|
|
@ -1,13 +1,13 @@ |
|
|
|
<template> |
|
|
|
<div class="diy-container"> |
|
|
|
<div v-if="list.length > 0" class="diy-container"> |
|
|
|
<el-tabs v-model="activeName"> |
|
|
|
<el-tab-pane label="自定义模板" name="first"> |
|
|
|
<div class="diy-wr"> |
|
|
|
<div class="left"> |
|
|
|
<el-tabs tab-position="left" class="left-h"> |
|
|
|
<el-tab-pane v-for="item in list" :key="item.itemGroupId" :label="item.groupName"> |
|
|
|
<el-tab-pane v-for="item in list" :key="item.id" :label="item.label"> |
|
|
|
<div class="pd10 dialog-h-content scroll-h"> |
|
|
|
<checkBox :ref="'checkbox' + item.itemGroupId" |
|
|
|
<checkBox v-if="item.queryItemList" :ref="'checkbox' + item.id" |
|
|
|
:list="item.queryItemList" @change="handleChangeBox" /> |
|
|
|
</div> |
|
|
|
</el-tab-pane> |
|
|
@ -21,9 +21,9 @@ |
|
|
|
</div> |
|
|
|
<div> |
|
|
|
<el-collapse v-model="activeCollapse" id="collapsWr"> |
|
|
|
<el-collapse-item v-for="item in rightList" :key="item.itemGroupId" |
|
|
|
:title="item.groupName" :name="item.itemGroupId" class="col-h"> |
|
|
|
<dragItem :ref="'drag' + item.itemGroupId" :list="item.queryItemList" :id="item.itemGroupId" |
|
|
|
<el-collapse-item v-for="item in rightList" :key="item.id" |
|
|
|
:title="item.label" :name="item.id" class="col-h"> |
|
|
|
<dragItem :ref="'drag' + item.id" :list="item.queryItemList" :id="item.id" |
|
|
|
@del="handleDelItem" |
|
|
|
@drag="handleDrag($event, item)"></dragItem> |
|
|
|
</el-collapse-item> |
|
|
@ -162,8 +162,9 @@ export default { |
|
|
|
}, |
|
|
|
created() { |
|
|
|
this.list.forEach(item => { |
|
|
|
this.$set(this.info, item.itemGroupId, []) |
|
|
|
this.$set(this.info, item.id, []) |
|
|
|
}) |
|
|
|
console.log('infodiy----', this.list) |
|
|
|
this.getTemplateList() |
|
|
|
}, |
|
|
|
watch: { |
|
|
@ -181,12 +182,12 @@ export default { |
|
|
|
// if (list.length == 0) return |
|
|
|
let obj = {} |
|
|
|
this.list.forEach(item =>{ |
|
|
|
if (item.itemGroupId == pid) obj = { ...item, queryItemList: [...list] } |
|
|
|
if (item.id == pid) obj = { ...item, queryItemList: [...list] } |
|
|
|
}) |
|
|
|
const groups = this.rightList.map(item => item.itemGroupId) |
|
|
|
const groups = this.rightList.map(item => item.id) |
|
|
|
if (groups.includes(pid)) { |
|
|
|
this.rightList.forEach((item, i) => { |
|
|
|
if (item.itemGroupId == pid ) { |
|
|
|
if (item.id == pid ) { |
|
|
|
item.queryItemList = [...list] |
|
|
|
if (list.length == 0) this.rightList.splice(i, 1) |
|
|
|
} |
|
|
@ -203,13 +204,13 @@ export default { |
|
|
|
}, |
|
|
|
handleDelItem(val) { |
|
|
|
const { item, index } = val |
|
|
|
console.log('item------', item, this.$refs[`checkbox${item.itemGroupId}`]) |
|
|
|
const checkList = this.$refs[`checkbox${item.itemGroupId}`][0].checkedList |
|
|
|
console.log('item------', item, this.$refs[`checkbox${item.id}`]) |
|
|
|
const checkList = this.$refs[`checkbox${item.id}`][0].checkedList |
|
|
|
checkList.forEach((n, i) => { |
|
|
|
if (n == item.itemId) this.$refs[`checkbox${item.itemGroupId}`][0].checkedList.splice(i, 1) |
|
|
|
if (n == item.itemId) this.$refs[`checkbox${item.id}`][0].checkedList.splice(i, 1) |
|
|
|
}) |
|
|
|
this.rightList.forEach((n, i) => { |
|
|
|
if (n.itemGroupId === item.itemGroupId) { |
|
|
|
if (n.id === item.id) { |
|
|
|
n.queryItemList.splice(index, 1) |
|
|
|
if (n.queryItemList.length === 0) this.rightList.splice(i, 1) |
|
|
|
} |
|
|
@ -234,7 +235,7 @@ export default { |
|
|
|
console.log('drag-----', val) |
|
|
|
console.log('drag-----', item) |
|
|
|
this.rightList.forEach((n, i) => { |
|
|
|
if (item.itemGroupId == n.itemGroupId) n.queryItemList = [...val] |
|
|
|
if (item.id == n.id) n.queryItemList = [...val] |
|
|
|
}) |
|
|
|
}, |
|
|
|
handleClose() { |
|
|
@ -261,7 +262,7 @@ export default { |
|
|
|
if (this.rightList.length == 0) return this.$message.error('请选择导出信息') |
|
|
|
this.previewList = this.rightList.map(item => { |
|
|
|
return { |
|
|
|
label: item.groupName, |
|
|
|
label: item.label, |
|
|
|
children: item.queryItemList |
|
|
|
} |
|
|
|
}) |
|
|
@ -288,11 +289,11 @@ export default { |
|
|
|
formCode: 'resi_base_info', |
|
|
|
itemList: this.rightList.map(item => { |
|
|
|
return { |
|
|
|
itemId: item.itemGroupId, |
|
|
|
label: item.groupName, |
|
|
|
itemId: item.id, |
|
|
|
label: item.label, |
|
|
|
tableName: item.queryItemList[0].tableName, |
|
|
|
children: item.queryItemList, |
|
|
|
supportAdd: item.itemGroupId == '20220422102809_117' ? true : false |
|
|
|
supportAdd: item.supportAdd |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|