|
|
|
|
@ -35,17 +35,6 @@
|
|
|
|
|
class="!w-240px"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item :label="t('EquipmentManagement.CapacityReport.deviceStatus')" prop="deviceStatus">
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="queryParams.deviceStatus"
|
|
|
|
|
:placeholder="t('EquipmentManagement.CapacityReport.placeholderDeviceStatus')"
|
|
|
|
|
clearable
|
|
|
|
|
class="!w-240px"
|
|
|
|
|
>
|
|
|
|
|
<el-option :label="t('EquipmentManagement.EquipmentLedger.normal')" :value="0" />
|
|
|
|
|
<el-option :label="t('EquipmentManagement.EquipmentLedger.stop')" :value="1" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item :label="t('EquipmentManagement.CapacityReport.workshop')" prop="workshop" v-show="showAllFilters">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="queryParams.workshop"
|
|
|
|
|
@ -92,16 +81,6 @@
|
|
|
|
|
<el-table-column :label="t('EquipmentManagement.CapacityReport.deviceCode')" align="center" prop="deviceCode" sortable />
|
|
|
|
|
<el-table-column :label="t('EquipmentManagement.CapacityReport.deviceName')" align="center" prop="deviceName" sortable />
|
|
|
|
|
<el-table-column :label="t('EquipmentManagement.CapacityReport.deviceType')" align="center" prop="typeName" sortable />
|
|
|
|
|
<el-table-column :label="t('EquipmentManagement.CapacityReport.deviceStatus')" align="center" prop="deviceStatus" sortable>
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-switch
|
|
|
|
|
:model-value="isDeviceLedgerEnabled(scope.row)"
|
|
|
|
|
:loading="Boolean(deviceStatusUpdatingMap[scope.row.id])"
|
|
|
|
|
inline-prompt
|
|
|
|
|
@change="(val) => handleDeviceStatusChange(scope.row, val)"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column :label="t('EquipmentManagement.CapacityReport.ratedCapacity')" align="center" prop="ratedCapacity" sortable />
|
|
|
|
|
<el-table-column :label="t('EquipmentManagement.CapacityReport.reportCapacity')" align="center" prop="reportCapacity" sortable />
|
|
|
|
|
<el-table-column :label="t('EquipmentManagement.CapacityReport.actualCapacity')" align="center" prop="actualCapacity" sortable />
|
|
|
|
|
@ -135,7 +114,6 @@ const queryParams = reactive({
|
|
|
|
|
deviceCode: undefined,
|
|
|
|
|
deviceName: undefined,
|
|
|
|
|
deviceType: undefined,
|
|
|
|
|
deviceStatus: undefined,
|
|
|
|
|
workshop: undefined
|
|
|
|
|
})
|
|
|
|
|
const queryFormRef = ref()
|
|
|
|
|
@ -148,31 +126,6 @@ const selectedIds = ref<number[]>([])
|
|
|
|
|
const toggleFilters = () => {
|
|
|
|
|
showAllFilters.value = !showAllFilters.value
|
|
|
|
|
}
|
|
|
|
|
const deviceStatusUpdatingMap = ref<Record<number, boolean>>({})
|
|
|
|
|
|
|
|
|
|
const isDeviceLedgerEnabled = (row: CapacityReportVO) => {
|
|
|
|
|
return Number(row.deviceStatus) === 0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handleDeviceStatusChange = async (row: CapacityReportVO, value: boolean) => {
|
|
|
|
|
if (!row?.id) return
|
|
|
|
|
const oldValue = Number(row.deviceStatus)
|
|
|
|
|
const nextValue = value ? 0 : 1
|
|
|
|
|
row.deviceStatus = nextValue
|
|
|
|
|
deviceStatusUpdatingMap.value[row.id] = true
|
|
|
|
|
try {
|
|
|
|
|
await DeviceLedgerApi.updateDeviceLedger({
|
|
|
|
|
id: row.id,
|
|
|
|
|
deviceStatus: nextValue
|
|
|
|
|
})
|
|
|
|
|
message.success(t('common.updateSuccess'))
|
|
|
|
|
} catch {
|
|
|
|
|
row.deviceStatus = oldValue
|
|
|
|
|
message.error(t('common.updateFail'))
|
|
|
|
|
} finally {
|
|
|
|
|
deviceStatusUpdatingMap.value[row.id] = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const getList = async () => {
|
|
|
|
|
loading.value = true
|
|
|
|
|
|