|
|
@ -25,10 +25,11 @@ |
|
|
|
label-width="150px" |
|
|
|
prop="agencyId" |
|
|
|
> |
|
|
|
<!-- { checkStrictly: true, emitPath: false,children:'subAgencyList',label:'agencyName',value:'agencyId'} --> |
|
|
|
<el-cascader ref="cascaderUnit" |
|
|
|
v-model="formData.agencyId" |
|
|
|
:options="orgOptions" |
|
|
|
:props="{ checkStrictly: true, emitPath: false,children:'subAgencyList',label:'agencyName',value:'agencyId'}" |
|
|
|
:props="optionProps" |
|
|
|
clearable |
|
|
|
@change="cascaderClick" |
|
|
|
/> |
|
|
@ -63,6 +64,14 @@ export default { |
|
|
|
formType: 'add', //表单操作类型 add新增,edit编辑,detail详情 |
|
|
|
btnDisable: false, |
|
|
|
orgOptions:[], |
|
|
|
optionProps: { |
|
|
|
checkStrictly: true, |
|
|
|
expandTrigger: 'hover', |
|
|
|
value: 'agencyId', |
|
|
|
label: 'agencyName', |
|
|
|
children: 'subAgencyList', |
|
|
|
}, |
|
|
|
agencyIdArray:[], |
|
|
|
tagId:'', |
|
|
|
formData: { |
|
|
|
tagName: '', |
|
|
@ -83,6 +92,8 @@ export default { |
|
|
|
components: {}, |
|
|
|
async mounted () { |
|
|
|
await this.getOrgTreeList() |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
methods: { |
|
|
@ -90,6 +101,7 @@ export default { |
|
|
|
async initForm (type, row) { |
|
|
|
this.startLoading() |
|
|
|
this.formType = type |
|
|
|
|
|
|
|
console.log(row); |
|
|
|
if(type!='add'){ |
|
|
|
this.formData.tagName = row.tagName |
|
|
@ -107,22 +119,37 @@ export default { |
|
|
|
}, |
|
|
|
async getOrgTreeList() { |
|
|
|
this.dataListLoading = true |
|
|
|
this.$http |
|
|
|
.post('/gov/org/customeragency/staffinagencylist') |
|
|
|
.then(({ data: res }) => { |
|
|
|
if (res.code !== 0) { |
|
|
|
return this.$message.error(res.msg) |
|
|
|
} else { |
|
|
|
console.log('获取查询详情成功', res.data) |
|
|
|
let { agencyList, subAgencyList } = res.data |
|
|
|
const _arr = [{ ...agencyList, subAgencyList: [...subAgencyList] }] |
|
|
|
this.orgOptions = this.deepTree(_arr) |
|
|
|
} |
|
|
|
}) |
|
|
|
.catch(() => { |
|
|
|
this.dataListLoading = false |
|
|
|
return this.$message.error('网络错误') |
|
|
|
}) |
|
|
|
// this.$http |
|
|
|
// .post('gov/org/customeragency/agencylist', { customerId: this.customerId}) |
|
|
|
// .then(({ data: res }) => { |
|
|
|
// if (res.code !== 0) { |
|
|
|
// return this.$message.error(res.msg) |
|
|
|
// } else { |
|
|
|
// console.log('获取查询详情成功', res.data) |
|
|
|
// let { agencyList, subAgencyList } = res.data |
|
|
|
// const _arr = [{ ...agencyList, subAgencyList: [...subAgencyList] }] |
|
|
|
// this.orgOptions = this.deepTree(_arr) |
|
|
|
// } |
|
|
|
// }) |
|
|
|
// .catch(() => { |
|
|
|
// this.dataListLoading = false |
|
|
|
// return this.$message.error('网络错误') |
|
|
|
// }) |
|
|
|
const url = '/gov/org/customeragency/agencylist' |
|
|
|
// const url = 'http://yapi.elinkservice.cn/mock/102/gov/org/agency/agencylist' |
|
|
|
|
|
|
|
let params = { |
|
|
|
customerId: this.customerId |
|
|
|
} |
|
|
|
const { data, code, msg } = await requestPost(url, params) |
|
|
|
if (code === 0) { |
|
|
|
this.options = [] |
|
|
|
this.agencyIdArray.length = [] |
|
|
|
this.orgOptions.push(data) |
|
|
|
|
|
|
|
} else { |
|
|
|
this.$message.error(msg) |
|
|
|
} |
|
|
|
this.dataListLoading = false |
|
|
|
}, |
|
|
|
deepTree (arr) { |
|
|
@ -141,7 +168,7 @@ export default { |
|
|
|
if (obj) { |
|
|
|
if (obj.level === "street") { |
|
|
|
for(let i in obj.subAgencyList){ |
|
|
|
this.formData.push({'agencyId':obj.subAgencyList[i].agencyId,'orgIdPath':obj.subAgencyList[i].orgIdPath}) |
|
|
|
this.formDatam.push({'agencyId':obj.subAgencyList[i].agencyId,'orgIdPath':obj.subAgencyList[i].orgIdPath}) |
|
|
|
} |
|
|
|
} else { |
|
|
|
this.formDatam.push({'agencyId':obj.agencyId,'orgIdPath':obj.orgIdPath}) |
|
|
@ -239,6 +266,10 @@ export default { |
|
|
|
computed: { |
|
|
|
}, |
|
|
|
props: { |
|
|
|
customerId:{ |
|
|
|
type:String, |
|
|
|
default:"" |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|