|
|
|
|
@ -203,7 +203,8 @@
|
|
|
|
|
<el-button
|
|
|
|
|
link
|
|
|
|
|
type="success"
|
|
|
|
|
@click="handleCreateTicket(scope.row.id)"
|
|
|
|
|
:disabled="!isTaskEnabled(scope.row)"
|
|
|
|
|
@click="handleCreateTicket(scope.row)"
|
|
|
|
|
:loading="ticketLoadingId === scope.row.id"
|
|
|
|
|
>
|
|
|
|
|
{{ t('EquipmentManagement.TaskManagement.createWorkOrder') }}
|
|
|
|
|
@ -373,6 +374,8 @@ const openForm = (type: string, row?: TaskManagementVO) => {
|
|
|
|
|
formRef.value.open(type, row)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const isTaskEnabled = (row: TaskManagementVO) => row.enabled === true || (row.enabled as any) === 'true'
|
|
|
|
|
|
|
|
|
|
const handleDelete = async (id?: number) => {
|
|
|
|
|
if (!id) return
|
|
|
|
|
try {
|
|
|
|
|
@ -384,11 +387,25 @@ const handleDelete = async (id?: number) => {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const ticketLoadingId = ref<number | undefined>(undefined)
|
|
|
|
|
const handleCreateTicket = async (id?: number) => {
|
|
|
|
|
if (!id) return
|
|
|
|
|
ticketLoadingId.value = id
|
|
|
|
|
const handleCreateTicket = async (row?: TaskManagementVO) => {
|
|
|
|
|
if (!row?.id) return
|
|
|
|
|
if (!isTaskEnabled(row)) {
|
|
|
|
|
message.warning(t('EquipmentManagement.TaskManagement.createTicketDisabledTip'))
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
await message.confirm(
|
|
|
|
|
t('EquipmentManagement.TaskManagement.createTicketConfirm'),
|
|
|
|
|
t('common.reminder')
|
|
|
|
|
)
|
|
|
|
|
} catch {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ticketLoadingId.value = row.id
|
|
|
|
|
try {
|
|
|
|
|
await TaskManagementApi.createTaskManagementTicket(id)
|
|
|
|
|
await TaskManagementApi.createTaskManagementTicket(row.id)
|
|
|
|
|
message.success(t('EquipmentManagement.TaskManagement.createTicketSuccess'))
|
|
|
|
|
} catch {
|
|
|
|
|
message.error(t('EquipmentManagement.TaskManagement.createTicketFail'))
|
|
|
|
|
@ -398,7 +415,7 @@ const handleCreateTicket = async (id?: number) => {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handleBeforeEnabledChange = async (row: TaskManagementVO) => {
|
|
|
|
|
const isEnabled = row.enabled === true || row.enabled === 'true'
|
|
|
|
|
const isEnabled = isTaskEnabled(row)
|
|
|
|
|
if (isEnabled) return true
|
|
|
|
|
const cronExpression = (row as any)?.cronExpression
|
|
|
|
|
if (typeof cronExpression === 'string' && cronExpression.trim()) return true
|
|
|
|
|
|