feat(mes):优化、实现 plan 的逻辑
parent
778141bf7f
commit
501db918f3
|
|
@ -1,9 +1,7 @@
|
|||
import request from '@/config/axios'
|
||||
|
||||
// TODO @AI:挪到 plan/shift 目录下
|
||||
|
||||
// MES 计划班次 VO
|
||||
export interface CalShiftVO {
|
||||
export interface CalPlanShiftVO {
|
||||
id: number
|
||||
planId: number // 排班计划编号
|
||||
sort: number // 显示顺序
|
||||
|
|
@ -18,39 +16,24 @@ export interface CalShiftVO {
|
|||
}
|
||||
|
||||
// MES 计划班次 API
|
||||
export const CalShiftApi = {
|
||||
// 查询计划班次分页
|
||||
getShiftPage: async (params: any) => {
|
||||
return await request.get({ url: `/mes/cal/shift/page`, params })
|
||||
},
|
||||
|
||||
// 查询计划班次详情
|
||||
getShift: async (id: number) => {
|
||||
return await request.get({ url: `/mes/cal/shift/get?id=` + id })
|
||||
},
|
||||
|
||||
export const CalPlanShiftApi = {
|
||||
// 查询指定排班计划的班次列表
|
||||
getShiftListByPlan: async (planId: number) => {
|
||||
return await request.get({ url: `/mes/cal/shift/list-by-plan?planId=` + planId })
|
||||
getPlanShiftListByPlan: async (planId: number) => {
|
||||
return await request.get({ url: `/mes/cal/plan-shift/list-by-plan?planId=` + planId })
|
||||
},
|
||||
|
||||
// 新增计划班次
|
||||
createShift: async (data: CalShiftVO) => {
|
||||
return await request.post({ url: `/mes/cal/shift/create`, data })
|
||||
createPlanShift: async (data: CalPlanShiftVO) => {
|
||||
return await request.post({ url: `/mes/cal/plan-shift/create`, data })
|
||||
},
|
||||
|
||||
// 修改计划班次
|
||||
updateShift: async (data: CalShiftVO) => {
|
||||
return await request.put({ url: `/mes/cal/shift/update`, data })
|
||||
updatePlanShift: async (data: CalPlanShiftVO) => {
|
||||
return await request.put({ url: `/mes/cal/plan-shift/update`, data })
|
||||
},
|
||||
|
||||
// 删除计划班次
|
||||
deleteShift: async (id: number) => {
|
||||
return await request.delete({ url: `/mes/cal/shift/delete?id=` + id })
|
||||
},
|
||||
|
||||
// 导出计划班次 Excel
|
||||
exportShift: async (params: any) => {
|
||||
return await request.download({ url: `/mes/cal/shift/export-excel`, params })
|
||||
deletePlanShift: async (id: number) => {
|
||||
return await request.delete({ url: `/mes/cal/plan-shift/delete?id=` + id })
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -264,5 +264,8 @@ export enum DICT_TYPE {
|
|||
MES_TM_MAINTEN_TYPE = 'mes_tm_mainten_type', // MES 保养维护类型
|
||||
MES_DV_MACHINERY_STATUS = 'mes_dv_machinery_status', // MES 设备状态
|
||||
MES_INDEX_TYPE = 'mes_index_type', // MES 检测项类型
|
||||
MES_DEFECT_LEVEL = 'mes_defect_level' // MES 缺陷等级
|
||||
MES_DEFECT_LEVEL = 'mes_defect_level', // MES 缺陷等级
|
||||
MES_PRO_WORKORDER_STATUS = 'mes_pro_workorder_status', // MES 生产工单状态
|
||||
MES_PRO_WORKORDER_SOURCE_TYPE = 'mes_pro_workorder_source_type', // MES 工单来源类型
|
||||
MES_PRO_WORKORDER_TYPE = 'mes_pro_workorder_type' // MES 工单类型
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,8 +74,7 @@
|
|||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<!-- TODO @AI:枚举类 -->
|
||||
<el-col :span="8" v-if="formData.shiftType && formData.shiftType !== 1">
|
||||
<el-col :span="8" v-if="formData.shiftType && formData.shiftType !== MesCalShiftTypeEnum.SINGLE">
|
||||
<el-form-item label="倒班方式" prop="shiftMethod">
|
||||
<el-select v-model="formData.shiftMethod" placeholder="请选择倒班方式" class="!w-1/1">
|
||||
<el-option
|
||||
|
|
@ -87,8 +86,7 @@
|
|||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- TODO @AI:枚举类 -->
|
||||
<el-col :span="8" v-if="formData.shiftMethod === 4">
|
||||
<el-col :span="8" v-if="formData.shiftMethod === MesCalShiftMethodEnum.DAY">
|
||||
<el-form-item label="倒班天数" prop="shiftCount">
|
||||
<el-input-number
|
||||
v-model="formData.shiftCount"
|
||||
|
|
@ -123,9 +121,8 @@
|
|||
</el-tabs>
|
||||
<template #footer>
|
||||
<!-- 确认按钮:仅草稿状态显示 -->
|
||||
<!-- TODO @AI:status 枚举 -->
|
||||
<el-button
|
||||
v-if="formType === 'update' && formData.status === 0"
|
||||
v-if="formType === 'update' && formData.status === MesCalPlanStatusEnum.PREPARE"
|
||||
type="warning"
|
||||
@click="handleConfirm"
|
||||
:disabled="formLoading"
|
||||
|
|
@ -142,6 +139,7 @@
|
|||
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||
import { CalPlanApi, CalPlanVO } from '@/api/mes/cal/plan'
|
||||
import { generateRandomStr } from '@/utils'
|
||||
import { MesCalPlanStatusEnum, MesCalShiftTypeEnum, MesCalShiftMethodEnum } from '@/views/mes/utils/constants'
|
||||
import CalShiftPanel from './CalShiftPanel.vue'
|
||||
import CalPlanTeamPanel from './CalPlanTeamPanel.vue'
|
||||
|
||||
|
|
@ -165,7 +163,7 @@ const formData = ref({
|
|||
shiftType: undefined,
|
||||
shiftMethod: undefined,
|
||||
shiftCount: undefined,
|
||||
status: 0,
|
||||
status: MesCalPlanStatusEnum.PREPARE,
|
||||
remark: undefined
|
||||
})
|
||||
const formRules = reactive({
|
||||
|
|
@ -223,10 +221,10 @@ const submitForm = async () => {
|
|||
/** 确认计划 */
|
||||
const handleConfirm = async () => {
|
||||
try {
|
||||
// TODO @AI:单独一个接口,更合适;
|
||||
await message.confirm('确认该排班计划?确认后将不可删除。')
|
||||
formLoading.value = true
|
||||
// TODO @AI:枚举类;
|
||||
const data = { ...formData.value, status: 1 } as unknown as CalPlanVO
|
||||
const data = { ...formData.value, status: MesCalPlanStatusEnum.CONFIRMED } as unknown as CalPlanVO
|
||||
await CalPlanApi.updatePlan(data)
|
||||
message.success('确认成功')
|
||||
dialogVisible.value = false
|
||||
|
|
@ -249,7 +247,7 @@ const resetForm = () => {
|
|||
shiftType: undefined,
|
||||
shiftMethod: undefined,
|
||||
shiftCount: undefined,
|
||||
status: 0, // TODO @AI:枚举类;
|
||||
status: MesCalPlanStatusEnum.PREPARE,
|
||||
remark: undefined
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
|
|
|
|||
|
|
@ -86,15 +86,18 @@ const openForm = (type: string) => {
|
|||
|
||||
/** 提交表单 */
|
||||
const submitForm = async () => {
|
||||
// 校验表单
|
||||
if (!formRef) return
|
||||
const valid = await formRef.value.validate()
|
||||
if (!valid) return
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = formData.value as unknown as CalPlanTeamVO
|
||||
await CalPlanTeamApi.createPlanTeam(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
dialogVisible.value = false
|
||||
// 刷新列表
|
||||
await getList()
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@
|
|||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { CalShiftApi, CalShiftVO } from '@/api/mes/cal/shift'
|
||||
import { CalPlanShiftApi, CalPlanShiftVO } from '@/api/mes/cal/shift'
|
||||
|
||||
const props = defineProps<{
|
||||
planId: number // 排班计划编号
|
||||
|
|
@ -66,13 +66,13 @@ const { t } = useI18n() // 国际化
|
|||
const message = useMessage() // 消息弹窗
|
||||
|
||||
const loading = ref(false) // 列表加载中
|
||||
const list = ref<CalShiftVO[]>([]) // 班次列表
|
||||
const list = ref<CalPlanShiftVO[]>([]) // 班次列表
|
||||
|
||||
/** 加载列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
list.value = await CalShiftApi.getShiftListByPlan(props.planId)
|
||||
list.value = await CalPlanShiftApi.getPlanShiftListByPlan(props.planId)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
|
|
@ -101,12 +101,13 @@ const formRules = reactive({
|
|||
})
|
||||
|
||||
/** 打开表单弹窗 */
|
||||
// TODO @AI:参考别的模块,方法里,应该有注释
|
||||
const openForm = (type: string, row?: CalShiftVO) => {
|
||||
const openForm = (type: string, row?: CalPlanShiftVO) => {
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = t('action.' + type)
|
||||
formType.value = type
|
||||
// 重置表单
|
||||
resetForm()
|
||||
// 修改时,设置数据
|
||||
if (type === 'update' && row) {
|
||||
formData.value = {
|
||||
id: row.id,
|
||||
|
|
@ -121,22 +122,24 @@ const openForm = (type: string, row?: CalShiftVO) => {
|
|||
}
|
||||
|
||||
/** 提交表单 */
|
||||
// TODO @AI:参考别的模块,方法里,应该有注释
|
||||
const submitForm = async () => {
|
||||
// 校验表单
|
||||
if (!formRef) return
|
||||
const valid = await formRef.value.validate()
|
||||
if (!valid) return
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = formData.value as unknown as CalShiftVO
|
||||
const data = formData.value as unknown as CalPlanShiftVO
|
||||
if (formType.value === 'create') {
|
||||
await CalShiftApi.createShift(data)
|
||||
await CalPlanShiftApi.createPlanShift(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
await CalShiftApi.updateShift(data)
|
||||
await CalPlanShiftApi.updatePlanShift(data)
|
||||
message.success(t('common.updateSuccess'))
|
||||
}
|
||||
dialogVisible.value = false
|
||||
// 刷新列表
|
||||
await getList()
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
|
|
@ -161,7 +164,7 @@ const resetForm = () => {
|
|||
const handleDelete = async (id: number) => {
|
||||
try {
|
||||
await message.delConfirm()
|
||||
await CalShiftApi.deleteShift(id)
|
||||
await CalPlanShiftApi.deletePlanShift(id)
|
||||
message.success('删除成功')
|
||||
await getList()
|
||||
} catch {}
|
||||
|
|
|
|||
|
|
@ -85,8 +85,20 @@
|
|||
<dict-tag :type="DICT_TYPE.MES_CAL_CALENDAR_TYPE" :value="scope.row.calendarType" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="开始日期" align="center" prop="startDate" :formatter="dateFormatter" width="180px" />
|
||||
<el-table-column label="结束日期" align="center" prop="endDate" :formatter="dateFormatter" width="180px" />
|
||||
<el-table-column
|
||||
label="开始日期"
|
||||
align="center"
|
||||
prop="startDate"
|
||||
:formatter="dateFormatter"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column
|
||||
label="结束日期"
|
||||
align="center"
|
||||
prop="endDate"
|
||||
:formatter="dateFormatter"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column label="轮班方式" align="center" prop="shiftType" min-width="100">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.MES_CAL_SHIFT_TYPE" :value="scope.row.shiftType" />
|
||||
|
|
@ -112,6 +124,7 @@
|
|||
<el-table-column label="操作" align="center" width="150">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
v-if="scope.row.status === MesCalPlanStatusEnum.PREPARE"
|
||||
link
|
||||
type="primary"
|
||||
@click="openForm('update', scope.row.id)"
|
||||
|
|
|
|||
|
|
@ -1,128 +0,0 @@
|
|||
<!-- TODO @AI:是不是不用这个??? -->
|
||||
<template>
|
||||
<Dialog :title="dialogTitle" v-model="dialogVisible" width="600px">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
label-width="100px"
|
||||
v-loading="formLoading"
|
||||
>
|
||||
<el-form-item label="排班计划" prop="planId">
|
||||
<el-input-number
|
||||
v-model="formData.planId"
|
||||
placeholder="请输入排班计划编号"
|
||||
class="!w-1/1"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="显示顺序" prop="sort">
|
||||
<el-input-number
|
||||
v-model="formData.sort"
|
||||
:min="1"
|
||||
controls-position="right"
|
||||
class="!w-1/1"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="班次名称" prop="name">
|
||||
<el-input v-model="formData.name" placeholder="请输入班次名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="开始时间" prop="startTime">
|
||||
<el-input v-model="formData.startTime" placeholder="请输入开始时间(如 08:00)" />
|
||||
</el-form-item>
|
||||
<el-form-item label="结束时间" prop="endTime">
|
||||
<el-input v-model="formData.endTime" placeholder="请输入结束时间(如 17:00)" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="formData.remark" type="textarea" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { CalShiftApi, CalShiftVO } from '@/api/mes/cal/shift'
|
||||
|
||||
defineOptions({ name: 'CalShiftForm' })
|
||||
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||
const dialogTitle = ref('') // 弹窗的标题
|
||||
const formLoading = ref(false) // 表单的加载中
|
||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||
const formData = ref({
|
||||
id: undefined,
|
||||
planId: undefined,
|
||||
sort: 1,
|
||||
name: undefined,
|
||||
startTime: undefined,
|
||||
endTime: undefined,
|
||||
remark: undefined
|
||||
})
|
||||
const formRules = reactive({
|
||||
planId: [{ required: true, message: '排班计划不能为空', trigger: 'blur' }],
|
||||
sort: [{ required: true, message: '显示顺序不能为空', trigger: 'blur' }],
|
||||
name: [{ required: true, message: '班次名称不能为空', trigger: 'blur' }],
|
||||
startTime: [{ required: true, message: '开始时间不能为空', trigger: 'blur' }],
|
||||
endTime: [{ required: true, message: '结束时间不能为空', trigger: 'blur' }]
|
||||
})
|
||||
const formRef = ref()
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (type: string, id?: number) => {
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = t('action.' + type)
|
||||
formType.value = type
|
||||
resetForm()
|
||||
// 修改时,设置数据
|
||||
if (id) {
|
||||
formLoading.value = true
|
||||
try {
|
||||
formData.value = await CalShiftApi.getShift(id)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
defineExpose({ open })
|
||||
|
||||
/** 提交表单 */
|
||||
const emit = defineEmits(['success'])
|
||||
const submitForm = async () => {
|
||||
await formRef.value.validate()
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = formData.value as unknown as CalShiftVO
|
||||
if (formType.value === 'create') {
|
||||
await CalShiftApi.createShift(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
await CalShiftApi.updateShift(data)
|
||||
message.success(t('common.updateSuccess'))
|
||||
}
|
||||
dialogVisible.value = false
|
||||
emit('success')
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
id: undefined,
|
||||
planId: undefined,
|
||||
sort: 1,
|
||||
name: undefined,
|
||||
startTime: undefined,
|
||||
endTime: undefined,
|
||||
remark: undefined
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
</script>
|
||||
|
|
@ -1,185 +0,0 @@
|
|||
<!-- TODO @AI:是不是不用这个??? -->
|
||||
<template>
|
||||
<ContentWrap>
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form
|
||||
class="-mb-15px"
|
||||
:model="queryParams"
|
||||
ref="queryFormRef"
|
||||
:inline="true"
|
||||
label-width="85px"
|
||||
>
|
||||
<el-form-item label="排班计划" prop="planId">
|
||||
<el-input
|
||||
v-model="queryParams.planId"
|
||||
placeholder="请输入排班计划编号"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="班次名称" prop="name">
|
||||
<el-input
|
||||
v-model="queryParams.name"
|
||||
placeholder="请输入班次名称"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
||||
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
@click="openForm('create')"
|
||||
v-hasPermi="['mes:cal-shift:create']"
|
||||
>
|
||||
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
||||
</el-button>
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
@click="handleExport"
|
||||
:loading="exportLoading"
|
||||
v-hasPermi="['mes:cal-shift:export']"
|
||||
>
|
||||
<Icon icon="ep:download" class="mr-5px" /> 导出
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</ContentWrap>
|
||||
|
||||
<!-- 列表 -->
|
||||
<ContentWrap>
|
||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
||||
<el-table-column label="班次编号" align="center" prop="id" width="100" />
|
||||
<el-table-column label="排班计划编号" align="center" prop="planId" width="120" />
|
||||
<el-table-column label="显示顺序" align="center" prop="sort" width="100" />
|
||||
<el-table-column label="班次名称" align="center" prop="name" min-width="120" />
|
||||
<el-table-column label="开始时间" align="center" prop="startTime" width="100" />
|
||||
<el-table-column label="结束时间" align="center" prop="endTime" width="100" />
|
||||
<el-table-column label="备注" align="center" prop="remark" min-width="150" />
|
||||
<el-table-column
|
||||
label="创建时间"
|
||||
align="center"
|
||||
prop="createTime"
|
||||
:formatter="dateFormatter"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column label="操作" align="center" width="150">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
@click="openForm('update', scope.row.id)"
|
||||
v-hasPermi="['mes:cal-shift:update']"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="danger"
|
||||
@click="handleDelete(scope.row.id)"
|
||||
v-hasPermi="['mes:cal-shift:delete']"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
<Pagination
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNo"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</ContentWrap>
|
||||
|
||||
<!-- 表单弹窗:添加/修改 -->
|
||||
<CalShiftForm ref="formRef" @success="getList" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
import download from '@/utils/download'
|
||||
import { CalShiftApi, CalShiftVO } from '@/api/mes/cal/shift'
|
||||
import CalShiftForm from './CalShiftForm.vue'
|
||||
|
||||
defineOptions({ name: 'MesCalShift' })
|
||||
|
||||
const message = useMessage() // 消息弹窗
|
||||
const { t } = useI18n() // 国际化
|
||||
|
||||
const loading = ref(true) // 列表的加载中
|
||||
const list = ref<CalShiftVO[]>([]) // 列表的数据
|
||||
const total = ref(0) // 列表的总页数
|
||||
const queryParams = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
planId: undefined,
|
||||
name: undefined
|
||||
})
|
||||
const queryFormRef = ref() // 搜索的表单
|
||||
const exportLoading = ref(false) // 导出的加载中
|
||||
|
||||
/** 查询列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await CalShiftApi.getShiftPage(queryParams)
|
||||
list.value = data.list
|
||||
total.value = data.total
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.pageNo = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value.resetFields()
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
/** 添加/修改操作 */
|
||||
const formRef = ref()
|
||||
const openForm = (type: string, id?: number) => {
|
||||
formRef.value.open(type, id)
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (id: number) => {
|
||||
try {
|
||||
await message.delConfirm()
|
||||
await CalShiftApi.deleteShift(id)
|
||||
message.success(t('common.delSuccess'))
|
||||
await getList()
|
||||
} catch {}
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = async () => {
|
||||
try {
|
||||
await message.exportConfirm()
|
||||
exportLoading.value = true
|
||||
const data = await CalShiftApi.exportShift(queryParams)
|
||||
download.excel(data, '计划班次.xls')
|
||||
} catch {
|
||||
} finally {
|
||||
exportLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 初始化 **/
|
||||
onMounted(async () => {
|
||||
await getList()
|
||||
})
|
||||
</script>
|
||||
|
|
@ -58,6 +58,14 @@ export const MesCalShiftMethodEnum = {
|
|||
DAY: 4 // 按天
|
||||
}
|
||||
|
||||
/** MES 生产工单状态枚举 */
|
||||
export const MesProWorkorderStatusEnum = {
|
||||
PREPARE: 0, // 草稿
|
||||
CONFIRMED: 1, // 已确认
|
||||
FINISHED: 2, // 已完成
|
||||
CANCELED: 3 // 已取消
|
||||
}
|
||||
|
||||
/** 获取物料/产品标识的标签 */
|
||||
export const getItemOrProductLabel = (value: string): string => {
|
||||
for (const item of Object.values(MesItemOrProductEnum)) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue