review(mes):pro-process 的初步实现 50%

pull/871/MERGE
YunaiV 2026-02-18 15:47:18 +08:00
parent 3c198013ba
commit 67e6e59120
8 changed files with 470 additions and 78 deletions

View File

@ -0,0 +1,44 @@
import request from '@/config/axios'
// MES 班组成员 VO
export interface CalTeamMemberVO {
id: number
teamId: number // 班组编号
userId: number // 用户编号
userName: string // 用户名称(关联查询)
nickname: string // 用户昵称(关联查询)
telephone: string // 用户手机号(关联查询)
remark: string // 备注
attribute1: string
attribute2: string
attribute3: number
attribute4: number
}
// MES 班组成员 API
export const CalTeamMemberApi = {
// 创建班组成员
createTeamMember: async (data: CalTeamMemberVO) => {
return await request.post({ url: `/mes/cal/team-member/create`, data })
},
// 删除班组成员
deleteTeamMember: async (id: number) => {
return await request.delete({ url: `/mes/cal/team-member/delete?id=` + id })
},
// 查询班组成员分页
getTeamMemberPage: async (params: any) => {
return await request.get({ url: `/mes/cal/team-member/page`, params })
},
// 查询指定班组的成员列表
getTeamMemberListByTeam: async (teamId: number) => {
return await request.get({ url: `/mes/cal/team-member/list-by-team`, params: { teamId } })
},
// 查询多个班组的成员列表
getTeamMemberListByTeamIds: async (teamIds: number[]) => {
return await request.get({ url: `/mes/cal/team-member/list-by-team`, params: { teamIds: teamIds.join(',') } })
}
}

View File

@ -0,0 +1,26 @@
import request from '@/config/axios'
// MES 班组排班 VO
export interface CalTeamShiftVO {
id: number
planId: number // 排班计划编号
teamId: number // 班组编号
shiftId: number // 班次编号
day: number // 日期
sort: number // 排序
teamName: string // 班组名称(关联查询)
shiftName: string // 班次名称(关联查询)
remark: string // 备注
attribute1: string
attribute2: string
attribute3: number
attribute4: number
}
// MES 班组排班 API
export const CalTeamShiftApi = {
// 查询班组排班列表
getTeamShiftList: async (params: any) => {
return await request.get({ url: `/mes/cal/team-shift/list`, params })
}
}

View File

@ -0,0 +1,42 @@
import request from '@/config/axios'
// MES 生产工序内容 VO
export interface ProProcessContentVO {
id?: number // 编号
processId: number // 工序编号
sort: number // 顺序编号
content?: string // 步骤说明
device?: string // 辅助设备
material?: string // 辅助材料
docUrl?: string // 材料文档 URL
remark?: string // 备注
createTime?: Date // 创建时间
}
// MES 生产工序内容 API
export const ProProcessContentApi = {
// 查询工序内容列表(按工序编号)
getProcessContentListByProcessId: async (processId: number) => {
return await request.get({ url: `/mes/pro/process-content/list-by-process?processId=` + processId })
},
// 查询工序内容详情
getProcessContent: async (id: number) => {
return await request.get({ url: `/mes/pro/process-content/get?id=` + id })
},
// 新增工序内容
createProcessContent: async (data: ProProcessContentVO) => {
return await request.post({ url: `/mes/pro/process-content/create`, data })
},
// 修改工序内容
updateProcessContent: async (data: ProProcessContentVO) => {
return await request.put({ url: `/mes/pro/process-content/update`, data })
},
// 删除工序内容
deleteProcessContent: async (id: number) => {
return await request.delete({ url: `/mes/pro/process-content/delete?id=` + id })
}
}

View File

