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/customDefine/index.vue |  336 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 336 insertions(+), 0 deletions(-)

diff --git a/Source/plt-web/plt-web-ui/src/views/processTemplate/customDefine/index.vue b/Source/plt-web/plt-web-ui/src/views/processTemplate/customDefine/index.vue
new file mode 100644
index 0000000..c0ed872
--- /dev/null
+++ b/Source/plt-web/plt-web-ui/src/views/processTemplate/customDefine/index.vue
@@ -0,0 +1,336 @@
+<template>
+  <!--娴佺▼妯℃澘瀹氫箟-->
+  <basic-container style="height: calc(100vh - 123px)">
+    <div style="margin-bottom: 5px;">
+      娴佺▼鍒嗙被锛�
+      <el-select v-model="tempType" :clearable="true" placeholder="璇烽�夋嫨" size="small"
+                 style="width: 300px;margin-right: 20px;"
+                 @change="tempTypeChange">
+        <el-option
+          v-for="item in tempTypeData"
+          :key="item.id"
+          :label="item.name"
+          :value="item.id">
+        </el-option>
+      </el-select>
+      娴佺▼妯℃澘鍚嶇О锛�
+      <el-input size="small" v-model="tempName" style="width: 300px;margin-right: 10px;"></el-input>
+      <el-button icon="el-icon-search" plain size="small" style="margin-right: 40px;" type="primary"
+                 @click="searchData">
+        鏌ヨ
+      </el-button>
+    </div>
+    <el-container style="height: calc(100% - 100px)">
+      <el-aside style="width: 40%;min-width: 500px;margin-right: 5px;">
+        <avue-crud
+          ref="crud"
+          :data="tableData"
+          :option="option"
+          :table-loading="tableLoading"
+          @on-load="getTableList"
+          @refresh-change="getTableList"
+          @selection-change="selectionChange"
+          @row-click="rowClickHandler"
+        >
+          <template slot="menuLeft" slot-scope="scope">
+            <el-button v-if="permissionList.addBtn" class="button-custom-icon" plain size="small" type="primary"
+                       @click="handlerAdd">
+              <icon-show :name="permissionList.addBtn.source"></icon-show>
+              澧炲姞
+            </el-button>
+            <el-button v-if="permissionList.downloadImportTemplateBtn" class="button-custom-icon" plain size="small"
+                       type="primary" @click="downloadTemplateHandler">
+              <icon-show :name="permissionList.downloadImportTemplateBtn.source"></icon-show>
+              涓嬭浇瀵煎叆妯℃澘
+            </el-button>
+            <el-button v-if="permissionList.importBtn" class="button-custom-icon" plain size="small" type="primary"
+                       @click="uploadHandler">
+              <icon-show :name="permissionList.importBtn.source"></icon-show>
+              瀵煎叆
+            </el-button>
+            <el-button v-if="permissionList.exportBtn" class="button-custom-icon" plain size="small" type="primary"
+                       @click="downloadHandler">
+              <icon-show :name="permissionList.exportBtn.source"></icon-show>
+              瀵煎嚭
+            </el-button>
+          </template>
+
+          <template slot="menu" slot-scope="scope">
+            <el-button v-if="permissionList.editBtn" size="small" type="text"
+                       @click="handleEdit(scope.row)">
+              <icon-show :name="permissionList.editBtn.source"></icon-show>
+              缂栬緫
+            </el-button>
+            <el-button v-if="permissionList.delBtn" size="small" type="text"
+                       @click="handleDel(scope.row)">
+              <icon-show :name="permissionList.delBtn.source"></icon-show>
+              鍒犻櫎
+            </el-button>
+            <el-button size="small" type="text" @click.stop="stopHandler(scope.row)">
+                <span v-if="scope.row.status === 0 && permissionList.stopBtn" style="color: #fa3434;display: flex">
+                  <icon-show :name="permissionList.stopBtn.source"></icon-show>
+                  鍋滅敤
+                </span>
+              <span v-if="scope.row.status === 1 && permissionList.actionBtn" style="color: #55b61d;display: flex">
+                  <icon-show :name="permissionList.actionBtn.source"></icon-show>
+                  鍚敤
+                </span>
+            </el-button>
+          </template>
+
+        </avue-crud>
+        <!-- 鍒涘缓缂栬緫鑷畾涔夊璇濇    -->
+        <el-dialog
+          v-dialogDrag
+          v-loading="dialogLoading"
+          :title="dialogType === 'add' ? ' 鍒涘缓' : '缂栬緫'"
+          :visible.sync="dialogVisible"
+          append-to-body="true"
+          class="avue-dialog"
+          width="1000px"
+          @close="dialogClose"
+        >
+            <span slot="footer" class="dialog-footer">
+              <el-button size="small" type="primary" @click="saveHandler">纭� 瀹�</el-button>
+              <el-button size="small" @click="dialogClose">鍙� 娑�</el-button>
+            </span>
+        </el-dialog>
+        <!-- 瀵煎叆   -->
+        <upload-file ref="upload" :fileType="upFileType" :fileUrl="fileUrl" :tipList="tipList" title="瀵煎叆娴佺▼妯℃澘"
+                     @updata="getTableList"></upload-file>
+      </el-aside>
+
+      <el-main width="60%">
+        <div style="height: 100%;background-color: #eeeeea">璁捐鍣�</div>
+      </el-main>
+    </el-container>
+  </basic-container>
+</template>
+
+<script>
+import {mapGetters} from "vuex";
+import basicOption from "@/util/basic-option";
+import {getTypeList} from "@/api/processTemplate/type";
+import {getProcessTempList,saveProcessTemp,updateProcessTemp,deleteProcessTemp,downloadTemplate,download,stopProcessTemp} from "@/api/processTemplate/define";
+import func from "@/util/func";
+
+export default {
+  name: "index",
+  data(){
+    return {
+      tempType:'',
+      tempName:'',
+      tempTypeData:[],
+      form:{},
+      tableLoading: false,
+      tableData: [],
+      currentRow:null,
+      selectionList: [],
+      upFileType: ['xls', 'xlsx'],
+      fileUrl: 'api/userQueryController/importUser',
+      tipList:[],
+      dialogLoading:false,
+      dialogVisible:false,
+      dialogType:'add'
+    }
+  },
+  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),
+        exportBtn: this.vaildData(this.permission[this.$route.query.id].EXPORT, false),
+        importBtn: this.vaildData(this.permission[this.$route.query.id].IMPORT, false),
+        downloadImportTemplateBtn: this.vaildData(this.permission[this.$route.query.id].DOWNLOADFILE, false),
+        stopBtn: this.vaildData(this.permission[this.$route.query.id].FREEZE, false),
+        actionBtn: this.vaildData(this.permission[this.$route.query.id].UNFREZE, false),
+      };
+    },
+    option(){
+      return  {
+        ...basicOption,
+        addBtn:false,
+        editBtn:false,
+        delBtn:false,
+        columnBtn:false,
+        gridBtn:false,
+        width:500,
+        calcHeight: -50,
+        align:'left',
+        headerAlign:'center',
+        menuWidth:190,
+        dialogMenuPosition: 'right',
+        dialogWidth:600,
+        column: [
+          {
+            label: '娴佺▼妯℃澘鍚嶇О',
+            prop: 'name'
+          },{
+            label: '鐗堟湰',
+            prop: 'desc',
+            width:50
+          },{
+            label: '鐘舵��',
+            prop: 'status',
+            width:65
+          }]
+      }
+    }
+  },
+  created() {
+    getTypeList().then(res => {
+      this.tempTypeData = res.data.data;
+    })
+  },
+  methods:{
+    getTableList(){
+      this.tableLoading = true;
+      getProcessTempList({tempType:this.tempType,tempName:this.tempName}).then(res => {
+        this.tableData = res.data.data;
+        this.tableLoading = false;
+      })
+    },
+    //娴佺▼鍒嗙被閫夋嫨
+    tempTypeChange(val){
+      this.getTableList();
+    },
+    searchData(){
+      this.getTableList();
+    },
+
+    handlerAdd(){
+      this.form={};
+      this.dialogVisible=true;
+      this.dialogType='add'
+    },
+    handleEdit(row,index) {
+      this.form={
+        ...row
+      }
+      this.dialogVisible = true;
+      this.dialogType = 'edit'
+    },
+    // 缂栬緫淇濆瓨
+    saveHandler() {
+      if(this.dialogType=='add'){
+        saveProcessTemp(this.form).then(res => {
+          if (res.data.code === 200) {
+            this.$message.success(res.data.obj);
+            this.getTableList();
+          }
+        });
+      }else{
+        updateProcessTemp(this.form).then(res => {
+          if (res.data.code === 200) {
+            this.$message.success(res.data.obj);
+            this.getTableList();
+          }
+        })
+      }
+
+    },
+    dialogClose(){
+      this.form={};
+      this.dialogLoading=false;
+      this.dialogVisible=false;
+    },
+    // 鍒犻櫎
+    handleDel(row,index) {
+      let params = {
+        ids: row.id
+      }
+
+      this.$confirm('鎮ㄧ‘瀹氳鍒犻櫎褰撳墠鏁版嵁鍚楋紵', '鎻愮ず', {
+        confirmButtonText: '纭畾',
+        cancelButtonText: '鍙栨秷',
+        type: 'warning'
+      }).then(() => {
+        deleteProcessTemp(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];
+        }
+      );
+    },
+
+    // 瀵煎嚭
+    downloadHandler() {
+      if (this.selectionList.length <= 0) {
+        this.$message.warning('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹繘琛屽鍑�');
+        return;
+      }
+
+      download({enumNames: this.ids}).then(res => {
+        func.downloadFileByBlobHandler(res);
+        this.$message.success('瀵煎嚭鎴愬姛');
+      }).catch(err => {
+      })
+    },
+
+    // 涓嬭浇瀵煎叆妯℃澘
+    downloadTemplateHandler() {
+      downloadTemplate().then(res => {
+        func.downloadFileByBlobHandler(res);
+        this.$message.success('涓嬭浇鎴愬姛');
+      }).catch(err => {
+      })
+    },
+
+    //瀵煎叆
+    uploadHandler() {
+      this.$refs.upload.visible = true;
+    },
+    // 鍋滅敤鍚敤
+    stopHandler(row) {
+      let params = {};
+      params = {
+        ids: row.oid,
+        flag: row.status === 0 ? true : false
+      }
+      stopProcessTemp(params).then(res => {
+        this.$message.success(res.data.obj);
+        this.getTableList();
+      });
+    },
+  }
+}
+</script>
+
+<style scoped>
+
+</style>

--
Gitblit v1.9.3