From 12719c811f17cb0187fab06cc40c7fe8216e1f96 Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期二, 13 一月 2026 10:16:44 +0800
Subject: [PATCH] 1.13一些bug修改

---
 src/views/collaborativeApproval/officeSupplies/index.vue | 1051 +++++++++++++++++++++++++++-------------------------------
 1 files changed, 488 insertions(+), 563 deletions(-)

diff --git a/src/views/collaborativeApproval/officeSupplies/index.vue b/src/views/collaborativeApproval/officeSupplies/index.vue
index 1717f98..6e429c3 100644
--- a/src/views/collaborativeApproval/officeSupplies/index.vue
+++ b/src/views/collaborativeApproval/officeSupplies/index.vue
@@ -4,667 +4,592 @@
       <template #header>
         <div class="card-header">
           <span>鍔炲叕鐗╄祫鐢宠绠$悊</span>
-          <el-button type="primary" @click="showApplyDialog = true">
-            <el-icon><Plus /></el-icon>
+          <el-button type="primary"
+                     @click="openShow()">
+            <el-icon>
+              <Plus />
+            </el-icon>
             鏂板缓鐢宠
           </el-button>
         </div>
       </template>
-
-             <!-- 鎼滅储鍖哄煙 -->
-       <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch">
-         <el-form-item label="鐢宠缂栧彿" prop="applyNo">
-           <el-input
-             v-model="queryParams.applyNo"
-             placeholder="璇疯緭鍏ョ敵璇风紪鍙�"
-             clearable
-             style="width: 200px"
-             @keyup.enter="handleQuery"
-           />
-         </el-form-item>
-         <el-form-item label="鐢宠浜�" prop="applicant">
-           <el-input
-             v-model="queryParams.applicant"
-             placeholder="璇疯緭鍏ョ敵璇蜂汉"
-             clearable
-             style="width: 200px"
-             @keyup.enter="handleQuery"
-           />
-         </el-form-item>
-         <el-form-item label="鐢宠鐘舵��" prop="status">
-           <el-select v-model="queryParams.status" placeholder="璇烽�夋嫨鐘舵��" clearable style="width: 200px">
-             <el-option label="寰呭鎵�" value="pending" />
-             <el-option label="宸查�氳繃" value="approved" />
-             <el-option label="宸叉嫆缁�" value="rejected" />
-             <el-option label="宸插彂鏀�" value="issued" />
-           </el-select>
-         </el-form-item>
-         <el-form-item>
-           <el-button type="primary" @click="handleQuery">
-             <el-icon><Search /></el-icon>
-             鎼滅储
-           </el-button>
-           <el-button @click="resetQuery">
-             <el-icon><Refresh /></el-icon>
-             閲嶇疆
-           </el-button>
-         </el-form-item>
-         <el-form-item>
-            <el-button type="primary" @click="handleExport">
-            <el-icon><Download /></el-icon>
+      <!-- 鎼滅储鍖哄煙 -->
+      <el-form :model="queryParams"
+               ref="queryRef"
+               :inline="true"
+               v-show="showSearch">
+        <el-form-item label="鐢宠缂栧彿"
+                      prop="code">
+          <el-input v-model="queryParams.code"
+                    placeholder="璇疯緭鍏ョ敵璇风紪鍙�"
+                    clearable
+                    style="width: 200px"
+                    @keyup.enter="handleQuery" />
+        </el-form-item>
+        <el-form-item label="鐢宠浜�"
+                      prop="applicant">
+          <el-input v-model="queryParams.applicant"
+                    placeholder="璇疯緭鍏ョ敵璇蜂汉"
+                    clearable
+                    style="width: 200px"
+                    @keyup.enter="handleQuery" />
+        </el-form-item>
+        <el-form-item label="鐢宠鐘舵��"
+                      prop="status">
+          <el-select v-model="queryParams.status"
+                     placeholder="璇烽�夋嫨鐘舵��"
+                     clearable
+                     style="width: 200px">
+            <el-option label="寰呭鎵�"
+                       value="1" />
+            <el-option label="宸查�氳繃"
+                       value="3" />
+            <el-option label="宸叉嫆缁�"
+                       value="2" />
+            <el-option label="宸插彂鏀�"
+                       value="4" />
+          </el-select>
+        </el-form-item>
+        <el-form-item>
+          <el-button type="primary"
+                     @click="handleQuery">
+            <el-icon>
+              <Search />
+            </el-icon>
+            鎼滅储
+          </el-button>
+          <el-button @click="resetQuery">
+            <el-icon>
+              <Refresh />
+            </el-icon>
+            閲嶇疆
+          </el-button>
+        </el-form-item>
+        <el-form-item>
+          <el-button type="primary"
+                     @click="handleExport">
+            <el-icon>
+              <Download />
+            </el-icon>
             瀵煎嚭
           </el-button>
-          <el-button type="success" @click="handleBatchApprove" :disabled="multipleSelection.length === 0">
-            <el-icon><Check /></el-icon>
-            鎵归噺瀹℃壒
-          </el-button>
-         </el-form-item>
-       </el-form>
-
+        </el-form-item>
+      </el-form>
       <!-- 琛ㄦ牸鍖哄煙 -->
