From aab7ba71765b91c568d606744b3376c2798dd969 Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Sat, 25 Sep 2021 17:06:03 +0800
Subject: [PATCH] 权限 保安公司管理员
---
src/views/securityEquipment/car.vue | 64 +++
src/views/securityEquipment/equipments.js | 6
src/views/securityGuard/securityGuard.vue | 4
src/views/recruitmentManagement/index.vue | 24 +
src/views/securityEquipment/gun.js | 12
src/views/securityEquipment/gun.vue | 61 +++
src/views/dispatch/dispatch.vue | 21 +
src/views/dispatch/dispatchChildoperable.vue | 13
src/views/securityEquipment/equipments.vue | 80 +++-
src/views/securityEquipment/car.js | 16
src/views/recruitmentManagement/data.js | 4
src/views/zc/zc.vue | 534 ++++++++++++++++++----------------
src/page/login/codelogin.vue | 2
13 files changed, 515 insertions(+), 326 deletions(-)
diff --git a/src/page/login/codelogin.vue b/src/page/login/codelogin.vue
index d359b6d..73152c3 100644
--- a/src/page/login/codelogin.vue
+++ b/src/page/login/codelogin.vue
@@ -305,7 +305,7 @@
this.$refs.loginForm.validate((valid) => {
if (valid) {
this.refreshCode(this.loginForm);
- this.message("dahsiofhiusa");
+ // this.message("dahsiofhiusa");
return Promise.reject(new Error("注册成功,待审核"));
}
});
diff --git a/src/views/dispatch/dispatch.vue b/src/views/dispatch/dispatch.vue
index 806c805..15f819f 100644
--- a/src/views/dispatch/dispatch.vue
+++ b/src/views/dispatch/dispatch.vue
@@ -377,6 +377,8 @@
},
],
},
+
+ useifid: 266,
};
},
created() {
@@ -387,6 +389,7 @@
deptColumn.editDisplay = false;
deptColumn.viewDisplay = false;
deptColumn.hide = true;
+ this.useifid = this.userInfo.dept_id;
}
},
computed: {
@@ -405,9 +408,9 @@
});
return ids1.join(",");
},
- ...mapState({
+ ...mapState({
userInfo: (state) => state.user.userInfo,
- })
+ }),
},
methods: {
handleChangeTABS(column) {
@@ -436,7 +439,10 @@
// this.$message.success("页码" + val);
},
rowSave(form, done, loading) {
- form["deptId"] = this.userInfo.dept_id;
+ // form["deptId"] = this.userInfo.dept_id;
+ if (this.useifid != 266) {
+ form["deptId"] = this.useifid;
+ }
adddata(form).then(
(res) => {
this.onLoad(this.page);
@@ -464,6 +470,9 @@
this.onLoad(this.page);
},
rowUpdate(row, index, done, loading) {
+ if (this.useifid != 266) {
+ row["deptId"] = this.useifid;
+ }
update(row).then(
() => {
this.onLoad(this.page);
@@ -575,8 +584,10 @@
...this.query,
};
}
-
- console.log(values);
+ if (this.useifid != 266) {
+ values["deptId"] = this.useifid;
+ }
+ // console.log(values);
getdata(
page.currentPage,
diff --git a/src/views/dispatch/dispatchChildoperable.vue b/src/views/dispatch/dispatchChildoperable.vue
index ab2717c..8e0550f 100644
--- a/src/views/dispatch/dispatchChildoperable.vue
+++ b/src/views/dispatch/dispatchChildoperable.vue
@@ -275,6 +275,7 @@
},
],
},
+ useifid: 266,
};
},
created() {
@@ -282,6 +283,8 @@
console.log("保安公司管理员登入");
const deptColumn = this.findObject(this.option1.column, "deptId");
deptColumn.search = false;
+ deptColumn.hide = true;
+ this.useifid = this.userInfo.dept_id;
} else {
const deptColumn = this.findObject(
this.option1.column,
@@ -338,7 +341,9 @@
// const userColumn = this.findObject(this.option1.column, "userIds");
// userColumn.dicUrl = "/api/blade-user/page-security-units?deptId="+this.userInfo.dept_id;
// }
-
+ if (this.useifid != 266) {
+ form["deptId"] = this.useifid;
+ }
adddata1(form).then(
(res) => {
this.onLoad1(this.page1);
@@ -370,6 +375,9 @@
// const userColumn = this.findObject(this.option1.column, "userIds");
// userColumn.dicUrl = "/api/blade-user/page-security-units?deptId="+this.userInfo.dept_id;
// }
+ if (this.useifid != 266) {
+ row["deptId"] = this.useifid;
+ }
update1(row).then(
() => {
this.onLoad1(this.page1);
@@ -490,6 +498,9 @@
} else {
this.initData(1);
}
+ if (this.useifid != 266) {
+ values["deptId"] = this.useifid;
+ }
getdata1(
page.currentPage,
diff --git a/src/views/recruitmentManagement/data.js b/src/views/recruitmentManagement/data.js
index d482386..d855e37 100644
--- a/src/views/recruitmentManagement/data.js
+++ b/src/views/recruitmentManagement/data.js
@@ -62,8 +62,8 @@
value: "id"
},
hide: true,
- // search: true,
- type: "select",
+ search: true,
+ type: "tree",
},
{
label: "招聘岗位",
diff --git a/src/views/recruitmentManagement/index.vue b/src/views/recruitmentManagement/index.vue
index fbbc4b2..6850d92 100644
--- a/src/views/recruitmentManagement/index.vue
+++ b/src/views/recruitmentManagement/index.vue
@@ -40,6 +40,7 @@
remove,
} from "@/api/recruitmentManagement/recruitmentManagement";
+import { mapGetters } from "vuex";
export default {
data() {
return {
@@ -65,9 +66,21 @@
selection: true,
column: column,
},
+ useifid: 266,
};
},
+ created() {
+ if (this.userInfo.role_name == "保安公司管理员") {
+ this.useifid = this.userInfo.dept_id;
+ const deptColumn = this.findObject(this.option.column, "deptId");
+ deptColumn.search = false;
+ deptColumn.hide = true;
+ deptColumn.disabled = true;
+ deptColumn.value = this.useifid;
+ }
+ },
computed: {
+ ...mapGetters(["userInfo"]),
ids() {
let ids = [];
this.selectionList.forEach((ele) => {
@@ -93,6 +106,9 @@
// var form = this.data[0];
// delete form.id;
// for (var k = 0; k < 13; k++) {
+ if (this.useifid != 266) {
+ form["deptId"] = this.useifid;
+ }
adddata(form).then(
(res) => {
this.onLoad(this.page);
@@ -120,7 +136,9 @@
this.onLoad(this.page);
},
rowUpdate(row, index, done, loading) {
- console.log(row);
+ if (this.useifid != 266) {
+ row["deptId"] = this.useifid;
+ }
update(row).then(
() => {
this.onLoad(this.page);
@@ -183,6 +201,9 @@
},
onLoad(page, params = {}) {
this.loading = true;
+ if (this.useifid != 266) {
+ params["deptId"] = this.useifid;
+ }
getdata(
page.currentPage,
page.pageSize,
@@ -192,7 +213,6 @@
const data = res.data.data;
this.page.total = data.total;
this.data = data.records;
- console.log(this.data);
this.loading = false;
});
},
diff --git a/src/views/securityEquipment/car.js b/src/views/securityEquipment/car.js
index 7d472fc..714b9fb 100644
--- a/src/views/securityEquipment/car.js
+++ b/src/views/securityEquipment/car.js
@@ -76,25 +76,25 @@
{
label: "所属保安公司",
prop: "deptId",
+ searchSpan: 6,
+ searchLabelWidth: 110,
rules: [{
required: true,
- message: "请输入保安公司",
+ message: "请输入所属保安公司",
trigger: "blur"
}],
- search: true,
- // addDisplay: true,
- // editDisplay: true,
- // viewDisplay: true,
- searchSpan: 4,
- searchLabelWidth: 110,
+ hide: true,
+ addDisplay: false,
+ editDisplay: false,
+ search: false,
overHidden: true,
- // searchSpan: 4,
dicUrl: "/api/blade-system/dept/security_lazy-tree?parentId=1413470343230877697",
props: {
label: "title",
value: "id"
},
type: "tree",
+ width: 250,
},
{
label: "责任人",
diff --git a/src/views/securityEquipment/car.vue b/src/views/securityEquipment/car.vue
index 88a517e..a73c164 100644
--- a/src/views/securityEquipment/car.vue
+++ b/src/views/securityEquipment/car.vue
@@ -26,7 +26,7 @@
>删 除
</el-button>
<el-button
- style="display:none"
+ style="display: none"
type="success"
size="small"
plain
@@ -61,7 +61,7 @@
<script>
import { data, column } from "./car";
import { getdata, adddata, update, remove } from "@/api/car/car";
-
+import { mapGetters } from "vuex";
export default {
props: ["fromDeptId"],
data() {
@@ -114,12 +114,14 @@
menuWidth: 160,
align: "center",
selection: true,
- labelWidth:110,
+ labelWidth: 110,
column: column,
},
+ useifid: 266,
};
},
computed: {
+ ...mapGetters(["userInfo"]),
ids() {
let ids = [];
this.selectionList.forEach((ele) => {
@@ -127,6 +129,14 @@
});
return ids.join(",");
},
+ },
+ created() {
+ if (
+ this.userInfo.role_name == "装备管理员" ||
+ this.userInfo.role_name == "保安公司管理员"
+ ) {
+ this.useifid = this.userInfo.dept_id;
+ }
},
methods: {
handleImport() {
@@ -164,6 +174,9 @@
if (this.fromDeptId != undefined) {
form["deptId"] = this.fromDeptId;
}
+ if (this.useifid != 266) {
+ form["deptId"] = this.useifid;
+ }
adddata(form).then(
(res) => {
this.onLoad(this.page);
@@ -196,6 +209,9 @@
// delete row.tenantName;
if (this.fromDeptId != undefined) {
row["deptId"] = this.fromDeptId;
+ }
+ if (this.useifid != 266) {
+ row["deptId"] = this.useifid;
}
update(row).then(
() => {
@@ -257,20 +273,46 @@
refreshChange() {
this.onLoad(this.page, this.query);
},
+ closeDep(name) {
+ for (let k in this.option.column) {
+ if (this.option.column[k].prop == name) {
+ this.option.column[k].search = false;
+ this.option.column[k].hide = true;
+ this.option.column[k].addDisplay = false;
+ this.option.column[k].editDisplay = false;
+ }
+ }
+ },
+ openDep(name) {
+ for (let k in this.option.column) {
+ if (this.option.column[k].prop == name) {
+ this.option.column[k].search = true;
+ this.option.column[k].hide = false;
+ this.option.column[k].addDisplay = true;
+ this.option.column[k].editDisplay = true;
+ }
+ }
+ },
onLoad(page, params = {}) {
this.loading = true;
// console.log(params.deptId);
if (this.fromDeptId != undefined) {
params["deptId"] = this.fromDeptId;
- this.option.column[4].search = false;
- this.option.column[4].hide = true;
- this.option.column[4].addDisplay = false;
- this.option.column[4].editDisplay = false;
+ // this.closeDep("deptId");
+ } else if (this.useifid != 266) {
+ console.log(123);
+ params["deptId"] = this.useifid;
+ // this.closeDep("deptId");
+ // for (let k in this.option.column) {
+ // if (this.option.column[k].prop == "deptId") {
+ // this.option.column[4].search = false;
+ // this.option.column[k].hide = true;
+ // this.option.column[k].addDisplay = false;
+ // this.option.column[k].editDisplay = false;
+ // }
+ // }
} else {
- this.option.column[4].search = true;
- this.option.column[4].hide = false;
- this.option.column[4].addDisplay = true;
- this.option.column[4].editDisplay = true;
+ this.openDep("deptId");
}
getdata(
page.currentPage,
diff --git a/src/views/securityEquipment/equipments.js b/src/views/securityEquipment/equipments.js
index 7cab161..56e3d78 100644
--- a/src/views/securityEquipment/equipments.js
+++ b/src/views/securityEquipment/equipments.js
@@ -56,8 +56,10 @@
message: "请输入所属保安公司",
trigger: "blur"
}],
- hide: false,
- search: true,
+ hide: true,
+ addDisplay: false,
+ editDisplay: false,
+ search: false,
overHidden: true,
dicUrl: "/api/blade-system/dept/security_lazy-tree?parentId=1413470343230877697",
props: {
diff --git a/src/views/securityEquipment/equipments.vue b/src/views/securityEquipment/equipments.vue
index 1d7800b..78246d7 100644
--- a/src/views/securityEquipment/equipments.vue
+++ b/src/views/securityEquipment/equipments.vue
@@ -60,7 +60,7 @@
<script>
import { data, column } from "./equipments";
import { getdata, adddata, update, remove } from "@/api/equipments/equipments";
-
+import { mapGetters } from "vuex";
export default {
props: ["fromDeptId"],
data() {
@@ -116,9 +116,12 @@
column: column,
labelWidth: 110,
},
+
+ useifid: 266,
};
},
computed: {
+ ...mapGetters(["userInfo"]),
ids() {
let ids = [];
this.selectionList.forEach((ele) => {
@@ -126,6 +129,14 @@
});
return ids.join(",");
},
+ },
+ created() {
+ if (
+ this.userInfo.role_name == "装备管理员" ||
+ this.userInfo.role_name == "保安公司管理员"
+ ) {
+ this.useifid = this.userInfo.dept_id;
+ }
},
methods: {
handleImport() {
@@ -164,6 +175,9 @@
if (this.fromDeptId != undefined) {
form["deptId"] = this.fromDeptId;
}
+ if (this.useifid != 266) {
+ form["deptId"] = this.useifid;
+ }
adddata(form).then(
(res) => {
this.onLoad(this.page);
@@ -197,6 +211,9 @@
// console.log(row.deptId);
if (this.fromDeptId != undefined) {
row["deptId"] = this.fromDeptId;
+ }
+ if (this.useifid != 266) {
+ row["deptId"] = this.useifid;
}
update(row).then(
() => {
@@ -258,39 +275,48 @@
refreshChange() {
this.onLoad(this.page, this.query);
},
+ closeDep(name) {
+ for (let k in this.option.column) {
+ if (this.option.column[k].prop == name) {
+ this.option.column[k].search = false;
+ this.option.column[k].hide = true;
+ this.option.column[k].addDisplay = false;
+ this.option.column[k].editDisplay = false;
+ }
+ }
+ },
+ openDep(name) {
+ for (let k in this.option.column) {
+ if (this.option.column[k].prop == name) {
+ this.option.column[k].search = true;
+ this.option.column[k].hide = false;
+ this.option.column[k].addDisplay = true;
+ this.option.column[k].editDisplay = true;
+ }
+ }
+ },
onLoad(page, params = {}) {
this.loading = true;
// console.log(params.deptId);
if (this.fromDeptId != undefined) {
params["deptId"] = this.fromDeptId;
- for (let k in this.option.column) {
- if (this.option.column[k].prop == "deptId") {
- this.option.column[k].search = false;
- this.option.column[k].hide = true;
- this.option.column[k].addDisplay = false;
- this.option.column[k].editDisplay = false;
- }
- }
- // this.option.column[4]. = false;
- // this.option.column[6].search = false;
- // this.option.column[6].hide = true;
- // this.option.column[6].addDisplay = false;
- // this.option.column[6].editDisplay = false;
+ // this.closeDep("deptId");
+ } else if (this.useifid != 266) {
+ console.log(123);
+ params["deptId"] = this.useifid;
+ // this.closeDep("deptId");
+ // for (let k in this.option.column) {
+ // if (this.option.column[k].prop == "deptId") {
+ // this.option.column[4].search = false;
+ // this.option.column[k].hide = true;
+ // this.option.column[k].addDisplay = false;
+ // this.option.column[k].editDisplay = false;
+ // }
+ // }
} else {
- for (let k in this.option.column) {
- if (this.option.column[k].prop == "deptId") {
- this.option.column[k].search = true;
- this.option.column[k].hide = false;
- this.option.column[k].addDisplay = true;
- this.option.column[k].editDisplay = true;
- }
- }
- // this.option.column[4].search = true;
- // this.option.column[6].search = true;
- // this.option.column[6].hide = false;
- // this.option.column[6].addDisplay = true;
- // this.option.column[6].editDisplay = true;
+ this.openDep("deptId");
}
+
getdata(
page.currentPage,
page.pageSize,
diff --git a/src/views/securityEquipment/gun.js b/src/views/securityEquipment/gun.js
index 329f8b4..63d8864 100644
--- a/src/views/securityEquipment/gun.js
+++ b/src/views/securityEquipment/gun.js
@@ -68,23 +68,25 @@
{
label: "所属保安公司",
prop: "deptId",
- search: true,
- searchSpan: 4,
+ searchSpan: 6,
searchLabelWidth: 110,
- labelWidth: 160,
rules: [{
required: true,
- message: "请输入组织机构",
+ message: "请输入所属保安公司",
trigger: "blur"
}],
+ hide: true,
+ addDisplay: false,
+ editDisplay: false,
+ search: false,
overHidden: true,
- // searchSpan: 4,
dicUrl: "/api/blade-system/dept/security_lazy-tree?parentId=1413470343230877697",
props: {
label: "title",
value: "id"
},
type: "tree",
+ width: 250,
},
{
label: "责任人",
diff --git a/src/views/securityEquipment/gun.vue b/src/views/securityEquipment/gun.vue
index 7bc403c..751aa10 100644
--- a/src/views/securityEquipment/gun.vue
+++ b/src/views/securityEquipment/gun.vue
@@ -35,6 +35,7 @@
import { data, column } from "./gun";
import { getdata, adddata, update, remove } from "@/api/gun/gun";
+import { mapGetters } from "vuex";
export default {
props: ["fromDeptId"],
data() {
@@ -59,12 +60,14 @@
align: "center",
border: true,
selection: true,
- labelWidth:110,
+ labelWidth: 110,
column: column,
},
+ useifid: 266,
};
},
computed: {
+ ...mapGetters(["userInfo"]),
ids() {
let ids = [];
this.selectionList.forEach((ele) => {
@@ -72,6 +75,14 @@
});
return ids.join(",");
},
+ },
+ created() {
+ if (
+ this.userInfo.role_name == "装备管理员" ||
+ this.userInfo.role_name == "保安公司管理员"
+ ) {
+ this.useifid = this.userInfo.dept_id;
+ }
},
methods: {
sizeChange(val) {
@@ -94,6 +105,9 @@
// delete form.tenantName;
if (this.fromDeptId != undefined) {
form["deptId"] = this.fromDeptId;
+ }
+ if (this.useifid != 266) {
+ form["deptId"] = this.useifid;
}
adddata(form).then(
(res) => {
@@ -127,6 +141,9 @@
// delete row.tenantName;
if (this.fromDeptId != undefined) {
row["deptId"] = this.fromDeptId;
+ }
+ if (this.useifid != 266) {
+ row["deptId"] = this.useifid;
}
update(row).then(
() => {
@@ -188,20 +205,46 @@
refreshChange() {
this.onLoad(this.page, this.query);
},
+ closeDep(name) {
+ for (let k in this.option.column) {
+ if (this.option.column[k].prop == name) {
+ this.option.column[k].search = false;
+ this.option.column[k].hide = true;
+ this.option.column[k].addDisplay = false;
+ this.option.column[k].editDisplay = false;
+ }
+ }
+ },
+ openDep(name) {
+ for (let k in this.option.column) {
+ if (this.option.column[k].prop == name) {
+ this.option.column[k].search = true;
+ this.option.column[k].hide = false;
+ this.option.column[k].addDisplay = true;
+ this.option.column[k].editDisplay = true;
+ }
+ }
+ },
onLoad(page, params = {}) {
this.loading = true;
// console.log(params.deptId);
if (this.fromDeptId != undefined) {
params["deptId"] = this.fromDeptId;
- this.option.column[5].search = false;
- this.option.column[5].hide = true;
- this.option.column[5].addDisplay = false;
- this.option.column[5].editDisplay = false;
+ // this.closeDep("deptId");
+ } else if (this.useifid != 266) {
+ console.log(123);
+ params["deptId"] = this.useifid;
+ // this.closeDep("deptId");
+ // for (let k in this.option.column) {
+ // if (this.option.column[k].prop == "deptId") {
+ // this.option.column[4].search = false;
+ // this.option.column[k].hide = true;
+ // this.option.column[k].addDisplay = false;
+ // this.option.column[k].editDisplay = false;
+ // }
+ // }
} else {
- this.option.column[5].search = true;
- this.option.column[5].hide = false;
- this.option.column[5].addDisplay = true;
- this.option.column[5].editDisplay = true;
+ this.openDep("deptId");
}
getdata(
page.currentPage,
diff --git a/src/views/securityGuard/securityGuard.vue b/src/views/securityGuard/securityGuard.vue
index f2eafe1..8999b56 100644
--- a/src/views/securityGuard/securityGuard.vue
+++ b/src/views/securityGuard/securityGuard.vue
@@ -589,7 +589,7 @@
},
action: "/api/blade-resource/oss/endpoint/put-files",
tip: "只能上传jpg/png个人头像,且不超过500kb",
- span: 10,
+ span: 12,
// row: true,
prop: "avatar",
},
@@ -607,7 +607,7 @@
},
action: "/api/blade-resource/oss/endpoint/put-files",
tip: "只能上传jpg/png指纹信息,且不超过500kb",
- span: 10,
+ span: 12,
// row: true,
prop: "fingerprint",
},
diff --git a/src/views/zc/zc.vue b/src/views/zc/zc.vue
index 1ff5804..4f90985 100644
--- a/src/views/zc/zc.vue
+++ b/src/views/zc/zc.vue
@@ -1,295 +1,327 @@
<template>
<basic-container>
- <avue-crud :option="option"
- :table-loading="loading"
- :data="data"
- :page.sync="page"
- :permission="permissionList"
- :before-open="beforeOpen"
- v-model="form"
- ref="crud"
- @row-update="rowUpdate"
- @row-save="rowSave"
- @row-del="rowDel"
- @search-change="searchChange"
- @search-reset="searchReset"
- @selection-change="selectionChange"
- @current-change="currentChange"
- @size-change="sizeChange"
- @refresh-change="refreshChange"
- @on-load="onLoad">
+ <avue-crud
+ :option="option"
+ :table-loading="loading"
+ :data="data"
+ :page.sync="page"
+ :permission="permissionList"
+ :before-open="beforeOpen"
+ v-model="form"
+ ref="crud"
+ @row-update="rowUpdate"
+ @row-save="rowSave"
+ @row-del="rowDel"
+ @search-change="searchChange"
+ @search-reset="searchReset"
+ @selection-change="selectionChange"
+ @current-change="currentChange"
+ @size-change="sizeChange"
+ @refresh-change="refreshChange"
+ @on-load="onLoad"
+ >
<template slot="menuLeft">
- <el-button type="danger"
- size="small"
- icon="el-icon-delete"
- plain
- v-if="permission.zc_delete"
- @click="handleDelete">删 除
+ <el-button
+ type="danger"
+ size="small"
+ icon="el-icon-delete"
+ plain
+ v-if="permission.zc_delete"
+ @click="handleDelete"
+ >删 除
</el-button>
</template>
- <template slot-scope="{row}" slot="type">
- <el-tag>{{row.type==='0'?'未审核':row.type==='1'?'审核通过':'审核未通过'}}</el-tag>
+ <template slot-scope="{ row }" slot="type">
+ <el-tag>{{
+ row.type === "0"
+ ? "未审核"
+ : row.type === "1"
+ ? "审核通过"
+ : "审核未通过"
+ }}</el-tag>
</template>
- <template slot-scope="{row}"
- slot="roleName">
- <el-tag>{{row.roleName}}</el-tag>
+ <template slot-scope="{ row }" slot="roleName">
+ <el-tag>{{ row.roleName }}</el-tag>
</template>
<template slot-scope="scope" slot="menu">
- <el-button icon="el-icon-check" size="small" @click.stop="handleEdit(scope.row,scope.index)">审核</el-button>
+ <el-button
+ icon="el-icon-check"
+ size="small"
+ @click.stop="handleEdit(scope.row, scope.index)"
+ >审核</el-button
+ >
</template>
</avue-crud>
-
-
</basic-container>
</template>
<script>
- import {getList, getDetail, add, update, remove} from "@/api/zc/zc";
- import {getRoleTree} from "@/api/system/role";
- import {mapGetters} from "vuex";
+import { getList, getDetail, add, update, remove } from "@/api/zc/zc";
+import { getRoleTree } from "@/api/system/role";
+import { mapGetters } from "vuex";
- export default {
- data() {
- return {
- form: {},
- query: {},
- loading: true,
- page: {
- pageSize: 10,
- currentPage: 1,
- total: 0
- },
- selectionList: [],
- option: {
- height:'auto',
- calcHeight: 54,
- tip: false,
- searchShow: true,
- searchMenuSpan: 4,
- border: true,
- index: true,
- viewBtn: true,
- selection: true,
- headerAlign: 'center',
- align: 'center',
- dialogClickModal: false,
- column: [
- {
- label: "账号",
- searchSpan:4,
- display: false,
- search: true,
- disabled:true,
- prop: "username",
+export default {
+ data() {
+ return {
+ form: {},
+ query: {},
+ loading: true,
+ page: {
+ pageSize: 10,
+ currentPage: 1,
+ total: 0,
+ },
+ selectionList: [],
+ option: {
+ height: "auto",
+ calcHeight: 54,
+ tip: false,
+ searchShow: true,
+ searchMenuSpan: 4,
+ border: true,
+ index: true,
+ viewBtn: true,
+ selection: true,
+ headerAlign: "center",
+ align: "center",
+ dialogClickModal: false,
+ column: [
+ {
+ label: "账号",
+ searchSpan: 4,
+ display: false,
+ search: true,
+ disabled: true,
+ prop: "username",
+ },
+ {
+ label: "密码",
+ hide: true,
+ editDisplay: false,
+ viewDisplay: false,
+ prop: "password",
+ },
+ {
+ label: "姓名",
+ display: false,
+ search: true,
+ searchSpan: 4,
+ disabled: true,
+ prop: "sname",
+ },
+ {
+ label: "身份证号",
+ disabled: true,
+ search: true,
+ display: false,
+ prop: "cardid",
+ },
+ {
+ label: "部门",
+ editDisplay: false,
+ prop: "deptName",
+ },
+ {
+ label: "角色",
+ prop: "parentId",
+ hide: true,
+ dicData: [],
+ type: "tree",
+ props: {
+ label: "title",
},
- {
- label: "密码",
- hide: true,
- editDisplay: false,
- viewDisplay: false,
- prop: "password",
- },
- {
- label: "姓名",
- display: false,
- search: true,
- searchSpan:4,
- disabled:true,
- prop: "sname",
- },
- {
- label: "身份证号",
- disabled:true,
- search: true,
- display: false,
- prop: "cardid",
- },
- {
- label: "部门",
- editDisplay: false,
- prop: "deptName",
- },
- {
- label: "角色",
- prop: "parentId",
- hide: true,
- dicData: [],
- type: "tree",
- props: {
- label: "title"
+ },
+ {
+ label: "审核状态",
+ prop: "type",
+ search: true,
+ slot: true,
+ searchSpan: 4,
+ type: "select",
+ dicData: [
+ {
+ label: "未审核",
+ value: "0",
},
- },
- {
- label: "审核状态",
- prop: "type",
- search: true,
- slot: true,
- searchSpan:4,
- type: "select",
- dicData: [
- {
- label: "未审核",
- value: "0"
- },
- {
- label: "审核通过",
- value: "1"
- },
- {
- label: "审核不通过",
- value: "2"
- }
-
- ],
- }
- ]
- },
- data: []
+ {
+ label: "审核通过",
+ value: "1",
+ },
+ {
+ label: "审核不通过",
+ value: "2",
+ },
+ ],
+ },
+ ],
+ },
+ data: [],
+ };
+ },
+ computed: {
+ ...mapGetters(["userInfo", "permission"]),
+ permissionList() {
+ return {
+ addBtn: this.vaildData(this.permission.zc_add, false),
+ viewBtn: this.vaildData(this.permission.zc_view, true),
+ delBtn: this.vaildData(this.permission.zc_delete, false),
+ editBtn: this.vaildData(this.permission.zc_edit, false),
};
},
- computed: {
- ...mapGetters(["permission"]),
- permissionList() {
- return {
- addBtn: this.vaildData(this.permission.zc_add, false),
- viewBtn: this.vaildData(this.permission.zc_view, true),
- delBtn: this.vaildData(this.permission.zc_delete, false),
- editBtn: this.vaildData(this.permission.zc_edit, false)
- };
- },
- ids() {
- let ids = [];
- this.selectionList.forEach(ele => {
- ids.push(ele.id);
- });
- return ids.join(",");
- }
+ ids() {
+ let ids = [];
+ this.selectionList.forEach((ele) => {
+ ids.push(ele.id);
+ });
+ return ids.join(",");
},
- methods: {
- initData(){
- getRoleTree().then(res => {
- const column = this.findObject(this.option.column, "parentId");
- column.dicData = res.data.data;
- });
- },
- handleEdit (row, index) {
- this.initData();
- this.$refs.crud.rowEdit(row, index);
- },
- rowSave(row, done, loading) {
- add(row).then(() => {
+ },
+ methods: {
+ initData(d) {
+ getRoleTree().then((res) => {
+ const column = this.findObject(this.option.column, "parentId");
+ var k = res.data.data;
+ var b = [];
+ if (d == "保安公司管理员") {
+ console.log(k);
+ for (var n in k) {
+ if (k[n].title == "保安" || k[n].title == "保安公司管理员") {
+ b.push(k[n]);
+ }
+ }
+ column.dicData = b;
+ } else {
+ column.dicData = k;
+ }
+ });
+ },
+ handleEdit(row, index) {
+ this.initData(this.userInfo.role_name);
+ this.$refs.crud.rowEdit(row, index);
+ },
+ rowSave(row, done, loading) {
+ add(row).then(
+ () => {
this.onLoad(this.page);
this.$message({
type: "success",
- message: "操作成功!"
+ message: "操作成功!",
});
done();
- }, error => {
+ },
+ (error) => {
loading();
window.console.log(error);
- });
- },
- rowUpdate(row, index, done, loading) {
- update(row).then(() => {
+ }
+ );
+ },
+ rowUpdate(row, index, done, loading) {
+ update(row).then(
+ () => {
this.onLoad(this.page);
this.$message({
type: "success",
- message: "操作成功!"
+ message: "操作成功!",
});
done();
- }, error => {
+ },
+ (error) => {
loading();
console.log(error);
+ }
+ );
+ },
+ rowDel(row) {
+ this.$confirm("确定将选择数据删除?", {
+ confirmButtonText: "确定",
+ cancelButtonText: "取消",
+ type: "warning",
+ })
+ .then(() => {
+ return remove(row.id);
+ })
+ .then(() => {
+ this.onLoad(this.page);
+ this.$message({
+ type: "success",
+ message: "操作成功!",
+ });
});
- },
- rowDel(row) {
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
+ },
+ handleDelete() {
+ if (this.selectionList.length === 0) {
+ this.$message.warning("请选择至少一条数据");
+ return;
+ }
+ this.$confirm("确定将选择数据删除?", {
+ confirmButtonText: "确定",
+ cancelButtonText: "取消",
+ type: "warning",
+ })
+ .then(() => {
+ return remove(this.ids);
})
- .then(() => {
- return remove(row.id);
- })
- .then(() => {
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!"
- });
+ .then(() => {
+ this.onLoad(this.page);
+ this.$message({
+ type: "success",
+ message: "操作成功!",
});
- },
- handleDelete() {
- if (this.selectionList.length === 0) {
- this.$message.warning("请选择至少一条数据");
- return;
- }
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- })
- .then(() => {
- return remove(this.ids);
- })
- .then(() => {
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.$refs.crud.toggleSelection();
- });
- },
- beforeOpen(done, type) {
- if (["edit", "view"].includes(type)) {
- getDetail(this.form.id).then(res => {
- this.form = res.data.data;
- });
- }
- done();
- },
- searchReset() {
- this.query = {};
- this.onLoad(this.page);
- },
- searchChange(params, done) {
- this.query = params;
- this.page.currentPage = 1;
- this.onLoad(this.page, params);
- done();
- },
- selectionChange(list) {
- this.selectionList = list;
- },
- selectionClear() {
- this.selectionList = [];
- this.$refs.crud.toggleSelection();
- },
- currentChange(currentPage){
- this.page.currentPage = currentPage;
- },
- sizeChange(pageSize){
- this.page.pageSize = pageSize;
- },
- refreshChange() {
- this.onLoad(this.page, this.query);
- },
- onLoad(page, params = {}) {
- this.loading = true;
- getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
- const data = res.data.data;
- this.page.total = data.total;
- this.data = data.records;
- this.loading = false;
- this.selectionClear();
+ this.$refs.crud.toggleSelection();
+ });
+ },
+ beforeOpen(done, type) {
+ if (["edit", "view"].includes(type)) {
+ getDetail(this.form.id).then((res) => {
+ this.form = res.data.data;
});
}
- }
- };
+ done();
+ },
+ searchReset() {
+ this.query = {};
+ this.onLoad(this.page);
+ },
+ searchChange(params, done) {
+ this.query = params;
+ this.page.currentPage = 1;
+ this.onLoad(this.page, params);
+ done();
+ },
+ selectionChange(list) {
+ this.selectionList = list;
+ },
+ selectionClear() {
+ this.selectionList = [];
+ this.$refs.crud.toggleSelection();
+ },
+ currentChange(currentPage) {
+ this.page.currentPage = currentPage;
+ },
+ sizeChange(pageSize) {
+ this.page.pageSize = pageSize;
+ },
+ refreshChange() {
+ this.onLoad(this.page, this.query);
+ },
+ onLoad(page, params = {}) {
+ this.loading = true;
+ getList(
+ page.currentPage,
+ page.pageSize,
+ Object.assign(params, this.query)
+ ).then((res) => {
+ const data = res.data.data;
+ this.page.total = data.total;
+ this.data = data.records;
+ this.loading = false;
+ this.selectionClear();
+ });
+ },
+ },
+};
</script>
<style>
-
</style>
--
Gitblit v1.9.3