fix: 载具扩展
This commit is contained in:
@@ -23,6 +23,7 @@ async function loadMaterialTypeTree() {
|
||||
|
||||
const selectedRows = ref<any[]>([]);
|
||||
const isMultiple = ref(false);
|
||||
const selectModalGridHeight = 600;
|
||||
|
||||
function handleRadioChange({ row }: { row: any }) {
|
||||
selectedRows.value = row ? [row] : [];
|
||||
@@ -71,8 +72,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
},
|
||||
gridOptions: {
|
||||
columns: [{ type: 'radio', width: 40 }, ...baseColumns],
|
||||
height: 'auto',
|
||||
maxHeight: '500px',
|
||||
height: selectModalGridHeight,
|
||||
keepSource: true,
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
|
||||
@@ -14,6 +14,7 @@ const emit = defineEmits(['select']);
|
||||
|
||||
const selectedRows = ref<any[]>([]);
|
||||
const isMultiple = ref(false);
|
||||
const selectModalGridHeight = 600;
|
||||
|
||||
function handleRadioChange({ row }: { row: any }) {
|
||||
selectedRows.value = row ? [row] : [];
|
||||
@@ -48,7 +49,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
},
|
||||
gridOptions: {
|
||||
columns: [{ type: 'radio', width: 40 }, ...baseColumns],
|
||||
height: 'auto',
|
||||
height: selectModalGridHeight,
|
||||
keepSource: true,
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
|
||||
@@ -45,8 +45,9 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||
rules: 'required',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
disabled: true,
|
||||
options: getDictOptions(DICT_TYPE.WMS_VEHICLE_TYPE),
|
||||
placeholder: '请选择载具类型',
|
||||
placeholder: '选择载具后会自动回填',
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -87,6 +88,14 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||
placeholder: '请输入木箱号',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'qty',
|
||||
label: '物料数量',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入物料数量',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'qtyUnitId',
|
||||
label: '数量单位',
|
||||
@@ -94,6 +103,10 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||
componentProps: {
|
||||
placeholder: '请输入数量计量单位标识',
|
||||
},
|
||||
dependencies: {
|
||||
triggerFields: [''],
|
||||
show: () => false,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'qtyUnitName',
|
||||
@@ -103,14 +116,6 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||
placeholder: '请输入数量计量单位名称',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'qty',
|
||||
label: '物料数量',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入物料数量',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'vehicleWeight',
|
||||
label: '托盘重量',
|
||||
@@ -127,6 +132,10 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||
componentProps: {
|
||||
placeholder: '请输入重量计量单位标识',
|
||||
},
|
||||
dependencies: {
|
||||
triggerFields: [''],
|
||||
show: () => false,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'weightUnitName',
|
||||
|
||||
@@ -13,10 +13,12 @@ import { $t } from '#/locales';
|
||||
|
||||
import { useFormSchema } from '../data';
|
||||
import MaterialSelectModalComponent from '../../../base/materialbase/components/MaterialSelectModal.vue';
|
||||
import MeasureUnitSelectModalComponent from '../../../base/measureunit/components/MeasureUnitSelectModal.vue';
|
||||
import StorageVehicleSelectModalComponent from '../../storagevehicleinfo/components/StorageVehicleSelectModal.vue';
|
||||
|
||||
const emit = defineEmits(['success']);
|
||||
const formData = ref<WmsStorageVehicleExtApi.StorageVehicleExt>();
|
||||
const activeMeasureUnitField = ref<'qty' | 'weight'>('qty');
|
||||
const getTitle = computed(() => {
|
||||
return formData.value?.storageVehicleExtId
|
||||
? $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({
|
||||
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;
|
||||
});
|
||||
|
||||
@@ -149,6 +206,7 @@ const [Modal, modalApi] = useVbenModal({
|
||||
<Modal :title="getTitle">
|
||||
<Form class="mx-4" />
|
||||
<MaterialSelectModal @select="handleMaterialSelect" />
|
||||
<MeasureUnitSelectModal @select="handleMeasureUnitSelect" />
|
||||
<StorageVehicleSelectModal @select="handleStorageVehicleSelect" />
|
||||
</Modal>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user