feat(wms): 优化 md item 的迁移代码(继续)

pull/345/head
YunaiV 2026-05-21 08:45:48 +08:00
parent 67997bd44d
commit 9cc52f128c
20 changed files with 148 additions and 86 deletions

View File

@ -21,13 +21,13 @@ const emit = defineEmits<{
selected: [rows: MesMdItemApi.Item[]];
}>();
const open = ref(false);
const multiple = ref(true);
const syncingSingleSelection = ref(false);
const selectedRows = ref<MesMdItemApi.Item[]>([]);
const selectedItemTypeId = ref<number>();
const preSelectedIds = ref<number[]>([]);
const typeTreeRef = ref<InstanceType<typeof MdItemTypeTree>>();
const open = ref(false); //
const multiple = ref(true); //
const syncingSingleSelection = ref(false); //
const selectedRows = ref<MesMdItemApi.Item[]>([]); //
const selectedItemTypeId = ref<number>(); //
const preSelectedIds = ref<number[]>([]); //
const typeTreeRef = ref<InstanceType<typeof MdItemTypeTree>>(); //
/** 单选模式下同步 VXE 勾选状态,避免跨页残留多选 */
async function syncSingleSelection(row?: MesMdItemApi.Item) {
@ -63,6 +63,7 @@ async function handleCheckboxChange({
selectedRows.value = records;
}
/** 处理全选变化 */
function handleCheckboxAll({ records }: { records: MesMdItemApi.Item[] }) {
if (syncingSingleSelection.value) {
return;
@ -70,11 +71,13 @@ function handleCheckboxAll({ records }: { records: MesMdItemApi.Item[] }) {
selectedRows.value = records;
}
/** 按分类筛选物料 */
function handleItemTypeNodeClick(row: MesMdItemTypeApi.ItemType | undefined) {
selectedItemTypeId.value = row?.id;
gridApi.query();
}
/** 回显预选物料 */
function applyPreSelection() {
if (preSelectedIds.value.length === 0) {
return;
@ -131,6 +134,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
},
});
/** 重置查询和选择状态 */
async function resetQueryState() {
selectedItemTypeId.value = undefined;
selectedRows.value = [];
@ -139,6 +143,7 @@ async function resetQueryState() {
await gridApi.formApi.resetForm();
}
/** 打开物料选择弹窗 */
async function openModal(selectedIds?: number[], options?: { multiple?: boolean }) {
open.value = true;
multiple.value = options?.multiple ?? true;
@ -150,11 +155,13 @@ async function openModal(selectedIds?: number[], options?: { multiple?: boolean
applyPreSelection();
}
/** 关闭物料选择弹窗 */
async function closeModal() {
open.value = false;
await resetQueryState();
}
/** 确认选择物料 */
function handleConfirm() {
if (selectedRows.value.length === 0) {
message.warning(multiple.value ? '请至少选择一条数据' : '请选择一条数据');

View File

@ -31,16 +31,17 @@ const emit = defineEmits<{
change: [item: MesMdItemApi.Item | undefined];
'update:modelValue': [value: number | undefined];
}>();
const attrs = useAttrs();
const dialogRef = ref<InstanceType<typeof MdItemSelectDialog>>();
const hovering = ref(false);
const selectedItem = ref<MesMdItemApi.Item>();
const attrs = useAttrs(); //
const dialogRef = ref<InstanceType<typeof MdItemSelectDialog>>(); //
const hovering = ref(false); //
const selectedItem = ref<MesMdItemApi.Item>(); //
const displayLabel = computed(() => selectedItem.value?.name ?? '');
const showClear = computed(
const displayLabel = computed(() => selectedItem.value?.name ?? ''); //
const showClear = computed( //
() => props.allowClear && !props.disabled && hovering.value && props.modelValue != null,
);
/** 根据物料编号回显选择器 */
async function resolveItemById(id: number | undefined) {
if (id == null) {
selectedItem.value = undefined;
@ -64,12 +65,14 @@ watch(
{ immediate: true },
);
/** 清空已选物料 */
function clearSelected() {
selectedItem.value = undefined;
emit('update:modelValue', undefined);
emit('change', undefined);
}
/** 打开物料选择弹窗 */
function handleClick(event: MouseEvent) {
if (props.disabled) {
return;
@ -84,6 +87,7 @@ function handleClick(event: MouseEvent) {
dialogRef.value?.open(selectedIds, { multiple: false });
}
/** 回填选中的物料 */
function handleSelected(rows: MesMdItemApi.Item[]) {
const item = rows[0];
if (!item) {

View File

@ -29,7 +29,7 @@ import ImportForm from './modules/import-form.vue';
defineOptions({ name: 'MesMdItem' });
const selectedItemTypeId = ref<number>();
const selectedItemTypeId = ref<number>(); //
const [FormModal, formModalApi] = useVbenModal({
connectedComponent: Form,

View File

@ -24,12 +24,12 @@ type FormMode = 'create' | 'detail' | 'update';
defineOptions({ name: 'MesMdItemForm' });
const emit = defineEmits(['success']);
const formMode = ref<FormMode>('create');
const subTabsName = ref('bom');
const formMode = ref<FormMode>('create'); //
const subTabsName = ref('bom'); //
const formData = ref<MesMdItemApi.Item>();
const barcodeDetailRef = ref<InstanceType<typeof BarcodeDetail>>();
const barcodeDetailRef = ref<InstanceType<typeof BarcodeDetail>>(); //
const isDetail = computed(() => formMode.value === 'detail');
const isDetail = computed(() => formMode.value === 'detail'); //
const getTitle = computed(() => {
const titles: Record<FormMode, string> = {
create: '新增物料/产品',
@ -38,7 +38,7 @@ const getTitle = computed(() => {
};
return titles[formMode.value];
});
const currentItemOrProduct = computed(() => formData.value?.itemOrProduct || '');
const currentItemOrProduct = computed(() => formData.value?.itemOrProduct || ''); // /
const [Form, formApi] = useVbenForm({
commonConfig: {
@ -57,6 +57,7 @@ const [Form, formApi] = useVbenForm({
/** 表单 schema 需要 formApi 引用,所以通过 setState 设置 schema */
formApi.setState({ schema: useFormSchema(formApi) });
/** 查看物料条码 */
function handleBarcode() {
if (!formData.value?.id) {
return;

View File

@ -25,10 +25,11 @@ const props = withDefaults(
},
);
const isReadOnly = computed(() => props.formType === 'detail');
const loading = ref(false);
const isReadOnly = computed(() => props.formType === 'detail'); //
const loading = ref(false); // /
const formData = ref<MesMdItemBatchConfigApi.BatchConfig>(buildDefaultData());
/** 构建批次属性默认值 */
function buildDefaultData(): MesMdItemBatchConfigApi.BatchConfig {
return {
itemId: props.itemId,
@ -49,6 +50,7 @@ function buildDefaultData(): MesMdItemBatchConfigApi.BatchConfig {
};
}
/** 加载批次属性配置 */
async function loadData() {
loading.value = true;
try {
@ -59,12 +61,14 @@ async function loadData() {
}
}
/** 判断是否已选择批次属性 */
function hasAnySelected() {
return Object.entries(formData.value).some(
([key, value]) => key.endsWith('Flag') && value === true,
);
}
/** 保存批次属性配置 */
async function handleSave() {
if (!hasAnySelected()) {
message.warning('至少选择一个批次属性');

View File

@ -32,12 +32,12 @@ const props = withDefaults(
},
);
const isReadOnly = computed(() => props.formType === 'detail');
const formOpen = ref(false);
const formLoading = ref(false);
const isReadOnly = computed(() => props.formType === 'detail'); //
const formOpen = ref(false); // BOM
const formLoading = ref(false); // BOM
const formData = ref<MesMdProductBomApi.ProductBom>();
const list = ref<MesMdProductBomApi.ProductBom[]>([]);
const itemSelectRef = ref<InstanceType<typeof MdItemSelectDialog>>();
const list = ref<MesMdProductBomApi.ProductBom[]>([]); // BOM
const itemSelectRef = ref<InstanceType<typeof MdItemSelectDialog>>(); //
const [Form, formApi] = useVbenForm({
commonConfig: {
@ -114,6 +114,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
} as VxeTableGridOptions<MesMdProductBomApi.ProductBom>,
});
/** 加载产品 BOM 列表 */
async function getList() {
gridApi.setLoading(true);
try {
@ -124,10 +125,12 @@ async function getList() {
}
}
/** 打开 BOM 物料选择弹窗 */
function handleAdd() {
itemSelectRef.value?.open(undefined, { multiple: true });
}
/** 添加选中的 BOM 物料 */
async function handleItemSelected(rows: MesMdItemApi.Item[]) {
if (rows.length === 0) {
return;
@ -143,6 +146,7 @@ async function handleItemSelected(rows: MesMdItemApi.Item[]) {
await getList();
}
/** 打开 BOM 编辑弹窗 */
async function openForm(row: MesMdProductBomApi.ProductBom) {
formOpen.value = true;
formData.value = row;
@ -153,6 +157,7 @@ async function openForm(row: MesMdProductBomApi.ProductBom) {
});
}
/** 提交 BOM 表单 */
async function submitForm() {
const { valid } = await formApi.validate();
if (!valid) {
@ -170,6 +175,7 @@ async function submitForm() {
}
}
/** 删除 BOM 物料 */
async function handleDelete(id: number) {
await deleteProductBom(id);
message.success($t('ui.actionMessage.deleteSuccess', ['BOM']));

View File

@ -38,13 +38,13 @@ const props = withDefaults(
},
);
const isReadOnly = computed(() => props.formType === 'detail');
const title = computed(() => props.kind);
const loading = ref(false);
const formOpen = ref(false);
const formLoading = ref(false);
const isReadOnly = computed(() => props.formType === 'detail'); //
const title = computed(() => props.kind); //
const loading = ref(false); // SIP/SOP
const formOpen = ref(false); // SIP/SOP
const formLoading = ref(false); // SIP/SOP
const formData = ref<MediaItem>();
const list = ref<MediaItem[]>([]);
const list = ref<MediaItem[]>([]); // SIP/SOP
const [Form, formApi] = useVbenForm({
commonConfig: {
@ -99,24 +99,29 @@ const [Form, formApi] = useVbenForm({
showDefaultActions: false,
});
/** 获取当前媒体类型的列表接口 */
function getListApi() {
return props.kind === 'SIP'
? getProductSipListByItemId
: getProductSopListByItemId;
}
/** 获取当前媒体类型的新增接口 */
function createApi() {
return props.kind === 'SIP' ? createProductSip : createProductSop;
}
/** 获取当前媒体类型的修改接口 */
function updateApi() {
return props.kind === 'SIP' ? updateProductSip : updateProductSop;
}
/** 获取当前媒体类型的删除接口 */
function deleteApi() {
return props.kind === 'SIP' ? deleteProductSip : deleteProductSop;
}
/** 加载 SIP/SOP 列表 */
async function getList() {
loading.value = true;
try {
@ -126,6 +131,7 @@ async function getList() {
}
}
/** 打开 SIP/SOP 表单 */
async function openForm(row?: MediaItem) {
formOpen.value = true;
formData.value = row;
@ -137,6 +143,7 @@ async function openForm(row?: MediaItem) {
});
}
/** 提交 SIP/SOP 表单 */
async function submitForm() {
const { valid } = await formApi.validate();
if (!valid) {
@ -154,6 +161,7 @@ async function submitForm() {
}
}
/** 删除 SIP/SOP */
async function handleDelete(id: number) {
await deleteApi()(id);
message.success('删除成功');

View File

@ -36,11 +36,11 @@ type ItemTypeNode = MesMdItemTypeApi.ItemType & {
disabled?: boolean;
};
const allList = ref<MesMdItemTypeApi.ItemType[]>([]);
const itemTypeTree = ref<ItemTypeNode[]>([]);
const selectedItem = ref<MesMdItemTypeApi.ItemType>();
const allList = ref<MesMdItemTypeApi.ItemType[]>([]); //
const itemTypeTree = ref<ItemTypeNode[]>([]); //
const selectedItem = ref<MesMdItemTypeApi.ItemType>(); //
const selectValue = computed({
const selectValue = computed({ //
get: () => props.modelValue,
set: (value: number | undefined) => {
emit('update:modelValue', value);

View File

@ -25,12 +25,12 @@ const emit = defineEmits<{
nodeClick: [itemType: MesMdItemTypeApi.ItemType | undefined];
}>();
const loading = ref(false);
const filterText = ref('');
const currentNodeId = ref<number>();
const selectedKeys = ref<number[]>([]);
const itemTypeList = ref<MesMdItemTypeApi.ItemType[]>([]);
const itemTypeTree = ref<any[]>([]);
const loading = ref(false); //
const filterText = ref(''); //
const currentNodeId = ref<number>(); //
const selectedKeys = ref<number[]>([]); // key
const itemTypeList = ref<MesMdItemTypeApi.ItemType[]>([]); //
const itemTypeTree = ref<any[]>([]); //
/** 加载分类树 */
async function loadTree() {

View File

@ -22,8 +22,9 @@ const [FormModal, formModalApi] = useVbenModal({
destroyOnClose: true,
});
const isExpanded = ref(true); //
/** 切换树形展开/收缩状态 */
const isExpanded = ref(true);
function handleExpand() {
isExpanded.value = !isExpanded.value;
gridApi.grid.setAllTreeExpand(isExpanded.value);

View File

@ -21,13 +21,13 @@ const emit = defineEmits<{
selected: [rows: MesMdItemApi.Item[]];
}>();
const open = ref(false);
const multiple = ref(true);
const syncingSingleSelection = ref(false);
const selectedRows = ref<MesMdItemApi.Item[]>([]);
const selectedItemTypeId = ref<number>();
const preSelectedIds = ref<number[]>([]);
const typeTreeRef = ref<InstanceType<typeof MdItemTypeTree>>();
const open = ref(false); //
const multiple = ref(true); //
const syncingSingleSelection = ref(false); //
const selectedRows = ref<MesMdItemApi.Item[]>([]); //
const selectedItemTypeId = ref<number>(); //
const preSelectedIds = ref<number[]>([]); //
const typeTreeRef = ref<InstanceType<typeof MdItemTypeTree>>(); //
/** 单选模式下同步 VXE 勾选状态,避免跨页残留多选 */
async function syncSingleSelection(row?: MesMdItemApi.Item) {
@ -63,6 +63,7 @@ async function handleCheckboxChange({
selectedRows.value = records;
}
/** 处理全选变化 */
function handleCheckboxAll({ records }: { records: MesMdItemApi.Item[] }) {
if (syncingSingleSelection.value) {
return;
@ -70,11 +71,13 @@ function handleCheckboxAll({ records }: { records: MesMdItemApi.Item[] }) {
selectedRows.value = records;
}
/** 按分类筛选物料 */
function handleItemTypeNodeClick(row: MesMdItemTypeApi.ItemType | undefined) {
selectedItemTypeId.value = row?.id;
gridApi.query();
}
/** 回显预选物料 */
function applyPreSelection() {
if (preSelectedIds.value.length === 0) {
return;
@ -131,6 +134,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
},
});
/** 重置查询和选择状态 */
async function resetQueryState() {
selectedItemTypeId.value = undefined;
selectedRows.value = [];
@ -139,6 +143,7 @@ async function resetQueryState() {
await gridApi.formApi.resetForm();
}
/** 打开物料选择弹窗 */
async function openModal(selectedIds?: number[], options?: { multiple?: boolean }) {
open.value = true;
multiple.value = options?.multiple ?? true;
@ -150,11 +155,13 @@ async function openModal(selectedIds?: number[], options?: { multiple?: boolean
applyPreSelection();
}
/** 关闭物料选择弹窗 */
async function closeModal() {
open.value = false;
await resetQueryState();
}
/** 确认选择物料 */
function handleConfirm() {
if (selectedRows.value.length === 0) {
ElMessage.warning(multiple.value ? '请至少选择一条数据' : '请选择一条数据');

View File

@ -31,16 +31,17 @@ const emit = defineEmits<{
change: [item: MesMdItemApi.Item | undefined];
'update:modelValue': [value: number | undefined];
}>();
const attrs = useAttrs();
const dialogRef = ref<InstanceType<typeof MdItemSelectDialog>>();
const hovering = ref(false);
const selectedItem = ref<MesMdItemApi.Item>();
const attrs = useAttrs(); //
const dialogRef = ref<InstanceType<typeof MdItemSelectDialog>>(); //
const hovering = ref(false); //
const selectedItem = ref<MesMdItemApi.Item>(); //
const displayLabel = computed(() => selectedItem.value?.name ?? '');
const showClear = computed(
const displayLabel = computed(() => selectedItem.value?.name ?? ''); //
const showClear = computed( //
() => props.clearable && !props.disabled && hovering.value && props.modelValue != null,
);
/** 根据物料编号回显选择器 */
async function resolveItemById(id: number | undefined) {
if (id == null) {
selectedItem.value = undefined;
@ -64,12 +65,14 @@ watch(
{ immediate: true },
);
/** 清空已选物料 */
function clearSelected() {
selectedItem.value = undefined;
emit('update:modelValue', undefined);
emit('change', undefined);
}
/** 打开物料选择弹窗 */
function handleClick(event: MouseEvent) {
if (props.disabled) {
return;
@ -84,6 +87,7 @@ function handleClick(event: MouseEvent) {
dialogRef.value?.open(selectedIds, { multiple: false });
}
/** 回填选中的物料 */
function handleSelected(rows: MesMdItemApi.Item[]) {
const item = rows[0];
if (!item) {

View File

@ -35,7 +35,7 @@ import ImportForm from './modules/import-form.vue';
defineOptions({ name: 'MesMdItem' });
const selectedItemTypeId = ref<number>();
const selectedItemTypeId = ref<number>(); //
const [FormModal, formModalApi] = useVbenModal({
connectedComponent: Form,

View File

@ -24,12 +24,12 @@ type FormMode = 'create' | 'detail' | 'update';
defineOptions({ name: 'MesMdItemForm' });
const emit = defineEmits(['success']);
const formMode = ref<FormMode>('create');
const subTabsName = ref('bom');
const formMode = ref<FormMode>('create'); //
const subTabsName = ref('bom'); //
const formData = ref<MesMdItemApi.Item>();
const barcodeDetailRef = ref<InstanceType<typeof BarcodeDetail>>();
const barcodeDetailRef = ref<InstanceType<typeof BarcodeDetail>>(); //
const isDetail = computed(() => formMode.value === 'detail');
const isDetail = computed(() => formMode.value === 'detail'); //
const getTitle = computed(() => {
const titles: Record<FormMode, string> = {
create: '新增物料/产品',
@ -38,7 +38,7 @@ const getTitle = computed(() => {
};
return titles[formMode.value];
});
const currentItemOrProduct = computed(() => formData.value?.itemOrProduct || '');
const currentItemOrProduct = computed(() => formData.value?.itemOrProduct || ''); // /
const [Form, formApi] = useVbenForm({
commonConfig: {
@ -57,6 +57,7 @@ const [Form, formApi] = useVbenForm({
/** 表单 schema 需要 formApi 引用,所以通过 setState 设置 schema */
formApi.setState({ schema: useFormSchema(formApi) });
/** 查看物料条码 */
function handleBarcode() {
if (!formData.value?.id) {
return;

View File

@ -25,10 +25,11 @@ const props = withDefaults(
},
);
const isReadOnly = computed(() => props.formType === 'detail');
const loading = ref(false);
const isReadOnly = computed(() => props.formType === 'detail'); //
const loading = ref(false); // /
const formData = ref<MesMdItemBatchConfigApi.BatchConfig>(buildDefaultData());
/** 构建批次属性默认值 */
function buildDefaultData(): MesMdItemBatchConfigApi.BatchConfig {
return {
itemId: props.itemId,
@ -49,6 +50,7 @@ function buildDefaultData(): MesMdItemBatchConfigApi.BatchConfig {
};
}
/** 加载批次属性配置 */
async function loadData() {
loading.value = true;
try {
@ -59,12 +61,14 @@ async function loadData() {
}
}
/** 判断是否已选择批次属性 */
function hasAnySelected() {
return Object.entries(formData.value).some(
([key, value]) => key.endsWith('Flag') && value === true,
);
}
/** 保存批次属性配置 */
async function handleSave() {
if (!hasAnySelected()) {
ElMessage.warning('至少选择一个批次属性');

View File

@ -32,12 +32,12 @@ const props = withDefaults(
},
);
const isReadOnly = computed(() => props.formType === 'detail');
const formOpen = ref(false);
const formLoading = ref(false);
const isReadOnly = computed(() => props.formType === 'detail'); //
const formOpen = ref(false); // BOM
const formLoading = ref(false); // BOM
const formData = ref<MesMdProductBomApi.ProductBom>();
const list = ref<MesMdProductBomApi.ProductBom[]>([]);
const itemSelectRef = ref<InstanceType<typeof MdItemSelectDialog>>();
const list = ref<MesMdProductBomApi.ProductBom[]>([]); // BOM
const itemSelectRef = ref<InstanceType<typeof MdItemSelectDialog>>(); //
const [Form, formApi] = useVbenForm({
commonConfig: {
@ -120,6 +120,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
} as VxeTableGridOptions<MesMdProductBomApi.ProductBom>,
});
/** 加载产品 BOM 列表 */
async function getList() {
gridApi.setLoading(true);
try {
@ -130,10 +131,12 @@ async function getList() {
}
}
/** 打开 BOM 物料选择弹窗 */
function handleAdd() {
itemSelectRef.value?.open(undefined, { multiple: true });
}
/** 添加选中的 BOM 物料 */
async function handleItemSelected(rows: MesMdItemApi.Item[]) {
if (rows.length === 0) {
return;
@ -149,6 +152,7 @@ async function handleItemSelected(rows: MesMdItemApi.Item[]) {
await getList();
}
/** 打开 BOM 编辑弹窗 */
async function openForm(row: MesMdProductBomApi.ProductBom) {
formOpen.value = true;
formData.value = row;
@ -159,6 +163,7 @@ async function openForm(row: MesMdProductBomApi.ProductBom) {
});
}
/** 提交 BOM 表单 */
async function submitForm() {
const { valid } = await formApi.validate();
if (!valid) {
@ -176,6 +181,7 @@ async function submitForm() {
}
}
/** 删除 BOM 物料 */
async function handleDelete(id: number) {
await deleteProductBom(id);
ElMessage.success($t('ui.actionMessage.deleteSuccess', ['BOM']));

View File

@ -46,13 +46,13 @@ const props = withDefaults(
},
);
const isReadOnly = computed(() => props.formType === 'detail');
const title = computed(() => props.kind);
const loading = ref(false);
const formOpen = ref(false);
const formLoading = ref(false);
const isReadOnly = computed(() => props.formType === 'detail'); //
const title = computed(() => props.kind); //
const loading = ref(false); // SIP/SOP
const formOpen = ref(false); // SIP/SOP
const formLoading = ref(false); // SIP/SOP
const formData = ref<MediaItem>();
const list = ref<MediaItem[]>([]);
const list = ref<MediaItem[]>([]); // SIP/SOP
const [Form, formApi] = useVbenForm({
commonConfig: {
@ -112,24 +112,29 @@ const [Form, formApi] = useVbenForm({
showDefaultActions: false,
});
/** 获取当前媒体类型的列表接口 */
function getListApi() {
return props.kind === 'SIP'
? getProductSipListByItemId
: getProductSopListByItemId;
}
/** 获取当前媒体类型的新增接口 */
function createApi() {
return props.kind === 'SIP' ? createProductSip : createProductSop;
}
/** 获取当前媒体类型的修改接口 */
function updateApi() {
return props.kind === 'SIP' ? updateProductSip : updateProductSop;
}
/** 获取当前媒体类型的删除接口 */
function deleteApi() {
return props.kind === 'SIP' ? deleteProductSip : deleteProductSop;
}
/** 加载 SIP/SOP 列表 */
async function getList() {
loading.value = true;
try {
@ -139,6 +144,7 @@ async function getList() {
}
}
/** 打开 SIP/SOP 表单 */
async function openForm(row?: MediaItem) {
formOpen.value = true;
formData.value = row;
@ -150,6 +156,7 @@ async function openForm(row?: MediaItem) {
});
}
/** 提交 SIP/SOP 表单 */
async function submitForm() {
const { valid } = await formApi.validate();
if (!valid) {
@ -167,6 +174,7 @@ async function submitForm() {
}
}
/** 删除 SIP/SOP */
async function handleDelete(id: number) {
await deleteApi()(id);
ElMessage.success('删除成功');

View File

@ -36,11 +36,11 @@ type ItemTypeNode = MesMdItemTypeApi.ItemType & {
disabled?: boolean;
};
const allList = ref<MesMdItemTypeApi.ItemType[]>([]);
const itemTypeTree = ref<ItemTypeNode[]>([]);
const selectedItem = ref<MesMdItemTypeApi.ItemType>();
const allList = ref<MesMdItemTypeApi.ItemType[]>([]); //
const itemTypeTree = ref<ItemTypeNode[]>([]); //
const selectedItem = ref<MesMdItemTypeApi.ItemType>(); //
const selectValue = computed({
const selectValue = computed({ //
get: () => props.modelValue,
set: (value: number | undefined) => {
emit('update:modelValue', value);

View File

@ -25,12 +25,12 @@ const emit = defineEmits<{
nodeClick: [itemType: MesMdItemTypeApi.ItemType | undefined];
}>();
const loading = ref(false);
const filterText = ref('');
const currentNodeId = ref<number>();
const itemTypeList = ref<MesMdItemTypeApi.ItemType[]>([]);
const itemTypeTree = ref<MesMdItemTypeApi.ItemType[]>([]);
const treeRef = ref<InstanceType<typeof ElTree>>();
const loading = ref(false); //
const filterText = ref(''); //
const currentNodeId = ref<number>(); //
const itemTypeList = ref<MesMdItemTypeApi.ItemType[]>([]); //
const itemTypeTree = ref<MesMdItemTypeApi.ItemType[]>([]); //
const treeRef = ref<InstanceType<typeof ElTree>>(); //
/** 加载分类树 */
async function loadTree() {

View File

@ -22,8 +22,9 @@ const [FormModal, formModalApi] = useVbenModal({
destroyOnClose: true,
});
const isExpanded = ref(true); //
/** 切换树形展开/收缩状态 */
const isExpanded = ref(true);
function handleExpand() {
isExpanded.value = !isExpanded.value;
gridApi.grid.setAllTreeExpand(isExpanded.value);