电子请购单优化 库存明细页面

This commit is contained in:
jhd
2026-07-01 09:11:15 +08:00
parent 272b29e54a
commit ad650b9a57
6 changed files with 434 additions and 21 deletions

View File

@@ -59,11 +59,15 @@
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="180">
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="160">
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-view" @click="handleView(scope.row)" v-hasPermi="['erp:purchaseRequisition:query']">查看</el-button>
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['erp:purchaseRequisition:edit']">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['erp:purchaseRequisition:remove']">删除</el-button>
<div style="display:flex;flex-wrap:wrap;">
<el-button size="mini" type="text" icon="el-icon-view" @click="handleView(scope.row)" v-hasPermi="['erp:purchaseRequisition:query']" style="width:50%;margin:0;text-align:center">查看</el-button>
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-if="scope.row.formStatus === '0'" v-hasPermi="['erp:purchaseRequisition:edit']" style="width:50%;margin:0;text-align:center">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" v-if="scope.row.formStatus === '0'" v-hasPermi="['erp:purchaseRequisition:remove']" style="width:50%;margin:0;text-align:center">删除</el-button>
<el-button size="mini" type="text" icon="el-icon-upload2" @click="handleSubmitOne(scope.row)" v-if="scope.row.formStatus === '0'" v-hasPermi="['erp:purchaseRequisition:approve']" style="width:50%;margin:0;text-align:center">提交</el-button>
<el-button size="mini" type="text" icon="el-icon-circle-check" style="color:#67c23a;width:50%;margin:0;text-align:center" @click="openApproval(scope.row)" v-if="scope.row.formStatus === '1'" v-hasPermi="['erp:purchaseRequisition:approve']">审批</el-button>
</div>
</template>
</el-table-column>
</KLPTable>
@@ -355,10 +359,42 @@
</div>
</div>
<div slot="footer" class="dialog-footer">
<el-button icon="el-icon-circle-check" style="color:#67c23a;float:left" @click="openApproval(viewForm)" v-if="viewForm.formStatus === '1'" v-hasPermi="['erp:purchaseRequisition:approve']">审批</el-button>
<el-button type="primary" icon="el-icon-download" :loading="printing" @click="exportPdf">导出PDF</el-button>
</div>
</el-dialog>
<!-- 审批弹窗 -->
<el-dialog title="审批请购单" :visible.sync="approvalOpen" width="560px" append-to-body :close-on-click-modal="false">
<div style="padding:0 8px">
<el-form size="small" label-width="90px">
<el-row :gutter="16">
<el-col :span="12">
<el-form-item label="请购部门">{{ approvalReq.reqDept || '—' }}</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="品名">{{ approvalReq.itemName || '—' }}</el-form-item>
</el-col>
</el-row>
<el-row :gutter="16">
<el-col :span="12">
<el-form-item label="规格">{{ approvalReq.specification || '—' }}</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="请购量">{{ approvalReq.quantity || '—' }}</el-form-item>
</el-col>
</el-row>
<el-form-item label="审批意见">
<el-input v-model="approvalRemark" type="textarea" :rows="3" placeholder="请输入审批意见(可选)" />
</el-form-item>
</el-form>
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="doReject" type="danger" icon="el-icon-close" :loading="approvalLoading"> </el-button>
<el-button @click="doApprove" type="primary" icon="el-icon-check" :loading="approvalLoading"> </el-button>
</div>
</el-dialog>
<!-- A4 打印模板屏幕外渲染 html2canvas 截图 -->
<div class="pr-print-wrap" v-show="printing">
<div class="pr-print" ref="printTemplate">
@@ -515,7 +551,10 @@ import {
getPurchaseRequisition,
addPurchaseRequisition,
updatePurchaseRequisition,
delPurchaseRequisition
delPurchaseRequisition,
submitApproval,
approvePurchase,
rejectPurchase
} from '@/api/erp/purchaseRequisition'
export default {
@@ -545,6 +584,11 @@ export default {
viewForm: {},
inspectionChecks: [],
printData: {},
// 审批
approvalOpen: false,
approvalReq: {},
approvalRemark: '',
approvalLoading: false,
rules: {}
}
},
@@ -630,6 +674,39 @@ export default {
this.viewForm = res.data || {}
})
},
// 提交审批(单个操作列)
handleSubmitOne(row) {
this.$modal.confirm('确认提交该请购单进行审批?').then(() => {
return submitApproval(row.reqId)
}).then(() => {
this.$modal.msgSuccess('已提交审批')
this.getList()
}).catch(() => {})
},
// 打开审批弹窗
openApproval(row) {
this.approvalReq = { ...row }
this.approvalRemark = ''
this.approvalOpen = true
},
// 审批通过
doApprove() {
this.approvalLoading = true
approvePurchase(this.approvalReq.reqId).then(() => {
this.$modal.msgSuccess('审批通过')
this.approvalOpen = false
this.getList()
}).finally(() => { this.approvalLoading = false })
},
// 驳回
doReject() {
this.approvalLoading = true
rejectPurchase(this.approvalReq.reqId).then(() => {
this.$modal.msgSuccess('已驳回')
this.approvalOpen = false
this.getList()
}).finally(() => { this.approvalLoading = false })
},
cancel() {
this.open = false
},