模型分类联调及管理日志

dev_2022-03-03
yujialong 3 years ago
parent 47404574f7
commit 9c448af60b
  1. 6
      src/utils/api.js
  2. 342
      src/views/serve/backstage/modelType.vue
  3. 108
      src/views/serve/backstage/sourceType.vue
  4. 198
      src/views/system/log.vue
  5. 318
      src/views/system/manageLog.vue

@ -99,9 +99,15 @@ export default {
updateProjectJudgment: `${host}/occupationlab/projectJudgment/updateProjectJudgment`, // 判分点中间表批量更新 updateProjectJudgment: `${host}/occupationlab/projectJudgment/updateProjectJudgment`, // 判分点中间表批量更新
deleteProjectJudgment: `${host}/occupationlab/projectJudgment/deleteProjectJudgment`, // 判分点中间表批量删除 deleteProjectJudgment: `${host}/occupationlab/projectJudgment/deleteProjectJudgment`, // 判分点中间表批量删除
// 系统后台 // 系统后台
deleteModelClass: `${host}/nakadai/model/reference/deleteModelClass`,
modelClassList: `${host}/nakadai/model/reference/modelClassList`,
saveReferenceCategory: `${host}/nakadai/model/reference/saveReferenceCategory`,
updateModelClass: `${host}/nakadai/model/reference/updateModelClass`,
deleteSourceModelCategory: `${host}/nakadai/model/category/deleteSourceModelCategory`, deleteSourceModelCategory: `${host}/nakadai/model/category/deleteSourceModelCategory`,
categorySave: `${host}/nakadai/model/category/save`, categorySave: `${host}/nakadai/model/category/save`,
sourceModelClassification: `${host}/nakadai/model/category/sourceModelClassification`, sourceModelClassification: `${host}/nakadai/model/category/sourceModelClassification`,
updateSourceModelCategory: `${host}/nakadai/model/category/updateSourceModelCategory`,
bulkDisable: `${host}/nakadai/model/demo/bulkDisable`, bulkDisable: `${host}/nakadai/model/demo/bulkDisable`,
deleteSysModelDemo: `${host}/nakadai/model/demo/deleteSysModelDemo`, deleteSysModelDemo: `${host}/nakadai/model/demo/deleteSysModelDemo`,

@ -1,20 +1,21 @@
<template> <template>
<div> <div>
<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"> <div class="flex-between m-b-20">
<el-button type="text" icon="el-icon-refresh" @click="syncModel">同步原始模型列表</el-button> <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> </div>
<org-tree <org-tree
:data="orgList" :data="orgList"
show-checkbox
default-expand-all default-expand-all
ref="orgTree" ref="tree"
node-key="id" node-key="id"
highlight-current highlight-current
:expand-on-click-node="false" :expand-on-click-node="false"
@node-click="getSingle" @node-click="getSingle"
@check="getCheck"
:props="{children: 'children', label: 'categoryName', isLeaf: 'leaf'}" :props="{children: 'children', label: 'categoryName', isLeaf: 'leaf'}"
> >
<span class="custom-tree-node" slot-scope="{ node, data }"> <span class="custom-tree-node" slot-scope="{ node, data }">
@ -23,33 +24,32 @@
<el-button <el-button
type="text" type="text"
icon="el-icon-edit-outline" icon="el-icon-edit-outline"
@click="() => handleEdit(node, data)"> @click="editType(data)">
</el-button> </el-button>
<el-button <el-button
v-if="node.level === 1"
type="text" type="text"
icon="el-icon-circle-plus-outline" icon="el-icon-circle-plus-outline"
@click="() => handleAdd(node, data)"> @click="addType(node, data)">
</el-button> </el-button>
<el-button <el-button
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
@click="() => handleDel(node, data)"> @click="delType(data)">
</el-button> </el-button>
</span> </span>
</span> </span>
</org-tree> </org-tree>
</div> </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 ref="Form" :model="Form" :rules="rules">
<el-form-item prop="staffArchitectureName"> <el-form-item prop="categoryName">
<el-input placeholder="请输入分类名称" v-model="Form.staffArchitectureName"></el-input> <el-input placeholder="请输入分类名称" v-model="Form.categoryName"></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="typeVisible = false"> </el-button> <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> </span>
</el-dialog> </el-dialog>
</div> </div>
@ -60,12 +60,15 @@ export default {
props: ["Data"], props: ["Data"],
data() { data() {
return { return {
systemId: this.$route.query.systemId,
frontShow: false,
orgList: [], orgList: [],
typeVisible: false, typeVisible: false,
depVisible: false,
Form: { Form: {
id: '',
parentId: '', parentId: '',
categoryName: '' categoryName: '',
level: ''
}, },
rules: { rules: {
categoryName: [ categoryName: [
@ -78,286 +81,93 @@ export default {
OrgTree OrgTree
}, },
mounted() { mounted() {
// this.getStaff() this.getType()
}, },
methods: { methods: {
getStaff() { getType() {
this.$post(this.api.sourceModelClassification).then(res => { this.$post(`${this.api.modelClassList}?systemId=${this.systemId}`).then(res => {
this.orgList = res.data const { data } = res
this.orgList = data
data.length && this.$nextTick(() => {
this.$refs.tree.setCurrentKey(data[0].id)
this.getSingle()
})
}).catch(res => {}) }).catch(res => {})
}, },
closeAdd() { getSingle() {
this.$refs.Form.resetFields() this.$emit('initData')
},
getSingle(data) {
this.$emit('getSingle', data)
},
getCheck(data, checked) {
this.$emit('getCheck', checked.checkedNodes)
},
//
addMajor() {
this.Form.staffArchitectureId = ''
this.Form.staffArchitectureName = ''
this.typeVisible = true
}, },
// //
syncModel() { 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.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) { editType(data) {
this.Form.staffArchitectureId = data.staffArchitectureId this.Form.id = data.id
this.Form.staffArchitectureName = data.staffArchitectureName this.Form.categoryName = data.categoryName
this.typeVisible = true 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;
}
}
}
}, },
sureDepartment(Form) { // //
this.$refs[Form].validate((valid) => { submit() {
this.$refs['Form'].validate((valid) => {
if (valid) { if (valid) {
let data = { const form = this.Form
gradeId: this.Form.gradeId, const data = {
gradeName: this.Form.gradeName, id: form.id,
staffArchitectureId: this.Form.staffArchitectureId categoryName: form.categoryName,
}; systemId: this.systemId
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;
} }
}); if (data.id) {
}); this.$post(this.api.updateModelClass, data).then(res => {
}).catch(res => { this.$message.success("编辑成功")
}); this.typeVisible = false
this.getType()
}).catch(res => {})
} else { } else {
this.$post(this.api.saveGrade, data).then(res => { data.level = form.level
this.$message.success("添加成功"); data.parentId = form.parentId
this.depVisible = false; this.$post(this.api.saveReferenceCategory, data).then(res => {
let newData = { this.$message.success("添加成功")
gradeId: res.gradeId, this.typeVisible = false
gradeName: this.Form.gradeName, this.getType()
label: this.Form.gradeName, }).catch(res => {})
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) { closeDia() {
this.$confirm("确定要删除该专业吗?该操作将会删除该组织下的用户账号。", "提示", { this.$refs.Form.resetFields()
type: "warning" this.Form = {
}).then(() => { id: '',
this.$post(`${this.api.deleteProfessional}?staffArchitectureId=${item.staffArchitectureId}`).then(res => { parentId: '',
this.$message.success("删除成功") categoryName: ''
this.$emit("getData") }
this.getStaff()
}).catch(res => {})
}).catch(() => {})
}, },
delDepartment(item) { //
this.$confirm("确定要删除该分类吗?该操作将会删除该组织下的用户账号。", "提示", { delType(item) {
this.$confirm("确定要删除分类吗?", "提示", {
type: "warning" type: "warning"
}).then(() => { }).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.$message.success("删除成功")
this.getStaff()
this.$emit("delDep", item, this.orgList)
this.$emit("getData") this.$emit("getData")
this.getType()
}).catch(res => {}) }).catch(res => {})
}).catch(() => {}) }).catch(() => {})
} }
} }
}; };
</script> </script>
<style scoped> <style lang="scss" scoped>
.side_view { .front-switch {
height: 800px; padding-bottom: 10px;
padding: 40px 20px; margin-bottom: 5px;
background-color: #fff; border-bottom: 1px solid #f0f0f0;
}
.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> </style>

@ -92,9 +92,6 @@ export default {
getSingle() { getSingle() {
this.$emit('initData') this.$emit('initData')
}, },
getCheck(data, checked) {
this.$emit('getCheck', checked.checkedNodes)
},
// //
addType(node, data) { addType(node, data) {
this.typeVisible = true this.typeVisible = true
@ -118,8 +115,7 @@ export default {
systemId: this.systemId systemId: this.systemId
} }
if (data.id) { if (data.id) {
debugger this.$post(this.api.updateSourceModelCategory, data).then(res => {
this.$post(this.api.updateProfessional, data).then(res => {
this.$message.success("编辑成功") this.$message.success("编辑成功")
this.typeVisible = false this.typeVisible = false
this.getType() this.getType()
@ -159,106 +155,6 @@ export default {
} }
}; };
</script> </script>
<style scoped> <style lang="scss" 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> </style>

@ -9,8 +9,7 @@
</ul> </ul>
</div> </div>
<el-table :data="listData" class="table" ref="table" stripe header-align="center" @selection-change="handleSelectionChange" :row-key="getRowKeys"> <el-table :data="listData" class="table" ref="table" stripe header-align="center" row-key="id">
<el-table-column type="selection" width="55" align="center" :selectable="practiceSelectable" :reserve-selection="true"></el-table-column>
<el-table-column type="index" width="60" label="序号" align="center"></el-table-column> <el-table-column type="index" width="60" label="序号" align="center"></el-table-column>
<el-table-column prop="roleName" label="平台名称" align="center" min-width="250" show-overflow-tooltip></el-table-column> <el-table-column prop="roleName" label="平台名称" align="center" min-width="250" show-overflow-tooltip></el-table-column>
<el-table-column prop="roleName" label="最新版本名称" align="center"></el-table-column> <el-table-column prop="roleName" label="最新版本名称" align="center"></el-table-column>
@ -19,47 +18,17 @@
<el-table-column prop="roleName" label="版本数" align="center"></el-table-column> <el-table-column prop="roleName" label="版本数" align="center"></el-table-column>
<el-table-column label="操作" align="center" width="200"> <el-table-column label="操作" align="center" width="200">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="showRole(scope.row)">管理</el-button> <el-button type="text" @click="toManage(scope.row)">管理</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<div class="pagination"> <div class="pagination">
<el-pagination background @current-change="currentChange" :current-page="page" layout="total, prev, pager, next" :total="total"></el-pagination> <el-pagination background @current-change="currentChange" :current-page="page" layout="total, prev, pager, next" :total="total"></el-pagination>
</div> </div>
<el-dialog :title="isDetail ? '查看角色' : (isAdd ? '新增角色' : '编辑角色')" :visible.sync="roleVisible" width="30%" @close="closeRole" class="dialog" :close-on-click-modal="false">
<el-form ref="form" label-width="80px" :disabled="isDetail">
<el-form-item label="角色名称">
<el-input v-model="form.roleName" placeholder="请输入角色名称"></el-input>
</el-form-item>
<el-form-item label="角色描述">
<el-input v-model="form.remark" placeholder="请输入角色描述" type="textarea" rows="5"></el-input>
</el-form-item>
<el-form-item prop="role" label="角色权限">
<div style="max-height: 300px; overflow: auto">
<el-tree
ref="per"
:data="permissions"
show-checkbox
default-expand-all
node-key="id"
:default-expanded-keys="checkedIds"
:default-checked-keys="checkedIds"
:props="defaultProps">
</el-tree>
</div>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer" v-if="!isDetail">
<el-button @click="roleVisible = false"> </el-button>
<el-button type="primary" @click="saveData"> </el-button>
</span>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import Setting from "@/setting";
export default { export default {
data() { data() {
return { return {
@ -71,20 +40,12 @@ export default {
roleName: "", roleName: "",
remark: "" remark: ""
}, },
listData: [], listData: [
defaultProps: { {}
children: "children", ],
label: "name"
},
page: 1, page: 1,
pageSize: 10, pageSize: 10,
total: 0, total: 0
multipleSelection: [],
isAdd: true,
roleVisible: false,
permissions: [],
checkedIds: [],
roleNameReapeat: false //
}; };
}, },
watch: { watch: {
@ -109,151 +70,8 @@ export default {
this.page = val; this.page = val;
this.getData(); this.getData();
}, },
handleDelete(row) { toManage() {
this.$confirm("确定要删除吗?", "提示", { this.$router.push(`/manageLog`)
type: "warning"
}).then(() => {
this.$post(`${this.api.batchRemove}?roleIds=${row.id}`).then(res => {
this.$message.success("删除成功");
this.getData();
}).catch(res => {});
}).catch(() => {});
},
getRowKeys(row) {
return row.id;
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
delAllSelection() {
if (this.multipleSelection.length) {
this.$confirm("确定要删除吗?", "提示", {
type: "warning"
}).then(() => {
let ids = this.multipleSelection.map(item => {
return item.id;
});
this.$post(`${this.api.batchRemove}?roleIds=${ids.toString()}`).then(res => {
this.$refs.table.clearSelection();
this.$message.success("删除成功");
this.getData();
}).catch(res => {});
if(this.multipleSelection.length === this.listData.length && this.page>1) {
this.handleCurrentChange(this.page - 1)
}
}).catch(() => {});
} else {
this.$message.error("请先选择数据!");
}
},
practiceSelectable(row, index){
let boolean = true;
if(row.roleName == '超级管理员'){
boolean = false
}else{
boolean = true
}
return boolean;
},
closeRole() {
this.isDetail = false;
this.form = {
id: "",
roleName: "",
remark: ""
};
this.checkedIds = [];
this.permissions = [];
},
//
getPer(row) {
if (!this.permissions.length) {
this.$get(`${this.api.queryAllMenus}?platformId=${Setting.platformId}`).then(res => {
let data = res.children;
//
let yw = data.findIndex(n => n.name == "业务后台");
yw != -1 && data.splice(yw, 1);
try {
let system = data.findIndex(n => n.name == "系统设置");
if (system != -1) {
data[system].children[1].children.splice(4, 1);
data[system].children[1].children.splice(1, 1);
data[system].children[1].children.splice(0, 1);
}
} catch (error) {
}
this.permissions = data;
if (row) {
this.getDetail(row);
}
}).catch(res => {
});
}
},
addRole() {
this.isAdd = true;
this.getPer();
this.checkedIds = [];
this.permissions.length && this.$refs.per.setCheckedNodes([]);
this.roleVisible = true;
},
//
handleRolePer(data, permissions) {
let result = data;
if (permissions.length) {
permissions.map(e => {
if (result.includes(e.id) && e.children) {
// ,idid,,,
e.children.every(n => result.includes(n)) || result.splice(result.indexOf(e.id), 1);
}
e.children && e.children.length && this.handleRolePer(data, e.children);
});
}
return result;
},
async getDetail(row) { //
let res = await this.$get(`${this.api.obtainDetails}?id=${row.id}`);
this.form = res.role;
this.form.id = row.id;
this.checkedIds = this.handleRolePer(res.permissionList, this.permissions);
this.$refs.per.setCheckedNodes(this.checkedIds);
},
showRole(row) {
this.isDetail = true;
this.isAdd = false;
this.getPer(row);
this.roleVisible = true;
},
editRole(row) {
this.isAdd = false;
this.getPer(row);
this.roleVisible = true;
},
async saveData() {
if (!this.form.roleName) return this.$message.warning("请填写角色名称");
if (!this.form.remark) return this.$message.warning("请填写角色描述");
if (!this.$refs.per.getCheckedKeys().length) return this.$message.warning("请选择角色权限");
// ,(),
let permissionId = [...this.$refs.per.getHalfCheckedKeys(), ...this.$refs.per.getCheckedKeys()];
let data = {
...this.form,
permissionId,
platformId:1,
};
if (this.form.id) {
this.$post(this.api.saveOrUpdate, data).then(res => {
this.$message.success("修改成功");
this.getData();
this.roleVisible = false;
}).catch(res => {});
} else {
this.$post(this.api.saveOrUpdate, data).then(res => {
this.$message.success("新增成功");
this.getData();
this.roleVisible = false;
}).catch(res => {});
}
} }
} }
}; };

@ -1,100 +1,55 @@
<template> <template>
<div class="page"> <div class="page">
<h6 class="p-title">筛选</h6>
<div class="tool"> <div class="tool">
<ul class="filter"> <div class="filters">
<li> <h6>日志更新</h6>
<el-input placeholder="请输入日志名称" prefix-icon="el-icon-search" v-model.trim="keyword" clearable></el-input> <div class="filter">
</li> <label>版本查询</label>
</ul> <el-select v-model="value" size="small" placeholder="请选择版本">
<el-option
v-for="item in vers"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</div> </div>
<el-table :data="listData" class="table" ref="table" stripe header-align="center" @selection-change="handleSelectionChange" :row-key="getRowKeys">
<el-table-column type="selection" width="55" align="center" :selectable="practiceSelectable" :reserve-selection="true"></el-table-column>
<el-table-column type="index" width="60" label="序号" align="center"></el-table-column>
<el-table-column prop="roleName" label="平台名称" align="center" min-width="250" show-overflow-tooltip></el-table-column>
<el-table-column prop="roleName" label="最新版本名称" align="center"></el-table-column>
<el-table-column prop="roleName" label="最新版本状态" align="center"></el-table-column>
<el-table-column prop="roleName" label="最近编辑" align="center"></el-table-column>
<el-table-column prop="roleName" label="版本数" align="center"></el-table-column>
<el-table-column label="操作" align="center" width="200">
<template slot-scope="scope">
<el-button type="text" @click="showRole(scope.row)">管理</el-button>
</template>
</el-table-column>
</el-table>
<div class="pagination">
<el-pagination background @current-change="currentChange" :current-page="page" layout="total, prev, pager, next" :total="total"></el-pagination>
</div> </div>
<div>
<el-dialog :title="isDetail ? '查看角色' : (isAdd ? '新增角色' : '编辑角色')" :visible.sync="roleVisible" width="30%" @close="closeRole" class="dialog" :close-on-click-modal="false"> <el-button type="primary">新增日志</el-button>
<el-form ref="form" label-width="80px" :disabled="isDetail"> </div>
<el-form-item label="角色名称">
<el-input v-model="form.roleName" placeholder="请输入角色名称"></el-input>
</el-form-item>
<el-form-item label="角色描述">
<el-input v-model="form.remark" placeholder="请输入角色描述" type="textarea" rows="5"></el-input>
</el-form-item>
<el-form-item prop="role" label="角色权限">
<div style="max-height: 300px; overflow: auto">
<el-tree
ref="per"
:data="permissions"
show-checkbox
default-expand-all
node-key="id"
:default-expanded-keys="checkedIds"
:default-checked-keys="checkedIds"
:props="defaultProps">
</el-tree>
</div> </div>
</el-form-item> <el-timeline class="timeline">
</el-form> <el-timeline-item placement="top">
<span slot="footer" class="dialog-footer" v-if="!isDetail"> <p class="sign">2022-03-05</p>
<el-button @click="roleVisible = false"> </el-button> <div class="ver">
<el-button type="primary" @click="saveData"> </el-button> <div>
职站V1.0
<span class="action">
<i class="el-icon-edit-outline"></i>
<i class="el-icon-delete" @click="del"></i>
</span> </span>
</el-dialog> </div>
<el-switch v-model="frontShow" :active-value="0" :inactive-value="1"></el-switch>
</div>
<ul class="detail">
<li>
<p class="name">修复</p>
<div class="val">测试测试测试测试测试测试</div>
</li>
</ul>
</el-timeline-item>
</el-timeline>
</div> </div>
</template> </template>
<script> <script>
import Setting from "@/setting";
export default { export default {
data() { data() {
return { return {
keyword: "", vers: []
searchTimer: null,
isDetail: false,
form: {
id: "",
roleName: "",
remark: ""
},
listData: [],
defaultProps: {
children: "children",
label: "name"
},
page: 1,
pageSize: 10,
total: 0,
multipleSelection: [],
isAdd: true,
roleVisible: false,
permissions: [],
checkedIds: [],
roleNameReapeat: false //
}; };
}, },
watch: {
keyword: function(val) {
clearTimeout(this.searchTimer);
this.searchTimer = setTimeout(() => {
this.getData();
}, 500);
}
},
mounted() { mounted() {
// this.getData(); // this.getData();
}, },
@ -105,159 +60,80 @@ export default {
this.total = res.rolePage.total; this.total = res.rolePage.total;
}).catch(res => {}); }).catch(res => {});
}, },
currentChange(val) { //
this.page = val; del(item) {
this.getData(); this.$confirm("确定要删除分类吗?", "提示", {
},
handleDelete(row) {
this.$confirm("确定要删除吗?", "提示", {
type: "warning" type: "warning"
}).then(() => { }).then(() => {
this.$post(`${this.api.batchRemove}?roleIds=${row.id}`).then(res => { this.$post(`${this.api.deleteModelClass}?categoryId=${item.id}`).then(res => {
this.$message.success("删除成功"); this.$message.success("删除成功")
this.getData(); this.$emit("getData")
}).catch(res => {}); this.getType()
}).catch(() => {}); }).catch(res => {})
}, }).catch(() => {})
getRowKeys(row) {
return row.id;
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
delAllSelection() {
if (this.multipleSelection.length) {
this.$confirm("确定要删除吗?", "提示", {
type: "warning"
}).then(() => {
let ids = this.multipleSelection.map(item => {
return item.id;
});
this.$post(`${this.api.batchRemove}?roleIds=${ids.toString()}`).then(res => {
this.$refs.table.clearSelection();
this.$message.success("删除成功");
this.getData();
}).catch(res => {});
if(this.multipleSelection.length === this.listData.length && this.page>1) {
this.handleCurrentChange(this.page - 1)
} }
}).catch(() => {});
} else {
this.$message.error("请先选择数据!");
} }
}, };
practiceSelectable(row, index){ </script>
let boolean = true; <style lang="scss" scoped>
if(row.roleName == '超级管理员'){ .page {
boolean = false padding: 24px 200px;
}else{ }
boolean = true .tool {
padding-bottom: 20px;
border-bottom: 1px solid #f0f0f0;
}
.filters {
display: inline-flex;
align-items: center;
h6 {
font-size: 18px;
} }
return boolean; .filter {
}, margin-left: 100px;
closeRole() {
this.isDetail = false;
this.form = {
id: "",
roleName: "",
remark: ""
};
this.checkedIds = [];
this.permissions = [];
},
//
getPer(row) {
if (!this.permissions.length) {
this.$get(`${this.api.queryAllMenus}?platformId=${Setting.platformId}`).then(res => {
let data = res.children;
//
let yw = data.findIndex(n => n.name == "业务后台");
yw != -1 && data.splice(yw, 1);
try {
let system = data.findIndex(n => n.name == "系统设置");
if (system != -1) {
data[system].children[1].children.splice(4, 1);
data[system].children[1].children.splice(1, 1);
data[system].children[1].children.splice(0, 1);
} }
} catch (error) { }
.timeline {
margin-left: 20%;
.sign {
margin: -11px 0 0 -10%;
font-size: 14px;
color: #9076FF;
} }
this.permissions = data; .ver {
if (row) { display: flex;
this.getDetail(row); justify-content: space-between;
align-items: center;
margin: -22px 0 20px;
font-size: 18px;
color: #9076FF;
cursor: pointer;
} }
}).catch(res => { .action {
}); margin-left: 15px;
i {
margin-left: 5px;
font-size: 14px;
cursor: pointer;
&:hover {
opacity: .9;
} }
},
addRole() {
this.isAdd = true;
this.getPer();
this.checkedIds = [];
this.permissions.length && this.$refs.per.setCheckedNodes([]);
this.roleVisible = true;
},
//
handleRolePer(data, permissions) {
let result = data;
if (permissions.length) {
permissions.map(e => {
if (result.includes(e.id) && e.children) {
// ,idid,,,
e.children.every(n => result.includes(n)) || result.splice(result.indexOf(e.id), 1);
} }
e.children && e.children.length && this.handleRolePer(data, e.children);
});
} }
return result; .detail {
}, li {
async getDetail(row) { // margin-bottom: 10px;
let res = await this.$get(`${this.api.obtainDetails}?id=${row.id}`);
this.form = res.role;
this.form.id = row.id;
this.checkedIds = this.handleRolePer(res.permissionList, this.permissions);
this.$refs.per.setCheckedNodes(this.checkedIds);
},
showRole(row) {
this.isDetail = true;
this.isAdd = false;
this.getPer(row);
this.roleVisible = true;
},
editRole(row) {
this.isAdd = false;
this.getPer(row);
this.roleVisible = true;
},
async saveData() {
if (!this.form.roleName) return this.$message.warning("请填写角色名称");
if (!this.form.remark) return this.$message.warning("请填写角色描述");
if (!this.$refs.per.getCheckedKeys().length) return this.$message.warning("请选择角色权限");
// ,(),
let permissionId = [...this.$refs.per.getHalfCheckedKeys(), ...this.$refs.per.getCheckedKeys()];
let data = {
...this.form,
permissionId,
platformId:1,
};
if (this.form.id) {
this.$post(this.api.saveOrUpdate, data).then(res => {
this.$message.success("修改成功");
this.getData();
this.roleVisible = false;
}).catch(res => {});
} else {
this.$post(this.api.saveOrUpdate, data).then(res => {
this.$message.success("新增成功");
this.getData();
this.roleVisible = false;
}).catch(res => {});
} }
.name {
font-size: 14px;
} }
.val {
font-size: 16px;
line-height: 1.8;
} }
}; }
</script> .switch {
<style lang="scss" scoped>
}
}
</style> </style>
Loading…
Cancel
Save