@ -0,0 +1,86 @@
<template>
<Dialog title="添加成员" v-model="dialogVisible" width="500px">
<el-form
ref="formRef"
:model="formData"
:rules="formRules"
label-width="80px"
v-loading="formLoading"
>
<el-form-item label="用户" prop="userId">
<el-select
v-model="formData.userId"
placeholder="请选择用户"
filterable
class="!w-1/1"
>
<el-option
v-for="user in userList"
:key="user.id"
:label="user.nickname"
:value="user.id"
/>
</el-select>
</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 { CalTeamMemberApi, CalTeamMemberVO } from '@/api/mes/cal/team/member'
import { getSimpleUserList } from '@/api/system/user'
import type { UserVO } from '@/api/system/user'
defineOptions({ name: 'CalTeamMemberForm' })
const emit = defineEmits<{ success: [] }>()
const { t } = useI18n()
const message = useMessage()
const dialogVisible = ref(false)
const formLoading = ref(false)
const formRef = ref()
const userList = ref<UserVO[]>([])
const formData = ref({
teamId: undefined as number | undefined,
userId: undefined as number | undefined,
remark: undefined as string | undefined
})
const formRules = reactive({
userId: [{ required: true, message: '用户不能为空', trigger: 'change' }]
})
/** 打开弹窗 */
const open = async (teamId: number) => {
dialogVisible.value = true
formData.value = { teamId, userId: undefined, remark: undefined }
formRef.value?.resetFields()
userList.value = await getSimpleUserList()
}
defineExpose({ open })
/** 提交表单 */
const submitForm = async () => {
if (!formRef) return
const valid = await formRef.value.validate()
if (!valid) return
formLoading.value = true
try {
await CalTeamMemberApi.createTeamMember(formData.value as unknown as CalTeamMemberVO)
message.success(t('common.createSuccess'))
dialogVisible.value = false
emit('success')
} finally {
formLoading.value = false
}
}
</script>

View File

@ -0,0 +1,70 @@
<template>
<div>
<el-button type="primary" plain size="small" @click="openForm()" class="mb-10px">
<Icon icon="ep:plus" class="mr-5px" /> 添加成员
</el-button>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true" border>
<el-table-column label="用户编号" align="center" prop="userId" width="100" />
<el-table-column label="用户昵称" align="center" prop="nickname" min-width="120" />
<el-table-column label="手机号" align="center" prop="telephone" min-width="120" />
<el-table-column label="备注" align="center" prop="remark" min-width="150" />
<el-table-column label="操作" align="center" width="80">
<template #default="scope">
<el-button link type="danger" @click="handleDelete(scope.row.id)"></el-button>
</template>
</el-table-column>
</el-table>
<CalTeamMemberForm ref="formRef" @success="getList" />
</div>
</template>
<script setup lang="ts">
import { CalTeamMemberApi, CalTeamMemberVO } from '@/api/mes/cal/team/member'
import CalTeamMemberForm from './CalTeamMemberForm.vue'
const props = defineProps<{
teamId: number //
}>()
const message = useMessage()
const loading = ref(false)
const list = ref<CalTeamMemberVO[]>([])
const formRef = ref<InstanceType<typeof CalTeamMemberForm>>()
/** 加载列表 */
const getList = async () => {
loading.value = true
try {
list.value = await CalTeamMemberApi.getTeamMemberListByTeam(props.teamId)
} finally {
loading.value = false
}
}
/** 打开添加弹窗 */
const openForm = () => {
formRef.value?.open(props.teamId)
}
/** 删除 */
const handleDelete = async (id: number) => {
try {
await message.delConfirm()
await CalTeamMemberApi.deleteTeamMember(id)
message.success('删除成功')
await getList()
} catch {}
}
watch(
() => props.teamId,
(val) => {
if (val) {
getList()
}
},
{ immediate: true }
)
</script>

View File

