| | |
| | | <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> |
| | |
| | | |
| | | <!-- 搜索区域 --> |
| | | <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" |
| | |
| | | </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> |
| | |
| | | <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"> |
| | |
| | | </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)" |
| | |
| | | 审批 |
| | | </el-button> |
| | | <el-button |
| | | v-if="scope.row.status === 'approved'" |
| | | v-if="scope.row.status === 3" |
| | | type="success" |
| | | link |
| | | @click="handleIssue(scope.row)" |
| | |
| | | 详情 |
| | | </el-button> |
| | | <el-button |
| | | v-if="scope.row.status === 'pending'" |
| | | v-if="scope.row.status === 2" |
| | | type="danger" |
| | | link |
| | | @click="handleDelete(scope.row)" |
| | |
| | | <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> |
| | |
| | | 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 |
| | |
| | | </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> |
| | |
| | | <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="请输入审批意见" |
| | |
| | | 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)"> |
| | |
| | | </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' |
| | | |
| | |
| | | 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() |
| | |
| | | // 获取状态类型 |
| | | 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' |
| | | } |
| | |
| | | // 获取状态文本 |
| | | 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' |
| | | }) |
| | | } |
| | | |
| | |
| | | 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 |
| | | // 从cookie中获取当前登录用户名称 |
| | | 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() |
| | | } |
| | | }) |
| | | } |
| | | |
| | | // 查看详情 |
| | |
| | | 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("已取消"); |
| | | }); |
| | | } |
| | | |
| | | // 页面加载时获取数据 |