| | |
| | | <template #header> |
| | | <div class="card-header"> |
| | | <span>办公物资申请管理</span> |
| | | <el-button type="primary" @click="openShow()"> |
| | | <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="code"> |
| | | <el-input |
| | | v-model="queryParams.code" |
| | | <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" |
| | | /> |
| | | @keyup.enter="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item label="申请人" prop="applicant"> |
| | | <el-input |
| | | v-model="queryParams.applicant" |
| | | <el-form-item label="申请人" |
| | | prop="applicant"> |
| | | <el-input v-model="queryParams.applicant" |
| | | placeholder="请输入申请人" |
| | | clearable |
| | | style="width: 200px" |
| | | @keyup.enter="handleQuery" |
| | | /> |
| | | @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-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 type="primary" |
| | | @click="handleQuery"> |
| | | <el-icon> |
| | | <Search /> |
| | | </el-icon> |
| | | 搜索 |
| | | </el-button> |
| | | <el-button @click="resetQuery"> |
| | | <el-icon><Refresh /></el-icon> |
| | | <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 type="primary" |
| | | @click="handleExport"> |
| | | <el-icon> |
| | | <Download /> |
| | | </el-icon> |
| | | 导出 |
| | | </el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | |
| | | <!-- 表格区域 --> |
| | | <el-table |
| | | v-loading="loading" |
| | | <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"> |
| | | 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> |
| | | <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"> |
| | | <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"> |
| | | <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" |
| | | <el-button v-if="scope.row.status === 1" |
| | | type="primary" |
| | | link |
| | | @click="handleApprove(scope.row)" |
| | | > |
| | | @click="handleApprove(scope.row)"> |
| | | 审批 |
| | | </el-button> |
| | | <el-button |
| | | v-if="scope.row.status === 3" |
| | | <el-button v-if="scope.row.status === 3" |
| | | type="success" |
| | | link |
| | | @click="handleIssue(scope.row)" |
| | | > |
| | | @click="handleIssue(scope.row)"> |
| | | 发放 |
| | | </el-button> |
| | | <el-button |
| | | type="info" |
| | | <el-button type="info" |
| | | link |
| | | @click="handleDetail(scope.row)" |
| | | > |
| | | @click="handleDetail(scope.row)"> |
| | | 详情 |
| | | </el-button> |
| | | <el-button |
| | | v-if="scope.row.status === 2" |
| | | <el-button v-if="scope.row.status === 2" |
| | | type="danger" |
| | | link |
| | | @click="handleDelete(scope.row)" |
| | | > |
| | | @click="handleDelete(scope.row)"> |
| | | 删除 |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <!-- 分页 --> |
| | | <pagination |
| | | v-show="total > 0" |
| | | <pagination v-show="total > 0" |
| | | :total="total" |
| | | v-model:page="queryParams.current" |
| | | v-model:limit="queryParams.size" |
| | | @pagination="getList" |
| | | /> |
| | | @pagination="getList" /> |
| | | </el-card> |
| | | |
| | | <!-- 申请对话框 --> |
| | | <el-dialog |
| | | v-model="showApplyDialog" |
| | | <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="请输入申请人名称" /> |
| | | 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 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-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="applyNum"> |
| | | <el-input-number v-model="applyForm.applyNum" :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" |
| | | <el-form-item label="申请原因" |
| | | prop="reason"> |
| | | <el-input v-model="applyForm.reason" |
| | | type="textarea" |
| | | :rows="3" |
| | | placeholder="请输入申请原因" |
| | | /> |
| | | 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="1">普通</el-radio> |
| | | <el-radio label="2">紧急</el-radio> |
| | |
| | | </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" |
| | | <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"> |
| | | 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" |
| | | <el-form-item label="审批意见" |
| | | prop="approvalOpinions"> |
| | | <el-input v-model="approveForm.approvalOpinions" |
| | | type="textarea" |
| | | :rows="3" |
| | | placeholder="请输入审批意见" |
| | | /> |
| | | 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" |
| | | <el-dialog v-model="showDetailDialog" |
| | | title="申请详情" |
| | | width="700px" |
| | | append-to-body |
| | | > |
| | | <el-descriptions :column="2" border> |
| | | 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="申请原因" |
| | | :span="2">{{ currentDetail.reason }}</el-descriptions-item> |
| | | <el-descriptions-item label="申请状态"> |
| | | <el-tag :type="getStatusType(currentDetail.status)"> |
| | | {{ getStatusText(currentDetail.status) }} |
| | |
| | | <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="审批意见" |
| | | :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> |
| | |
| | | </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' |
| | | 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 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: '' |
| | | }) |
| | | code: "", |
| | | applicant: "", |
| | | status: "", |
| | | }); |
| | | |
| | | // 申请表单 |
| | | const applyForm = reactive({ |
| | | applicant: '', |
| | | dept: '', |
| | | materialType: '', |
| | | itemName: '', |
| | | applicant: "", |
| | | dept: "", |
| | | materialType: "", |
| | | itemName: "", |
| | | applyNum: 1, |
| | | reason: '', |
| | | urgency: '1' |
| | | }) |
| | | reason: "", |
| | | urgency: "1", |
| | | }); |
| | | |
| | | // 审批表单 |
| | | const approveForm = reactive({ |
| | | approveResult: '3', |
| | | approvalOpinions: '' |
| | | }) |
| | | 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' }] |
| | | } |
| | | 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' }] |
| | | } |
| | | approveResult: [ |
| | | { required: true, message: "请选择审批结果", trigger: "change" }, |
| | | ], |
| | | approvalOpinions: [ |
| | | { required: true, message: "请输入审批意见", trigger: "blur" }, |
| | | ], |
| | | }; |
| | | |
| | | const openShow = () => { |
| | | showApplyDialog.value = true |
| | | resetApplyForm() |
| | | } |
| | | showApplyDialog.value = true; |
| | | resetApplyForm(); |
| | | }; |
| | | |
| | | // 获取列表数据 |
| | | const getList = () => { |
| | | loading.value = true |
| | | loading.value = true; |
| | | listPage(queryParams).then(res => { |
| | | total.value = res.data.total |
| | | loading.value = false |
| | | officeList.value = res.data.records |
| | | }) |
| | | } |
| | | total.value = res.data.total; |
| | | loading.value = false; |
| | | officeList.value = res.data.records; |
| | | }); |
| | | }; |
| | | |
| | | // 查询 |
| | | const handleQuery = () => { |
| | | queryParams.current = 1 |
| | | getList() |
| | | } |
| | | queryParams.current = 1; |
| | | getList(); |
| | | }; |
| | | |
| | | // 重置查询 |
| | | const resetQuery = () => { |
| | | queryParams.code = '' |
| | | queryParams.applicant = '' |
| | | queryParams.status = '' |
| | | handleQuery() |
| | | } |
| | | queryParams.code = ""; |
| | | queryParams.applicant = ""; |
| | | queryParams.status = ""; |
| | | handleQuery(); |
| | | }; |
| | | |
| | | // 多选 |
| | | const handleSelectionChange = (selection) => { |
| | | multipleSelection.value = selection |
| | | } |
| | | const handleSelectionChange = selection => { |
| | | multipleSelection.value = selection; |
| | | }; |
| | | |
| | | // 获取状态类型 |
| | | const getStatusType = (status) => { |
| | | const getStatusType = status => { |
| | | const statusMap = { |
| | | 1: 'warning', |
| | | 3: 'success', |
| | | 2: 'danger', |
| | | 4: 'info' |
| | | } |
| | | return statusMap[status] || 'info' |
| | | } |
| | | 1: "warning", |
| | | 3: "success", |
| | | 2: "danger", |
| | | 4: "info", |
| | | }; |
| | | return statusMap[status] || "info"; |
| | | }; |
| | | |
| | | // 获取状态文本 |
| | | const getStatusText = (status) => { |
| | | const getStatusText = status => { |
| | | const statusMap = { |
| | | 1: '待审批', |
| | | 3: '已通过', |
| | | 2: '已拒绝', |
| | | 4: '已发放' |
| | | } |
| | | return statusMap[status] || status |
| | | } |
| | | 1: "待审批", |
| | | 3: "已通过", |
| | | 2: "已拒绝", |
| | | 4: "已发放", |
| | | }; |
| | | return statusMap[status] || status; |
| | | }; |
| | | |
| | | // 提交申请 |
| | | const submitApply = () => { |
| | | add(applyForm).then(() => { |
| | | ElMessage.success('申请成功') |
| | | getList() |
| | | showApplyDialog.value = false |
| | | resetApplyForm() |
| | | }) |
| | | |
| | | |
| | | |
| | | } |
| | | ElMessage.success("申请成功"); |
| | | getList(); |
| | | showApplyDialog.value = false; |
| | | resetApplyForm(); |
| | | }); |
| | | }; |
| | | |
| | | //重置表单 |
| | | const resetApplyForm = () => { |
| | | // 重置表单 |
| | | Object.assign(applyForm, { |
| | | applicant: '', |
| | | dept: '', |
| | | materialType: '', |
| | | itemName: '', |
| | | applicant: "", |
| | | dept: "", |
| | | materialType: "", |
| | | itemName: "", |
| | | applyNum: 1, |
| | | reason: '', |
| | | urgency: '1' |
| | | }) |
| | | } |
| | | reason: "", |
| | | urgency: "1", |
| | | }); |
| | | }; |
| | | |
| | | // 审批 |
| | | const handleApprove = (row) => { |
| | | currentDetail.value = row |
| | | showApproveDialog.value = true |
| | | } |
| | | 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 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 |
| | | 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) => { |
| | | 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() |
| | | showApproveDialog.value = false; |
| | | ElMessage.success("审批完成"); |
| | | getList(); |
| | | |
| | | // 重置表单 |
| | | Object.assign(approveForm, { |
| | | approveResult: '3', |
| | | approvalOpinions: '' |
| | | }) |
| | | approveResult: "3", |
| | | approvalOpinions: "", |
| | | }); |
| | | } |
| | | }) |
| | | |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | // 发放 |
| | | const handleIssue = (row) => { |
| | | row.status = 4 |
| | | row.issueTime = formatDate(new Date()) |
| | | row.issueUser = Cookies.get('username') |
| | | update(row).then((res) =>{ |
| | | 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() |
| | | ElMessage.success("发放完成"); |
| | | getList(); |
| | | } |
| | | }) |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | // 查看详情 |
| | | const handleDetail = (row) => { |
| | | currentDetail.value = row |
| | | showDetailDialog.value = true |
| | | } |
| | | const handleDetail = row => { |
| | | currentDetail.value = row; |
| | | showDetailDialog.value = true; |
| | | }; |
| | | |
| | | // 删除 |
| | | const handleDelete = (row) => { |
| | | ElMessageBox.confirm('确认删除该申请吗?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | const handleDelete = row => { |
| | | ElMessageBox.confirm("确认删除该申请吗?", "提示", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | }).then(() => { |
| | | let ids = [row.id] |
| | | deleteOff(ids).then((res) =>{ |
| | | ElMessage.success('删除成功') |
| | | getList() |
| | | }) |
| | | }) |
| | | } |
| | | let ids = [row.id]; |
| | | deleteOff(ids).then(res => { |
| | | ElMessage.success("删除成功"); |
| | | getList(); |
| | | }); |
| | | }); |
| | | }; |
| | | const { proxy } = getCurrentInstance(); |
| | | // 导出 |
| | | const handleExport = () => { |
| | |
| | | .catch(() => { |
| | | proxy.$modal.msg("已取消"); |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | // 页面加载时获取数据 |
| | | onMounted(() => { |
| | | getList() |
| | | }) |
| | | getList(); |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped> |