| | |
| | | import type { VbenFormApi, VbenFormSchema } from "#/adapter/form"; |
| | | import type { VxeTableGridOptions } from "#/adapter/vxe-table"; |
| | | |
| | | import { h } from 'vue'; |
| | | |
| | | import { CommonStatusEnum, DICT_TYPE } from "#/packages/constants/src"; |
| | | import { getDictOptions } from "#/packages/effects/hooks/src"; |
| | | |
| | | import { z } from '#/adapter/form'; |
| | | import { generateAutoCode } from '#/api/mes/md/autocode/record'; |
| | | import { MesAutoCodeRuleCode } from '@vben/constants'; |
| | | import { getItemTypeSimpleList } from '#/api/mes/md/item/type'; |
| | | import { getUnitPage } from '#/api/mdm/unit'; |
| | | import { getWarehouseSimpleList } from '#/api/mes/wm/warehouse'; |
| | | |
| | | import { Button } from 'ant-design-vue'; |
| | | |
| | | // 缓存单位列表 |
| | | let unitListCache: any[] | null = null; |
| | |
| | | { |
| | | component: "Input", |
| | | fieldName: "code", |
| | | label: "物料编码", |
| | | label: "产品编号", |
| | | componentProps: { |
| | | maxLength: 64, |
| | | placeholder: "请输入物料编码", |
| | | placeholder: "选择产品类型并保存后自动生成", |
| | | disabled: true, |
| | | }, |
| | | rules: z.string().min(1, '物料编码不能为空').max(64), |
| | | suffix: () => |
| | | h( |
| | | Button, |
| | | { |
| | | type: 'default', |
| | | onClick: async () => { |
| | | const code = await generateAutoCode( |
| | | MesAutoCodeRuleCode.MD_ITEM_CODE, |
| | | ); |
| | | await formApi?.setFieldValue('code', code); |
| | | }, |
| | | }, |
| | | { default: () => '生成' }, |
| | | ), |
| | | help: "系统按产品类型自动生成九位编号,例如原材料 100100001", |
| | | }, |
| | | { |
| | | component: "Input", |
| | |
| | | treeDefaultExpandAll: true, |
| | | treeData: categoryTreeData, |
| | | fieldNames: { label: 'label', value: 'value', children: 'children' }, |
| | | }, |
| | | }, |
| | | { |
| | | component: 'Select', |
| | | fieldName: 'itemType', |
| | | label: '产品类型', |
| | | rules: 'selectRequired', |
| | | componentProps: { |
| | | placeholder: '请选择产品类型', |
| | | options: [ |
| | | { label: '原材料(1001)', value: 1 }, |
| | | { label: '半成品(1002)', value: 2 }, |
| | | { label: '成品(1003)', value: 3 }, |
| | | { label: '辅材(1004)', value: 4 }, |
| | | { label: '其他(1005)', value: 5 }, |
| | | ], |
| | | }, |
| | | }, |
| | | { |
| | |
| | | }, |
| | | }, |
| | | { |
| | | component: 'Divider', |
| | | fieldName: 'basicDataDivider', |
| | | label: '基础数据', |
| | | formItemClass: 'col-span-2', |
| | | componentProps: { orientation: 'left', plain: true }, |
| | | }, |
| | | { |
| | | component: 'Textarea', |
| | | fieldName: 'technicalParameters', |
| | | label: '技术参数', |
| | | formItemClass: 'col-span-2', |
| | | componentProps: { |
| | | placeholder: '请输入产品技术参数', |
| | | rows: 4, |
| | | }, |
| | | }, |
| | | { |
| | | component: "InputNumber", |
| | | fieldName: "safetyStock", |
| | | label: "库存预警数量", |
| | | componentProps: { |
| | | class: "!w-full", |
| | | min: 0, |
| | | precision: 2, |
| | | placeholder: "请输入库存预警数量", |
| | | }, |
| | | }, |
| | | { |
| | | component: "InputNumber", |
| | | fieldName: "minStock", |
| | | label: "最低库存", |
| | | componentProps: { |
| | | class: "!w-full", |
| | | min: 0, |
| | | precision: 2, |
| | | placeholder: "请输入最低库存", |
| | | }, |
| | | }, |
| | | { |
| | | component: "InputNumber", |
| | | fieldName: "maxStock", |
| | | label: "最高库存", |
| | | componentProps: { |
| | | class: "!w-full", |
| | | min: 0, |
| | | precision: 2, |
| | | placeholder: "请输入最高库存", |
| | | }, |
| | | }, |
| | | { |
| | | component: "InputNumber", |
| | | fieldName: "purchasePrice", |
| | | label: "采购价", |
| | |
| | | min: 0, |
| | | precision: 2, |
| | | placeholder: "请输入成本价", |
| | | }, |
| | | }, |
| | | { |
| | | component: "InputNumber", |
| | | fieldName: "safetyStock", |
| | | label: "安全库存", |
| | | componentProps: { |
| | | class: "!w-full", |
| | | min: 0, |
| | | precision: 2, |
| | | placeholder: "请输入安全库存", |
| | | }, |
| | | }, |
| | | { |
| | | component: "InputNumber", |
| | | fieldName: "minStock", |
| | | label: "最低库存", |
| | | componentProps: { |
| | | class: "!w-full", |
| | | min: 0, |
| | | precision: 2, |
| | | placeholder: "请输入最低库存", |
| | | }, |
| | | }, |
| | | { |
| | | component: "InputNumber", |
| | | fieldName: "maxStock", |
| | | label: "最高库存", |
| | | componentProps: { |
| | | class: "!w-full", |
| | | min: 0, |
| | | precision: 2, |
| | | placeholder: "请输入最高库存", |
| | | }, |
| | | }, |
| | | { |
| | |
| | | return [ |
| | | { |
| | | fieldName: "code", |
| | | label: "物料编码", |
| | | label: "产品编号", |
| | | component: "Input", |
| | | componentProps: { |
| | | placeholder: "请输入物料编码", |
| | |
| | | { type: "checkbox", width: 40 }, |
| | | { |
| | | field: "code", |
| | | title: "物料编码", |
| | | title: "产品编号", |
| | | minWidth: 120, |
| | | }, |
| | | { |