@ -0,0 +1,176 @@
<!-- MES 生产工序内容操作步骤子组件 -->
<template>
<div>
<!-- 操作栏 -->
<el-row class="mb-10px">
<el-button type="primary" plain @click="openContentForm('create')">
<Icon icon="ep:plus" class="mr-5px" /> 添加步骤
</el-button>
</el-row>
<!-- 步骤列表 -->
<el-table v-loading="loading" :data="contentList" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="序号" align="center" prop="sort" width="80" />
<el-table-column label="步骤说明" align="center" prop="content" min-width="200" />
<el-table-column label="辅助设备" align="center" prop="device" width="150" />
<el-table-column label="辅助材料" align="center" prop="material" width="150" />
<el-table-column label="材料文档" align="center" prop="docUrl" width="150" />
<el-table-column label="备注" align="center" prop="remark" min-width="120" />
<el-table-column label="操作" align="center" width="130">
<template #default="scope">
<el-button link type="primary" @click="openContentForm('update', scope.row)">编辑</el-button>
<el-button link type="danger" @click="handleDeleteContent(scope.row.id)"></el-button>
</template>
</el-table-column>
</el-table>
<!-- 步骤表单弹窗 -->
<Dialog :title="contentDialogTitle" v-model="contentDialogVisible" width="600px">
<el-form
ref="contentFormRef"
:model="contentFormData"
:rules="contentFormRules"
label-width="100px"
v-loading="contentFormLoading"
>
<el-form-item label="序号" prop="sort">
<el-input-number
v-model="contentFormData.sort"
:min="1"
:max="999"
controls-position="right"
class="!w-1/1"
/>
</el-form-item>
<el-form-item label="步骤说明" prop="content">
<el-input
v-model="contentFormData.content"
type="textarea"
:rows="3"
placeholder="请输入步骤说明"
/>
</el-form-item>
<el-form-item label="辅助设备" prop="device">
<el-input v-model="contentFormData.device" placeholder="请输入辅助设备" />
</el-form-item>
<el-form-item label="辅助材料" prop="material">
<el-input v-model="contentFormData.material" placeholder="请输入辅助材料" />
</el-form-item>
<el-form-item label="材料文档 URL" prop="docUrl">
<el-input v-model="contentFormData.docUrl" placeholder="请输入材料文档 URL" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="contentFormData.remark" type="textarea" placeholder="请输入备注" />
</el-form-item>
</el-form>
<template #footer>
<el-button @click="submitContentForm" type="primary" :loading="contentFormLoading"> </el-button>
<el-button @click="contentDialogVisible = false"> </el-button>
</template>
</Dialog>
</div>
</template>
<script setup lang="ts">
import { ProProcessContentApi, ProProcessContentVO } from '@/api/mes/pro/process/content'
defineOptions({ name: 'ProProcessContentTable' })
const props = defineProps<{
processId: number
}>()
const message = useMessage()
const { t } = useI18n()
// ==================== ====================
const loading = ref(false)
const contentList = ref<ProProcessContentVO[]>([])
/** 查询步骤列表 */
const getContentList = async () => {
loading.value = true
try {
contentList.value = await ProProcessContentApi.getProcessContentListByProcessId(props.processId)
} finally {
loading.value = false
}
}
/** 删除步骤 */
const handleDeleteContent = async (id: number) => {
try {
await message.delConfirm()
await ProProcessContentApi.deleteProcessContent(id)
message.success(t('common.delSuccess'))
await getContentList()
} catch {}
}
// ==================== ====================
const contentDialogVisible = ref(false)
const contentDialogTitle = ref('')
const contentFormLoading = ref(false)
const contentFormType = ref('')
const contentFormData = ref<Partial<ProProcessContentVO>>({
id: undefined,
processId: undefined,
sort: 1,
content: '',
device: '',
material: '',
docUrl: '',
remark: ''
})
const contentFormRules = reactive({
sort: [{ required: true, message: '序号不能为空', trigger: 'blur' }]
})
const contentFormRef = ref()
/** 打开步骤表单弹窗 */
const openContentForm = async (type: string, row?: ProProcessContentVO) => {
contentDialogVisible.value = true
contentDialogTitle.value = type === 'create' ? '添加操作步骤' : '编辑操作步骤'
contentFormType.value = type
//
const maxSort = contentList.value.reduce((max, item) => Math.max(max, item.sort || 0), 0)
contentFormData.value = {
id: undefined,
processId: props.processId,
sort: maxSort + 1,
content: '',
device: '',
material: '',
docUrl: '',
remark: ''
}
//
if (row) {
contentFormData.value = { ...row }
}
}
/** 提交步骤表单 */
const submitContentForm = async () => {
await contentFormRef.value.validate()
contentFormLoading.value = true
try {
const data = contentFormData.value as ProProcessContentVO
if (contentFormType.value === 'create') {
await ProProcessContentApi.createProcessContent(data)
message.success(t('common.createSuccess'))
} else {
await ProProcessContentApi.updateProcessContent(data)
message.success(t('common.updateSuccess'))
}
contentDialogVisible.value = false
await getContentList()
} finally {
contentFormLoading.value = false
}
}
// ==================== ====================
onMounted(async () => {
await getContentList()
})
</script>

View File

