From 8c6cf205affbbc8ada74f00a7ca25ebca867e9ed Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Mon, 27 Sep 2021 11:44:44 +0800
Subject: [PATCH] 图表颜色
---
src/views/zc/zc.vue | 533 +++++++++++++++++++++++++++++++---------------------------
1 files changed, 283 insertions(+), 250 deletions(-)
diff --git a/src/views/zc/zc.vue b/src/views/zc/zc.vue
index c95d4b0..4f90985 100644
--- a/src/views/zc/zc.vue
+++ b/src/views/zc/zc.vue
@@ -1,294 +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,
- 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