fix: 载具扩展

This commit is contained in:
2026-07-23 13:51:09 +08:00
parent 76ebd44f26
commit 69750540a3
5 changed files with 82 additions and 13 deletions

3
.gitignore vendored
View File

@@ -52,4 +52,5 @@ application-my.yaml
/nl-ui-app/unpackage/ /nl-ui-app/unpackage/
.DS_Store .DS_Store
**/.DS_Store **/.DS_Store
/.superpowers/

View File

@@ -23,6 +23,7 @@ async function loadMaterialTypeTree() {
const selectedRows = ref<any[]>([]); const selectedRows = ref<any[]>([]);
const isMultiple = ref(false); const isMultiple = ref(false);
const selectModalGridHeight = 600;
function handleRadioChange({ row }: { row: any }) { function handleRadioChange({ row }: { row: any }) {
selectedRows.value = row ? [row] : []; selectedRows.value = row ? [row] : [];
@@ -71,8 +72,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
}, },
gridOptions: { gridOptions: {
columns: [{ type: 'radio', width: 40 }, ...baseColumns], columns: [{ type: 'radio', width: 40 }, ...baseColumns],
height: 'auto', height: selectModalGridHeight,
maxHeight: '500px',
keepSource: true, keepSource: true,
proxyConfig: { proxyConfig: {
ajax: { ajax: {

View File

@@ -14,6 +14,7 @@ const emit = defineEmits(['select']);
const selectedRows = ref<any[]>([]); const selectedRows = ref<any[]>([]);
const isMultiple = ref(false); const isMultiple = ref(false);
const selectModalGridHeight = 600;
function handleRadioChange({ row }: { row: any }) { function handleRadioChange({ row }: { row: any }) {
selectedRows.value = row ? [row] : []; selectedRows.value = row ? [row] : [];
@@ -48,7 +49,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
}, },
gridOptions: { gridOptions: {
columns: [{ type: 'radio', width: 40 }, ...baseColumns], columns: [{ type: 'radio', width: 40 }, ...baseColumns],
height: 'auto', height: selectModalGridHeight,
keepSource: true, keepSource: true,
proxyConfig: { proxyConfig: {
ajax: { ajax: {

View File

@@ -45,8 +45,9 @@ export function useFormSchema(): VbenFormSchema[] {
rules: 'required', rules: 'required',
component: 'Select', component: 'Select',
componentProps: { componentProps: {
disabled: true,
options: getDictOptions(DICT_TYPE.WMS_VEHICLE_TYPE), options: getDictOptions(DICT_TYPE.WMS_VEHICLE_TYPE),
placeholder: '选择载具类型', placeholder: '选择载具后会自动回填',
}, },
}, },
{ {
@@ -87,6 +88,14 @@ export function useFormSchema(): VbenFormSchema[] {
placeholder: '请输入木箱号', placeholder: '请输入木箱号',
}, },
}, },
{
fieldName: 'qty',
label: '物料数量',
component: 'Input',
componentProps: {
placeholder: '请输入物料数量',
},
},
{ {
fieldName: 'qtyUnitId', fieldName: 'qtyUnitId',
label: '数量单位', label: '数量单位',
@@ -94,6 +103,10 @@ export function useFormSchema(): VbenFormSchema[] {
componentProps: { componentProps: {
placeholder: '请输入数量计量单位标识', placeholder: '请输入数量计量单位标识',
}, },
dependencies: {
triggerFields: [''],
show: () => false,
},
}, },
{ {
fieldName: 'qtyUnitName', fieldName: 'qtyUnitName',
@@ -103,14 +116,6 @@ export function useFormSchema(): VbenFormSchema[] {
placeholder: '请输入数量计量单位名称', placeholder: '请输入数量计量单位名称',
}, },
}, },
{
fieldName: 'qty',
label: '物料数量',
component: 'Input',
componentProps: {
placeholder: '请输入物料数量',
},
},
{ {
fieldName: 'vehicleWeight', fieldName: 'vehicleWeight',
label: '托盘重量', label: '托盘重量',
@@ -127,6 +132,10 @@ export function useFormSchema(): VbenFormSchema[] {
componentProps: { componentProps: {
placeholder: '请输入重量计量单位标识', placeholder: '请输入重量计量单位标识',
}, },
dependencies: {
triggerFields: [''],
show: () => false,
},
}, },
{ {
fieldName: 'weightUnitName', fieldName: 'weightUnitName',

View File

@@ -13,10 +13,12 @@ import { $t } from '#/locales';
import { useFormSchema } from '../data'; import { useFormSchema } from '../data';
import MaterialSelectModalComponent from '../../../base/materialbase/components/MaterialSelectModal.vue'; import MaterialSelectModalComponent from '../../../base/materialbase/components/MaterialSelectModal.vue';
import MeasureUnitSelectModalComponent from '../../../base/measureunit/components/MeasureUnitSelectModal.vue';
import StorageVehicleSelectModalComponent from '../../storagevehicleinfo/components/StorageVehicleSelectModal.vue'; import StorageVehicleSelectModalComponent from '../../storagevehicleinfo/components/StorageVehicleSelectModal.vue';
const emit = defineEmits(['success']); const emit = defineEmits(['success']);
const formData = ref<WmsStorageVehicleExtApi.StorageVehicleExt>(); const formData = ref<WmsStorageVehicleExtApi.StorageVehicleExt>();
const activeMeasureUnitField = ref<'qty' | 'weight'>('qty');
const getTitle = computed(() => { const getTitle = computed(() => {
return formData.value?.storageVehicleExtId return formData.value?.storageVehicleExtId
? $t('ui.actionTitle.edit', ['载具扩展属性信息']) ? $t('ui.actionTitle.edit', ['载具扩展属性信息'])
@@ -44,6 +46,37 @@ function handleMaterialSelect(rows: any[]) {
} }
} }
/** 璁¢噺鍗曚綅閫夋嫨寮圭獥 */
const [MeasureUnitSelectModal, measureUnitSelectModalApi] = useVbenModal({
connectedComponent: MeasureUnitSelectModalComponent,
});
function openMeasureUnitSelect(field: 'qty' | 'weight') {
activeMeasureUnitField.value = field;
measureUnitSelectModalApi.setData({ multiple: false }).open();
}
function handleMeasureUnitSelect(rows: any[]) {
if (rows.length > 0) {
const row = rows[0];
const currentValues = formApi.getValues();
const values =
activeMeasureUnitField.value === 'qty'
? {
qtyUnitId: row.measureUnitId,
qtyUnitName: row.unitName,
}
: {
weightUnitId: row.measureUnitId,
weightUnitName: row.unitName,
};
formApi.setValues({
...currentValues,
...values,
});
}
}
/** 载具信息选择弹窗 */ /** 载具信息选择弹窗 */
const [StorageVehicleSelectModal, storageVehicleSelectModalApi] = useVbenModal({ const [StorageVehicleSelectModal, storageVehicleSelectModalApi] = useVbenModal({
connectedComponent: StorageVehicleSelectModalComponent, connectedComponent: StorageVehicleSelectModalComponent,
@@ -88,6 +121,30 @@ const schema = useFormSchema().map((field) => {
}, },
}; };
} }
if (field.fieldName === 'qtyUnitName') {
return {
...field,
componentProps: {
...field.componentProps,
placeholder: '请选择数量单位',
readonly: true,
style: 'cursor: pointer',
onClick: () => openMeasureUnitSelect('qty'),
},
};
}
if (field.fieldName === 'weightUnitName') {
return {
...field,
componentProps: {
...field.componentProps,
placeholder: '请选择重量单位',
readonly: true,
style: 'cursor: pointer',
onClick: () => openMeasureUnitSelect('weight'),
},
};
}
return field; return field;
}); });
@@ -149,6 +206,7 @@ const [Modal, modalApi] = useVbenModal({
<Modal :title="getTitle"> <Modal :title="getTitle">
<Form class="mx-4" /> <Form class="mx-4" />
<MaterialSelectModal @select="handleMaterialSelect" /> <MaterialSelectModal @select="handleMaterialSelect" />
<MeasureUnitSelectModal @select="handleMeasureUnitSelect" />
<StorageVehicleSelectModal @select="handleStorageVehicleSelect" /> <StorageVehicleSelectModal @select="handleStorageVehicleSelect" />
</Modal> </Modal>
</template> </template>