| | |
| | | row: any |
| | | index: number |
| | | } |
| | | interface WmsTaskItem { |
| | | id: string |
| | | taskNo: string |
| | | // 其他字段... |
| | | } |
| | | export const useWmsTask = (props: any, ctx?: any) => { |
| | | const wmsTask = injectModel<WmsTask>('wmsTask') |
| | | const { exportFile } = useFile() |
| | |
| | | /** |
| | | * 动态列配置 |
| | | */ |
| | | const wmsTaskColumns = ref<Record<string, any>>([]) |
| | | const wmsTaskColumns = ref<Record<string, any>>({}) |
| | | /** |
| | | * 搜索值 |
| | | */ |
| | |
| | | /** |
| | | * 选择项 |
| | | */ |
| | | const selection = ref([]) |
| | | const selection = ref<WmsTaskItem[]>([]) |
| | | /** |
| | | * 当前选中的行 |
| | | */ |
| | |
| | | title: '', |
| | | isAdd: false, |
| | | }) |
| | | |
| | | |
| | | const dialogSettingConfig = reactive({ |
| | | visible: false, |
| | |
| | | // divided: true, |
| | | // icon: 'up', |
| | | // }, |
| | | // { |
| | | // label: '向下添加', |
| | | // fn: (c: CurrentType, pageNum: number) => { |
| | | // current.value = null |
| | | // sort.value = c.index + 2 + (pageNum - 1) * 50 |
| | | // dialogConfig.visible = true |
| | | // dialogConfig.title = '添加' |
| | | // dialogConfig.isAdd = false |
| | | // }, |
| | | // divided: true, |
| | | // icon: 'down', |
| | | // }, |
| | | // { |
| | | // label: '创建副本', |
| | | // fn: async ({ row }: CurrentType) => { |
| | | // await wmsTask.cloneData([row.id]) |
| | | // ElMessage.success('创建副本成功') |
| | | // tableRef.value?.getList() |
| | | // }, |
| | | // divided: true, |
| | | // icon: 'copy', |
| | | // }, |
| | | { |
| | | label: '强制完成', |
| | | fn: async (c: CurrentType) => { |
| | | // 获取要操作的任务(多选或当前行) |
| | | const tasks = selection.value.length > 0 ? selection.value : [c.row] |
| | | const data = { |
| | | taskNo: tasks[0].taskNo, |
| | | } |
| | | |
| | | ConfirmBox(`是否强制完成 ${tasks.map((t) => t.taskNo).join(',')}`) |
| | | .then(async () => { |
| | | await wmsTask.finishTask(data) // 传递单个对象或数组 |
| | | ElMessage.success('强制完成成功') |
| | | tableRef.value.getList() |
| | | }) |
| | | .catch(() => {}) |
| | | }, |
| | | divided: true, |
| | | icon: 'down', |
| | | }, |
| | | { |
| | | label: '取消', |
| | | fn: async (c: CurrentType) => { |
| | | // 获取要操作的任务(多选或当前行) |
| | | const tasks = selection.value.length > 0 ? selection.value : [c.row] |
| | | |
| | | const data = { |
| | | taskNo: tasks[0].taskNo, |
| | | } |
| | | |
| | | ConfirmBox(`是否取消 ${tasks.map((t) => t.taskNo).join(',')}`) |
| | | .then(async () => { |
| | | await wmsTask.cancelTask(data) // 传递单个对象或数组 |
| | | ElMessage.success('取消成功') |
| | | tableRef.value.getList() |
| | | }) |
| | | .catch(() => {}) |
| | | }, |
| | | divided: true, |
| | | icon: 'copy', |
| | | }, |
| | | { |
| | | label: '删除', |
| | | fn: async (c: CurrentType) => { |
| | | const names = selection.value.map((item: { taskNo: string }) => item.taskNo) |
| | | const names = selection.value.map( |
| | | (item: { taskNo: string }) => item.taskNo |
| | | ) |
| | | ConfirmBox( |
| | | `是否删除${names.length ? names.join(',') : c.row.taskNo}` |
| | | ).then(async () => { |
| | |
| | | onConfirmWmsTask, |
| | | onCheck, |
| | | onAddWmsTask, |
| | | onAdvancedQuery |
| | | onAdvancedQuery, |
| | | } |
| | | } |