|
|
|
@ -203,7 +203,10 @@
|
|
|
|
:print-max-width="220" :empty-text="t('EquipmentManagement.EquipmentLedger.qrcodeEmpty')"
|
|
|
|
:print-max-width="220" :empty-text="t('EquipmentManagement.EquipmentLedger.qrcodeEmpty')"
|
|
|
|
:error-text="t('EquipmentManagement.EquipmentLedger.qrcodeLoadError')"
|
|
|
|
:error-text="t('EquipmentManagement.EquipmentLedger.qrcodeLoadError')"
|
|
|
|
:refresh-url="getQrcodeRefreshUrl()" :refresh-disabled="!formData.id || !formData.deviceCode"
|
|
|
|
:refresh-url="getQrcodeRefreshUrl()" :refresh-disabled="!formData.id || !formData.deviceCode"
|
|
|
|
refresh-confirm-text="确认刷新该设备二维码吗?" @refresh-success="handleQrcodeRefreshSuccess" />
|
|
|
|
refresh-confirm-text="确认刷新该设备二维码吗?"
|
|
|
|
|
|
|
|
:template-json="formData.templateJson"
|
|
|
|
|
|
|
|
:print-data="buildPrintData()"
|
|
|
|
|
|
|
|
@refresh-success="handleQrcodeRefreshSuccess" />
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
</el-col>
|
|
|
|
|
|
|
|
|
|
|
|
@ -498,6 +501,7 @@ const initFormData = () => ({
|
|
|
|
beijianIds: [] as number[],
|
|
|
|
beijianIds: [] as number[],
|
|
|
|
fileUrl: undefined,
|
|
|
|
fileUrl: undefined,
|
|
|
|
qrcodeUrl: undefined,
|
|
|
|
qrcodeUrl: undefined,
|
|
|
|
|
|
|
|
templateJson: undefined,
|
|
|
|
sort: undefined,
|
|
|
|
sort: undefined,
|
|
|
|
dvId: undefined
|
|
|
|
dvId: undefined
|
|
|
|
})
|
|
|
|
})
|
|
|
|
@ -628,6 +632,20 @@ const getQrcodeRefreshUrl = () => {
|
|
|
|
return `/mes/device-ledger/regenerate-code?id=${formData.value.id}&code=${encodeURIComponent(String(formData.value.deviceCode))}`
|
|
|
|
return `/mes/device-ledger/regenerate-code?id=${formData.value.id}&code=${encodeURIComponent(String(formData.value.deviceCode))}`
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const buildPrintData = () => {
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
|
|
|
id: formData.value.id,
|
|
|
|
|
|
|
|
deviceCode: formData.value.deviceCode,
|
|
|
|
|
|
|
|
deviceName: formData.value.deviceName,
|
|
|
|
|
|
|
|
deviceSpec: formData.value.deviceSpec,
|
|
|
|
|
|
|
|
deviceBrand: formData.value.deviceBrand,
|
|
|
|
|
|
|
|
deviceModel: formData.value.deviceModel,
|
|
|
|
|
|
|
|
deviceLocation: formData.value.deviceLocation,
|
|
|
|
|
|
|
|
remark: formData.value.remark,
|
|
|
|
|
|
|
|
qrcodeUrl: formData.value.qrcodeUrl
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const handleQrcodeRefreshSuccess = async (data: any) => {
|
|
|
|
const handleQrcodeRefreshSuccess = async (data: any) => {
|
|
|
|
if (!formData.value.id) return
|
|
|
|
if (!formData.value.id) return
|
|
|
|
if (data?.qrcodeUrl) {
|
|
|
|
if (data?.qrcodeUrl) {
|
|
|
|
@ -677,9 +695,14 @@ const open = async (type: string, id?: number, defaultDeviceTypeId?: number) =>
|
|
|
|
formLoading.value = true
|
|
|
|
formLoading.value = true
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
const detail = await DeviceLedgerApi.getDeviceLedger(id)
|
|
|
|
const detail = await DeviceLedgerApi.getDeviceLedger(id)
|
|
|
|
|
|
|
|
const templateJson = (detail as any)?.templateJson
|
|
|
|
|
|
|
|
const parsedTemplateJson = typeof templateJson === 'string'
|
|
|
|
|
|
|
|
? JSON.parse(templateJson)
|
|
|
|
|
|
|
|
: templateJson
|
|
|
|
formData.value = {
|
|
|
|
formData.value = {
|
|
|
|
...initFormData(),
|
|
|
|
...initFormData(),
|
|
|
|
...(detail as any),
|
|
|
|
...(detail as any),
|
|
|
|
|
|
|
|
templateJson: parsedTemplateJson,
|
|
|
|
isCode: (detail as any)?.isCode ?? false,
|
|
|
|
isCode: (detail as any)?.isCode ?? false,
|
|
|
|
isScheduled: normalizeNumberish((detail as any)?.isScheduled ?? (detail as any)?.isScheduled) ?? 0,
|
|
|
|
isScheduled: normalizeNumberish((detail as any)?.isScheduled ?? (detail as any)?.isScheduled) ?? 0,
|
|
|
|
ratedCapacity: normalizeNumberish((detail as any)?.ratedCapacity),
|
|
|
|
ratedCapacity: normalizeNumberish((detail as any)?.ratedCapacity),
|
|
|
|
|