-      <el-table
-        v-loading="loading"
-        :data="suppliesList"
-        @selection-change="handleSelectionChange"
-        style="width: 100%"
-      >
-        <el-table-column type="selection" width="55" align="center" />
-        <el-table-column label="鐢宠缂栧彿" align="center" prop="applyNo" width="180" />
-        <el-table-column label="鐢宠浜�" align="center" prop="applicant" width="120" />
-        <el-table-column label="閮ㄩ棬" align="center" prop="department" width="120" />
-        <el-table-column label="鐗╄祫绫诲瀷" align="center" prop="supplyType" width="120" />
-        <el-table-column label="鐢宠鏁伴噺" align="center" prop="quantity" width="100" />
-        <el-table-column label="鐢宠鍘熷洜" align="center" prop="reason" min-width="200" show-overflow-tooltip />
-        <el-table-column label="鐢宠鐘舵��" align="center" prop="status" width="100">
+      <el-table v-loading="loading"
+                :data="officeList"
+                @selection-change="handleSelectionChange"
+                style="width: 100%">
+        <el-table-column type="selection"
+                         width="55"
+                         align="center" />
+        <el-table-column label="鐢宠缂栧彿"
+                         align="center"
+                         prop="code"
+                         width="180" />
+        <el-table-column label="鐢宠浜�"
+                         align="center"
+                         prop="applicant"
+                         width="120" />
+        <el-table-column label="閮ㄩ棬"
+                         align="center"
+                         prop="dept"
+                         width="120" />
+        <el-table-column label="鐗╄祫绫诲瀷"
+                         align="center"
+                         prop="materialType"
+                         width="120">
+          <template #default="scope">
+            <el-tag v-if="scope.row.materialType === 1"
+                    type="info">鍏朵粬</el-tag>
+            <el-tag v-if="scope.row.materialType === 2"
+                    type="success">娓呮磥鐢ㄥ搧</el-tag>
+            <el-tag v-if="scope.row.materialType === 3"
+                    type="warning">鐢靛瓙璁惧</el-tag>
+            <el-tag v-if="scope.row.materialType === 4"
+                    type="danger">鍔炲叕鐢ㄥ搧</el-tag>
+          </template>
+        </el-table-column>
+        <el-table-column label="鐢宠鏁伴噺"
+                         align="center"
+                         prop="applyNum"
+                         width="100" />
+        <el-table-column label="鐢宠鍘熷洜"
+                         align="center"
+                         prop="reason"
+                         min-width="200"
+                         show-overflow-tooltip />
+        <el-table-column label="鐢宠鐘舵��"
+                         align="center"
+                         prop="status"
+                         width="100">
           <template #default="scope">
             <el-tag :type="getStatusType(scope.row.status)">
               {{ getStatusText(scope.row.status) }}
             </el-tag>
           </template>
         </el-table-column>
-        <el-table-column label="鐢宠鏃堕棿" align="center" prop="applyTime" width="180" />
-        <el-table-column label="瀹℃壒浜�" align="center" prop="approver" width="120" />
-        <el-table-column label="瀹℃壒鏃堕棿" align="center" prop="approveTime" width="180" />
-        <el-table-column label="鍙戞斁鏃堕棿" align="center" prop="issueTime" width="180" />
-        <el-table-column label="鎿嶄綔" align="center" fixed="right" class-name="small-padding fixed-width" width="200">
+        <el-table-column label="鐢宠鏃堕棿"
+                         align="center"
+                         prop="applyTime"
+                         width="180" />
+        <el-table-column label="瀹℃壒浜�"
+                         align="center"
+                         prop="approval"
+                         width="120" />
+        <el-table-column label="瀹℃壒鏃堕棿"
+                         align="center"
+                         prop="approvalTime"
+                         width="180" />
+        <el-table-column label="鍙戞斁鏃堕棿"
+                         align="center"
+                         prop="issueTime"
+                         width="180" />
+        <el-table-column label="鎿嶄綔"
+                         align="center"
+                         fixed="right"
+                         class-name="small-padding fixed-width"
+                         width="200">
           <template #default="scope">
-            <el-button
-              v-if="scope.row.status === 'pending'"
-              type="primary"
-              link
-              @click="handleApprove(scope.row)"
-            >
+            <el-button v-if="scope.row.status === 1"
+                       type="primary"
+                       link
+                       @click="handleApprove(scope.row)">
               瀹℃壒
             </el-button>
-            <el-button
-              v-if="scope.row.status === 'approved'"
-              type="success"
-							link
-              @click="handleIssue(scope.row)"
-            >
+            <el-button v-if="scope.row.status === 3"
+                       type="success"
+                       link
+                       @click="handleIssue(scope.row)">
               鍙戞斁
             </el-button>
-            <el-button
-              type="info"
-							link
-              @click="handleDetail(scope.row)"
-            >
+            <el-button type="info"
+                       link
+                       @click="handleDetail(scope.row)">
               璇︽儏
             </el-button>
-            <el-button
-              v-if="scope.row.status === 'pending'"
-              type="danger"
-							link
-              @click="handleDelete(scope.row)"
-            >
+            <el-button v-if="scope.row.status === 2"
+                       type="danger"
+                       link
+                       @click="handleDelete(scope.row)">
               鍒犻櫎
             </el-button>
           </template>
         </el-table-column>
       </el-table>
-
       <!-- 鍒嗛〉 -->
-      <pagination
-        v-show="total > 0"
-        :total="total"
-        v-model:page="queryParams.pageNum"
-        v-model:limit="queryParams.pageSize"
-        @pagination="getList"
-      />
+      <pagination v-show="total > 0"
+                  :total="total"
+                  v-model:page="queryParams.current"
+                  v-model:limit="queryParams.size"
+                  @pagination="getList" />
     </el-card>
-
     <!-- 鐢宠瀵硅瘽妗� -->
