n20-common-lib 3.3.12 → 3.3.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
<!-- 自定义审批项填写表单 -->
|
|
1
2
|
<template>
|
|
2
3
|
<div class="w-100p">
|
|
3
4
|
<div v-for="(item, i) in otherAttData" :key="i" class="flex-box m-l-m m-r-m">
|
|
@@ -139,27 +140,35 @@ export default {
|
|
|
139
140
|
// JSON解析失败时忽略
|
|
140
141
|
}
|
|
141
142
|
},
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
143
|
+
// 两个数据入口统一初始化,保证多选控件首次渲染时绑定响应式数组。
|
|
144
|
+
normalizeData(data = []) {
|
|
145
|
+
return data.map((sourceItem) => {
|
|
146
|
+
const item = { ...sourceItem }
|
|
147
|
+
const selectedValues = Array.isArray(item.cfgVal)
|
|
148
|
+
? [...item.cfgVal]
|
|
149
|
+
: item.cfgVal === undefined || item.cfgVal === null || item.cfgVal === ''
|
|
150
|
+
? []
|
|
151
|
+
: String(item.cfgVal).split(',')
|
|
152
|
+
|
|
153
|
+
if (item.cfgType === '32') {
|
|
154
|
+
item.checkList = Array.isArray(item.checkList) ? [...item.checkList] : selectedValues
|
|
155
|
+
}
|
|
156
|
+
if (item.cfgType === '31') {
|
|
157
|
+
item.selectList = Array.isArray(item.selectList) ? [...item.selectList] : selectedValues
|
|
158
|
+
}
|
|
159
|
+
this.setDefaultValue(item)
|
|
160
|
+
return item
|
|
161
|
+
})
|
|
162
|
+
},
|
|
163
|
+
getData(data = []) {
|
|
164
|
+
this.otherAttData = this.normalizeData(data)
|
|
146
165
|
this.$emit('loaded', this.otherAttData.length > 0)
|
|
147
166
|
if (this.taskId) {
|
|
148
167
|
axios
|
|
149
168
|
.post(`/bems/admin/customization/${this.taskId}`, null, { loading: false })
|
|
150
169
|
.then(({ data }) => {
|
|
151
170
|
if (data && data.length) {
|
|
152
|
-
this.otherAttData =
|
|
153
|
-
data?.map((item) => {
|
|
154
|
-
if (['32'].includes(item.cfgType)) {
|
|
155
|
-
item.checkList = item.checkList ? item.checkList : []
|
|
156
|
-
}
|
|
157
|
-
if (['31'].includes(item.cfgType)) {
|
|
158
|
-
item.selectList = item.selectList ? item.selectList : []
|
|
159
|
-
}
|
|
160
|
-
this.setDefaultValue(item)
|
|
161
|
-
return item
|
|
162
|
-
}) || []
|
|
171
|
+
this.otherAttData = this.normalizeData(data)
|
|
163
172
|
}
|
|
164
173
|
this.$emit('loaded', this.otherAttData.length > 0)
|
|
165
174
|
})
|