From d0906f2ac9ae481a2fffbdcf21d688d15852b79b Mon Sep 17 00:00:00 2001
From: xiejun <xiejun@vci-tech.com>
Date: 星期四, 26 十二月 2024 17:02:19 +0800
Subject: [PATCH] 集成获取mdm分发通用数据格式接口集成 日志输出到日志文件中
---
Source/BladeX-Tool/blade-starter-develop/src/main/resources/templates/saber/sub/crud.vue.btl | 371 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 371 insertions(+), 0 deletions(-)
diff --git a/Source/BladeX-Tool/blade-starter-develop/src/main/resources/templates/saber/sub/crud.vue.btl b/Source/BladeX-Tool/blade-starter-develop/src/main/resources/templates/saber/sub/crud.vue.btl
new file mode 100644
index 0000000..b36a800
--- /dev/null
+++ b/Source/BladeX-Tool/blade-starter-develop/src/main/resources/templates/saber/sub/crud.vue.btl
@@ -0,0 +1,371 @@
+<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">
+ <template slot="menuLeft">
+ <el-button type="danger"
+ size="small"
+ icon="el-icon-delete"
+ plain
+ v-if="permission.${model.modelCode!}_delete"
+ @click="handleDelete">鍒� 闄�
+ </el-button>
+ </template>
+ <template slot-scope="{row}" slot="menu">
+ <el-button type="text"
+ icon="el-icon-setting"
+ size="small"
+ @click.stop="handleDataSub(row)">閰� 缃�
+ </el-button>
+ </template>
+ </avue-crud>
+ <el-drawer :title="`[\${${model.modelCode!}Name}] 閰嶇疆`" :visible.sync="subVisible" :direction="direction" append-to-body
+ :before-close="handleSubClose" size="1000px">
+ <basic-container>
+ <avue-crud :option="optionSub"
+ :data="dataSub"
+ :page.sync="pageSub"
+ v-model="formSub"
+ :table-loading="loadingSub"
+ ref="crudSub"
+ @row-del="rowDelSub"
+ @row-update="rowUpdateSub"
+ @row-save="rowSaveSub"
+ :before-open="beforeOpenSub"
+ @search-change="searchChangeSub"
+ @search-reset="searchResetSub"
+ @selection-change="selectionChangeSub"
+ @current-change="currentChangeSub"
+ @size-change="sizeChangeSub"
+ @on-load="onLoadSub">
+ <template slot="menuLeft">
+ <el-button type="danger"
+ size="small"
+ icon="el-icon-delete"
+ plain
+ @click="handleDeleteSub">鍒� 闄�
+ </el-button>
+ </template>
+ </avue-crud>
+ </basic-container>
+ </el-drawer>
+ </basic-container>
+</template>
+
+<script>
+ import {getList, getDetail, add, update, remove} from "@/api/${serviceCode!}/${model.modelCode!}";
+ import {getList as getListSub, getDetail as getDetailSub, add as addSub, update as updateSub, remove as removeSub} from "@/api/${serviceCode!}/${subModel.modelCode!}";
+ import option from "@/const/${serviceCode!}/${model.modelCode!}";
+ import optionSub from "@/const/${serviceCode!}/${subModel.modelCode!}";
+ import {mapGetters} from "vuex";
+
+ export default {
+ data() {
+ return {
+ form: {},
+ query: {},
+ loading: true,
+ data: [],
+ selectionList: [],
+ page: {
+ pageSize: 10,
+ currentPage: 1,
+ total: 0
+ },
+ option: option,
+ subVisible: false,
+ direction: 'rtl',
+ ${subFkIdHump!}: 0,
+ ${model.modelCode!}Name: "${model.modelName!}",
+ formSub: {},
+ querySub: {},
+ loadingSub: true,
+ dataSub: [],
+ selectionListSub: [],
+ pageSub: {
+ pageSize: 10,
+ currentPage: 1,
+ total: 0
+ },
+ optionSub: optionSub
+ };
+ },
+ computed: {
+ ...mapGetters(["permission"]),
+ permissionList() {
+ return {
+ addBtn: this.vaildData(this.permission.${model.modelCode!}_add, false),
+ viewBtn: this.vaildData(this.permission.${model.modelCode!}_view, false),
+ delBtn: this.vaildData(this.permission.${model.modelCode!}_delete, false),
+ editBtn: this.vaildData(this.permission.${model.modelCode!}_edit, false)
+ };
+ },
+ ids() {
+ let ids = [];
+ this.selectionList.forEach(ele => {
+ ids.push(ele.id);
+ });
+ return ids.join(",");
+ },
+ subIds() {
+ let ids = [];
+ this.selectionListSub.forEach(ele => {
+ ids.push(ele.id);
+ });
+ return ids.join(",");
+ }
+ },
+ methods: {
+ // 涓昏〃妯″潡
+ 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: "鎿嶄綔鎴愬姛!"
+ });
+ });
+ },
+ 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;
+ },
+ 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();
+ });
+ },
+ // 瀛愯〃妯″潡
+ handleDataSub(row) {
+ this.subVisible = true;
+ this.${subFkIdHump!} = row.id;
+ this.onLoadSub(this.pageSub)
+ },
+ handleSubClose(hide) {
+ hide();
+ },
+ rowSaveSub(row, loading, done) {
+ row = {
+ ...row,
+ ${subFkIdHump!}: this.${subFkIdHump!},
+ };
+ addSub(row).then(() => {
+ loading();
+ this.onLoadSub(this.pageSub);
+ this.$message({
+ type: "success",
+ message: "鎿嶄綔鎴愬姛!"
+ });
+ }, error => {
+ done();
+ window.console.log(error);
+ });
+ },
+ rowUpdateSub(row, index, loading, done) {
+ row = {
+ ...row,
+ ${subFkIdHump!}: this.${subFkIdHump!},
+ };
+ updateSub(row).then(() => {
+ loading();
+ this.onLoadSub(this.pageSub);
+ this.$message({
+ type: "success",
+ message: "鎿嶄綔鎴愬姛!"
+ });
+ }, error => {
+ done();
+ window.console.log(error);
+ });
+ },
+ rowDelSub(row) {
+ this.$confirm("纭畾灏嗛�夋嫨鏁版嵁鍒犻櫎?", {
+ confirmButtonText: "纭畾",
+ cancelButtonText: "鍙栨秷",
+ type: "warning"
+ })
+ .then(() => {
+ return removeSub(row.id);
+ })
+ .then(() => {
+ this.onLoadSub(this.pageSub);
+ this.$message({
+ type: "success",
+ message: "鎿嶄綔鎴愬姛!"
+ });
+ });
+ },
+ handleDeleteSub() {
+ if (this.selectionListSub.length === 0) {
+ this.$message.warning("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�");
+ return;
+ }
+ this.$confirm("纭畾灏嗛�夋嫨鏁版嵁鍒犻櫎?", {
+ confirmButtonText: "纭畾",
+ cancelButtonText: "鍙栨秷",
+ type: "warning"
+ })
+ .then(() => {
+ return removeSub(this.subIds);
+ })
+ .then(() => {
+ this.onLoadSub(this.pageSub);
+ this.$message({
+ type: "success",
+ message: "鎿嶄綔鎴愬姛!"
+ });
+ this.$refs.crudSub.toggleSelection();
+ });
+ },
+ beforeOpenSub(done, type) {
+ if (["edit", "view"].includes(type)) {
+ getDetailSub(this.formSub.id).then(res => {
+ this.formSub = res.data.data;
+ });
+ }
+ done();
+ },
+ searchResetSub() {
+ this.querySub = {};
+ this.onLoadSub(this.pageSub);
+ },
+ searchChangeSub(params) {
+ this.querySub = params;
+ this.onLoadSub(this.pageSub, params);
+ },
+ selectionChangeSub(list) {
+ this.selectionListSub = list;
+ },
+ currentChangeSub(currentPage) {
+ this.pageSub.currentPage = currentPage;
+ },
+ sizeChangeSub(pageSize) {
+ this.pageSub.pageSize = pageSize;
+ },
+ refreshChange() {
+ this.onLoad(this.page, this.query);
+ },
+ onLoadSub(page, params = {}) {
+ this.loadingSub = true;
+ const values = {
+ ...params,
+ ${subFkIdHump!}: this.${subFkIdHump!},
+ }
+ getListSub(page.currentPage, page.pageSize, Object.assign(values, this.querySub)).then(res => {
+ const data = res.data.data;
+ this.pageSub.total = data.total;
+ this.dataSub = data.records;
+ this.selectionListSub = [];
+ this.loadingSub = false;
+ });
+ },
+ }
+ };
+</script>
+
+<style>
+</style>
--
Gitblit v1.10.0