|
|
|
|
@ -208,7 +208,7 @@
|
|
|
|
|
<Icon icon="ep:download" class="mr-5px" /> {{ t('action.export') }}
|
|
|
|
|
</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
<el-table v-loading="tableLoading" :data="editableCriticalComponentRows" :stripe="true" :show-overflow-tooltip="true">
|
|
|
|
|
<el-table ref="tableRef" v-loading="tableLoading" :data="editableCriticalComponentRows" :stripe="true" :show-overflow-tooltip="true">
|
|
|
|
|
<el-table-column :label="t('EquipmentManagement.EquipmentLedger.componentCode')" align="center" prop="code" min-width="140" sortable />
|
|
|
|
|
<el-table-column :label="t('EquipmentManagement.EquipmentLedger.componentName')" align="center" prop="name" min-width="140" sortable />
|
|
|
|
|
<el-table-column :label="t('EquipmentManagement.EquipmentKeyItems.count')" align="center" prop="count" min-width="180">
|
|
|
|
|
@ -225,6 +225,15 @@
|
|
|
|
|
<el-table-column :label="t('EquipmentManagement.EquipmentLedger.componentDesc')" align="center" prop="description" min-width="180" />
|
|
|
|
|
<el-table-column :label="t('EquipmentManagement.EquipmentLedger.remark')" align="center" prop="remark" min-width="180" />
|
|
|
|
|
<el-table-column :label="t('EquipmentManagement.EquipmentLedger.createTime')" align="center" prop="createTime" :formatter="dateFormatter" width="180" sortable />
|
|
|
|
|
<el-table-column :label="t('EquipmentManagement.EquipmentLedger.operate')" align="center" min-width="160px"
|
|
|
|
|
fixed="right">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-button link type="danger" @click="handleDelete(scope.row.id)"
|
|
|
|
|
v-hasPermi="['mes:device-ledger:delete']">
|
|
|
|
|
{{ t('EquipmentManagement.EquipmentLedger.delete') }}
|
|
|
|
|
</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
|
</el-tab-pane>
|
|
|
|
|
|
|
|
|
|
@ -232,7 +241,7 @@
|
|
|
|
|
</el-tabs>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="device-ledger-action-bar" :style="actionBarStyle">
|
|
|
|
|
<el-button @click="handleCancelEdit">{{ t('common.cancel') }}</el-button>
|
|
|
|
|
<el-button @click="handleCancel">{{ t('common.cancel') }}</el-button>
|
|
|
|
|
<el-button type="primary" :loading="formLoading" :disabled="fileUploading" @click="submitForm">{{ t('common.save') }}</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
@ -364,6 +373,7 @@ const message = useMessage()
|
|
|
|
|
const route = useRoute()
|
|
|
|
|
const { delView } = useTagsViewStore()
|
|
|
|
|
const { currentRoute } = useRouter()
|
|
|
|
|
const router = useRouter()
|
|
|
|
|
const appStore = useAppStore()
|
|
|
|
|
const deviceId = computed(() => Number(route.params.id))
|
|
|
|
|
const detailLoading = ref(false)
|
|
|
|
|
@ -384,6 +394,7 @@ const updateActionBarRect = () => {
|
|
|
|
|
actionBarStyle.width = rect.width + 'px'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const tableRef = ref()
|
|
|
|
|
const updateActionBarRectAfterLayout = () => {
|
|
|
|
|
nextTick(updateActionBarRect)
|
|
|
|
|
window.setTimeout(updateActionBarRect, 320)
|
|
|
|
|
@ -622,14 +633,12 @@ const selectedDeviceRows = ref<any[]>([])
|
|
|
|
|
const ids = ref<number[]>([])
|
|
|
|
|
const bjIds = ref<number[]>([])
|
|
|
|
|
const openCriticalComponentDialog = () => {
|
|
|
|
|
/* criticalComponentDraft.value = [...(formData.value.componentIds ?? [])]
|
|
|
|
|
criticalComponentDialogVisible.value = true
|
|
|
|
|
ids.value = [...(formData.value.componentIds ?? [])]
|
|
|
|
|
setDefaultSelections()*/
|
|
|
|
|
|
|
|
|
|
queryParams.name = ''
|
|
|
|
|
queryParams.description = ''
|
|
|
|
|
queryParams.code = ''
|
|
|
|
|
const rows = selectedDeviceRows.value.map((item) => ({ ...item, id: Number(item.id) }))
|
|
|
|
|
criticalComponentSelectDialogRef.value?.open(rows)
|
|
|
|
|
let initIds= formData.value.machineId!=undefined?formData.value.machineId.toString().split(","):[]
|
|
|
|
|
let initIds= formData.value.componentIds!=undefined?formData.value.componentIds.toString().split(","):[]
|
|
|
|
|
ids.value=initIds.map((id) => Number(id))
|
|
|
|
|
}
|
|
|
|
|
const openBeijianDialog = () => {
|
|
|
|
|
@ -1014,13 +1023,14 @@ const submitForm = async () => {
|
|
|
|
|
await DeviceLedgerApi.updateDeviceLedger(buildSubmitData())
|
|
|
|
|
message.success(t('common.updateSuccess'))
|
|
|
|
|
await getDetail()
|
|
|
|
|
getDetailList()
|
|
|
|
|
} finally {
|
|
|
|
|
formLoading.value = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handleCancelEdit = async () => {
|
|
|
|
|
await getDetail()
|
|
|
|
|
const handleCancel = async () => {
|
|
|
|
|
router.back()
|
|
|
|
|
}
|
|
|
|
|
const handleExportCriticalComponent = async () => {
|
|
|
|
|
if (!deviceId.value) return
|
|
|
|
|
@ -1111,6 +1121,7 @@ async function initForm() {
|
|
|
|
|
beijianIds: parseIdsValue((detail as any)?.beijianId),
|
|
|
|
|
qrcodeUrl: (detail as any)?.qrcodeUrl,
|
|
|
|
|
}
|
|
|
|
|
ids.value=parseIdsValue((detail as any)?.componentId)
|
|
|
|
|
savedCriticalComponentOptions.value = buildCriticalComponentOptions((detail as any)?.componentList ?? [])
|
|
|
|
|
savedBeijianOptions.value = buildBeijianOptions((detail as any)?.beijianList ?? [])
|
|
|
|
|
// syncCriticalComponentRows()
|
|
|
|
|
@ -1141,15 +1152,7 @@ const criticalComponentColumns = computed(() => [
|
|
|
|
|
const fetchCriticalComponentPage = async (params: Record<string, any>) => {
|
|
|
|
|
return await CriticalComponentApi.getCriticalComponentPage(params)
|
|
|
|
|
}
|
|
|
|
|
const handleCriticalComponentSelectConfirm = ({ ids: selectedIds, rows }: { ids: Array<number | string>; rows: any[] }) => {
|
|
|
|
|
/* selectedRows.value = rows
|
|
|
|
|
savedCriticalComponentOptions.value = mergeSelectionOptions(savedCriticalComponentOptions.value, buildCriticalComponentOptions(rows))
|
|
|
|
|
const selected = filterValidSelectedIds(
|
|
|
|
|
[...(formData.value.componentIds ?? []), ...selectedIds],
|
|
|
|
|
mergeSelectionOptions(savedCriticalComponentOptions.value, criticalComponentOptions.value)
|
|
|
|
|
)
|
|
|
|
|
formData.value.componentIds = selected
|
|
|
|
|
appendSelectedCriticalComponentRows(selected)*/
|
|
|
|
|
const handleCriticalComponentSelectConfirm = (payload: { ids: (number | string)[]; rows: any[] }) => {
|
|
|
|
|
formData.value.devices = payload.rows
|
|
|
|
|
.map((item) => {
|
|
|
|
|
const id = Number(item.id)
|
|
|
|
|
@ -1163,6 +1166,7 @@ const handleCriticalComponentSelectConfirm = ({ ids: selectedIds, rows }: { ids:
|
|
|
|
|
selectedDeviceRows.value = payload.rows
|
|
|
|
|
formData.value.machineId = payload.ids.join(',')
|
|
|
|
|
ids.value = payload.ids.map((id) => Number(id))
|
|
|
|
|
appendSelectedCriticalComponentRows(ids.value)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const buildCriticalComponentRowById = (id: number) => {
|
|
|
|
|
@ -1202,6 +1206,25 @@ const appendSelectedCriticalComponentRows = (selectedIds: number[]) => {
|
|
|
|
|
editableCriticalComponentRows.value = [...editableCriticalComponentRows.value, ...rowsToAppend]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/** 删除按钮操作 */
|
|
|
|
|
const buildIdsParam = (ids: number | number[]) => {
|
|
|
|
|
return Array.isArray(ids) ? ids.join(',') : String(ids)
|
|
|
|
|
}
|
|
|
|
|
const handleDelete = async (id: string) => {
|
|
|
|
|
try {
|
|
|
|
|
// 删除的二次确认
|
|
|
|
|
await message.delConfirm()
|
|
|
|
|
editableCriticalComponentRows.value = editableCriticalComponentRows.value.filter((item: any) => item.id !== id)
|
|
|
|
|
await DeviceLedgerApi.deleteDeviceCriticalComponent(id)
|
|
|
|
|
message.success(t('common.delSuccess'))
|
|
|
|
|
selectedIds.value = []
|
|
|
|
|
|
|
|
|
|
tableRef.value?.clearSelection?.()
|
|
|
|
|
// 刷新列表
|
|
|
|
|
//await getList()
|
|
|
|
|
} catch {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onMounted(async () => {
|
|
|
|
|
await ensureOptionsLoaded()
|
|
|
|
|
|