From 3ea117935f971b75b141fc92591c10ade8aa3c81 Mon Sep 17 00:00:00 2001
From: wangting <675591594@qq.com>
Date: 星期二, 18 七月 2023 16:39:56 +0800
Subject: [PATCH] 流程业务数据保存
---
Source/UBCS-WEB/dist/src/views/util/demo/dict-classic.vue | 359 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 359 insertions(+), 0 deletions(-)
diff --git a/Source/UBCS-WEB/dist/src/views/util/demo/dict-classic.vue b/Source/UBCS-WEB/dist/src/views/util/demo/dict-classic.vue
new file mode 100644
index 0000000..659da7a
--- /dev/null
+++ b/Source/UBCS-WEB/dist/src/views/util/demo/dict-classic.vue
@@ -0,0 +1,359 @@
+<template>
+ <basic-container>
+ <avue-crud
+ :option="option"
+ :table-loading="loading"
+ :data="data"
+ ref="crud"
+ v-model="form"
+ :permission="permissionList"
+ :before-open="beforeOpen"
+ :before-close="beforeClose"
+ @row-del="rowDel"
+ @row-update="rowUpdate"
+ @row-save="rowSave"
+ @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"
+ v-if="permission.dict_delete"
+ plain
+ @click="handleDelete"
+ >鍒� 闄�
+ </el-button>
+ </template>
+ <template slot-scope="{row}" slot="isSealed">
+ <el-tag>{{row.isSealed===0?'鍚�':'鏄�'}}</el-tag>
+ </template>
+ <template slot-scope="scope" slot="menu">
+ <el-button
+ type="text"
+ icon="el-icon-check"
+ size="small"
+ @click.stop="handleAdd(scope.row,scope.index)"
+ >鏂板瀛愰」
+ </el-button>
+ </template>
+ </avue-crud>
+ </basic-container>
+</template>
+
+<script>
+ import {
+ getList,
+ remove,
+ update,
+ add,
+ getDict,
+ getDictTree
+ } from "@/api/system/dict";
+ import {mapGetters} from "vuex";
+
+ export default {
+ data() {
+ return {
+ form: {},
+ selectionList: [],
+ query: {},
+ loading: true,
+ page: {
+ pageSize: 10,
+ currentPage: 1,
+ total: 0
+ },
+ option: {
+ tip: false,
+ searchShow: true,
+ searchMenuSpan: 6,
+ tree: true,
+ border: true,
+ index: true,
+ selection: true,
+ viewBtn: true,
+ menuWidth: 300,
+ dialogWidth: 880,
+ column: [
+ {
+ label: "瀛楀吀缂栧彿",
+ prop: "code",
+ search: true,
+ span: 24,
+ rules: [
+ {
+ required: true,
+ message: "璇疯緭鍏ュ瓧鍏哥紪鍙�",
+ trigger: "blur"
+ }
+ ]
+ },
+ {
+ label: "瀛楀吀鍚嶇О",
+ prop: "dictValue",
+ search: true,
+ align: "center",
+ rules: [
+ {
+ required: true,
+ message: "璇疯緭鍏ュ瓧鍏稿悕绉�",
+ trigger: "blur"
+ }
+ ]
+ },
+ {
+ label: "涓婄骇瀛楀吀",
+ prop: "parentId",
+ type: "tree",
+ dicData: [],
+ hide: true,
+ props: {
+ label: "title"
+ },
+ rules: [
+ {
+ required: false,
+ message: "璇烽�夋嫨涓婄骇瀛楀吀",
+ trigger: "click"
+ }
+ ]
+ },
+ {
+ label: "瀛楀吀閿��",
+ prop: "dictKey",
+ type: "number",
+ rules: [
+ {
+ required: true,
+ message: "璇疯緭鍏ュ瓧鍏搁敭鍊�",
+ trigger: "blur"
+ }
+ ]
+ },
+ {
+ label: "瀛楀吀鎺掑簭",
+ prop: "sort",
+ type: "number",
+ rules: [
+ {
+ required: true,
+ message: "璇疯緭鍏ュ瓧鍏告帓搴�",
+ trigger: "blur"
+ }
+ ]
+ },
+ {
+ label: "灏佸瓨",
+ prop: "isSealed",
+ type: "select",
+ dicData: [
+ {
+ label: "鍚�",
+ value: 0
+ },
+ {
+ label: "鏄�",
+ value: 1
+ }
+ ],
+ slot: true,
+ rules: [
+ {
+ required: true,
+ message: "璇烽�夋嫨灏佸瓨",
+ trigger: "blur"
+ }
+ ]
+ },
+ {
+ label: "瀛楀吀澶囨敞",
+ prop: "remark",
+ search: true,
+ hide: true
+ }
+ ]
+ },
+ data: []
+ };
+ },
+ computed: {
+ ...mapGetters(["permission"]),
+ permissionList() {
+ return {
+ addBtn: this.vaildData(this.permission.dict_add, false),
+ viewBtn: this.vaildData(this.permission.dict_view, false),
+ delBtn: this.vaildData(this.permission.dict_delete, false),
+ editBtn: this.vaildData(this.permission.dict_edit, false)
+ };
+ },
+ ids() {
+ let ids = [];
+ this.selectionList.forEach(ele => {
+ ids.push(ele.id);
+ });
+ return ids.join(",");
+ }
+ },
+ mounted() {
+ getDictTree().then(res => {
+ const column = this.findObject(this.optionChild.column, "parentId");
+ column.dicData = res.data.data;
+ });
+ },
+ methods: {
+ handleAdd(row) {
+ this.$refs.crud.value.code = row.code;
+ this.$refs.crud.value.parentId = row.id;
+ this.$refs.crud.option.column.filter(item => {
+ if (item.prop === "code") {
+ item.value = row.code;
+ item.addDisabled = true;
+ }
+ if (item.prop === "parentId") {
+ item.value = row.id;
+ item.addDisabled = true;
+ }
+ });
+ this.$refs.crud.rowAdd();
+ },
+ rowSave(row, done, loading) {
+ add(row).then(() => {
+ this.onLoad(this.page);
+ this.$message({
+ type: "success",
+ message: "鎿嶄綔鎴愬姛!"
+ });
+ done();
+ }, error => {
+ window.console.log(error);
+ loading();
+ });
+ },
+ rowUpdate(row, index, done, loading) {
+ update(row).then(() => {
+ this.onLoad(this.page);
+ this.$message({
+ type: "success",
+ message: "鎿嶄綔鎴愬姛!"
+ });
+ done();
+ }, error => {
+ window.console.log(error);
+ loading();
+ });
+ },
+ rowDel(row) {
+ this.$confirm("纭畾灏嗛�夋嫨鏁版嵁鍒犻櫎?", {
+ confirmButtonText: "纭畾",
+ cancelButtonText: "鍙栨秷",
+ type: "warning"
+ })
+ .then(() => {
+ return remove(row.id);
+ })
+ .then(() => {
+ this.onLoad(this.page);
+ this.$message({
+ type: "success",
+ message: "鎿嶄綔鎴愬姛!"
+ });
+ });
+ },
+ 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();
+ },
+ 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)) {
+ getDict(this.form.id).then(res => {
+ this.form = res.data.data;
+ });
+ }
+ done();
+ },
+ beforeClose(done) {
+ this.$refs.crud.tableForm = {};
+ this.$refs.crud.value.code = "";
+ this.$refs.crud.value.parentId = "";
+ this.$refs.crud.value.addDisabled = false;
+ this.$refs.crud.option.column.filter(item => {
+ if (item.prop === "code") {
+ item.value = "";
+ item.addDisabled = false;
+ }
+ if (item.prop === "parentId") {
+ item.value = "";
+ item.addDisabled = false;
+ }
+ });
+ done();
+ },
+ 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 => {
+ this.data = res.data.data;
+ this.loading = false;
+ this.selectionClear();
+ });
+ }
+ }
+ };
+</script>
+
+<style>
+</style>
--
Gitblit v1.9.3