From c659560c7ee8d8f8278b938421de13bf65d1e1b1 Mon Sep 17 00:00:00 2001
From: ludc <ludc@vci-tech.com>
Date: 星期三, 15 一月 2025 14:28:25 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 Source/plt-web/plt-web-ui/src/views/processTemplate/customType/index.vue |  202 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 202 insertions(+), 0 deletions(-)

diff --git a/Source/plt-web/plt-web-ui/src/views/processTemplate/customType/index.vue b/Source/plt-web/plt-web-ui/src/views/processTemplate/customType/index.vue
new file mode 100644
index 0000000..8c4b080
--- /dev/null
+++ b/Source/plt-web/plt-web-ui/src/views/processTemplate/customType/index.vue
@@ -0,0 +1,202 @@
+<template>
+  <!--娴佺▼妯℃澘鍒嗙被-->
+  <basic-container>
+    <avue-crud
+      ref="crud"
+      v-model="form"
+      :data="tableData"
+      :option="option"
+      :table-loading="tableLoading"
+      @on-load="getTableList"
+      @refresh-change="getTableList"
+      @row-save="rowSaveHandler"
+      @row-update="rowUpdateHandler"
+      @row-click="rowClickHandler"
+      @selection-change="selectionChange"
+    >
+      <template slot="menuLeft" slot-scope="scope">
+        <el-button v-if="permissionList.addBtn" class="button-custom-icon" size="small" type="primary"
+                   @click="$refs.crud.rowAdd()">
+          <icon-show :name="permissionList.addBtn.source"></icon-show>
+          鏂� 澧�
+        </el-button>
+        <el-button v-if="permissionList.exportBtn" class="button-custom-icon" plain size="small" type="primary" @click="exportClickHandler">
+          <icon-show :name="permissionList.exportBtn.source"></icon-show>
+          瀵煎嚭
+        </el-button>
+      </template>
+      <template slot="menu" slot-scope="{ row, index }">
+        <el-button
+          v-if="permissionList.editBtn"
+          size="small"
+          type="text"
+          @click="handleEdit(row, index)"
+        >
+          <icon-show :name="permissionList.editBtn.source"></icon-show>
+          缂栬緫
+        </el-button>
+        <el-button
+          v-if="permissionList.delBtn"
+          size="small"
+          type="text"
+          @click="handleDel(row, index)"
+        >
+          <icon-show :name="permissionList.delBtn.source"></icon-show>
+          鍒犻櫎
+        </el-button>
+      </template>
+    </avue-crud>
+  </basic-container>
+</template>
+
+<script>
+import {mapGetters} from "vuex";
+import basicOption from "@/util/basic-option";
+import {getTypeList, saveType, updateType, deleteType} from "@/api/processTemplate/type";
+import func from "@/util/func";
+
+export default {
+  name: "index",
+  data: function () {
+    return {
+      form:{},
+      tableLoading: false,
+      tableData: [],
+      currentRow:null,
+      selectionList: [],
+    }
+  },
+  computed: {
+    ids() {
+      let ids = [];
+      this.selectionList.forEach(ele => {
+        ids.push(ele.id);
+      });
+      return ids.join(",");
+    },
+    ...mapGetters(["permission"]),
+    permissionList() {
+      return {
+        addBtn: this.vaildData(this.permission[this.$route.query.id].ADD, false),
+        delBtn: this.vaildData(this.permission[this.$route.query.id].DELETE, false),
+        editBtn: this.vaildData(this.permission[this.$route.query.id].EDIT, false),
+      };
+    },
+    option(){
+      return  {
+        ...basicOption,
+        addBtn:false,
+        editBtn:false,
+        delBtn:false,
+        calcHeight: -60,
+        align:'left',
+        headerAlign:'center',
+        menuWidth:160,
+        dialogMenuPosition: 'right',
+        dialogWidth:600,
+        column: [
+          {
+            label: '鍒嗙被鍚嶇О',
+            prop: 'name',
+            span: 24,
+            rules: [{ required: true, message: '璇疯緭鍏ュ垎绫诲悕绉�', trigger: 'blur' }]
+          },{
+            label: '鎻忚堪',
+            prop: 'desc',
+            span: 24,
+            type:'textarea'
+          }]
+      }
+    }
+  },
+  methods: {
+    // 琛ㄦ牸璇锋眰
+    getTableList() {
+      this.tableLoading = true;
+      getTypeList().then(res => {
+        this.tableData = res.data.data;
+        this.tableLoading = false;
+      })
+    },
+
+    // 鏂板
+    rowSaveHandler(row, done, loading) {
+      saveType(row).then(res => {
+        if (res.data.code === 200) {
+          this.$message.success(res.data.obj);
+          this.getTableList();
+          done();
+        }
+      }).catch(err => {
+        loading()
+      });
+    },
+
+    handleEdit(row,index){
+      this.$refs.crud.rowEdit(row, index);
+    },
+
+    // 缂栬緫
+    rowUpdateHandler(row, index, done, loading) {
+      updateType(row).then(res => {
+        if (res.data.code === 200) {
+          this.$message.success(res.data.obj);
+          this.getTableList();
+          done()
+        }
+      }).catch(err => {
+        loading()
+      });
+    },
+
+    // 鍒犻櫎
+    handleDel(row,index) {
+      let params = {
+        ids: row.id
+      }
+
+      this.$confirm('鎮ㄧ‘瀹氳鍒犻櫎褰撳墠鐨勫垎绫诲悧锛�', '鎻愮ず', {
+        confirmButtonText: '纭畾',
+        cancelButtonText: '鍙栨秷',
+        type: 'warning'
+      }).then(() => {
+        deleteType(params).then(res => {
+          if (res.data.code === 200) {
+            this.$message.success(res.data.obj);
+            this.getTableList();
+          }
+        });
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: '宸插彇娑堝垹闄�'
+        });
+      });
+    },
+
+    //閫夋嫨鐨勮
+    selectionChange(list) {
+      this.selectionList = list;
+    },
+
+    // 琛屽崟閫�
+    rowClickHandler(row) {
+      func.rowClickHandler(
+        row,
+        this.$refs.crud,
+        this.lastIndex,
+        (newIndex) => {
+          this.lastIndex = newIndex;
+        },
+        () => {
+          this.selectionList = [row];
+        }
+      );
+    },
+  }
+}
+</script>
+
+<style scoped>
+
+</style>

--
Gitblit v1.9.3