| | |
| | | :tree-data="areaData" |
| | | placeholder="行政区划" |
| | | :replaceFields="replaceFields" |
| | | disabled |
| | | @change="changeArea" |
| | | /> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | <a-col :span="12"> |
| | | <a-form-model-item label="组织架构"> |
| | | <a-input v-model="orgName" disabled/> |
| | | <a-select |
| | | v-model.trim="form.orgStructureId" |
| | | placeholder="选择组织架构" |
| | | style="width: 100%" |
| | | allowClear |
| | | show-search |
| | | > |
| | | <a-select-option v-for="item in orgData" :value="item.id" :key="item.id">{{item.orgName}}</a-select-option> |
| | | </a-select> |
| | | <!-- <a-input v-model="orgName" />--> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | </a-row> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import {addContactors,updateContactors} from '@/api/contactBook' |
| | | import {addContactors, getStructure, updateContactors} from '@/api/contactBook' |
| | | import {verifySimplePhone} from "@/util/validate"; |
| | | import {getDistrictInfo} from "@/api/login"; |
| | | import subMenu from "@/views/Admin/contactBook/subMenu.vue"; |
| | | import {getOrgData} from "@/api/user"; |
| | | export default { |
| | | name: 'addressUserMod', |
| | | components: {subMenu}, |
| | | props: ['groupList'], |
| | | data () { |
| | | let validatePhone = (rule, value, callback)=>{ |
| | |
| | | wrapperCol: { span: 14 }, |
| | | areaId: null, |
| | | orgName: '', |
| | | areaVal: [], |
| | | orgData: [], |
| | | fieldNames:{ |
| | | label: 'name', |
| | | value: 'id', |
| | | children: 'children' |
| | | }, |
| | | form: { |
| | | id: null, |
| | | name: '', |
| | |
| | | label: '救援队伍' |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | value: '灾害信息员', |
| | | label: '灾害信息员', |
| | | children: [ |
| | | { |
| | | value: '灾害信息员', |
| | | label: '灾害信息员' |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | value: '企业', |
| | | label: '企业', |
| | | children: [ |
| | | { |
| | | value: '企业', |
| | | label: '企业' |
| | | } |
| | | ] |
| | | } |
| | | ], |
| | | replaceFields: { |
| | |
| | | key:'id', |
| | | value: 'id' |
| | | }, |
| | | currentKey: [], |
| | | openKeys: [], |
| | | |
| | | } |
| | | }, |
| | | created() { |
| | | const t = this |
| | | t.getDistrictInfo() |
| | | // t.getDistrictInfo() |
| | | t.getStructure() |
| | | }, |
| | | |
| | | |
| | | methods:{ |
| | | openDialog(type,data,areaId,orgName,orgId){ |
| | | openDialog(type,data,areaId,orgName,orgId) { |
| | | const t = this |
| | | t.changeArea(areaId) |
| | | t.createRules() |
| | | t.areaId = Number(areaId) |
| | | t.orgName = orgName |
| | | |
| | | if(type == 'add'){ |
| | | t.title = '新增责任人' |
| | | t.isView = false |
| | |
| | | } |
| | | } |
| | | t.visible = true |
| | | }, |
| | | onChange(value) { |
| | | const t = this |
| | | |
| | | }, |
| | | isValidKey(key, object){ |
| | | return key in object; |
| | |
| | | }); |
| | | }, |
| | | |
| | | async getStructure(){ |
| | | const t = this |
| | | const res = await getStructure() |
| | | if(res.data.code == 100){ |
| | | t.areaData = t.filterBranches(res.data.data,['自治区直辖县级行政区划']) |
| | | // const firstItem = this.firstIdWithOrgStructures(res.data.data[0]) |
| | | // if(firstItem){ |
| | | // t.openKeys = [firstItem.id +'-'+ firstItem.name] |
| | | // t.currentId = firstItem.id |
| | | // t.currentKey = [firstItem.orgStructures[0].id +'-'+ firstItem.orgStructures[0].orgName] |
| | | // }else{ |
| | | // t.$message.warning('暂无可操作的单位,请先进入“组织架构维护页面”新建相应的本级单位') |
| | | // } |
| | | }else{ |
| | | t.$message.warning(res.data.msg) |
| | | } |
| | | }, |
| | | filterBranches(branches, targetNames) { |
| | | return branches.filter(branch => { |
| | | if (targetNames.includes(branch.name)) { |
| | | return false; // 过滤掉当前分支 |
| | | } |
| | | if (branch.children && branch.children.length > 0) { |
| | | branch.children = this.filterBranches(branch.children, targetNames); |
| | | } |
| | | return true; // 保留当前分支 |
| | | }); |
| | | }, |
| | | async getDistrictInfo(){ |
| | | let res = await getDistrictInfo() |
| | | let res = await getStructure() |
| | | if(res.data.code == 100){ |
| | | this.areaData = res.data.data |
| | | } else { |
| | |
| | | handleCancel(e) { |
| | | const t = this |
| | | t.visible = false; |
| | | }, |
| | | changeArea(val){ |
| | | const t = this |
| | | t.form.districtId = val; |
| | | t.form.districtCode = t.findCodeById(t.areaData,val) |
| | | t.form.orgStructureId = null; |
| | | getOrgData(val).then(res => { |
| | | if(res.data.code === 100) { |
| | | console.log("res",res) |
| | | t.orgData = res.data.data |
| | | }else { |
| | | t.$message.warning(res.data.msg) |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | } |