From 9aae2af6f3937a7d99ec619b51f457002cef969f Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期一, 03 十一月 2025 14:29:37 +0800
Subject: [PATCH] 档案管理-添加导出功能
---
src/views/collaborativeApproval/officeSupplies/index.vue | 482 ++++++++++++++++++-----------------------------------
1 files changed, 162 insertions(+), 320 deletions(-)
diff --git a/src/views/collaborativeApproval/officeSupplies/index.vue b/src/views/collaborativeApproval/officeSupplies/index.vue
index 58ccc76..a2d1c6d 100644
--- a/src/views/collaborativeApproval/officeSupplies/index.vue
+++ b/src/views/collaborativeApproval/officeSupplies/index.vue
@@ -4,7 +4,7 @@
<template #header>
<div class="card-header">
<span>鍔炲叕鐗╄祫鐢宠绠$悊</span>
- <el-button type="primary" @click="showApplyDialog = true">
+ <el-button type="primary" @click="openShow()">
<el-icon><Plus /></el-icon>
鏂板缓鐢宠
</el-button>
@@ -13,9 +13,9 @@
<!-- 鎼滅储鍖哄煙 -->
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch">
- <el-form-item label="鐢宠缂栧彿" prop="applyNo">
+ <el-form-item label="鐢宠缂栧彿" prop="code">
<el-input
- v-model="queryParams.applyNo"
+ v-model="queryParams.code"
placeholder="璇疯緭鍏ョ敵璇风紪鍙�"
clearable
style="width: 200px"
@@ -33,10 +33,10 @@
</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-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>
@@ -54,26 +54,29 @@
<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-table
v-loading="loading"
- :data="suppliesList"
+ :data="officeList"
@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="code" 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="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">
@@ -83,13 +86,13 @@
</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="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'"
+ v-if="scope.row.status === 1"
type="primary"
link
@click="handleApprove(scope.row)"
@@ -97,7 +100,7 @@
瀹℃壒
</el-button>
<el-button
- v-if="scope.row.status === 'approved'"
+ v-if="scope.row.status === 3"
type="success"
link
@click="handleIssue(scope.row)"
@@ -112,7 +115,7 @@
璇︽儏
</el-button>
<el-button
- v-if="scope.row.status === 'pending'"
+ v-if="scope.row.status === 2"
type="danger"
link
@click="handleDelete(scope.row)"
@@ -127,8 +130,8 @@
<pagination
v-show="total > 0"
:total="total"
- v-model:page="queryParams.pageNum"
- v-model:limit="queryParams.pageSize"
+ v-model:page="queryParams.current"
+ v-model:limit="queryParams.size"
@pagination="getList"
/>
</el-card>
@@ -141,19 +144,25 @@
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-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="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
@@ -165,9 +174,9 @@
</el-form-item>
<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>
@@ -189,13 +198,13 @@
<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-form-item label="瀹℃壒鎰忚" prop="approvalOpinions">
<el-input
- v-model="approveForm.approveComment"
+ v-model="approveForm.approvalOpinions"
type="textarea"
:rows="3"
placeholder="璇疯緭鍏ュ鎵规剰瑙�"
@@ -218,12 +227,12 @@
append-to-body
>
<el-descriptions :column="2" border>
- <el-descriptions-item label="鐢宠缂栧彿">{{ currentDetail.applyNo }}</el-descriptions-item>
+ <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="鐢宠鏁伴噺">{{ 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)">
@@ -231,18 +240,20 @@
</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 {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'
@@ -253,232 +264,76 @@
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: '',
+ current: 1,
+ size: 10,
+ code: '',
applicant: '',
status: ''
})
// 鐢宠琛ㄥ崟
const applyForm = reactive({
- supplyType: '',
+ applicant: '',
+ dept: '',
+ materialType: '',
itemName: '',
- quantity: 1,
+ applyNum: 1,
reason: '',
- urgency: 'normal'
+ urgency: '1'
})
// 瀹℃壒琛ㄥ崟
const approveForm = reactive({
- approveResult: 'approved',
- approveComment: ''
+ approveResult: '3',
+ approvalOpinions: ''
})
// 琛ㄥ崟鏍¢獙瑙勫垯
const applyRules = {
- supplyType: [{ required: true, message: '璇烽�夋嫨鐗╄祫绫诲瀷', trigger: 'change' }],
+ applicant: [{ required: true, message: '璇烽�夋嫨鐗╄祫绫诲瀷', trigger: 'blur' }],
+ dept: [{ required: true, message: '璇烽�夋嫨鐗╄祫绫诲瀷', trigger: 'blur' }],
+ materialType: [{ required: true, message: '璇烽�夋嫨鐗╄祫绫诲瀷', trigger: 'change' }],
itemName: [{ required: true, message: '璇疯緭鍏ュ叿浣撶墿鍝佸悕绉�', trigger: 'blur' }],
- quantity: [{ 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' }]
+ approvalOpinions: [{ required: true, message: '璇疯緭鍏ュ鎵规剰瑙�', trigger: 'blur' }]
}
-// 鍋囨暟鎹�
-const mockData = [
- {
- id: 1,
- applyNo: 'WS20241201001',
- applicant: '闄堝織寮�',
- department: '鎶�鏈儴',
- supplyType: '鍔炲叕鐢ㄥ搧',
- itemName: 'A4鎵撳嵃绾�',
- quantity: 10,
- reason: '鏃ュ父鍔炲叕鎵撳嵃闇�瑕�',
- status: 'pending',
- applyTime: '2024-12-01 09:30:00',
- approver: '',
- approveTime: '',
- approveComment: '',
- issueTime: '',
- issuer: ''
- },
- {
- id: 2,
- applyNo: 'WS20241201002',
- applicant: '鍒橀泤濠�',
- department: '浜轰簨閮�',
- supplyType: '鐢靛瓙璁惧',
- itemName: '鏃犵嚎榧犳爣',
- quantity: 2,
- reason: '鏂板憳宸ュ叆鑱岄厤澶�',
- status: 'approved',
- applyTime: '2024-12-01 10:15:00',
- approver: '鐜嬪缓鍥�',
- approveTime: '2024-12-01 14:20:00',
- approveComment: '鍚屾剰鐢宠锛岃鍙婃椂鍙戞斁',
- issueTime: '',
- issuer: ''
- },
- {
- id: 3,
- applyNo: 'WS20241201003',
- applicant: '鐜嬪缓鍥�',
- department: '璐㈠姟閮�',
- supplyType: '娓呮磥鐢ㄥ搧',
- itemName: '娲楁墜娑�',
- quantity: 5,
- reason: '鍔炲叕瀹ゆ竻娲佺敤鍝佽ˉ鍏�',
- status: 'issued',
- applyTime: '2024-12-01 11:00:00',
- approver: '鍒橀泤濠�',
- approveTime: '2024-12-01 15:30:00',
- approveComment: '鍚屾剰鐢宠',
- issueTime: '2024-12-01 16:00:00',
- issuer: '閽变紵鏄�'
- },
- {
- id: 4,
- applyNo: 'WS20241201004',
- applicant: '璧典附鍗�',
- department: '甯傚満閮�',
- supplyType: '鍏朵粬',
- itemName: '鏂囦欢澶�',
- quantity: 20,
- reason: '椤圭洰璧勬枡鏁寸悊闇�瑕�',
- status: 'rejected',
- applyTime: '2024-12-01 13:45:00',
- approver: '闄堝織寮�',
- approveTime: '2024-12-01 17:00:00',
- approveComment: '鏁伴噺杩囧锛屽缓璁噺灏戝埌10涓�',
- issueTime: '',
- issuer: ''
- },
- {
- id: 5,
- applyNo: 'WS20241202001',
- applicant: '閽变紵鏄�',
- department: '杩愯惀閮�',
- supplyType: '鍔炲叕鐢ㄥ搧',
- itemName: '绛惧瓧绗�',
- quantity: 50,
- reason: '閮ㄩ棬鏃ュ父鍔炲叕鐢ㄥ搧琛ュ厖',
- status: 'pending',
- applyTime: '2024-12-02 08:30:00',
- approver: '',
- approveTime: '',
- approveComment: '',
- issueTime: '',
- issuer: ''
- },
- {
- id: 6,
- applyNo: 'WS20241202002',
- applicant: '瀛欐槑鍗�',
- department: '鎶�鏈儴',
- supplyType: '鐢靛瓙璁惧',
- itemName: '閿洏',
- quantity: 3,
- reason: '鏂板憳宸ヨ澶囬厤澶�',
- status: 'approved',
- applyTime: '2024-12-02 14:20:00',
- approver: '闄堝織寮�',
- approveTime: '2024-12-02 16:00:00',
- approveComment: '鍚屾剰鐢宠',
- issueTime: '',
- issuer: ''
- },
- {
- id: 7,
- applyNo: 'WS20241203001',
- applicant: '鍛ㄧ編鐜�',
- department: '浜轰簨閮�',
- supplyType: '娓呮磥鐢ㄥ搧',
- itemName: '绾稿肪',
- quantity: 30,
- reason: '鍔炲叕鍖哄煙娓呮磥鐢ㄥ搧琛ュ厖',
- status: 'issued',
- applyTime: '2024-12-03 09:15:00',
- approver: '璧典附鍗�',
- approveTime: '2024-12-03 10:30:00',
- approveComment: '鍚屾剰鐢宠',
- issueTime: '2024-12-03 11:00:00',
- issuer: '瀛欐槑鍗�'
- },
- {
- id: 8,
- applyNo: 'WS20241203002',
- applicant: '鍚村織寮�',
- department: '璐㈠姟閮�',
- supplyType: '鍏朵粬',
- itemName: '璁$畻鍣�',
- quantity: 2,
- reason: '璐㈠姟鏍哥畻宸ヤ綔闇�瑕�',
- status: 'rejected',
- applyTime: '2024-12-03 15:45:00',
- approver: '鐜嬪缓鍥�',
- approveTime: '2024-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
- )
+ listPage(queryParams).then(res => {
+ total.value = res.data.total
loading.value = false
- }, 500)
+ officeList.value = res.data.records
+ })
}
// 鏌ヨ
const handleQuery = () => {
- queryParams.pageNum = 1
+ queryParams.current = 1
getList()
}
// 閲嶇疆鏌ヨ
const resetQuery = () => {
- queryParams.applyNo = ''
+ queryParams.code = ''
queryParams.applicant = ''
queryParams.status = ''
handleQuery()
@@ -492,10 +347,10 @@
// 鑾峰彇鐘舵�佺被鍨�
const getStatusType = (status) => {
const statusMap = {
- pending: 'warning',
- approved: 'success',
- rejected: 'danger',
- issued: 'info'
+ 1: 'warning',
+ 3: 'success',
+ 2: 'danger',
+ 4: 'info'
}
return statusMap[status] || 'info'
}
@@ -503,46 +358,38 @@
// 鑾峰彇鐘舵�佹枃鏈�
const getStatusText = (status) => {
const statusMap = {
- pending: '寰呭鎵�',
- approved: '宸查�氳繃',
- rejected: '宸叉嫆缁�',
- issued: '宸插彂鏀�'
+ 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: ''
- }
+ add(applyForm).then(() => {
+ ElMessage.success('鐢宠鎴愬姛')
+ getList()
+ showApplyDialog.value = false
+ resetApplyForm()
+ })
+
- mockData.unshift(newApply)
- showApplyDialog.value = false
- ElMessage.success('鐢宠鎻愪氦鎴愬姛')
- getList()
-
+
+}
+
+//閲嶇疆琛ㄥ崟
+const resetApplyForm = () => {
// 閲嶇疆琛ㄥ崟
Object.assign(applyForm, {
- supplyType: '',
+ applicant: '',
+ dept: '',
+ materialType: '',
itemName: '',
- quantity: 1,
+ applyNum: 1,
reason: '',
- urgency: 'normal'
+ urgency: '1'
})
}
@@ -552,38 +399,50 @@
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 = () => {
- 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: ''
+ 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) => {
- 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()
+ row.status = 4
+ row.issueTime = formatDate(new Date())
+ row.issueUser = Cookies.get('username')
+ update(row).then((res) =>{
+ if(res.code === 200){
+ ElMessage.success('鍙戞斁瀹屾垚')
+ getList()
+ }
+ })
}
// 鏌ョ湅璇︽儏
@@ -599,44 +458,27 @@
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 = '鎵归噺瀹℃壒閫氳繃'
- }
+ let ids = [row.id]
+ deleteOff(ids).then((res) =>{
+ ElMessage.success('鍒犻櫎鎴愬姛')
+ getList()
})
- ElMessage.success('鎵归噺瀹℃壒瀹屾垚')
- getList()
})
}
-
+const { proxy } = getCurrentInstance();
// 瀵煎嚭
const handleExport = () => {
- ElMessage.success('瀵煎嚭鍔熻兘寮�鍙戜腑...')
+ ElMessageBox.confirm("鎵�鏈夌殑鍐呭灏嗚瀵煎嚭锛屾槸鍚︾‘璁ゅ鍑猴紵", "瀵煎嚭", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ proxy.download("/officeSupplies/export", {}, "鍔炲叕鐗╄祫.xlsx");
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
+ });
}
// 椤甸潰鍔犺浇鏃惰幏鍙栨暟鎹�
--
Gitblit v1.9.3