Revert "fix: 仓库/业务类型下拉改用 api 模式加载,selectedStorId 追踪修复"
This reverts commit e018ad54cc.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<script lang="ts" setup>
|
||||
import { ref, watch } from 'vue';
|
||||
import { computed, ref, watch } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
|
||||
@@ -10,6 +10,7 @@ import { useVbenForm } from '#/adapter/form';
|
||||
import { VxeColumn, VxeTable } from '#/adapter/vxe-table';
|
||||
import {
|
||||
type OutboundCreateReq,
|
||||
type OutboundDetail,
|
||||
createIostorInvWithDetails,
|
||||
} from '#/api/wms/iostorinv';
|
||||
import { getBsrealStorAttrSimpleList } from '#/api/wms/bsrealstorattr';
|
||||
@@ -22,22 +23,22 @@ import ManualDetailModalComponent from './manual-detail.vue';
|
||||
const emit = defineEmits(['success']);
|
||||
|
||||
// ========== 仓库选项 ==========
|
||||
const warehouseMap = ref<Record<string, any>>({});
|
||||
async function loadWarehouseOptions() {
|
||||
const storOptions = ref<any[]>([]);
|
||||
async function loadStorOptions() {
|
||||
const list = await getBsrealStorAttrSimpleList();
|
||||
const map: Record<string, any> = {};
|
||||
const result = (list || []).map((item: any) => {
|
||||
map[item.storId] = item;
|
||||
return { ...item };
|
||||
});
|
||||
warehouseMap.value = map;
|
||||
return result;
|
||||
storOptions.value = (list || []).map((item: any) => ({
|
||||
label: item.storName,
|
||||
value: item.storId,
|
||||
storCode: item.storCode,
|
||||
storName: item.storName,
|
||||
}));
|
||||
}
|
||||
|
||||
// ========== 业务类型选项 ==========
|
||||
const billTypeOptions = ref<any[]>([]);
|
||||
async function loadBillTypeOptions() {
|
||||
const list = await getSimpleDictDataList();
|
||||
return (list || [])
|
||||
billTypeOptions.value = (list || [])
|
||||
.filter((d: any) => d.dictType === 'out_bill_type')
|
||||
.map((d: any) => ({ label: d.label, value: d.value }));
|
||||
}
|
||||
@@ -57,11 +58,9 @@ const [Form, formApi] = useVbenForm({
|
||||
rules: 'required',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
api: loadWarehouseOptions,
|
||||
labelField: 'storName',
|
||||
valueField: 'storId',
|
||||
options: storOptions,
|
||||
placeholder: '请选择仓库',
|
||||
allowClear: true,
|
||||
fieldNames: { label: 'label', value: 'value' },
|
||||
onChange: (val: string) => {
|
||||
selectedStorId.value = val || '';
|
||||
},
|
||||
@@ -73,11 +72,8 @@ const [Form, formApi] = useVbenForm({
|
||||
rules: 'required',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
api: loadBillTypeOptions,
|
||||
labelField: 'label',
|
||||
valueField: 'value',
|
||||
options: billTypeOptions,
|
||||
placeholder: '请选择业务类型',
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -222,12 +218,12 @@ const [Modal, modalApi] = useVbenModal({
|
||||
}
|
||||
modalApi.lock();
|
||||
try {
|
||||
const wh = warehouseMap.value[masterValues.storId];
|
||||
const stor = storOptions.value.find((s) => s.value === masterValues.storId);
|
||||
const req: OutboundCreateReq = {
|
||||
billType: masterValues.billType,
|
||||
storId: masterValues.storId,
|
||||
storCode: wh?.storCode,
|
||||
storName: wh?.storName,
|
||||
storCode: stor?.storCode,
|
||||
storName: stor?.storName,
|
||||
bizDate: masterValues.bizDate,
|
||||
remark: masterValues.remark,
|
||||
details: detailList.value.map((d: any) => ({
|
||||
@@ -255,6 +251,8 @@ const [Modal, modalApi] = useVbenModal({
|
||||
},
|
||||
async onOpenChange(isOpen: boolean) {
|
||||
if (isOpen) {
|
||||
await loadStorOptions();
|
||||
await loadBillTypeOptions();
|
||||
formApi.setValues({ bizDate: dayjs().format('YYYY-MM-DD HH:mm:ss') });
|
||||
}
|
||||
if (!isOpen) {
|
||||
|
||||
Reference in New Issue
Block a user