|
|
|
@ -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)" |
|
|
|
></div> |
|
|
|
|
|
|
|
<div |
|
|
|
v-else-if="item.type == 'checkbox'" |
|
|
|
> |
|
|
|
<div v-if="item.control.showAll"> |
|
|
|
|
|
|
|
<el-checkbox-group |
|
|
|
v-bind="item.control" |
|
|
|
:disabled="true" |
|
|
|
v-model="scope.row[item.name]" |
|
|
|
|
|
|
|
|
|
|
|
> |
|
|
|
<el-checkbox |
|
|
|
v-for="(item1, index) in item.options" |
|
|
|
:key="index" |
|
|
|
:label="transformOption(item1.value)" |
|
|
|
> |
|
|
|
<span >{{ item1.label }}</span> |
|
|
|
</el-checkbox> |
|
|
|
</el-checkbox-group> |
|
|
|
</div> |
|
|
|
<div v-else> |
|
|
|
|
|
|
|
{{ judgeCheckbox(scope.row[item.name], item.options) }} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div v-else-if="item.type == 'associatedForms'"> |
|
|
|
<AssociatedForms |
|
|
|
:data="item" |
|
|
|
|