-    <el-dialog
-      v-model="showApplyDialog"
-      title="鍔炲叕鐗╄祫鐢宠"
-      width="600px"
-      append-to-body
-    >
-      <el-form ref="applyFormRef" :model="applyForm" :rules="applyRules" label-width="100px">
-        <el-form-item label="鐗╄祫绫诲瀷" prop="supplyType">
-          <el-select v-model="applyForm.supplyType" placeholder="璇烽�夋嫨鐗╄祫绫诲瀷" style="width: 100%">
-            <el-option label="鍔炲叕鐢ㄥ搧" value="office" />
-            <el-option label="鐢靛瓙璁惧" value="electronic" />
-            <el-option label="娓呮磥鐢ㄥ搧" value="cleaning" />
-            <el-option label="鍏朵粬" value="other" />
+    <el-dialog v-model="showApplyDialog"
+               title="鍔炲叕鐗╄祫鐢宠"
+               width="600px"
+               append-to-body>
+      <el-form ref="applyFormRef"
+               :model="applyForm"
+               :rules="applyRules"
+               label-width="100px">
+        <el-form-item label="鐢宠浜�"
+                      prop="applicant">
+          <el-input v-model="applyForm.applicant"
+                    placeholder="璇疯緭鍏ョ敵璇蜂汉鍚嶇О" />
+        </el-form-item>
+        <el-form-item label="閮ㄩ棬"
+                      prop="dept">
+          <el-input v-model="applyForm.dept"
+                    placeholder="璇疯緭鍏ラ儴闂ㄥ悕绉�" />
+        </el-form-item>
+        <el-form-item label="鐗╄祫绫诲瀷"
+                      prop="materialType">
+          <el-select v-model="applyForm.materialType"
+                     placeholder="璇烽�夋嫨鐗╄祫绫诲瀷"
+                     style="width: 100%">
+            <el-option label="鍔炲叕鐢ㄥ搧"
+                       value="4" />
+            <el-option label="鐢靛瓙璁惧"
+                       value="3" />
+            <el-option label="娓呮磥鐢ㄥ搧"
+                       value="2" />
+            <el-option label="鍏朵粬"
+                       value="1" />
           </el-select>
         </el-form-item>
-        <el-form-item label="鍏蜂綋鐗╁搧" prop="itemName">
-          <el-input v-model="applyForm.itemName" placeholder="璇疯緭鍏ュ叿浣撶墿鍝佸悕绉�" />
+        <el-form-item label="鍏蜂綋鐗╁搧"
+                      prop="itemName">
+          <el-input v-model="applyForm.itemName"
+                    placeholder="璇疯緭鍏ュ叿浣撶墿鍝佸悕绉�" />
         </el-form-item>
-        <el-form-item label="鐢宠鏁伴噺" prop="quantity">
-          <el-input-number v-model="applyForm.quantity" :min="1" :max="999" style="width: 100%" />
+        <el-form-item label="鐢宠鏁伴噺"
+                      prop="applyNum">
+          <el-input-number v-model="applyForm.applyNum"
+                           :min="1"
+                           :max="999"
+                           style="width: 100%" />
         </el-form-item>
-        <el-form-item label="鐢宠鍘熷洜" prop="reason">
-          <el-input
-            v-model="applyForm.reason"
-            type="textarea"
-            :rows="3"
-            placeholder="璇疯緭鍏ョ敵璇峰師鍥�"
-          />
+        <el-form-item label="鐢宠鍘熷洜"
+                      prop="reason">
+          <el-input v-model="applyForm.reason"
+                    type="textarea"
+                    :rows="3"
+                    placeholder="璇疯緭鍏ョ敵璇峰師鍥�" />
         </el-form-item>
-        <el-form-item label="绱ф�ョ▼搴�" prop="urgency">
+        <el-form-item label="绱ф�ョ▼搴�"
+                      prop="urgency">
           <el-radio-group v-model="applyForm.urgency">
-            <el-radio label="normal">鏅��</el-radio>
-            <el-radio label="urgent">绱ф��</el-radio>
-            <el-radio label="very_urgent">闈炲父绱ф��</el-radio>
+            <el-radio label="1">鏅��</el-radio>
+            <el-radio label="2">绱ф��</el-radio>
+            <el-radio label="3">闈炲父绱ф��</el-radio>
           </el-radio-group>
         </el-form-item>
       </el-form>
       <template #footer>
         <div class="dialog-footer">
+          <el-button type="primary"
+                     @click="submitApply">纭� 瀹�</el-button>
           <el-button @click="showApplyDialog = false">鍙� 娑�</el-button>
-          <el-button type="primary" @click="submitApply">纭� 瀹�</el-button>
         </div>
       </template>
     </el-dialog>
-
     <!-- 瀹℃壒瀵硅瘽妗� -->
-    <el-dialog
-      v-model="showApproveDialog"
-      title="瀹℃壒鐢宠"
-      width="500px"
-      append-to-body
-    >
-      <el-form ref="approveFormRef" :model="approveForm" :rules="approveRules" label-width="100px">
-        <el-form-item label="瀹℃壒缁撴灉" prop="approveResult">
+    <el-dialog v-model="showApproveDialog"
+               title="瀹℃壒鐢宠"
+               width="500px"
+               append-to-body>
+      <el-form ref="approveFormRef"
+               :model="approveForm"
+               :rules="approveRules"
+               label-width="100px">
+        <el-form-item label="瀹℃壒缁撴灉"
+                      prop="approveResult">
           <el-radio-group v-model="approveForm.approveResult">
-            <el-radio label="approved">閫氳繃</el-radio>
-            <el-radio label="rejected">鎷掔粷</el-radio>
+            <el-radio label="3">閫氳繃</el-radio>
+            <el-radio label="2">鎷掔粷</el-radio>
           </el-radio-group>
         </el-form-item>
