This commit is contained in:
weiwei committed 2025-04-14 14:34:59 +08:00
1 parent 7cc571d09d
commit e55047bef2
1 file changed
+51 -45
@@ -1,7 +1,39 @@
<template>
<div v-loading="loading" :element-loading-svg="svg" element-loading-svg-view-box="-10, -10, 50, 50" class="w-full h-full">
<div v-if="baseDataForm.inventoryCode" class="layout-padding-auto layout-padding-view" style="overflow: scroll">
<el-form v-if="!disabled" ref="baseDataFormRef" :model="baseDataForm" :rules="dataRules" label-width="100px">
<div v-if="disabled" ref="baseDataInfoRef">
<div style="margin-bottom: 8px; padding: 8px 16px; color: #606279">
<div style="display: inline-block; width: 100%">
<div style="float: left; width: 33.33%; height: 28px; line-height: 28px">
<span class="font-bold">单据编号:</span>
<span>{{ baseDataForm.inventoryCode }}</span>
</div>
<div style="float: left; width: 33.33%; height: 28px; line-height: 28px">
<span class="font-bold">单据日期:</span>
<span>{{ baseDataForm.inventoryDate }}</span>
</div>
<div style="float: left; width: 33.33%; height: 28px; line-height: 28px">
<span class="font-bold">经办人:</span>
<span>{{ baseDataForm.handlerUserId }}</span>
</div>
</div>
<div style="display: inline-block; width: 100%">
<div style="float: left; width: 33.33%; height: 28px; line-height: 28px">
<span class="font-bold">关联补货申请:</span>
<span>{{ baseDataForm.linkCode }}</span>
</div>
<div style="float: left; width: 33.33%; height: 28px; line-height: 28px">
<span class="font-bold">货商:</span>
<span>{{ baseDataForm.supplierId }}</span>
</div>
<div style="float: left; width: 33.33%; height: 28px; line-height: 28px">
<span class="font-bold">备注:</span>
<span>{{ baseDataForm.remark }}</span>
</div>
</div>
</div>
</div>
<el-form v-else ref="baseDataFormRef" :model="baseDataForm" :rules="dataRules" label-width="100px">
<div class="flex flex-wrap">
<el-form-item label="单据编号" prop="inventoryCode">
<el-input v-model.trim="baseDataForm.inventoryCode" readonly style="width: 200px" :disabled="disabled" />
@@ -36,41 +68,9 @@
</el-form-item>
</div>
</el-form>
<div v-else ref="baseDataInfoRef">
<div style="margin-bottom: 8px; padding: 8px 16px; color: #606279">
<div style="display: inline-block; width: 100%">
<div style="float: left; width: 33.33%; height: 28px; line-height: 28px">
<span class="font-bold">单据编号:</span>
<span>{{ baseDataForm.inventoryCode }}</span>
</div>
<div style="float: left; width: 33.33%; height: 28px; line-height: 28px">
<span class="font-bold">单据日期:</span>
<span>{{ baseDataForm.inventoryDate }}</span>
</div>
<div style="float: left; width: 33.33%; height: 28px; line-height: 28px">
<span class="font-bold">经办人:</span>
<span>{{ baseDataForm.handlerUserId }}</span>
</div>
</div>
<div style="display: inline-block; width: 100%">
<div style="float: left; width: 33.33%; height: 28px; line-height: 28px">
<span class="font-bold">关联补货申请:</span>
<span>{{ baseDataForm.linkCode }}</span>
</div>
<div style="float: left; width: 33.33%; height: 28px; line-height: 28px">
<span class="font-bold">货商:</span>
<span>{{ baseDataForm.supplierId }}</span>
</div>
<div style="float: left; width: 33.33%; height: 28px; line-height: 28px">
<span class="font-bold">备注:</span>
<span>{{ baseDataForm.remark }}</span>
</div>
</div>
</div>
</div>
<el-row v-if="!disabled" class="my-3">
<el-button @click="addEvent">新增(顶部)</el-button>
<!-- <el-button @click="addEvent">新增(顶部)</el-button>
<el-button @click="pushEvent">新增(尾部)</el-button>
<el-button @click="insertEvent">
在第
@@ -85,10 +85,10 @@
style="min-width: 50px; margin: 0 5px"
/>
行新增
</el-button>
</el-button> -->
<el-button type="primary" plain @click="handleClickSpuSelect">商品选择</el-button>
<el-button @click="removeSelectRowEvent" :disabled="state.selectedRowsErpSpuIds.length <= 0">删除选中</el-button>
<el-button @click="clearData">清空数据</el-button>
<el-button @click="handleClickSpuSelect">商品选择</el-button>
<el-button type="danger" plain @click="clearData">清空数据</el-button>
</el-row>
<vxe-table
@@ -137,7 +137,7 @@
:label="item.unit"
:value="item.id"
/>
<el-option v-else :key="row.id" :label="row.unit" :value="row.id" />
<el-option v-else :key="row.id" :label="row.unit" :value="row.unitId" />
</el-select>
</template>
<template #default="{ row }">
@@ -192,7 +192,7 @@
</el-row>
<!-- 商品选择对话框 -->
<erpSpuSelectDialog
<select-dialog
ref="erpSpuSelectDialogRef"
v-model="state.erpSpuSelectDialogVisible"
:selectedSpuRows="state.editableTableData"
@@ -218,11 +218,12 @@ import { getPlanCode, getErpSpuSimpleAll, getCgddPage } from "/@/api/supermarket
import { VxeTableEvents, VxeTablePropTypes, type VxeTableInstance } from "vxe-table"
import { formatDate } from "/@/utils/formatTime"
import { Search } from "@element-plus/icons-vue"
import erpSpuSelectDialog from "/@/views/supermarketerp/components/erpSpuSelectDialog.vue"
import linkCodeDialog from "/@/views/supermarketerp/components/linkCodeDialog.vue"
import { displayPrice } from "/@/utils/formatMoney"
import { tablePrint } from "../../supermarketUtils"
const SelectDialog = defineAsyncComponent(() => import("/@/views/supermarketerp/components/erpSpuSelectDialog.vue"))
const props = withDefaults(
defineProps<{
formId: string | undefined
@@ -307,7 +308,7 @@ const getInitData = async () => {
disabled.value = props.disabled
if (id) {
loading.value = true
// 获取采购计划数据 & 获取简要商品列表
// 获取清单数据
const [cgPlanData] = await Promise.allSettled([getObj(id)])
.then((results) => results.map((result) => (result.status === "fulfilled" ? result.value : null)))
.finally(() => (loading.value = false))
@@ -317,16 +318,21 @@ const getInitData = async () => {
state.editableTableData = cgPlanData.data.items
state.erpSpuItemsMemo = cgPlanData.data.items
}
return
} else {
loading.value = true
// 获取采购入库编号
const [planCode] = await Promise.allSettled([getPlanCode({ type: 3 })])
.then((results) => results.map((result) => (result.status === "fulfilled" ? result.value : null)))
.finally(() => (loading.value = false))
planCode && planCode.code === 0 && (baseDataForm.inventoryCode = planCode.data)
}
loading.value = true
// 获取采购入库编号
const [erpSpuSimpleAll, planCode] = await Promise.allSettled([getErpSpuSimpleAll(), getPlanCode({ type: 3 })])
// 获取简要商品列表
const [erpSpuSimpleAll] = await Promise.allSettled([getErpSpuSimpleAll()])
.then((results) => results.map((result) => (result.status === "fulfilled" ? result.value : null)))
.finally(() => (loading.value = false))
erpSpuSimpleAll && erpSpuSimpleAll.code === 0 && (state.erpSpuSimpleAll = erpSpuSimpleAll.data)
planCode && planCode.code === 0 && (baseDataForm.inventoryCode = planCode.data)
}
// 点击关联采购申请编号