From 5c10c4c77fcb3a92754f37ae8dcd6e29edb90252 Mon Sep 17 00:00:00 2001
From: BAOLH <baolh@yhzhg.cn>
Date: Wed, 16 Apr 2025 07:14:49 +0000
Subject: [PATCH] 模板绑定页添加申请审核站点更新功能

---
 eladmin-web-master/src/views/template/bind/index.vue |   93 +++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 91 insertions(+), 2 deletions(-)

diff --git a/eladmin-web-master/src/views/template/bind/index.vue b/eladmin-web-master/src/views/template/bind/index.vue
index c7583f4..fe611e7 100644
--- a/eladmin-web-master/src/views/template/bind/index.vue
+++ b/eladmin-web-master/src/views/template/bind/index.vue
@@ -10,10 +10,43 @@
           type="primary"
           icon="el-icon-edit"
           class="filter-item"
+          :loading="refreshWecomVacationTypeLoading"
           @click="refreshWecomVacationType()"
         >
           更新企微请假类型
         </el-button>
+
+        <el-popover
+          slot="right"
+          placement="bottom-start"
+          width="400"
+          trigger="click"
+          title="更新申请审核站点"
+          @show="showEditApprovalSite()"
+          @hide="hideEditApprovalSite()"
+        >
+          <el-form ref="form" :model="approvalSiteParam.form" :rules="rules" size="small" label-width="80px">
+            <el-form-item label="审核站点">
+              <el-radio-group v-model="approvalSiteParam.form.approvalSite">
+                <el-radio-button label="system">系统</el-radio-button>
+                <el-radio-button label="wecom">企微</el-radio-button>
+              </el-radio-group>
+            </el-form-item>
+          </el-form>
+          <div class="popover-footer">
+            <el-button :loading="approvalSiteParam.loading" type="primary" @click="doEditApprovalSite">确认</el-button>
+          </div>
+
+          <el-button
+            slot="reference"
+            size="mini"
+            type="warning"
+            icon="el-icon-edit"
+            class="filter-item"
+          >
+            更新申请审核站点
+          </el-button>
+        </el-popover>
       </div>
       <!--表单组件-->
       <el-dialog :close-on-click-modal="false" :before-close="cancelBind" :visible.sync="bindParam.visible" :title="bindParam.title" width="600px">
@@ -56,6 +89,7 @@
           <el-button :loading="bindParam.loading" type="primary" @click="doBind">确认</el-button>
         </div>
       </el-dialog>
+
       <!--表格渲染-->
       <el-table ref="table" v-loading="queryLoading" :data="tableInfoData" size="small" style="width: 100%;">
         <el-table-column type="selection" width="55" />
@@ -72,7 +106,7 @@
 </template>
 
 <script>
-import { bind, queryByTable, editWecomVacationType } from '@/api/template/templateControlField'
+import { bind, queryByTable, editWecomVacationType, editApprovalSite } from '@/api/template/templateControlField'
 import { queryTemplate } from '@/api/template/template'
 import constant from '@utils/constant'
 import Vue from 'vue'
@@ -102,6 +136,17 @@
         // 绑定表单数据
         data: {}
       },
+      // 更新企微请假类型Loading
+      refreshWecomVacationTypeLoading: false,
+      // 更新申请审核站点参数
+      approvalSiteParam: {
+        form: {
+          approvalSite: null
+        },
+        loading: false
+      },
+      // 申请审核站点: system-系统审批,wecom-企业微信审批。默认为system
+      approvalSite: 'system',
       permission: {
         add: ['admin', 'templateControlField:add'],
         edit: ['admin', 'templateControlField:edit'],
@@ -110,7 +155,7 @@
       rules: {}
     }
   },
-  dicts: [constant.WECOM_BIND_LEAVE, constant.WECOM_BIND_GOOUT, constant.WECOM_BIND_TRAVEL, constant.WECOM_BIND_OVERTIME, constant.WECOM_BIND_REPLACEMENT],
+  dicts: [constant.WECOM_BIND_LEAVE, constant.WECOM_BIND_GOOUT, constant.WECOM_BIND_TRAVEL, constant.WECOM_BIND_OVERTIME, constant.WECOM_BIND_REPLACEMENT, constant.APPROVAL_SITE_TYPE],
   created() {
     const that = this
     that.queryLoading = true
@@ -145,18 +190,28 @@
       that.tableInfoData.push(leaveTableDate, goOutTableDate, travelTableDate, overtimeTableDate, replacementTableDate)
 
       that.queryLoading = false
+
+      // 判断申请审核站点
+      const filterData = dictData[constant.APPROVAL_SITE_TYPE].filter(item => item.value.toLowerCase() === 'wecom')
+      if (filterData.length > 0) {
+        that.approvalSite = 'wecom'
+      }
     })
   },
   methods: {
     // 更新企微请假类型
     refreshWecomVacationType() {
       const that = this
+      that.refreshWecomVacationTypeLoading = true
       editWecomVacationType().then(() => {
         that.$message({
           message: '企微请假类型更新成功',
           type: 'success',
           duration: 1500
         })
+        that.refreshWecomVacationTypeLoading = false
+      }).catch(() => {
+        that.refreshWecomVacationTypeLoading = false
       })
     },
 
@@ -270,6 +325,36 @@
       that.bindParam.visible = false
       that.bindParam.loading = false
       that.clearTemplateBindData()
+    },
+
+    // 开启更新申请审核站点弹窗
+    showEditApprovalSite() {
+      const that = this
+      that.$set(that.approvalSiteParam.form, 'approvalSite', that.approvalSite)
+    },
+
+    // 隐藏更新申请审核站点弹窗
+    hideEditApprovalSite() {
+      const that = this
+      that.$set(that.approvalSiteParam.form, 'approvalSite', null)
+    },
+
+    // 执行更新申请审核站点
+    doEditApprovalSite() {
+      const that = this
+      const approvalSite = that.approvalSiteParam.form.approvalSite
+      that.approvalSiteParam.loading = true
+      editApprovalSite({ approvalSite: approvalSite }).then(() => {
+        that.$message({
+          message: '申请审核站点更新成功',
+          type: 'success',
+          duration: 1500
+        })
+        that.$set(that, 'approvalSite', approvalSite)
+        that.approvalSiteParam.loading = false
+      }).catch(() => {
+        that.approvalSiteParam.loading = false
+      })
     }
   }
 }
@@ -283,4 +368,8 @@
     align-items: center;
     gap: 10px;
   }
+  .popover-footer {
+    display: flex;
+    justify-content: end;
+  }
 </style>

--
Gitblit v1.9.3