-        <el-form-item label="瀹℃壒鎰忚" prop="approveComment">
-          <el-input
-            v-model="approveForm.approveComment"
-            type="textarea"
-            :rows="3"
-            placeholder="璇疯緭鍏ュ鎵规剰瑙�"
-          />
+        <el-form-item label="瀹℃壒鎰忚"
+                      prop="approvalOpinions">
+          <el-input v-model="approveForm.approvalOpinions"
+                    type="textarea"
+                    :rows="3"
+                    placeholder="璇疯緭鍏ュ鎵规剰瑙�" />
         </el-form-item>
       </el-form>
       <template #footer>
         <div class="dialog-footer">
+          <el-button type="primary"
+                     @click="submitApprove">纭� 瀹�</el-button>
           <el-button @click="showApproveDialog = false">鍙� 娑�</el-button>
-          <el-button type="primary" @click="submitApprove">纭� 瀹�</el-button>
         </div>
       </template>
     </el-dialog>
-
     <!-- 璇︽儏瀵硅瘽妗� -->
-    <el-dialog
-      v-model="showDetailDialog"
-      title="鐢宠璇︽儏"
-      width="700px"
-      append-to-body
-    >
-      <el-descriptions :column="2" border>
-        <el-descriptions-item label="鐢宠缂栧彿">{{ currentDetail.applyNo }}</el-descriptions-item>
+    <el-dialog v-model="showDetailDialog"
+               title="鐢宠璇︽儏"
+               width="700px"
+               append-to-body>
+      <el-descriptions :column="2"
+                       border>
+        <el-descriptions-item label="鐢宠缂栧彿">{{ currentDetail.code }}</el-descriptions-item>
         <el-descriptions-item label="鐢宠浜�">{{ currentDetail.applicant }}</el-descriptions-item>
-        <el-descriptions-item label="閮ㄩ棬">{{ currentDetail.department }}</el-descriptions-item>
-        <el-descriptions-item label="鐗╄祫绫诲瀷">{{ currentDetail.supplyType }}</el-descriptions-item>
+        <el-descriptions-item label="閮ㄩ棬">{{ currentDetail.dept }}</el-descriptions-item>
+        <el-descriptions-item label="鐗╄祫绫诲瀷">{{ currentDetail.materialType }}</el-descriptions-item>
         <el-descriptions-item label="鍏蜂綋鐗╁搧">{{ currentDetail.itemName }}</el-descriptions-item>
-        <el-descriptions-item label="鐢宠鏁伴噺">{{ currentDetail.quantity }}</el-descriptions-item>
-        <el-descriptions-item label="鐢宠鍘熷洜" :span="2">{{ currentDetail.reason }}</el-descriptions-item>
+        <el-descriptions-item label="鐢宠鏁伴噺">{{ currentDetail.applyNum }}</el-descriptions-item>
+        <el-descriptions-item label="鐢宠鍘熷洜"
+                              :span="2">{{ currentDetail.reason }}</el-descriptions-item>
         <el-descriptions-item label="鐢宠鐘舵��">
           <el-tag :type="getStatusType(currentDetail.status)">
             {{ getStatusText(currentDetail.status) }}
           </el-tag>
         </el-descriptions-item>
         <el-descriptions-item label="鐢宠鏃堕棿">{{ currentDetail.applyTime }}</el-descriptions-item>
-        <el-descriptions-item label="瀹℃壒浜�">{{ currentDetail.approver || '-' }}</el-descriptions-item>
-        <el-descriptions-item label="瀹℃壒鏃堕棿">{{ currentDetail.approveTime || '-' }}</el-descriptions-item>
-        <el-descriptions-item label="瀹℃壒鎰忚" :span="2">{{ currentDetail.approveComment || '-' }}</el-descriptions-item>
+        <el-descriptions-item label="瀹℃壒浜�">{{ currentDetail.approval || '-' }}</el-descriptions-item>
+        <el-descriptions-item label="瀹℃壒鏃堕棿">{{ currentDetail.approvalTime || '-' }}</el-descriptions-item>
+        <el-descriptions-item label="瀹℃壒鎰忚"
+                              :span="2">{{ currentDetail.approvalOpinions || '-' }}</el-descriptions-item>
         <el-descriptions-item label="鍙戞斁鏃堕棿">{{ currentDetail.issueTime || '-' }}</el-descriptions-item>
-        <el-descriptions-item label="鍙戞斁浜�">{{ currentDetail.issuer || '-' }}</el-descriptions-item>
+        <el-descriptions-item label="鍙戞斁浜�">{{ currentDetail.issueUser || '-' }}</el-descriptions-item>
       </el-descriptions>
     </el-dialog>
   </div>
 </template>
 
 <script setup>
-import { ref, reactive, onMounted } from 'vue'
-import { ElMessage, ElMessageBox } from 'element-plus'
-import { Plus, Search, Refresh, Download, Check } from '@element-plus/icons-vue'
+  import {
+    listPage,
+    add,
+    update,
+    deleteOff,
+  } from "@/api/collaborativeApproval/officeSupplies.js";
+  import { ref, reactive, onMounted, getCurrentInstance } from "vue";
+  import Cookies from "js-cookie";
+  import { ElMessage, ElMessageBox } from "element-plus";
+  import {
+    Plus,
+    Search,
+    Refresh,
+    Download,
+    Check,
+  } from "@element-plus/icons-vue";
 