@ -1,6 +1,6 @@
<!-- MES 生产工序表单 -->
<template>
<Dialog :title="dialogTitle" v-model="dialogVisible" width="900px">
<Dialog :title="dialogTitle" v-model="dialogVisible" width="700px">
<el-form
ref="formRef"
:model="formData"
@ -10,6 +10,7 @@
>
<el-row :gutter="20">
<el-col :span="12">
<!-- TODO @AI生成 -->
<el-form-item label="工序编码" prop="code">
<el-input v-model="formData.code" placeholder="请输入工序编码" />
</el-form-item>
@ -35,6 +36,7 @@
</el-form-item>
</el-col>
</el-row>
<!-- TODO @AI工序说明应该是这个文字 -->
<el-form-item label="工艺要求" prop="attention">
<el-input
v-model="formData.attention"
@ -46,52 +48,7 @@
<el-form-item label="备注" prop="remark">
<el-input v-model="formData.remark" type="textarea" placeholder="请输入备注" />
</el-form-item>
<!-- 工序内容操作步骤 -->
<el-divider content-position="left">操作步骤</el-divider>
<el-table :data="formData.contents" border style="width: 100%">
<el-table-column label="序号" align="center" width="80">
<template #default="scope">
<el-input-number
v-model="scope.row.sort"
:min="1"
:max="999"
controls-position="right"
size="small"
/>
</template>
</el-table-column>
<el-table-column label="步骤说明" align="center" min-width="200">
<template #default="scope">
<el-input v-model="scope.row.content" type="textarea" :rows="2" placeholder="请输入步骤说明" />
</template>
</el-table-column>
<el-table-column label="辅助设备" align="center" width="150">
<template #default="scope">
<el-input v-model="scope.row.device" placeholder="请输入辅助设备" />
</template>
</el-table-column>
<el-table-column label="辅助材料" align="center" width="150">
<template #default="scope">
<el-input v-model="scope.row.material" placeholder="请输入辅助材料" />
</template>
</el-table-column>
<el-table-column label="材料文档" align="center" width="150">
<template #default="scope">
<el-input v-model="scope.row.docUrl" placeholder="请输入文档 URL" />
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="80">
<template #default="scope">
<el-button link type="danger" @click="handleDeleteContent(scope.$index)">
删除
</el-button>
</template>
</el-table-column>
</el-table>
<el-button type="primary" plain class="mt-10px" @click="handleAddContent">
<Icon icon="ep:plus" class="mr-5px" /> 添加步骤
</el-button>
<!-- 标记时支持添加操作步骤对齐 ktg也类似别的模块 ContentList + ContentForm -->
</el-form>
<template #footer>
<el-button @click="dialogVisible = false"> </el-button>
@ -102,7 +59,7 @@
<script setup lang="ts">
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
import { ProProcessApi, ProProcessVO, ProProcessContentVO } from '@/api/mes/pro/process'
import { ProProcessApi, ProProcessVO } from '@/api/mes/pro/process'
defineOptions({ name: 'ProProcessForm' })
@ -119,8 +76,7 @@ const formData = ref<ProProcessVO>({
name: '',
attention: '',
status: 0,
remark: '',
contents: []
remark: ''
})
const formRules = reactive({
code: [{ required: true, message: '工序编码不能为空', trigger: 'blur' }],
@ -140,10 +96,6 @@ const open = async (type: string, id?: number) => {
formLoading.value = true
try {
formData.value = await ProProcessApi.getProcess(id)
// contents
if (!formData.value.contents) {
formData.value.contents = []
}
} finally {
formLoading.value = false
}
@ -185,30 +137,8 @@ const resetForm = () => {
name: '',
attention: '',
status: 0,
remark: '',
contents: []
remark: ''
}
formRef.value?.resetFields()
}
/** 添加操作步骤 */
const handleAddContent = () => {
if (!formData.value.contents) {
formData.value.contents = []
}
const maxSort = formData.value.contents.reduce((max, item) => Math.max(max, item.sort || 0), 0)
formData.value.contents.push({
sort: maxSort + 1,
content: '',
device: '',
material: '',
docUrl: '',
remark: ''
})
}
/** 删除操作步骤 */
const handleDeleteContent = (index: number) => {
formData.value.contents?.splice(index, 1)
}
</script>

View File

@ -72,9 +72,26 @@
<!-- 列表 -->
<ContentWrap>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table
v-loading="loading"
:data="list"
:stripe="true"
:show-overflow-tooltip="true"
row-key="id"
>
<!-- 展开行操作步骤 -->
<!-- TODO @AI不需要这个交互 ktg 对齐 -->
<el-table-column type="expand">
<template #default="scope">
<div class="px-40px py-10px">
<div class="mb-10px font-bold text-gray-600">操作步骤</div>
<ProProcessContentTable :processId="scope.row.id" />
</div>
</template>
</el-table-column>
<el-table-column label="工序编码" align="center" prop="code" width="150" />
<el-table-column label="工序名称" align="center" prop="name" width="200" />
<!-- TODO @AI去掉要求 -->
<el-table-column label="工艺要求" align="center" prop="attention" show-overflow-tooltip />
<el-table-column label="状态" align="center" prop="status" width="100">
<template #default="scope">
@ -129,6 +146,7 @@ import { dateFormatter } from '@/utils/formatTime'
import download from '@/utils/download'
import { ProProcessApi, ProProcessVO } from '@/api/mes/pro/process'
import ProProcessForm from './ProProcessForm.vue'
import ProProcessContentTable from './ProProcessContentTable.vue'
defineOptions({ name: 'MesProProcess' })