diff --git a/src/api/mes/deviceledger/index.ts b/src/api/mes/deviceledger/index.ts
index 17e8f030..3ffcc733 100644
--- a/src/api/mes/deviceledger/index.ts
+++ b/src/api/mes/deviceledger/index.ts
@@ -26,6 +26,9 @@ export interface DeviceLedgerVO {
remark: string // 备注
fileUrl?: string // 附件下载
qrcodeUrl?: string
+ isSchedueld?: number
+ isScheduled?: number
+ ratedCapacity?: number
componentId?: string // 关键件,ids集合
componentList?: CriticalComponentVO[]
beijianId?: string // 备件,ids集合
diff --git a/src/locales/en.ts b/src/locales/en.ts
index c039d4f7..6d0c83e0 100644
--- a/src/locales/en.ts
+++ b/src/locales/en.ts
@@ -1196,9 +1196,15 @@ export default {
qrcode: 'QR Code/Barcode',
deviceName: 'Name',
deviceStatus: 'Status',
+ statusEnabled: 'Enabled',
+ statusDisabled: 'Disabled',
deviceType: 'Type',
deviceSpec: 'Spec',
deviceModel: 'Model',
+ isSchedueld: 'Schedule',
+ ratedCapacity: 'Rated Capacity',
+ yes: 'Yes',
+ no: 'No',
productionDate: 'Production Date',
factoryEntryDate: 'Factory Entry Date',
deviceLocation: 'Location',
@@ -1218,6 +1224,7 @@ export default {
placeholderDeviceType: 'Please select type',
placeholderDeviceModel: 'Please input model',
placeholderDeviceSpec: 'Please input spec',
+ placeholderRatedCapacity: 'Please input rated capacity',
placeholderProductionDate: 'Please select production date',
placeholderFactoryEntryDate: 'Please select factory entry date',
placeholderDeviceLocation: 'Please input location',
diff --git a/src/locales/zh-CN.ts b/src/locales/zh-CN.ts
index d7d22ba2..547ebe42 100644
--- a/src/locales/zh-CN.ts
+++ b/src/locales/zh-CN.ts
@@ -1188,9 +1188,15 @@ export default {
qrcode: '二维码/条形码',
deviceName: '名称',
deviceStatus: '状态',
+ statusEnabled: '启用',
+ statusDisabled: '不启用',
deviceType: '类型',
deviceSpec: '规格',
deviceModel: '型号',
+ isSchedueld: '是否排产',
+ ratedCapacity: '额定产能',
+ yes: '是',
+ no: '否',
productionDate: '生产日期',
factoryEntryDate: '入厂日期',
deviceLocation: '位置',
@@ -1210,6 +1216,7 @@ export default {
placeholderDeviceType: '请选择类型',
placeholderDeviceModel: '请输入型号',
placeholderDeviceSpec: '请输入规格',
+ placeholderRatedCapacity: '请输入额定产能',
placeholderProductionDate: '请选择生产日期',
placeholderFactoryEntryDate: '请选择入厂日期',
placeholderDeviceLocation: '请输入位置',
diff --git a/src/views/mes/deviceledger/DeviceLedgerForm.vue b/src/views/mes/deviceledger/DeviceLedgerForm.vue
index ba72d292..44a46134 100644
--- a/src/views/mes/deviceledger/DeviceLedgerForm.vue
+++ b/src/views/mes/deviceledger/DeviceLedgerForm.vue
@@ -73,6 +73,30 @@
+
+
+
+
+
+
+
+
+
+
@@ -1099,6 +1108,8 @@ const tzStatusOptions = computed(() => {
const detailVisible = ref(false)
const detailLoading = ref(false)
const detailData = ref()
+const detailStatusLoading = ref(false)
+const deviceStatusUpdatingMap = ref>({})
const detailActiveTab = ref('check')
const selectedDetailId = ref()
@@ -1179,6 +1190,42 @@ const getTzStatusTagStyle = (value: any) => {
return 'color: #fff'
}
+const formatScheduleLabel = (value: any) => {
+ return Number(value) === 1
+ ? t('EquipmentManagement.EquipmentLedger.yes')
+ : t('EquipmentManagement.EquipmentLedger.no')
+}
+
+const isDeviceLedgerEnabled = (row: DeviceLedgerVO) => {
+ return Number((row as any)?.deviceStatus) === 0
+}
+
+const handleDeviceStatusChange = async (row: DeviceLedgerVO, value: boolean) => {
+ if (!row?.id) return
+ const oldValue = Number((row as any).deviceStatus)
+ const nextValue = value ? 0 : 1
+ ;(row as any).deviceStatus = nextValue
+ deviceStatusUpdatingMap.value[row.id] = true
+ try {
+ await DeviceLedgerApi.updateDeviceLedger({
+ id: row.id,
+ deviceStatus: nextValue
+ } as DeviceLedgerVO)
+ if (detailData.value?.id === row.id) {
+ detailData.value.deviceStatus = nextValue
+ }
+ message.success(t('common.updateSuccess'))
+ } catch {
+ ;(row as any).deviceStatus = oldValue
+ if (detailData.value?.id === row.id) {
+ detailData.value.deviceStatus = oldValue
+ }
+ message.error(t('common.updateFail'))
+ } finally {
+ deviceStatusUpdatingMap.value[row.id] = false
+ }
+}
+
const formatDetailDate = (value: any) => {
if (!value) return ''
return formatDate(new Date(value), 'YYYY-MM-DD')
@@ -1219,6 +1266,28 @@ const handleDetail = async (id: number) => {
}
}
+const handleDetailStatusChange = async (value: number) => {
+ if (!detailData.value?.id) return
+ const oldValue = value === 0 ? 1 : 0
+ detailStatusLoading.value = true
+ try {
+ await DeviceLedgerApi.updateDeviceLedger({
+ id: detailData.value.id,
+ deviceStatus: value
+ } as DeviceLedgerVO)
+ const current = list.value.find((item) => item.id === detailData.value?.id)
+ if (current) {
+ current.deviceStatus = value
+ }
+ message.success(t('common.updateSuccess'))
+ } catch {
+ detailData.value.deviceStatus = oldValue
+ message.error(t('common.updateFail'))
+ } finally {
+ detailStatusLoading.value = false
+ }
+}
+
const closeDetail = () => {
detailVisible.value = false
selectedDetailId.value = undefined