-// 鍝嶅簲寮忔暟鎹�
-const loading = ref(false)
-const showSearch = ref(true)
-const showApplyDialog = ref(false)
-const showApproveDialog = ref(false)
-const showDetailDialog = ref(false)
-const multipleSelection = ref([])
-const total = ref(0)
-const suppliesList = ref([])
-const currentDetail = ref({})
+  // 鍝嶅簲寮忔暟鎹�
+  const loading = ref(false);
+  const showSearch = ref(true);
+  const showApplyDialog = ref(false);
+  const showApproveDialog = ref(false);
+  const showDetailDialog = ref(false);
+  const multipleSelection = ref([]);
+  const officeList = ref([]);
+  const total = ref(0);
+  const suppliesList = ref([]);
+  const currentDetail = ref({});
 
-// 鏌ヨ鍙傛暟
-const queryParams = reactive({
-  pageNum: 1,
-  pageSize: 10,
-  applyNo: '',
-  applicant: '',
-  status: ''
-})
+  // 鏌ヨ鍙傛暟
+  const queryParams = reactive({
+    current: 1,
+    size: 10,
+    code: "",
+    applicant: "",
+    status: "",
+  });
 
-// 鐢宠琛ㄥ崟
-const applyForm = reactive({
-  supplyType: '',
-  itemName: '',
-  quantity: 1,
-  reason: '',
-  urgency: 'normal'
-})
+  // 鐢宠琛ㄥ崟
+  const applyForm = reactive({
+    applicant: "",
+    dept: "",
+    materialType: "",
+    itemName: "",
+    applyNum: 1,
+    reason: "",
+    urgency: "1",
+  });
 
-// 瀹℃壒琛ㄥ崟
-const approveForm = reactive({
-  approveResult: 'approved',
-  approveComment: ''
-})
+  // 瀹℃壒琛ㄥ崟
+  const approveForm = reactive({
+    approveResult: "3",
+    approvalOpinions: "",
+  });
 
-// 琛ㄥ崟鏍¢獙瑙勫垯
-const applyRules = {
-  supplyType: [{ required: true, message: '璇烽�夋嫨鐗╄祫绫诲瀷', trigger: 'change' }],
-  itemName: [{ required: true, message: '璇疯緭鍏ュ叿浣撶墿鍝佸悕绉�', trigger: 'blur' }],
-  quantity: [{ required: true, message: '璇疯緭鍏ョ敵璇锋暟閲�', trigger: 'blur' }],
-  reason: [{ required: true, message: '璇疯緭鍏ョ敵璇峰師鍥�', trigger: 'blur' }]
-}
+  // 琛ㄥ崟鏍¢獙瑙勫垯
+  const applyRules = {
+    applicant: [{ required: true, message: "璇烽�夋嫨鐗╄祫绫诲瀷", trigger: "blur" }],
+    dept: [{ required: true, message: "璇烽�夋嫨鐗╄祫绫诲瀷", trigger: "blur" }],
+    materialType: [
+      { required: true, message: "璇烽�夋嫨鐗╄祫绫诲瀷", trigger: "change" },
+    ],
+    itemName: [
+      { required: true, message: "璇疯緭鍏ュ叿浣撶墿鍝佸悕绉�", trigger: "blur" },
+    ],
+    applyNum: [{ required: true, message: "璇疯緭鍏ョ敵璇锋暟閲�", trigger: "blur" }],
+    reason: [{ required: true, message: "璇疯緭鍏ョ敵璇峰師鍥�", trigger: "blur" }],
+  };
 
-const approveRules = {
-  approveResult: [{ required: true, message: '璇烽�夋嫨瀹℃壒缁撴灉', trigger: 'change' }],
-  approveComment: [{ required: true, message: '璇疯緭鍏ュ鎵规剰瑙�', trigger: 'blur' }]
-}
+  const approveRules = {
+    approveResult: [
+      { required: true, message: "璇烽�夋嫨瀹℃壒缁撴灉", trigger: "change" },
+    ],
+    approvalOpinions: [
+      { required: true, message: "璇疯緭鍏ュ鎵规剰瑙�", trigger: "blur" },
+    ],
+  };
 
