Browse Source

部门区域编码

feature/syp_points
songyunpeng 5 years ago
parent
commit
f9e01cc351
  1. 43
      src/views/modules/sys/dept-add-or-update.vue

43
src/views/modules/sys/dept-add-or-update.vue

@ -58,6 +58,21 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item prop="areaCode" label="区域编码" class="dept-list">
<el-popover v-model="areaCodeListVisible" ref="areaCodeListPopover" placement="bottom-start" trigger="click">
<el-tree :data="areaCodeList"
:props="{ label: 'name', children: 'children' }"
node-key="code"
ref="areaCodeListTree"
:highlight-current="true"
:expand-on-click-node="false"
accordion
@current-change="areaCodeListTreeCurrentChangeHandle">
</el-tree>
</el-popover>
<el-input v-model="dataForm.areaCode" v-popover:areaCodeListPopover :readonly="true" placeholder="区域编码">
</el-input>
</el-form-item>
<el-form-item prop="sort"
:label="$t('dept.sort')">
<el-input-number v-model="dataForm.sort"
@ -81,7 +96,9 @@ export default {
return {
visible: false,
deptList: [],
areaCodeList: [],
deptListVisible: false,
areaCodeListVisible: false,
dataForm: {
id: '',
name: '',
@ -109,6 +126,9 @@ export default {
],
typeKey: [
{ required: true, message: this.$t('validate.required'), trigger: 'change' }
],
areaCode: [
{ required: true, message: this.$t('validate.required'), trigger: 'change' }
]
}
}
@ -130,6 +150,7 @@ export default {
this.dataForm.typeKey = ''
}
})
this.getAreaCodeDeptList()
})
this.getSecondOrgDicList()
},
@ -146,6 +167,15 @@ export default {
this.deptList = res.data
}).catch(() => { })
},
//
getAreaCodeDeptList () {
return this.$http.get('/sys/dept/getDeptCode').then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.areaCodeList = res.data.options
}).catch(() => { })
},
//
getSecondOrgDicList () {
this.$http.get(`/sys/dict/listSimple/org_type`).then(({ data: res }) => {
@ -169,6 +199,7 @@ export default {
return this.deptListTreeSetDefaultHandle()
}
this.$refs.deptListTree.setCurrentKey(this.dataForm.pid)
this.$refs.areaCodeListTree.setCurrentKey(this.dataForm.areaCode)
}).catch(() => { })
},
// ,
@ -182,6 +213,11 @@ export default {
this.dataForm.parentName = data.name
this.deptListVisible = false
},
// ,
areaCodeListTreeCurrentChangeHandle (data) {
this.dataForm.areaCode = data.code
this.areaCodeListVisible = false
},
//
dataFormSubmitHandle: debounce(function () {
this.$refs['dataForm'].validate((valid) => {
@ -217,4 +253,11 @@ export default {
}
}
}
.el-popover {
height: 320px;
overflow-y: scroll;
}
.el-dialog__footer {
margin-top: 100px;
}
</style>

Loading…
Cancel
Save