巡查的权限

master
刘翔宇-旅管家 4 years ago
parent ec720efac2
commit a2ecf5a97a

@ -15,9 +15,9 @@
</div> </div>
<div ref="lxTable"> <div ref="lxTable">
<el-table :data="tableData" class="v-table" :height="tableHeight" style="width: 100%"> <el-table :data="tableData" class="v-table" :height="tableHeight" style="width: 100%">
<el-table-column type="index" width="50" label="序号" align="center"> </el-table-column> <el-table-column type="index" width="50" label="序号" align="center" :fixed="left"> </el-table-column>
<el-table-column :prop="column.field" :align="column.align" v-for="(column,index) in columns" <el-table-column :prop="column.field" :align="column.align" v-for="(column,index) in columns"
:label="column.title" :width="column.width"> :label="column.title" :width="column.width" :fixed="column.fixed">
<template slot-scope="scope"> <template slot-scope="scope">
<div v-if="column.type=='opt'"> <div v-if="column.type=='opt'">
<Button ghost size="small" @click="edit(scope.row)" type="primary" <Button ghost size="small" @click="edit(scope.row)" type="primary"
@ -25,8 +25,14 @@
<Button ghost size="small" @click="del(scope.row)" type="error" style="margin-left: 10px;">删除</Button> <Button ghost size="small" @click="del(scope.row)" type="error" style="margin-left: 10px;">删除</Button>
</div> </div>
<div v-else-if="column.type=='format'"> <div v-else-if="column.type=='format'">
<div v-if="column.field=='menu'">
{{showMenu(scope.row["allow_menu_list"])}}
</div>
<div v-else>
{{scope.row[column.field]?scope.row[column.field].name:""}} {{scope.row[column.field]?scope.row[column.field].name:""}}
</div> </div>
</div>
<div v-else>{{scope.row[column.field]}}</div> <div v-else>{{scope.row[column.field]}}</div>
</template> </template>
</el-table-column> </el-table-column>
@ -63,11 +69,7 @@
<el-col :span="24"> <el-col :span="24">
<el-form-item label="所属片区" prop="area_id"> <el-form-item label="所属片区" prop="area_id">
<el-select style="width:100%" v-model="form.area_id" placeholder="请选择所属片区"> <el-select style="width:100%" v-model="form.area_id" placeholder="请选择所属片区">
<el-option <el-option v-for="item in areaList" :key="item.id" :label="item.name" :value="item.id">
v-for="item in areaList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -75,11 +77,7 @@
<el-col :span="24"> <el-col :span="24">
<el-form-item label="所属养护单位" prop="maintain_id"> <el-form-item label="所属养护单位" prop="maintain_id">
<el-select style="width:100%" v-model="form.maintain_id" placeholder="请选择所属养护单位"> <el-select style="width:100%" v-model="form.maintain_id" placeholder="请选择所属养护单位">
<el-option <el-option v-for="item in maintainList" :key="item.id" :label="item.name" :value="item.id">
v-for="item in maintainList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -87,11 +85,7 @@
<el-col :span="24"> <el-col :span="24">
<el-form-item label="巡查养护组" prop="group_id"> <el-form-item label="巡查养护组" prop="group_id">
<el-select style="width:100%" v-model="form.group_id" placeholder="请选择巡查养护组"> <el-select style="width:100%" v-model="form.group_id" placeholder="请选择巡查养护组">
<el-option <el-option v-for="item in groupList" :key="item.id" :label="item.name" :value="item.id">
v-for="item in groupList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -148,56 +142,52 @@
dialogFormVisible: false, dialogFormVisible: false,
formLabelWidth: "120px", formLabelWidth: "120px",
tableData: [], tableData: [],
areaList:[], areaList: [],
maintainList:[], maintainList: [],
groupList:[], groupList: [],
tableHeight: 0, tableHeight: 0,
searchFields: { searchFields: {
KeyWord: "" KeyWord: ""
}, },
roleList:[{ roleList: [{
id:1, id: "1",
value:"巡查管理" value: "巡查管理"
},{ }, {
id:2, id: "2",
value:"养护管理" value: "养护管理"
},{ }, {
id:3, id: "3",
value:"监督考核" value: "监督考核"
},{ }, {
id:4, id: "4",
value:"通用巡查" value: "通用巡查"
},], }, ],
roleArr:[], roleArr: [],
paginations: { paginations: {
page: 1, page: 1,
page_size: 15, page_size: 15,
total: 0 total: 0
}, },
form: { form: {
name:"", name: "",
username:"", username: "",
password:"", password: "",
area_id:"", area_id: "",
maintain_id:"", maintain_id: "",
group_id:"" group_id: "",
allow_menu_ids: ""
}, },
rules: { rules: {
name:[{ name: [{
required: true, required: true,
message: '请填写名字', message: '请填写名字',
trigger: 'blur', trigger: 'blur',
}], }],
username:[{ username: [{
required: true, required: true,
message: '请填写账号', message: '请填写账号',
trigger: 'blur', trigger: 'blur',
}],
password:[{
required: true,
message: '请填写密码',
trigger: 'blur',
}] }]
}, },
@ -232,25 +222,25 @@
type: "format", type: "format",
align: "center" align: "center"
}, },
// { {
// field: "admin_id", field: "menu",
// title: "", title: "功能权限",
// type: "string", type: "format",
// align: "center", align: "center"
// width:180 },
// },
{ {
field: "created_at", field: "created_at",
title: "提交日期", title: "提交日期",
type: "string", type: "string",
align: "center", align: "center",
width:180 width: 180
}, },
{ {
field: "操作", field: "操作",
title: "操作", title: "操作",
width: 220, width: 220,
type: "opt", type: "opt",
fixed: "right"
} }
], ],
} }
@ -261,6 +251,23 @@
}, },
methods: { methods: {
showMenu(listMenu) {
if (listMenu.length == 0) {
return "不限";
} else {
var sb = [];
for (var m of listMenu) {
var r = this.roleList.filter((item) => {
return item.id == m;
});
if (r.length == 1) {
sb.push(r[0].value);
}
}
return sb.join(",");
}
},
initLoad() { initLoad() {
var that = this; var that = this;
var clientHeight = document.documentElement.clientHeight var clientHeight = document.documentElement.clientHeight
@ -323,6 +330,7 @@
show(obj) { show(obj) {
// this.clientHeight = document.documentElement.clientHeight - 84 - 110; // this.clientHeight = document.documentElement.clientHeight - 84 - 110;
this.dialogViewVisible = false; this.dialogViewVisible = false;
this.info(obj); this.info(obj);
}, },
info(obj) { info(obj) {
@ -331,6 +339,7 @@
let result = Object.assign(that.form, res); let result = Object.assign(that.form, res);
// this.$set(that.form,res); // this.$set(that.form,res);
that.form = result; that.form = result;
that.roleArr = result.allow_menu_list;
}).catch(error => { }).catch(error => {
//reject(error) //reject(error)
@ -338,7 +347,8 @@
}, },
edit(obj) { edit(obj) {
this.form = this.$options.data().form this.form = this.$options.data().form;
this.roleArr = [];
if (obj) { if (obj) {
this.info(obj) this.info(obj)
} }
@ -370,6 +380,7 @@
// return; // return;
this.$refs[formName].validate((valid) => { this.$refs[formName].validate((valid) => {
if (valid) { if (valid) {
that.form.allow_menu_ids = that.roleArr.join(",");
if (that.form.id) { if (that.form.id) {
save(that.form).then(response => { save(that.form).then(response => {
this.$Message.success('操作成功'); this.$Message.success('操作成功');
@ -408,7 +419,8 @@
.dialogConcent { .dialogConcent {
overflow-y: auto; overflow-y: auto;
} }
.width100{
width:100%; .width100 {
width: 100%;
} }
</style> </style>

Loading…
Cancel
Save