|
|
@ -10,11 +10,7 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<EdfsWrap title="设备信息列表" class="device-info-table"> |
|
|
|
<EdfsWrap title="设备信息列表" class="device-info-table"> |
|
|
|
<template #title-right> |
|
|
|
<template #title-right> |
|
|
|
<EdfsButton |
|
|
|
<EdfsButton type="primary" inner-text="新增设备" @click="addDevice" /> |
|
|
|
type="primary" |
|
|
|
|
|
|
|
inner-text="新增设备" |
|
|
|
|
|
|
|
@click="addDevice" |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
</template> |
|
|
|
</template> |
|
|
|
<EdfsTable |
|
|
|
<EdfsTable |
|
|
|
class="table" |
|
|
|
class="table" |
|
|
@ -56,7 +52,7 @@ |
|
|
|
/> |
|
|
|
/> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
|
<el-table-column label="操作" width="190" align="center"> |
|
|
|
<el-table-column label="操作" width="210" align="center"> |
|
|
|
<template #default="scope"> |
|
|
|
<template #default="scope"> |
|
|
|
<EdfsButton |
|
|
|
<EdfsButton |
|
|
|
link |
|
|
|
link |
|
|
@ -64,6 +60,12 @@ |
|
|
|
inner-text="查看" |
|
|
|
inner-text="查看" |
|
|
|
@click="onView(scope.row)" |
|
|
|
@click="onView(scope.row)" |
|
|
|
/><el-divider direction="vertical" /> |
|
|
|
/><el-divider direction="vertical" /> |
|
|
|
|
|
|
|
<EdfsButton |
|
|
|
|
|
|
|
link |
|
|
|
|
|
|
|
type="primary" |
|
|
|
|
|
|
|
inner-text="打印标签" |
|
|
|
|
|
|
|
@click="onPrint(scope.row)" |
|
|
|
|
|
|
|
/><el-divider direction="vertical" /> |
|
|
|
|
|
|
|
|
|
|
|
<el-dropdown @command="command => handleCommand(command, scope.row)"> |
|
|
|
<el-dropdown @command="command => handleCommand(command, scope.row)"> |
|
|
|
<el-button type="primary" link |
|
|
|
<el-button type="primary" link |
|
|
@ -104,12 +106,14 @@ import type { TableColumnCtx } from 'element-plus' |
|
|
|
import { useRouter } from 'vue-router' |
|
|
|
import { useRouter } from 'vue-router' |
|
|
|
import PieChart from './components/pie-chart.vue' |
|
|
|
import PieChart from './components/pie-chart.vue' |
|
|
|
import { |
|
|
|
import { |
|
|
|
|
|
|
|
getDeviceLabelBase64, |
|
|
|
getDevicePage, |
|
|
|
getDevicePage, |
|
|
|
getDeviceSummaryByStatus, |
|
|
|
getDeviceSummaryByStatus, |
|
|
|
type IDevice, |
|
|
|
type IDevice, |
|
|
|
} from '@/api/module/eam/device' |
|
|
|
} from '@/api/module/eam/device' |
|
|
|
import { deviceTableCol, DeviceStatus } from './utils' |
|
|
|
import { deviceTableCol, DeviceStatus } from './utils' |
|
|
|
import { getCategoryTree, type ICategoryTree } from '@/api/module/eam/device/category' |
|
|
|
import { getCategoryTree, type ICategoryTree } from '@/api/module/eam/device/category' |
|
|
|
|
|
|
|
import jsPDF from 'jspdf' |
|
|
|
|
|
|
|
|
|
|
|
const loading = ref(true) |
|
|
|
const loading = ref(true) |
|
|
|
const total = ref(0) |
|
|
|
const total = ref(0) |
|
|
@ -191,6 +195,26 @@ function onView(row: any) { |
|
|
|
router.push({ path: '/device/deviceOperation', query: { action: 'view', id: row.id } }) |
|
|
|
router.push({ path: '/device/deviceOperation', query: { action: 'view', id: row.id } }) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function onPrint(row: any) { |
|
|
|
|
|
|
|
const res = await getDeviceLabelBase64(row.id) |
|
|
|
|
|
|
|
debugger |
|
|
|
|
|
|
|
if (isResError(res)) return |
|
|
|
|
|
|
|
const pdf = new jsPDF('l', 'mm', [60, 40]) |
|
|
|
|
|
|
|
const pdfWidth = pdf.internal.pageSize.getWidth() // 标签的宽度 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const imgData = res.data |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const imgWidth = pdfWidth |
|
|
|
|
|
|
|
const imgHeight = (pdfWidth * 3) / 4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 添加图片到标签的 PDF 中 |
|
|
|
|
|
|
|
pdf.addImage(imgData, 'JPEG', 0, 0, imgWidth, imgHeight) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 打开 PDF 打印对话框 |
|
|
|
|
|
|
|
pdf.autoPrint() |
|
|
|
|
|
|
|
window.open(pdf.output('bloburl'), '_blank') |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function handleCommand(command: string, row: any) { |
|
|
|
function handleCommand(command: string, row: any) { |
|
|
|
editDevice(row, command) |
|
|
|
editDevice(row, command) |
|
|
|
} |
|
|
|
} |
|
|
|