-// 鍋囨暟鎹�
-const mockData = [
-  {
-    id: 1,
-    applyNo: 'WS20241201001',
-    applicant: '闄堝織寮�',
-    department: '鎶�鏈儴',
-    supplyType: '鍔炲叕鐢ㄥ搧',
-    itemName: 'A4鎵撳嵃绾�',
-    quantity: 10,
-    reason: '鏃ュ父鍔炲叕鎵撳嵃闇�瑕�',
-    status: 'pending',
-    applyTime: '2025-12-01 09:30:00',
-    approver: '',
-    approveTime: '',
-    approveComment: '',
-    issueTime: '',
-    issuer: ''
-  },
-  {
-    id: 2,
-    applyNo: 'WS20241201002',
-    applicant: '鍒橀泤濠�',
-    department: '浜轰簨閮�',
-    supplyType: '鐢靛瓙璁惧',
-    itemName: '鏃犵嚎榧犳爣',
-    quantity: 2,
-    reason: '鏂板憳宸ュ叆鑱岄厤澶�',
-    status: 'approved',
-    applyTime: '2025-12-01 10:15:00',
-    approver: '鐜嬪缓鍥�',
-    approveTime: '2025-12-01 14:20:00',
-    approveComment: '鍚屾剰鐢宠锛岃鍙婃椂鍙戞斁',
-    issueTime: '',
-    issuer: ''
-  },
-  {
-    id: 3,
-    applyNo: 'WS20241201003',
-    applicant: '鐜嬪缓鍥�',
-    department: '璐㈠姟閮�',
-    supplyType: '娓呮磥鐢ㄥ搧',
-    itemName: '娲楁墜娑�',
-    quantity: 5,
-    reason: '鍔炲叕瀹ゆ竻娲佺敤鍝佽ˉ鍏�',
-    status: 'issued',
-    applyTime: '2025-12-01 11:00:00',
-    approver: '鍒橀泤濠�',
-    approveTime: '2025-12-01 15:30:00',
-    approveComment: '鍚屾剰鐢宠',
-    issueTime: '2025-12-01 16:00:00',
-    issuer: '閽变紵鏄�'
-  },
-  {
-    id: 4,
-    applyNo: 'WS20241201004',
-    applicant: '璧典附鍗�',
-    department: '甯傚満閮�',
-    supplyType: '鍏朵粬',
-    itemName: '鏂囦欢澶�',
-    quantity: 20,
-    reason: '椤圭洰璧勬枡鏁寸悊闇�瑕�',
-    status: 'rejected',
-    applyTime: '2025-12-01 13:45:00',
-    approver: '闄堝織寮�',
-    approveTime: '2025-12-01 17:00:00',
-    approveComment: '鏁伴噺杩囧锛屽缓璁噺灏戝埌10涓�',
-    issueTime: '',
-    issuer: ''
-  },
-  {
-    id: 5,
-    applyNo: 'WS20241202001',
-    applicant: '閽变紵鏄�',
-    department: '杩愯惀閮�',
-    supplyType: '鍔炲叕鐢ㄥ搧',
-    itemName: '绛惧瓧绗�',
-    quantity: 50,
-    reason: '閮ㄩ棬鏃ュ父鍔炲叕鐢ㄥ搧琛ュ厖',
-    status: 'pending',
-    applyTime: '2025-12-02 08:30:00',
-    approver: '',
-    approveTime: '',
-    approveComment: '',
-    issueTime: '',
-    issuer: ''
-  },
-  {
-    id: 6,
-    applyNo: 'WS20241202002',
-    applicant: '瀛欐槑鍗�',
-    department: '鎶�鏈儴',
-    supplyType: '鐢靛瓙璁惧',
-    itemName: '閿洏',
-    quantity: 3,
-    reason: '鏂板憳宸ヨ澶囬厤澶�',
-    status: 'approved',
-    applyTime: '2025-12-02 14:20:00',
-    approver: '闄堝織寮�',
-    approveTime: '2025-12-02 16:00:00',
-    approveComment: '鍚屾剰鐢宠',
-    issueTime: '',
-    issuer: ''
-  },
-  {
-    id: 7,
-    applyNo: 'WS20241203001',
-    applicant: '鍛ㄧ編鐜�',
-    department: '浜轰簨閮�',
-    supplyType: '娓呮磥鐢ㄥ搧',
-    itemName: '绾稿肪',
-    quantity: 30,
-    reason: '鍔炲叕鍖哄煙娓呮磥鐢ㄥ搧琛ュ厖',
-    status: 'issued',
-    applyTime: '2025-12-03 09:15:00',
-    approver: '璧典附鍗�',
-    approveTime: '2025-12-03 10:30:00',
-    approveComment: '鍚屾剰鐢宠',
-    issueTime: '2025-12-03 11:00:00',
-    issuer: '瀛欐槑鍗�'
-  },
-  {
-    id: 8,
-    applyNo: 'WS20241203002',
-    applicant: '鍚村織寮�',
-    department: '璐㈠姟閮�',
-    supplyType: '鍏朵粬',
-    itemName: '璁$畻鍣�',
-    quantity: 2,
-    reason: '璐㈠姟鏍哥畻宸ヤ綔闇�瑕�',
-    status: 'rejected',
-    applyTime: '2025-12-03 15:45:00',
-    approver: '鐜嬪缓鍥�',
-    approveTime: '2025-12-03 17:20:00',
-    approveComment: '宸叉湁璁$畻鍣紝鏆備笉闇�瑕�',
-    issueTime: '',
-    issuer: ''
-  }
-]
+  const openShow = () => {
+    showApplyDialog.value = true;
+    resetApplyForm();
+  };
 
-// 鑾峰彇鍒楄〃鏁版嵁
-const getList = () => {
-  loading.value = true
-  // 妯℃嫙寮傛璇锋眰
-  setTimeout(() => {
-    let filteredData = [...mockData]
-    
-    // 鏍规嵁鏌ヨ鏉′欢杩囨护
-    if (queryParams.applyNo) {
-      filteredData = filteredData.filter(item => 
-        item.applyNo.toLowerCase().includes(queryParams.applyNo.toLowerCase())
-      )
-    }
-    if (queryParams.applicant) {
-      filteredData = filteredData.filter(item => 
-        item.applicant.toLowerCase().includes(queryParams.applicant.toLowerCase())
-      )
-    }
-    if (queryParams.status) {
-      filteredData = filteredData.filter(item => 
-        item.status === queryParams.status
-      )
-    }
-    
-    // 鎸夌敵璇锋椂闂村�掑簭鎺掑垪
-    filteredData.sort((a, b) => new Date(b.applyTime) - new Date(a.applyTime))
-    
-    total.value = filteredData.length
-    suppliesList.value = filteredData.slice(
-      (queryParams.pageNum - 1) * queryParams.pageSize,
-      queryParams.pageNum * queryParams.pageSize
-    )
-    loading.value = false
-  }, 500)
-}
+  // 鑾峰彇鍒楄〃鏁版嵁
+  const getList = () => {
+    loading.value = true;
+    listPage(queryParams).then(res => {
+      total.value = res.data.total;
+      loading.value = false;
+      officeList.value = res.data.records;
+    });
+  };
 
-// 鏌ヨ
-const handleQuery = () => {
-  queryParams.pageNum = 1
-  getList()
-}
+  // 鏌ヨ
+  const handleQuery = () => {
+    queryParams.current = 1;
+    getList();
+  };
 
