|
|
|
@ -1,20 +1,21 @@ |
|
|
|
|
<template> |
|
|
|
|
<div> |
|
|
|
|
<div> |
|
|
|
|
<div class="front-switch"> |
|
|
|
|
<el-switch v-model="frontShow" :active-value="0" :inactive-value="1" active-text="内置模型按钮前台展示"></el-switch> |
|
|
|
|
</div> |
|
|
|
|
<div class="flex-between m-b-20"> |
|
|
|
|
<el-button type="text" icon="el-icon-refresh" @click="syncModel">同步原始模型列表</el-button> |
|
|
|
|
<el-button type="text" @click="addMajor">添加</el-button> |
|
|
|
|
<el-button type="text" @click="addType(0)">添加</el-button> |
|
|
|
|
</div> |
|
|
|
|
<org-tree |
|
|
|
|
:data="orgList" |
|
|
|
|
show-checkbox |
|
|
|
|
default-expand-all |
|
|
|
|
ref="orgTree" |
|
|
|
|
ref="tree" |
|
|
|
|
node-key="id" |
|
|
|
|
highlight-current |
|
|
|
|
:expand-on-click-node="false" |
|
|
|
|
@node-click="getSingle" |
|
|
|
|
@check="getCheck" |
|
|
|
|
:props="{children: 'children', label: 'categoryName', isLeaf: 'leaf'}" |
|
|
|
|
> |
|
|
|
|
<span class="custom-tree-node" slot-scope="{ node, data }"> |
|
|
|
@ -23,33 +24,32 @@ |
|
|
|
|
<el-button |
|
|
|
|
type="text" |
|
|
|
|
icon="el-icon-edit-outline" |
|
|
|
|
@click="() => handleEdit(node, data)"> |
|
|
|
|
@click="editType(data)"> |
|
|
|
|
</el-button> |
|
|
|
|
<el-button |
|
|
|
|
v-if="node.level === 1" |
|
|
|
|
type="text" |
|
|
|
|
icon="el-icon-circle-plus-outline" |
|
|
|
|
@click="() => handleAdd(node, data)"> |
|
|
|
|
@click="addType(node, data)"> |
|
|
|
|
</el-button> |
|
|
|
|
<el-button |
|
|
|
|
type="text" |
|
|
|
|
icon="el-icon-delete" |
|
|
|
|
@click="() => handleDel(node, data)"> |
|
|
|
|
@click="delType(data)"> |
|
|
|
|
</el-button> |
|
|
|
|
</span> |
|
|
|
|
</span> |
|
|
|
|
</org-tree> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<el-dialog :title="Form.id ? '编辑分类' : '新增分类'" :visible.sync="typeVisible" width="24%" center @close="closeAdd" :close-on-click-modal="false"> |
|
|
|
|
<el-dialog :title="Form.id ? '编辑分类' : '新增分类'" :visible.sync="typeVisible" width="24%" center @close="closeDia" :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 prop="categoryName"> |
|
|
|
|
<el-input placeholder="请输入分类名称" v-model="Form.categoryName"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-form> |
|
|
|
|
<span slot="footer" class="dialog-footer"> |
|
|
|
|
<el-button @click="typeVisible = false">取 消</el-button> |
|
|
|
|
<el-button type="primary" @click="sure('Form')">确 定</el-button> |
|
|
|
|
<el-button type="primary" @click="submit">确 定</el-button> |
|
|
|
|
</span> |
|
|
|
|
</el-dialog> |
|
|
|
|
</div> |
|
|
|
@ -60,12 +60,15 @@ export default { |
|
|
|
|
props: ["Data"], |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
systemId: this.$route.query.systemId, |
|
|
|
|
frontShow: false, |
|
|
|
|
orgList: [], |
|
|
|
|
typeVisible: false, |
|
|
|
|
depVisible: false, |
|
|
|
|
Form: { |
|
|
|
|
id: '', |
|
|
|
|
parentId: '', |
|
|
|
|
categoryName: '' |
|
|
|
|
categoryName: '', |
|
|
|
|
level: '' |
|
|
|
|
}, |
|
|
|
|
rules: { |
|
|
|
|
categoryName: [ |
|
|
|
@ -78,286 +81,93 @@ export default { |
|
|
|
|
OrgTree |
|
|
|
|
}, |
|
|
|
|
mounted() { |
|
|
|
|
// this.getStaff() |
|
|
|
|
this.getType() |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
getStaff() { |
|
|
|
|
this.$post(this.api.sourceModelClassification).then(res => { |
|
|
|
|
this.orgList = res.data |
|
|
|
|
getType() { |
|
|
|
|
this.$post(`${this.api.modelClassList}?systemId=${this.systemId}`).then(res => { |
|
|
|
|
const { data } = res |
|
|
|
|
this.orgList = data |
|
|
|
|
data.length && this.$nextTick(() => { |
|
|
|
|
this.$refs.tree.setCurrentKey(data[0].id) |
|
|
|
|
this.getSingle() |
|
|
|
|
}) |
|
|
|
|
}).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.typeVisible = true |
|
|
|
|
getSingle() { |
|
|
|
|
this.$emit('initData') |
|
|
|
|
}, |
|
|
|
|
// 同步原始模型 |
|
|
|
|
syncModel() { |
|
|
|
|
this.$confirm('同步后当前的组织架构将会被删除,是否继续?', '提示', { |
|
|
|
|
type: "warning" |
|
|
|
|
}).then(() => { |
|
|
|
|
// let ids = this.multipleSelection.map(item => { |
|
|
|
|
// return item.accountId; |
|
|
|
|
// }); |
|
|
|
|
// this.$post(`${this.api.delStaff}?accountIds=${ids.toString()}`).then(res => { |
|
|
|
|
// this.$refs.table.clearSelection(); |
|
|
|
|
// this.$message.success("删除成功"); |
|
|
|
|
// this.getData(); |
|
|
|
|
// }).catch(res => {}) |
|
|
|
|
}).catch(() => {}) |
|
|
|
|
}, |
|
|
|
|
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 => { |
|
|
|
|
this.$message.success("编辑成功"); |
|
|
|
|
this.typeVisible = 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 => { |
|
|
|
|
this.$message.success("添加成功"); |
|
|
|
|
this.typeVisible = false; |
|
|
|
|
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; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
handleAdd(node, data) { // 添加分类 |
|
|
|
|
// 添加分类 |
|
|
|
|
addType(node, data) { |
|
|
|
|
this.typeVisible = true |
|
|
|
|
this.Form.parentId = data.id |
|
|
|
|
this.Form.parentId = data ? data.id : 0 |
|
|
|
|
this.Form.level = node ? node.level : 0 |
|
|
|
|
}, |
|
|
|
|
handleEdit(node, data) { // 编辑分类 |
|
|
|
|
if (node.level === 1) { |
|
|
|
|
this.Form.staffArchitectureId = data.staffArchitectureId |
|
|
|
|
this.Form.staffArchitectureName = data.staffArchitectureName |
|
|
|
|
this.typeVisible = 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; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// 编辑分类 |
|
|
|
|
editType(data) { |
|
|
|
|
this.Form.id = data.id |
|
|
|
|
this.Form.categoryName = data.categoryName |
|
|
|
|
this.typeVisible = true |
|
|
|
|
}, |
|
|
|
|
sureDepartment(Form) { // 提交新增编辑分类 |
|
|
|
|
this.$refs[Form].validate((valid) => { |
|
|
|
|
// 保存分类 |
|
|
|
|
submit() { |
|
|
|
|
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 => { |
|
|
|
|
this.$message.success("编辑成功"); |
|
|
|
|
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 => { |
|
|
|
|
}); |
|
|
|
|
const form = this.Form |
|
|
|
|
const data = { |
|
|
|
|
id: form.id, |
|
|
|
|
categoryName: form.categoryName, |
|
|
|
|
systemId: this.systemId |
|
|
|
|
} |
|
|
|
|
if (data.id) { |
|
|
|
|
this.$post(this.api.updateModelClass, data).then(res => { |
|
|
|
|
this.$message.success("编辑成功") |
|
|
|
|
this.typeVisible = false |
|
|
|
|
this.getType() |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
} else { |
|
|
|
|
this.$post(this.api.saveGrade, data).then(res => { |
|
|
|
|
this.$message.success("添加成功"); |
|
|
|
|
this.depVisible = false; |
|
|
|
|
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 => { |
|
|
|
|
}); |
|
|
|
|
data.level = form.level |
|
|
|
|
data.parentId = form.parentId |
|
|
|
|
this.$post(this.api.saveReferenceCategory, data).then(res => { |
|
|
|
|
this.$message.success("添加成功") |
|
|
|
|
this.typeVisible = false |
|
|
|
|
this.getType() |
|
|
|
|
}).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 => { |
|
|
|
|
this.$message.success("删除成功") |
|
|
|
|
this.$emit("getData") |
|
|
|
|
this.getStaff() |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}).catch(() => {}) |
|
|
|
|
closeDia() { |
|
|
|
|
this.$refs.Form.resetFields() |
|
|
|
|
this.Form = { |
|
|
|
|
id: '', |
|
|
|
|
parentId: '', |
|
|
|
|
categoryName: '' |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
delDepartment(item) { |
|
|
|
|
this.$confirm("确定要删除该分类吗?该操作将会删除该组织下的用户账号。", "提示", { |
|
|
|
|
// 删除分类 |
|
|
|
|
delType(item) { |
|
|
|
|
this.$confirm("确定要删除分类吗?", "提示", { |
|
|
|
|
type: "warning" |
|
|
|
|
}).then(() => { |
|
|
|
|
this.$post(`${this.api.deleteGrade}?gradeId=${item.gradeId}`).then(res => { |
|
|
|
|
this.$post(`${this.api.deleteModelClass}?categoryId=${item.id}`).then(res => { |
|
|
|
|
this.$message.success("删除成功") |
|
|
|
|
this.getStaff() |
|
|
|
|
this.$emit("delDep", item, this.orgList) |
|
|
|
|
this.$emit("getData") |
|
|
|
|
this.getType() |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}).catch(() => {}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
</script> |
|
|
|
|
<style scoped> |
|
|
|
|
.side_view { |
|
|
|
|
height: 800px; |
|
|
|
|
padding: 40px 20px; |
|
|
|
|
background-color: #fff; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.side_icon { |
|
|
|
|
text-align: right; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.side_icon i { |
|
|
|
|
cursor: pointer; |
|
|
|
|
font-size: 20px; |
|
|
|
|
color: #9278FF; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.side_tree { |
|
|
|
|
width: 100%; |
|
|
|
|
font-size: 14px; |
|
|
|
|
color: #333; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.side_tree i { |
|
|
|
|
color: #9278FF; |
|
|
|
|
margin-left: 10px; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.fir_back { |
|
|
|
|
width: 100%; |
|
|
|
|
padding: 15px 0; |
|
|
|
|
background: rgba(255, 255, 255, 1); |
|
|
|
|
/* box-shadow:1px 14px 29px 0px rgba(138,97,250,0.19); */ |
|
|
|
|
border-radius: 10px; |
|
|
|
|
text-align: left; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.fir_back:first-child { |
|
|
|
|
margin-top: 20px; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.fir_back:hover { |
|
|
|
|
box-shadow: 1px 14px 29px 0px rgba(138, 97, 250, 0.19); |
|
|
|
|
cursor: pointer; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.fir_back span { |
|
|
|
|
margin-left: 10px; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.two_active { |
|
|
|
|
color: #9278FF; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* .two_active:hover{ |
|
|
|
|
color: #9278FF; |
|
|
|
|
cursor:pointer; |
|
|
|
|
} */ |
|
|
|
|
.two_back:hover { |
|
|
|
|
cursor: pointer; |
|
|
|
|
color: #9278FF; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.mar_top { |
|
|
|
|
margin-top: 20px; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.back_active { |
|
|
|
|
box-shadow: 1px 14px 29px 0px rgba(138, 97, 250, 0.19); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.bor_lef { |
|
|
|
|
padding: 20px 0 0 0; |
|
|
|
|
margin-left: 40px; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.three_lef { |
|
|
|
|
margin-left: 60px; |
|
|
|
|
padding: 20px 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.three_text { |
|
|
|
|
font-size: 14px; |
|
|
|
|
margin-top: 10px; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.teacher_tab { |
|
|
|
|
margin-left: 20px; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.icon_select:before { |
|
|
|
|
transform: rotate(180deg); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.list-enter-active, .list-leave-active { |
|
|
|
|
transition: all 1s; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.list-enter, .list-leave-to { |
|
|
|
|
opacity: 0; |
|
|
|
|
transform: translateY(-30px); |
|
|
|
|
<style lang="scss" scoped> |
|
|
|
|
.front-switch { |
|
|
|
|
padding-bottom: 10px; |
|
|
|
|
margin-bottom: 5px; |
|
|
|
|
border-bottom: 1px solid #f0f0f0; |
|
|
|
|
} |
|
|
|
|
</style> |
|
|
|
|