|
@ -4,12 +4,12 @@ |
|
|
<el-form-item label="机构名称" prop="deptId"> |
|
|
<el-form-item label="机构名称" prop="deptId"> |
|
|
<el-cascader v-model="deptIdList" |
|
|
<el-cascader v-model="deptIdList" |
|
|
:options="options" |
|
|
:options="options" |
|
|
v-if="dataForm.id == null" |
|
|
v-if="!dataForm.id" |
|
|
:props="{ checkStrictly: true }" |
|
|
:props="{ checkStrictly: true }" |
|
|
ref="dept" |
|
|
ref="deptLabel" |
|
|
style="width: 345px" |
|
|
style="width: 345px" |
|
|
clearable></el-cascader> |
|
|
clearable></el-cascader> |
|
|
<el-form-item v-if="dataForm.id != null"> |
|
|
<el-form-item v-if="dataForm.id"> |
|
|
{{dataForm.deptName}} |
|
|
{{dataForm.deptName}} |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
@ -141,21 +141,25 @@ export default { |
|
|
'deptIdList': function (val) { |
|
|
'deptIdList': function (val) { |
|
|
if (val.length !== 0) { |
|
|
if (val.length !== 0) { |
|
|
this.dataForm.deptId = val[val.length - 1] |
|
|
this.dataForm.deptId = val[val.length - 1] |
|
|
|
|
|
|
|
|
|
|
|
let casLabelVal = this.$refs['deptLabel'].getCheckedNodes()[0].pathLabels |
|
|
|
|
|
this.dataForm.deptName = casLabelVal[val.length - 1] |
|
|
} else { |
|
|
} else { |
|
|
this.dataForm.deptId = '' |
|
|
this.dataForm.deptId = '' |
|
|
|
|
|
this.dataForm.deptName = '' |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
created () { |
|
|
created () { |
|
|
this.$http |
|
|
this.$http |
|
|
.get(`/sys/user/deptOptions/getByLoginUser`) |
|
|
.get(`/sys/user/deptOptions/getByLoginUser`) |
|
|
.then(({ data: res }) => { |
|
|
.then(({ data: res }) => { |
|
|
if (res.code !== 0) { |
|
|
if (res.code !== 0) { |
|
|
return this.$message.error(res.msg) |
|
|
return this.$message.error(res.msg) |
|
|
} |
|
|
} |
|
|
this.options = res.data.options |
|
|
this.options = res.data.options |
|
|
}) |
|
|
}) |
|
|
.catch(() => { }) |
|
|
.catch(() => { }) |
|
|
}, |
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
|
init () { |
|
|
init () { |
|
@ -185,9 +189,6 @@ export default { |
|
|
if (!valid) { |
|
|
if (!valid) { |
|
|
return false |
|
|
return false |
|
|
} |
|
|
} |
|
|
if(!this.dataForm.id){ |
|
|
|
|
|
this.dataForm.deptName = this.$refs['dept'].inputValue.split('/').slice(-1).toString().replace(/\s+/g,''); |
|
|
|
|
|
} |
|
|
|
|
|
this.$http[!this.dataForm.id ? 'post' : 'put']('/sys/screendeptinfo/', this.dataForm).then(({ data: res }) => { |
|
|
this.$http[!this.dataForm.id ? 'post' : 'put']('/sys/screendeptinfo/', this.dataForm).then(({ data: res }) => { |
|
|
if (res.code !== 0) { |
|
|
if (res.code !== 0) { |
|
|
return this.$message.error(res.msg) |
|
|
return this.$message.error(res.msg) |
|
@ -199,11 +200,11 @@ export default { |
|
|
onClose: () => { |
|
|
onClose: () => { |
|
|
this.visible = false |
|
|
this.visible = false |
|
|
this.$emit('refreshDataList') |
|
|
this.$emit('refreshDataList') |
|
|
|
|
|
this.deptIdList = [] |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
}).catch(() => {}) |
|
|
}).catch(() => {}) |
|
|
}) |
|
|
}) |
|
|
this.deptIdList = [] |
|
|
|
|
|
}, 1000, { 'leading': true, 'trailing': false }) |
|
|
}, 1000, { 'leading': true, 'trailing': false }) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|