-// 閲嶇疆鏌ヨ
-const resetQuery = () => {
-  queryParams.applyNo = ''
-  queryParams.applicant = ''
-  queryParams.status = ''
-  handleQuery()
-}
+  // 閲嶇疆鏌ヨ
+  const resetQuery = () => {
+    queryParams.code = "";
+    queryParams.applicant = "";
+    queryParams.status = "";
+    handleQuery();
+  };
 
-// 澶氶��
-const handleSelectionChange = (selection) => {
-  multipleSelection.value = selection
-}
+  // 澶氶��
+  const handleSelectionChange = selection => {
+    multipleSelection.value = selection;
+  };
 
-// 鑾峰彇鐘舵�佺被鍨�
-const getStatusType = (status) => {
-  const statusMap = {
-    pending: 'warning',
-    approved: 'success',
-    rejected: 'danger',
-    issued: 'info'
-  }
-  return statusMap[status] || 'info'
-}
+  // 鑾峰彇鐘舵�佺被鍨�
+  const getStatusType = status => {
+    const statusMap = {
+      1: "warning",
+      3: "success",
+      2: "danger",
+      4: "info",
+    };
+    return statusMap[status] || "info";
+  };
 
-// 鑾峰彇鐘舵�佹枃鏈�
-const getStatusText = (status) => {
-  const statusMap = {
-    pending: '寰呭鎵�',
-    approved: '宸查�氳繃',
-    rejected: '宸叉嫆缁�',
-    issued: '宸插彂鏀�'
-  }
-  return statusMap[status] || status
-}
+  // 鑾峰彇鐘舵�佹枃鏈�
+  const getStatusText = status => {
+    const statusMap = {
+      1: "寰呭鎵�",
+      3: "宸查�氳繃",
+      2: "宸叉嫆缁�",
+      4: "宸插彂鏀�",
+    };
+    return statusMap[status] || status;
+  };
 
-// 鎻愪氦鐢宠
-const submitApply = () => {
-  const newApply = {
-    id: mockData.length + 1,
-    applyNo: `WS${new Date().getTime()}`,
-    applicant: '褰撳墠鐢ㄦ埛',
-    department: '鎶�鏈儴',
-    supplyType: applyForm.supplyType,
-    itemName: applyForm.itemName,
-    quantity: applyForm.quantity,
-    reason: applyForm.reason,
-    status: 'pending',
-    applyTime: new Date().toLocaleString(),
-    approver: '',
-    approveTime: '',
-    approveComment: '',
-    issueTime: '',
-    issuer: ''
-  }
-  
-  mockData.unshift(newApply)
-  showApplyDialog.value = false
-  ElMessage.success('鐢宠鎻愪氦鎴愬姛')
-  getList()
-  
-  // 閲嶇疆琛ㄥ崟
-  Object.assign(applyForm, {
-    supplyType: '',
-    itemName: '',
-    quantity: 1,
-    reason: '',
-    urgency: 'normal'
-  })
-}
+  // 鎻愪氦鐢宠
+  const submitApply = () => {
+    add(applyForm).then(() => {
+      ElMessage.success("鐢宠鎴愬姛");
+      getList();
+      showApplyDialog.value = false;
+      resetApplyForm();
+    });
+  };
 
-// 瀹℃壒
-const handleApprove = (row) => {
-  currentDetail.value = row
-  showApproveDialog.value = true
-}
+  //閲嶇疆琛ㄥ崟
+  const resetApplyForm = () => {
+    // 閲嶇疆琛ㄥ崟
+    Object.assign(applyForm, {
+      applicant: "",
+      dept: "",
+      materialType: "",
+      itemName: "",
+      applyNum: 1,
+      reason: "",
+      urgency: "1",
+    });
+  };
 
-// 鎻愪氦瀹℃壒
-const submitApprove = () => {
-  const index = mockData.findIndex(item => item.id === currentDetail.value.id)
-  if (index !== -1) {
-    mockData[index].status = approveForm.approveResult
-    mockData[index].approver = '褰撳墠瀹℃壒浜�'
-    mockData[index].approveTime = new Date().toLocaleString()
-    mockData[index].approveComment = approveForm.approveComment
-  }
-  
-  showApproveDialog.value = false
-  ElMessage.success('瀹℃壒瀹屾垚')
-  getList()
-  
-  // 閲嶇疆琛ㄥ崟
-  Object.assign(approveForm, {
-    approveResult: 'approved',
-    approveComment: ''
-  })
-}
+  // 瀹℃壒
+  const handleApprove = row => {
+    currentDetail.value = row;
+    showApproveDialog.value = true;
+  };
 
-// 鍙戞斁
-const handleIssue = (row) => {
-  const index = mockData.findIndex(item => item.id === row.id)
-  if (index !== -1) {
-    mockData[index].status = 'issued'
-    mockData[index].issueTime = new Date().toLocaleString()
-    mockData[index].issuer = '褰撳墠鍙戞斁浜�'
-  }
-  
-  ElMessage.success('鍙戞斁瀹屾垚')
-  getList()
-}
+  const formatDate = date => {
+    const year = date.getFullYear();
+    const month = String(date.getMonth() + 1).padStart(2, "0");
+    const day = String(date.getDate()).padStart(2, "0");
+    const hours = String(date.getHours()).padStart(2, "0");
+    const minutes = String(date.getMinutes()).padStart(2, "0");
+    const sends = String(date.getSeconds()).padStart(2, "0");
+    return `${year}-${month}-${day} ${hours}:${minutes}:${sends}`;
+  };
 
