|
|
|
@ -9,7 +9,7 @@
|
|
|
|
<div class="dv-repair-dialog" v-loading="formLoading">
|
|
|
|
<div class="dv-repair-dialog" v-loading="formLoading">
|
|
|
|
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="100px">
|
|
|
|
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="100px">
|
|
|
|
<section class="dv-repair-section">
|
|
|
|
<section class="dv-repair-section">
|
|
|
|
<div class="dv-repair-section__title">基本信息</div>
|
|
|
|
<div class="dv-repair-section__title">{{ t('MoldManagement.MoldRepair.reportInfo') }}</div>
|
|
|
|
<el-row :gutter="20">
|
|
|
|
<el-row :gutter="20">
|
|
|
|
<el-col :span="8">
|
|
|
|
<el-col :span="8">
|
|
|
|
<el-form-item :label="t('MoldManagement.MoldRepair.repairCode')" prop="repairCode">
|
|
|
|
<el-form-item :label="t('MoldManagement.MoldRepair.repairCode')" prop="repairCode">
|
|
|
|
@ -70,28 +70,6 @@
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
</el-col>
|
|
|
|
<el-col v-if="formType !== 'create'" :span="8">
|
|
|
|
<el-col v-if="formType !== 'create'" :span="8">
|
|
|
|
<el-form-item :label="t('MoldManagement.MoldRepair.repairUser')" prop="acceptedBy">
|
|
|
|
|
|
|
|
<el-select
|
|
|
|
|
|
|
|
v-model="formData.acceptedBy" multiple 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 v-if="formType !== 'create'" :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-form-item :label="t('MoldManagement.MoldRepair.status')">
|
|
|
|
<el-input :model-value="statusLabel" disabled />
|
|
|
|
<el-input :model-value="statusLabel" disabled />
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
@ -133,9 +111,9 @@
|
|
|
|
</section>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
|
|
<section class="dv-repair-section">
|
|
|
|
<section class="dv-repair-section">
|
|
|
|
<div class="dv-repair-section__title">维修对象</div>
|
|
|
|
<div class="dv-repair-section__title">{{ t('MoldManagement.MoldRepair.faultInfo') }}</div>
|
|
|
|
<el-row :gutter="20">
|
|
|
|
<el-row :gutter="20">
|
|
|
|
<el-col :span="8">
|
|
|
|
<el-col :span="24">
|
|
|
|
<el-form-item :label="t('MoldManagement.MoldRepair.mold')" prop="moldId">
|
|
|
|
<el-form-item :label="t('MoldManagement.MoldRepair.mold')" prop="moldId">
|
|
|
|
<el-input
|
|
|
|
<el-input
|
|
|
|
:model-value="selectedMoldText"
|
|
|
|
:model-value="selectedMoldText"
|
|
|
|
@ -154,24 +132,6 @@
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
</el-input>
|
|
|
|
</el-input>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
|
|
|
|
<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 />
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
|
|
|
<el-form-item :label="t('MoldManagement.MoldRepair.moldCode')" prop="moldCode" :required="false">
|
|
|
|
|
|
|
|
<el-input v-model="formData.moldCode" :placeholder="t('MoldManagement.MoldRepair.placeholderMoldCodeAuto')" disabled />
|
|
|
|
|
|
|
|
</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="24">
|
|
|
|
|
|
|
|
<el-form-item :label="t('MoldManagement.MoldRepair.faultPhenomenon')" prop="faultPhenomenon">
|
|
|
|
<el-form-item :label="t('MoldManagement.MoldRepair.faultPhenomenon')" prop="faultPhenomenon">
|
|
|
|
<template #label>
|
|
|
|
<template #label>
|
|
|
|
<span class="dv-repair-label is-required">
|
|
|
|
<span class="dv-repair-label is-required">
|
|
|
|
@ -212,8 +172,35 @@
|
|
|
|
</section>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
|
|
<section v-if="showRepairFields" class="dv-repair-section">
|
|
|
|
<section v-if="showRepairFields" class="dv-repair-section">
|
|
|
|
<div class="dv-repair-section__title">处理结果</div>
|
|
|
|
<div class="dv-repair-section__title-row">
|
|
|
|
|
|
|
|
<div class="dv-repair-section__title">{{ t('MoldManagement.MoldRepair.processingResult') }}</div>
|
|
|
|
|
|
|
|
<el-select
|
|
|
|
|
|
|
|
v-if="hasRepairHistory"
|
|
|
|
|
|
|
|
v-model="selectedRepairHistoryIndex"
|
|
|
|
|
|
|
|
class="dv-repair-history-select"
|
|
|
|
|
|
|
|
@change="changeRepairHistory"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<el-option
|
|
|
|
|
|
|
|
v-for="option in repairHistoryOptions"
|
|
|
|
|
|
|
|
:key="option.value"
|
|
|
|
|
|
|
|
:value="option.value"
|
|
|
|
|
|
|
|
:label="option.label"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</el-select>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<el-row :gutter="20">
|
|
|
|
<el-row :gutter="20">
|
|
|
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
|
|
|
<el-form-item :label="t('MoldManagement.MoldRepair.repairUser')" prop="acceptedBy">
|
|
|
|
|
|
|
|
<el-select
|
|
|
|
|
|
|
|
v-model="formData.acceptedBy" multiple filterable clearable
|
|
|
|
|
|
|
|
:placeholder="t('MoldManagement.MoldRepair.placeholderAcceptUser')"
|
|
|
|
|
|
|
|
class="!w-full"
|
|
|
|
|
|
|
|
:disabled="repairFieldsDisabled"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<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-col :span="8">
|
|
|
|
<el-form-item :label="t('MoldManagement.MoldRepair.repairResult')" prop="repairStatus">
|
|
|
|
<el-form-item :label="t('MoldManagement.MoldRepair.repairResult')" prop="repairStatus">
|
|
|
|
<template #label>
|
|
|
|
<template #label>
|
|
|
|
@ -246,20 +233,6 @@
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
</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="datetime" format="YYYY-MM-DD HH:mm:ss" value-format="x"
|
|
|
|
|
|
|
|
:placeholder="t('MoldManagement.MoldRepair.placeholderConfirmDate')"
|
|
|
|
|
|
|
|
class="!w-full" :disabled="repairFieldsDisabled"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
|
|
</el-row>
|
|
|
|
</el-row>
|
|
|
|
<el-row :gutter="20">
|
|
|
|
<el-row :gutter="20">
|
|
|
|
<el-col :span="8">
|
|
|
|
<el-col :span="8">
|
|
|
|
@ -336,13 +309,37 @@
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
</el-row>
|
|
|
|
</section>
|
|
|
|
<el-row v-if="hasRepairHistory" :gutter="20">
|
|
|
|
|
|
|
|
<el-col :span="8">
|
|
|
|
<section v-if="isDetailMode && String(formData.status) === '2'" class="dv-repair-section">
|
|
|
|
<el-form-item :label="t('MoldManagement.MoldRepair.confirmUser')">
|
|
|
|
<div class="dv-repair-section__title">{{ t('MoldManagement.MoldRepair.rejectionInfo') }}</div>
|
|
|
|
<el-input :model-value="getUserLabel(displayedRepairHistory.confirmBy)" disabled />
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
|
|
|
<el-form-item :label="t('MoldManagement.MoldRepair.confirmDate')">
|
|
|
|
|
|
|
|
<el-date-picker
|
|
|
|
|
|
|
|
:model-value="toTimestamp(displayedRepairHistory.confirmDate)"
|
|
|
|
|
|
|
|
type="datetime"
|
|
|
|
|
|
|
|
format="YYYY-MM-DD HH:mm:ss"
|
|
|
|
|
|
|
|
value-format="x"
|
|
|
|
|
|
|
|
class="!w-full"
|
|
|
|
|
|
|
|
disabled
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
|
|
|
<el-form-item :label="t('MoldManagement.MoldRepair.acceptanceResult')">
|
|
|
|
|
|
|
|
<el-input :model-value="getDocumentStatusLabel(displayedRepairHistory.status)" disabled />
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
<el-row v-if="hasRepairHistory && String(displayedRepairHistory.status) === '2'" :gutter="20">
|
|
|
|
|
|
|
|
<el-col :span="24">
|
|
|
|
<el-form-item :label="t('MoldManagement.MoldRepair.rejectReason')">
|
|
|
|
<el-form-item :label="t('MoldManagement.MoldRepair.rejectReason')">
|
|
|
|
<el-input :model-value="formData.rejectReason || '-'" type="textarea" :rows="3" disabled />
|
|
|
|
<el-input :model-value="displayedRepairHistory.rejectReason || '-'" type="textarea" :rows="3" disabled />
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
|
|
</el-row>
|
|
|
|
</section>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
|
|
<section class="dv-repair-section">
|
|
|
|
<section class="dv-repair-section">
|
|
|
|
@ -470,7 +467,7 @@
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
<script setup lang="ts">
|
|
|
|
import { MoldRepairApi, MoldRepairVO } from '@/api/mold/moldrepair'
|
|
|
|
import { MoldRepairAcceptanceHistoryVO, MoldRepairApi, MoldRepairVO } from '@/api/mold/moldrepair'
|
|
|
|
import { MoldBrandApi, MoldVO } from '@/api/erp/mold'
|
|
|
|
import { MoldBrandApi, MoldVO } from '@/api/erp/mold'
|
|
|
|
import { getSimpleUserList, UserVO } from '@/api/system/user'
|
|
|
|
import { getSimpleUserList, UserVO } from '@/api/system/user'
|
|
|
|
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
|
|
|
|
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
|
|
|
|
@ -560,24 +557,76 @@ const currentRepairStatusValue = computed(() => {
|
|
|
|
const showRepairFields = computed(() => {
|
|
|
|
const showRepairFields = computed(() => {
|
|
|
|
if (formType.value === 'repair') return true
|
|
|
|
if (formType.value === 'repair') return true
|
|
|
|
if (formType.value === 'update') return currentStatusValue.value === '1'
|
|
|
|
if (formType.value === 'update') return currentStatusValue.value === '1'
|
|
|
|
if (formType.value === 'detail') return currentRepairStatusValue.value !== '0'
|
|
|
|
if (formType.value === 'detail') return hasRepairHistory.value || currentRepairStatusValue.value !== '0'
|
|
|
|
return false
|
|
|
|
return false
|
|
|
|
})
|
|
|
|
})
|
|
|
|
const repairFieldsDisabled = computed(() => formType.value !== 'repair')
|
|
|
|
const repairFieldsDisabled = computed(() => formType.value !== 'repair')
|
|
|
|
const failureLevelOptions = computed(() => getStrDictOptions(DICT_TYPE.FAILURE_LEVEL))
|
|
|
|
const failureLevelOptions = computed(() => getStrDictOptions(DICT_TYPE.FAILURE_LEVEL))
|
|
|
|
|
|
|
|
const documentStatusOptions = computed(() => getStrDictOptions(DICT_TYPE.MOLD_DOCUMENT_STATUS))
|
|
|
|
const statusLabel = computed(() => {
|
|
|
|
const statusLabel = computed(() => {
|
|
|
|
const status = formData.value.status
|
|
|
|
return getDocumentStatusLabel(formData.value.status)
|
|
|
|
if (status === '' || status === null || status === undefined) return t('MoldManagement.MoldRepair.statusPending')
|
|
|
|
|
|
|
|
return String(status) === '1'
|
|
|
|
|
|
|
|
? t('MoldManagement.MoldRepair.statusDone')
|
|
|
|
|
|
|
|
: String(status) === '2'
|
|
|
|
|
|
|
|
? t('MoldManagement.MoldRepair.statusRejected')
|
|
|
|
|
|
|
|
: t('MoldManagement.MoldRepair.statusPending')
|
|
|
|
|
|
|
|
})
|
|
|
|
})
|
|
|
|
const isHydrating = ref(false)
|
|
|
|
const isHydrating = ref(false)
|
|
|
|
const openRequestId = ref(0)
|
|
|
|
const openRequestId = ref(0)
|
|
|
|
const emit = defineEmits(['success', 'closed'])
|
|
|
|
const emit = defineEmits(['success', 'closed'])
|
|
|
|
const formData = ref<MoldRepairFormData>(createDefaultFormData())
|
|
|
|
const formData = ref<MoldRepairFormData>(createDefaultFormData())
|
|
|
|
|
|
|
|
const repairHistoryList = ref<MoldRepairAcceptanceHistoryVO[]>([])
|
|
|
|
|
|
|
|
const selectedRepairHistoryIndex = ref<number>()
|
|
|
|
|
|
|
|
const hasRepairHistory = computed(() => repairHistoryList.value.length > 0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const getHistoryTimestamp = (history: MoldRepairAcceptanceHistoryVO) => {
|
|
|
|
|
|
|
|
const timestamp = toTimestamp(history.createTime ?? history.confirmDate ?? history.finishDate)
|
|
|
|
|
|
|
|
return timestamp === undefined ? Number.NEGATIVE_INFINITY : Number(timestamp)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const toTimestamp = (value: any): any => {
|
|
|
|
|
|
|
|
if (value === undefined || value === null || value === '') return undefined
|
|
|
|
|
|
|
|
if (typeof value === 'number') return value
|
|
|
|
|
|
|
|
const timestamp = new Date(value).getTime()
|
|
|
|
|
|
|
|
return Number.isNaN(timestamp) ? undefined : timestamp
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const latestRepairHistoryIndex = computed(() => repairHistoryList.value.reduce((latestIndex, history, index) => {
|
|
|
|
|
|
|
|
return getHistoryTimestamp(history) >= getHistoryTimestamp(repairHistoryList.value[latestIndex]) ? index : latestIndex
|
|
|
|
|
|
|
|
}, 0))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const repairHistoryOptions = computed(() => repairHistoryList.value.map((_, index) => ({
|
|
|
|
|
|
|
|
value: index,
|
|
|
|
|
|
|
|
label: `${t('MoldManagement.MoldRepair.historyRepairResult')} ${index + 1}`
|
|
|
|
|
|
|
|
})))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const displayedRepairHistory = computed(() => {
|
|
|
|
|
|
|
|
return selectedRepairHistoryIndex.value === undefined
|
|
|
|
|
|
|
|
? formData.value
|
|
|
|
|
|
|
|
: repairHistoryList.value[selectedRepairHistoryIndex.value] ?? formData.value
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const getDocumentStatusLabel = (value: unknown) => {
|
|
|
|
|
|
|
|
const status = value === '' || value === null || value === undefined ? '0' : String(value)
|
|
|
|
|
|
|
|
return documentStatusOptions.value.find((item) => String(item.value) === status)?.label ?? status
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const applyRepairHistory = (source: Record<string, any>) => {
|
|
|
|
|
|
|
|
formData.value.repairResult = source.repairResult ?? ''
|
|
|
|
|
|
|
|
formData.value.repairStatus = normalizeRepairStatusValue(source.repairStatus ?? source.repairResult)
|
|
|
|
|
|
|
|
formData.value.finishDate = toTimestamp(source.finishDate)
|
|
|
|
|
|
|
|
formData.value.confirmDate = toTimestamp(source.confirmDate)
|
|
|
|
|
|
|
|
formData.value.confirmBy = normalizeUserId(source.confirmBy)
|
|
|
|
|
|
|
|
formData.value.rejectReason = source.rejectReason
|
|
|
|
|
|
|
|
formData.value.downtimeDuration = source.downtimeDuration ?? source.shutdownDuration
|
|
|
|
|
|
|
|
formData.value.faultReason = source.faultReason
|
|
|
|
|
|
|
|
formData.value.handlingMeasures = source.handlingMeasures ?? source.treatmentMeasures
|
|
|
|
|
|
|
|
formData.value.replacementParts = source.replacementParts
|
|
|
|
|
|
|
|
formData.value.repairContent = source.repairContent ?? source.repairSummary
|
|
|
|
|
|
|
|
formData.value.repairedImages = normalizeImageString(source.repairedImages)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const changeRepairHistory = () => {
|
|
|
|
|
|
|
|
const source = selectedRepairHistoryIndex.value === undefined
|
|
|
|
|
|
|
|
? undefined
|
|
|
|
|
|
|
|
: repairHistoryList.value[selectedRepairHistoryIndex.value]
|
|
|
|
|
|
|
|
if (source) applyRepairHistory(source as Record<string, any>)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const moldLoading = ref(false)
|
|
|
|
const moldLoading = ref(false)
|
|
|
|
const moldOptions = ref<{ label: string; value: number; raw?: MoldVO }[]>([])
|
|
|
|
const moldOptions = ref<{ label: string; value: number; raw?: MoldVO }[]>([])
|
|
|
|
@ -687,6 +736,12 @@ const resetMoldDialogQuery = () => {
|
|
|
|
handleMoldDialogQuery()
|
|
|
|
handleMoldDialogQuery()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const getUserLabel = (value: any) => {
|
|
|
|
|
|
|
|
const normalizedValue = normalizeUserId(value)
|
|
|
|
|
|
|
|
if (!normalizedValue) return '-'
|
|
|
|
|
|
|
|
return users.value.find((user) => String(user.id) === normalizedValue)?.nickname ?? String(value)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const splitUserIds = (value: unknown) => {
|
|
|
|
const splitUserIds = (value: unknown) => {
|
|
|
|
const values = Array.isArray(value) ? value : String(value ?? '').split(',')
|
|
|
|
const values = Array.isArray(value) ? value : String(value ?? '').split(',')
|
|
|
|
return [...new Set(values.map((item) => normalizeUserId(item)).filter(Boolean) as string[])]
|
|
|
|
return [...new Set(values.map((item) => normalizeUserId(item)).filter(Boolean) as string[])]
|
|
|
|
@ -798,18 +853,6 @@ const formRules = reactive({
|
|
|
|
trigger: 'change',
|
|
|
|
trigger: 'change',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
confirmDate: [
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
validator: (_: any, value: any, callback: any) => {
|
|
|
|
|
|
|
|
if (formType.value === 'repair' && !value) {
|
|
|
|
|
|
|
|
callback(new Error(t('MoldManagement.MoldRepair.validatorConfirmDateRequired')))
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
callback()
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
trigger: 'change',
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
repairStatus: [
|
|
|
|
repairStatus: [
|
|
|
|
{
|
|
|
|
{
|
|
|
|
validator: (_: any, value: any, callback: any) => {
|
|
|
|
validator: (_: any, value: any, callback: any) => {
|
|
|
|
@ -919,9 +962,9 @@ const open = async (type: string, id?: number) => {
|
|
|
|
|
|
|
|
|
|
|
|
if (currentOpenId !== openRequestId.value) return
|
|
|
|
if (currentOpenId !== openRequestId.value) return
|
|
|
|
|
|
|
|
|
|
|
|
;(formData.value as any).requireDate = (formData.value as any).requireDate ?? undefined
|
|
|
|
;(formData.value as any).requireDate = toTimestamp((formData.value as any).requireDate)
|
|
|
|
;(formData.value as any).finishDate = (formData.value as any).finishDate ?? (type === 'repair' ? Date.now() : undefined)
|
|
|
|
;(formData.value as any).finishDate = toTimestamp((formData.value as any).finishDate) ?? (type === 'repair' ? Date.now() : undefined)
|
|
|
|
;(formData.value as any).confirmDate = (formData.value as any).confirmDate ?? (type === 'repair' ? Date.now() : undefined)
|
|
|
|
;(formData.value as any).confirmDate = toTimestamp((formData.value as any).confirmDate)
|
|
|
|
;(formData.value as any).repairResult = (formData.value as any).repairResult ?? ''
|
|
|
|
;(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 === ''
|
|
|
|
;(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).repairResult)
|
|
|
|
@ -932,10 +975,10 @@ const open = async (type: string, id?: number) => {
|
|
|
|
;(formData.value as any).shutdown = (formData.value as any).shutdown ?? undefined
|
|
|
|
;(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).faultImages = normalizeImageString((formData.value as any).faultImages)
|
|
|
|
;(formData.value as any).faultReason = (formData.value as any).faultReason ?? undefined
|
|
|
|
;(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).downtimeDuration = (formData.value as any).downtimeDuration ?? (formData.value as any).shutdownDuration ?? undefined
|
|
|
|
;(formData.value as any).handlingMeasures = (formData.value as any).handlingMeasures ?? undefined
|
|
|
|
;(formData.value as any).handlingMeasures = (formData.value as any).handlingMeasures ?? (formData.value as any).treatmentMeasures ?? undefined
|
|
|
|
;(formData.value as any).replacementParts = (formData.value as any).replacementParts ?? 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).repairContent = (formData.value as any).repairContent ?? (formData.value as any).repairSummary ?? undefined
|
|
|
|
;(formData.value as any).repairedImages = normalizeImageString((formData.value as any).repairedImages)
|
|
|
|
;(formData.value as any).repairedImages = normalizeImageString((formData.value as any).repairedImages)
|
|
|
|
|
|
|
|
|
|
|
|
;(formData.value as any).acceptedBy = splitUserIds((formData.value as any).acceptedBy)
|
|
|
|
;(formData.value as any).acceptedBy = splitUserIds((formData.value as any).acceptedBy)
|
|
|
|
@ -960,6 +1003,11 @@ const open = async (type: string, id?: number) => {
|
|
|
|
const label = `${formData.value.moldCode ?? ''} ${formData.value.moldName ?? ''}`.trim() || `ID:${resolvedMoldId}`
|
|
|
|
const label = `${formData.value.moldCode ?? ''} ${formData.value.moldName ?? ''}`.trim() || `ID:${resolvedMoldId}`
|
|
|
|
moldOptions.value = upsertMoldOption(moldOptions.value, { label, value: resolvedMoldId })
|
|
|
|
moldOptions.value = upsertMoldOption(moldOptions.value, { label, value: resolvedMoldId })
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
repairHistoryList.value = Array.isArray((formData.value as any).acceptanceHistoryList)
|
|
|
|
|
|
|
|
? (formData.value as any).acceptanceHistoryList
|
|
|
|
|
|
|
|
: []
|
|
|
|
|
|
|
|
selectedRepairHistoryIndex.value = hasRepairHistory.value ? latestRepairHistoryIndex.value : undefined
|
|
|
|
|
|
|
|
changeRepairHistory()
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
isHydrating.value = false
|
|
|
|
isHydrating.value = false
|
|
|
|
formLoading.value = false
|
|
|
|
formLoading.value = false
|
|
|
|
@ -996,11 +1044,20 @@ const submitForm = async () => {
|
|
|
|
data.faultImages = Array.isArray(data.faultImages) ? data.faultImages.join(',') : (data.faultImages ?? '')
|
|
|
|
data.faultImages = Array.isArray(data.faultImages) ? data.faultImages.join(',') : (data.faultImages ?? '')
|
|
|
|
data.repairedImages = Array.isArray(data.repairedImages) ? data.repairedImages.join(',') : (data.repairedImages ?? '')
|
|
|
|
data.repairedImages = Array.isArray(data.repairedImages) ? data.repairedImages.join(',') : (data.repairedImages ?? '')
|
|
|
|
data.repairResult = data.repairStatus
|
|
|
|
data.repairResult = data.repairStatus
|
|
|
|
|
|
|
|
data.shutdownDuration = data.downtimeDuration
|
|
|
|
|
|
|
|
data.treatmentMeasures = data.handlingMeasures
|
|
|
|
|
|
|
|
data.repairSummary = data.repairContent
|
|
|
|
data.acceptedBy = normalizeAcceptedBy(data.acceptedBy)
|
|
|
|
data.acceptedBy = normalizeAcceptedBy(data.acceptedBy)
|
|
|
|
data.confirmBy = normalizeUserId(data.confirmBy)
|
|
|
|
data.confirmBy = normalizeUserId(data.confirmBy)
|
|
|
|
data.repairReporter = normalizeUserId(data.repairReporter)
|
|
|
|
data.repairReporter = normalizeUserId(data.repairReporter)
|
|
|
|
|
|
|
|
delete data.acceptanceHistoryList
|
|
|
|
|
|
|
|
delete data.downtimeDuration
|
|
|
|
|
|
|
|
delete data.handlingMeasures
|
|
|
|
|
|
|
|
delete data.repairContent
|
|
|
|
if (formType.value === 'repair') {
|
|
|
|
if (formType.value === 'repair') {
|
|
|
|
data.status = '1'
|
|
|
|
data.status = '3'
|
|
|
|
|
|
|
|
delete data.confirmBy
|
|
|
|
|
|
|
|
delete data.confirmDate
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (formType.value === 'create') {
|
|
|
|
if (formType.value === 'create') {
|
|
|
|
await MoldRepairApi.createMoldRepair(data)
|
|
|
|
await MoldRepairApi.createMoldRepair(data)
|
|
|
|
@ -1018,6 +1075,8 @@ const submitForm = async () => {
|
|
|
|
|
|
|
|
|
|
|
|
const resetForm = () => {
|
|
|
|
const resetForm = () => {
|
|
|
|
formData.value = createDefaultFormData()
|
|
|
|
formData.value = createDefaultFormData()
|
|
|
|
|
|
|
|
repairHistoryList.value = []
|
|
|
|
|
|
|
|
selectedRepairHistoryIndex.value = undefined
|
|
|
|
moldOptionsLoaded.value = false
|
|
|
|
moldOptionsLoaded.value = false
|
|
|
|
formRef.value?.resetFields()
|
|
|
|
formRef.value?.resetFields()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -1078,6 +1137,22 @@ const resetForm = () => {
|
|
|
|
border-left: 3px solid #409eff;
|
|
|
|
border-left: 3px solid #409eff;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.dv-repair-section__title-row {
|
|
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
|
|
gap: 12px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.dv-repair-section__title {
|
|
|
|
|
|
|
|
margin-bottom: 16px;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.dv-repair-history-select {
|
|
|
|
|
|
|
|
width: 260px;
|
|
|
|
|
|
|
|
margin-bottom: 16px;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.dv-repair-code-row {
|
|
|
|
.dv-repair-code-row {
|
|
|
|
display: flex;
|
|
|
|
display: flex;
|
|
|
|
gap: 10px;
|
|
|
|
gap: 10px;
|
|
|
|
|