hookehuyr

feat(表单组件): 为表单字段添加分数显示功能

在CheckboxField、PickerField和RadioField组件中添加分数显示功能,当item.component_props.score存在时显示分数
在index.vue中修改分页构建逻辑,仅在add或undefined页面类型时构建分页,并在只读模式下设置分数值
<!--
* @Date: 2022-08-30 11:34:19
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-06-10 14:38:18
* @LastEditTime: 2025-11-24 16:50:52
* @FilePath: /data-table/src/components/CheckboxField/index.vue
* @Description: 多项选择控件
-->
......@@ -14,6 +14,7 @@
<span v-if="item.component_props.max" style="color: gray">
(最多可选数:&nbsp;{{ item.component_props.max }})
</span>
<span v-if="item.component_props.score" style="margin-left: 0.5rem; color: red;">({{ item.component_props.score }} 分)</span>
</div>
<div v-if="item.component_props.note" class="note" v-html="item.component_props.note" />
<van-field v-if="!item.component_props.readonly" :rules="item.rules" :border="false">
......
<!--
* @Date: 2022-08-30 13:46:51
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-11-20 18:23:21
* @LastEditTime: 2025-11-24 16:52:05
* @FilePath: /data-table/src/components/PickerField/index.vue
* @Description: 单列选择器组件
-->
......@@ -11,6 +11,7 @@
<span v-if="item.component_props.disabled_show"><van-icon name="https://cdn.ipadbiz.cn/custom_form/icon/closed-eye1.png" /></span>
<span v-if="item.component_props.required" style="color: red">&nbsp;*</span>
<span :class="[ReadonlyShow ? 'readonly-show' : '']">{{ item.component_props.label }}</span>
<span v-if="item.component_props.score" style="margin-left: 0.5rem; color: red;">({{ item.component_props.score }} 分)</span>
</div>
<van-field :name="item.name" :rules="item.rules" style="padding: 0;">
<template #input>
......
<!--
* @Date: 2022-08-30 11:34:19
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-03-27 14:17:04
* @LastEditTime: 2025-11-24 15:01:52
* @FilePath: /data-table/src/components/RadioField/index.vue
* @Description: 单项选择控件
-->
......@@ -11,6 +11,7 @@
<span v-if="item.component_props.disabled_show"><van-icon name="https://cdn.ipadbiz.cn/custom_form/icon/closed-eye1.png" /></span>
<span v-if="item.component_props.required" style="color: red">&nbsp;*</span>
<span :class="[ReadonlyShow ? 'readonly-show' : '']">{{ item.component_props.label }}</span>
<span v-if="item.component_props.score" style="margin-left: 0.5rem; color: red;">({{ item.component_props.score }} 分)</span>
</div>
<div v-if="item.component_props.note" class="note" v-html="item.component_props.note" />
<van-field v-if="!item.component_props.readonly" :rules="item.rules">
......@@ -149,7 +150,7 @@ const onBlur = (item) => {
// 发送自定义数据结构
props.item.value = { key: props.item.key, value: radio_value.value, affix: affix_value.value, type: "radio" };
emit("active", props.item.value);
// 适配cookie保存未完成表单
const currentValue = affix_value.value ? affix_value.value : radio_value.value;
const existingCookie = Cookies.get($route.query.code);
......
<!--
* @Date: 2022-07-18 10:22:22
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-11-20 17:47:01
* @LastEditTime: 2025-11-24 16:40:46
* @FilePath: /data-table/src/views/index.vue
* @Description: 首页
-->
......@@ -495,8 +495,10 @@ onMounted(async () => {
formData.value = formatData(page_form);
// TAG: 构建分页组件
buildPages();
enable_pagination.value = filtered_pages.value.length > 1;
if (page_type === 'add' || page_type === undefined) {
buildPages();
enable_pagination.value = filtered_pages.value.length > 1;
}
/**** END ****/
// TAG:获取原来表单数据
......@@ -514,6 +516,9 @@ onMounted(async () => {
if (isInfoPage) {
item.component_props.readonly = true;
PCommit.value.visible = false; // 只读模式下,提交按钮隐藏
// 处理分页表单结果数据
const score_map = object.x_score_map;
item.component_props.score = score_map[item.key] || '';
}
}
});
......