推送项目重构代码
This commit is contained in:
@@ -54,9 +54,15 @@
|
||||
<el-select v-model="batchStatus" size="mini" placeholder="批量设置状态" style="width:140px">
|
||||
<el-option v-for="s in statusOptions" :key="s.value" :value="s.value" :label="s.label" />
|
||||
</el-select>
|
||||
<el-button size="mini" type="success" @click="submitComplete">执行入库</el-button>
|
||||
<el-button size="mini" type="success" @click="submitComplete(props.row)">执行入库</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 收货单上传:仅入库批量场景需要 -->
|
||||
<div v-if="mode === 'batch' && props.row.status === 0" class="receipt-row">
|
||||
<span class="r-label"><i class="el-icon-paperclip"></i> 收货单:</span>
|
||||
<file-upload v-model="props.row.receiptDoc" />
|
||||
<span class="r-hint">提交时会一并保存到本单据</span>
|
||||
</div>
|
||||
<el-table v-loading="itemsLoading[props.row.masterId]"
|
||||
:data="itemsMap[props.row.masterId] || []" size="mini" stripe ref="warehouseTable">
|
||||
<el-table-column v-if="mode === 'batch' && props.row.status === 0"
|
||||
@@ -161,6 +167,7 @@
|
||||
|
||||
<script>
|
||||
import { listRequirements } from "@/api/oa/requirement";
|
||||
import FileUpload from "@/components/FileUpload";
|
||||
import AddPurchaseDialog from "./components/AddPurchaseDialog.vue";
|
||||
import {
|
||||
addOaWarehouseMaster,
|
||||
@@ -179,7 +186,7 @@ import {
|
||||
|
||||
export default {
|
||||
name: "OaOutWarehouse",
|
||||
components: { AddPurchaseDialog },
|
||||
components: { AddPurchaseDialog, FileUpload },
|
||||
data () {
|
||||
return {
|
||||
// 顶部状态筛选
|
||||
@@ -365,7 +372,7 @@ export default {
|
||||
this.warehouseTaskList.splice(index, 1)
|
||||
this.$message.success('删除成功')
|
||||
},
|
||||
submitComplete () {
|
||||
submitComplete (masterRow) {
|
||||
const rows = this.$refs.warehouseTable.selection || []
|
||||
if (!rows.length) {
|
||||
return this.$message.warning('请先勾选物料')
|
||||
@@ -374,17 +381,22 @@ export default {
|
||||
return this.$message.warning('请选择批量状态')
|
||||
}
|
||||
|
||||
// 前端直接设值(实际项目可调用接口)
|
||||
rows.forEach(r => { r.taskStatus = this.batchStatus })
|
||||
|
||||
// 批量入库采购单
|
||||
updateOaWarehouseTaskBatch(rows).then(res => {
|
||||
this.getList();
|
||||
this.drawer = false;
|
||||
// 1. 如果有收货单 → 先保存到 master
|
||||
const saveMaster = (masterRow && masterRow.receiptDoc)
|
||||
? updateOaWarehouseMaster({
|
||||
masterId: masterRow.masterId,
|
||||
receiptDoc: masterRow.receiptDoc,
|
||||
type: masterRow.type
|
||||
})
|
||||
: Promise.resolve()
|
||||
|
||||
saveMaster.then(() => updateOaWarehouseTaskBatch(rows)).then(() => {
|
||||
this.getList()
|
||||
this.drawer = false
|
||||
this.$message.success(`已批量入库 ${rows.length} 条`)
|
||||
|
||||
})
|
||||
|
||||
},
|
||||
/** 执行入库操作 */
|
||||
handleIn (row) {
|
||||
@@ -671,4 +683,20 @@ export default {
|
||||
border-radius: 4px;
|
||||
i { font-size: 11px; margin-right: 2px; }
|
||||
}
|
||||
.receipt-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 6px 0;
|
||||
margin-bottom: 6px;
|
||||
border-bottom: 1px dashed #ebeef5;
|
||||
.r-label {
|
||||
color: #606266;
|
||||
font-size: 12px;
|
||||
flex-shrink: 0;
|
||||
i { margin-right: 2px; color: #909399; }
|
||||
}
|
||||
.r-hint { color: #909399; font-size: 11px; }
|
||||
::v-deep .el-upload-list { font-size: 12px; }
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user