jiangyy 4 years ago
parent
commit
7563bce86b
  1. 154
      epmet-oper-web/src/views/components/editResi.vue
  2. 63
      epmet-oper-web/src/views/components/resiForm.vue
  3. 175
      epmet-oper-web/src/views/modules/base/resi.vue

154
epmet-oper-web/src/views/components/editResi.vue

@ -7,8 +7,8 @@
<el-button icon="el-icon-plus" size="small" @click="handleAddRow"></el-button>
</el-col>
</el-row>
<resi-form v-for="(item, index) in addList" :key="index" :ref="'baseForms' + index" :columns="3"
:form-list="item.itemList" :form-id="'baseForms' + item" />
<edit-form v-for="(item, index) in addList" :key="index" :ref="'baseForms' + index" :columns="3"
:form-list="item.itemList || formList" :form-id="'baseForms' + item.row" />
</template>
<template v-else>
<el-row v-if="fixed" class="resi-row">
@ -18,7 +18,7 @@
<!-- <div class="resi-cell"> -->
<!-- <div class="resi-cell-label">{{n.label}}</div> -->
<div class="resi-cell-value">
<el-select v-model="form.GRID_ID" placeholder="请选择网格" size="small"
<el-select v-model="form.GRID_ID" :disabled="disabled" placeholder="请选择网格" size="small"
clearable class="resi-cell-select"
>
<el-option
@ -37,7 +37,7 @@
<!-- <div class="resi-cell"> -->
<!-- <div class="resi-cell-label">{{n.label}}</div> -->
<div class="resi-cell-value">
<el-select v-model="form.VILLAGE_ID" placeholder="请选择小区" size="small"
<el-select v-model="form.VILLAGE_ID" :disabled="disabled" placeholder="请选择小区" size="small"
clearable class="resi-cell-select"
>
<el-option
@ -56,7 +56,7 @@
<!-- <div class="resi-cell"> -->
<!-- <div class="resi-cell-label">{{n.label}}</div> -->
<div class="resi-cell-value">
<el-select v-model="form.BUILD_ID" placeholder="请选择楼号" size="small"
<el-select v-model="form.BUILD_ID" :disabled="disabled" placeholder="请选择楼号" size="small"
clearable class="resi-cell-select"
>
<el-option
@ -75,7 +75,7 @@
<!-- <div class="resi-cell"> -->
<!-- <div class="resi-cell-label">{{n.label}}</div> -->
<div class="resi-cell-value">
<el-select v-model="form.HOME_ID" placeholder="请选择" size="small"
<el-select v-model="form.HOME_ID" :disabled="disabled" placeholder="请选择" size="small"
clearable class="resi-cell-select"
>
<el-option
@ -102,6 +102,7 @@
<el-input
v-if="n.validType"
v-model="form[n.columnName]"
:disabled="disabled"
class="resi-cell-input"
size="small"
clearable
@ -111,6 +112,7 @@
<el-input
v-else
v-model="form[n.columnName]"
:disabled="disabled"
class="resi-cell-input"
size="small"
clearable
@ -132,6 +134,7 @@
<el-date-picker
v-else-if="n.itemType === 'datepicker'"
v-model="form[n.columnName]"
:disabled="disabled"
class="resi-cell-input"
type="date"
size="small"
@ -143,6 +146,7 @@
<el-date-picker
v-else-if="n.itemType === 'dateRange'"
v-model="form[n.columnName]"
:disabled="disabled"
type="daterange"
align="right"
unlink-panels
@ -154,11 +158,13 @@
<el-time-picker
v-else-if="n.itemType === 'timepicker'"
v-model="form[n.columnName]"
:disabled="disabled"
placeholder="任意时间点">
</el-time-picker>
<el-time-picker
v-else-if="n.itemType === 'timeRange'"
v-model="form[n.columnName]"
:disabled="disabled"
is-range
range-separator="至"
start-placeholder="开始时间"
@ -167,6 +173,7 @@
</el-time-picker>
<el-select v-else-if="n.itemType === 'select'" v-model="form[n.columnName]"
:multiple="n.multiSelect"
:disabled="disabled"
placeholder="请选择" size="small" clearable class="resi-cell-select">
<el-option
v-for="item in n.options || options"
@ -184,12 +191,14 @@
v-model="form[n.columnName]"
:options="n.options"
:props="{ checkStrictly: true }"
:disabled="disabled"
clearable
size="small"
@blur="handleChange"
class="resi-cell-select">
</el-cascader>
<template v-else-if="n.itemType === 'radio'">
<el-radio v-for="ns in n.options" :key="ns.value" v-model="form[n.columnName]"
<el-radio v-for="ns in n.options" :key="ns.value" v-model="form[n.columnName]" :disabled="disabled"
:label="ns.value">
{{ ns.label }}
</el-radio>
@ -197,7 +206,7 @@
</template>
<template v-else-if="n.itemType === 'checkbox'">
<el-checkbox-group v-model="form[n.columnName]">
<el-checkbox v-for="ns in n.options" :key="ns.value" :label="ns.value">{{ns.label}}</el-checkbox>
<el-checkbox v-for="ns in n.options" :key="ns.value" :label="ns.value" :disabled="disabled">{{ns.label}}</el-checkbox>
<!-- <el-checkbox label="n.la"></el-checkbox> -->
</el-checkbox-group>
</template>
@ -215,7 +224,7 @@
import { isCard, isMobile } from '@/utils/validate'
export default {
name: 'resiForm',
name: 'editForm',
props: {
fixed: {
type: Boolean,
@ -255,6 +264,10 @@ export default {
supportAdd: { //
type: Boolean,
default: false
},
disabled: { //
type: Boolean,
default: false
}
},
data () {
@ -285,14 +298,15 @@ export default {
// console.log('formInfo', obj)
if (Object.keys(obj).length > 0) {
_form = { ...obj }
return _form
// return _form
}
arr.forEach(item => {
if (item.multiSelect || item.itemType === 'cascader') {
if (item.columnValue && item.columnValue.indexOf(',') > -1) _form[item.columnName] = item.columnValue.split(',')
else _form[item.columnName] = [item.columnValue]
} else _form[item.columnName] = item.columnValue
else _form[item.columnName] = (item.columnValue && [item.columnValue]) || []
} else _form[item.columnName] = item.columnValue || ''
})
// console.log('_from0000---', arr)
return _form
}
let initRules = (arr) => {
@ -320,45 +334,19 @@ export default {
let rules = initRules(this.formList)
let tempFormList = [ ...this.formList ]
let constForm = {
...form,
GRID_ID: '',
VILLAGE_ID: '',
BUILD_ID: '',
HOME_ID: ''
...form
}
return {
openSearch: false,
options: [{
value: '选项1',
label: '黄金糕'
}, {
value: '选项2',
label: '双皮奶'
}, {
value: '选项3',
label: '蚵仔煎'
}, {
value: '选项4',
label: '龙须面'
}, {
value: '选项5',
label: '北京烤鸭'
}],
fixedForm: {
GRID_ID: '',
VILLAGE_ID: '',
BUILD_ID: '',
HOME_ID: ''
},
fixedList: {
AGENCY_ID: this.$store.state.user.agencyId
},
fixedList: {},
form: {
...form,
GRID_ID: '',
VILLAGE_ID: '',
BUILD_ID: '',
HOME_ID: ''
...form
},
constForm,
tempFormList,
@ -370,7 +358,6 @@ export default {
optionsB: [],
optionsH: [],
optionsG: [],
checkList: ['选中且禁用', '复选框 A'],
pickerOptions: {
shortcuts: [{
text: '最近一周',
@ -441,7 +428,7 @@ export default {
watch: {
form: {
handler (val, val2) {
// console.log('valpppp----', val, val2)
console.log('valpppp----', val, val2)
for (let n in val) {
if (this.constForm[n] !== val[n]) {
this.handleChangeForm(n)
@ -455,30 +442,38 @@ export default {
}
},
created () {
// this.initForm()
this.initForm()
// console.log('formInfo---ggg', this.form)
if (this.supportAdd) {
this.addList = [...this.mutiList]
// console.log('addList----111', this.addList)
}
// } this.addList.push(this.addCount++)
this.getOptionsList()
if (this.fixed) this.getOptionsList()
},
methods: {
initForm () {
console.log('formInfo', this.formInfo)
if (Object.keys(this.formInfo).length > 0) {
this.form = { ...this.formInfo }
return
}
this.formList.forEach(item => {
this.$set(this.form, item.columnName, '')
// console.log('formInfo', this.formInfo)
// if (Object.keys(this.formInfo).length > 0) {
// this.form = { ...this.formInfo }
// return
// }
this.formList.forEach(async item => {
if (item.optionSourceType === 'remote') {
await this.getOptionsLists(item.optionSourceValue).then(res => {
item.options = res
})
}
})
},
handleOpenSearch () {
this.openSearch = !this.openSearch
},
handleAddRow () {
this.addList.push(this.addCount++)
this.addList.push({
row: this.addList.length,
itemList: this.formList
})
},
//
handleFiexedForm (val) {
@ -500,31 +495,26 @@ export default {
// form
handleChangeForm (val) {
if (this.fixed) {
// let item = {}
for (let n in this.fixedForm) {
if (n === val) {
// item = {
// [val]: this.form[val]
// }
// this.fixedList.push(item)
this.$set(this.fixedList, val, this.form[val])
}
}
}
console.log('fixedList----999', this.fixedList)
this.tempFormList.forEach(item => {
if (item.columnName === val) item.isChange = true
})
},
handleChange () {
// this.handleForm()
},
handlerMuscForm () {
let arr = []
this.addList.forEach(item => {
// console.log('handlerMuscForm----000', this.$refs['baseForms' + item][0].handleForm())
arr.push([ ...this.$refs['baseForms' + item][0].handleForm() ])
// console.log('handlerMuscForm----000', this.$refs['baseForms' + item.row || item][0].handleForm())
arr.push([ ...this.$refs['baseForms' + item.row][0].handleForm() ])
})
// console.log('handlerMuscForm----111', arr)
let arr2 = arr.reduce(function (a, b) { return a.concat(b) })
// console.log('handlerMuscForm----222', arr2)
let hash = {}
let i = 0
let res = []
@ -533,7 +523,6 @@ export default {
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({
@ -541,10 +530,8 @@ export default {
supportAdd: this.supportAdd,
tableName: name
})
// console.log('hash[name]0000---', hash[name], res)
}
})
// console.log('handlerMuscForm----333', res)
return res
},
resetForm () {
@ -561,26 +548,38 @@ export default {
var name = item.tableName
hash[name] ? res[hash[name] - 1].list.push(item) : hash[name] = ++i && res.push({
list: [item],
ID: item.ID,
tableName: name
})
})
// console.log('resssssss', res)
res.forEach(item => {
let _form = {}
// let ID = item.list[0].ID
item.list.filter(n => n.isChange).forEach(r => {
_form[r.columnName] = r.multiSelect || r.itemType === 'cascader' ? this.form[r.columnName].toString() : this.form[r.columnName]
if (r.ID) {
_form.ID = r.ID
}
// return _form
})
if (this.fixed) {
for (let n in this.fixedList) {
_form[n] = this.fixedList[n]
}
if (Object.keys(_form).length > 0) {
_form.AGENCY_ID = this.$store.state.user.agencyId
}
}
// console.log('objeckeyssss', Object.keys(_form), _form, this.form)
newForm.push({
tableName: item.tableName,
supportAdd: this.supportAdd,
list: [{ ..._form }]
ID: item.ID,
list: Object.keys(_form).length > 0 ? [{ ..._form }] : []
})
})
// console.log('newFormhhhhh', newForm)
return newForm
} else {
console.log('error submit!!')
@ -590,6 +589,23 @@ export default {
if (this.supportAdd) newForm = this.handlerMuscForm()
return newForm
},
async getOptionsLists (url) {
let options = []
// console.log('getOptionsList----', url)
await this.$http
.post(url, { formCode: 'resi_base_info' })
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
} else {
options = res.data
}
})
.catch(() => {
return this.$message.error('网络错误')
})
return options
},
getOptionsList () {
const { user } = this.$store.state
this.$http
@ -598,7 +614,6 @@ export default {
if (res.code !== 0) {
return this.$message.error(res.msg)
} else {
console.log('获取查询详情成功', res.data)
this.optionsG = res.data
}
})
@ -611,7 +626,6 @@ export default {
if (res.code !== 0) {
return this.$message.error(res.msg)
} else {
console.log('获取查询详情成功', res.data)
this.optionsV = res.data
}
})
@ -624,7 +638,6 @@ export default {
if (res.code !== 0) {
return this.$message.error(res.msg)
} else {
console.log('获取查询详情成功', res.data)
this.optionsB = res.data
}
})
@ -637,7 +650,6 @@ export default {
if (res.code !== 0) {
return this.$message.error(res.msg)
} else {
console.log('获取查询详情成功', res.data)
this.optionsH = res.data
}
})

63
epmet-oper-web/src/views/components/resiForm.vue

@ -283,6 +283,12 @@ export default {
arr.forEach(item => {
if (item.multiSelect) _form[item.columnName] = []
else _form[item.columnName] = ''
// if (item.optionSourceType === 'remote') {
// this.getOptionsLists(item.optionSourceValue).then(res => {
// item.options = res
// })
// }
})
return _form
}
@ -309,6 +315,7 @@ export default {
}
let form = initForm(this.formInfo, this.formList)
let rules = initRules(this.formList)
console.log('rulessss', rules)
let tempFormList = [ ...this.formList ]
let constForm = {
...form,
@ -319,22 +326,6 @@ export default {
}
return {
openSearch: false,
options: [{
value: '选项1',
label: '黄金糕'
}, {
value: '选项2',
label: '双皮奶'
}, {
value: '选项3',
label: '蚵仔煎'
}, {
value: '选项4',
label: '龙须面'
}, {
value: '选项5',
label: '北京烤鸭'
}],
fixedForm: {
GRID_ID: '',
VILLAGE_ID: '',
@ -361,7 +352,6 @@ export default {
optionsB: [],
optionsH: [],
optionsG: [],
checkList: ['选中且禁用', '复选框 A'],
pickerOptions: {
shortcuts: [{
text: '最近一周',
@ -449,17 +439,17 @@ export default {
// this.initForm()
// console.log('formInfo---ggg', this.form)
if (this.supportAdd) this.addList.push(this.addCount++)
this.getOptionsList()
if (this.fixed) this.getOptionsList()
},
methods: {
initForm () {
console.log('formInfo', this.formInfo)
if (Object.keys(this.formInfo).length > 0) {
this.form = { ...this.formInfo }
return
}
this.formList.forEach(item => {
this.$set(this.form, item.columnName, '')
this.formList.forEach(async item => {
console.log('initform---item', item.label, item.optionSourceType)
// if (item.optionSourceType === 'remote') {
// await this.getOptionsLists(item.optionSourceValue).then(res => {
// item.options = res
// })
// }
})
},
handleOpenSearch () {
@ -479,6 +469,7 @@ export default {
//
handleChangeGroup (columnName, value) {
this.tempFormList.forEach(item => {
// console.log('columnName', item.columnName, columnName)
if (item.columnName === columnName && item.itemType === 'radio' && item.childGroup) {
console.log('columnName', item.columnName, columnName)
this.$emit('changegroup', { value, childGroup: item.childGroup })
@ -566,7 +557,7 @@ export default {
newForm.push({
tableName: item.tableName,
supportAdd: this.supportAdd,
list: [{ ..._form }]
list: Object.keys(_form).length > 0 ? [{ ..._form }] : []
})
})
return newForm
@ -586,7 +577,6 @@ export default {
if (res.code !== 0) {
return this.$message.error(res.msg)
} else {
console.log('获取查询详情成功', res.data)
this.optionsG = res.data
}
})
@ -599,7 +589,6 @@ export default {
if (res.code !== 0) {
return this.$message.error(res.msg)
} else {
console.log('获取查询详情成功', res.data)
this.optionsV = res.data
}
})
@ -612,7 +601,6 @@ export default {
if (res.code !== 0) {
return this.$message.error(res.msg)
} else {
console.log('获取查询详情成功', res.data)
this.optionsB = res.data
}
})
@ -632,6 +620,23 @@ export default {
.catch(() => {
return this.$message.error('网络错误')
})
},
async getOptionsLists (url) {
let options = []
console.log('getOptionsList----', url)
await this.$http
.post(url, { formCode: 'resi_base_info' })
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
} else {
options = res.data
}
})
.catch(() => {
return this.$message.error('网络错误')
})
return options
}
}
}

175
epmet-oper-web/src/views/modules/base/resi.vue

@ -34,9 +34,14 @@
align="center"
width="120">
<template slot-scope="scope">
<el-button @click="handleClick(scope.row)" type="text" size="small">查看</el-button>
<el-button @click="handleLook(scope.row)" type="text" size="small">查看</el-button>
<el-button @click="handleEdit(scope.row)" type="text" size="small" class="btn-color-edit">编辑</el-button>
<el-button type="text" size="small" class="btn-color-del">删除</el-button>
<el-popconfirm
title="删除之后无法回复,确认删除?"
@onConfirm="handleDel(scope.row)"
>
<el-button slot="reference" type="text" size="small" class="btn-color-del">删除</el-button>
</el-popconfirm>
</template>
</el-table-column>
</el-table>
@ -85,8 +90,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" :disabled="disabled" :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">
@ -94,14 +99,14 @@
<el-tab-pane v-for="item in tabsList" :key="item.columnName"
:label="item.label" :name="'group' + item.groupId">
<edit-resi :ref="'group' + item.groupId" :columns="3" :support-add="item.supportAdd"
:form-id="item.columnName" :muti-list="item.mutiList" :form-list=" item.itemList" />
:form-id="item.columnName" :muti-list="item.mutiList" :form-list=" item.itemList" :disabled="disabled" />
</el-tab-pane>
</el-tabs>
</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 v-if="!disabled" type="primary" size="small" @click="handleEditSUbmit">提交</el-button>
</div>
</el-dialog>
@ -120,6 +125,7 @@ export default {
},
data () {
return {
disabled: false,
pageLoading: false,
dialogEditVisible: false,
dialogVisible: false,
@ -132,6 +138,15 @@ export default {
tableData: [],
searchList: [],
value: '',
editForm: {
GRID_ID: '',
VILLAGE_ID: '',
BUILD_ID: '',
HOME_ID: ''
},
editTableName: {
},
formList: [],
tableHeader: [],
tabsForm: [{
@ -180,7 +195,7 @@ export default {
},
async created () {
await this.getSearchList()
await this.getFormList()
// await this.getFormList()
await this.getTableHeader()
this.getTableData()
this.pageLoading = true
@ -215,10 +230,18 @@ export default {
handleClick (tab, event) {
console.log(tab, event)
},
handleEdit (row) {
async handleLook (row) {
this.disabled = true
await this.getFormList()
this.getrowInfo(row.icResiUserId)
},
handleAdd () {
async handleEdit (row) {
this.disabled = false
await this.getFormList()
this.getrowInfo(row.icResiUserId)
},
async handleAdd () {
await this.getFormList()
this.dialogVisible = true
},
async handleChangeGroup (val) {
@ -251,30 +274,29 @@ export default {
if (hasT) this.tabsList.splice(i, 1)
}
},
handleSUbmit () {
console.log('baseform', this.$refs.baseForm.handleForm())
formetForm () {
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({
@ -282,12 +304,10 @@ export default {
supportAdd: item.supportAdd,
tableName: name
})
// console.log('hash[name]0000---', hash[name], res)
}
})
// listlist
res.forEach(item => {
// console.log('arrr777-----sub', item)
let _form = {}
item.list.forEach(n => {
_form = { ..._form, ...n }
@ -297,12 +317,45 @@ export default {
list: item.supportAdd ? [...item.list] : [{ ..._form }]
})
})
// console.log('arrr999-----sub', finalArr)
this.submitAdd(finalArr)
return finalArr
},
async handleEditSUbmit () {
const arr = await this.formetForm()
this.submitEdit(arr)
},
async handleSUbmit () {
const arr = await this.formetForm()
this.submitAdd(arr)
},
handleDel (row) {
let params = {
formCode: 'resi_base_info',
icResiUserId: row.icResiUserId
}
this.$http
.post('/epmetuser/icresiuser/delete', params)
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
} else {
this.$message.success('删除成功')
this.getTableData()
}
})
.catch(() => {
return this.$message.error('网络错误')
})
},
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 +375,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 +384,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' })
@ -353,7 +427,7 @@ export default {
conditions: this.conditions
}
this.$http
.post('/data/aggregator/icresiuser/listresi', params)
.post('/epmetuser/icresiuser/listresi', params)
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
@ -372,14 +446,18 @@ export default {
icResiUserId: id
}
this.$http
.post('/data/aggregator/icresiuser/detail', params)
.post('/epmetuser/icresiuser/detail', params)
.then(({ data: res }) => {
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 +467,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 +535,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 +551,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(() => {
@ -537,6 +615,7 @@ export default {
}
.resi-card-table {
.btn-color-del {
margin-left: 10px;
color: rgba(213, 16, 16, 1);
}
.btn-color-edit {

Loading…
Cancel
Save