refactor(mes): 合并子列表 Form 到 List 组件,统一 Panel 重命名为 List
1. 合并 4 对 Form→List:将独立的 *Form.vue 弹窗组件内联到对应的 *List.vue 中 - TemplateIndicatorForm → TemplateIndicatorList - TemplateItemForm → TemplateItemList - CalTeamMemberForm → CalTeamMemberList - ProProcessContentForm → ProProcessContentList 2. 重命名 5 个 Panel→List,更新引用方 import - WorkstationMachinePanel → WorkstationMachineList - WorkstationToolPanel → WorkstationToolList - WorkstationWorkerPanel → WorkstationWorkerList - CalPlanTeamPanel → CalPlanTeamList - CalShiftPanel → CalShiftList 3. 统一 9 个子列表组件的注释风格 - 补全文件头注释、defineOptions、模板区域注释 - 统一分隔线、JSDoc、变量行尾注释、watch 注释 - 去掉多余的闭合行尾注释 4. 修复 WorkstationToolList 中 createSuccess/updateSuccess 提示写反的 bugpull/871/MERGE
parent
e94f2d4fee
commit
1c0cbc0dc6
|
|
@ -113,10 +113,10 @@
|
||||||
<!-- 编辑时显示子资源 Tab -->
|
<!-- 编辑时显示子资源 Tab -->
|
||||||
<el-tabs v-if="formType === 'update'" v-model="activeTab" class="mt-10px">
|
<el-tabs v-if="formType === 'update'" v-model="activeTab" class="mt-10px">
|
||||||
<el-tab-pane label="班次" name="shift">
|
<el-tab-pane label="班次" name="shift">
|
||||||
<CalShiftPanel :plan-id="formData.id!" />
|
<CalShiftList :plan-id="formData.id!" />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="班组" name="team">
|
<el-tab-pane label="班组" name="team">
|
||||||
<CalPlanTeamPanel :plan-id="formData.id!" />
|
<CalPlanTeamList :plan-id="formData.id!" />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
|
|
@ -140,8 +140,8 @@ import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||||
import { CalPlanApi, CalPlanVO } from '@/api/mes/cal/plan'
|
import { CalPlanApi, CalPlanVO } from '@/api/mes/cal/plan'
|
||||||
import { generateRandomStr } from '@/utils'
|
import { generateRandomStr } from '@/utils'
|
||||||
import { MesCalPlanStatusEnum, MesCalShiftTypeEnum, MesCalShiftMethodEnum } from '@/views/mes/utils/constants'
|
import { MesCalPlanStatusEnum, MesCalShiftTypeEnum, MesCalShiftMethodEnum } from '@/views/mes/utils/constants'
|
||||||
import CalShiftPanel from './CalShiftPanel.vue'
|
import CalShiftList from './CalShiftList.vue'
|
||||||
import CalPlanTeamPanel from './CalPlanTeamPanel.vue'
|
import CalPlanTeamList from './CalPlanTeamList.vue'
|
||||||
|
|
||||||
defineOptions({ name: 'CalPlanForm' })
|
defineOptions({ name: 'CalPlanForm' })
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,11 @@
|
||||||
|
<!-- MES 排班计划-班组 列表 -->
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
|
<!-- 操作栏 -->
|
||||||
<el-button type="primary" plain size="small" @click="openForm('create')" class="mb-10px">
|
<el-button type="primary" plain size="small" @click="openForm('create')" class="mb-10px">
|
||||||
<Icon icon="ep:plus" class="mr-5px" /> 添加班组
|
<Icon icon="ep:plus" class="mr-5px" /> 添加班组
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<!-- 列表 -->
|
||||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true" border>
|
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true" border>
|
||||||
<el-table-column label="班组编号" align="center" prop="teamId" width="120" />
|
<el-table-column label="班组编号" align="center" prop="teamId" width="120" />
|
||||||
<el-table-column label="班组编码" align="center" prop="teamCode" min-width="120" />
|
<el-table-column label="班组编码" align="center" prop="teamCode" min-width="120" />
|
||||||
|
|
@ -15,7 +18,7 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
<!-- 添加班组弹窗 -->
|
<!-- 表单弹窗:添加/修改 -->
|
||||||
<Dialog :title="dialogTitle" v-model="dialogVisible" width="500px">
|
<Dialog :title="dialogTitle" v-model="dialogVisible" width="500px">
|
||||||
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="80px" v-loading="formLoading">
|
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="80px" v-loading="formLoading">
|
||||||
<el-form-item label="班组" prop="teamId">
|
<el-form-item label="班组" prop="teamId">
|
||||||
|
|
@ -44,6 +47,8 @@
|
||||||
import { CalPlanTeamApi, CalPlanTeamVO } from '@/api/mes/cal/plan/team'
|
import { CalPlanTeamApi, CalPlanTeamVO } from '@/api/mes/cal/plan/team'
|
||||||
import { CalTeamApi, CalTeamVO } from '@/api/mes/cal/team'
|
import { CalTeamApi, CalTeamVO } from '@/api/mes/cal/team'
|
||||||
|
|
||||||
|
defineOptions({ name: 'CalPlanTeamList' })
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
planId: number // 排班计划编号
|
planId: number // 排班计划编号
|
||||||
}>()
|
}>()
|
||||||
|
|
@ -51,11 +56,11 @@ const props = defineProps<{
|
||||||
const { t } = useI18n() // 国际化
|
const { t } = useI18n() // 国际化
|
||||||
const message = useMessage() // 消息弹窗
|
const message = useMessage() // 消息弹窗
|
||||||
|
|
||||||
const loading = ref(false) // 列表加载中
|
const loading = ref(false) // 列表的加载中
|
||||||
const list = ref<CalPlanTeamVO[]>([]) // 班组列表
|
const list = ref<CalPlanTeamVO[]>([]) // 列表的数据
|
||||||
const teamList = ref<CalTeamVO[]>([]) // 班组下拉列表
|
const teamList = ref<CalTeamVO[]>([]) // 班组下拉列表
|
||||||
|
|
||||||
/** 加载列表 */
|
/** 查询列表 */
|
||||||
const getList = async () => {
|
const getList = async () => {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
try {
|
try {
|
||||||
|
|
@ -65,10 +70,10 @@ const getList = async () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==================== 添加班组 ====================
|
// ==================== 添加/修改 ====================
|
||||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||||
const dialogTitle = ref('') // 弹窗的标题
|
const dialogTitle = ref('') // 弹窗的标题
|
||||||
const formLoading = ref(false) // 表单的提交加载中
|
const formLoading = ref(false) // 表单的加载中
|
||||||
const formRef = ref() // 表单 Ref
|
const formRef = ref() // 表单 Ref
|
||||||
const formData = ref({
|
const formData = ref({
|
||||||
id: undefined as number | undefined,
|
id: undefined as number | undefined,
|
||||||
|
|
@ -130,6 +135,7 @@ const handleDelete = async (id: number) => {
|
||||||
} catch {}
|
} catch {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 监听 planId 变化,加载列表 */
|
||||||
watch(
|
watch(
|
||||||
() => props.planId,
|
() => props.planId,
|
||||||
(val) => {
|
(val) => {
|
||||||
|
|
@ -1,8 +1,11 @@
|
||||||
|
<!-- MES 排班计划-班次 列表 -->
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
|
<!-- 操作栏 -->
|
||||||
<el-button type="primary" plain size="small" @click="openForm('create')" class="mb-10px">
|
<el-button type="primary" plain size="small" @click="openForm('create')" class="mb-10px">
|
||||||
<Icon icon="ep:plus" class="mr-5px" /> 添加班次
|
<Icon icon="ep:plus" class="mr-5px" /> 添加班次
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<!-- 列表 -->
|
||||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true" border>
|
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true" border>
|
||||||
<el-table-column label="顺序" align="center" prop="sort" width="80" />
|
<el-table-column label="顺序" align="center" prop="sort" width="80" />
|
||||||
<el-table-column label="班次名称" align="center" prop="name" min-width="120" />
|
<el-table-column label="班次名称" align="center" prop="name" min-width="120" />
|
||||||
|
|
@ -17,7 +20,7 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
<!-- 添加/编辑班次弹窗 -->
|
<!-- 表单弹窗:添加/修改 -->
|
||||||
<Dialog :title="dialogTitle" v-model="dialogVisible" width="500px">
|
<Dialog :title="dialogTitle" v-model="dialogVisible" width="500px">
|
||||||
<el-form
|
<el-form
|
||||||
ref="formRef"
|
ref="formRef"
|
||||||
|
|
@ -58,6 +61,8 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { CalPlanShiftApi, CalPlanShiftVO } from '@/api/mes/cal/shift'
|
import { CalPlanShiftApi, CalPlanShiftVO } from '@/api/mes/cal/shift'
|
||||||
|
|
||||||
|
defineOptions({ name: 'CalShiftList' })
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
planId: number // 排班计划编号
|
planId: number // 排班计划编号
|
||||||
}>()
|
}>()
|
||||||
|
|
@ -65,10 +70,10 @@ const props = defineProps<{
|
||||||
const { t } = useI18n() // 国际化
|
const { t } = useI18n() // 国际化
|
||||||
const message = useMessage() // 消息弹窗
|
const message = useMessage() // 消息弹窗
|
||||||
|
|
||||||
const loading = ref(false) // 列表加载中
|
const loading = ref(false) // 列表的加载中
|
||||||
const list = ref<CalPlanShiftVO[]>([]) // 班次列表
|
const list = ref<CalPlanShiftVO[]>([]) // 列表的数据
|
||||||
|
|
||||||
/** 加载列表 */
|
/** 查询列表 */
|
||||||
const getList = async () => {
|
const getList = async () => {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
try {
|
try {
|
||||||
|
|
@ -78,11 +83,11 @@ const getList = async () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==================== 添加/编辑班次 ====================
|
// ==================== 添加/修改 ====================
|
||||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||||
const dialogTitle = ref('') // 弹窗的标题
|
const dialogTitle = ref('') // 弹窗的标题
|
||||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||||
const formLoading = ref(false) // 表单的提交加载中
|
const formLoading = ref(false) // 表单的加载中
|
||||||
const formRef = ref() // 表单 Ref
|
const formRef = ref() // 表单 Ref
|
||||||
const formData = ref({
|
const formData = ref({
|
||||||
id: undefined as number | undefined,
|
id: undefined as number | undefined,
|
||||||
|
|
@ -105,7 +110,6 @@ const openForm = (type: string, row?: CalPlanShiftVO) => {
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
dialogTitle.value = t('action.' + type)
|
dialogTitle.value = t('action.' + type)
|
||||||
formType.value = type
|
formType.value = type
|
||||||
// 重置表单
|
|
||||||
resetForm()
|
resetForm()
|
||||||
// 修改时,设置数据
|
// 修改时,设置数据
|
||||||
if (type === 'update' && row) {
|
if (type === 'update' && row) {
|
||||||
|
|
@ -170,6 +174,7 @@ const handleDelete = async (id: number) => {
|
||||||
} catch {}
|
} catch {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 监听 planId 变化,加载列表 */
|
||||||
watch(
|
watch(
|
||||||
() => props.planId,
|
() => props.planId,
|
||||||
(val) => {
|
(val) => {
|
||||||
|
|
@ -1,86 +0,0 @@
|
||||||
<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>
|
|
||||||
|
|
@ -21,7 +21,8 @@
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { CalTeamMemberApi, CalTeamMemberVO } from '@/api/mes/cal/team/member'
|
import { CalTeamMemberApi, CalTeamMemberVO } from '@/api/mes/cal/team/member'
|
||||||
import CalTeamMemberForm from './CalTeamMemberForm.vue'
|
import { getSimpleUserList } from '@/api/system/user'
|
||||||
|
import type { UserVO } from '@/api/system/user'
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
teamId: number // 班组编号
|
teamId: number // 班组编号
|
||||||
|
|
|
||||||
|
|
@ -110,13 +110,13 @@
|
||||||
<!-- 编辑时显示子资源 Tab -->
|
<!-- 编辑时显示子资源 Tab -->
|
||||||
<el-tabs v-if="formType === 'update'" v-model="activeTab" class="mt-10px">
|
<el-tabs v-if="formType === 'update'" v-model="activeTab" class="mt-10px">
|
||||||
<el-tab-pane label="设备资源" name="machine">
|
<el-tab-pane label="设备资源" name="machine">
|
||||||
<WorkstationMachinePanel :workstation-id="formData.id!" />
|
<WorkstationMachineList :workstation-id="formData.id!" />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="工装夹具" name="tool">
|
<el-tab-pane label="工装夹具" name="tool">
|
||||||
<WorkstationToolPanel :workstation-id="formData.id!" />
|
<WorkstationToolList :workstation-id="formData.id!" />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="人力资源" name="worker">
|
<el-tab-pane label="人力资源" name="worker">
|
||||||
<WorkstationWorkerPanel :workstation-id="formData.id!" />
|
<WorkstationWorkerList :workstation-id="formData.id!" />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
|
|
@ -135,9 +135,9 @@ import { WmWarehouseLocationApi, WmWarehouseLocationVO } from '@/api/mes/wm/ware
|
||||||
import { WmWarehouseAreaApi, WmWarehouseAreaVO } from '@/api/mes/wm/warehouse/area'
|
import { WmWarehouseAreaApi, WmWarehouseAreaVO } from '@/api/mes/wm/warehouse/area'
|
||||||
import { CommonStatusEnum } from '@/utils/constants'
|
import { CommonStatusEnum } from '@/utils/constants'
|
||||||
import { generateRandomStr } from '@/utils'
|
import { generateRandomStr } from '@/utils'
|
||||||
import WorkstationMachinePanel from './WorkstationMachinePanel.vue'
|
import WorkstationMachineList from './WorkstationMachineList.vue'
|
||||||
import WorkstationToolPanel from './WorkstationToolPanel.vue'
|
import WorkstationToolList from './WorkstationToolList.vue'
|
||||||
import WorkstationWorkerPanel from './WorkstationWorkerPanel.vue'
|
import WorkstationWorkerList from './WorkstationWorkerList.vue'
|
||||||
|
|
||||||
defineOptions({ name: 'WorkstationForm' })
|
defineOptions({ name: 'WorkstationForm' })
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,11 @@
|
||||||
|
<!-- MES 工作站-设备资源 列表 -->
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
|
<!-- 操作栏 -->
|
||||||
<el-button type="primary" plain size="small" @click="openForm('create')" class="mb-10px">
|
<el-button type="primary" plain size="small" @click="openForm('create')" class="mb-10px">
|
||||||
<Icon icon="ep:plus" class="mr-5px" /> 添加设备
|
<Icon icon="ep:plus" class="mr-5px" /> 添加设备
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<!-- 列表 -->
|
||||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true" border>
|
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true" border>
|
||||||
<el-table-column label="设备编号" align="center" prop="machineryId" />
|
<el-table-column label="设备编号" align="center" prop="machineryId" />
|
||||||
<el-table-column label="设备名称" align="center" prop="machineryName" />
|
<el-table-column label="设备名称" align="center" prop="machineryName" />
|
||||||
|
|
@ -15,7 +18,7 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
<!-- 添加设备弹窗 -->
|
<!-- 表单弹窗:添加/修改 -->
|
||||||
<Dialog :title="dialogTitle" v-model="dialogVisible" width="500px">
|
<Dialog :title="dialogTitle" v-model="dialogVisible" width="500px">
|
||||||
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="80px" v-loading="formLoading">
|
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="80px" v-loading="formLoading">
|
||||||
<el-form-item label="设备" prop="machineryId">
|
<el-form-item label="设备" prop="machineryId">
|
||||||
|
|
@ -49,6 +52,8 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { MdWorkstationMachineApi, MdWorkstationMachineVO } from '@/api/mes/md/workstation/machine'
|
import { MdWorkstationMachineApi, MdWorkstationMachineVO } from '@/api/mes/md/workstation/machine'
|
||||||
|
|
||||||
|
defineOptions({ name: 'WorkstationMachineList' })
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
workstationId: number // 工作站编号
|
workstationId: number // 工作站编号
|
||||||
}>()
|
}>()
|
||||||
|
|
@ -56,10 +61,10 @@ const props = defineProps<{
|
||||||
const { t } = useI18n() // 国际化
|
const { t } = useI18n() // 国际化
|
||||||
const message = useMessage() // 消息弹窗
|
const message = useMessage() // 消息弹窗
|
||||||
|
|
||||||
const loading = ref(false) // 列表加载中
|
const loading = ref(false) // 列表的加载中
|
||||||
const list = ref<MdWorkstationMachineVO[]>([]) // 设备资源列表
|
const list = ref<MdWorkstationMachineVO[]>([]) // 列表的数据
|
||||||
|
|
||||||
/** 加载列表 */
|
/** 查询列表 */
|
||||||
const getList = async () => {
|
const getList = async () => {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
try {
|
try {
|
||||||
|
|
@ -69,11 +74,11 @@ const getList = async () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==================== 添加设备 ====================
|
// ==================== 添加/修改 ====================
|
||||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||||
const dialogTitle = ref('') // 弹窗的标题
|
const dialogTitle = ref('') // 弹窗的标题
|
||||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||||
const formLoading = ref(false) // 表单的提交加载中
|
const formLoading = ref(false) // 表单的加载中
|
||||||
const formRef = ref() // 表单 Ref
|
const formRef = ref() // 表单 Ref
|
||||||
const formData = ref({
|
const formData = ref({
|
||||||
id: undefined as number | undefined,
|
id: undefined as number | undefined,
|
||||||
|
|
@ -81,11 +86,11 @@ const formData = ref({
|
||||||
machineryId: undefined as number | undefined,
|
machineryId: undefined as number | undefined,
|
||||||
quantity: 1,
|
quantity: 1,
|
||||||
remark: undefined as string | undefined
|
remark: undefined as string | undefined
|
||||||
}) // 表单数据
|
})
|
||||||
const formRules = reactive({
|
const formRules = reactive({
|
||||||
machineryId: [{ required: true, message: '设备不能为空', trigger: 'blur' }],
|
machineryId: [{ required: true, message: '设备不能为空', trigger: 'blur' }],
|
||||||
quantity: [{ required: true, message: '数量不能为空', trigger: 'blur' }]
|
quantity: [{ required: true, message: '数量不能为空', trigger: 'blur' }]
|
||||||
}) // 表单校验规则
|
})
|
||||||
|
|
||||||
/** 打开表单弹窗 */
|
/** 打开表单弹窗 */
|
||||||
const openForm = (type: string) => {
|
const openForm = (type: string) => {
|
||||||
|
|
@ -137,6 +142,7 @@ const handleDelete = async (id: number) => {
|
||||||
} catch {}
|
} catch {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 监听 workstationId 变化,加载列表 */
|
||||||
watch(
|
watch(
|
||||||
() => props.workstationId,
|
() => props.workstationId,
|
||||||
(val) => {
|
(val) => {
|
||||||
|
|
@ -1,8 +1,11 @@
|
||||||
|
<!-- MES 工作站-工装夹具 列表 -->
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
|
<!-- 操作栏 -->
|
||||||
<el-button type="primary" plain size="small" @click="openForm('create')" class="mb-10px">
|
<el-button type="primary" plain size="small" @click="openForm('create')" class="mb-10px">
|
||||||
<Icon icon="ep:plus" class="mr-5px" /> 添加工具
|
<Icon icon="ep:plus" class="mr-5px" /> 添加工具
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<!-- 列表 -->
|
||||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true" border>
|
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true" border>
|
||||||
<el-table-column label="工具类型编号" align="center" prop="toolTypeId" />
|
<el-table-column label="工具类型编号" align="center" prop="toolTypeId" />
|
||||||
<el-table-column label="工具类型名称" align="center" prop="toolTypeName" />
|
<el-table-column label="工具类型名称" align="center" prop="toolTypeName" />
|
||||||
|
|
@ -16,7 +19,7 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
<!-- 添加/编辑弹窗 -->
|
<!-- 表单弹窗:添加/修改 -->
|
||||||
<Dialog :title="dialogTitle" v-model="dialogVisible" width="500px">
|
<Dialog :title="dialogTitle" v-model="dialogVisible" width="500px">
|
||||||
<el-form
|
<el-form
|
||||||
ref="formRef"
|
ref="formRef"
|
||||||
|
|
@ -57,6 +60,8 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { MdWorkstationToolApi, MdWorkstationToolVO } from '@/api/mes/md/workstation/tool'
|
import { MdWorkstationToolApi, MdWorkstationToolVO } from '@/api/mes/md/workstation/tool'
|
||||||
|
|
||||||
|
defineOptions({ name: 'WorkstationToolList' })
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
workstationId: number // 工作站编号
|
workstationId: number // 工作站编号
|
||||||
}>()
|
}>()
|
||||||
|
|
@ -64,10 +69,10 @@ const props = defineProps<{
|
||||||
const { t } = useI18n() // 国际化
|
const { t } = useI18n() // 国际化
|
||||||
const message = useMessage() // 消息弹窗
|
const message = useMessage() // 消息弹窗
|
||||||
|
|
||||||
const loading = ref(false) // 列表加载中
|
const loading = ref(false) // 列表的加载中
|
||||||
const list = ref<MdWorkstationToolVO[]>([]) // 工装夹具资源列表
|
const list = ref<MdWorkstationToolVO[]>([]) // 列表的数据
|
||||||
|
|
||||||
/** 加载列表 */
|
/** 查询列表 */
|
||||||
const getList = async () => {
|
const getList = async () => {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
try {
|
try {
|
||||||
|
|
@ -77,11 +82,11 @@ const getList = async () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==================== 添加/编辑工具 ====================
|
// ==================== 添加/修改 ====================
|
||||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||||
const dialogTitle = ref('') // 弹窗的标题
|
const dialogTitle = ref('') // 弹窗的标题
|
||||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||||
const formLoading = ref(false) // 表单的提交加载中
|
const formLoading = ref(false) // 表单的加载中
|
||||||
const formRef = ref() // 表单 Ref
|
const formRef = ref() // 表单 Ref
|
||||||
const formData = ref({
|
const formData = ref({
|
||||||
id: undefined as number | undefined,
|
id: undefined as number | undefined,
|
||||||
|
|
@ -89,11 +94,11 @@ const formData = ref({
|
||||||
toolTypeId: undefined as number | undefined,
|
toolTypeId: undefined as number | undefined,
|
||||||
quantity: 1,
|
quantity: 1,
|
||||||
remark: undefined as string | undefined
|
remark: undefined as string | undefined
|
||||||
}) // 表单数据
|
})
|
||||||
const formRules = reactive({
|
const formRules = reactive({
|
||||||
toolTypeId: [{ required: true, message: '工具类型不能为空', trigger: 'blur' }],
|
toolTypeId: [{ required: true, message: '工具类型不能为空', trigger: 'blur' }],
|
||||||
quantity: [{ required: true, message: '数量不能为空', trigger: 'blur' }]
|
quantity: [{ required: true, message: '数量不能为空', trigger: 'blur' }]
|
||||||
}) // 表单校验规则
|
})
|
||||||
|
|
||||||
/** 打开表单弹窗 */
|
/** 打开表单弹窗 */
|
||||||
const openForm = (type: string, row?: MdWorkstationToolVO) => {
|
const openForm = (type: string, row?: MdWorkstationToolVO) => {
|
||||||
|
|
@ -101,7 +106,7 @@ const openForm = (type: string, row?: MdWorkstationToolVO) => {
|
||||||
dialogTitle.value = t('action.' + type)
|
dialogTitle.value = t('action.' + type)
|
||||||
formType.value = type
|
formType.value = type
|
||||||
resetForm()
|
resetForm()
|
||||||
// 修改时,何止数据
|
// 修改时,设置数据
|
||||||
if (type === 'update' && row) {
|
if (type === 'update' && row) {
|
||||||
formData.value = { ...row }
|
formData.value = { ...row }
|
||||||
}
|
}
|
||||||
|
|
@ -119,10 +124,10 @@ const submitForm = async () => {
|
||||||
const data = formData.value as unknown as MdWorkstationToolVO
|
const data = formData.value as unknown as MdWorkstationToolVO
|
||||||
if (formType.value === 'create') {
|
if (formType.value === 'create') {
|
||||||
await MdWorkstationToolApi.createWorkstationTool(data)
|
await MdWorkstationToolApi.createWorkstationTool(data)
|
||||||
message.success(t('common.updateSuccess'))
|
message.success(t('common.createSuccess'))
|
||||||
} else {
|
} else {
|
||||||
await MdWorkstationToolApi.updateWorkstationTool(data)
|
await MdWorkstationToolApi.updateWorkstationTool(data)
|
||||||
message.success(t('common.createSuccess'))
|
message.success(t('common.updateSuccess'))
|
||||||
}
|
}
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
// 刷新列表
|
// 刷新列表
|
||||||
|
|
@ -154,6 +159,7 @@ const handleDelete = async (id: number) => {
|
||||||
} catch {}
|
} catch {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 监听 workstationId 变化,加载列表 */
|
||||||
watch(
|
watch(
|
||||||
() => props.workstationId,
|
() => props.workstationId,
|
||||||
(val) => {
|
(val) => {
|
||||||
|
|
@ -1,8 +1,11 @@
|
||||||
|
<!-- MES 工作站-人力资源 列表 -->
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
|
<!-- 操作栏 -->
|
||||||
<el-button type="primary" plain size="small" @click="openForm('create')" class="mb-10px">
|
<el-button type="primary" plain size="small" @click="openForm('create')" class="mb-10px">
|
||||||
<Icon icon="ep:plus" class="mr-5px" /> 添加人员
|
<Icon icon="ep:plus" class="mr-5px" /> 添加人员
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<!-- 列表 -->
|
||||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true" border>
|
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true" border>
|
||||||
<el-table-column label="岗位编号" align="center" prop="postId" />
|
<el-table-column label="岗位编号" align="center" prop="postId" />
|
||||||
<el-table-column label="岗位名称" align="center" prop="postName" />
|
<el-table-column label="岗位名称" align="center" prop="postName" />
|
||||||
|
|
@ -16,7 +19,7 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
<!-- 添加/编辑弹窗 -->
|
<!-- 表单弹窗:添加/修改 -->
|
||||||
<Dialog :title="dialogTitle" v-model="dialogVisible" width="500px">
|
<Dialog :title="dialogTitle" v-model="dialogVisible" width="500px">
|
||||||
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="80px" v-loading="formLoading">
|
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="80px" v-loading="formLoading">
|
||||||
<el-form-item label="岗位" prop="postId">
|
<el-form-item label="岗位" prop="postId">
|
||||||
|
|
@ -57,6 +60,8 @@
|
||||||
import { MdWorkstationWorkerApi, MdWorkstationWorkerVO } from '@/api/mes/md/workstation/worker'
|
import { MdWorkstationWorkerApi, MdWorkstationWorkerVO } from '@/api/mes/md/workstation/worker'
|
||||||
import * as PostApi from '@/api/system/post'
|
import * as PostApi from '@/api/system/post'
|
||||||
|
|
||||||
|
defineOptions({ name: 'WorkstationWorkerList' })
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
workstationId: number // 工作站编号
|
workstationId: number // 工作站编号
|
||||||
}>()
|
}>()
|
||||||
|
|
@ -64,11 +69,11 @@ const props = defineProps<{
|
||||||
const { t } = useI18n() // 国际化
|
const { t } = useI18n() // 国际化
|
||||||
const message = useMessage() // 消息弹窗
|
const message = useMessage() // 消息弹窗
|
||||||
|
|
||||||
const loading = ref(false) // 列表加载中
|
const loading = ref(false) // 列表的加载中
|
||||||
const list = ref<MdWorkstationWorkerVO[]>([]) // 人力资源列表
|
const list = ref<MdWorkstationWorkerVO[]>([]) // 列表的数据
|
||||||
const postList = ref<PostApi.PostVO[]>([]) // 岗位下拉列表
|
const postList = ref<PostApi.PostVO[]>([]) // 岗位下拉列表
|
||||||
|
|
||||||
/** 加载列表 */
|
/** 查询列表 */
|
||||||
const getList = async () => {
|
const getList = async () => {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
try {
|
try {
|
||||||
|
|
@ -78,11 +83,11 @@ const getList = async () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==================== 添加/编辑人员 ====================
|
// ==================== 添加/修改 ====================
|
||||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||||
const dialogTitle = ref('') // 弹窗的标题
|
const dialogTitle = ref('') // 弹窗的标题
|
||||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||||
const formLoading = ref(false) // 表单的提交加载中
|
const formLoading = ref(false) // 表单的加载中
|
||||||
const formRef = ref() // 表单 Ref
|
const formRef = ref() // 表单 Ref
|
||||||
const formData = ref({
|
const formData = ref({
|
||||||
id: undefined as number | undefined,
|
id: undefined as number | undefined,
|
||||||
|
|
@ -90,11 +95,11 @@ const formData = ref({
|
||||||
postId: undefined as number | undefined,
|
postId: undefined as number | undefined,
|
||||||
quantity: 1,
|
quantity: 1,
|
||||||
remark: undefined as string | undefined
|
remark: undefined as string | undefined
|
||||||
}) // 表单数据
|
})
|
||||||
const formRules = reactive({
|
const formRules = reactive({
|
||||||
postId: [{ required: true, message: '岗位不能为空', trigger: 'change' }],
|
postId: [{ required: true, message: '岗位不能为空', trigger: 'change' }],
|
||||||
quantity: [{ required: true, message: '数量不能为空', trigger: 'blur' }]
|
quantity: [{ required: true, message: '数量不能为空', trigger: 'blur' }]
|
||||||
}) // 表单校验规则
|
})
|
||||||
|
|
||||||
/** 打开表单弹窗 */
|
/** 打开表单弹窗 */
|
||||||
const openForm = async (type: string, row?: MdWorkstationWorkerVO) => {
|
const openForm = async (type: string, row?: MdWorkstationWorkerVO) => {
|
||||||
|
|
@ -157,6 +162,7 @@ const handleDelete = async (id: number) => {
|
||||||
} catch {}
|
} catch {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 监听 workstationId 变化,加载列表 */
|
||||||
watch(
|
watch(
|
||||||
() => props.workstationId,
|
() => props.workstationId,
|
||||||
(val) => {
|
(val) => {
|
||||||
|
|
@ -1,129 +0,0 @@
|
||||||
<!-- MES 操作步骤表单弹窗 -->
|
|
||||||
<template>
|
|
||||||
<Dialog :title="dialogTitle" v-model="dialogVisible" width="600px">
|
|
||||||
<el-form
|
|
||||||
ref="formRef"
|
|
||||||
:model="formData"
|
|
||||||
:rules="formRules"
|
|
||||||
label-width="120px"
|
|
||||||
v-loading="formLoading"
|
|
||||||
>
|
|
||||||
<el-form-item label="序号" prop="sort">
|
|
||||||
<el-input-number
|
|
||||||
v-model="formData.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="formData.content"
|
|
||||||
type="textarea"
|
|
||||||
:rows="3"
|
|
||||||
placeholder="请输入步骤说明"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="辅助设备" prop="device">
|
|
||||||
<el-input v-model="formData.device" placeholder="请输入辅助设备" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="辅助材料" prop="material">
|
|
||||||
<el-input v-model="formData.material" placeholder="请输入辅助材料" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="材料文档 URL" prop="docUrl">
|
|
||||||
<el-input v-model="formData.docUrl" placeholder="请输入材料文档 URL" />
|
|
||||||
</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="dialogVisible = false">取 消</el-button>
|
|
||||||
<el-button type="primary" @click="submitForm" :loading="formLoading">确 定</el-button>
|
|
||||||
</template>
|
|
||||||
</Dialog>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
import { ProProcessContentApi, ProProcessContentVO } from '@/api/mes/pro/process/content'
|
|
||||||
|
|
||||||
defineOptions({ name: 'ProProcessContentForm' })
|
|
||||||
|
|
||||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
|
||||||
|
|
||||||
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<Partial<ProProcessContentVO>>({
|
|
||||||
id: undefined,
|
|
||||||
processId: undefined,
|
|
||||||
sort: 1,
|
|
||||||
content: '',
|
|
||||||
device: '',
|
|
||||||
material: '',
|
|
||||||
docUrl: '',
|
|
||||||
remark: ''
|
|
||||||
})
|
|
||||||
const formRules = reactive({
|
|
||||||
sort: [{ required: true, message: '序号不能为空', trigger: 'blur' }]
|
|
||||||
})
|
|
||||||
const formRef = ref() // 表单 Ref
|
|
||||||
|
|
||||||
/** 打开弹窗 */
|
|
||||||
const open = (type: string, processId: number, maxSort: number, row?: ProProcessContentVO) => {
|
|
||||||
dialogVisible.value = true
|
|
||||||
dialogTitle.value = type === 'create' ? '添加操作步骤' : '编辑操作步骤'
|
|
||||||
formType.value = type
|
|
||||||
resetForm(processId, maxSort)
|
|
||||||
// 修改时,设置数据
|
|
||||||
if (row) {
|
|
||||||
formData.value = { ...row }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
|
||||||
|
|
||||||
/** 提交表单 */
|
|
||||||
const submitForm = async () => {
|
|
||||||
// 校验表单
|
|
||||||
if (!formRef) return
|
|
||||||
const valid = await formRef.value.validate()
|
|
||||||
if (!valid) return
|
|
||||||
// 提交请求
|
|
||||||
formLoading.value = true
|
|
||||||
try {
|
|
||||||
const data = formData.value as ProProcessContentVO
|
|
||||||
if (formType.value === 'create') {
|
|
||||||
await ProProcessContentApi.createProcessContent(data)
|
|
||||||
message.success(t('common.createSuccess'))
|
|
||||||
} else {
|
|
||||||
await ProProcessContentApi.updateProcessContent(data)
|
|
||||||
message.success(t('common.updateSuccess'))
|
|
||||||
}
|
|
||||||
dialogVisible.value = false
|
|
||||||
// 发送操作成功的事件
|
|
||||||
emit('success')
|
|
||||||
} finally {
|
|
||||||
formLoading.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 重置表单 */
|
|
||||||
const resetForm = (processId: number, maxSort: number) => {
|
|
||||||
formData.value = {
|
|
||||||
id: undefined,
|
|
||||||
processId,
|
|
||||||
sort: maxSort + 1,
|
|
||||||
content: '',
|
|
||||||
device: '',
|
|
||||||
material: '',
|
|
||||||
docUrl: '',
|
|
||||||
remark: ''
|
|
||||||
}
|
|
||||||
formRef.value?.resetFields()
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
@ -24,13 +24,54 @@
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
<!-- 表单弹窗:添加/修改 -->
|
<!-- 表单弹窗:添加/修改 -->
|
||||||
<ProProcessContentForm ref="formRef" @success="getList" />
|
<Dialog :title="dialogTitle" v-model="dialogVisible" width="600px">
|
||||||
|
<el-form
|
||||||
|
ref="formRef"
|
||||||
|
:model="formData"
|
||||||
|
:rules="formRules"
|
||||||
|
label-width="120px"
|
||||||
|
v-loading="formLoading"
|
||||||
|
>
|
||||||
|
<el-form-item label="序号" prop="sort">
|
||||||
|
<el-input-number
|
||||||
|
v-model="formData.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="formData.content"
|
||||||
|
type="textarea"
|
||||||
|
:rows="3"
|
||||||
|
placeholder="请输入步骤说明"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="辅助设备" prop="device">
|
||||||
|
<el-input v-model="formData.device" placeholder="请输入辅助设备" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="辅助材料" prop="material">
|
||||||
|
<el-input v-model="formData.material" placeholder="请输入辅助材料" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="材料文档 URL" prop="docUrl">
|
||||||
|
<el-input v-model="formData.docUrl" placeholder="请输入材料文档 URL" />
|
||||||
|
</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="dialogVisible = false">取 消</el-button>
|
||||||
|
<el-button type="primary" @click="submitForm" :loading="formLoading">确 定</el-button>
|
||||||
|
</template>
|
||||||
|
</Dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ProProcessContentApi, ProProcessContentVO } from '@/api/mes/pro/process/content'
|
import { ProProcessContentApi, ProProcessContentVO } from '@/api/mes/pro/process/content'
|
||||||
import ProProcessContentForm from './ProProcessContentForm.vue'
|
|
||||||
|
|
||||||
defineOptions({ name: 'ProProcessContentList' })
|
defineOptions({ name: 'ProProcessContentList' })
|
||||||
|
|
||||||
|
|
@ -43,7 +84,6 @@ const { t } = useI18n() // 国际化
|
||||||
|
|
||||||
const loading = ref(false) // 列表的加载中
|
const loading = ref(false) // 列表的加载中
|
||||||
const list = ref<ProProcessContentVO[]>([]) // 列表的数据
|
const list = ref<ProProcessContentVO[]>([]) // 列表的数据
|
||||||
const formRef = ref<InstanceType<typeof ProProcessContentForm>>() // 表单 Ref
|
|
||||||
|
|
||||||
/** 查询列表 */
|
/** 查询列表 */
|
||||||
const getList = async () => {
|
const getList = async () => {
|
||||||
|
|
@ -55,10 +95,77 @@ const getList = async () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ==================== 添加/修改 ====================
|
||||||
|
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||||
|
const dialogTitle = ref('') // 弹窗的标题
|
||||||
|
const formLoading = ref(false) // 表单的加载中
|
||||||
|
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||||
|
const formRef = ref() // 表单 Ref
|
||||||
|
const formData = ref<Partial<ProProcessContentVO>>({
|
||||||
|
id: undefined,
|
||||||
|
processId: undefined,
|
||||||
|
sort: 1,
|
||||||
|
content: '',
|
||||||
|
device: '',
|
||||||
|
material: '',
|
||||||
|
docUrl: '',
|
||||||
|
remark: ''
|
||||||
|
})
|
||||||
|
const formRules = reactive({
|
||||||
|
sort: [{ required: true, message: '序号不能为空', trigger: 'blur' }]
|
||||||
|
})
|
||||||
|
|
||||||
/** 添加/修改操作 */
|
/** 添加/修改操作 */
|
||||||
const openForm = (type: string, row?: ProProcessContentVO) => {
|
const openForm = (type: string, row?: ProProcessContentVO) => {
|
||||||
const maxSort = list.value.reduce((max, item) => Math.max(max, item.sort || 0), 0)
|
const maxSort = list.value.reduce((max, item) => Math.max(max, item.sort || 0), 0)
|
||||||
formRef.value!.open(type, props.processId, maxSort, row)
|
dialogVisible.value = true
|
||||||
|
dialogTitle.value = type === 'create' ? '添加操作步骤' : '编辑操作步骤'
|
||||||
|
formType.value = type
|
||||||
|
resetForm(props.processId, maxSort)
|
||||||
|
// 修改时,设置数据
|
||||||
|
if (row) {
|
||||||
|
formData.value = { ...row }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 提交表单 */
|
||||||
|
const submitForm = async () => {
|
||||||
|
// 校验表单
|
||||||
|
if (!formRef) return
|
||||||
|
const valid = await formRef.value.validate()
|
||||||
|
if (!valid) return
|
||||||
|
// 提交请求
|
||||||
|
formLoading.value = true
|
||||||
|
try {
|
||||||
|
const data = formData.value as ProProcessContentVO
|
||||||
|
if (formType.value === 'create') {
|
||||||
|
await ProProcessContentApi.createProcessContent(data)
|
||||||
|
message.success(t('common.createSuccess'))
|
||||||
|
} else {
|
||||||
|
await ProProcessContentApi.updateProcessContent(data)
|
||||||
|
message.success(t('common.updateSuccess'))
|
||||||
|
}
|
||||||
|
dialogVisible.value = false
|
||||||
|
// 刷新列表
|
||||||
|
await getList()
|
||||||
|
} finally {
|
||||||
|
formLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置表单 */
|
||||||
|
const resetForm = (processId: number, maxSort: number) => {
|
||||||
|
formData.value = {
|
||||||
|
id: undefined,
|
||||||
|
processId,
|
||||||
|
sort: maxSort + 1,
|
||||||
|
content: '',
|
||||||
|
device: '',
|
||||||
|
material: '',
|
||||||
|
docUrl: '',
|
||||||
|
remark: ''
|
||||||
|
}
|
||||||
|
formRef.value?.resetFields()
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
|
|
|
||||||
|
|
@ -1,190 +0,0 @@
|
||||||
<!-- MES 质检方案-检测指标项 表单 -->
|
|
||||||
<template>
|
|
||||||
<Dialog :title="dialogTitle" v-model="dialogVisible" width="900px">
|
|
||||||
<el-form
|
|
||||||
ref="formRef"
|
|
||||||
:model="formData"
|
|
||||||
:rules="formRules"
|
|
||||||
label-width="100px"
|
|
||||||
v-loading="formLoading"
|
|
||||||
>
|
|
||||||
<el-row :gutter="16">
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="质检指标" prop="indicatorId">
|
|
||||||
<QcIndicatorSelect
|
|
||||||
v-model="formData.indicatorId"
|
|
||||||
placeholder="请选择质检指标"
|
|
||||||
class="!w-1/1"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="标准值" prop="standardValue">
|
|
||||||
<el-input-number
|
|
||||||
v-model="formData.standardValue"
|
|
||||||
placeholder="请输入标准值"
|
|
||||||
:precision="4"
|
|
||||||
class="!w-1/1"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
<el-row :gutter="16">
|
|
||||||
<el-col :span="8">
|
|
||||||
<el-form-item label="计量单位" prop="unitMeasureId">
|
|
||||||
<MdUnitMeasureSelect
|
|
||||||
v-model="formData.unitMeasureId"
|
|
||||||
placeholder="请选择计量单位"
|
|
||||||
clearable
|
|
||||||
class="!w-1/1"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="8">
|
|
||||||
<el-form-item label="误差上限" prop="thresholdMax">
|
|
||||||
<el-input-number
|
|
||||||
v-model="formData.thresholdMax"
|
|
||||||
placeholder="请输入"
|
|
||||||
:precision="4"
|
|
||||||
class="!w-1/1"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="8">
|
|
||||||
<el-form-item label="误差下限" prop="thresholdMin">
|
|
||||||
<el-input-number
|
|
||||||
v-model="formData.thresholdMin"
|
|
||||||
placeholder="请输入"
|
|
||||||
:precision="4"
|
|
||||||
class="!w-1/1"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
<el-row>
|
|
||||||
<el-col :span="24">
|
|
||||||
<el-form-item label="检测方法" prop="checkMethod">
|
|
||||||
<el-input
|
|
||||||
type="textarea"
|
|
||||||
v-model="formData.checkMethod"
|
|
||||||
placeholder="请输入检测方法"
|
|
||||||
:rows="3"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
<el-row>
|
|
||||||
<el-col :span="24">
|
|
||||||
<el-form-item label="说明图URL" prop="docUrl">
|
|
||||||
<el-input v-model="formData.docUrl" placeholder="请输入说明图URL" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
<el-row>
|
|
||||||
<el-col :span="24">
|
|
||||||
<el-form-item label="备注" prop="remark">
|
|
||||||
<el-input type="textarea" v-model="formData.remark" placeholder="请输入备注" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
</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 { QcTemplateIndicatorApi, QcTemplateIndicatorVO } from '@/api/mes/qc/template/indicator'
|
|
||||||
import QcIndicatorSelect from '@/views/mes/qc/indicator/components/QcIndicatorSelect.vue'
|
|
||||||
import MdUnitMeasureSelect from '@/views/mes/md/unitmeasure/components/MdUnitMeasureSelect.vue'
|
|
||||||
|
|
||||||
defineOptions({ name: 'TemplateIndicatorForm' })
|
|
||||||
|
|
||||||
const { t } = useI18n() // 国际化
|
|
||||||
const message = useMessage() // 消息弹窗
|
|
||||||
|
|
||||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
|
||||||
const dialogTitle = ref('') // 弹窗的标题
|
|
||||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
|
||||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
|
||||||
const formData = ref({
|
|
||||||
id: undefined,
|
|
||||||
templateId: undefined as number | undefined,
|
|
||||||
indicatorId: undefined,
|
|
||||||
checkMethod: undefined,
|
|
||||||
standardValue: undefined,
|
|
||||||
unitMeasureId: undefined,
|
|
||||||
thresholdMax: undefined,
|
|
||||||
thresholdMin: undefined,
|
|
||||||
docUrl: undefined,
|
|
||||||
remark: undefined
|
|
||||||
})
|
|
||||||
const formRules = reactive({
|
|
||||||
indicatorId: [{ required: true, message: '质检指标不能为空', trigger: 'change' }]
|
|
||||||
})
|
|
||||||
const formRef = ref() // 表单 Ref
|
|
||||||
|
|
||||||
/** 打开弹窗 */
|
|
||||||
const open = async (type: string, id?: number, templateId?: number) => {
|
|
||||||
dialogVisible.value = true
|
|
||||||
dialogTitle.value = t('action.' + type)
|
|
||||||
formType.value = type
|
|
||||||
resetForm()
|
|
||||||
formData.value.templateId = templateId
|
|
||||||
// 修改时,设置数据
|
|
||||||
if (id) {
|
|
||||||
formLoading.value = true
|
|
||||||
try {
|
|
||||||
formData.value = await QcTemplateIndicatorApi.getTemplateIndicator(id)
|
|
||||||
} finally {
|
|
||||||
formLoading.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
|
||||||
|
|
||||||
/** 提交表单 */
|
|
||||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
|
||||||
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 QcTemplateIndicatorVO
|
|
||||||
if (formType.value === 'create') {
|
|
||||||
await QcTemplateIndicatorApi.createTemplateIndicator(data)
|
|
||||||
message.success(t('common.createSuccess'))
|
|
||||||
} else {
|
|
||||||
await QcTemplateIndicatorApi.updateTemplateIndicator(data)
|
|
||||||
message.success(t('common.updateSuccess'))
|
|
||||||
}
|
|
||||||
dialogVisible.value = false
|
|
||||||
// 发送操作成功的事件
|
|
||||||
emit('success')
|
|
||||||
} finally {
|
|
||||||
formLoading.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 重置表单 */
|
|
||||||
const resetForm = () => {
|
|
||||||
formData.value = {
|
|
||||||
id: undefined,
|
|
||||||
templateId: undefined,
|
|
||||||
indicatorId: undefined,
|
|
||||||
checkMethod: undefined,
|
|
||||||
standardValue: undefined,
|
|
||||||
unitMeasureId: undefined,
|
|
||||||
thresholdMax: undefined,
|
|
||||||
thresholdMin: undefined,
|
|
||||||
docUrl: undefined,
|
|
||||||
remark: undefined
|
|
||||||
}
|
|
||||||
formRef.value?.resetFields()
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
@ -51,15 +51,108 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
<!-- 表单弹窗 -->
|
<!-- 表单弹窗:添加/修改 -->
|
||||||
<TemplateIndicatorForm ref="formRef" @success="getList" />
|
<Dialog :title="dialogTitle" v-model="dialogVisible" width="900px">
|
||||||
|
<el-form
|
||||||
|
ref="formRef"
|
||||||
|
:model="formData"
|
||||||
|
:rules="formRules"
|
||||||
|
label-width="100px"
|
||||||
|
v-loading="formLoading"
|
||||||
|
>
|
||||||
|
<el-row :gutter="16">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="质检指标" prop="indicatorId">
|
||||||
|
<QcIndicatorSelect
|
||||||
|
v-model="formData.indicatorId"
|
||||||
|
placeholder="请选择质检指标"
|
||||||
|
class="!w-1/1"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="标准值" prop="standardValue">
|
||||||
|
<el-input-number
|
||||||
|
v-model="formData.standardValue"
|
||||||
|
placeholder="请输入标准值"
|
||||||
|
:precision="4"
|
||||||
|
class="!w-1/1"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="16">
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="计量单位" prop="unitMeasureId">
|
||||||
|
<MdUnitMeasureSelect
|
||||||
|
v-model="formData.unitMeasureId"
|
||||||
|
placeholder="请选择计量单位"
|
||||||
|
clearable
|
||||||
|
class="!w-1/1"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="误差上限" prop="thresholdMax">
|
||||||
|
<el-input-number
|
||||||
|
v-model="formData.thresholdMax"
|
||||||
|
placeholder="请输入"
|
||||||
|
:precision="4"
|
||||||
|
class="!w-1/1"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="误差下限" prop="thresholdMin">
|
||||||
|
<el-input-number
|
||||||
|
v-model="formData.thresholdMin"
|
||||||
|
placeholder="请输入"
|
||||||
|
:precision="4"
|
||||||
|
class="!w-1/1"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="检测方法" prop="checkMethod">
|
||||||
|
<el-input
|
||||||
|
type="textarea"
|
||||||
|
v-model="formData.checkMethod"
|
||||||
|
placeholder="请输入检测方法"
|
||||||
|
:rows="3"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="说明图URL" prop="docUrl">
|
||||||
|
<el-input v-model="formData.docUrl" placeholder="请输入说明图URL" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input type="textarea" v-model="formData.remark" placeholder="请输入备注" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
||||||
|
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||||
|
</template>
|
||||||
|
</Dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { DICT_TYPE } from '@/utils/dict'
|
import { DICT_TYPE } from '@/utils/dict'
|
||||||
import { QcTemplateIndicatorApi, QcTemplateIndicatorVO } from '@/api/mes/qc/template/indicator'
|
import { QcTemplateIndicatorApi, QcTemplateIndicatorVO } from '@/api/mes/qc/template/indicator'
|
||||||
import TemplateIndicatorForm from './TemplateIndicatorForm.vue'
|
import QcIndicatorSelect from '@/views/mes/qc/indicator/components/QcIndicatorSelect.vue'
|
||||||
|
import MdUnitMeasureSelect from '@/views/mes/md/unitmeasure/components/MdUnitMeasureSelect.vue'
|
||||||
|
|
||||||
defineOptions({ name: 'TemplateIndicatorList' })
|
defineOptions({ name: 'TemplateIndicatorList' })
|
||||||
|
|
||||||
|
|
@ -87,10 +180,86 @@ const getList = async () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ==================== 添加/修改 ====================
|
||||||
|
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||||
|
const dialogTitle = ref('') // 弹窗的标题
|
||||||
|
const formLoading = ref(false) // 表单的加载中
|
||||||
|
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||||
|
const formRef = ref() // 表单 Ref
|
||||||
|
const formData = ref({
|
||||||
|
id: undefined,
|
||||||
|
templateId: undefined as number | undefined,
|
||||||
|
indicatorId: undefined,
|
||||||
|
checkMethod: undefined,
|
||||||
|
standardValue: undefined,
|
||||||
|
unitMeasureId: undefined,
|
||||||
|
thresholdMax: undefined,
|
||||||
|
thresholdMin: undefined,
|
||||||
|
docUrl: undefined,
|
||||||
|
remark: undefined
|
||||||
|
})
|
||||||
|
const formRules = reactive({
|
||||||
|
indicatorId: [{ required: true, message: '质检指标不能为空', trigger: 'change' }]
|
||||||
|
})
|
||||||
|
|
||||||
/** 添加/修改操作 */
|
/** 添加/修改操作 */
|
||||||
const formRef = ref()
|
const openForm = async (type: string, id?: number) => {
|
||||||
const openForm = (type: string, id?: number) => {
|
dialogVisible.value = true
|
||||||
formRef.value.open(type, id, props.templateId)
|
dialogTitle.value = t('action.' + type)
|
||||||
|
formType.value = type
|
||||||
|
resetForm()
|
||||||
|
formData.value.templateId = props.templateId
|
||||||
|
// 修改时,设置数据
|
||||||
|
if (id) {
|
||||||
|
formLoading.value = true
|
||||||
|
try {
|
||||||
|
formData.value = await QcTemplateIndicatorApi.getTemplateIndicator(id)
|
||||||
|
} finally {
|
||||||
|
formLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 提交表单 */
|
||||||
|
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 QcTemplateIndicatorVO
|
||||||
|
if (formType.value === 'create') {
|
||||||
|
await QcTemplateIndicatorApi.createTemplateIndicator(data)
|
||||||
|
message.success(t('common.createSuccess'))
|
||||||
|
} else {
|
||||||
|
await QcTemplateIndicatorApi.updateTemplateIndicator(data)
|
||||||
|
message.success(t('common.updateSuccess'))
|
||||||
|
}
|
||||||
|
dialogVisible.value = false
|
||||||
|
// 刷新列表
|
||||||
|
await getList()
|
||||||
|
} finally {
|
||||||
|
formLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置表单 */
|
||||||
|
const resetForm = () => {
|
||||||
|
formData.value = {
|
||||||
|
id: undefined,
|
||||||
|
templateId: undefined,
|
||||||
|
indicatorId: undefined,
|
||||||
|
checkMethod: undefined,
|
||||||
|
standardValue: undefined,
|
||||||
|
unitMeasureId: undefined,
|
||||||
|
thresholdMax: undefined,
|
||||||
|
thresholdMin: undefined,
|
||||||
|
docUrl: undefined,
|
||||||
|
remark: undefined
|
||||||
|
}
|
||||||
|
formRef.value?.resetFields()
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
|
|
|
||||||
|
|
@ -1,190 +0,0 @@
|
||||||
<!-- MES 质检方案-产品关联 表单 -->
|
|
||||||
<template>
|
|
||||||
<Dialog :title="dialogTitle" v-model="dialogVisible" width="900px">
|
|
||||||
<el-form
|
|
||||||
ref="formRef"
|
|
||||||
:model="formData"
|
|
||||||
:rules="formRules"
|
|
||||||
label-width="120px"
|
|
||||||
v-loading="formLoading"
|
|
||||||
>
|
|
||||||
<el-row>
|
|
||||||
<el-col :span="24">
|
|
||||||
<el-form-item label="产品物料" prop="itemId">
|
|
||||||
<MdItemSelect v-model="formData.itemId" placeholder="请选择产品物料" class="!w-1/1" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
<el-row :gutter="16">
|
|
||||||
<el-col :span="8">
|
|
||||||
<el-form-item label="最低检测数" prop="quantityCheck">
|
|
||||||
<el-input-number
|
|
||||||
v-model="formData.quantityCheck"
|
|
||||||
placeholder="请输入最低检测数"
|
|
||||||
:min="1"
|
|
||||||
class="!w-1/1"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="8">
|
|
||||||
<el-form-item label="最大不合格数" prop="quantityUnqualified">
|
|
||||||
<el-tooltip content="超出最大不合格数后整批判定不合格,0表示不启用" placement="top">
|
|
||||||
<el-input-number
|
|
||||||
v-model="formData.quantityUnqualified"
|
|
||||||
placeholder="0表示不启用"
|
|
||||||
:min="0"
|
|
||||||
class="!w-1/1"
|
|
||||||
/>
|
|
||||||
</el-tooltip>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
<el-row :gutter="16">
|
|
||||||
<el-col :span="8">
|
|
||||||
<el-form-item label="致命缺陷率(%)" prop="criticalRate">
|
|
||||||
<el-tooltip content="缺陷比例超出后整批判定不合格,0表示不允许出现" placement="top">
|
|
||||||
<el-input-number
|
|
||||||
v-model="formData.criticalRate"
|
|
||||||
placeholder="0表示不允许"
|
|
||||||
:min="0"
|
|
||||||
:max="100"
|
|
||||||
:precision="2"
|
|
||||||
class="!w-1/1"
|
|
||||||
/>
|
|
||||||
</el-tooltip>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="8">
|
|
||||||
<el-form-item label="严重缺陷率(%)" prop="majorRate">
|
|
||||||
<el-tooltip content="缺陷比例超出后整批判定不合格,0表示不允许出现" placement="top">
|
|
||||||
<el-input-number
|
|
||||||
v-model="formData.majorRate"
|
|
||||||
placeholder="0表示不允许"
|
|
||||||
:min="0"
|
|
||||||
:max="100"
|
|
||||||
:precision="2"
|
|
||||||
class="!w-1/1"
|
|
||||||
/>
|
|
||||||
</el-tooltip>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="8">
|
|
||||||
<el-form-item label="轻微缺陷率(%)" prop="minorRate">
|
|
||||||
<el-tooltip content="缺陷比例超出后整批判定不合格,0表示不允许出现" placement="top">
|
|
||||||
<el-input-number
|
|
||||||
v-model="formData.minorRate"
|
|
||||||
:min="0"
|
|
||||||
:max="100"
|
|
||||||
:precision="2"
|
|
||||||
class="!w-1/1"
|
|
||||||
/>
|
|
||||||
</el-tooltip>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
<el-row>
|
|
||||||
<el-col :span="24">
|
|
||||||
<el-form-item label="备注" prop="remark">
|
|
||||||
<el-input type="textarea" v-model="formData.remark" placeholder="请输入备注" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
</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 { QcTemplateItemApi, QcTemplateItemVO } from '@/api/mes/qc/template/item'
|
|
||||||
import MdItemSelect from '@/views/mes/md/item/components/MdItemSelect.vue'
|
|
||||||
|
|
||||||
defineOptions({ name: 'TemplateItemForm' })
|
|
||||||
|
|
||||||
const { t } = useI18n() // 国际化
|
|
||||||
const message = useMessage() // 消息弹窗
|
|
||||||
|
|
||||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
|
||||||
const dialogTitle = ref('') // 弹窗的标题
|
|
||||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
|
||||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
|
||||||
const formData = ref({
|
|
||||||
id: undefined,
|
|
||||||
templateId: undefined as number | undefined,
|
|
||||||
itemId: undefined,
|
|
||||||
quantityCheck: 1,
|
|
||||||
quantityUnqualified: 0,
|
|
||||||
criticalRate: 0,
|
|
||||||
majorRate: 0,
|
|
||||||
minorRate: 100,
|
|
||||||
remark: undefined
|
|
||||||
})
|
|
||||||
const formRules = reactive({
|
|
||||||
itemId: [{ required: true, message: '产品物料不能为空', trigger: 'change' }],
|
|
||||||
quantityCheck: [{ required: true, message: '最低检测数不能为空', trigger: 'blur' }]
|
|
||||||
})
|
|
||||||
const formRef = ref() // 表单 Ref
|
|
||||||
|
|
||||||
/** 打开弹窗 */
|
|
||||||
const open = async (type: string, id?: number, templateId?: number) => {
|
|
||||||
dialogVisible.value = true
|
|
||||||
dialogTitle.value = t('action.' + type)
|
|
||||||
formType.value = type
|
|
||||||
resetForm()
|
|
||||||
formData.value.templateId = templateId
|
|
||||||
// 修改时,设置数据
|
|
||||||
if (id) {
|
|
||||||
formLoading.value = true
|
|
||||||
try {
|
|
||||||
formData.value = await QcTemplateItemApi.getTemplateItem(id)
|
|
||||||
} finally {
|
|
||||||
formLoading.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
|
||||||
|
|
||||||
/** 提交表单 */
|
|
||||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
|
||||||
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 QcTemplateItemVO
|
|
||||||
if (formType.value === 'create') {
|
|
||||||
await QcTemplateItemApi.createTemplateItem(data)
|
|
||||||
message.success(t('common.createSuccess'))
|
|
||||||
} else {
|
|
||||||
await QcTemplateItemApi.updateTemplateItem(data)
|
|
||||||
message.success(t('common.updateSuccess'))
|
|
||||||
}
|
|
||||||
dialogVisible.value = false
|
|
||||||
// 发送操作成功的事件
|
|
||||||
emit('success')
|
|
||||||
} finally {
|
|
||||||
formLoading.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 重置表单 */
|
|
||||||
const resetForm = () => {
|
|
||||||
formData.value = {
|
|
||||||
id: undefined,
|
|
||||||
templateId: undefined,
|
|
||||||
itemId: undefined,
|
|
||||||
quantityCheck: 1,
|
|
||||||
quantityUnqualified: 0,
|
|
||||||
criticalRate: 0,
|
|
||||||
majorRate: 0,
|
|
||||||
minorRate: 100,
|
|
||||||
remark: undefined
|
|
||||||
}
|
|
||||||
formRef.value?.resetFields()
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
@ -51,14 +51,108 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
<!-- 表单弹窗 -->
|
<!-- 表单弹窗:添加/修改 -->
|
||||||
<TemplateItemForm ref="formRef" @success="getList" />
|
<Dialog :title="dialogTitle" v-model="dialogVisible" width="900px">
|
||||||
|
<el-form
|
||||||
|
ref="formRef"
|
||||||
|
:model="formData"
|
||||||
|
:rules="formRules"
|
||||||
|
label-width="120px"
|
||||||
|
v-loading="formLoading"
|
||||||
|
>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="产品物料" prop="itemId">
|
||||||
|
<MdItemSelect v-model="formData.itemId" placeholder="请选择产品物料" class="!w-1/1" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="16">
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="最低检测数" prop="quantityCheck">
|
||||||
|
<el-input-number
|
||||||
|
v-model="formData.quantityCheck"
|
||||||
|
placeholder="请输入最低检测数"
|
||||||
|
:min="1"
|
||||||
|
class="!w-1/1"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="最大不合格数" prop="quantityUnqualified">
|
||||||
|
<el-tooltip content="超出最大不合格数后整批判定不合格,0表示不启用" placement="top">
|
||||||
|
<el-input-number
|
||||||
|
v-model="formData.quantityUnqualified"
|
||||||
|
placeholder="0表示不启用"
|
||||||
|
:min="0"
|
||||||
|
class="!w-1/1"
|
||||||
|
/>
|
||||||
|
</el-tooltip>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="16">
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="致命缺陷率(%)" prop="criticalRate">
|
||||||
|
<el-tooltip content="缺陷比例超出后整批判定不合格,0表示不允许出现" placement="top">
|
||||||
|
<el-input-number
|
||||||
|
v-model="formData.criticalRate"
|
||||||
|
placeholder="0表示不允许"
|
||||||
|
:min="0"
|
||||||
|
:max="100"
|
||||||
|
:precision="2"
|
||||||
|
class="!w-1/1"
|
||||||
|
/>
|
||||||
|
</el-tooltip>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="严重缺陷率(%)" prop="majorRate">
|
||||||
|
<el-tooltip content="缺陷比例超出后整批判定不合格,0表示不允许出现" placement="top">
|
||||||
|
<el-input-number
|
||||||
|
v-model="formData.majorRate"
|
||||||
|
placeholder="0表示不允许"
|
||||||
|
:min="0"
|
||||||
|
:max="100"
|
||||||
|
:precision="2"
|
||||||
|
class="!w-1/1"
|
||||||
|
/>
|
||||||
|
</el-tooltip>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="轻微缺陷率(%)" prop="minorRate">
|
||||||
|
<el-tooltip content="缺陷比例超出后整批判定不合格,0表示不允许出现" placement="top">
|
||||||
|
<el-input-number
|
||||||
|
v-model="formData.minorRate"
|
||||||
|
:min="0"
|
||||||
|
:max="100"
|
||||||
|
:precision="2"
|
||||||
|
class="!w-1/1"
|
||||||
|
/>
|
||||||
|
</el-tooltip>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input type="textarea" v-model="formData.remark" placeholder="请输入备注" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
||||||
|
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||||
|
</template>
|
||||||
|
</Dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { QcTemplateItemApi, QcTemplateItemVO } from '@/api/mes/qc/template/item'
|
import { QcTemplateItemApi, QcTemplateItemVO } from '@/api/mes/qc/template/item'
|
||||||
import TemplateItemForm from './TemplateItemForm.vue'
|
import MdItemSelect from '@/views/mes/md/item/components/MdItemSelect.vue'
|
||||||
|
|
||||||
defineOptions({ name: 'TemplateItemList' })
|
defineOptions({ name: 'TemplateItemList' })
|
||||||
|
|
||||||
|
|
@ -86,10 +180,85 @@ const getList = async () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ==================== 添加/修改 ====================
|
||||||
|
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||||
|
const dialogTitle = ref('') // 弹窗的标题
|
||||||
|
const formLoading = ref(false) // 表单的加载中
|
||||||
|
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||||
|
const formRef = ref() // 表单 Ref
|
||||||
|
const formData = ref({
|
||||||
|
id: undefined,
|
||||||
|
templateId: undefined as number | undefined,
|
||||||
|
itemId: undefined,
|
||||||
|
quantityCheck: 1,
|
||||||
|
quantityUnqualified: 0,
|
||||||
|
criticalRate: 0,
|
||||||
|
majorRate: 0,
|
||||||
|
minorRate: 100,
|
||||||
|
remark: undefined
|
||||||
|
})
|
||||||
|
const formRules = reactive({
|
||||||
|
itemId: [{ required: true, message: '产品物料不能为空', trigger: 'change' }],
|
||||||
|
quantityCheck: [{ required: true, message: '最低检测数不能为空', trigger: 'blur' }]
|
||||||
|
})
|
||||||
|
|
||||||
/** 添加/修改操作 */
|
/** 添加/修改操作 */
|
||||||
const formRef = ref()
|
const openForm = async (type: string, id?: number) => {
|
||||||
const openForm = (type: string, id?: number) => {
|
dialogVisible.value = true
|
||||||
formRef.value.open(type, id, props.templateId)
|
dialogTitle.value = t('action.' + type)
|
||||||
|
formType.value = type
|
||||||
|
resetForm()
|
||||||
|
formData.value.templateId = props.templateId
|
||||||
|
// 修改时,设置数据
|
||||||
|
if (id) {
|
||||||
|
formLoading.value = true
|
||||||
|
try {
|
||||||
|
formData.value = await QcTemplateItemApi.getTemplateItem(id)
|
||||||
|
} finally {
|
||||||
|
formLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 提交表单 */
|
||||||
|
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 QcTemplateItemVO
|
||||||
|
if (formType.value === 'create') {
|
||||||
|
await QcTemplateItemApi.createTemplateItem(data)
|
||||||
|
message.success(t('common.createSuccess'))
|
||||||
|
} else {
|
||||||
|
await QcTemplateItemApi.updateTemplateItem(data)
|
||||||
|
message.success(t('common.updateSuccess'))
|
||||||
|
}
|
||||||
|
dialogVisible.value = false
|
||||||
|
// 刷新列表
|
||||||
|
await getList()
|
||||||
|
} finally {
|
||||||
|
formLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置表单 */
|
||||||
|
const resetForm = () => {
|
||||||
|
formData.value = {
|
||||||
|
id: undefined,
|
||||||
|
templateId: undefined,
|
||||||
|
itemId: undefined,
|
||||||
|
quantityCheck: 1,
|
||||||
|
quantityUnqualified: 0,
|
||||||
|
criticalRate: 0,
|
||||||
|
majorRate: 0,
|
||||||
|
minorRate: 100,
|
||||||
|
remark: undefined
|
||||||
|
}
|
||||||
|
formRef.value?.resetFields()
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue