fix: 载具扩展表
This commit is contained in:
@@ -72,6 +72,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
gridOptions: {
|
gridOptions: {
|
||||||
columns: [{ type: 'radio', width: 40 }, ...baseColumns],
|
columns: [{ type: 'radio', width: 40 }, ...baseColumns],
|
||||||
height: 'auto',
|
height: 'auto',
|
||||||
|
maxHeight: '500px',
|
||||||
keepSource: true,
|
keepSource: true,
|
||||||
proxyConfig: {
|
proxyConfig: {
|
||||||
ajax: {
|
ajax: {
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ 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 StorageVehicleSelectModalComponent from '../../storagevehicleinfo/components/StorageVehicleSelectModal.vue';
|
||||||
|
|
||||||
const emit = defineEmits(['success']);
|
const emit = defineEmits(['success']);
|
||||||
const formData = ref<WmsStorageVehicleExtApi.StorageVehicleExt>();
|
const formData = ref<WmsStorageVehicleExtApi.StorageVehicleExt>();
|
||||||
@@ -43,7 +44,29 @@ function handleMaterialSelect(rows: any[]) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 覆盖物料名称字段:只读,点击弹出选择窗
|
/** 载具信息选择弹窗 */
|
||||||
|
const [StorageVehicleSelectModal, storageVehicleSelectModalApi] = useVbenModal({
|
||||||
|
connectedComponent: StorageVehicleSelectModalComponent,
|
||||||
|
});
|
||||||
|
|
||||||
|
function openStorageVehicleSelect() {
|
||||||
|
storageVehicleSelectModalApi.setData({ multiple: false }).open();
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleStorageVehicleSelect(rows: any[]) {
|
||||||
|
if (rows.length > 0) {
|
||||||
|
const row = rows[0];
|
||||||
|
const currentValues = formApi.getValues();
|
||||||
|
formApi.setValues({
|
||||||
|
...currentValues,
|
||||||
|
storageVehicleId: row.storageVehicleId,
|
||||||
|
storageVehicleCode: row.storageVehicleCode,
|
||||||
|
storageVehicleType: row.storageVehicleType,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 覆盖物料名称和载具编码字段:只读,点击弹出选择窗
|
||||||
const schema = useFormSchema().map((field) => {
|
const schema = useFormSchema().map((field) => {
|
||||||
if (field.fieldName === 'materialName') {
|
if (field.fieldName === 'materialName') {
|
||||||
return {
|
return {
|
||||||
@@ -54,6 +77,17 @@ const schema = useFormSchema().map((field) => {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
if (field.fieldName === 'storageVehicleCode') {
|
||||||
|
return {
|
||||||
|
...field,
|
||||||
|
componentProps: {
|
||||||
|
...field.componentProps,
|
||||||
|
readonly: true,
|
||||||
|
style: 'cursor: pointer',
|
||||||
|
onClick: openStorageVehicleSelect,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
return field;
|
return field;
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -115,5 +149,6 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
<Modal :title="getTitle">
|
<Modal :title="getTitle">
|
||||||
<Form class="mx-4" />
|
<Form class="mx-4" />
|
||||||
<MaterialSelectModal @select="handleMaterialSelect" />
|
<MaterialSelectModal @select="handleMaterialSelect" />
|
||||||
|
<StorageVehicleSelectModal @select="handleStorageVehicleSelect" />
|
||||||
</Modal>
|
</Modal>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -0,0 +1,112 @@
|
|||||||
|
<script lang="ts" setup>
|
||||||
|
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||||
|
|
||||||
|
import { ref } from 'vue';
|
||||||
|
|
||||||
|
import { useVbenModal } from '@vben/common-ui';
|
||||||
|
|
||||||
|
import { message } from 'antdv-next';
|
||||||
|
|
||||||
|
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||||
|
import { getStorageVehicleInfoPage } from '#/api/wms/storagevehicleinfo';
|
||||||
|
import {getDictOptions} from "@vben/hooks";
|
||||||
|
import {DICT_TYPE} from "@vben/constants";
|
||||||
|
|
||||||
|
const emit = defineEmits(['select']);
|
||||||
|
|
||||||
|
const selectedRows = ref<any[]>([]);
|
||||||
|
const isMultiple = ref(false);
|
||||||
|
const selectModalGridHeight = 600;
|
||||||
|
|
||||||
|
function handleRadioChange({ row }: { row: any }) {
|
||||||
|
selectedRows.value = row ? [row] : [];
|
||||||
|
}
|
||||||
|
|
||||||
|
const baseColumns = [
|
||||||
|
{ field: 'storageVehicleCode', title: '载具编码', minWidth: 120 },
|
||||||
|
{ field: 'storageVehicleName', title: '载具名称', minWidth: 200 },
|
||||||
|
{ field: 'storageVehicleType', title: '载具类型', minWidth: 120 },
|
||||||
|
];
|
||||||
|
|
||||||
|
const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
|
formOptions: {
|
||||||
|
schema: [
|
||||||
|
{
|
||||||
|
fieldName: 'storageVehicleCode',
|
||||||
|
label: '载具编码',
|
||||||
|
component: 'Input',
|
||||||
|
componentProps: { allowClear: true, placeholder: '请输入载具编码' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fieldName: 'storageVehicleName',
|
||||||
|
label: '载具名称',
|
||||||
|
component: 'Input',
|
||||||
|
componentProps: { allowClear: true, placeholder: '请输入载具名称' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fieldName: 'storageVehicleType',
|
||||||
|
label: '载具类型',
|
||||||
|
component: 'Select',
|
||||||
|
componentProps: {
|
||||||
|
allowClear: true,
|
||||||
|
options: getDictOptions(DICT_TYPE.WMS_VEHICLE_TYPE),
|
||||||
|
placeholder: '请选择载具类型',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
gridOptions: {
|
||||||
|
columns: [{ type: 'radio', width: 40 }, ...baseColumns],
|
||||||
|
height: selectModalGridHeight,
|
||||||
|
keepSource: true,
|
||||||
|
proxyConfig: {
|
||||||
|
ajax: {
|
||||||
|
query: async ({ page }, formValues) => {
|
||||||
|
return await getStorageVehicleInfoPage({
|
||||||
|
pageNo: page.currentPage,
|
||||||
|
pageSize: page.pageSize,
|
||||||
|
...formValues,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
rowConfig: {
|
||||||
|
keyField: 'storageVehicleId',
|
||||||
|
isHover: true,
|
||||||
|
},
|
||||||
|
toolbarConfig: {
|
||||||
|
refresh: true,
|
||||||
|
search: true,
|
||||||
|
},
|
||||||
|
} as VxeTableGridOptions<any>,
|
||||||
|
gridEvents: {
|
||||||
|
radioChange: handleRadioChange,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const [Modal, modalApi] = useVbenModal({
|
||||||
|
async onConfirm() {
|
||||||
|
if (selectedRows.value.length === 0) {
|
||||||
|
message.warning('请至少选择一条载具信息');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
emit('select', selectedRows.value);
|
||||||
|
modalApi.close();
|
||||||
|
},
|
||||||
|
async onOpenChange(isOpen: boolean) {
|
||||||
|
if (!isOpen) {
|
||||||
|
selectedRows.value = [];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const data = modalApi.getData<{ multiple: boolean }>();
|
||||||
|
isMultiple.value = data?.multiple ?? false;
|
||||||
|
selectedRows.value = [];
|
||||||
|
},
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Modal title="选择载具" class="w-[1000px]">
|
||||||
|
<Grid />
|
||||||
|
</Modal>
|
||||||
|
</template>
|
||||||
Reference in New Issue
Block a user