|
|
|
@ -1,12 +1,14 @@ |
|
|
|
|
<template> |
|
|
|
|
<div> |
|
|
|
|
<div> |
|
|
|
|
<div> |
|
|
|
|
<div class="flex-between m-b-20"> |
|
|
|
|
<h6 class="p-title" style="margin-bottom: 0">员工组织架构</h6> |
|
|
|
|
<el-button type="text" @click="addMajor" v-auth="'员工管理:新增专业'">添加</el-button> |
|
|
|
|
</div> |
|
|
|
|
<org-tree |
|
|
|
|
:data="orgList" |
|
|
|
|
<div class="flex-between m-b-20"> |
|
|
|
|
<h6 class="p-title" |
|
|
|
|
style="margin-bottom: 0">教师组织架构</h6> |
|
|
|
|
<el-button type="text" |
|
|
|
|
@click="addMajor" |
|
|
|
|
v-auth="'员工管理:新增专业'">添加</el-button> |
|
|
|
|
</div> |
|
|
|
|
<org-tree :data="orgList" |
|
|
|
|
show-checkbox |
|
|
|
|
default-expand-all |
|
|
|
|
ref="orgTree" |
|
|
|
@ -15,277 +17,294 @@ |
|
|
|
|
:expand-on-click-node="false" |
|
|
|
|
@node-click="getSingle" |
|
|
|
|
@check="getCheck" |
|
|
|
|
:props="{children: 'children', label: 'label', isLeaf: 'leaf'}" |
|
|
|
|
> |
|
|
|
|
<span class="custom-tree-node" slot-scope="{ node, data }"> |
|
|
|
|
<span style="display: inline-block; margin-right: 20px">{{ node.label }}</span> |
|
|
|
|
<span> |
|
|
|
|
<el-button |
|
|
|
|
v-auth="'员工管理:新增专业'" |
|
|
|
|
type="text" |
|
|
|
|
icon="el-icon-edit-outline" |
|
|
|
|
@click="() => handleEdit(node, data)"> |
|
|
|
|
</el-button> |
|
|
|
|
<el-button |
|
|
|
|
v-auth="'员工管理:编辑专业'" |
|
|
|
|
v-if="node.level === 1" |
|
|
|
|
type="text" |
|
|
|
|
icon="el-icon-circle-plus-outline" |
|
|
|
|
@click="() => handleAdd(node, data)"> |
|
|
|
|
</el-button> |
|
|
|
|
<el-button |
|
|
|
|
v-auth="'员工管理:删除专业'" |
|
|
|
|
type="text" |
|
|
|
|
icon="el-icon-delete" |
|
|
|
|
@click="() => handleDel(node, data)"> |
|
|
|
|
</el-button> |
|
|
|
|
</span> |
|
|
|
|
</span> |
|
|
|
|
</org-tree> |
|
|
|
|
</div> |
|
|
|
|
:props="{children: 'children', label: 'label', isLeaf: 'leaf'}"> |
|
|
|
|
<span class="custom-tree-node" |
|
|
|
|
slot-scope="{ node, data }"> |
|
|
|
|
<span style="display: inline-block; margin-right: 20px">{{ node.label }}</span> |
|
|
|
|
<span> |
|
|
|
|
<el-button v-auth="'员工管理:新增专业'" |
|
|
|
|
type="text" |
|
|
|
|
icon="el-icon-edit-outline" |
|
|
|
|
@click="() => handleEdit(node, data)"> |
|
|
|
|
</el-button> |
|
|
|
|
<el-button v-auth="'员工管理:编辑专业'" |
|
|
|
|
v-if="node.level === 1" |
|
|
|
|
type="text" |
|
|
|
|
icon="el-icon-circle-plus-outline" |
|
|
|
|
@click="() => handleAdd(node, data)"> |
|
|
|
|
</el-button> |
|
|
|
|
<el-button v-auth="'员工管理:删除专业'" |
|
|
|
|
type="text" |
|
|
|
|
icon="el-icon-delete" |
|
|
|
|
@click="() => handleDel(node, data)"> |
|
|
|
|
</el-button> |
|
|
|
|
</span> |
|
|
|
|
</span> |
|
|
|
|
</org-tree> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<el-dialog :title="Form.staffArchitectureId ? '编辑部门' : '新增部门'" :visible.sync="majorVisible" width="24%" center @close="closeAdd" :close-on-click-modal="false"> |
|
|
|
|
<el-form ref="Form" :model="Form" :rules="rules"> |
|
|
|
|
<el-form-item prop="staffArchitectureName"> |
|
|
|
|
<el-input placeholder="请输入部门名称" v-model="Form.staffArchitectureName"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-form> |
|
|
|
|
<span slot="footer" class="dialog-footer"> |
|
|
|
|
<el-button @click="majorVisible = false">取 消</el-button> |
|
|
|
|
<el-button type="primary" @click="sure('Form')">确 定</el-button> |
|
|
|
|
</span> |
|
|
|
|
</el-dialog> |
|
|
|
|
<el-dialog :title="Form.staffArchitectureId ? '编辑部门' : '新增部门'" |
|
|
|
|
:visible.sync="majorVisible" |
|
|
|
|
width="24%" |
|
|
|
|
center |
|
|
|
|
@close="closeAdd" |
|
|
|
|
:close-on-click-modal="false"> |
|
|
|
|
<el-form ref="Form" |
|
|
|
|
:model="Form" |
|
|
|
|
:rules="rules"> |
|
|
|
|
<el-form-item prop="staffArchitectureName"> |
|
|
|
|
<el-input placeholder="请输入部门名称" |
|
|
|
|
v-model="Form.staffArchitectureName"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-form> |
|
|
|
|
<span slot="footer" |
|
|
|
|
class="dialog-footer"> |
|
|
|
|
<el-button @click="majorVisible = false">取 消</el-button> |
|
|
|
|
<el-button type="primary" |
|
|
|
|
@click="sure('Form')">确 定</el-button> |
|
|
|
|
</span> |
|
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
|
|
<el-dialog :title="Form.gradeId ? '编辑部门' : '新增部门'" :visible.sync="depVisible" width="24%" center @close="closeAdd" :close-on-click-modal="false"> |
|
|
|
|
<el-form ref="Form1" :model="Form" :rules="rules"> |
|
|
|
|
<el-form-item prop="gradeName"> |
|
|
|
|
<el-input placeholder="请输入部门名称" v-model="Form.gradeName"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-form> |
|
|
|
|
<span slot="footer" class="dialog-footer"> |
|
|
|
|
<el-button @click="depVisible = false">取 消</el-button> |
|
|
|
|
<el-button type="primary" @click="sureDepartment('Form1')">确 定</el-button> |
|
|
|
|
</span> |
|
|
|
|
</el-dialog> |
|
|
|
|
</div> |
|
|
|
|
<el-dialog :title="Form.gradeId ? '编辑部门' : '新增部门'" |
|
|
|
|
:visible.sync="depVisible" |
|
|
|
|
width="24%" |
|
|
|
|
center |
|
|
|
|
@close="closeAdd" |
|
|
|
|
:close-on-click-modal="false"> |
|
|
|
|
<el-form ref="Form1" |
|
|
|
|
:model="Form" |
|
|
|
|
:rules="rules"> |
|
|
|
|
<el-form-item prop="gradeName"> |
|
|
|
|
<el-input placeholder="请输入部门名称" |
|
|
|
|
v-model="Form.gradeName"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-form> |
|
|
|
|
<span slot="footer" |
|
|
|
|
class="dialog-footer"> |
|
|
|
|
<el-button @click="depVisible = false">取 消</el-button> |
|
|
|
|
<el-button type="primary" |
|
|
|
|
@click="sureDepartment('Form1')">确 定</el-button> |
|
|
|
|
</span> |
|
|
|
|
</el-dialog> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
<script> |
|
|
|
|
import util from "@/libs/util"; |
|
|
|
|
import OrgTree from "@/components/org-tree/src/tree"; |
|
|
|
|
export default { |
|
|
|
|
props: ["Data"], |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
orgList: [], |
|
|
|
|
firactive: 0, |
|
|
|
|
twoactive: 0, |
|
|
|
|
majorVisible: false, |
|
|
|
|
depVisible: false, |
|
|
|
|
Form: { |
|
|
|
|
staffArchitectureId: "", // 专业ID |
|
|
|
|
staffArchitectureName: "", // // 专业名称 |
|
|
|
|
gradeId: "", |
|
|
|
|
gradeName: "" |
|
|
|
|
}, |
|
|
|
|
rules: { |
|
|
|
|
staffArchitectureName: [ |
|
|
|
|
{ required: true, message: "请输入部门名称", trigger: "blur" } |
|
|
|
|
], |
|
|
|
|
gradeName: [ |
|
|
|
|
{ required: true, message: "请输入部门名称", trigger: "blur" } |
|
|
|
|
] |
|
|
|
|
}, |
|
|
|
|
staffstateProfessId: "", |
|
|
|
|
staffstateId: "", |
|
|
|
|
}; |
|
|
|
|
props: ["Data"], |
|
|
|
|
data () { |
|
|
|
|
return { |
|
|
|
|
orgList: [], |
|
|
|
|
firactive: 0, |
|
|
|
|
twoactive: 0, |
|
|
|
|
majorVisible: false, |
|
|
|
|
depVisible: false, |
|
|
|
|
Form: { |
|
|
|
|
staffArchitectureId: "", // 专业ID |
|
|
|
|
staffArchitectureName: "", // // 专业名称 |
|
|
|
|
gradeId: "", |
|
|
|
|
gradeName: "" |
|
|
|
|
}, |
|
|
|
|
rules: { |
|
|
|
|
staffArchitectureName: [ |
|
|
|
|
{ required: true, message: "请输入部门名称", trigger: "blur" } |
|
|
|
|
], |
|
|
|
|
gradeName: [ |
|
|
|
|
{ required: true, message: "请输入部门名称", trigger: "blur" } |
|
|
|
|
] |
|
|
|
|
}, |
|
|
|
|
staffstateProfessId: "", |
|
|
|
|
staffstateId: "", |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
components: { |
|
|
|
|
OrgTree |
|
|
|
|
}, |
|
|
|
|
mounted () { |
|
|
|
|
this.getStaff() |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
getStaff () { |
|
|
|
|
this.$get(this.api.professionalList).then(res => { |
|
|
|
|
if (res.data && res.data.length) { |
|
|
|
|
res.data.map(e => { |
|
|
|
|
(e.ifVisible = false), (e.ischeck = false), (e.label = e.staffArchitectureName), (e.id = e.staffArchitectureId); |
|
|
|
|
let data = { |
|
|
|
|
staffArchitectureId: e.staffArchitectureId |
|
|
|
|
} |
|
|
|
|
this.$get(this.api.staffGradeList, data).then(res => { |
|
|
|
|
res.data.map(e => { |
|
|
|
|
(e.ischeck = false), (e.label = e.gradeName), (e.id = e.gradeId) |
|
|
|
|
}) |
|
|
|
|
e.children = res.data |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
setTimeout(() => { |
|
|
|
|
this.orgList = res.data; |
|
|
|
|
}, 500) |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
}, |
|
|
|
|
components: { |
|
|
|
|
OrgTree |
|
|
|
|
closeAdd () { |
|
|
|
|
this.$refs.Form.resetFields() |
|
|
|
|
}, |
|
|
|
|
mounted() { |
|
|
|
|
this.getStaff() |
|
|
|
|
getSingle (data) { |
|
|
|
|
this.$emit('getSingle', data) |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
getStaff() { |
|
|
|
|
this.$get(this.api.professionalList).then(res => { |
|
|
|
|
if (res.data && res.data.length) { |
|
|
|
|
res.data.map(e => { |
|
|
|
|
(e.ifVisible = false), (e.ischeck = false), (e.label = e.staffArchitectureName), (e.id = e.staffArchitectureId); |
|
|
|
|
let data = { |
|
|
|
|
staffArchitectureId: e.staffArchitectureId |
|
|
|
|
} |
|
|
|
|
this.$get(this.api.staffGradeList, data).then(res => { |
|
|
|
|
res.data.map(e => { |
|
|
|
|
(e.ischeck = false), (e.label = e.gradeName), (e.id = e.gradeId) |
|
|
|
|
}) |
|
|
|
|
e.children = res.data |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
setTimeout(() => { |
|
|
|
|
this.orgList = res.data; |
|
|
|
|
}, 500) |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}, |
|
|
|
|
closeAdd() { |
|
|
|
|
this.$refs.Form.resetFields() |
|
|
|
|
}, |
|
|
|
|
getSingle(data) { |
|
|
|
|
this.$emit('getSingle', data) |
|
|
|
|
}, |
|
|
|
|
getCheck(data, checked) { |
|
|
|
|
this.$emit('getCheck', checked.checkedNodes) |
|
|
|
|
}, |
|
|
|
|
// 新增编辑专业 |
|
|
|
|
addMajor() { |
|
|
|
|
this.Form.staffArchitectureId = '' |
|
|
|
|
this.Form.staffArchitectureName = '' |
|
|
|
|
this.majorVisible = true |
|
|
|
|
}, |
|
|
|
|
sure(Form) { // 提交新增/修改专业 |
|
|
|
|
this.$refs[Form].validate((valid) => { |
|
|
|
|
if (valid) { |
|
|
|
|
let data = { |
|
|
|
|
staffArchitectureName: this.Form.staffArchitectureName, |
|
|
|
|
staffArchitectureId: this.Form.staffArchitectureId, |
|
|
|
|
isDel: 0 // 是否删除(0、未删除 1、已删除) |
|
|
|
|
}; |
|
|
|
|
if (this.Form.staffArchitectureId) { |
|
|
|
|
this.$post(this.api.updateProfessional, data).then(res => { |
|
|
|
|
util.successMsg("编辑成功"); |
|
|
|
|
this.majorVisible = false; |
|
|
|
|
this.orgList.map(e => { |
|
|
|
|
if (e.staffArchitectureId == this.Form.staffArchitectureId) { |
|
|
|
|
e.staffArchitectureName = this.Form.staffArchitectureName; |
|
|
|
|
e.label = this.Form.staffArchitectureName; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
this.$emit("getData"); |
|
|
|
|
}).catch(res => { |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
this.$post(this.api.saveProfessional, data).then(res => { |
|
|
|
|
util.successMsg("添加成功"); |
|
|
|
|
this.majorVisible = false; |
|
|
|
|
this.getStaff() |
|
|
|
|
// let newData = { |
|
|
|
|
// staffArchitectureId: res.staffArchitectureId, |
|
|
|
|
// staffArchitectureName: this.Form.staffArchitectureName, |
|
|
|
|
// label: this.Form.staffArchitectureName, |
|
|
|
|
// value: res.staffArchitectureId, |
|
|
|
|
// ifVisible: false, |
|
|
|
|
// ischeck: false, |
|
|
|
|
// children: [] |
|
|
|
|
// }; |
|
|
|
|
// this.orgList.push(newData); |
|
|
|
|
}).catch(res => { |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
return false; |
|
|
|
|
getCheck (data, checked) { |
|
|
|
|
this.$emit('getCheck', checked.checkedNodes) |
|
|
|
|
}, |
|
|
|
|
// 新增编辑专业 |
|
|
|
|
addMajor () { |
|
|
|
|
this.Form.staffArchitectureId = '' |
|
|
|
|
this.Form.staffArchitectureName = '' |
|
|
|
|
this.majorVisible = true |
|
|
|
|
}, |
|
|
|
|
sure (Form) { // 提交新增/修改专业 |
|
|
|
|
this.$refs[Form].validate((valid) => { |
|
|
|
|
if (valid) { |
|
|
|
|
let data = { |
|
|
|
|
staffArchitectureName: this.Form.staffArchitectureName, |
|
|
|
|
staffArchitectureId: this.Form.staffArchitectureId, |
|
|
|
|
isDel: 0 // 是否删除(0、未删除 1、已删除) |
|
|
|
|
}; |
|
|
|
|
if (this.Form.staffArchitectureId) { |
|
|
|
|
this.$post(this.api.updateProfessional, data).then(res => { |
|
|
|
|
util.successMsg("编辑成功"); |
|
|
|
|
this.majorVisible = false; |
|
|
|
|
this.orgList.map(e => { |
|
|
|
|
if (e.staffArchitectureId == this.Form.staffArchitectureId) { |
|
|
|
|
e.staffArchitectureName = this.Form.staffArchitectureName; |
|
|
|
|
e.label = this.Form.staffArchitectureName; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
this.$emit("getData"); |
|
|
|
|
}).catch(res => { |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
handleAdd(node, data) { // 添加部门 |
|
|
|
|
this.Form.gradeId = '' |
|
|
|
|
this.Form.gradeName = '' |
|
|
|
|
this.depVisible = true |
|
|
|
|
this.Form.staffArchitectureId = data.staffArchitectureId |
|
|
|
|
}, |
|
|
|
|
handleEdit(node, data) { // 编辑部门 |
|
|
|
|
if (node.level === 1) { |
|
|
|
|
this.Form.staffArchitectureId = data.staffArchitectureId |
|
|
|
|
this.Form.staffArchitectureName = data.staffArchitectureName |
|
|
|
|
this.majorVisible = true |
|
|
|
|
} else { |
|
|
|
|
this.Form.gradeId = data.gradeId |
|
|
|
|
this.Form.gradeName = data.gradeName |
|
|
|
|
this.depVisible = true |
|
|
|
|
} |
|
|
|
|
for (let j = 0; j < this.orgList.length; j++) { |
|
|
|
|
for (let k = 0; k < this.orgList[j].children.length; k++) { |
|
|
|
|
if (this.orgList[j].children[k].gradeName == data.gradeName) { |
|
|
|
|
this.Form.staffArchitectureId = this.orgList[j].staffArchitectureId; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
sureDepartment(Form) { // 提交新增编辑部门 |
|
|
|
|
this.$refs[Form].validate((valid) => { |
|
|
|
|
if (valid) { |
|
|
|
|
let data = { |
|
|
|
|
gradeId: this.Form.gradeId, |
|
|
|
|
gradeName: this.Form.gradeName, |
|
|
|
|
staffArchitectureId: this.Form.staffArchitectureId |
|
|
|
|
}; |
|
|
|
|
if (this.Form.gradeId) { |
|
|
|
|
this.$post(this.api.updateGrade, data).then(res => { |
|
|
|
|
util.successMsg("编辑成功"); |
|
|
|
|
this.depVisible = false; |
|
|
|
|
this.orgList.map(e => { |
|
|
|
|
e.children.map(r => { |
|
|
|
|
if (r.gradeId == this.Form.gradeId) { |
|
|
|
|
r.gradeName = this.Form.gradeName; |
|
|
|
|
r.label = this.Form.gradeName; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
}).catch(res => { |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
this.$post(this.api.saveGrade, data).then(res => { |
|
|
|
|
util.successMsg("添加成功"); |
|
|
|
|
this.depVisible = false; |
|
|
|
|
this.getStaff() |
|
|
|
|
// let newData = { |
|
|
|
|
// gradeId: res.gradeId, |
|
|
|
|
// gradeName: this.Form.gradeName, |
|
|
|
|
// label: this.Form.gradeName, |
|
|
|
|
// value: res.gradeId, |
|
|
|
|
// ifVisible: false, |
|
|
|
|
// ischeck: false |
|
|
|
|
// }; |
|
|
|
|
// this.orgList.map(e => { |
|
|
|
|
// if (e.staffArchitectureId == this.Form.staffArchitectureId) { |
|
|
|
|
// e.ifVisible = true; |
|
|
|
|
// e.children.push(newData); |
|
|
|
|
// } |
|
|
|
|
// }); |
|
|
|
|
}).catch(res => { |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
this.$post(this.api.saveProfessional, data).then(res => { |
|
|
|
|
util.successMsg("添加成功"); |
|
|
|
|
this.majorVisible = false; |
|
|
|
|
this.getStaff() |
|
|
|
|
// let newData = { |
|
|
|
|
// staffArchitectureId: res.staffArchitectureId, |
|
|
|
|
// staffArchitectureName: this.Form.staffArchitectureName, |
|
|
|
|
// label: this.Form.staffArchitectureName, |
|
|
|
|
// value: res.staffArchitectureId, |
|
|
|
|
// ifVisible: false, |
|
|
|
|
// ischeck: false, |
|
|
|
|
// children: [] |
|
|
|
|
// }; |
|
|
|
|
// this.orgList.push(newData); |
|
|
|
|
}).catch(res => { |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
handleDel(node, data) { |
|
|
|
|
node.level === 1 ? this.delMajor(data) : this.delDepartment(data) |
|
|
|
|
}, |
|
|
|
|
delMajor(item) { |
|
|
|
|
this.$confirm("确定要删除该专业吗?该操作将会删除该组织下的用户账号。", "提示", { |
|
|
|
|
type: "warning" |
|
|
|
|
}).then(() => { |
|
|
|
|
this.$post(`${this.api.deleteProfessional}?staffArchitectureId=${item.staffArchitectureId}`).then(res => { |
|
|
|
|
util.successMsg("删除成功") |
|
|
|
|
this.$emit("getData") |
|
|
|
|
this.getStaff() |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}).catch(() => {}) |
|
|
|
|
}, |
|
|
|
|
delDepartment(item) { |
|
|
|
|
this.$confirm("确定要删除该部门吗?该操作将会删除该组织下的用户账号。", "提示", { |
|
|
|
|
type: "warning" |
|
|
|
|
}).then(() => { |
|
|
|
|
this.$post(`${this.api.deleteGrade}?gradeId=${item.gradeId}`).then(res => { |
|
|
|
|
util.successMsg("删除成功") |
|
|
|
|
this.getStaff() |
|
|
|
|
this.$emit("delDep", item, this.orgList) |
|
|
|
|
this.$emit("getData") |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}).catch(() => {}) |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
handleAdd (node, data) { // 添加部门 |
|
|
|
|
this.Form.gradeId = '' |
|
|
|
|
this.Form.gradeName = '' |
|
|
|
|
this.depVisible = true |
|
|
|
|
this.Form.staffArchitectureId = data.staffArchitectureId |
|
|
|
|
}, |
|
|
|
|
handleEdit (node, data) { // 编辑部门 |
|
|
|
|
if (node.level === 1) { |
|
|
|
|
this.Form.staffArchitectureId = data.staffArchitectureId |
|
|
|
|
this.Form.staffArchitectureName = data.staffArchitectureName |
|
|
|
|
this.majorVisible = true |
|
|
|
|
} else { |
|
|
|
|
this.Form.gradeId = data.gradeId |
|
|
|
|
this.Form.gradeName = data.gradeName |
|
|
|
|
this.depVisible = true |
|
|
|
|
} |
|
|
|
|
for (let j = 0; j < this.orgList.length; j++) { |
|
|
|
|
for (let k = 0; k < this.orgList[j].children.length; k++) { |
|
|
|
|
if (this.orgList[j].children[k].gradeName == data.gradeName) { |
|
|
|
|
this.Form.staffArchitectureId = this.orgList[j].staffArchitectureId; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
sureDepartment (Form) { // 提交新增编辑部门 |
|
|
|
|
this.$refs[Form].validate((valid) => { |
|
|
|
|
if (valid) { |
|
|
|
|
let data = { |
|
|
|
|
gradeId: this.Form.gradeId, |
|
|
|
|
gradeName: this.Form.gradeName, |
|
|
|
|
staffArchitectureId: this.Form.staffArchitectureId |
|
|
|
|
}; |
|
|
|
|
if (this.Form.gradeId) { |
|
|
|
|
this.$post(this.api.updateGrade, data).then(res => { |
|
|
|
|
util.successMsg("编辑成功"); |
|
|
|
|
this.depVisible = false; |
|
|
|
|
this.orgList.map(e => { |
|
|
|
|
e.children.map(r => { |
|
|
|
|
if (r.gradeId == this.Form.gradeId) { |
|
|
|
|
r.gradeName = this.Form.gradeName; |
|
|
|
|
r.label = this.Form.gradeName; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
}).catch(res => { |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
this.$post(this.api.saveGrade, data).then(res => { |
|
|
|
|
util.successMsg("添加成功"); |
|
|
|
|
this.depVisible = false; |
|
|
|
|
this.getStaff() |
|
|
|
|
// let newData = { |
|
|
|
|
// gradeId: res.gradeId, |
|
|
|
|
// gradeName: this.Form.gradeName, |
|
|
|
|
// label: this.Form.gradeName, |
|
|
|
|
// value: res.gradeId, |
|
|
|
|
// ifVisible: false, |
|
|
|
|
// ischeck: false |
|
|
|
|
// }; |
|
|
|
|
// this.orgList.map(e => { |
|
|
|
|
// if (e.staffArchitectureId == this.Form.staffArchitectureId) { |
|
|
|
|
// e.ifVisible = true; |
|
|
|
|
// e.children.push(newData); |
|
|
|
|
// } |
|
|
|
|
// }); |
|
|
|
|
}).catch(res => { |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
handleDel (node, data) { |
|
|
|
|
node.level === 1 ? this.delMajor(data) : this.delDepartment(data) |
|
|
|
|
}, |
|
|
|
|
delMajor (item) { |
|
|
|
|
this.$confirm("确定要删除该专业吗?该操作将会删除该组织下的用户账号。", "提示", { |
|
|
|
|
type: "warning" |
|
|
|
|
}).then(() => { |
|
|
|
|
this.$post(`${this.api.deleteProfessional}?staffArchitectureId=${item.staffArchitectureId}`).then(res => { |
|
|
|
|
util.successMsg("删除成功") |
|
|
|
|
this.$emit("getData") |
|
|
|
|
this.getStaff() |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
}).catch(() => { }) |
|
|
|
|
}, |
|
|
|
|
delDepartment (item) { |
|
|
|
|
this.$confirm("确定要删除该部门吗?该操作将会删除该组织下的用户账号。", "提示", { |
|
|
|
|
type: "warning" |
|
|
|
|
}).then(() => { |
|
|
|
|
this.$post(`${this.api.deleteGrade}?gradeId=${item.gradeId}`).then(res => { |
|
|
|
|
util.successMsg("删除成功") |
|
|
|
|
this.getStaff() |
|
|
|
|
this.$emit("delDep", item, this.orgList) |
|
|
|
|
this.$emit("getData") |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
}).catch(() => { }) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
</script> |
|
|
|
|
<style scoped> |
|
|
|
@ -302,7 +321,7 @@ export default { |
|
|
|
|
.side_icon i { |
|
|
|
|
cursor: pointer; |
|
|
|
|
font-size: 20px; |
|
|
|
|
color: #9278FF; |
|
|
|
|
color: #9278ff; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.side_tree { |
|
|
|
@ -312,7 +331,7 @@ export default { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.side_tree i { |
|
|
|
|
color: #9278FF; |
|
|
|
|
color: #9278ff; |
|
|
|
|
margin-left: 10px; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -339,7 +358,7 @@ export default { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.two_active { |
|
|
|
|
color: #9278FF; |
|
|
|
|
color: #9278ff; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* .two_active:hover{ |
|
|
|
@ -348,7 +367,7 @@ export default { |
|
|
|
|
} */ |
|
|
|
|
.two_back:hover { |
|
|
|
|
cursor: pointer; |
|
|
|
|
color: #9278FF; |
|
|
|
|
color: #9278ff; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.mar_top { |
|
|
|
@ -382,11 +401,13 @@ export default { |
|
|
|
|
transform: rotate(180deg); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.list-enter-active, .list-leave-active { |
|
|
|
|
.list-enter-active, |
|
|
|
|
.list-leave-active { |
|
|
|
|
transition: all 1s; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.list-enter, .list-leave-to { |
|
|
|
|
.list-enter, |
|
|
|
|
.list-leave-to { |
|
|
|
|
opacity: 0; |
|
|
|
|
transform: translateY(-30px); |
|
|
|
|
} |
|
|
|
|