-// 鏌ョ湅璇︽儏
-const handleDetail = (row) => {
-  currentDetail.value = row
-  showDetailDialog.value = true
-}
+  // 鎻愪氦瀹℃壒
+  const submitApprove = () => {
+    currentDetail.value.status = approveForm.approveResult;
+    // 浠巆ookie涓幏鍙栧綋鍓嶇櫥褰曠敤鎴峰悕绉�
+    currentDetail.value.approval = Cookies.get("username");
+    currentDetail.value.approvalTime = formatDate(new Date());
+    currentDetail.value.approvalOpinions = approveForm.approvalOpinions;
+    update(currentDetail.value).then(res => {
+      if (res.code === 200) {
+        showApproveDialog.value = false;
+        ElMessage.success("瀹℃壒瀹屾垚");
+        getList();
 
-// 鍒犻櫎
-const handleDelete = (row) => {
-  ElMessageBox.confirm('纭鍒犻櫎璇ョ敵璇峰悧锛�', '鎻愮ず', {
-    confirmButtonText: '纭畾',
-    cancelButtonText: '鍙栨秷',
-    type: 'warning'
-  }).then(() => {
-    const index = mockData.findIndex(item => item.id === row.id)
-    if (index !== -1) {
-      mockData.splice(index, 1)
-    }
-    ElMessage.success('鍒犻櫎鎴愬姛')
-    getList()
-  })
-}
-
-// 鎵归噺瀹℃壒
-const handleBatchApprove = () => {
-  if (multipleSelection.value.length === 0) {
-    ElMessage.warning('璇烽�夋嫨瑕佸鎵圭殑璁板綍')
-    return
-  }
-  
-  ElMessageBox.confirm(`纭鎵归噺瀹℃壒閫変腑鐨� ${multipleSelection.value.length} 鏉¤褰曞悧锛焋, '鎻愮ず', {
-    confirmButtonText: '纭畾',
-    cancelButtonText: '鍙栨秷',
-    type: 'warning'
-  }).then(() => {
-    multipleSelection.value.forEach(row => {
-      const index = mockData.findIndex(item => item.id === row.id)
-      if (index !== -1) {
-        mockData[index].status = 'approved'
-        mockData[index].approver = '褰撳墠瀹℃壒浜�'
-        mockData[index].approveTime = new Date().toLocaleString()
-        mockData[index].approveComment = '鎵归噺瀹℃壒閫氳繃'
+        // 閲嶇疆琛ㄥ崟
+        Object.assign(approveForm, {
+          approveResult: "3",
+          approvalOpinions: "",
+        });
       }
+    });
+  };
+
+  // 鍙戞斁
+  const handleIssue = row => {
+    row.status = 4;
+    row.issueTime = formatDate(new Date());
+    row.issueUser = Cookies.get("username");
+    update(row).then(res => {
+      if (res.code === 200) {
+        ElMessage.success("鍙戞斁瀹屾垚");
+        getList();
+      }
+    });
+  };
+
+  // 鏌ョ湅璇︽儏
+  const handleDetail = row => {
+    currentDetail.value = row;
+    showDetailDialog.value = true;
+  };
+
+  // 鍒犻櫎
+  const handleDelete = row => {
+    ElMessageBox.confirm("纭鍒犻櫎璇ョ敵璇峰悧锛�", "鎻愮ず", {
+      confirmButtonText: "纭畾",
+      cancelButtonText: "鍙栨秷",
+      type: "warning",
+    }).then(() => {
+      let ids = [row.id];
+      deleteOff(ids).then(res => {
+        ElMessage.success("鍒犻櫎鎴愬姛");
+        getList();
+      });
+    });
+  };
+  const { proxy } = getCurrentInstance();
+  // 瀵煎嚭
+  const handleExport = () => {
+    ElMessageBox.confirm("鎵�鏈夌殑鍐呭灏嗚瀵煎嚭锛屾槸鍚︾‘璁ゅ鍑猴紵", "瀵煎嚭", {
+      confirmButtonText: "纭",
+      cancelButtonText: "鍙栨秷",
+      type: "warning",
     })
-    ElMessage.success('鎵归噺瀹℃壒瀹屾垚')
-    getList()
-  })
-}
+      .then(() => {
+        proxy.download("/officeSupplies/export", {}, "鍔炲叕鐗╄祫.xlsx");
+      })
+      .catch(() => {
+        proxy.$modal.msg("宸插彇娑�");
+      });
+  };
 
-// 瀵煎嚭
-const handleExport = () => {
-  ElMessage.success('瀵煎嚭鍔熻兘寮�鍙戜腑...')
-}
-
-// 椤甸潰鍔犺浇鏃惰幏鍙栨暟鎹�
-onMounted(() => {
-  getList()
-})
+  // 椤甸潰鍔犺浇鏃惰幏鍙栨暟鎹�
+  onMounted(() => {
+    getList();
+  });
 </script>
 
 <style scoped>
-.app-container {
-  padding: 20px;
-}
+  .app-container {
+    padding: 20px;
+  }
 
-.card-header {
-  display: flex;
-  justify-content: space-between;
-  align-items: center;
-}
+  .card-header {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+  }
 
-.mb8 {
-  margin-bottom: 8px;
-}
+  .mb8 {
+    margin-bottom: 8px;
+  }
 
-.dialog-footer {
-  text-align: right;
-}
+  .dialog-footer {
+    text-align: right;
+  }
 
-:deep(.el-descriptions__label) {
-  width: 120px;
-}
+  :deep(.el-descriptions__label) {
+    width: 120px;
+  }
 </style>

--
Gitblit v1.9.3