模型分类联调及管理日志

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

@ -99,9 +99,15 @@ export default {
updateProjectJudgment: `${host}/occupationlab/projectJudgment/updateProjectJudgment`, // 判分点中间表批量更新
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`,
categorySave: `${host}/nakadai/model/category/save`,
sourceModelClassification: `${host}/nakadai/model/category/sourceModelClassification`,
updateSourceModelCategory: `${host}/nakadai/model/category/updateSourceModelCategory`,
bulkDisable: `${host}/nakadai/model/demo/bulkDisable`,
deleteSysModelDemo: `${host}/nakadai/model/demo/deleteSysModelDemo`,

@ -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>

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

@ -9,8 +9,7 @@
</ul>
</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 :data="listData" class="table" ref="table" stripe header-align="center" row-key="id">
<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>
@ -19,47 +18,17 @@
<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>
<el-button type="text" @click="toManage(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>
<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>
</template>
<script>
import Setting from "@/setting";
export default {
data() {
return {
@ -71,20 +40,12 @@ export default {
roleName: "",
remark: ""
},
listData: [],
defaultProps: {
children: "children",
label: "name"
},
listData: [
{}
],
page: 1,
pageSize: 10,
total: 0,
multipleSelection: [],
isAdd: true,
roleVisible: false,
permissions: [],
checkedIds: [],
roleNameReapeat: false //
total: 0
};
},
watch: {
@ -109,151 +70,8 @@ export default {
this.page = val;
this.getData();
},
handleDelete(row) {
this.$confirm("确定要删除吗?", "提示", {
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 => {});
}
toManage() {
this.$router.push(`/manageLog`)
}
}
};

@ -1,100 +1,55 @@
<template>
<div class="page">
<h6 class="p-title">筛选</h6>
<div class="tool">
<ul class="filter">
<li>
<el-input placeholder="请输入日志名称" prefix-icon="el-icon-search" v-model.trim="keyword" clearable></el-input>
</li>
</ul>
<div class="filters">
<h6>日志更新</h6>
<div class="filter">
<label>版本查询</label>
<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>
<div>
<el-button type="primary">新增日志</el-button>
</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>
<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>
<el-timeline class="timeline">
<el-timeline-item placement="top">
<p class="sign">2022-03-05</p>
<div class="ver">
<div>
职站V1.0
<span class="action">
<i class="el-icon-edit-outline"></i>
<i class="el-icon-delete" @click="del"></i>
</span>
</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>
<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>
</template>
<script>
import Setting from "@/setting";
export default {
data() {
return {
keyword: "",
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 //
vers: []
};
},
watch: {
keyword: function(val) {
clearTimeout(this.searchTimer);
this.searchTimer = setTimeout(() => {
this.getData();
}, 500);
}
},
mounted() {
// this.getData();
},
@ -105,159 +60,80 @@ export default {
this.total = res.rolePage.total;
}).catch(res => {});
},
currentChange(val) {
this.page = val;
this.getData();
},
handleDelete(row) {
this.$confirm("确定要删除吗?", "提示", {
//
del(item) {
this.$confirm("确定要删除分类吗?", "提示", {
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 => {});
}
this.$post(`${this.api.deleteModelClass}?categoryId=${item.id}`).then(res => {
this.$message.success("删除成功")
this.$emit("getData")
this.getType()
}).catch(res => {})
}).catch(() => {})
}
}
};
</script>
<style lang="scss" scoped>
.page {
padding: 24px 200px;
}
.tool {
padding-bottom: 20px;
border-bottom: 1px solid #f0f0f0;
}
.filters {
display: inline-flex;
align-items: center;
h6 {
font-size: 18px;
}
.filter {
margin-left: 100px;
}
}
.timeline {
margin-left: 20%;
.sign {
margin: -11px 0 0 -10%;
font-size: 14px;
color: #9076FF;
}
.ver {
display: flex;
justify-content: space-between;
align-items: center;
margin: -22px 0 20px;
font-size: 18px;
color: #9076FF;
cursor: pointer;
}
.action {
margin-left: 15px;
i {
margin-left: 5px;
font-size: 14px;
cursor: pointer;
&:hover {
opacity: .9;
}
}
}
.detail {
li {
margin-bottom: 10px;
}
.name {
font-size: 14px;
}
.val {
font-size: 16px;
line-height: 1.8;
}
}
.switch {
}
}
</style>
Loading…
Cancel
Save