diff --git a/apps/web-antd/src/views/mes/cal/plan/data.ts b/apps/web-antd/src/views/mes/cal/plan/data.ts new file mode 100644 index 000000000..a12ad2e13 --- /dev/null +++ b/apps/web-antd/src/views/mes/cal/plan/data.ts @@ -0,0 +1,280 @@ +import type { VbenFormApi, VbenFormSchema } from '#/adapter/form'; +import type { VxeTableGridOptions } from '#/adapter/vxe-table'; +import type { MesCalPlanApi } from '#/api/mes/cal/plan'; + +import { h } from 'vue'; + +import { DICT_TYPE } from '@vben/constants'; +import { getDictOptions } from '@vben/hooks'; + +import { Button } from 'ant-design-vue'; + +import { generateAutoCode } from '#/api/mes/md/autocode/record'; +import { getRangePickerDefaultProps } from '#/utils'; +import { + MesAutoCodeRuleCode, + MesCalPlanStatusEnum, + MesCalShiftMethodEnum, + MesCalShiftTypeEnum, +} from '#/views/mes/utils/constants'; + +/** 新增/修改排班计划的表单 */ +export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] { + return [ + { + fieldName: 'id', + component: 'Input', + dependencies: { + triggerFields: [''], + show: () => false, + }, + }, + { + fieldName: 'status', + component: 'Input', + dependencies: { + triggerFields: [''], + show: () => false, + }, + defaultValue: MesCalPlanStatusEnum.PREPARE, + }, + { + fieldName: 'code', + label: '计划编码', + component: 'Input', + componentProps: { + placeholder: '请输入计划编码', + }, + rules: 'required', + suffix: () => + h( + Button, + { + type: 'default', + onClick: async () => { + try { + const code = await generateAutoCode(MesAutoCodeRuleCode.CAL_PLAN_CODE); + await formApi?.setFieldValue('code', code); + } catch (error) { + console.error(error); + } + }, + }, + { default: () => '生成' }, + ), + }, + { + fieldName: 'name', + label: '计划名称', + component: 'Input', + componentProps: { + placeholder: '请输入计划名称', + }, + rules: 'required', + }, + { + fieldName: 'calendarType', + label: '班组类型', + component: 'Select', + componentProps: { + allowClear: true, + options: getDictOptions(DICT_TYPE.MES_CAL_CALENDAR_TYPE, 'number'), + placeholder: '请选择班组类型', + }, + rules: 'selectRequired', + }, + { + fieldName: 'startDate', + label: '开始日期', + component: 'DatePicker', + componentProps: { + format: 'YYYY-MM-DD', + placeholder: '请选择开始日期', + valueFormat: 'x', + }, + rules: 'required', + }, + { + fieldName: 'endDate', + label: '结束日期', + component: 'DatePicker', + componentProps: { + format: 'YYYY-MM-DD', + placeholder: '请选择结束日期', + valueFormat: 'x', + }, + rules: 'required', + }, + { + fieldName: 'shiftType', + label: '轮班方式', + component: 'Select', + componentProps: { + allowClear: true, + options: getDictOptions(DICT_TYPE.MES_CAL_SHIFT_TYPE, 'number'), + placeholder: '请选择轮班方式', + }, + rules: 'selectRequired', + }, + { + fieldName: 'shiftMethod', + label: '倒班方式', + component: 'Select', + componentProps: { + allowClear: true, + options: getDictOptions(DICT_TYPE.MES_CAL_SHIFT_METHOD, 'number'), + placeholder: '请选择倒班方式', + }, + dependencies: { + triggerFields: ['shiftType'], + show: (values) => !!values.shiftType && values.shiftType !== MesCalShiftTypeEnum.SINGLE, + }, + }, + { + fieldName: 'shiftCount', + label: '倒班天数', + component: 'InputNumber', + componentProps: { + class: '!w-full', + min: 1, + precision: 0, + }, + dependencies: { + triggerFields: ['shiftMethod'], + show: (values) => values.shiftMethod === MesCalShiftMethodEnum.DAY, + }, + }, + { + 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: 'startDate', + label: '开始日期', + component: 'RangePicker', + componentProps: { + ...getRangePickerDefaultProps(), + }, + }, + { + fieldName: 'endDate', + label: '结束日期', + component: 'RangePicker', + componentProps: { + ...getRangePickerDefaultProps(), + }, + }, + { + fieldName: 'shiftType', + label: '轮班方式', + component: 'Select', + componentProps: { + allowClear: true, + options: getDictOptions(DICT_TYPE.MES_CAL_SHIFT_TYPE, 'number'), + placeholder: '请选择轮班方式', + }, + }, + { + fieldName: 'status', + label: '状态', + component: 'Select', + componentProps: { + allowClear: true, + options: getDictOptions(DICT_TYPE.MES_CAL_PLAN_STATUS, 'number'), + placeholder: '请选择状态', + }, + }, + ]; +} + +/** 列表的字段 */ +export function useGridColumns(): VxeTableGridOptions['columns'] { + return [ + { + field: 'code', + title: '计划编码', + minWidth: 140, + slots: { + default: 'code', + }, + }, + { field: 'name', title: '计划名称', minWidth: 150 }, + { + field: 'calendarType', + title: '班组类型', + width: 120, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.MES_CAL_CALENDAR_TYPE }, + }, + }, + { field: 'startDate', title: '开始日期', width: 150, formatter: 'formatDate' }, + { field: 'endDate', title: '结束日期', width: 150, formatter: 'formatDate' }, + { + field: 'shiftType', + title: '轮班方式', + width: 120, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.MES_CAL_SHIFT_TYPE }, + }, + }, + { + field: 'shiftMethod', + title: '倒班方式', + width: 120, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.MES_CAL_SHIFT_METHOD }, + }, + }, + { + field: 'status', + title: '单据状态', + width: 120, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.MES_CAL_PLAN_STATUS }, + }, + }, + { field: 'createTime', title: '创建时间', width: 180, formatter: 'formatDateTime' }, + { + title: '操作', + width: 160, + fixed: 'right', + slots: { + default: 'actions', + }, + }, + ]; +} diff --git a/apps/web-antd/src/views/mes/cal/plan/index.vue b/apps/web-antd/src/views/mes/cal/plan/index.vue new file mode 100644 index 000000000..7f834ade2 --- /dev/null +++ b/apps/web-antd/src/views/mes/cal/plan/index.vue @@ -0,0 +1,144 @@ + + + diff --git a/apps/web-antd/src/views/mes/cal/plan/modules/form.vue b/apps/web-antd/src/views/mes/cal/plan/modules/form.vue new file mode 100644 index 000000000..850b44dc5 --- /dev/null +++ b/apps/web-antd/src/views/mes/cal/plan/modules/form.vue @@ -0,0 +1,154 @@ + + + diff --git a/apps/web-antd/src/views/mes/cal/plan/modules/shift-list.vue b/apps/web-antd/src/views/mes/cal/plan/modules/shift-list.vue new file mode 100644 index 000000000..d2cf20c2c --- /dev/null +++ b/apps/web-antd/src/views/mes/cal/plan/modules/shift-list.vue @@ -0,0 +1,236 @@ + + + diff --git a/apps/web-antd/src/views/mes/cal/plan/modules/team-list.vue b/apps/web-antd/src/views/mes/cal/plan/modules/team-list.vue new file mode 100644 index 000000000..cac43c757 --- /dev/null +++ b/apps/web-antd/src/views/mes/cal/plan/modules/team-list.vue @@ -0,0 +1,207 @@ + + + diff --git a/apps/web-ele/src/views/mes/cal/holiday/data.ts b/apps/web-ele/src/views/mes/cal/holiday/data.ts new file mode 100644 index 000000000..a16b76999 --- /dev/null +++ b/apps/web-ele/src/views/mes/cal/holiday/data.ts @@ -0,0 +1,47 @@ +import type { VbenFormSchema } from '#/adapter/form'; + +import { DICT_TYPE } from '@vben/constants'; +import { getDictOptions } from '@vben/hooks'; + +import { z } from '#/adapter/form'; +import { HolidayType } from '#/views/mes/utils/constants'; + +/** 假期设置表单 */ +export function useHolidayFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'day', + component: 'Input', + dependencies: { + triggerFields: [''], + show: () => false, + }, + }, + { + fieldName: 'dayDisplay', + label: '日期', + component: 'Input', + componentProps: { + disabled: true, + }, + }, + { + fieldName: 'type', + label: '类型', + component: 'RadioGroup', + componentProps: { + options: getDictOptions(DICT_TYPE.MES_CAL_HOLIDAY_TYPE, 'number'), + }, + rules: z.number().default(HolidayType.WORKDAY), + }, + { + fieldName: 'remark', + label: '备注', + component: 'Textarea', + componentProps: { + placeholder: '请输入备注', + rows: 3, + }, + }, + ]; +} diff --git a/apps/web-ele/src/views/mes/cal/holiday/index.vue b/apps/web-ele/src/views/mes/cal/holiday/index.vue new file mode 100644 index 000000000..d80937300 --- /dev/null +++ b/apps/web-ele/src/views/mes/cal/holiday/index.vue @@ -0,0 +1,192 @@ + + + diff --git a/apps/web-ele/src/views/mes/cal/holiday/modules/form.vue b/apps/web-ele/src/views/mes/cal/holiday/modules/form.vue new file mode 100644 index 000000000..345c02862 --- /dev/null +++ b/apps/web-ele/src/views/mes/cal/holiday/modules/form.vue @@ -0,0 +1,84 @@ + + +