完成了 BOM 管理和生产管理,完成部分发料单、采购计划和调拨单。

This commit is contained in:
c
2026-02-28 18:18:01 +08:00
commit 219eef4729
399 changed files with 46113 additions and 0 deletions

View File

@@ -0,0 +1,76 @@
<script lang="ts" setup>
import { get } from "@/common/http/request";
import type { TreeInstance } from "element-plus";
const props = defineProps({
title: String,
data: Array,
url: String,
param: URLSearchParams,
selectUrl: String,
showCheckbox: { default: false },
});
const treeCheck = defineModel<number[]>();
const treeSelect = defineModel("current-node");
const treeData = ref();
const treeRef = ref<TreeInstance>();
const loadData = async () => {
if (props.url !== undefined) {
const rawUrlData = await get(props.url, props.param).then(res => res.data);
treeData.value = rawUrlData;
}
if (props.data !== undefined && treeData.value === undefined) {
treeData.value = props.data;
}
};
const clearSelect = () => {
treeRef.value?.setCheckedKeys([]);
};
const defaultProps = {
children: "children",
label: "label",
};
const checkHandle = (checkedNode: any, treeStatus: any) => {
treeCheck.value = treeStatus.checkedKeys;
};
const clickHandle = (clickNode: any, nodeAttr: any, treeNode: any, event: any) => {
treeSelect.value = clickNode;
};
const initSelect = (newV: number[]) => {
treeRef.value?.setCheckedKeys(newV);
};
watch(treeCheck, (newV: number[] | undefined) => {
if (newV === undefined) return;
initSelect(newV);
});
onMounted(loadData);
defineExpose({
clear: clearSelect,
});
</script>
<template>
<div>
<p v-if="title !== undefined">{{ title }}</p>
<el-tree
ref="treeRef"
:props="defaultProps"
:data="treeData"
v-model="treeCheck"
node-key="id"
default-expand-all
highlight-current
:show-checkbox="showCheckbox"
@check="checkHandle"
@node-click="clickHandle"
/>
</div>
</template>