|
|
@@ -178,6 +178,7 @@
|
|
|
import BaseButton from '@/components/base-button.vue'
|
|
|
import uploads from '@/components/uploads.vue'
|
|
|
import { useStore } from '@/store/user.js'
|
|
|
+import { unique } from '@/utils/tools.js'
|
|
|
|
|
|
export default {
|
|
|
name: 'form_dialog',
|
|
|
@@ -420,9 +421,23 @@ export default {
|
|
|
} else {
|
|
|
this.fieldType[index].params = tmps
|
|
|
}
|
|
|
+ // list to params
|
|
|
+ const keys = unique(this.fieldType[index].params.map(sub => sub.type))
|
|
|
+ console.log(keys)
|
|
|
+ for (const key in keys) {
|
|
|
+ const tmp = this.fieldType[index].params = this.groupBy(this.fieldType[index].params, key)
|
|
|
+ console.log(tmp)
|
|
|
+ }
|
|
|
+
|
|
|
this.fieldType[index].count = this.fieldType[index].params.filter(e => e.checked).length
|
|
|
this.fieldType[index].checkAll = this.fieldType[index].count === this.fieldType[index].params.length
|
|
|
},
|
|
|
+ groupBy (xs, key) {
|
|
|
+ return xs.reduce(function (rv, x) {
|
|
|
+ (rv[x[key]] = rv[x[key]] || []).push(x)
|
|
|
+ return rv
|
|
|
+ }, {})
|
|
|
+ },
|
|
|
importExcel () {
|
|
|
if (this.attaches && this.attaches.length === 0) {
|
|
|
this.$message.error('请选择要上传的文件')
|