|
|
|
|
@ -7,7 +7,7 @@
|
|
|
|
|
</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="dv-repair-dialog" v-loading="formLoading">
|
|
|
|
|
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="120px">
|
|
|
|
|
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="100px">
|
|
|
|
|
<section class="dv-repair-section">
|
|
|
|
|
<div class="dv-repair-section__title">基本信息</div>
|
|
|
|
|
<el-row :gutter="20">
|
|
|
|
|
@ -23,31 +23,111 @@
|
|
|
|
|
</template>
|
|
|
|
|
<div class="dv-repair-code-row">
|
|
|
|
|
<el-input
|
|
|
|
|
:disabled="formData.isCode == true || formType === 'update'"
|
|
|
|
|
:disabled="repairCodeDisabled"
|
|
|
|
|
v-model="formData.repairCode"
|
|
|
|
|
:placeholder="t('common.code')"
|
|
|
|
|
/>
|
|
|
|
|
<el-switch
|
|
|
|
|
v-model="formData.isCode"
|
|
|
|
|
:disabled="formType === 'update'"
|
|
|
|
|
:disabled="formType === 'update' || formType === 'repair' || formType === 'detail'"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
<el-form-item :label="t('MoldManagement.MoldRepair.repairName')" prop="repairName">
|
|
|
|
|
<el-form-item :label="t('MoldManagement.MoldRepair.repairName')" prop="repairName" required>
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="formData.repairName"
|
|
|
|
|
:placeholder="t('MoldManagement.MoldRepair.placeholderRepairName')"
|
|
|
|
|
:disabled="isRepairMode"
|
|
|
|
|
:disabled="isBaseInfoReadonly"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
<el-form-item :label="t('MoldManagement.MoldRepair.requireDate')" prop="requireDate" required>
|
|
|
|
|
<el-date-picker
|
|
|
|
|
v-model="formData.requireDate"
|
|
|
|
|
type="date"
|
|
|
|
|
value-format="x"
|
|
|
|
|
:placeholder="t('MoldManagement.MoldRepair.placeholderRequireDate')"
|
|
|
|
|
class="!w-full"
|
|
|
|
|
:disabled="isBaseInfoReadonly"
|
|
|
|
|
/>
|
|
|
|
|
</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="formData.acceptedBy" filterable clearable
|
|
|
|
|
:placeholder="t('MoldManagement.MoldRepair.placeholderAcceptUser')"
|
|
|
|
|
class="!w-full"
|
|
|
|
|
:disabled="isRepairMetaReadonly">
|
|
|
|
|
<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="formData.confirmBy" filterable clearable
|
|
|
|
|
:placeholder="t('MoldManagement.MoldRepair.placeholderConfirmUser')"
|
|
|
|
|
class="!w-full"
|
|
|
|
|
:disabled="isRepairMetaReadonly">
|
|
|
|
|
<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.status')">
|
|
|
|
|
<el-input :model-value="statusLabel" disabled />
|
|
|
|
|
</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">
|
|
|
|
|
<template #label>
|
|
|
|
|
<span class="dv-repair-label is-required">
|
|
|
|
|
{{ t('MoldManagement.MoldRepair.faultLevel') }}
|
|
|
|
|
</span>
|
|
|
|
|
</template>
|
|
|
|
|
<el-radio-group v-model="formData.faultLevel" :disabled="isRepairMetaReadonly">
|
|
|
|
|
<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">
|
|
|
|
|
<template #label>
|
|
|
|
|
<span class="dv-repair-label is-required">
|
|
|
|
|
{{ t('MoldManagement.MoldRepair.isShutdown') }}
|
|
|
|
|
</span>
|
|
|
|
|
</template>
|
|
|
|
|
<el-radio-group v-model="formData.shutdown" :disabled="isRepairMetaReadonly">
|
|
|
|
|
<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">维修对象</div>
|
|
|
|
|
<el-row :gutter="20">
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
<el-form-item :label="t('MoldManagement.MoldRepair.mold')" prop="moldId">
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="formData.moldId" filterable clearable :loading="moldLoading"
|
|
|
|
|
:disabled="isRepairMode"
|
|
|
|
|
:disabled="isBaseInfoReadonly"
|
|
|
|
|
:placeholder="t('MoldManagement.MoldRepair.placeholderMold')"
|
|
|
|
|
class="!w-full"
|
|
|
|
|
>
|
|
|
|
|
@ -55,8 +135,6 @@
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-row :gutter="20">
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
<el-form-item :label="t('MoldManagement.MoldRepair.moldName')" prop="moldName" :required="false">
|
|
|
|
|
<el-input v-model="formData.moldName" :placeholder="t('MoldManagement.MoldRepair.placeholderMoldNameAuto')" disabled />
|
|
|
|
|
@ -68,27 +146,46 @@
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
<section class="dv-repair-section">
|
|
|
|
|
<div class="dv-repair-section__title">故障信息</div>
|
|
|
|
|
<el-row :gutter="20">
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
<el-form-item :label="t('MoldManagement.MoldRepair.repairUser')" prop="acceptedBy">
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="formData.acceptedBy" filterable clearable
|
|
|
|
|
:placeholder="t('MoldManagement.MoldRepair.placeholderAcceptUser')"
|
|
|
|
|
class="!w-full"
|
|
|
|
|
:disabled="isRepairMode">
|
|
|
|
|
<el-option v-for="item in users" :key="String(item.id)" :label="item.nickname" :value="String(item.id)" />
|
|
|
|
|
</el-select>
|
|
|
|
|
<el-col :span="24">
|
|
|
|
|
<el-form-item :label="t('MoldManagement.MoldRepair.faultPhenomenon')" prop="faultPhenomenon">
|
|
|
|
|
<template #label>
|
|
|
|
|
<span class="dv-repair-label is-required">
|
|
|
|
|
{{ t('MoldManagement.MoldRepair.faultPhenomenon') }}
|
|
|
|
|
</span>
|
|
|
|
|
</template>
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="formData.faultPhenomenon"
|
|
|
|
|
:placeholder="t('MoldManagement.MoldRepair.placeholderFaultPhenomenon')"
|
|
|
|
|
:disabled="isFaultInfoReadonly"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item :label="t('MoldManagement.MoldRepair.faultDescription')" prop="faultDescription">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="formData.faultDescription"
|
|
|
|
|
type="textarea"
|
|
|
|
|
:rows="4"
|
|
|
|
|
:placeholder="t('MoldManagement.MoldRepair.placeholderFaultDescription')"
|
|
|
|
|
:disabled="isFaultInfoReadonly"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
<el-form-item :label="t('MoldManagement.MoldRepair.confirmUser')" prop="confirmBy">
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="formData.confirmBy" filterable clearable
|
|
|
|
|
:placeholder="t('MoldManagement.MoldRepair.placeholderConfirmUser')"
|
|
|
|
|
class="!w-full"
|
|
|
|
|
:disabled="isRepairMode">
|
|
|
|
|
<el-option v-for="item in users" :key="String(item.id)" :label="item.nickname" :value="String(item.id)" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-row :gutter="20">
|
|
|
|
|
<el-col :span="24">
|
|
|
|
|
<el-form-item :label="t('MoldManagement.MoldRepair.faultImages')">
|
|
|
|
|
<UploadImgs
|
|
|
|
|
v-model="faultImagesValue"
|
|
|
|
|
:limit="9"
|
|
|
|
|
:disabled="isFaultInfoReadonly"
|
|
|
|
|
width="120px"
|
|
|
|
|
height="120px"
|
|
|
|
|
class="dv-repair-upload"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
@ -98,16 +195,30 @@
|
|
|
|
|
<div class="dv-repair-section__title">处理结果</div>
|
|
|
|
|
<el-row :gutter="20">
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
<el-form-item :label="t('MoldManagement.MoldRepair.requireDate')" prop="requireDate">
|
|
|
|
|
<el-date-picker
|
|
|
|
|
v-model="formData.requireDate" type="date" value-format="x"
|
|
|
|
|
:placeholder="t('MoldManagement.MoldRepair.placeholderRequireDate')"
|
|
|
|
|
class="!w-full" :disabled="repairFieldsDisabled"
|
|
|
|
|
/>
|
|
|
|
|
<el-form-item :label="t('MoldManagement.MoldRepair.repairResult')" prop="repairStatus">
|
|
|
|
|
<template #label>
|
|
|
|
|
<span class="dv-repair-label" :class="{ 'is-required': formType === 'repair' }">
|
|
|
|
|
{{ t('MoldManagement.MoldRepair.repairResult') }}
|
|
|
|
|
</span>
|
|
|
|
|
</template>
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="formData.repairStatus"
|
|
|
|
|
class="!w-full"
|
|
|
|
|
:placeholder="t('MoldManagement.MoldRepair.placeholderRepairResult')"
|
|
|
|
|
:disabled="repairFieldsDisabled"
|
|
|
|
|
>
|
|
|
|
|
<el-option :label="t('MoldManagement.MoldRepair.repairResultOk')" :value="1" />
|
|
|
|
|
<el-option :label="t('MoldManagement.MoldRepair.repairResultNg')" :value="2" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
<el-form-item :label="t('MoldManagement.MoldRepair.finishDate')" prop="finishDate">
|
|
|
|
|
<template #label>
|
|
|
|
|
<span class="dv-repair-label" :class="{ 'is-required': formType === 'repair' }">
|
|
|
|
|
{{ t('MoldManagement.MoldRepair.finishDate') }}
|
|
|
|
|
</span>
|
|
|
|
|
</template>
|
|
|
|
|
<el-date-picker
|
|
|
|
|
v-model="formData.finishDate" type="date" value-format="x"
|
|
|
|
|
:placeholder="t('MoldManagement.MoldRepair.placeholderFinishDate')"
|
|
|
|
|
@ -117,6 +228,11 @@
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
<el-form-item :label="t('MoldManagement.MoldRepair.confirmDate')" prop="confirmDate">
|
|
|
|
|
<template #label>
|
|
|
|
|
<span class="dv-repair-label" :class="{ 'is-required': formType === 'repair' }">
|
|
|
|
|
{{ t('MoldManagement.MoldRepair.confirmDate') }}
|
|
|
|
|
</span>
|
|
|
|
|
</template>
|
|
|
|
|
<el-date-picker
|
|
|
|
|
v-model="formData.confirmDate" type="date" value-format="x"
|
|
|
|
|
:placeholder="t('MoldManagement.MoldRepair.placeholderConfirmDate')"
|
|
|
|
|
@ -125,56 +241,138 @@
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-row :gutter="20">
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
<el-form-item :label="t('MoldManagement.MoldRepair.downtimeDuration')" prop="downtimeDuration">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="formData.downtimeDuration"
|
|
|
|
|
:placeholder="t('MoldManagement.MoldRepair.placeholderDowntimeDuration')"
|
|
|
|
|
:disabled="repairFieldsDisabled"
|
|
|
|
|
>
|
|
|
|
|
<template #append>小时</template>
|
|
|
|
|
</el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
<el-form-item :label="t('MoldManagement.MoldRepair.faultReason')" prop="faultReason">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="formData.faultReason"
|
|
|
|
|
:placeholder="t('MoldManagement.MoldRepair.placeholderFaultReason')"
|
|
|
|
|
:disabled="repairFieldsDisabled"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
<el-form-item :label="t('MoldManagement.MoldRepair.handlingMeasures')" prop="handlingMeasures">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="formData.handlingMeasures"
|
|
|
|
|
:placeholder="t('MoldManagement.MoldRepair.placeholderHandlingMeasures')"
|
|
|
|
|
:disabled="repairFieldsDisabled"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-row :gutter="20">
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
<el-form-item :label="t('MoldManagement.MoldRepair.replacementParts')" prop="replacementParts">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="formData.replacementParts"
|
|
|
|
|
:placeholder="t('MoldManagement.MoldRepair.placeholderReplacementParts')"
|
|
|
|
|
:disabled="repairFieldsDisabled"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-row :gutter="20">
|
|
|
|
|
<el-col :span="14">
|
|
|
|
|
<el-form-item :label="t('MoldManagement.MoldRepair.repairContent')" prop="repairContent">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="formData.repairContent"
|
|
|
|
|
type="textarea"
|
|
|
|
|
:rows="4"
|
|
|
|
|
:maxlength="1000"
|
|
|
|
|
show-word-limit
|
|
|
|
|
:placeholder="t('MoldManagement.MoldRepair.placeholderRepairContent')"
|
|
|
|
|
:disabled="repairFieldsDisabled"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-row :gutter="20">
|
|
|
|
|
<el-col :span="24">
|
|
|
|
|
<el-form-item :label="t('MoldManagement.MoldRepair.repairResult')" prop="repairResult">
|
|
|
|
|
<Editor v-model="formData.repairResult" height="150px" :readonly="repairFieldsDisabled" />
|
|
|
|
|
<el-form-item :label="t('MoldManagement.MoldRepair.repairedImages')">
|
|
|
|
|
<UploadImgs
|
|
|
|
|
v-model="repairedImagesValue"
|
|
|
|
|
:limit="9"
|
|
|
|
|
:disabled="repairFieldsDisabled"
|
|
|
|
|
width="120px"
|
|
|
|
|
height="120px"
|
|
|
|
|
class="dv-repair-upload"
|
|
|
|
|
>
|
|
|
|
|
<template #tip>
|
|
|
|
|
<span>最多上传 9 张维修后图片</span>
|
|
|
|
|
</template>
|
|
|
|
|
</UploadImgs>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
</section>
|
|
|
|
|
</el-form>
|
|
|
|
|
|
|
|
|
|
<el-tabs v-model="subTabsName" style="margin-top: 16px;">
|
|
|
|
|
<el-tab-pane :label="t('MoldManagement.MoldRepair.tabMoldRepairLine')" name="moldRepairLine">
|
|
|
|
|
<MoldRepairLineForm ref="moldRepairLineFormRef" :repair-id="formData.id" :line-mode="lineMode" />
|
|
|
|
|
</el-tab-pane>
|
|
|
|
|
</el-tabs>
|
|
|
|
|
<section class="dv-repair-section">
|
|
|
|
|
<div class="dv-repair-section__title">创建备注 / 补充说明</div>
|
|
|
|
|
<el-form-item prop="remark" label-width="0">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="formData.remark"
|
|
|
|
|
type="textarea"
|
|
|
|
|
:rows="3"
|
|
|
|
|
maxlength="300"
|
|
|
|
|
show-word-limit
|
|
|
|
|
:placeholder="t('MoldManagement.MoldRepair.placeholderRemark')"
|
|
|
|
|
:disabled="formType === 'repair' || isDetailMode"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</section>
|
|
|
|
|
</el-form>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="dv-repair-footer">
|
|
|
|
|
<el-button @click="closeForm">{{ t('common.cancel') }}</el-button>
|
|
|
|
|
<el-button @click="submitForm" type="primary" :disabled="formLoading">{{ t('common.ok') }}</el-button>
|
|
|
|
|
<el-button v-if="!isDetailMode" @click="submitForm" type="primary" :disabled="formLoading">{{ submitButtonText }}</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { MoldRepairApi, MoldRepairVO } from '@/api/mold/moldrepair'
|
|
|
|
|
import { MoldRepairItemsApi } from '@/api/mold/moldRepairItems'
|
|
|
|
|
import MoldRepairLineForm from './components/MoldRepairLineForm.vue'
|
|
|
|
|
import { MoldBrandApi, MoldVO } from '@/api/erp/mold'
|
|
|
|
|
import { getSimpleUserList, UserVO } from '@/api/system/user'
|
|
|
|
|
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
|
|
|
|
|
|
|
|
|
|
defineOptions({ name: 'MoldRepairForm' })
|
|
|
|
|
|
|
|
|
|
const { t } = useI18n()
|
|
|
|
|
const message = useMessage()
|
|
|
|
|
interface MoldRepairFormData extends Partial<MoldRepairVO> {
|
|
|
|
|
moldId?: number
|
|
|
|
|
shutdown?: boolean
|
|
|
|
|
isCode?: boolean
|
|
|
|
|
faultLevel?: string
|
|
|
|
|
faultImages?: string
|
|
|
|
|
repairResult?: string
|
|
|
|
|
repairStatus?: string
|
|
|
|
|
faultPhenomenon?: string
|
|
|
|
|
faultDescription?: string
|
|
|
|
|
faultReason?: string
|
|
|
|
|
downtimeDuration?: string
|
|
|
|
|
handlingMeasures?: string
|
|
|
|
|
replacementParts?: string
|
|
|
|
|
repairContent?: string
|
|
|
|
|
repairedImages?: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const dialogTitle = ref('')
|
|
|
|
|
const formLoading = ref(false)
|
|
|
|
|
const formType = ref('')
|
|
|
|
|
const isRepairMode = computed(() => formType.value === 'update' || formType.value === 'repair')
|
|
|
|
|
const showRepairFields = computed(() => formType.value === 'update' || formType.value === 'repair')
|
|
|
|
|
const repairFieldsDisabled = computed(() => formType.value !== 'repair')
|
|
|
|
|
const isHydrating = ref(false)
|
|
|
|
|
const openRequestId = ref(0)
|
|
|
|
|
const emit = defineEmits(['success', 'closed'])
|
|
|
|
|
const formData = ref({
|
|
|
|
|
const createDefaultFormData = (): MoldRepairFormData => ({
|
|
|
|
|
id: undefined,
|
|
|
|
|
repairCode: undefined,
|
|
|
|
|
repairName: undefined,
|
|
|
|
|
moldId: undefined as number | undefined,
|
|
|
|
|
moldId: undefined,
|
|
|
|
|
moldCode: undefined,
|
|
|
|
|
moldName: undefined,
|
|
|
|
|
machineryBrand: undefined,
|
|
|
|
|
@ -183,28 +381,73 @@ const formData = ref({
|
|
|
|
|
finishDate: undefined,
|
|
|
|
|
confirmDate: undefined,
|
|
|
|
|
repairResult: '',
|
|
|
|
|
repairStatus: '',
|
|
|
|
|
faultPhenomenon: undefined,
|
|
|
|
|
faultDescription: undefined,
|
|
|
|
|
faultLevel: undefined,
|
|
|
|
|
shutdown: undefined,
|
|
|
|
|
faultImages: '',
|
|
|
|
|
faultReason: undefined,
|
|
|
|
|
acceptedBy: undefined,
|
|
|
|
|
confirmBy: undefined,
|
|
|
|
|
status: undefined,
|
|
|
|
|
remark: undefined,
|
|
|
|
|
isCode: undefined
|
|
|
|
|
isCode: true,
|
|
|
|
|
downtimeDuration: undefined,
|
|
|
|
|
handlingMeasures: undefined,
|
|
|
|
|
replacementParts: undefined,
|
|
|
|
|
repairContent: undefined,
|
|
|
|
|
repairedImages: '',
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const { t } = useI18n()
|
|
|
|
|
const message = useMessage()
|
|
|
|
|
|
|
|
|
|
const dialogTitle = ref('')
|
|
|
|
|
const formLoading = ref(false)
|
|
|
|
|
const formType = ref('')
|
|
|
|
|
const isDetailMode = computed(() => formType.value === 'detail')
|
|
|
|
|
const isBaseInfoReadonly = computed(() => formType.value === 'repair' || formType.value === 'detail')
|
|
|
|
|
const isRepairMetaReadonly = computed(() => formType.value === 'detail')
|
|
|
|
|
const isFaultInfoReadonly = computed(() => formType.value === 'repair' || formType.value === 'detail')
|
|
|
|
|
const repairCodeDisabled = computed(() => formData.value.isCode === true || formType.value === 'update' || formType.value === 'repair' || formType.value === 'detail')
|
|
|
|
|
const submitButtonText = computed(() => {
|
|
|
|
|
if (formType.value === 'create') return '保存'
|
|
|
|
|
if (formType.value === 'repair') return '保存并提交'
|
|
|
|
|
return t('common.ok')
|
|
|
|
|
})
|
|
|
|
|
const currentStatusValue = computed(() => {
|
|
|
|
|
const value = formData.value.status
|
|
|
|
|
return value === '' || value === null || value === undefined ? '' : String(value)
|
|
|
|
|
})
|
|
|
|
|
const currentRepairStatusValue = computed(() => {
|
|
|
|
|
const value = formData.value.repairStatus
|
|
|
|
|
return value === '' || value === null || value === undefined ? '0' : String(value)
|
|
|
|
|
})
|
|
|
|
|
const showRepairFields = computed(() => {
|
|
|
|
|
if (formType.value === 'repair') return true
|
|
|
|
|
if (formType.value === 'update') return currentStatusValue.value === '1'
|
|
|
|
|
if (formType.value === 'detail') return currentRepairStatusValue.value !== '0'
|
|
|
|
|
return false
|
|
|
|
|
})
|
|
|
|
|
const repairFieldsDisabled = computed(() => formType.value !== 'repair')
|
|
|
|
|
const failureLevelOptions = computed(() => getStrDictOptions(DICT_TYPE.FAILURE_LEVEL))
|
|
|
|
|
const statusLabel = computed(() => {
|
|
|
|
|
const status = formData.value.status
|
|
|
|
|
if (status === '' || status === null || status === undefined) return t('MoldManagement.MoldRepair.statusPending')
|
|
|
|
|
return String(status) === '1'
|
|
|
|
|
? t('MoldManagement.MoldRepair.statusDone')
|
|
|
|
|
: t('MoldManagement.MoldRepair.statusPending')
|
|
|
|
|
})
|
|
|
|
|
const isHydrating = ref(false)
|
|
|
|
|
const openRequestId = ref(0)
|
|
|
|
|
const emit = defineEmits(['success', 'closed'])
|
|
|
|
|
const formData = ref<MoldRepairFormData>(createDefaultFormData())
|
|
|
|
|
|
|
|
|
|
const moldLoading = ref(false)
|
|
|
|
|
const moldOptions = ref<{ label: string; value: number; raw?: MoldVO }[]>([])
|
|
|
|
|
const moldOptionsLoaded = ref(false)
|
|
|
|
|
|
|
|
|
|
const lineMode = computed(() => {
|
|
|
|
|
if (formType.value === 'repair') return 'repair' as const
|
|
|
|
|
if (formType.value === 'update') {
|
|
|
|
|
const v = formData.value.status === '' || formData.value.status === null || formData.value.status === undefined
|
|
|
|
|
? undefined
|
|
|
|
|
: String(formData.value.status)
|
|
|
|
|
if (v === '1') return 'readonlyWithResult' as const
|
|
|
|
|
}
|
|
|
|
|
return 'edit' as const
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const users = ref<UserVO[]>([])
|
|
|
|
|
|
|
|
|
|
const ensureUsersLoaded = async () => {
|
|
|
|
|
@ -252,14 +495,13 @@ const ensureMoldOptionsLoaded = async () => {
|
|
|
|
|
|
|
|
|
|
watch(
|
|
|
|
|
() => formData.value.moldId,
|
|
|
|
|
async (moldId) => {
|
|
|
|
|
(moldId) => {
|
|
|
|
|
if (isHydrating.value) return
|
|
|
|
|
if (typeof moldId !== 'number') {
|
|
|
|
|
formData.value.moldCode = undefined
|
|
|
|
|
formData.value.moldName = undefined
|
|
|
|
|
formData.value.machinerySpec = undefined
|
|
|
|
|
formData.value.machineryBrand = undefined
|
|
|
|
|
if (formType.value === 'create') setLineRows([])
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -273,8 +515,6 @@ watch(
|
|
|
|
|
formData.value.machinerySpec = raw?.moldType ?? raw?.spec ?? raw?.moldSpec
|
|
|
|
|
formData.value.machineryBrand = raw?.brandName ?? raw?.brand ?? raw?.moldBrand
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await prefillLinesByMold(moldId as number)
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
const formRules = reactive({
|
|
|
|
|
@ -298,12 +538,12 @@ const formRules = reactive({
|
|
|
|
|
trigger: 'blur',
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
repairName: [],
|
|
|
|
|
repairName: [{ required: true, message: t('MoldManagement.MoldRepair.validatorRepairNameRequired'), trigger: 'blur' }],
|
|
|
|
|
moldId: [{ required: true, message: t('MoldManagement.MoldRepair.validatorMoldRequired'), trigger: 'change' }],
|
|
|
|
|
requireDate: [
|
|
|
|
|
{
|
|
|
|
|
validator: (_: any, value: any, callback: any) => {
|
|
|
|
|
if (formType.value === 'repair' && !value) {
|
|
|
|
|
if (!value) {
|
|
|
|
|
callback(new Error(t('MoldManagement.MoldRepair.validatorRequireDateRequired')))
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
@ -336,7 +576,7 @@ const formRules = reactive({
|
|
|
|
|
trigger: 'change',
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
repairResult: [
|
|
|
|
|
repairStatus: [
|
|
|
|
|
{
|
|
|
|
|
validator: (_: any, value: any, callback: any) => {
|
|
|
|
|
if (formType.value === 'repair' && !value) {
|
|
|
|
|
@ -345,14 +585,79 @@ const formRules = reactive({
|
|
|
|
|
}
|
|
|
|
|
callback()
|
|
|
|
|
},
|
|
|
|
|
trigger: 'change',
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
faultPhenomenon: [
|
|
|
|
|
{
|
|
|
|
|
validator: (_: any, value: any, callback: any) => {
|
|
|
|
|
if (value === undefined || value === null || String(value).trim() === '') {
|
|
|
|
|
callback(new Error(t('MoldManagement.MoldRepair.validatorFaultPhenomenonRequired')))
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
callback()
|
|
|
|
|
},
|
|
|
|
|
trigger: 'blur',
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
faultLevel: [
|
|
|
|
|
{
|
|
|
|
|
validator: (_: any, value: any, callback: any) => {
|
|
|
|
|
if (value === undefined || value === null || String(value).trim() === '') {
|
|
|
|
|
callback(new Error(t('MoldManagement.MoldRepair.validatorFaultLevelRequired')))
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
callback()
|
|
|
|
|
},
|
|
|
|
|
trigger: 'change',
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
shutdown: [
|
|
|
|
|
{
|
|
|
|
|
validator: (_: any, value: any, callback: any) => {
|
|
|
|
|
if (value === undefined || value === null || value === '') {
|
|
|
|
|
callback(new Error(t('MoldManagement.MoldRepair.validatorIsShutdownRequired')))
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
callback()
|
|
|
|
|
},
|
|
|
|
|
trigger: 'change',
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
})
|
|
|
|
|
const formRef = ref()
|
|
|
|
|
|
|
|
|
|
const subTabsName = ref('moldRepairLine')
|
|
|
|
|
const moldRepairLineFormRef = ref()
|
|
|
|
|
const splitImageValue = (value: unknown) => {
|
|
|
|
|
if (Array.isArray(value)) return value.map((item) => String(item).trim()).filter(Boolean)
|
|
|
|
|
if (typeof value !== 'string') return []
|
|
|
|
|
return value
|
|
|
|
|
.split(',')
|
|
|
|
|
.map((item) => item.trim())
|
|
|
|
|
.filter(Boolean)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const normalizeImageString = (value: unknown) => splitImageValue(value).join(',')
|
|
|
|
|
|
|
|
|
|
const normalizeRepairStatusValue = (value: unknown) => {
|
|
|
|
|
if (value === undefined || value === null || value === '') return ''
|
|
|
|
|
const num = Number(value)
|
|
|
|
|
if (!Number.isNaN(num) && num === 0) return ''
|
|
|
|
|
return Number.isNaN(num) ? value : num
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const faultImagesValue = computed<string[]>({
|
|
|
|
|
get: () => splitImageValue(formData.value.faultImages),
|
|
|
|
|
set: (value) => {
|
|
|
|
|
formData.value.faultImages = value.join(',')
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const repairedImagesValue = computed<string[]>({
|
|
|
|
|
get: () => splitImageValue(formData.value.repairedImages),
|
|
|
|
|
set: (value) => {
|
|
|
|
|
formData.value.repairedImages = value.join(',')
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
watch(
|
|
|
|
|
() => formData.value.isCode,
|
|
|
|
|
@ -364,44 +669,6 @@ watch(
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
const setLineRows = (rows: any[]) => {
|
|
|
|
|
moldRepairLineFormRef.value?.setData(rows)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const normalizeMoldRepairItemList = (data: any) => {
|
|
|
|
|
const rows = (Array.isArray(data) ? data : data?.list ?? data?.data ?? []) as any[]
|
|
|
|
|
return rows
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const toMoldRepairLineRow = (item: any) => {
|
|
|
|
|
const subjectId = item?.subjectId ?? item?.id
|
|
|
|
|
return {
|
|
|
|
|
id: undefined,
|
|
|
|
|
repairId: formData.value.id,
|
|
|
|
|
subjectId,
|
|
|
|
|
subjectCode: item?.subjectCode ?? item?.subject_code ?? item?.code,
|
|
|
|
|
subjectName: item?.subjectName ?? item?.subject_name ?? item?.name,
|
|
|
|
|
subjectType: item?.subjectType ?? item?.subject_type ?? item?.type,
|
|
|
|
|
subjectContent: item?.subjectContent ?? item?.projectContent ?? item?.subject_content,
|
|
|
|
|
subjectStandard: item?.subjectStandard ?? item?.judgmentCriteria ?? item?.subject_standard,
|
|
|
|
|
malfunction: undefined,
|
|
|
|
|
malfunctionUrl: undefined,
|
|
|
|
|
repairDes: undefined,
|
|
|
|
|
remark: undefined,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const prefillLinesByMold = async (moldId: number | undefined) => {
|
|
|
|
|
if (formType.value !== 'create') return
|
|
|
|
|
if (typeof moldId !== 'number') {
|
|
|
|
|
setLineRows([])
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
const data = await MoldRepairItemsApi.getRepairItemsPage({ pageNo: 1, pageSize: 100, moldId })
|
|
|
|
|
const list = normalizeMoldRepairItemList(data)
|
|
|
|
|
setLineRows(list.map(toMoldRepairLineRow))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const open = async (type: string, id?: number) => {
|
|
|
|
|
const currentOpenId = ++openRequestId.value
|
|
|
|
|
dialogTitle.value = type === 'repair' ? '维修处理结果' : t('action.' + type)
|
|
|
|
|
@ -422,6 +689,20 @@ const open = async (type: string, id?: number) => {
|
|
|
|
|
;(formData.value as any).finishDate = (formData.value as any).finishDate ?? undefined
|
|
|
|
|
;(formData.value as any).confirmDate = (formData.value as any).confirmDate ?? undefined
|
|
|
|
|
;(formData.value as any).repairResult = (formData.value as any).repairResult ?? ''
|
|
|
|
|
;(formData.value as any).repairStatus = (formData.value as any).repairStatus === undefined || (formData.value as any).repairStatus === null || (formData.value as any).repairStatus === ''
|
|
|
|
|
? normalizeRepairStatusValue((formData.value as any).repairResult)
|
|
|
|
|
: normalizeRepairStatusValue((formData.value as any).repairStatus)
|
|
|
|
|
;(formData.value as any).faultPhenomenon = (formData.value as any).faultPhenomenon ?? undefined
|
|
|
|
|
;(formData.value as any).faultDescription = (formData.value as any).faultDescription ?? undefined
|
|
|
|
|
;(formData.value as any).faultLevel = (formData.value as any).faultLevel === undefined || (formData.value as any).faultLevel === null ? undefined : String((formData.value as any).faultLevel)
|
|
|
|
|
;(formData.value as any).shutdown = (formData.value as any).shutdown ?? undefined
|
|
|
|
|
;(formData.value as any).faultImages = normalizeImageString((formData.value as any).faultImages)
|
|
|
|
|
;(formData.value as any).faultReason = (formData.value as any).faultReason ?? undefined
|
|
|
|
|
;(formData.value as any).downtimeDuration = (formData.value as any).downtimeDuration ?? undefined
|
|
|
|
|
;(formData.value as any).handlingMeasures = (formData.value as any).handlingMeasures ?? undefined
|
|
|
|
|
;(formData.value as any).replacementParts = (formData.value as any).replacementParts ?? undefined
|
|
|
|
|
;(formData.value as any).repairContent = (formData.value as any).repairContent ?? undefined
|
|
|
|
|
;(formData.value as any).repairedImages = normalizeImageString((formData.value as any).repairedImages)
|
|
|
|
|
|
|
|
|
|
;(formData.value as any).acceptedBy = normalizeUserId((formData.value as any).acceptedBy)
|
|
|
|
|
;(formData.value as any).confirmBy = normalizeUserId((formData.value as any).confirmBy)
|
|
|
|
|
@ -462,7 +743,14 @@ const submitForm = async () => {
|
|
|
|
|
await formRef.value.validate()
|
|
|
|
|
formLoading.value = true
|
|
|
|
|
try {
|
|
|
|
|
const data = { ...formData.value }
|
|
|
|
|
const data: any = { ...formData.value }
|
|
|
|
|
data.faultLevel = data.faultLevel === undefined || data.faultLevel === null || String(data.faultLevel).trim() === '' ? undefined : String(data.faultLevel)
|
|
|
|
|
data.faultImages = Array.isArray(data.faultImages) ? data.faultImages.join(',') : (data.faultImages ?? '')
|
|
|
|
|
data.repairedImages = Array.isArray(data.repairedImages) ? data.repairedImages.join(',') : (data.repairedImages ?? '')
|
|
|
|
|
data.repairResult = data.repairStatus
|
|
|
|
|
if (formType.value === 'repair') {
|
|
|
|
|
data.status = '1'
|
|
|
|
|
}
|
|
|
|
|
if (formType.value === 'create') {
|
|
|
|
|
await MoldRepairApi.createMoldRepair(data)
|
|
|
|
|
message.success(t('common.createSuccess'))
|
|
|
|
|
@ -470,7 +758,6 @@ const submitForm = async () => {
|
|
|
|
|
await MoldRepairApi.updateMoldRepair(data)
|
|
|
|
|
message.success(t('common.updateSuccess'))
|
|
|
|
|
}
|
|
|
|
|
await moldRepairLineFormRef.value?.submit()
|
|
|
|
|
closeForm()
|
|
|
|
|
emit('success')
|
|
|
|
|
} finally {
|
|
|
|
|
@ -479,25 +766,7 @@ const submitForm = async () => {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const resetForm = () => {
|
|
|
|
|
formData.value = {
|
|
|
|
|
id: undefined,
|
|
|
|
|
repairCode: undefined,
|
|
|
|
|
repairName: undefined,
|
|
|
|
|
moldId: undefined,
|
|
|
|
|
moldCode: undefined,
|
|
|
|
|
moldName: undefined,
|
|
|
|
|
machineryBrand: undefined,
|
|
|
|
|
machinerySpec: undefined,
|
|
|
|
|
requireDate: undefined,
|
|
|
|
|
finishDate: undefined,
|
|
|
|
|
confirmDate: undefined,
|
|
|
|
|
repairResult: '',
|
|
|
|
|
acceptedBy: undefined,
|
|
|
|
|
confirmBy: undefined,
|
|
|
|
|
status: undefined,
|
|
|
|
|
remark: undefined,
|
|
|
|
|
isCode: true
|
|
|
|
|
}
|
|
|
|
|
formData.value = createDefaultFormData()
|
|
|
|
|
moldOptionsLoaded.value = false
|
|
|
|
|
formRef.value?.resetFields()
|
|
|
|
|
}
|
|
|
|
|
@ -531,6 +800,17 @@ const resetForm = () => {
|
|
|
|
|
overflow-y: auto;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.dv-repair-label {
|
|
|
|
|
display: inline-flex;
|
|
|
|
|
gap: 4px;
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
|
|
|
|
&.is-required::before {
|
|
|
|
|
color: var(--el-color-danger);
|
|
|
|
|
content: '*';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.dv-repair-section {
|
|
|
|
|
margin-bottom: 20px;
|
|
|
|
|
padding: 16px;
|
|
|
|
|
|