Revert "fix: 修复前端报错 — VxeTable组件、MaterialSelectModal路径、dayjs类型"
This reverts commit ec05ee98d0.
This commit is contained in:
@@ -1,4 +1,6 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
import type { WmsIostorInvApi } from '#/api/wms/iostorinv';
|
||||||
|
|
||||||
import { computed, ref, watch } from 'vue';
|
import { computed, ref, watch } from 'vue';
|
||||||
|
|
||||||
import { useVbenModal } from '@vben/common-ui';
|
import { useVbenModal } from '@vben/common-ui';
|
||||||
@@ -7,7 +9,6 @@ import dayjs from 'dayjs';
|
|||||||
import { message } from 'antdv-next';
|
import { message } from 'antdv-next';
|
||||||
|
|
||||||
import { useVbenForm } from '#/adapter/form';
|
import { useVbenForm } from '#/adapter/form';
|
||||||
import { VxeColumn, VxeTable } from '#/adapter/vxe-table';
|
|
||||||
import {
|
import {
|
||||||
type OutboundCreateReq,
|
type OutboundCreateReq,
|
||||||
type OutboundDetail,
|
type OutboundDetail,
|
||||||
@@ -23,7 +24,9 @@ import ManualDetailModalComponent from './manual-detail.vue';
|
|||||||
const emit = defineEmits(['success']);
|
const emit = defineEmits(['success']);
|
||||||
|
|
||||||
// ========== 仓库选项 ==========
|
// ========== 仓库选项 ==========
|
||||||
const storOptions = ref<any[]>([]);
|
const storOptions = ref<
|
||||||
|
{ label: string; value: string; storCode: string; storName: string }[]
|
||||||
|
>([]);
|
||||||
async function loadStorOptions() {
|
async function loadStorOptions() {
|
||||||
const list = await getBsrealStorAttrSimpleList();
|
const list = await getBsrealStorAttrSimpleList();
|
||||||
storOptions.value = (list || []).map((item: any) => ({
|
storOptions.value = (list || []).map((item: any) => ({
|
||||||
@@ -35,7 +38,7 @@ async function loadStorOptions() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ========== 业务类型选项 ==========
|
// ========== 业务类型选项 ==========
|
||||||
const billTypeOptions = ref<any[]>([]);
|
const billTypeOptions = ref<{ label: string; value: string }[]>([]);
|
||||||
async function loadBillTypeOptions() {
|
async function loadBillTypeOptions() {
|
||||||
const list = await getSimpleDictDataList();
|
const list = await getSimpleDictDataList();
|
||||||
billTypeOptions.value = (list || [])
|
billTypeOptions.value = (list || [])
|
||||||
@@ -122,13 +125,16 @@ const [Form, formApi] = useVbenForm({
|
|||||||
});
|
});
|
||||||
|
|
||||||
// ========== 明细数据 ==========
|
// ========== 明细数据 ==========
|
||||||
const detailList = ref<any[]>([]);
|
type DetailRow = OutboundDetail & { vehicleCode?: string; materialName?: string };
|
||||||
|
const detailList = ref<DetailRow[]>([]);
|
||||||
|
|
||||||
function updateSummary() {
|
function updateSummary() {
|
||||||
const total = detailList.value.reduce((sum, d) => sum + (Number(d.planQty) || 0), 0);
|
const totalWeight = detailList.value
|
||||||
|
.reduce((sum, d) => sum + (Number(d.planQty) || 0), 0)
|
||||||
|
.toFixed(3);
|
||||||
formApi.setValues({
|
formApi.setValues({
|
||||||
detailCount: detailList.value.length,
|
detailCount: detailList.value.length,
|
||||||
totalWeight: total.toFixed(3),
|
totalWeight: String(totalWeight),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,13 +147,34 @@ watch(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// ========== 明细表格 ==========
|
||||||
|
const vxeGridRef = ref();
|
||||||
|
const gridOptions = computed(() => ({
|
||||||
|
columns: [
|
||||||
|
{ type: 'seq', title: '序号', width: 50 },
|
||||||
|
{ field: 'vehicleCode', title: '箱号', width: 100 },
|
||||||
|
{ field: 'materialCode', title: '物料编码', width: 120 },
|
||||||
|
{ field: 'materialName', title: '物料名称', width: 150 },
|
||||||
|
{ field: 'pcsn', title: '子卷号', width: 100 },
|
||||||
|
{ field: 'planQty', title: '出库重量', width: 100 },
|
||||||
|
{ field: 'qtyUnitName', title: '单位', width: 60 },
|
||||||
|
{ field: 'remark', title: '备注', width: 120 },
|
||||||
|
{ title: '操作', width: 80, slots: { default: 'actions' } },
|
||||||
|
],
|
||||||
|
data: detailList.value,
|
||||||
|
height: 'auto',
|
||||||
|
rowConfig: { keyField: 'materialCode', isHover: true },
|
||||||
|
toolbarConfig: false,
|
||||||
|
pagerConfig: false,
|
||||||
|
}));
|
||||||
|
|
||||||
function handleDeleteDetail(index: number) {
|
function handleDeleteDetail(index: number) {
|
||||||
detailList.value.splice(index, 1);
|
detailList.value.splice(index, 1);
|
||||||
updateSummary();
|
updateSummary();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ========== 库存选择弹窗 ==========
|
// ========== 库存选择弹窗(子组件自带 Modal,用 ref 调用 open) ==========
|
||||||
const inventorySelectRef = ref<any>();
|
const inventorySelectRef = ref<InstanceType<typeof InventorySelectModalComponent>>();
|
||||||
|
|
||||||
function handleSelectFromInventory() {
|
function handleSelectFromInventory() {
|
||||||
const storId = formApi.getValues().storId;
|
const storId = formApi.getValues().storId;
|
||||||
@@ -177,8 +204,8 @@ function onInventorySelected(rows: any[]) {
|
|||||||
updateSummary();
|
updateSummary();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ========== 手动新增弹窗 ==========
|
// ========== 手动新增弹窗(子组件自带 Modal,用 ref 调用 open) ==========
|
||||||
const manualDetailRef = ref<any>();
|
const manualDetailRef = ref<InstanceType<typeof ManualDetailModalComponent>>();
|
||||||
|
|
||||||
function handleManualAdd() {
|
function handleManualAdd() {
|
||||||
manualDetailRef.value?.open();
|
manualDetailRef.value?.open();
|
||||||
@@ -220,7 +247,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
storName: stor?.storName,
|
storName: stor?.storName,
|
||||||
bizDate: masterValues.bizDate,
|
bizDate: masterValues.bizDate,
|
||||||
remark: masterValues.remark,
|
remark: masterValues.remark,
|
||||||
details: detailList.value.map((d: any) => ({
|
details: detailList.value.map((d) => ({
|
||||||
materialCode: d.materialCode,
|
materialCode: d.materialCode,
|
||||||
materialId: d.materialId,
|
materialId: d.materialId,
|
||||||
pcsn: d.pcsn,
|
pcsn: d.pcsn,
|
||||||
@@ -247,7 +274,10 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
if (isOpen) {
|
if (isOpen) {
|
||||||
await loadStorOptions();
|
await loadStorOptions();
|
||||||
await loadBillTypeOptions();
|
await loadBillTypeOptions();
|
||||||
formApi.setValues({ bizDate: dayjs().format('YYYY-MM-DD HH:mm:ss') });
|
// 业务日期默认当天
|
||||||
|
formApi.setValues({
|
||||||
|
bizDate: dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
if (!isOpen) {
|
if (!isOpen) {
|
||||||
detailList.value = [];
|
detailList.value = [];
|
||||||
@@ -273,26 +303,17 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<VxeTable :data="detailList" show-overflow>
|
<vxe-grid ref="vxeGridRef" v-bind="gridOptions">
|
||||||
<VxeColumn type="seq" title="序号" width="50" align="center" />
|
<template #actions="{ rowIndex }">
|
||||||
<VxeColumn field="vehicleCode" title="箱号" width="100" />
|
<a-button type="link" danger @click="handleDeleteDetail(rowIndex)">
|
||||||
<VxeColumn field="materialCode" title="物料编码" width="120" />
|
删除
|
||||||
<VxeColumn field="materialName" title="物料名称" width="150" />
|
</a-button>
|
||||||
<VxeColumn field="pcsn" title="子卷号" width="100" />
|
</template>
|
||||||
<VxeColumn field="planQty" title="出库重量" width="100" />
|
</vxe-grid>
|
||||||
<VxeColumn field="qtyUnitName" title="单位" width="60" />
|
|
||||||
<VxeColumn field="remark" title="备注" min-width="120" />
|
|
||||||
<VxeColumn title="操作" width="80" align="center" fixed="right">
|
|
||||||
<template #default="{ rowIndex }">
|
|
||||||
<a-button type="link" danger size="small" @click="handleDeleteDetail(rowIndex)">
|
|
||||||
删除
|
|
||||||
</a-button>
|
|
||||||
</template>
|
|
||||||
</VxeColumn>
|
|
||||||
</VxeTable>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- 子弹窗:不通过 connectedComponent,而是通过 ref 调用 -->
|
||||||
<InventorySelectModalComponent
|
<InventorySelectModalComponent
|
||||||
ref="inventorySelectRef"
|
ref="inventorySelectRef"
|
||||||
@select="onInventorySelected"
|
@select="onInventorySelected"
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { useVbenModal } from '@vben/common-ui';
|
|||||||
|
|
||||||
import { useVbenForm } from '#/adapter/form';
|
import { useVbenForm } from '#/adapter/form';
|
||||||
|
|
||||||
import MaterialSelectModalComponent from '../../../base/materialbase/components/MaterialSelectModal.vue';
|
import MaterialSelectModalComponent from '../../base/materialbase/components/MaterialSelectModal.vue';
|
||||||
|
|
||||||
const emit = defineEmits(['confirm']);
|
const emit = defineEmits(['confirm']);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user