|
|
|
|
@ -178,10 +178,10 @@
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-button
|
|
|
|
|
link type="primary" @click="openForm('repair', scope.row.id)"
|
|
|
|
|
v-if="String(scope.row.status) !== '1' && !isProcessedRepair(scope.row.repairStatus)" v-hasPermi="['mes:dv-repair:update']"
|
|
|
|
|
v-if="String(scope.row.status) === '0' && !isProcessedRepair(scope.row.repairStatus)" v-hasPermi="['mes:dv-repair:update']"
|
|
|
|
|
>{{ t('MoldManagement.MoldRepair.repair') }}</el-button>
|
|
|
|
|
<el-button
|
|
|
|
|
v-if="!isProcessedRepair(scope.row.repairStatus)"
|
|
|
|
|
v-if="String(scope.row.status) === '0' && !isProcessedRepair(scope.row.repairStatus)"
|
|
|
|
|
link type="primary" @click="openForm('update', scope.row.id)"
|
|
|
|
|
v-hasPermi="['mes:dv-repair:update']">
|
|
|
|
|
{{ t('MoldManagement.MoldRepair.edit') }}
|
|
|
|
|
@ -192,6 +192,12 @@
|
|
|
|
|
v-hasPermi="['mes:dv-repair:update']">
|
|
|
|
|
{{ t('action.detail') }}
|
|
|
|
|
</el-button>
|
|
|
|
|
<el-button
|
|
|
|
|
v-if="String(scope.row.status) === '1'"
|
|
|
|
|
link type="danger" :loading="String(rejectingId) === String(scope.row.id)" @click="handleReject(scope.row.id)"
|
|
|
|
|
v-hasPermi="['mes:dv-repair:update']">
|
|
|
|
|
{{ t('MoldManagement.MoldRepair.reject') }}
|
|
|
|
|
</el-button>
|
|
|
|
|
<el-button link type="danger" @click="handleDelete(scope.row.id)" v-hasPermi="['mes:dv-repair:delete']">
|
|
|
|
|
{{ t('MoldManagement.MoldRepair.delete') }}
|
|
|
|
|
</el-button>
|
|
|
|
|
@ -281,7 +287,8 @@ const exportLoading = ref(false)
|
|
|
|
|
|
|
|
|
|
const statusOptions = [
|
|
|
|
|
{ label: t('MoldManagement.MoldRepair.statusPending'), value: '0' },
|
|
|
|
|
{ label: t('MoldManagement.MoldRepair.statusDone'), value: '1' }
|
|
|
|
|
{ label: t('MoldManagement.MoldRepair.statusDone'), value: '1' },
|
|
|
|
|
{ label: t('MoldManagement.MoldRepair.statusRejected'), value: '2' }
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
const getResultLabel = (value: any) => {
|
|
|
|
|
@ -304,6 +311,7 @@ const getStatusLabel = (value: any) => {
|
|
|
|
|
const v = value === '' || value === null || value === undefined ? undefined : String(value)
|
|
|
|
|
if (v === '0') return t('MoldManagement.MoldRepair.statusPending')
|
|
|
|
|
if (v === '1') return t('MoldManagement.MoldRepair.statusDone')
|
|
|
|
|
if (v === '2') return t('MoldManagement.MoldRepair.statusRejected')
|
|
|
|
|
return '-'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -311,6 +319,7 @@ const getStatusTagType = (value: any) => {
|
|
|
|
|
const v = value === '' || value === null || value === undefined ? undefined : String(value)
|
|
|
|
|
if (v === '1') return 'success'
|
|
|
|
|
if (v === '0') return 'warning'
|
|
|
|
|
if (v === '2') return 'danger'
|
|
|
|
|
return 'info'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -332,6 +341,7 @@ const updatePlanTableMaxHeight = async () => {
|
|
|
|
|
planTableMaxHeight.value = Math.min(window.innerHeight, Math.max(240, Math.floor(availableHeight)))
|
|
|
|
|
}
|
|
|
|
|
const selectedIds = ref<number[]>([])
|
|
|
|
|
const rejectingId = ref<number | string>()
|
|
|
|
|
const handleSelectionChange = (rows: any[]) => {
|
|
|
|
|
selectedIds.value = rows?.map((row) => row.id).filter((id) => id !== undefined) ?? []
|
|
|
|
|
}
|
|
|
|
|
@ -412,6 +422,28 @@ const handleBatchDelete = async () => {
|
|
|
|
|
await handleDelete(selectedIds.value)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handleReject = async (id: number | string) => {
|
|
|
|
|
try {
|
|
|
|
|
const { value } = await ElMessageBox.prompt(
|
|
|
|
|
t('MoldManagement.MoldRepair.rejectReasonPrompt'),
|
|
|
|
|
t('MoldManagement.MoldRepair.reject'),
|
|
|
|
|
{
|
|
|
|
|
confirmButtonText: t('common.ok'),
|
|
|
|
|
cancelButtonText: t('common.cancel'),
|
|
|
|
|
inputPattern: /^[\s\S]*.*\S[\s\S]*$/,
|
|
|
|
|
inputErrorMessage: t('MoldManagement.MoldRepair.rejectReasonRequired')
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
rejectingId.value = id
|
|
|
|
|
await MoldRepairApi.rejectMoldRepair({ id, rejectReason: value })
|
|
|
|
|
message.success(t('MoldManagement.MoldRepair.rejectSuccess'))
|
|
|
|
|
await getList()
|
|
|
|
|
} catch {
|
|
|
|
|
} finally {
|
|
|
|
|
rejectingId.value = undefined
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handleExport = async () => {
|
|
|
|
|
try {
|
|
|
|
|
await message.exportConfirm()
|
|
|
|
|
|