|
|
|
@ -67,7 +67,6 @@ |
|
|
|
|
<el-input v-model.trim="orgForm.organizationName" placeholder="请输入"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="上级部门"> |
|
|
|
|
<!--:options="cascaderOptions"--> |
|
|
|
|
<el-cascader |
|
|
|
|
v-if="showCascader" |
|
|
|
|
v-model="cascaderValue" |
|
|
|
@ -302,6 +301,7 @@ export default { |
|
|
|
|
organizationName: "" |
|
|
|
|
}, |
|
|
|
|
cascaderValue: [], // 上级部门 |
|
|
|
|
cascaderLevel: 1, |
|
|
|
|
cascaderProps: { |
|
|
|
|
checkStrictly: true, |
|
|
|
|
label: "organizationName", |
|
|
|
@ -315,10 +315,13 @@ export default { |
|
|
|
|
parentId = node.data.id; |
|
|
|
|
} |
|
|
|
|
that.$post(`${that.api.stuOrganizationTree}?level=${level}&parentId=${parentId}`).then(res => { |
|
|
|
|
let { status, treeList } = res; |
|
|
|
|
const { status, treeList } = res; |
|
|
|
|
const isGrade = that.labelName === '年级' // 编辑的该层级是否是年级(年级只能更换到组织下,所以年级班级都要禁选) |
|
|
|
|
const deepLevel = that.cascaderLevel // 最深层级 |
|
|
|
|
if (status === 200 && treeList.length) { |
|
|
|
|
treeList.forEach(i => { |
|
|
|
|
i.leaf = i.level === 2; |
|
|
|
|
if (deepLevel === 3 || (isGrade && i.leaf) || (deepLevel === 2 && i.leaf)) i.disabled = true |
|
|
|
|
}); |
|
|
|
|
return resolve(treeList); |
|
|
|
|
} else { |
|
|
|
@ -446,7 +449,6 @@ export default { |
|
|
|
|
util.debounce(this.getOrgStudentData(), 1000); |
|
|
|
|
}, |
|
|
|
|
handleAdd(node, data) { // 添加部门 |
|
|
|
|
console.log(JSON.stringify(data)); |
|
|
|
|
this.orgVisible = true; |
|
|
|
|
this.orgTitle = "新增"; |
|
|
|
|
this.isAddOrg = true; |
|
|
|
@ -472,8 +474,17 @@ export default { |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 获取一共有多少级子级 |
|
|
|
|
getDeep(data) { |
|
|
|
|
let list = data |
|
|
|
|
let level = 1 |
|
|
|
|
while (list.childNodes.length) { |
|
|
|
|
list = list.childNodes[0] |
|
|
|
|
++level |
|
|
|
|
} |
|
|
|
|
return level |
|
|
|
|
}, |
|
|
|
|
handleEdit(node, data) { // 编辑部门 |
|
|
|
|
// console.log("data=", data.ids); |
|
|
|
|
this.orgVisible = true; |
|
|
|
|
this.orgForm = data; |
|
|
|
|
this.orgTitle = "编辑"; |
|
|
|
@ -490,6 +501,7 @@ export default { |
|
|
|
|
tempArr.splice(tempArr.length - 1, 1); |
|
|
|
|
this.cascaderValue = tempArr; |
|
|
|
|
} |
|
|
|
|
this.cascaderLevel = this.getDeep(node) |
|
|
|
|
}, |
|
|
|
|
handleChangeCascader(value) { |
|
|
|
|
// console.log(JSON.stringify(value)); |
|
|
|
@ -512,9 +524,10 @@ export default { |
|
|
|
|
orgSubmit() { // 提交组织架构新增/编辑 |
|
|
|
|
this.$refs.orgForm.validate((valid) => { |
|
|
|
|
if (valid) { |
|
|
|
|
if (this.cascaderValue && this.cascaderValue.length) { |
|
|
|
|
this.orgForm.parentId = this.cascaderValue[this.cascaderValue.length - 1]; |
|
|
|
|
this.orgForm.level = this.cascaderValue.length + 1; |
|
|
|
|
const cas = this.cascaderValue |
|
|
|
|
if (cas && cas.length) { |
|
|
|
|
this.orgForm.parentId = cas[cas.length - 1]; |
|
|
|
|
this.orgForm.level = cas.length + 1; |
|
|
|
|
} |
|
|
|
|
if (this.isAddOrg) { |
|
|
|
|
// 添加 |
|
|
|
@ -525,6 +538,7 @@ export default { |
|
|
|
|
}).catch(err => { |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
if (cas.length === 1 && this.labelName === '班级名称') return util.errorMsg('请选择年级!') |
|
|
|
|
// 编辑 |
|
|
|
|
this.$post(this.api.updateOrg, this.orgForm).then(res => { |
|
|
|
|
util.successMsg("编辑成功!"); |
|
|
|
@ -583,7 +597,6 @@ export default { |
|
|
|
|
i.ids = ids ? `${ids},${i.id}` : `${i.id}`; // 给树结构添加唯一标识 |
|
|
|
|
result.push(i); |
|
|
|
|
}); |
|
|
|
|
// console.log(JSON.stringify(result)); |
|
|
|
|
return resolve(result); |
|
|
|
|
} else { |
|
|
|
|
return resolve([]); |
|
|
|
@ -859,7 +872,6 @@ export default { |
|
|
|
|
let { status, treeList } = res; |
|
|
|
|
if (status === 200 && treeList.length) { |
|
|
|
|
let result = []; |
|
|
|
|
// console.log(this.form.classId); |
|
|
|
|
treeList.forEach(i => { |
|
|
|
|
i.disabled = i.level < 3; |
|
|
|
|
if (i.level === 3) { |
|
|
|
@ -874,7 +886,6 @@ export default { |
|
|
|
|
i.leaf = false; |
|
|
|
|
i.showCheckbox = false; |
|
|
|
|
} |
|
|
|
|
// console.log(JSON.stringify(i)); |
|
|
|
|
result.push(i); |
|
|
|
|
}); |
|
|
|
|
return resolve(result); |
|
|
|
@ -1005,7 +1016,6 @@ export default { |
|
|
|
|
}, |
|
|
|
|
uploadSuccess(res, file, fileList) { |
|
|
|
|
this.uploadFaild = false; |
|
|
|
|
console.log(res) |
|
|
|
|
if (res.status === 200) { |
|
|
|
|
if (res.data.exportCode) { |
|
|
|
|
this.exportCode = res.data.exportCode; |
|
|
|
|