hookehuyr

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

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