|
|
|
|
@ -0,0 +1,738 @@
|
|
|
|
|
<template>
|
|
|
|
|
<div class="mold-maintain-page">
|
|
|
|
|
<div class="mold-maintain-page__header">
|
|
|
|
|
<el-button @click="emit('back')">
|
|
|
|
|
<Icon icon="ep:arrow-left" class="mr-5px" /> {{ t('MoldManagement.MoldBrandPage.back') }}
|
|
|
|
|
</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="mold-maintain-page__body">
|
|
|
|
|
<!-- 左侧模具信息区域 -->
|
|
|
|
|
<div class="mold-maintain-page__sidebar" v-if="mold">
|
|
|
|
|
<div class="mold-maintain-page__info-card">
|
|
|
|
|
<div class="mold-maintain-page__info-header">
|
|
|
|
|
<span class="mold-maintain-page__info-num">1</span>
|
|
|
|
|
<span class="mold-maintain-page__info-title">{{ t('MoldManagement.MoldBrandPage.moldInfo') }}</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="mold-maintain-page__info-image-wrap">
|
|
|
|
|
<el-image v-if="getImageList(mold.images).length" :src="getImageList(mold.images)[0]"
|
|
|
|
|
fit="cover" class="mold-maintain-page__info-image" />
|
|
|
|
|
<el-empty v-else :description="t('MoldManagement.MoldBrandDetail.noImage')" />
|
|
|
|
|
</div>
|
|
|
|
|
<div class="mold-maintain-page__info-item">
|
|
|
|
|
<span class="mold-maintain-page__info-label">{{ t('MoldManagement.MoldBrandPage.moldCode') }}</span>
|
|
|
|
|
<span class="mold-maintain-page__info-value">{{ mold.code }}</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="mold-maintain-page__info-item">
|
|
|
|
|
<span class="mold-maintain-page__info-label">{{ t('MoldManagement.MoldBrandPage.moldName') }}</span>
|
|
|
|
|
<span class="mold-maintain-page__info-value">{{ mold.name }}</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="mold-maintain-page__info-item">
|
|
|
|
|
<span class="mold-maintain-page__info-label">{{ t('MoldManagement.MoldBrandPage.productName') }}</span>
|
|
|
|
|
<span class="mold-maintain-page__info-value">{{ mold.productName }}</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="mold-maintain-page__info-item">
|
|
|
|
|
<span class="mold-maintain-page__info-label">{{ t('MoldManagement.MoldBrandPage.moldSize') }}</span>
|
|
|
|
|
<span class="mold-maintain-page__info-value">{{ mold.moldSize }}</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="mold-maintain-page__info-item">
|
|
|
|
|
<span class="mold-maintain-page__info-label">{{ t('MoldManagement.MoldBrandPage.status') }}</span>
|
|
|
|
|
<dict-tag :type="DICT_TYPE.ERP_MOLD_STATUS" :value="mold.status" />
|
|
|
|
|
</div>
|
|
|
|
|
<div class="mold-maintain-page__info-item">
|
|
|
|
|
<span class="mold-maintain-page__info-label">{{ t('MoldManagement.MoldBrandPage.currentDevice') }}</span>
|
|
|
|
|
<span class="mold-maintain-page__info-value">{{ mold.currentDevice || '-' }}</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- 右侧表单区域 -->
|
|
|
|
|
<div class="mold-maintain-page__form">
|
|
|
|
|
<div class="mold-maintain-page__form-header">
|
|
|
|
|
<span class="mold-maintain-page__info-num">2</span>
|
|
|
|
|
<span class="mold-maintain-page__info-title">{{ t('MoldManagement.MoldBrandPage.maintainInfo') }}</span>
|
|
|
|
|
</div>
|
|
|
|
|
<el-form ref="maintainFormRef" :model="formModel" :rules="formRules" label-width="100px">
|
|
|
|
|
<!-- 维护类型 -->
|
|
|
|
|
<el-form-item :label="t('MoldManagement.MoldBrandPage.maintainType')" prop="maintainType">
|
|
|
|
|
<div class="mold-maintain-type-card">
|
|
|
|
|
<div
|
|
|
|
|
v-for="type in maintainTypes"
|
|
|
|
|
:key="type.value"
|
|
|
|
|
class="mold-maintain-type-card__item"
|
|
|
|
|
:class="{ 'is-active': maintainFormData.maintainType === type.value }"
|
|
|
|
|
@click="selectMaintainType(type.value)"
|
|
|
|
|
>
|
|
|
|
|
<div class="mold-maintain-type-card__icon">
|
|
|
|
|
<el-icon :size="26">
|
|
|
|
|
<component :is="type.icon" />
|
|
|
|
|
</el-icon>
|
|
|
|
|
</div>
|
|
|
|
|
<span class="mold-maintain-type-card__label">{{ type.label }}</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
<!-- 点检/保养表单 -->
|
|
|
|
|
<template v-if="isInspectOrMaintain">
|
|
|
|
|
<el-form-item :label="t('EquipmentManagement.TaskManagement.name')" prop="name">
|
|
|
|
|
<el-input v-model="taskFormData.name" :placeholder="t('EquipmentManagement.TaskManagement.placeholderName')" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item :label="t('EquipmentManagement.TaskManagement.projectForm')" prop="projectForm">
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="taskFormData.projectForm"
|
|
|
|
|
multiple
|
|
|
|
|
filterable
|
|
|
|
|
clearable
|
|
|
|
|
:placeholder="t('EquipmentManagement.TaskManagement.placeholderProjectForm')"
|
|
|
|
|
class="!w-full"
|
|
|
|
|
>
|
|
|
|
|
<el-option v-for="item in planOptions" :key="String(item.id)" :label="item.planName" :value="String(item.id)" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item :label="t('EquipmentManagement.TaskManagement.dateRange')" prop="dateRange">
|
|
|
|
|
<el-date-picker
|
|
|
|
|
v-model="taskFormData.dateRange"
|
|
|
|
|
value-format="YYYY-MM-DD"
|
|
|
|
|
type="daterange"
|
|
|
|
|
:start-placeholder="t('EquipmentManagement.TaskManagement.placeholderStartDate')"
|
|
|
|
|
:end-placeholder="t('EquipmentManagement.TaskManagement.placeholderEndDate')"
|
|
|
|
|
class="!w-320px"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item :label="t('EquipmentManagement.TaskManagement.cronExpression')" prop="cronExpression">
|
|
|
|
|
<template #label>
|
|
|
|
|
<Tooltip
|
|
|
|
|
title="Cron 表达式"
|
|
|
|
|
message="可以通过AI生成,AI提示词举例:帮我生成一个周一早上 9 点执行的 Cron 表达式"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
<crontab v-model="taskFormData.cronExpression" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item :label="t('EquipmentManagement.TaskManagement.operableUsers')" prop="operableUsers">
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="taskFormData.operableUsers"
|
|
|
|
|
multiple
|
|
|
|
|
filterable
|
|
|
|
|
clearable
|
|
|
|
|
:placeholder="t('EquipmentManagement.TaskManagement.placeholderOperableUsers')"
|
|
|
|
|
class="!w-full"
|
|
|
|
|
>
|
|
|
|
|
<el-option v-for="item in users" :key="String(item.id)" :label="item.nickname" :value="String(item.id)" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item :label="t('EquipmentManagement.TaskManagement.enabled')" prop="enabled">
|
|
|
|
|
<el-radio-group v-model="taskFormData.enabled">
|
|
|
|
|
<el-radio
|
|
|
|
|
v-for="dict in getBoolDictOptions(DICT_TYPE.INFRA_BOOLEAN_STRING)" :key="String(dict.value)"
|
|
|
|
|
:label="dict.value">
|
|
|
|
|
{{ dict.label }}
|
|
|
|
|
</el-radio>
|
|
|
|
|
</el-radio-group>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<!-- 维修表单 -->
|
|
|
|
|
<template v-if="isRepair">
|
|
|
|
|
<section class="dv-repair-section">
|
|
|
|
|
<div class="dv-repair-section__title">{{ t('MoldManagement.MoldRepair.basicInfo') }}</div>
|
|
|
|
|
<el-row :gutter="20">
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
<el-form-item :label="t('MoldManagement.MoldRepair.repairCode')" prop="repairCode">
|
|
|
|
|
<div class="dv-repair-code-row">
|
|
|
|
|
<el-input
|
|
|
|
|
:disabled="repairCodeDisabled"
|
|
|
|
|
v-model="repairFormData.repairCode"
|
|
|
|
|
:placeholder="t('common.code')"
|
|
|
|
|
/>
|
|
|
|
|
<el-switch
|
|
|
|
|
v-model="repairFormData.isCode"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
<el-form-item :label="t('MoldManagement.MoldRepair.repairName')" prop="repairName">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="repairFormData.repairName"
|
|
|
|
|
:placeholder="t('MoldManagement.MoldRepair.placeholderRepairName')"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
<el-form-item :label="t('MoldManagement.MoldRepair.requireDate')" prop="requireDate">
|
|
|
|
|
<el-date-picker
|
|
|
|
|
v-model="repairFormData.requireDate"
|
|
|
|
|
type="date"
|
|
|
|
|
value-format="x"
|
|
|
|
|
:placeholder="t('MoldManagement.MoldRepair.placeholderRequireDate')"
|
|
|
|
|
class="!w-full"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-row :gutter="20">
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
<el-form-item :label="t('MoldManagement.MoldRepair.repairUser')" prop="acceptedBy">
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="repairFormData.acceptedBy" filterable clearable
|
|
|
|
|
:placeholder="t('MoldManagement.MoldRepair.placeholderAcceptUser')"
|
|
|
|
|
class="!w-full">
|
|
|
|
|
<el-option v-for="item in users" :key="String(item.id)" :label="item.nickname" :value="String(item.id)" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
<el-form-item :label="t('MoldManagement.MoldRepair.confirmUser')" prop="confirmBy">
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="repairFormData.confirmBy" filterable clearable
|
|
|
|
|
:placeholder="t('MoldManagement.MoldRepair.placeholderConfirmUser')"
|
|
|
|
|
class="!w-full">
|
|
|
|
|
<el-option v-for="item in users" :key="String(item.id)" :label="item.nickname" :value="String(item.id)" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-row :gutter="20">
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
<el-form-item :label="t('MoldManagement.MoldRepair.faultLevel')" prop="faultLevel">
|
|
|
|
|
<el-radio-group v-model="repairFormData.faultLevel">
|
|
|
|
|
<el-radio
|
|
|
|
|
v-for="dict in failureLevelOptions"
|
|
|
|
|
:key="String(dict.value)"
|
|
|
|
|
:label="String(dict.value)"
|
|
|
|
|
>
|
|
|
|
|
{{ dict.label }}
|
|
|
|
|
</el-radio>
|
|
|
|
|
</el-radio-group>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
<el-form-item :label="t('MoldManagement.MoldRepair.isShutdown')" prop="shutdown">
|
|
|
|
|
<el-radio-group v-model="repairFormData.shutdown">
|
|
|
|
|
<el-radio :label="true">{{ t('common.yes') }}</el-radio>
|
|
|
|
|
<el-radio :label="false">{{ t('common.no') }}</el-radio>
|
|
|
|
|
</el-radio-group>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
<section class="dv-repair-section">
|
|
|
|
|
<div class="dv-repair-section__title">{{ t('MoldManagement.MoldRepair.faultInfo') }}</div>
|
|
|
|
|
<el-row :gutter="20">
|
|
|
|
|
<el-col :span="24">
|
|
|
|
|
<el-form-item :label="t('MoldManagement.MoldRepair.faultPhenomenon')" prop="faultPhenomenon">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="repairFormData.faultPhenomenon"
|
|
|
|
|
:placeholder="t('MoldManagement.MoldRepair.placeholderFaultPhenomenon')"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item :label="t('MoldManagement.MoldRepair.faultDescription')" prop="faultDescription">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="repairFormData.faultDescription"
|
|
|
|
|
type="textarea"
|
|
|
|
|
:rows="4"
|
|
|
|
|
:placeholder="t('MoldManagement.MoldRepair.placeholderFaultDescription')"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
<section class="dv-repair-section">
|
|
|
|
|
<div class="dv-repair-section__title">{{ t('MoldManagement.MoldRepair.remark') }}</div>
|
|
|
|
|
<el-form-item prop="remark" label-width="0">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="repairFormData.remark"
|
|
|
|
|
type="textarea"
|
|
|
|
|
:rows="3"
|
|
|
|
|
maxlength="300"
|
|
|
|
|
show-word-limit
|
|
|
|
|
:placeholder="t('MoldManagement.MoldRepair.placeholderRemark')"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</section>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<!-- 更换压网表单 -->
|
|
|
|
|
<template v-if="isReplaceNet">
|
|
|
|
|
<el-form-item :label="t('MoldManagement.MoldBrandPage.replaceNetRemark')" prop="replaceNetRemark">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="replaceNetFormData.remark"
|
|
|
|
|
type="textarea"
|
|
|
|
|
:rows="4"
|
|
|
|
|
:placeholder="t('MoldManagement.MoldBrandPage.placeholderReplaceNetRemark')"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</template>
|
|
|
|
|
</el-form>
|
|
|
|
|
|
|
|
|
|
<div class="mold-maintain-page__form-actions">
|
|
|
|
|
<el-button @click="emit('back')">{{ t('MoldManagement.MoldBrandPage.cancel') }}</el-button>
|
|
|
|
|
<el-button type="primary" @click="submitForm" :loading="submitLoading">{{ t('MoldManagement.MoldBrandPage.submit') }}</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { ref, reactive, computed, watch } from 'vue'
|
|
|
|
|
import { EditPen, RefreshRight, Search, Tools } from '@element-plus/icons-vue'
|
|
|
|
|
import { MoldBrandApi, type MoldBrandVO } from '@/api/erp/mold'
|
|
|
|
|
import { DeviceLedgerApi, type DeviceLedgerVO } from '@/api/mes/deviceledger'
|
|
|
|
|
import { TaskManagementApi, type TaskManagementVO } from '@/api/mold/taskManagement'
|
|
|
|
|
import { MoldRepairApi, type MoldRepairVO } from '@/api/mold/moldrepair'
|
|
|
|
|
import { PlanMaintenanceApi } from '@/api/mold/planmaintenance'
|
|
|
|
|
import { getSimpleUserList, type UserVO } from '@/api/system/user'
|
|
|
|
|
import { DICT_TYPE, getBoolDictOptions, getStrDictOptions } from '@/utils/dict'
|
|
|
|
|
import { Tooltip } from '@/components/Tooltip'
|
|
|
|
|
|
|
|
|
|
defineOptions({ name: 'MoldMaintainView' })
|
|
|
|
|
|
|
|
|
|
const props = defineProps<{
|
|
|
|
|
mold: MoldBrandVO | null
|
|
|
|
|
deviceOptions: DeviceLedgerVO[]
|
|
|
|
|
}>()
|
|
|
|
|
|
|
|
|
|
const emit = defineEmits<{
|
|
|
|
|
(e: 'back'): void
|
|
|
|
|
(e: 'success'): void
|
|
|
|
|
}>()
|
|
|
|
|
|
|
|
|
|
const { t } = useI18n()
|
|
|
|
|
const message = useMessage()
|
|
|
|
|
|
|
|
|
|
const submitLoading = ref(false)
|
|
|
|
|
const maintainFormRef = ref()
|
|
|
|
|
|
|
|
|
|
// 表单验证规则
|
|
|
|
|
const formRules = reactive({
|
|
|
|
|
maintainType: [{ required: true, message: t('MoldManagement.MoldBrandPage.placeholderMaintainType'), trigger: 'change' }],
|
|
|
|
|
// 点检/保养表单规则
|
|
|
|
|
name: [{ required: true, message: t('EquipmentManagement.TaskManagement.placeholderName'), trigger: 'blur' }],
|
|
|
|
|
taskType: [{ required: true, message: t('EquipmentManagement.TaskManagement.placeholderTaskType'), trigger: 'change' }],
|
|
|
|
|
projectForm: [{ required: true, message: t('EquipmentManagement.TaskManagement.placeholderProjectForm'), trigger: 'change' }],
|
|
|
|
|
dateRange: [{ required: true, message: t('EquipmentManagement.TaskManagement.placeholderDateRange'), trigger: 'change' }],
|
|
|
|
|
enabled: [{ required: true, message: t('EquipmentManagement.TaskManagement.placeholderEnabled'), trigger: 'change' }],
|
|
|
|
|
// 维修表单规则
|
|
|
|
|
repairName: [{ required: true, message: t('MoldManagement.MoldRepair.validatorRepairNameRequired'), trigger: 'blur' }],
|
|
|
|
|
requireDate: [{ required: true, message: t('MoldManagement.MoldRepair.validatorRequireDateRequired'), trigger: 'change' }],
|
|
|
|
|
faultLevel: [{ required: true, message: t('MoldManagement.MoldRepair.validatorFaultLevelRequired'), trigger: 'change' }],
|
|
|
|
|
shutdown: [{ required: true, message: t('MoldManagement.MoldRepair.validatorIsShutdownRequired'), trigger: 'change' }],
|
|
|
|
|
faultPhenomenon: [{ required: true, message: t('MoldManagement.MoldRepair.validatorFaultPhenomenonRequired'), trigger: 'blur' }],
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// 合并表单模型,用于 el-form 验证
|
|
|
|
|
const formModel = computed(() => ({
|
|
|
|
|
maintainType: maintainFormData.maintainType,
|
|
|
|
|
name: taskFormData.name,
|
|
|
|
|
taskType: taskFormData.taskType,
|
|
|
|
|
projectForm: taskFormData.projectForm,
|
|
|
|
|
dateRange: taskFormData.dateRange,
|
|
|
|
|
enabled: taskFormData.enabled,
|
|
|
|
|
repairName: repairFormData.repairName,
|
|
|
|
|
requireDate: repairFormData.requireDate,
|
|
|
|
|
faultLevel: repairFormData.faultLevel,
|
|
|
|
|
shutdown: repairFormData.shutdown,
|
|
|
|
|
faultPhenomenon: repairFormData.faultPhenomenon,
|
|
|
|
|
}))
|
|
|
|
|
|
|
|
|
|
// 维护类型
|
|
|
|
|
const maintainFormData = reactive({
|
|
|
|
|
maintainType: 1 as number
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// 点检/保养表单数据
|
|
|
|
|
const taskFormData = reactive({
|
|
|
|
|
name: undefined as string | undefined,
|
|
|
|
|
taskType: 1 as number,
|
|
|
|
|
projectForm: [] as string[],
|
|
|
|
|
dateRange: [] as string[],
|
|
|
|
|
cronExpression: undefined as string | undefined,
|
|
|
|
|
operableUsers: [] as string[],
|
|
|
|
|
enabled: true as boolean
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// 维修表单数据
|
|
|
|
|
const repairFormData = reactive({
|
|
|
|
|
repairCode: undefined as string | undefined,
|
|
|
|
|
repairName: undefined as string | undefined,
|
|
|
|
|
requireDate: undefined as string | undefined,
|
|
|
|
|
acceptedBy: undefined as string | undefined,
|
|
|
|
|
confirmBy: undefined as string | undefined,
|
|
|
|
|
faultLevel: undefined as string | undefined,
|
|
|
|
|
shutdown: undefined as boolean | undefined,
|
|
|
|
|
faultPhenomenon: undefined as string | undefined,
|
|
|
|
|
faultDescription: undefined as string | undefined,
|
|
|
|
|
remark: undefined as string | undefined,
|
|
|
|
|
isCode: true as boolean
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// 更换压网表单数据
|
|
|
|
|
const replaceNetFormData = reactive({
|
|
|
|
|
remark: undefined as string | undefined
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// 计算属性
|
|
|
|
|
const isInspectOrMaintain = computed(() => [1, 2].includes(maintainFormData.maintainType ?? 0))
|
|
|
|
|
const isRepair = computed(() => maintainFormData.maintainType === 3)
|
|
|
|
|
const isReplaceNet = computed(() => maintainFormData.maintainType === 4)
|
|
|
|
|
const repairCodeDisabled = computed(() => repairFormData.isCode === true)
|
|
|
|
|
const failureLevelOptions = computed(() => getStrDictOptions(DICT_TYPE.FAILURE_LEVEL))
|
|
|
|
|
|
|
|
|
|
// 维护类型配置
|
|
|
|
|
const maintainTypes = computed(() => [
|
|
|
|
|
{ value: 1, label: t('MoldManagement.MoldBrandPage.maintainTypeInspect'), icon: Search },
|
|
|
|
|
{ value: 2, label: t('MoldManagement.MoldBrandPage.maintainTypeMaintain'), icon: Tools },
|
|
|
|
|
{ value: 3, label: t('MoldManagement.MoldBrandPage.maintainTypeRepair'), icon: EditPen },
|
|
|
|
|
{ value: 4, label: t('MoldManagement.MoldBrandPage.maintainTypeReplaceNet'), icon: RefreshRight }
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
// 下拉选项
|
|
|
|
|
const planOptions = ref<{ id: number | string; planName: string }[]>([])
|
|
|
|
|
const users = ref<UserVO[]>([])
|
|
|
|
|
|
|
|
|
|
const getImageList = (images?: string) => {
|
|
|
|
|
if (!images) return []
|
|
|
|
|
return String(images)
|
|
|
|
|
.split(',')
|
|
|
|
|
.map((item) => item.trim())
|
|
|
|
|
.filter(Boolean)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const parseIdsValue = (value: any): string[] => {
|
|
|
|
|
if (!value) return []
|
|
|
|
|
if (Array.isArray(value)) return value.map((v) => String(v).trim()).filter(Boolean)
|
|
|
|
|
return String(value)
|
|
|
|
|
.split(',')
|
|
|
|
|
.map((v) => v.trim())
|
|
|
|
|
.filter(Boolean)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const toCommaSeparatedIds = (value: any): string | undefined => {
|
|
|
|
|
const ids = parseIdsValue(value)
|
|
|
|
|
return ids.length ? ids.join(',') : undefined
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const initOptions = async () => {
|
|
|
|
|
const [planRes, userRes] = await Promise.all([
|
|
|
|
|
PlanMaintenanceApi.getPlanMaintenancePage({}),
|
|
|
|
|
getSimpleUserList()
|
|
|
|
|
])
|
|
|
|
|
planOptions.value = (planRes?.list ?? []) as { id: number | string; planName: string }[]
|
|
|
|
|
users.value = userRes ?? []
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handleMaintainTypeChange = () => {
|
|
|
|
|
// 切换维护类型时重置表单
|
|
|
|
|
if (isInspectOrMaintain.value) {
|
|
|
|
|
taskFormData.name = undefined
|
|
|
|
|
taskFormData.taskType = maintainFormData.maintainType
|
|
|
|
|
taskFormData.projectForm = []
|
|
|
|
|
taskFormData.dateRange = []
|
|
|
|
|
taskFormData.cronExpression = undefined
|
|
|
|
|
taskFormData.operableUsers = []
|
|
|
|
|
taskFormData.enabled = true
|
|
|
|
|
} else if (isRepair.value) {
|
|
|
|
|
repairFormData.repairCode = undefined
|
|
|
|
|
repairFormData.repairName = undefined
|
|
|
|
|
repairFormData.requireDate = undefined
|
|
|
|
|
repairFormData.acceptedBy = undefined
|
|
|
|
|
repairFormData.confirmBy = undefined
|
|
|
|
|
repairFormData.faultLevel = undefined
|
|
|
|
|
repairFormData.shutdown = undefined
|
|
|
|
|
repairFormData.faultPhenomenon = undefined
|
|
|
|
|
repairFormData.faultDescription = undefined
|
|
|
|
|
repairFormData.remark = undefined
|
|
|
|
|
repairFormData.isCode = true
|
|
|
|
|
} else if (isReplaceNet.value) {
|
|
|
|
|
replaceNetFormData.remark = undefined
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const selectMaintainType = (type: number) => {
|
|
|
|
|
maintainFormData.maintainType = type
|
|
|
|
|
handleMaintainTypeChange()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const submitForm = async () => {
|
|
|
|
|
// 表单验证
|
|
|
|
|
try {
|
|
|
|
|
await maintainFormRef.value?.validate()
|
|
|
|
|
} catch {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
submitLoading.value = true
|
|
|
|
|
try {
|
|
|
|
|
if (isInspectOrMaintain.value) {
|
|
|
|
|
// 提交点检/保养任务
|
|
|
|
|
const [startDate, endDate] = Array.isArray(taskFormData.dateRange) ? taskFormData.dateRange : []
|
|
|
|
|
const payload: TaskManagementVO = {
|
|
|
|
|
name: taskFormData.name,
|
|
|
|
|
taskType: taskFormData.taskType,
|
|
|
|
|
moldList: props.mold?.id ? String(props.mold.id) : undefined,
|
|
|
|
|
projectForm: toCommaSeparatedIds(taskFormData.projectForm),
|
|
|
|
|
startDate: startDate || undefined,
|
|
|
|
|
endDate: endDate || undefined,
|
|
|
|
|
cronExpression: taskFormData.cronExpression,
|
|
|
|
|
operableUsers: toCommaSeparatedIds(taskFormData.operableUsers),
|
|
|
|
|
enabled: taskFormData.enabled
|
|
|
|
|
}
|
|
|
|
|
await TaskManagementApi.createTaskManagement(payload)
|
|
|
|
|
message.success(t('common.createSuccess'))
|
|
|
|
|
} else if (isRepair.value) {
|
|
|
|
|
// 提交维修单
|
|
|
|
|
const payload: any = {
|
|
|
|
|
repairCode: repairFormData.isCode ? undefined : repairFormData.repairCode,
|
|
|
|
|
repairName: repairFormData.repairName,
|
|
|
|
|
moldId: props.mold?.id,
|
|
|
|
|
requireDate: repairFormData.requireDate,
|
|
|
|
|
acceptedBy: repairFormData.acceptedBy,
|
|
|
|
|
confirmBy: repairFormData.confirmBy,
|
|
|
|
|
faultLevel: repairFormData.faultLevel,
|
|
|
|
|
shutdown: repairFormData.shutdown,
|
|
|
|
|
faultPhenomenon: repairFormData.faultPhenomenon,
|
|
|
|
|
faultDescription: repairFormData.faultDescription,
|
|
|
|
|
remark: repairFormData.remark
|
|
|
|
|
}
|
|
|
|
|
await MoldRepairApi.createMoldRepair(payload)
|
|
|
|
|
message.success(t('common.createSuccess'))
|
|
|
|
|
} else if (isReplaceNet.value) {
|
|
|
|
|
// 提交更换压网记录(可扩展)
|
|
|
|
|
message.success(t('common.createSuccess'))
|
|
|
|
|
}
|
|
|
|
|
emit('success')
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error(t('MoldManagement.MoldBrandPage.submitFailed'), error)
|
|
|
|
|
} finally {
|
|
|
|
|
submitLoading.value = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const open = async () => {
|
|
|
|
|
maintainFormData.maintainType = 1
|
|
|
|
|
await initOptions()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
defineExpose({ open })
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
.mold-maintain-page__header {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
align-items: center;
|
|
|
|
|
margin-bottom: 20px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.mold-maintain-page__info-card {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
gap: 16px;
|
|
|
|
|
padding: 20px;
|
|
|
|
|
background: #fff;
|
|
|
|
|
border-radius: 12px;
|
|
|
|
|
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
|
|
|
|
|
flex: 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.mold-maintain-page__info-header,
|
|
|
|
|
.mold-maintain-page__form-header {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
gap: 8px;
|
|
|
|
|
margin-bottom: 4px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.mold-maintain-page__info-num {
|
|
|
|
|
display: inline-flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
width: 22px;
|
|
|
|
|
height: 22px;
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
background: var(--el-color-primary);
|
|
|
|
|
color: #fff;
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
flex-shrink: 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.mold-maintain-page__info-title {
|
|
|
|
|
font-size: 15px;
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
color: var(--el-text-color-primary);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.mold-maintain-page__info-image-wrap {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: left;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.mold-maintain-page__info-image {
|
|
|
|
|
width: 120px;
|
|
|
|
|
height: 120px;
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
border: 1px solid var(--el-border-color-lighter);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.mold-maintain-page__info-empty {
|
|
|
|
|
width: 120px;
|
|
|
|
|
height: 120px;
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
border: 1px dashed var(--el-border-color-lighter);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.mold-maintain-page__info-item {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
gap: 8px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.mold-maintain-page__info-label {
|
|
|
|
|
color: var(--el-text-color-secondary);
|
|
|
|
|
font-size: 13px;
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
flex-shrink: 0;
|
|
|
|
|
width: 90px;
|
|
|
|
|
text-align: left;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.mold-maintain-page__info-value {
|
|
|
|
|
color: var(--el-text-color-primary);
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
flex: 1;
|
|
|
|
|
text-align: left;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.mold-maintain-page__body {
|
|
|
|
|
display: flex;
|
|
|
|
|
gap: 20px;
|
|
|
|
|
align-items: stretch;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.mold-maintain-page__sidebar {
|
|
|
|
|
width: 20vw;
|
|
|
|
|
flex-shrink: 0;
|
|
|
|
|
display: flex;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.mold-maintain-page__form {
|
|
|
|
|
flex: 1;
|
|
|
|
|
background: #fff;
|
|
|
|
|
border-radius: 12px;
|
|
|
|
|
padding: 24px 32px;
|
|
|
|
|
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
:deep(.el-form-item__label) {
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.mold-maintain-page__form-actions {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: flex-end;
|
|
|
|
|
gap: 12px;
|
|
|
|
|
margin-top: 24px;
|
|
|
|
|
padding-top: 16px;
|
|
|
|
|
border-top: 1px solid var(--el-border-color-lighter);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.dv-repair-section {
|
|
|
|
|
margin-bottom: 20px;
|
|
|
|
|
padding: 16px;
|
|
|
|
|
background: #f8f9fa;
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.dv-repair-section__title {
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
color: #303133;
|
|
|
|
|
margin-bottom: 16px;
|
|
|
|
|
padding-left: 8px;
|
|
|
|
|
border-left: 3px solid #409eff;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.dv-repair-label {
|
|
|
|
|
display: inline-flex;
|
|
|
|
|
gap: 4px;
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
|
|
|
|
&.is-required::before {
|
|
|
|
|
color: var(--el-color-danger);
|
|
|
|
|
content: '*';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.dv-repair-code-row {
|
|
|
|
|
display: flex;
|
|
|
|
|
gap: 10px;
|
|
|
|
|
align-items: center;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 维护类型卡片样式 */
|
|
|
|
|
.mold-maintain-type-card {
|
|
|
|
|
display: flex;
|
|
|
|
|
gap: 16px;
|
|
|
|
|
flex-wrap: wrap;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.mold-maintain-type-card__item {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
width: 100px;
|
|
|
|
|
height: 100px;
|
|
|
|
|
border-radius: 12px;
|
|
|
|
|
border: 2px solid var(--el-border-color-lighter);
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
transition: all 0.25s ease;
|
|
|
|
|
background: #fff;
|
|
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
|
border-color: var(--el-color-primary);
|
|
|
|
|
transform: translateY(-2px);
|
|
|
|
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&.is-active {
|
|
|
|
|
border-color: var(--el-color-primary);
|
|
|
|
|
background: rgba(64, 158, 255, 0.06);
|
|
|
|
|
box-shadow: 0 4px 12px rgba(64, 158, 255, 0.2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.mold-maintain-type-card__icon {
|
|
|
|
|
width: 44px;
|
|
|
|
|
height: 44px;
|
|
|
|
|
border-radius: 12px;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
color: var(--el-color-primary);
|
|
|
|
|
background: var(--el-color-primary-light-9);
|
|
|
|
|
transition: transform 0.25s ease;
|
|
|
|
|
|
|
|
|
|
.mold-maintain-type-card__item:hover & {
|
|
|
|
|
transform: scale(1.1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.mold-maintain-type-card__label {
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
color: var(--el-text-color-primary);
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.mold-maintain-type-card__item.is-active .mold-maintain-type-card__label {
|
|
|
|
|
color: var(--el-color-primary);
|
|
|
|
|
}
|
|
|
|
|
</style>
|