diff --git a/apps/web-antd/package.json b/apps/web-antd/package.json index a3ae11913..93a6f0e28 100644 --- a/apps/web-antd/package.json +++ b/apps/web-antd/package.json @@ -54,6 +54,7 @@ "camunda-bpmn-moddle": "catalog:", "cropperjs": "catalog:", "dayjs": "catalog:", + "dhtmlx-gantt": "catalog:", "diagram-js": "catalog:", "fast-xml-parser": "catalog:", "highlight.js": "catalog:", diff --git a/apps/web-antd/src/views/mes/wm/stocktaking/plan/components/index.ts b/apps/web-antd/src/views/mes/wm/stocktaking/plan/components/index.ts new file mode 100644 index 000000000..d6289b11d --- /dev/null +++ b/apps/web-antd/src/views/mes/wm/stocktaking/plan/components/index.ts @@ -0,0 +1,2 @@ +export { default as StockTakingPlanSelectDialog } from './stock-taking-plan-select-dialog.vue'; +export { default as StockTakingPlanSelect } from './stock-taking-plan-select.vue'; diff --git a/apps/web-antd/src/views/mes/wm/stocktaking/plan/components/stock-taking-plan-select-dialog.vue b/apps/web-antd/src/views/mes/wm/stocktaking/plan/components/stock-taking-plan-select-dialog.vue new file mode 100644 index 000000000..f46313f17 --- /dev/null +++ b/apps/web-antd/src/views/mes/wm/stocktaking/plan/components/stock-taking-plan-select-dialog.vue @@ -0,0 +1,210 @@ + + + diff --git a/apps/web-antd/src/views/mes/wm/stocktaking/plan/components/stock-taking-plan-select.vue b/apps/web-antd/src/views/mes/wm/stocktaking/plan/components/stock-taking-plan-select.vue new file mode 100644 index 000000000..82cf2f4ee --- /dev/null +++ b/apps/web-antd/src/views/mes/wm/stocktaking/plan/components/stock-taking-plan-select.vue @@ -0,0 +1,137 @@ + + + diff --git a/apps/web-antd/src/views/mes/wm/stocktaking/plan/data.ts b/apps/web-antd/src/views/mes/wm/stocktaking/plan/data.ts new file mode 100644 index 000000000..883fbff90 --- /dev/null +++ b/apps/web-antd/src/views/mes/wm/stocktaking/plan/data.ts @@ -0,0 +1,387 @@ +import type { VbenFormApi, VbenFormSchema } from '#/adapter/form'; +import type { VxeTableGridOptions } from '#/adapter/vxe-table'; +import type { MesWmStockTakingPlanApi } from '#/api/mes/wm/stocktaking/plan'; +import type { MesWmStockTakingPlanParamApi } from '#/api/mes/wm/stocktaking/plan/param'; + +import { h } from 'vue'; + +import { CommonStatusEnum, DICT_TYPE } from '@vben/constants'; +import { getDictOptions } from '@vben/hooks'; + +import { Button } from 'ant-design-vue'; + +import { z } from '#/adapter/form'; +import { generateAutoCode } from '#/api/mes/md/autocode/record'; +import { + MesAutoCodeRuleCode, + MesWmStockTakingTypeEnum, +} from '#/views/mes/utils/constants'; + +/** 表单类型 */ +export type FormType = 'create' | 'detail' | 'update'; + +/** 新增/修改的表单 */ +export function useFormSchema( + formType: FormType, + formApi?: VbenFormApi, +): VbenFormSchema[] { + return [ + { + fieldName: 'id', + component: 'Input', + dependencies: { + triggerFields: [''], + show: () => false, + }, + }, + { + fieldName: 'code', + label: '方案编码', + component: 'Input', + componentProps: { + placeholder: '请输入方案编码', + }, + rules: 'required', + suffix: + formType === 'detail' + ? undefined + : () => + h( + Button, + { + type: 'default', + onClick: async () => { + const code = await generateAutoCode( + MesAutoCodeRuleCode.WM_STOCK_TAKING_PLAN_CODE, + ); + await formApi?.setFieldValue('code', code); + }, + }, + { default: () => '生成' }, + ), + }, + { + fieldName: 'name', + label: '方案名称', + component: 'Input', + componentProps: { + placeholder: '请输入方案名称', + }, + rules: 'required', + }, + { + fieldName: 'type', + label: '盘点类型', + component: 'Select', + componentProps: { + options: getDictOptions(DICT_TYPE.MES_WM_STOCK_TAKING_TYPE, 'number'), + placeholder: '请选择盘点类型', + }, + rules: 'selectRequired', + }, + { + fieldName: 'startTime', + label: '开始时间', + component: 'DatePicker', + componentProps: { + placeholder: '请选择开始时间', + showTime: true, + valueFormat: 'x', + }, + dependencies: { + triggerFields: ['type'], + show: (values) => values.type === MesWmStockTakingTypeEnum.DYNAMIC, + }, + }, + { + fieldName: 'endTime', + label: '结束时间', + component: 'DatePicker', + componentProps: { + placeholder: '请选择结束时间', + showTime: true, + valueFormat: 'x', + }, + dependencies: { + triggerFields: ['type'], + show: (values) => values.type === MesWmStockTakingTypeEnum.DYNAMIC, + }, + }, + { + fieldName: 'blindFlag', + label: '是否盲盘', + component: 'Switch', + componentProps: { + checkedChildren: '是', + unCheckedChildren: '否', + }, + rules: z.boolean().default(false), + }, + { + fieldName: 'frozen', + label: '冻结库存', + component: 'Switch', + componentProps: { + checkedChildren: '是', + unCheckedChildren: '否', + }, + rules: z.boolean().default(false), + }, + { + fieldName: 'remark', + label: '备注', + component: 'Textarea', + formItemClass: 'col-span-3', + componentProps: { + placeholder: '请输入备注', + rows: 3, + }, + }, + ]; +} + +/** 列表的搜索表单 */ +export function useGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'code', + label: '方案编码', + component: 'Input', + componentProps: { + allowClear: true, + placeholder: '请输入方案编码', + }, + }, + { + fieldName: 'name', + label: '方案名称', + component: 'Input', + componentProps: { + allowClear: true, + placeholder: '请输入方案名称', + }, + }, + { + fieldName: 'type', + label: '盘点类型', + component: 'Select', + componentProps: { + allowClear: true, + options: getDictOptions(DICT_TYPE.MES_WM_STOCK_TAKING_TYPE, 'number'), + placeholder: '请选择盘点类型', + }, + }, + ]; +} + +/** 列表的字段 */ +export function useGridColumns( + onStatusChange?: ( + newStatus: number, + row: MesWmStockTakingPlanApi.StockTakingPlan, + ) => Promise, +): VxeTableGridOptions['columns'] { + return [ + { + field: 'code', + title: '方案编码', + minWidth: 160, + slots: { default: 'code' }, + }, + { + field: 'name', + title: '方案名称', + minWidth: 160, + }, + { + field: 'type', + title: '盘点类型', + minWidth: 120, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.MES_WM_STOCK_TAKING_TYPE }, + }, + }, + { + field: 'startTime', + title: '开始时间', + width: 180, + formatter: 'formatDateTime', + }, + { + field: 'endTime', + title: '结束时间', + width: 180, + formatter: 'formatDateTime', + }, + { + field: 'blindFlag', + title: '是否盲盘', + width: 100, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.INFRA_BOOLEAN_STRING }, + }, + }, + { + field: 'frozen', + title: '是否冻结库存', + width: 120, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.INFRA_BOOLEAN_STRING }, + }, + }, + { + field: 'status', + title: '状态', + width: 120, + cellRender: { + attrs: { beforeChange: onStatusChange }, + name: 'CellSwitch', + props: { + checkedValue: CommonStatusEnum.ENABLE, + unCheckedValue: CommonStatusEnum.DISABLE, + }, + }, + }, + { + title: '操作', + width: 160, + fixed: 'right', + slots: { default: 'actions' }, + }, + ]; +} + +/** 盘点方案条件列表的字段 */ +export function useParamGridColumns( + editable = true, +): VxeTableGridOptions['columns'] { + return [ + { + field: 'type', + title: '条件类型', + minWidth: 120, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.MES_WM_STOCK_TAKING_PLAN_PARAM_TYPE }, + }, + }, + { + field: 'valueCode', + title: '条件值编码', + minWidth: 140, + }, + { + field: 'valueName', + title: '条件值名称', + minWidth: 160, + }, + ...(editable + ? [ + { + title: '操作', + width: 120, + fixed: 'right', + slots: { default: 'actions' }, + } as const, + ] + : []), + ]; +} + +/** 选择弹窗的搜索表单 */ +export function useSelectGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'code', + label: '方案编码', + component: 'Input', + componentProps: { + allowClear: true, + placeholder: '请输入方案编码', + }, + }, + { + fieldName: 'name', + label: '方案名称', + component: 'Input', + componentProps: { + allowClear: true, + placeholder: '请输入方案名称', + }, + }, + { + fieldName: 'type', + label: '盘点类型', + component: 'Select', + componentProps: { + allowClear: true, + options: getDictOptions(DICT_TYPE.MES_WM_STOCK_TAKING_TYPE, 'number'), + placeholder: '请选择盘点类型', + }, + }, + ]; +} + +/** 选择弹窗的字段 */ +export function useSelectGridColumns( + multiple = true, +): VxeTableGridOptions['columns'] { + return [ + { + type: multiple ? 'checkbox' : 'radio', + width: 50, + }, + { + field: 'code', + title: '方案编码', + width: 200, + }, + { + field: 'name', + title: '方案名称', + minWidth: 150, + }, + { + field: 'type', + title: '盘点类型', + width: 120, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.MES_WM_STOCK_TAKING_TYPE }, + }, + }, + { + field: 'startTime', + title: '开始时间', + width: 180, + formatter: 'formatDateTime', + }, + { + field: 'endTime', + title: '结束时间', + width: 180, + formatter: 'formatDateTime', + }, + { + field: 'blindFlag', + title: '是否盲盘', + width: 100, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.INFRA_BOOLEAN_STRING }, + }, + }, + { + field: 'frozen', + title: '是否冻结库存', + width: 120, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.INFRA_BOOLEAN_STRING }, + }, + }, + ]; +} diff --git a/apps/web-antd/src/views/mes/wm/stocktaking/plan/index.vue b/apps/web-antd/src/views/mes/wm/stocktaking/plan/index.vue new file mode 100644 index 000000000..54b0cf182 --- /dev/null +++ b/apps/web-antd/src/views/mes/wm/stocktaking/plan/index.vue @@ -0,0 +1,184 @@ + + + diff --git a/apps/web-antd/src/views/mes/wm/stocktaking/plan/modules/form.vue b/apps/web-antd/src/views/mes/wm/stocktaking/plan/modules/form.vue new file mode 100644 index 000000000..f0e7827f8 --- /dev/null +++ b/apps/web-antd/src/views/mes/wm/stocktaking/plan/modules/form.vue @@ -0,0 +1,126 @@ + + + diff --git a/apps/web-antd/src/views/mes/wm/stocktaking/plan/modules/param-form.vue b/apps/web-antd/src/views/mes/wm/stocktaking/plan/modules/param-form.vue new file mode 100644 index 000000000..49128ca83 --- /dev/null +++ b/apps/web-antd/src/views/mes/wm/stocktaking/plan/modules/param-form.vue @@ -0,0 +1,267 @@ + + +