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/system/dict.vue | 186 +++++++++++++++++++++++++---------------------
1 files changed, 101 insertions(+), 85 deletions(-)
diff --git a/src/views/system/dict.vue b/src/views/system/dict.vue
index 1355028..9265d5b 100644
--- a/src/views/system/dict.vue
+++ b/src/views/system/dict.vue
@@ -1,5 +1,5 @@
<template>
- <basic-container>
+ <basic-container class="hasButTwo">
<avue-crud
:option="optionParent"
:table-loading="loading"
@@ -29,7 +29,7 @@
v-if="permission.dict_delete"
plain
@click="handleDelete"
- >删 除
+ >删 除
</el-button>
</template>
<template slot-scope="scope" slot="menu">
@@ -39,20 +39,24 @@
size="small"
@click.stop="handleRowClick(scope.row)"
v-if="userInfo.role_name.includes('admin')"
- >字典配置
+ >字典配置
</el-button>
</template>
- <template slot-scope="{row}" slot="code">
- <el-tag @click="handleRowClick(row)" style="cursor:pointer">{{ row.code }}</el-tag>
+ <template slot-scope="{ row }" slot="code">
+ <el-tag @click="handleRowClick(row)" style="cursor: pointer">{{
+ row.code
+ }}</el-tag>
</template>
- <template slot-scope="{row}" slot="isSealed">
- <el-tag>{{ row.isSealed === 0 ? '否' : '是' }}</el-tag>
+ <template slot-scope="{ row }" slot="isSealed">
+ <el-tag>{{ row.isSealed === 0 ? "否" : "是" }}</el-tag>
</template>
</avue-crud>
- <el-dialog :title="`[${dictValue}]字典配置`"
- append-to-body
- :visible.sync="box"
- width="1000px">
+ <el-dialog
+ :title="`[${dictValue}]字典配置`"
+ append-to-body
+ :visible.sync="box"
+ width="1000px"
+ >
<avue-crud
:option="optionChild"
:table-loading="loadingChild"
@@ -81,7 +85,7 @@
v-if="permission.dict_delete"
plain
@click="handleDelete"
- >删 除
+ >删 除
</el-button>
</template>
<template slot-scope="scope" slot="menu">
@@ -89,13 +93,13 @@
type="text"
icon="el-icon-circle-plus-outline"
size="small"
- @click.stop="handleAdd(scope.row,scope.index)"
+ @click.stop="handleAdd(scope.row, scope.index)"
v-if="userInfo.role_name.includes('admin')"
- >新增子项
+ >新增子项
</el-button>
</template>
- <template slot-scope="{row}" slot="isSealed">
- <el-tag>{{ row.isSealed === 0 ? '否' : '是' }}</el-tag>
+ <template slot-scope="{ row }" slot="isSealed">
+ <el-tag>{{ row.isSealed === 0 ? "否" : "是" }}</el-tag>
</template>
</avue-crud>
</el-dialog>
@@ -110,15 +114,15 @@
update,
add,
getDict,
- getDictTree
+ getDictTree,
} from "@/api/system/dict";
-import {optionParent, optionChild} from "@/option/system/dict";
-import {mapGetters} from "vuex";
+import { optionParent, optionChild } from "@/option/system/dict";
+import { mapGetters } from "vuex";
export default {
data() {
return {
- dictValue: '暂无',
+ dictValue: "暂无",
parentId: -1,
formParent: {},
formChild: {},
@@ -131,13 +135,13 @@
pageSize: 10,
pageSizes: [10, 30, 50, 100, 200],
currentPage: 1,
- total: 0
+ total: 0,
},
pageChild: {
pageSize: 10,
pageSizes: [10, 30, 50, 100, 200],
currentPage: 1,
- total: 0
+ total: 0,
},
dataParent: [],
dataChild: [],
@@ -157,18 +161,18 @@
},
ids() {
let ids = [];
- this.selectionList.forEach(ele => {
+ this.selectionList.forEach((ele) => {
ids.push(ele.id);
});
return ids.join(",");
- }
+ },
},
mounted() {
this.initData();
},
methods: {
initData() {
- getDictTree().then(res => {
+ getDictTree().then((res) => {
const column = this.findObject(this.optionChild.column, "parentId");
column.dicData = res.data.data;
});
@@ -187,37 +191,43 @@
...row,
dictKey: -1,
};
- add(form).then(() => {
- this.onLoadParent(this.pageParent);
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- done();
- }, error => {
- window.console.log(error);
- loading();
- });
+ add(form).then(
+ () => {
+ this.onLoadParent(this.pageParent);
+ this.$message({
+ type: "success",
+ message: "操作成功!",
+ });
+ done();
+ },
+ (error) => {
+ window.console.log(error);
+ loading();
+ }
+ );
},
rowUpdate(row, index, done, loading) {
- update(row).then(() => {
- this.onLoadParent(this.pageParent);
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.onLoadChild(this.pageChild);
- done();
- }, error => {
- window.console.log(error);
- loading();
- });
+ update(row).then(
+ () => {
+ this.onLoadParent(this.pageParent);
+ this.$message({
+ type: "success",
+ message: "操作成功!",
+ });
+ this.onLoadChild(this.pageChild);
+ done();
+ },
+ (error) => {
+ window.console.log(error);
+ loading();
+ }
+ );
},
rowDel(row) {
this.$confirm("确定将选择数据删除?", {
confirmButtonText: "确定",
cancelButtonText: "取消",
- type: "warning"
+ type: "warning",
})
.then(() => {
return remove(row.id);
@@ -226,7 +236,7 @@
this.onLoadParent(this.pageParent);
this.$message({
type: "success",
- message: "操作成功!"
+ message: "操作成功!",
});
});
},
@@ -268,7 +278,7 @@
this.$confirm("确定将选择数据删除?", {
confirmButtonText: "确定",
cancelButtonText: "取消",
- type: "warning"
+ type: "warning",
})
.then(() => {
return remove(this.ids);
@@ -277,14 +287,14 @@
this.onLoadParent(this.pageParent);
this.$message({
type: "success",
- message: "操作成功!"
+ message: "操作成功!",
});
this.$refs.crud.toggleSelection();
});
},
beforeOpen(done, type) {
if (["edit", "view"].includes(type)) {
- getDict(this.formParent.id).then(res => {
+ getDict(this.formParent.id).then((res) => {
this.formParent = res.data.data;
});
}
@@ -300,36 +310,42 @@
this.onLoadParent(this.pageParent, this.query);
},
rowSaveChild(row, done, loading) {
- add(row).then(() => {
- this.onLoadChild(this.pageChild);
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- done();
- }, error => {
- window.console.log(error);
- loading();
- });
+ add(row).then(
+ () => {
+ this.onLoadChild(this.pageChild);
+ this.$message({
+ type: "success",
+ message: "操作成功!",
+ });
+ done();
+ },
+ (error) => {
+ window.console.log(error);
+ loading();
+ }
+ );
},
rowUpdateChild(row, index, done, loading) {
- update(row).then(() => {
- this.onLoadChild(this.pageChild);
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- done();
- }, error => {
- window.console.log(error);
- loading();
- });
+ update(row).then(
+ () => {
+ this.onLoadChild(this.pageChild);
+ this.$message({
+ type: "success",
+ message: "操作成功!",
+ });
+ done();
+ },
+ (error) => {
+ window.console.log(error);
+ loading();
+ }
+ );
},
rowDelChild(row) {
this.$confirm("确定将选择数据删除?", {
confirmButtonText: "确定",
cancelButtonText: "取消",
- type: "warning"
+ type: "warning",
})
.then(() => {
return remove(row.id);
@@ -338,7 +354,7 @@
this.onLoadChild(this.pageChild);
this.$message({
type: "success",
- message: "操作成功!"
+ message: "操作成功!",
});
});
},
@@ -367,7 +383,7 @@
this.$confirm("确定将选择数据删除?", {
confirmButtonText: "确定",
cancelButtonText: "取消",
- type: "warning"
+ type: "warning",
})
.then(() => {
return remove(this.ids);
@@ -376,7 +392,7 @@
this.onLoadChild(this.pageChild);
this.$message({
type: "success",
- message: "操作成功!"
+ message: "操作成功!",
});
this.$refs.crudChild.toggleSelection();
});
@@ -386,7 +402,7 @@
this.initData();
}
if (["edit", "view"].includes(type)) {
- getDict(this.formChild.id).then(res => {
+ getDict(this.formChild.id).then((res) => {
this.formChild = res.data.data;
});
}
@@ -394,7 +410,7 @@
},
beforeCloseChild(done) {
this.$refs.crudChild.value.parentId = this.parentId;
- this.$refs.crudChild.option.column.filter(item => {
+ this.$refs.crudChild.option.column.filter((item) => {
if (item.prop === "parentId") {
item.value = this.parentId;
}
@@ -416,7 +432,7 @@
page.currentPage,
page.pageSize,
Object.assign(params, this.query)
- ).then(res => {
+ ).then((res) => {
const data = res.data.data;
this.pageParent.total = data.total;
this.dataParent = data.records;
@@ -431,13 +447,13 @@
page.pageSize,
this.parentId,
Object.assign(params, this.query)
- ).then(res => {
+ ).then((res) => {
this.dataChild = res.data.data;
this.loadingChild = false;
this.selectionClear();
});
- }
- }
+ },
+ },
};
</script>
--
Gitblit v1.9.3