|
|
@ -85,8 +85,8 @@ |
|
|
|
width="80%" |
|
|
|
append-to-body |
|
|
|
:close-on-click-modal="false" |
|
|
|
:before-close="handlerCancle"> |
|
|
|
<edit-resi v-if="dialogEditVisible" ref="baseForm" :fixed="true" :form-list="formList" @changegroup="handleChangeGroup" /> |
|
|
|
:before-close="handlerEditCancle"> |
|
|
|
<edit-resi v-if="dialogEditVisible" ref="baseForm" :form-info="editForm" :fixed="true" :form-list="formList" @changegroup="handleChangeGroup" /> |
|
|
|
<div v-if="dialogEditVisible" class="resi-other"> |
|
|
|
<div class="resi-other-title">其他</div> |
|
|
|
<div class="tabs-other-info"> |
|
|
@ -100,8 +100,8 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="resi-btns"> |
|
|
|
<el-button size="small" @click="handlerCancle">取消</el-button> |
|
|
|
<el-button type="primary" size="small" @click="handleSUbmit">提交</el-button> |
|
|
|
<el-button size="small" @click="handlerEditCancle">取消</el-button> |
|
|
|
<el-button type="primary" size="small" @click="handleEditSUbmit">提交</el-button> |
|
|
|
</div> |
|
|
|
</el-dialog> |
|
|
|
|
|
|
@ -132,6 +132,15 @@ export default { |
|
|
|
tableData: [], |
|
|
|
searchList: [], |
|
|
|
value: '', |
|
|
|
editForm: { |
|
|
|
GRID_ID: '', |
|
|
|
VILLAGE_ID: '', |
|
|
|
BUILD_ID: '', |
|
|
|
HOME_ID: '' |
|
|
|
}, |
|
|
|
editTableName: { |
|
|
|
|
|
|
|
}, |
|
|
|
formList: [], |
|
|
|
tableHeader: [], |
|
|
|
tabsForm: [{ |
|
|
@ -180,7 +189,7 @@ export default { |
|
|
|
}, |
|
|
|
async created () { |
|
|
|
await this.getSearchList() |
|
|
|
await this.getFormList() |
|
|
|
// await this.getFormList() |
|
|
|
await this.getTableHeader() |
|
|
|
this.getTableData() |
|
|
|
this.pageLoading = true |
|
|
@ -215,10 +224,12 @@ export default { |
|
|
|
handleClick (tab, event) { |
|
|
|
console.log(tab, event) |
|
|
|
}, |
|
|
|
handleEdit (row) { |
|
|
|
async handleEdit (row) { |
|
|
|
await this.getFormList() |
|
|
|
this.getrowInfo(row.icResiUserId) |
|
|
|
}, |
|
|
|
handleAdd () { |
|
|
|
async handleAdd () { |
|
|
|
await this.getFormList() |
|
|
|
this.dialogVisible = true |
|
|
|
}, |
|
|
|
async handleChangeGroup (val) { |
|
|
@ -251,6 +262,59 @@ export default { |
|
|
|
if (hasT) this.tabsList.splice(i, 1) |
|
|
|
} |
|
|
|
}, |
|
|
|
handleEditSUbmit () { |
|
|
|
const _baseForm = this.$refs.baseForm.handleForm() |
|
|
|
let arr = [] |
|
|
|
// let arr1 = [] |
|
|
|
if (_baseForm.length === 0) return false |
|
|
|
arr.push([ ..._baseForm ]) |
|
|
|
this.tabsList.forEach(item => { |
|
|
|
// console.log('groupInfo', this.$refs['group' + item.groupId][0].handleForm()) |
|
|
|
arr.push([ ...this.$refs['group' + item.groupId][0].handleForm() ]) |
|
|
|
}) |
|
|
|
let arr2 = arr.reduce(function (a, b) { return a.concat(b) }) |
|
|
|
// console.log('arrr555-----sub', arr2) |
|
|
|
let noChange = true |
|
|
|
arr2.forEach(item => { |
|
|
|
if (item.list.length !== 0) noChange = false |
|
|
|
}) |
|
|
|
if (noChange) return this.$message.warning('您还没有做任何修改') |
|
|
|
// 合并相同tableName的多个数组 |
|
|
|
let hash = {} |
|
|
|
let i = 0 |
|
|
|
let res = [] |
|
|
|
let finalArr = [] |
|
|
|
arr2.forEach(function (item) { |
|
|
|
// console.log('arrr666-----sub', item) |
|
|
|
let name = item.tableName |
|
|
|
if (hash[name]) { |
|
|
|
res[hash[name] - 1].list.push(...item.list) |
|
|
|
// console.log('hash[name]---', hash[name], res, res[hash[name] - 1], item) |
|
|
|
} else { |
|
|
|
hash[name] = ++i |
|
|
|
res.push({ |
|
|
|
list: [...item.list], |
|
|
|
supportAdd: item.supportAdd, |
|
|
|
tableName: name |
|
|
|
}) |
|
|
|
// console.log('hash[name]0000---', hash[name], res) |
|
|
|
} |
|
|
|
}) |
|
|
|
// 多个list合并成一个list子集 |
|
|
|
res.forEach(item => { |
|
|
|
// console.log('arrr777-----sub', item) |
|
|
|
let _form = {} |
|
|
|
item.list.forEach(n => { |
|
|
|
_form = { ..._form, ...n } |
|
|
|
}) |
|
|
|
finalArr.push({ |
|
|
|
tableName: item.tableName, |
|
|
|
list: item.supportAdd ? [...item.list] : [{ ..._form }] |
|
|
|
}) |
|
|
|
}) |
|
|
|
// console.log('editInfo---', res, finalArr) |
|
|
|
this.submitEdit(finalArr) |
|
|
|
}, |
|
|
|
handleSUbmit () { |
|
|
|
console.log('baseform', this.$refs.baseForm.handleForm()) |
|
|
|
const _baseForm = this.$refs.baseForm.handleForm() |
|
|
@ -303,6 +367,13 @@ export default { |
|
|
|
handleFormatUrl (url) { |
|
|
|
return url.includes('?') |
|
|
|
}, |
|
|
|
handlerEditCancle () { |
|
|
|
this.$refs.baseForm.resetForm() |
|
|
|
this.tabsList.forEach(item => { |
|
|
|
this.$refs['group' + item.groupId][0].resetForm() |
|
|
|
}) |
|
|
|
this.dialogEditVisible = false |
|
|
|
}, |
|
|
|
handlerCancle () { |
|
|
|
this.$refs.baseForm.resetForm() |
|
|
|
this.tabsList.forEach(item => { |
|
|
@ -322,8 +393,8 @@ export default { |
|
|
|
this.$refs.baseForm.resetForm() |
|
|
|
this.tabsList.forEach(item => { |
|
|
|
this.$refs['group' + item.groupId][0].resetForm() |
|
|
|
this.getTableData() |
|
|
|
}) |
|
|
|
this.getTableData() |
|
|
|
this.dialogVisible = false |
|
|
|
} |
|
|
|
}) |
|
|
@ -331,6 +402,27 @@ export default { |
|
|
|
return this.$message.error('网络错误') |
|
|
|
}) |
|
|
|
}, |
|
|
|
submitEdit (arr) { |
|
|
|
this.$http |
|
|
|
.post('/epmetuser/icresiuser/edit', arr) |
|
|
|
.then(({ data: res }) => { |
|
|
|
if (res.code !== 0) { |
|
|
|
return this.$message.error(res.msg) |
|
|
|
} else { |
|
|
|
this.$message.success('提交成功') |
|
|
|
// this.$refs[formName].resetFields(); |
|
|
|
this.$refs.baseForm.resetForm() |
|
|
|
this.tabsList.forEach(item => { |
|
|
|
this.$refs['group' + item.groupId][0].resetForm() |
|
|
|
}) |
|
|
|
this.getTableData() |
|
|
|
this.dialogEditVisible = false |
|
|
|
} |
|
|
|
}) |
|
|
|
.catch(() => { |
|
|
|
return this.$message.error('网络错误') |
|
|
|
}) |
|
|
|
}, |
|
|
|
getTableHeader () { |
|
|
|
this.$http |
|
|
|
.post('/oper/customize/icform/tableheaders', { formCode: 'resi_base_info' }) |
|
|
@ -377,9 +469,13 @@ export default { |
|
|
|
if (res.code !== 0) { |
|
|
|
return this.$message.error(res.msg) |
|
|
|
} else { |
|
|
|
console.log('getrowInfo----', res.data) |
|
|
|
// console.log('getrowInfo----', res.data) |
|
|
|
let info = res.data |
|
|
|
this.editTableName = { ...info } |
|
|
|
let list = info[this.formList[0].tableName][0] |
|
|
|
for (let n in list) { |
|
|
|
this.editForm[n] = list[n] |
|
|
|
} |
|
|
|
this.formList.forEach(item => { |
|
|
|
if (item.childGroup && info[item.childGroup.tableName]) { |
|
|
|
// let _info = info[item.childGroup.tableName] |
|
|
@ -389,47 +485,53 @@ export default { |
|
|
|
this.tabsList.push(item.childGroup) |
|
|
|
} |
|
|
|
item.columnValue = list[item.columnName] |
|
|
|
item.ID = list.ID |
|
|
|
}) |
|
|
|
let mutiList = [] |
|
|
|
this.tabsList.forEach(item => { |
|
|
|
let _info = info[item.tableName] |
|
|
|
let _list = [...item.itemList] |
|
|
|
if (item.supportAdd) { |
|
|
|
// console.log('tabsList---333', item.label) |
|
|
|
const _list = [...item.itemList] |
|
|
|
let mutiList = [] |
|
|
|
if (_info) { |
|
|
|
_info.forEach((fo, index) => { |
|
|
|
// console.log('mutiList----555' + index, mutiList, _list) |
|
|
|
mutiList.splice(index, 0, { |
|
|
|
row: index, |
|
|
|
itemList: _list.map(m => { |
|
|
|
// console.log('itemList---item' + index, m) |
|
|
|
return { |
|
|
|
...m, |
|
|
|
ID: fo.ID, |
|
|
|
columnValue: fo[m.columnName] |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
console.log('mutiList----666' + index, mutiList) |
|
|
|
// console.log('mutiList----666' + index, mutiList) |
|
|
|
}) |
|
|
|
} |
|
|
|
item.mutiList = mutiList |
|
|
|
} else { |
|
|
|
if (_info) { |
|
|
|
item.itemList.forEach(n => { |
|
|
|
n.ID = _info[0].ID |
|
|
|
n.columnValue = _info[0][n.columnName] |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
console.log('getrowInfo---formname', this.tabsList) |
|
|
|
// console.log('getrowInfo---formname', this.tabsList) |
|
|
|
this.dialogEditVisible = true |
|
|
|
} |
|
|
|
}) |
|
|
|
.catch(() => { |
|
|
|
console.log('getrowInfo---formname', 0) |
|
|
|
.catch((err) => { |
|
|
|
console.log('getrowInfo---formnameerr', err) |
|
|
|
return this.$message.error('网络错误') |
|
|
|
}) |
|
|
|
}, |
|
|
|
async getOptionsList (url) { |
|
|
|
let options = [] |
|
|
|
console.log('getOptionsList----', url) |
|
|
|
// console.log('getOptionsList----', url) |
|
|
|
await this.$http |
|
|
|
.post(url, { formCode: 'resi_base_info' }) |
|
|
|
.then(({ data: res }) => { |
|
|
@ -451,10 +553,9 @@ export default { |
|
|
|
if (res.code !== 0) { |
|
|
|
return this.$message.error(res.msg) |
|
|
|
} else { |
|
|
|
console.log('获取查询详情成功', res.data) |
|
|
|
// console.log('获取查询详情成功', res.data) |
|
|
|
this.searchList = res.data |
|
|
|
res.data.forEach(item => { |
|
|
|
console.log('optionSourceType---000', item.optionSourceType, item.optionSourceValue, item.label) |
|
|
|
if (item.optionSourceType === 'remote') { |
|
|
|
this.getOptionsList(item.optionSourceValue).then(res => { |
|
|
|
item.options = res |
|
|
@ -468,40 +569,35 @@ export default { |
|
|
|
return this.$message.error('网络错误') |
|
|
|
}) |
|
|
|
}, |
|
|
|
getFormList () { |
|
|
|
this.$http |
|
|
|
async getFormList () { |
|
|
|
await this.$http |
|
|
|
.post('/oper/customize/icform/getcustomerform', { formCode: 'resi_base_info', dynamic: true }) |
|
|
|
.then(({ data: res }) => { |
|
|
|
if (res.code !== 0) { |
|
|
|
return this.$message.error(res.msg) |
|
|
|
} else { |
|
|
|
console.log('获取详情成功') |
|
|
|
console.log('获取详情成功getFormList') |
|
|
|
let { itemList, groupList } = res.data |
|
|
|
// this.details = res.data /oper/customize/icform/conditionlist |
|
|
|
this.formList = res.data.itemList |
|
|
|
this.tabsList = res.data.groupList |
|
|
|
this.activeName = 'group' + res.data.groupList[0].groupId |
|
|
|
itemList.forEach(item => { |
|
|
|
itemList.forEach(async item => { |
|
|
|
if (item.optionSourceType === 'remote') { |
|
|
|
console.log('optionSourceType-111', this.handleFormatUrl(item.optionSourceValue), item.optionSourceValue) |
|
|
|
this.getOptionsList(item.optionSourceValue).then(res => { |
|
|
|
await this.getOptionsList(item.optionSourceValue).then(res => { |
|
|
|
item.options = res |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
groupList.forEach(item => { |
|
|
|
item.itemList.forEach(n => { |
|
|
|
item.itemList.forEach(async n => { |
|
|
|
n.tableName = item.tableName |
|
|
|
if (n.optionSourceType === 'remote') { |
|
|
|
this.getOptionsList(n.optionSourceValue).then(res => { |
|
|
|
await this.getOptionsList(n.optionSourceValue).then(res => { |
|
|
|
n.options = res |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
// if (item.supportAdd) { |
|
|
|
// item.itemList = [ item.itemList ] |
|
|
|
// } |
|
|
|
}) |
|
|
|
this.formList = itemList |
|
|
|
this.tabsList = groupList |
|
|
|
} |
|
|
|
}) |
|
|
|
.catch(() => { |
|
|
|