diff --git a/src/components/DesignForm/public/form/childTable.vue b/src/components/DesignForm/public/form/childTable.vue index 8452665..284a865 100644 --- a/src/components/DesignForm/public/form/childTable.vue +++ b/src/components/DesignForm/public/form/childTable.vue @@ -190,8 +190,50 @@ const timeToString = (timeVal: any, types: int) => { }; +// 将字符类数字转为数值类 +const formatNumber = (val: any) => { + // 将字符类数字转为数值类 + if (typeof val === 'string' && /^\d+(\.\d+)?$/.test(val.toString())) { + // 为数字 + return Number(val) + } else { + return val + } +} +const config = computed(() => { + return props.data.config || {}; +}); +const transformOption = (val: string | number, type?: string) => { + switch (config.value.transformData || type) { + case "none": + return val; + case "string": + try { + return val.toString(); + } catch (e) { + return val; + } + } + return formatNumber(val); +}; - +const judgeCheckbox = (val: any, list: any) => { + let valAry = []; + if (Array.isArray(val)) { + if (val.length > 0) { + if (Array.isArray(list)) { + val.forEach((item) => { + list.forEach((ltem) => { + if (item == ltem.value) { + valAry.push(ltem.label); + } + }); + }); + } + } + } + return valAry.join(',');; +}; let associatedFormsIndexTablekey = 0; /* const emits = defineEmits<{ @@ -248,6 +290,34 @@ function optionsValue3Get1(data: any, fieldName: string) { v-else-if="item.type == 'datePicker'" v-html="timeToString(scope.row[item.name], item.control.type)" > + +
+
+ + + + {{ item1.label }} + + +
+
+ + {{ judgeCheckbox(scope.row[item.name], item.options) }} +
+
+
{ >
{{ judgeCheckbox(value, data.options) }}
+ { @change="onValueChange(data.type)" :style="getFormItemInputStyle(configStyle, 4)" > +