From be125538c6e9c17a923c9dbe1e4cca9962b0ed39 Mon Sep 17 00:00:00 2001
From: yaowanxin <3588231647@qq.com>
Date: 星期一, 08 九月 2025 10:17:53 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into ywx

---
 src/views/collaborativeApproval/officeSupplies/index.vue |  512 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 512 insertions(+), 0 deletions(-)

diff --git a/src/views/collaborativeApproval/officeSupplies/index.vue b/src/views/collaborativeApproval/officeSupplies/index.vue
new file mode 100644
index 0000000..a2d1c6d
--- /dev/null
+++ b/src/views/collaborativeApproval/officeSupplies/index.vue
@@ -0,0 +1,512 @@
+<template>
+  <div class="app-container">
+    <el-card class="box-card">
+      <template #header>
+        <div class="card-header">
+          <span>鍔炲叕鐗╄祫鐢宠绠$悊</span>
+          <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="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-form-item>
+       </el-form>
+
+      <!-- 琛ㄦ牸鍖哄煙 -->
+      <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="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 === 1"
+              type="primary"
+              link
+              @click="handleApprove(scope.row)"
+            >
+              瀹℃壒
+            </el-button>
+            <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>
+            <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.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="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>
+        <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>
+        <el-form-item label="绱ф�ョ▼搴�" prop="urgency">
+          <el-radio-group v-model="applyForm.urgency">
+            <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 @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-radio-group v-model="approveForm.approveResult">
+            <el-radio label="3">閫氳繃</el-radio>
+            <el-radio label="2">鎷掔粷</el-radio>
+          </el-radio-group>
+        </el-form-item>
+        <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 @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.code }}</el-descriptions-item>
+        <el-descriptions-item label="鐢宠浜�">{{ currentDetail.applicant }}</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.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.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.issueUser || '-' }}</el-descriptions-item>
+      </el-descriptions>
+    </el-dialog>
+  </div>
+</template>
+
+<script setup>
+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 officeList = ref([])
+const total = ref(0)
+const suppliesList = ref([])
+const currentDetail = ref({})
+
+// 鏌ヨ鍙傛暟
+const queryParams = reactive({
+  current: 1,
+  size: 10,
+  code: '',
+  applicant: '',
+  status: ''
+})
+
+// 鐢宠琛ㄥ崟
+const applyForm = reactive({
+  applicant: '',
+  dept: '',
+  materialType: '',
+  itemName: '',
+  applyNum: 1,
+  reason: '',
+  urgency: '1'
+})
+
+// 瀹℃壒琛ㄥ崟
+const approveForm = reactive({
+  approveResult: '3',
+  approvalOpinions: ''
+})
+
+// 琛ㄥ崟鏍¢獙瑙勫垯
+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' }],
+  approvalOpinions: [{ required: true, message: '璇疯緭鍏ュ鎵规剰瑙�', trigger: 'blur' }]
+}
+
+const openShow = () => {
+  showApplyDialog.value = true
+  resetApplyForm()
+}
+
+// 鑾峰彇鍒楄〃鏁版嵁
+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.current = 1
+  getList()
+}
+
+// 閲嶇疆鏌ヨ
+const resetQuery = () => {
+  queryParams.code = ''
+  queryParams.applicant = ''
+  queryParams.status = ''
+  handleQuery()
+}
+
+// 澶氶��
+const handleSelectionChange = (selection) => {
+  multipleSelection.value = selection
+}
+
+// 鑾峰彇鐘舵�佺被鍨�
+const getStatusType = (status) => {
+  const statusMap = {
+    1: 'warning',
+    3: 'success',
+    2: 'danger',
+    4: 'info'
+  }
+  return statusMap[status] || 'info'
+}
+
+// 鑾峰彇鐘舵�佹枃鏈�
+const getStatusText = (status) => {
+  const statusMap = {
+    1: '寰呭鎵�',
+    3: '宸查�氳繃',
+    2: '宸叉嫆缁�',
+    4: '宸插彂鏀�'
+  }
+  return statusMap[status] || status
+}
+
+// 鎻愪氦鐢宠
+const submitApply = () => {
+  add(applyForm).then(() => {
+    ElMessage.success('鐢宠鎴愬姛')
+    getList()
+    showApplyDialog.value = false
+    resetApplyForm()
+  })
+
+  
+
+}
+
+//閲嶇疆琛ㄥ崟
+const resetApplyForm = () => {
+  // 閲嶇疆琛ㄥ崟
+  Object.assign(applyForm, {
+    applicant: '',
+    dept: '',
+    materialType: '',
+    itemName: '',
+    applyNum: 1,
+    reason: '',
+    urgency: '1'
+  })
+}
+
+// 瀹℃壒
+const handleApprove = (row) => {
+  currentDetail.value = row
+  showApproveDialog.value = true
+}
+
+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 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()
+
+      // 閲嶇疆琛ㄥ崟
+      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",
+  })
+      .then(() => {
+        proxy.download("/officeSupplies/export", {}, "鍔炲叕鐗╄祫.xlsx");
+      })
+      .catch(() => {
+        proxy.$modal.msg("宸插彇娑�");
+      });
+}
+
+// 椤甸潰鍔犺浇鏃惰幏鍙栨暟鎹�
+onMounted(() => {
+  getList()
+})
+</script>
+
+<style scoped>
+.app-container {
+  padding: 20px;
+}
+
+.card-header {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+}
+
+.mb8 {
+  margin-bottom: 8px;
+}
+
+.dialog-footer {
+  text-align: right;
+}
+
+:deep(.el-descriptions__label) {
+  width: 120px;
+}
+</style>

--
Gitblit v1.9.3