|
|
@ -7,21 +7,17 @@ |
|
|
|
:rules="dataRule" |
|
|
|
ref="dataForm" |
|
|
|
@keyup.enter.native="dataFormSubmitHandle()" |
|
|
|
label-width="120px"> |
|
|
|
label-width="100px"> |
|
|
|
<el-form-item prop="name" |
|
|
|
:label="$t('dept.name')"> |
|
|
|
<el-input v-model="dataForm.name" |
|
|
|
<el-input class="input-width-jg" v-model="dataForm.name" |
|
|
|
:placeholder="$t('dept.name')"></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item prop="partyCode" |
|
|
|
:label="$t('dept.partyCode')"> |
|
|
|
<el-input v-model="dataForm.partyCode" |
|
|
|
<el-input class="input-width-jg" v-model="dataForm.partyCode" |
|
|
|
:placeholder="$t('dept.partyCode')"></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item prop="allAreaCode" :label="$t('dept.areaCode')"> |
|
|
|
<el-cascader v-model="dataForm.allAreaCode" :options="areaCodeOptions" :props="optionProps" change-on-select style="width: 320px" clearable> |
|
|
|
</el-cascader> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item prop="parentName" |
|
|
|
:label="$t('dept.parentName')" |
|
|
|
class="dept-list"> |
|
|
@ -39,7 +35,7 @@ |
|
|
|
@current-change="deptListTreeCurrentChangeHandle"> |
|
|
|
</el-tree> |
|
|
|
</el-popover> |
|
|
|
<el-input v-model="dataForm.parentName" |
|
|
|
<el-input class="input-width-jg" v-model="dataForm.parentName" |
|
|
|
v-popover:deptListPopover |
|
|
|
:readonly="true" |
|
|
|
:placeholder="$t('dept.parentName')"> |
|
|
@ -50,6 +46,7 @@ |
|
|
|
</i> |
|
|
|
</el-input> |
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item label="机构类型" |
|
|
|
prop="typeKey"> |
|
|
|
<el-select v-model="dataForm.typeKey" |
|
|
@ -62,6 +59,28 @@ |
|
|
|
</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 class="input-width-jg" v-model="dataForm.areaCode" v-popover:areaCodeListPopover :readonly="true" placeholder="区域编码"> |
|
|
|
</el-input> |
|
|
|
<el-tooltip placement="top"> |
|
|
|
<div slot="content">机构类型为街道或社区时,请选择行政区划中的组织机构,若没用对应选项点击下方红色文字链接新增行政区划;<br/>机构类型为其他类型时,选择其上级行政区划。</div> |
|
|
|
<i class="el-icon-question" style="color: #ff4c52" /> |
|
|
|
</el-tooltip> |
|
|
|
<div> |
|
|
|
<el-link @click="addAreaCode()" v-if="dataForm.typeKey === 'street_party' || dataForm.typeKey === 'community_party'" type="danger">如果没有匹配的行政区划,请点击此处新增</el-link> |
|
|
|
</div> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item prop="sort" |
|
|
|
:label="$t('dept.sort')"> |
|
|
|
<el-input-number v-model="dataForm.sort" |
|
|
@ -85,7 +104,9 @@ export default { |
|
|
|
return { |
|
|
|
visible: false, |
|
|
|
deptList: [], |
|
|
|
areaCodeList: [], |
|
|
|
deptListVisible: false, |
|
|
|
areaCodeListVisible: false, |
|
|
|
dataForm: { |
|
|
|
id: '', |
|
|
|
name: '', |
|
|
@ -94,16 +115,10 @@ export default { |
|
|
|
sort: 0, |
|
|
|
typeKey: '', |
|
|
|
typeName: '', |
|
|
|
partyCode: '', |
|
|
|
areaCode: '', |
|
|
|
allAreaCode: [], |
|
|
|
partyCode: '' |
|
|
|
}, |
|
|
|
optionProps: { |
|
|
|
value: 'code', |
|
|
|
label: 'name', |
|
|
|
children: 'children' |
|
|
|
parentAreaCode: '' |
|
|
|
}, |
|
|
|
areaCodeOptions: [], |
|
|
|
secondOrgDictList: [] |
|
|
|
} |
|
|
|
}, |
|
|
@ -116,14 +131,14 @@ export default { |
|
|
|
partyCode: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'change' } |
|
|
|
], |
|
|
|
allAreaCode: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'change' } |
|
|
|
], |
|
|
|
parentName: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'change' } |
|
|
|
], |
|
|
|
typeKey: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'change' } |
|
|
|
], |
|
|
|
areaCode: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'change' } |
|
|
|
] |
|
|
|
} |
|
|
|
} |
|
|
@ -143,13 +158,11 @@ export default { |
|
|
|
} else { |
|
|
|
this.dataForm.partyCode = '' |
|
|
|
this.dataForm.typeKey = '' |
|
|
|
this.dataForm.areaCode = '' |
|
|
|
this.dataForm.allAreaCode = '' |
|
|
|
} |
|
|
|
}) |
|
|
|
this.getAreaCodeDeptList() |
|
|
|
}) |
|
|
|
this.getSecondOrgDicList() |
|
|
|
this.getAreaCodeOption() |
|
|
|
}, |
|
|
|
// 改变机构类型 |
|
|
|
changeOrgType (item) { |
|
|
@ -164,13 +177,13 @@ export default { |
|
|
|
this.deptList = res.data |
|
|
|
}).catch(() => { }) |
|
|
|
}, |
|
|
|
// 获取区域编码 |
|
|
|
getAreaCodeOption () { |
|
|
|
return this.$http.get('/sys/dept/getEpmetAreaCode', { params: { rootAreaCode: '370124', rootAreaLevel: 'district' } }).then(({ data: res }) => { |
|
|
|
// 获取部门区域编码列表 |
|
|
|
getAreaCodeDeptList () { |
|
|
|
return this.$http.get('/sys/dept/getDeptCode').then(({ data: res }) => { |
|
|
|
if (res.code !== 0) { |
|
|
|
return this.$message.error(res.msg) |
|
|
|
} |
|
|
|
this.areaCodeOptions = res.data |
|
|
|
this.areaCodeList = res.data.options |
|
|
|
}).catch(() => { }) |
|
|
|
}, |
|
|
|
// 获取二级党委字典列表 |
|
|
@ -192,11 +205,11 @@ export default { |
|
|
|
...this.dataForm, |
|
|
|
...res.data |
|
|
|
} |
|
|
|
this.dataForm.allAreaCode = res.data.allAreaCode.split(',') |
|
|
|
if (this.dataForm.pid === '0') { |
|
|
|
return this.deptListTreeSetDefaultHandle() |
|
|
|
} |
|
|
|
this.$refs.deptListTree.setCurrentKey(this.dataForm.pid) |
|
|
|
this.$refs.areaCodeListTree.setCurrentKey(this.dataForm.areaCode) |
|
|
|
}).catch(() => { }) |
|
|
|
}, |
|
|
|
// 上级部门树, 设置默认值 |
|
|
@ -210,14 +223,40 @@ export default { |
|
|
|
this.dataForm.parentName = data.name |
|
|
|
this.deptListVisible = false |
|
|
|
}, |
|
|
|
// 上级部门区域编码树, 选中 |
|
|
|
areaCodeListTreeCurrentChangeHandle (data) { |
|
|
|
this.dataForm.areaCode = data.code |
|
|
|
this.dataForm.parentAreaCode = data.parentCode |
|
|
|
this.areaCodeListVisible = false |
|
|
|
}, |
|
|
|
addAreaCode () { |
|
|
|
if (this.dataForm.name === null || this.dataForm.name === '' || this.dataForm.name.trim() === '') { |
|
|
|
return this.$message.error('请填写机构名称') |
|
|
|
} |
|
|
|
if (this.dataForm.pid === null || this.dataForm.pid === '' || this.dataForm.pid.trim() === '' || this.dataForm.pid.trim() === '0') { |
|
|
|
return this.$message.error('请选择上级部门') |
|
|
|
} |
|
|
|
this.$http['post']('/sys/dept/addAreaCode', this.dataForm).then(({ data: res }) => { |
|
|
|
if (res.code !== 0) { |
|
|
|
return this.$message.error(res.msg) |
|
|
|
} |
|
|
|
this.$message({ |
|
|
|
message: this.$t('prompt.success'), |
|
|
|
type: 'success', |
|
|
|
duration: 500, |
|
|
|
onClose: () => { |
|
|
|
this.dataForm.areaCode = res.data.areaCode |
|
|
|
this.getAreaCodeDeptList() |
|
|
|
} |
|
|
|
}) |
|
|
|
}).catch(() => { }) |
|
|
|
}, |
|
|
|
// 表单提交 |
|
|
|
dataFormSubmitHandle: debounce(function () { |
|
|
|
this.$refs['dataForm'].validate((valid) => { |
|
|
|
if (!valid) { |
|
|
|
return false |
|
|
|
} |
|
|
|
this.dataForm.areaCode = this.dataForm.allAreaCode[this.dataForm.allAreaCode.length - 1] |
|
|
|
this.dataForm.allAreaCode = this.dataForm.allAreaCode.toString() |
|
|
|
this.$http[!this.dataForm.id ? 'post' : 'put']('/sys/dept', this.dataForm).then(({ data: res }) => { |
|
|
|
if (res.code !== 0) { |
|
|
|
return this.$message.error(res.msg) |
|
|
@ -247,4 +286,14 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
.el-popover { |
|
|
|
height: 320px; |
|
|
|
overflow-y: scroll; |
|
|
|
} |
|
|
|
.el-dialog__footer { |
|
|
|
margin-top: 100px; |
|
|
|
} |
|
|
|
.input-width-jg { |
|
|
|
width: 93%; |
|
|
|
} |
|
|
|
</style> |
|
|
|