Compare commits
No commits in common. 'main' and 'ck' have entirely different histories.
@ -1,62 +0,0 @@
|
|||||||
import request from '@/config/axios'
|
|
||||||
|
|
||||||
export interface DeviceOperationOverviewParams {
|
|
||||||
ids?: string
|
|
||||||
startTime?: string
|
|
||||||
endTime?: string
|
|
||||||
timelinePageNo?: number
|
|
||||||
timelinePageSize?: number
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface DeviceOperationOverviewMetricVO {
|
|
||||||
key: string
|
|
||||||
icon: string
|
|
||||||
value: number
|
|
||||||
unit: string
|
|
||||||
change: number
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface DeviceOperationOverviewHourlyStatusVO {
|
|
||||||
hour: string
|
|
||||||
running: number
|
|
||||||
standby: number
|
|
||||||
fault: number
|
|
||||||
offline: number
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface DeviceOperationOverviewSummaryVO {
|
|
||||||
status: 'running' | 'standby' | 'fault' | 'offline'
|
|
||||||
percent: number
|
|
||||||
hours: number
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface DeviceOperationOverviewTimelineSegmentVO {
|
|
||||||
status: 'running' | 'standby' | 'fault' | 'offline'
|
|
||||||
startHour: number
|
|
||||||
endHour: number
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface DeviceOperationOverviewTimelineRowVO {
|
|
||||||
id: string
|
|
||||||
name: string
|
|
||||||
utilizationRate: number
|
|
||||||
segments: DeviceOperationOverviewTimelineSegmentVO[]
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface DeviceOperationOverviewRespVO {
|
|
||||||
metrics: DeviceOperationOverviewMetricVO[]
|
|
||||||
hourlyStatus: DeviceOperationOverviewHourlyStatusVO[]
|
|
||||||
summary: DeviceOperationOverviewSummaryVO[]
|
|
||||||
summaryTotalHours: number
|
|
||||||
timelineRows: DeviceOperationOverviewTimelineRowVO[]
|
|
||||||
totalDevices: number
|
|
||||||
}
|
|
||||||
|
|
||||||
export const DeviceOperationOverviewApi = {
|
|
||||||
getRunOverview: async (params: DeviceOperationOverviewParams) => {
|
|
||||||
return await request.get<DeviceOperationOverviewRespVO>({
|
|
||||||
url: `/iot/device-operation-record/runOverview`,
|
|
||||||
params
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,47 +0,0 @@
|
|||||||
import request from '@/config/axios'
|
|
||||||
|
|
||||||
export interface CapacityReportVO {
|
|
||||||
id: number
|
|
||||||
deviceCode: string
|
|
||||||
deviceName: string
|
|
||||||
typeName: string
|
|
||||||
deviceStatus: number
|
|
||||||
ratedCapacity: number
|
|
||||||
reportCapacity: number
|
|
||||||
actualCapacity: number
|
|
||||||
workshopName: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface CapacityReportQuery {
|
|
||||||
pageNo: number
|
|
||||||
pageSize: number
|
|
||||||
deviceCode?: string
|
|
||||||
deviceName?: string
|
|
||||||
deviceType?: string
|
|
||||||
deviceStatus?: string
|
|
||||||
workshop?: string
|
|
||||||
ids?: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export const DeviceLedgerApi = {
|
|
||||||
/**
|
|
||||||
* 产能报表分页查询
|
|
||||||
*/
|
|
||||||
getCapacityReportPage: async (params: CapacityReportQuery) => {
|
|
||||||
return await request.get({ url: '/mes/device-ledger/capacity-report/page', params })
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 产能报表导出
|
|
||||||
*/
|
|
||||||
exportCapacityReport: async (params: { ids?: string }) => {
|
|
||||||
return await request.download({ url: '/mes/device-ledger/capacity-report/export-excel', params })
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新设备状态
|
|
||||||
*/
|
|
||||||
updateDeviceLedger: async (data: { id: number; deviceStatus: number }) => {
|
|
||||||
return await request.put({ url: '/mes/device-ledger/update', data })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,33 +0,0 @@
|
|||||||
import request from '@/config/axios'
|
|
||||||
|
|
||||||
export interface PrintTemplateVO {
|
|
||||||
id: number
|
|
||||||
templateCode: string
|
|
||||||
templateName: string
|
|
||||||
templateType: number
|
|
||||||
templateJson: string
|
|
||||||
remark: string
|
|
||||||
isEnable: boolean
|
|
||||||
createTime: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export const PrintTemplateApi = {
|
|
||||||
getPrintTemplatePage: async (params: any) => {
|
|
||||||
return await request.get({ url: `/mes/print-template/page`, params })
|
|
||||||
},
|
|
||||||
getPrintTemplate: async (id: number) => {
|
|
||||||
return await request.get({ url: `/mes/print-template/get?id=` + id })
|
|
||||||
},
|
|
||||||
createPrintTemplate: async (data: PrintTemplateVO) => {
|
|
||||||
return await request.post({ url: `/mes/print-template/create`, data })
|
|
||||||
},
|
|
||||||
updatePrintTemplate: async (data: PrintTemplateVO) => {
|
|
||||||
return await request.put({ url: `/mes/print-template/update`, data })
|
|
||||||
},
|
|
||||||
deletePrintTemplate: async (id: number) => {
|
|
||||||
return await request.delete({ url: `/mes/print-template/delete?id=` + id })
|
|
||||||
},
|
|
||||||
exportPrintTemplate: async (params) => {
|
|
||||||
return await request.download({ url: `/mes/print-template/export-excel`, params })
|
|
||||||
},
|
|
||||||
}
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 366 B |
@ -1,15 +1,178 @@
|
|||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import type { RunOverviewQueryParams } from './components/types'
|
import type {
|
||||||
|
DeviceTimelineRow,
|
||||||
|
HourlyStatusItem,
|
||||||
|
OverviewOption,
|
||||||
|
RunOverviewData,
|
||||||
|
RunOverviewQueryParams,
|
||||||
|
RunOverviewMetric,
|
||||||
|
RunStatus
|
||||||
|
} from './components/types'
|
||||||
|
|
||||||
const DATE_TIME_FORMAT = 'YYYY-MM-DD HH:mm:ss'
|
const DATE_TIME_FORMAT = 'YYYY-MM-DD HH:mm:ss'
|
||||||
|
|
||||||
|
export const GROUP_OPTIONS: OverviewOption[] = [
|
||||||
|
{ label: 'SMT一组', value: 'group-1' },
|
||||||
|
{ label: '成型二组', value: 'group-2' },
|
||||||
|
{ label: '总装三组', value: 'group-3' }
|
||||||
|
]
|
||||||
|
|
||||||
|
export const DEVICE_OPTIONS: OverviewOption[] = [
|
||||||
|
{ label: '模拟干燥设备04', value: 'device-01' },
|
||||||
|
{ label: '模拟干燥设备03', value: 'device-02' },
|
||||||
|
{ label: '模拟干燥设备02', value: 'device-03' },
|
||||||
|
{ label: '成型模拟设备05', value: 'device-04' },
|
||||||
|
{ label: '成型模拟设备04', value: 'device-05' },
|
||||||
|
{ label: '模拟干燥设备', value: 'device-06' },
|
||||||
|
{ label: '成型模拟设备02', value: 'device-07' },
|
||||||
|
{ label: '成型模拟设备01', value: 'device-08' },
|
||||||
|
{ label: '物流输送设备01', value: 'device-09' },
|
||||||
|
{ label: '包装工作站02', value: 'device-10' },
|
||||||
|
{ label: '包装工作站03', value: 'device-11' },
|
||||||
|
{ label: '拧紧设备01', value: 'device-12' },
|
||||||
|
{ label: '视觉检测设备01', value: 'device-13' }
|
||||||
|
]
|
||||||
|
|
||||||
|
const shiftTimeline = (segments: Array<{ status: RunStatus; startHour: number; endHour: number }>, offset: number) =>
|
||||||
|
segments.map((segment, index) => {
|
||||||
|
let nextStart = segment.startHour + offset
|
||||||
|
let nextEnd = segment.endHour + offset
|
||||||
|
if (index === 0 && nextStart < 0) nextStart = 0
|
||||||
|
if (index === segments.length - 1 && nextEnd > 24) nextEnd = 24
|
||||||
|
return {
|
||||||
|
...segment,
|
||||||
|
startHour: Math.max(0, Math.min(24, Number(nextStart.toFixed(2)))),
|
||||||
|
endHour: Math.max(0, Math.min(24, Number(nextEnd.toFixed(2))))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const BASE_SEGMENTS = [
|
||||||
|
{ status: 'running' as const, startHour: 0, endHour: 2.7 },
|
||||||
|
{ status: 'standby' as const, startHour: 2.7, endHour: 3.1 },
|
||||||
|
{ status: 'running' as const, startHour: 3.1, endHour: 6.6 },
|
||||||
|
{ status: 'standby' as const, startHour: 6.6, endHour: 7.15 },
|
||||||
|
{ status: 'running' as const, startHour: 7.15, endHour: 13.9 },
|
||||||
|
{ status: 'standby' as const, startHour: 13.9, endHour: 14.25 },
|
||||||
|
{ status: 'offline' as const, startHour: 14.25, endHour: 14.95 },
|
||||||
|
{ status: 'running' as const, startHour: 14.95, endHour: 17.45 },
|
||||||
|
{ status: 'fault' as const, startHour: 17.45, endHour: 18.15 },
|
||||||
|
{ status: 'standby' as const, startHour: 18.15, endHour: 18.8 },
|
||||||
|
{ status: 'running' as const, startHour: 18.8, endHour: 20.55 },
|
||||||
|
{ status: 'standby' as const, startHour: 20.55, endHour: 20.95 },
|
||||||
|
{ status: 'running' as const, startHour: 20.95, endHour: 22.25 },
|
||||||
|
{ status: 'offline' as const, startHour: 22.25, endHour: 23.05 },
|
||||||
|
{ status: 'running' as const, startHour: 23.05, endHour: 23.7 },
|
||||||
|
{ status: 'offline' as const, startHour: 23.7, endHour: 24 }
|
||||||
|
]
|
||||||
|
|
||||||
|
const TIMELINE_OFFSETS = [0, -0.3, 0.8, -0.5, 0.45, 1.05, -1.1, 0.25, -0.75, 0.6, -0.2, 1.2, -0.45]
|
||||||
|
|
||||||
export const buildDefaultQueryParams = (): RunOverviewQueryParams => {
|
export const buildDefaultQueryParams = (): RunOverviewQueryParams => {
|
||||||
const start = dayjs().startOf('day')
|
const start = dayjs().startOf('day')
|
||||||
const end = dayjs().endOf('day')
|
const end = dayjs().endOf('day')
|
||||||
return {
|
return {
|
||||||
groupId: '',
|
groupId: GROUP_OPTIONS[0].value,
|
||||||
deviceId: [],
|
deviceId: '',
|
||||||
quickRange: 'today',
|
quickRange: 'today',
|
||||||
timeRange: [start.format(DATE_TIME_FORMAT), end.format(DATE_TIME_FORMAT)]
|
timeRange: [start.format(DATE_TIME_FORMAT), end.format(DATE_TIME_FORMAT)]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const toTimelineRows = (): DeviceTimelineRow[] =>
|
||||||
|
DEVICE_OPTIONS.map((device, index) => ({
|
||||||
|
id: device.value,
|
||||||
|
name: device.label,
|
||||||
|
utilizationRate: [82.35, 76.12, 68.54, 75.63, 72.18, 91.24, 65.32, 78.44, 71.05, 83.67, 69.18, 87.42, 74.56][index],
|
||||||
|
segments: shiftTimeline(BASE_SEGMENTS, TIMELINE_OFFSETS[index] || 0)
|
||||||
|
}))
|
||||||
|
|
||||||
|
const toHourlyStatus = (summaryFactor: number): HourlyStatusItem[] => {
|
||||||
|
return Array.from({ length: 24 }, (_, hour) => {
|
||||||
|
const runningBase = 74 + Math.sin((hour / 24) * Math.PI * 3) * 14 + summaryFactor * 2
|
||||||
|
const standbyBase = 10 + Math.cos((hour / 24) * Math.PI * 4) * 7
|
||||||
|
const faultBase = 2 + Math.max(0, Math.sin((hour - 5) / 2.2)) * 5
|
||||||
|
const offlineBase = 100 - runningBase - standbyBase - faultBase
|
||||||
|
|
||||||
|
const running = Math.max(48, Math.min(88, Number(runningBase.toFixed(2))))
|
||||||
|
const standby = Math.max(4, Math.min(26, Number(standbyBase.toFixed(2))))
|
||||||
|
const fault = Math.max(1, Math.min(8, Number(faultBase.toFixed(2))))
|
||||||
|
const offline = Number(Math.max(4, 100 - running - standby - fault).toFixed(2))
|
||||||
|
|
||||||
|
return {
|
||||||
|
hour: `${String(hour).padStart(2, '0')}:00`,
|
||||||
|
running,
|
||||||
|
standby,
|
||||||
|
fault,
|
||||||
|
offline
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const createMetrics = (summaryFactor: number): RunOverviewMetric[] => [
|
||||||
|
{
|
||||||
|
key: 'utilizationRate',
|
||||||
|
icon: 'ep:pie-chart',
|
||||||
|
value: Number((75.42 + summaryFactor * 1.2).toFixed(2)),
|
||||||
|
unit: '%',
|
||||||
|
change: 4.32
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'powerOnRate',
|
||||||
|
icon: 'ep:video-play',
|
||||||
|
value: Number((90.12 + summaryFactor * 0.7).toFixed(2)),
|
||||||
|
unit: '%',
|
||||||
|
change: 2.15
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'faultRate',
|
||||||
|
icon: 'ep:warning',
|
||||||
|
value: Number(Math.max(1.5, 3.21 - summaryFactor * 0.35).toFixed(2)),
|
||||||
|
unit: '%',
|
||||||
|
change: -1.03
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'standbyRate',
|
||||||
|
icon: 'ep:timer',
|
||||||
|
value: Number(Math.max(4, 6.67 - summaryFactor * 0.25).toFixed(2)),
|
||||||
|
unit: '%',
|
||||||
|
change: -1.14
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
const createSummary = (summaryFactor: number) => {
|
||||||
|
const running = Number((75.42 + summaryFactor * 1.2).toFixed(2))
|
||||||
|
const standby = Number(Math.max(4, 6.67 - summaryFactor * 0.25).toFixed(2))
|
||||||
|
const fault = Number(Math.max(1.5, 3.21 - summaryFactor * 0.35).toFixed(2))
|
||||||
|
const offline = Number((100 - running - standby - fault).toFixed(2))
|
||||||
|
|
||||||
|
return [
|
||||||
|
{ status: 'running' as const, percent: running, hours: Number(((24 * running) / 100).toFixed(2)) },
|
||||||
|
{ status: 'standby' as const, percent: standby, hours: Number(((24 * standby) / 100).toFixed(2)) },
|
||||||
|
{ status: 'fault' as const, percent: fault, hours: Number(((24 * fault) / 100).toFixed(2)) },
|
||||||
|
{ status: 'offline' as const, percent: offline, hours: Number(((24 * offline) / 100).toFixed(2)) }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
export const buildRunOverviewData = (query: RunOverviewQueryParams): RunOverviewData => {
|
||||||
|
const summaryFactor =
|
||||||
|
query.quickRange === 'today'
|
||||||
|
? 0
|
||||||
|
: query.quickRange === 'yesterday'
|
||||||
|
? -0.8
|
||||||
|
: query.quickRange === 'last7Days'
|
||||||
|
? 1.1
|
||||||
|
: query.quickRange === 'last30Days'
|
||||||
|
? 0.45
|
||||||
|
: 0.15
|
||||||
|
|
||||||
|
const rows = toTimelineRows()
|
||||||
|
const filteredRows = query.deviceId ? rows.filter((row) => row.id === query.deviceId) : rows
|
||||||
|
|
||||||
|
return {
|
||||||
|
metrics: createMetrics(summaryFactor),
|
||||||
|
hourlyStatus: toHourlyStatus(summaryFactor),
|
||||||
|
summary: createSummary(summaryFactor),
|
||||||
|
timelineRows: filteredRows,
|
||||||
|
totalDevices: filteredRows.length
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -1,174 +0,0 @@
|
|||||||
<template>
|
|
||||||
<Dialog v-model="dialogVisible" :title="dialogTitle" width="1300" :scroll="true" max-height="70vh" align-center>
|
|
||||||
<el-form class="-mb-15px" :model="queryParams" ref="queryFormRef" :inline="true" label-width="auto">
|
|
||||||
<el-form-item :label="t('EquipmentManagement.CapacityReport.dialogProductCode')" prop="productCode">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.productCode"
|
|
||||||
:placeholder="t('EquipmentManagement.CapacityReport.dialogProductCodePlaceholder')"
|
|
||||||
clearable
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
class="!w-200px"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item :label="t('EquipmentManagement.CapacityReport.dialogProductName')" prop="productName">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.productName"
|
|
||||||
:placeholder="t('EquipmentManagement.CapacityReport.dialogProductNamePlaceholder')"
|
|
||||||
clearable
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
class="!w-200px"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item :label="t('EquipmentManagement.CapacityReport.dialogBaogongTime')" prop="baogongTime">
|
|
||||||
<el-date-picker v-model="baogongTime" value-format="YYYY-MM-DD HH:mm:ss" type="daterange"
|
|
||||||
:start-placeholder="t('EquipmentManagement.CapacityReport.dialogBaogongTimeStart')"
|
|
||||||
:end-placeholder="t('EquipmentManagement.CapacityReport.dialogBaogongTimeEnd')"
|
|
||||||
:shortcuts="baogongTimeShortcuts"
|
|
||||||
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]" class="!w-240px" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item>
|
|
||||||
<el-button @click="handleQuery">
|
|
||||||
<Icon icon="ep:search" class="mr-5px" />
|
|
||||||
{{ t('EquipmentManagement.CapacityReport.dialogSearchButtonText') }}
|
|
||||||
</el-button>
|
|
||||||
<el-button @click="resetQuery">
|
|
||||||
<Icon icon="ep:refresh" class="mr-5px" />
|
|
||||||
{{ t('EquipmentManagement.CapacityReport.dialogResetButtonText') }}
|
|
||||||
</el-button>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true" style="margin-top: 16px">
|
|
||||||
<el-table-column :label="t('EquipmentManagement.CapacityReport.dialogProductCode')" align="center" prop="productCode" />
|
|
||||||
<el-table-column :label="t('EquipmentManagement.CapacityReport.dialogProductName')" align="center" prop="productName" />
|
|
||||||
<el-table-column :label="t('EquipmentManagement.CapacityReport.dialogBaogongTotal')" align="center" prop="baogongTotal" />
|
|
||||||
<el-table-column :label="t('EquipmentManagement.CapacityReport.dialogAvgCapacity')" align="center" prop="avgCapacity" />
|
|
||||||
</el-table>
|
|
||||||
<Pagination
|
|
||||||
:total="total"
|
|
||||||
v-model:page="queryParams.pageNo"
|
|
||||||
v-model:limit="queryParams.pageSize"
|
|
||||||
@pagination="getList"
|
|
||||||
/>
|
|
||||||
</Dialog>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
import { PlanApi } from '@/api/mes/plan'
|
|
||||||
|
|
||||||
const { t } = useI18n()
|
|
||||||
|
|
||||||
const props = defineProps<{
|
|
||||||
modelValue: boolean
|
|
||||||
deviceId?: number
|
|
||||||
deviceName?: string
|
|
||||||
}>()
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
|
||||||
(e: 'update:modelValue', value: boolean): void
|
|
||||||
}>()
|
|
||||||
|
|
||||||
const dialogVisible = computed({
|
|
||||||
get() {
|
|
||||||
return props.modelValue
|
|
||||||
},
|
|
||||||
set(value: boolean) {
|
|
||||||
emit('update:modelValue', value)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const dialogTitle = computed(() => {
|
|
||||||
const name = props.deviceName || '-'
|
|
||||||
return `${t('EquipmentManagement.CapacityReport.dialogTitlePrefix')}${name}`
|
|
||||||
})
|
|
||||||
|
|
||||||
const loading = ref(false)
|
|
||||||
const list = ref<any[]>([])
|
|
||||||
const total = ref(0)
|
|
||||||
const queryParams = reactive({
|
|
||||||
pageNo: 1,
|
|
||||||
pageSize: 10,
|
|
||||||
deviceId: undefined as number | undefined,
|
|
||||||
productCode: undefined as string | undefined,
|
|
||||||
productName: undefined as string | undefined,
|
|
||||||
beginBaogongTime: undefined as string | undefined,
|
|
||||||
endBaogongTime: undefined as string | undefined
|
|
||||||
})
|
|
||||||
const baogongTime = ref<[string, string]>(['', ''])
|
|
||||||
const baogongTimeShortcuts = [
|
|
||||||
{
|
|
||||||
text: t('EquipmentManagement.CapacityReport.shortcutLastWeek'),
|
|
||||||
value: () => {
|
|
||||||
const end = new Date()
|
|
||||||
const start = new Date()
|
|
||||||
start.setDate(start.getDate() - 7)
|
|
||||||
return [start, end]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: t('EquipmentManagement.CapacityReport.shortcutLastHalfYear'),
|
|
||||||
value: () => {
|
|
||||||
const end = new Date()
|
|
||||||
const start = new Date()
|
|
||||||
start.setMonth(start.getMonth() - 6)
|
|
||||||
return [start, end]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: t('EquipmentManagement.CapacityReport.shortcutLastYear'),
|
|
||||||
value: () => {
|
|
||||||
const end = new Date()
|
|
||||||
const start = new Date()
|
|
||||||
start.setFullYear(start.getFullYear() - 1)
|
|
||||||
return [start, end]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
const queryFormRef = ref()
|
|
||||||
|
|
||||||
const getList = async () => {
|
|
||||||
if (!props.deviceId) {
|
|
||||||
list.value = []
|
|
||||||
total.value = 0
|
|
||||||
return
|
|
||||||
}
|
|
||||||
loading.value = true
|
|
||||||
try {
|
|
||||||
const params = {
|
|
||||||
...queryParams,
|
|
||||||
beginBaogongTime: baogongTime.value?.[0] || undefined,
|
|
||||||
endBaogongTime: baogongTime.value?.[1] || undefined
|
|
||||||
}
|
|
||||||
const data = await PlanApi.getProductCapacityPage(params)
|
|
||||||
list.value = data.list
|
|
||||||
total.value = data.total
|
|
||||||
} finally {
|
|
||||||
loading.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleQuery = () => {
|
|
||||||
queryParams.pageNo = 1
|
|
||||||
getList()
|
|
||||||
}
|
|
||||||
|
|
||||||
const resetQuery = () => {
|
|
||||||
queryFormRef.value?.resetFields()
|
|
||||||
baogongTime.value = ['', '']
|
|
||||||
queryParams.deviceId = props.deviceId
|
|
||||||
handleQuery()
|
|
||||||
}
|
|
||||||
|
|
||||||
watch(
|
|
||||||
() => [props.modelValue, props.deviceId],
|
|
||||||
([visible, deviceId]) => {
|
|
||||||
if (!visible) return
|
|
||||||
queryParams.deviceId = deviceId as number
|
|
||||||
queryParams.pageNo = 1
|
|
||||||
queryParams.productCode = undefined
|
|
||||||
queryParams.productName = undefined
|
|
||||||
queryParams.taskCode = undefined
|
|
||||||
getList()
|
|
||||||
}
|
|
||||||
)
|
|
||||||
</script>
|
|
||||||
@ -1,234 +0,0 @@
|
|||||||
<template>
|
|
||||||
<ContentWrap>
|
|
||||||
<!-- 搜索工作栏 -->
|
|
||||||
<el-form class="-mb-15px" :model="queryParams" ref="queryFormRef" :inline="true" min-label-width="80px">
|
|
||||||
<el-form-item :label="t('EquipmentManagement.CapacityReport.deviceCode')" prop="deviceCode">
|
|
||||||
<el-input v-model="queryParams.deviceCode"
|
|
||||||
:placeholder="t('EquipmentManagement.CapacityReport.placeholderDeviceCode')" clearable
|
|
||||||
@keyup.enter="handleQuery" class="!w-240px" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item :label="t('EquipmentManagement.CapacityReport.deviceName')" prop="deviceName">
|
|
||||||
<el-input v-model="queryParams.deviceName"
|
|
||||||
:placeholder="t('EquipmentManagement.CapacityReport.placeholderDeviceName')" clearable
|
|
||||||
@keyup.enter="handleQuery" class="!w-240px" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item :label="t('EquipmentManagement.CapacityReport.baogongTime')" prop="baogongTime">
|
|
||||||
<el-date-picker v-model="baogongTime" value-format="YYYY-MM-DD HH:mm:ss" type="daterange"
|
|
||||||
:start-placeholder="t('EquipmentManagement.CapacityReport.placeholderBaogongTimeStart')"
|
|
||||||
:end-placeholder="t('EquipmentManagement.CapacityReport.placeholderBaogongTimeEnd')"
|
|
||||||
:shortcuts="baogongTimeShortcuts"
|
|
||||||
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]" class="!w-240px" />
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item v-if="filterCount > 3">
|
|
||||||
<el-button type="text" class="text-primary" @click="toggleFilters">
|
|
||||||
<Icon :icon="showAllFilters ? 'ep:arrow-up' : 'ep:arrow-down'" class="mr-5px" />
|
|
||||||
{{ showAllFilters ? t('FactoryModeling.FactoryStructure.collapseText') :
|
|
||||||
t('FactoryModeling.FactoryStructure.expandText') }}
|
|
||||||
</el-button>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item>
|
|
||||||
<el-button @click="handleQuery">
|
|
||||||
<Icon icon="ep:search" class="mr-5px" /> {{ t('common.query') }}
|
|
||||||
</el-button>
|
|
||||||
<el-button @click="resetQuery">
|
|
||||||
<Icon icon="ep:refresh" class="mr-5px" /> {{ t('common.reset') }}
|
|
||||||
</el-button>
|
|
||||||
<el-button type="success" plain @click="handleExport" :loading="exportLoading">
|
|
||||||
<Icon icon="ep:download" class="mr-5px" /> {{ t('EquipmentManagement.EquipmentLedger.export') }}
|
|
||||||
</el-button>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
</ContentWrap>
|
|
||||||
|
|
||||||
<!-- 列表 -->
|
|
||||||
<ContentWrap>
|
|
||||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true" :row-key="(row) => row.id"
|
|
||||||
@select-all="handleSelectAll" @select="handleSelect">
|
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
|
||||||
<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.ratedCapacity')" align="center"
|
|
||||||
prop="ratedCapacity" sortable />
|
|
||||||
<el-table-column align="center" prop="reportCapacity">
|
|
||||||
<template #header>
|
|
||||||
<span>{{ t('EquipmentManagement.CapacityReport.reportCapacity') }}</span>
|
|
||||||
<el-tooltip :content="t('EquipmentManagement.CapacityReport.reportCapacityTooltip')" placement="top">
|
|
||||||
<Icon icon="ep:question-filled" class="ml-4px"
|
|
||||||
style="vertical-align: middle; color: var(--el-text-color-secondary)" />
|
|
||||||
</el-tooltip>
|
|
||||||
</template>
|
|
||||||
<template #default="scope">
|
|
||||||
<el-button link type="primary" @click="openProductCapacity(scope.row)">
|
|
||||||
{{ t('EquipmentManagement.CapacityReport.reportCapacityViewDetail') }}
|
|
||||||
</el-button>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column align="center" prop="actualCapacity" sortable>
|
|
||||||
<template #header>
|
|
||||||
<span>{{ t('EquipmentManagement.CapacityReport.actualCapacity') }}</span>
|
|
||||||
<el-tooltip :content="t('EquipmentManagement.CapacityReport.actualCapacityTooltip')" placement="top">
|
|
||||||
<Icon icon="ep:question-filled" class="ml-4px"
|
|
||||||
style="vertical-align: middle; color: var(--el-text-color-secondary)" />
|
|
||||||
</el-tooltip>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column :label="t('EquipmentManagement.CapacityReport.workshop')" align="center" prop="workshopName"
|
|
||||||
sortable />
|
|
||||||
</el-table>
|
|
||||||
<Pagination :total="total" v-model:page="queryParams.pageNo" v-model:limit="queryParams.pageSize"
|
|
||||||
@pagination="getList" />
|
|
||||||
</ContentWrap>
|
|
||||||
|
|
||||||
<ProductCapacityDialog v-model="productCapacityVisible" :device-id="productCapacityDeviceId"
|
|
||||||
:device-name="productCapacityDeviceName" />
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
import { ref, reactive } from 'vue'
|
|
||||||
import download from '@/utils/download'
|
|
||||||
import { DeviceLedgerApi, CapacityReportVO } from '@/api/mes/device-ledger'
|
|
||||||
import ProductCapacityDialog from './ProductCapacityDialog.vue'
|
|
||||||
|
|
||||||
defineOptions({ name: 'CapacityReport' })
|
|
||||||
|
|
||||||
const message = useMessage()
|
|
||||||
const { t } = useI18n()
|
|
||||||
|
|
||||||
const loading = ref(true)
|
|
||||||
const list = ref<CapacityReportVO[]>([])
|
|
||||||
const total = ref(0)
|
|
||||||
const queryParams = reactive({
|
|
||||||
pageNo: 1,
|
|
||||||
pageSize: 10,
|
|
||||||
deviceCode: undefined,
|
|
||||||
deviceName: undefined,
|
|
||||||
deviceType: undefined,
|
|
||||||
workshop: undefined,
|
|
||||||
beginTime: undefined,
|
|
||||||
endTime: undefined
|
|
||||||
})
|
|
||||||
const baogongTime = ref<[string, string]>(['', ''])
|
|
||||||
const queryFormRef = ref()
|
|
||||||
const exportLoading = ref(false)
|
|
||||||
const showAllFilters = ref(false)
|
|
||||||
const filterCount = 3
|
|
||||||
const selectedIds = ref<number[]>([])
|
|
||||||
const productCapacityVisible = ref(false)
|
|
||||||
const productCapacityDeviceId = ref<number>()
|
|
||||||
const productCapacityDeviceName = ref<string>()
|
|
||||||
|
|
||||||
const baogongTimeShortcuts = [
|
|
||||||
{
|
|
||||||
text: t('EquipmentManagement.CapacityReport.shortcutLastWeek'),
|
|
||||||
value: () => {
|
|
||||||
const end = new Date()
|
|
||||||
const start = new Date()
|
|
||||||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
|
|
||||||
return [start, end]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: t('EquipmentManagement.CapacityReport.shortcutLastHalfYear'),
|
|
||||||
value: () => {
|
|
||||||
const end = new Date()
|
|
||||||
const start = new Date()
|
|
||||||
start.setMonth(start.getMonth() - 6)
|
|
||||||
return [start, end]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: t('EquipmentManagement.CapacityReport.shortcutLastYear'),
|
|
||||||
value: () => {
|
|
||||||
const end = new Date()
|
|
||||||
const start = new Date()
|
|
||||||
start.setFullYear(start.getFullYear() - 1)
|
|
||||||
return [start, end]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
const openProductCapacity = (row: CapacityReportVO) => {
|
|
||||||
productCapacityDeviceId.value = row.id
|
|
||||||
productCapacityDeviceName.value = row.deviceName
|
|
||||||
productCapacityVisible.value = true
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 切换筛选框展开/折叠 */
|
|
||||||
const toggleFilters = () => {
|
|
||||||
showAllFilters.value = !showAllFilters.value
|
|
||||||
}
|
|
||||||
|
|
||||||
const getList = async () => {
|
|
||||||
loading.value = true
|
|
||||||
try {
|
|
||||||
const params = {
|
|
||||||
...queryParams,
|
|
||||||
beginTime: baogongTime.value?.[0] || undefined,
|
|
||||||
endTime: baogongTime.value?.[1] || undefined
|
|
||||||
}
|
|
||||||
const data = await DeviceLedgerApi.getCapacityReportPage(params)
|
|
||||||
list.value = data.list
|
|
||||||
total.value = data.total
|
|
||||||
} finally {
|
|
||||||
loading.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleQuery = () => {
|
|
||||||
queryParams.pageNo = 1
|
|
||||||
selectedIds.value = []
|
|
||||||
getList()
|
|
||||||
}
|
|
||||||
|
|
||||||
const resetQuery = () => {
|
|
||||||
queryFormRef.value?.resetFields()
|
|
||||||
baogongTime.value = ['', '']
|
|
||||||
selectedIds.value = []
|
|
||||||
handleQuery()
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleSelectAll = (val: boolean) => {
|
|
||||||
if (val) {
|
|
||||||
selectedIds.value = list.value.map(item => item.id)
|
|
||||||
} else {
|
|
||||||
selectedIds.value = []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleSelect = (val: boolean, row: CapacityReportVO) => {
|
|
||||||
if (val) {
|
|
||||||
selectedIds.value.push(row.id)
|
|
||||||
} else {
|
|
||||||
const index = selectedIds.value.indexOf(row.id)
|
|
||||||
if (index > -1) {
|
|
||||||
selectedIds.value.splice(index, 1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleExport = async () => {
|
|
||||||
try {
|
|
||||||
await message.exportConfirm()
|
|
||||||
exportLoading.value = true
|
|
||||||
const params: { ids?: string } = {}
|
|
||||||
if (selectedIds.value.length > 0) {
|
|
||||||
params.ids = selectedIds.value.join(',')
|
|
||||||
}
|
|
||||||
const data = await DeviceLedgerApi.exportCapacityReport(params)
|
|
||||||
download.excel(data, t('EquipmentManagement.CapacityReport.exportFilename'))
|
|
||||||
} catch {
|
|
||||||
} finally {
|
|
||||||
exportLoading.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
getList()
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
File diff suppressed because it is too large
Load Diff
@ -1,125 +0,0 @@
|
|||||||
<template>
|
|
||||||
<Dialog :title="dialogTitle" v-model="dialogVisible">
|
|
||||||
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="120px" v-loading="formLoading">
|
|
||||||
<el-form-item prop="templateCode">
|
|
||||||
<template #label>
|
|
||||||
<span>
|
|
||||||
{{ t('TemplateManagement.PrintTemplate.templateCode') }}
|
|
||||||
<el-tooltip :content="t('TemplateManagement.PrintTemplate.templateCodeTooltip')" placement="top">
|
|
||||||
<Icon icon="ep:question-filled" />
|
|
||||||
</el-tooltip>
|
|
||||||
</span>
|
|
||||||
</template>
|
|
||||||
<el-row :gutter="10" style="width: 100%;">
|
|
||||||
<el-col :xs="24" :sm="18" :md="16" :lg="14" :xl="12">
|
|
||||||
<el-input v-model="formData.templateCode" :placeholder="t('TemplateManagement.PrintTemplate.placeholderTemplateCode')" :disabled="formData.isAutoCode || formType === 'update'" />
|
|
||||||
</el-col>
|
|
||||||
<el-col :xs="24" :sm="6" :md="4" :lg="3" :xl="2">
|
|
||||||
<el-switch v-model="formData.isAutoCode" :disabled="formType === 'update'" />
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item :label="t('TemplateManagement.PrintTemplate.templateName')" prop="templateName">
|
|
||||||
<el-input v-model="formData.templateName" :placeholder="t('TemplateManagement.PrintTemplate.placeholderTemplateName')" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item :label="t('TemplateManagement.PrintTemplate.templateType')" prop="templateType">
|
|
||||||
<el-select v-model="formData.templateType" :placeholder="t('TemplateManagement.PrintTemplate.placeholderTemplateType')" class="!w-full">
|
|
||||||
<el-option v-for="dict in getIntDictOptions('print_template_type')" :key="dict.value" :label="dict.label" :value="dict.value" />
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item :label="t('TemplateManagement.PrintTemplate.isEnable')" prop="isEnable">
|
|
||||||
<el-switch v-model="formData.isEnable" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item :label="t('TemplateManagement.PrintTemplate.remark')" prop="remark">
|
|
||||||
<el-input v-model="formData.remark" :placeholder="t('TemplateManagement.PrintTemplate.placeholderRemark')" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
<template #footer>
|
|
||||||
<el-button @click="submitForm" type="primary" :disabled="formLoading">{{ t('common.ok') }}</el-button>
|
|
||||||
<el-button @click="dialogVisible = false">{{ t('common.cancel') }}</el-button>
|
|
||||||
</template>
|
|
||||||
</Dialog>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
import { PrintTemplateApi, PrintTemplateVO } from '@/api/mes/printtemplate'
|
|
||||||
import { getIntDictOptions } from '@/utils/dict'
|
|
||||||
|
|
||||||
defineOptions({ name: 'PrintTemplateForm' })
|
|
||||||
|
|
||||||
const { t } = useI18n()
|
|
||||||
const message = useMessage()
|
|
||||||
|
|
||||||
const dialogVisible = ref(false)
|
|
||||||
const dialogTitle = ref('')
|
|
||||||
const formLoading = ref(false)
|
|
||||||
const formType = ref('')
|
|
||||||
const formData = ref({
|
|
||||||
id: undefined,
|
|
||||||
templateCode: undefined,
|
|
||||||
isAutoCode: true,
|
|
||||||
templateName: undefined,
|
|
||||||
templateType: undefined,
|
|
||||||
remark: undefined,
|
|
||||||
isEnable: true,
|
|
||||||
})
|
|
||||||
const formRules = computed(() => ({
|
|
||||||
templateCode: formData.value.isAutoCode ? [] : [{ required: true, message: t('TemplateManagement.PrintTemplate.validatorCodeRequired'), trigger: 'blur' }],
|
|
||||||
templateName: [{ required: true, message: t('TemplateManagement.PrintTemplate.validatorNameRequired'), trigger: 'blur' }],
|
|
||||||
templateType: [{ required: true, message: t('TemplateManagement.PrintTemplate.validatorTypeRequired'), trigger: 'change' }],
|
|
||||||
}))
|
|
||||||
const formRef = ref()
|
|
||||||
|
|
||||||
const open = async (type: string, id?: number) => {
|
|
||||||
dialogVisible.value = true
|
|
||||||
dialogTitle.value = t('action.' + type)
|
|
||||||
formType.value = type
|
|
||||||
resetForm()
|
|
||||||
if (id) {
|
|
||||||
formLoading.value = true
|
|
||||||
try {
|
|
||||||
formData.value = await PrintTemplateApi.getPrintTemplate(id)
|
|
||||||
} finally {
|
|
||||||
formLoading.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
defineExpose({ open })
|
|
||||||
|
|
||||||
const emit = defineEmits(['success'])
|
|
||||||
const submitForm = async () => {
|
|
||||||
await formRef.value.validate()
|
|
||||||
formLoading.value = true
|
|
||||||
try {
|
|
||||||
const data = formData.value as unknown as PrintTemplateVO
|
|
||||||
const { isAutoCode, ...submitData } = data as any
|
|
||||||
if (isAutoCode) {
|
|
||||||
delete submitData.templateCode
|
|
||||||
}
|
|
||||||
if (formType.value === 'create') {
|
|
||||||
await PrintTemplateApi.createPrintTemplate(submitData)
|
|
||||||
message.success(t('common.createSuccess'))
|
|
||||||
} else {
|
|
||||||
await PrintTemplateApi.updatePrintTemplate(submitData)
|
|
||||||
message.success(t('common.updateSuccess'))
|
|
||||||
}
|
|
||||||
dialogVisible.value = false
|
|
||||||
emit('success')
|
|
||||||
} finally {
|
|
||||||
formLoading.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const resetForm = () => {
|
|
||||||
formData.value = {
|
|
||||||
id: undefined,
|
|
||||||
templateCode: undefined,
|
|
||||||
isAutoCode: true,
|
|
||||||
templateName: undefined,
|
|
||||||
templateType: undefined,
|
|
||||||
remark: undefined,
|
|
||||||
isEnable: true,
|
|
||||||
}
|
|
||||||
formRef.value?.resetFields()
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@ -1,169 +0,0 @@
|
|||||||
<template>
|
|
||||||
<ContentWrap>
|
|
||||||
<el-form class="-mb-15px" :model="queryParams" ref="queryFormRef" :inline="true" min-label-width="68px">
|
|
||||||
<el-form-item :label="t('TemplateManagement.PrintTemplate.templateCode')" prop="templateCode">
|
|
||||||
<el-input v-model="queryParams.templateCode"
|
|
||||||
:placeholder="t('TemplateManagement.PrintTemplate.placeholderTemplateCode')" clearable
|
|
||||||
@keyup.enter="handleQuery" class="!w-240px" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item :label="t('TemplateManagement.PrintTemplate.templateName')" prop="templateName">
|
|
||||||
<el-input v-model="queryParams.templateName"
|
|
||||||
:placeholder="t('TemplateManagement.PrintTemplate.placeholderTemplateName')" clearable
|
|
||||||
@keyup.enter="handleQuery" class="!w-240px" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item>
|
|
||||||
<el-button @click="handleQuery">
|
|
||||||
<Icon icon="ep:search" class="mr-5px" /> {{ t('common.query') }}
|
|
||||||
</el-button>
|
|
||||||
<el-button @click="resetQuery">
|
|
||||||
<Icon icon="ep:refresh" class="mr-5px" /> {{ t('common.reset') }}
|
|
||||||
</el-button>
|
|
||||||
<el-button type="primary" plain @click="openForm('create')">
|
|
||||||
<Icon icon="ep:plus" class="mr-5px" /> {{ t('action.add') }}
|
|
||||||
</el-button>
|
|
||||||
<el-button type="success" plain @click="handleExport" :loading="exportLoading">
|
|
||||||
<Icon icon="ep:download" class="mr-5px" /> {{ t('action.export') }}
|
|
||||||
</el-button>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
</ContentWrap>
|
|
||||||
|
|
||||||
<ContentWrap>
|
|
||||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true" row-key="id"
|
|
||||||
@selection-change="handleSelectionChange">
|
|
||||||
<el-table-column type="selection" width="55" fixed="left" reserve-selection />
|
|
||||||
<el-table-column :label="t('TemplateManagement.PrintTemplate.templateCode')" align="center" prop="templateCode"
|
|
||||||
sortable />
|
|
||||||
<el-table-column :label="t('TemplateManagement.PrintTemplate.templateName')" align="center" prop="templateName"
|
|
||||||
sortable />
|
|
||||||
<el-table-column :label="t('TemplateManagement.PrintTemplate.templateType')" align="center" prop="templateType"
|
|
||||||
sortable>
|
|
||||||
<template #default="scope">
|
|
||||||
<dict-tag type="print_template_type" :value="scope.row.templateType" />
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column :label="t('TemplateManagement.PrintTemplate.isEnable')" align="center" prop="isEnable" sortable>
|
|
||||||
<template #default="scope">
|
|
||||||
<el-tag :type="scope.row.isEnable ? 'success' : 'danger'">
|
|
||||||
{{ scope.row.isEnable ? t('TemplateManagement.PrintTemplate.enabled') :
|
|
||||||
t('TemplateManagement.PrintTemplate.disabled') }}
|
|
||||||
</el-tag>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column :label="t('TemplateManagement.PrintTemplate.templateJson')" align="center" prop="templateJson"
|
|
||||||
min-width="200px" :show-overflow-tooltip="true" />
|
|
||||||
<el-table-column :label="t('TemplateManagement.PrintTemplate.remark')" align="center" prop="remark" />
|
|
||||||
<el-table-column :label="t('TemplateManagement.PrintTemplate.createTime')" align="center" prop="createTime"
|
|
||||||
:formatter="dateFormatter" width="180px" sortable />
|
|
||||||
<el-table-column :label="t('TemplateManagement.PrintTemplate.operate')" align="center" min-width="160px">
|
|
||||||
<template #default="scope">
|
|
||||||
<el-button link type="primary" @click="openForm('update', scope.row.id)">
|
|
||||||
{{ t('action.edit') }}
|
|
||||||
</el-button>
|
|
||||||
<el-button link type="warning" @click="openDesigner(scope.row)">
|
|
||||||
{{ t('TemplateManagement.PrintTemplate.design') }}
|
|
||||||
</el-button>
|
|
||||||
<el-button link type="danger" @click="handleDelete(scope.row.id)">
|
|
||||||
{{ t('action.del') }}
|
|
||||||
</el-button>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
<Pagination :total="total" v-model:page="queryParams.pageNo" v-model:limit="queryParams.pageSize"
|
|
||||||
@pagination="getList" />
|
|
||||||
</ContentWrap>
|
|
||||||
|
|
||||||
<PrintTemplateForm ref="formRef" @success="getList" />
|
|
||||||
<PrintTemplateDesigner ref="designerRef" @success="getList" />
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
import { dateFormatter } from '@/utils/formatTime'
|
|
||||||
import download from '@/utils/download'
|
|
||||||
import { PrintTemplateApi, PrintTemplateVO } from '@/api/mes/printtemplate'
|
|
||||||
import { DictTag } from '@/components/DictTag'
|
|
||||||
import PrintTemplateForm from './PrintTemplateForm.vue'
|
|
||||||
import PrintTemplateDesigner from './PrintTemplateDesigner.vue'
|
|
||||||
|
|
||||||
defineOptions({ name: 'PrintTemplate' })
|
|
||||||
|
|
||||||
const message = useMessage()
|
|
||||||
const { t } = useI18n()
|
|
||||||
|
|
||||||
const loading = ref(true)
|
|
||||||
const list = ref<PrintTemplateVO[]>([])
|
|
||||||
const total = ref(0)
|
|
||||||
const queryParams = reactive({
|
|
||||||
pageNo: 1,
|
|
||||||
pageSize: 10,
|
|
||||||
templateCode: undefined,
|
|
||||||
templateName: undefined,
|
|
||||||
})
|
|
||||||
const queryFormRef = ref()
|
|
||||||
const exportLoading = ref(false)
|
|
||||||
const selectedIds = ref<number[]>([])
|
|
||||||
|
|
||||||
const getList = async () => {
|
|
||||||
loading.value = true
|
|
||||||
try {
|
|
||||||
const data = await PrintTemplateApi.getPrintTemplatePage(queryParams)
|
|
||||||
list.value = data.list
|
|
||||||
total.value = data.total
|
|
||||||
} finally {
|
|
||||||
loading.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleQuery = () => {
|
|
||||||
queryParams.pageNo = 1
|
|
||||||
getList()
|
|
||||||
}
|
|
||||||
|
|
||||||
const resetQuery = () => {
|
|
||||||
queryFormRef.value.resetFields()
|
|
||||||
handleQuery()
|
|
||||||
}
|
|
||||||
|
|
||||||
const formRef = ref()
|
|
||||||
const openForm = (type: string, id?: number) => {
|
|
||||||
formRef.value.open(type, id)
|
|
||||||
}
|
|
||||||
|
|
||||||
const designerRef = ref()
|
|
||||||
const openDesigner = (row: any) => {
|
|
||||||
designerRef.value.open(row)
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleDelete = async (id: number) => {
|
|
||||||
try {
|
|
||||||
await message.delConfirm()
|
|
||||||
await PrintTemplateApi.deletePrintTemplate(id)
|
|
||||||
message.success(t('common.delSuccess'))
|
|
||||||
await getList()
|
|
||||||
} catch { }
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleExport = async () => {
|
|
||||||
try {
|
|
||||||
await message.exportConfirm()
|
|
||||||
exportLoading.value = true
|
|
||||||
const params = {
|
|
||||||
...queryParams,
|
|
||||||
ids: selectedIds.value.length ? selectedIds.value.join(',') : undefined,
|
|
||||||
}
|
|
||||||
const data = await PrintTemplateApi.exportPrintTemplate(params)
|
|
||||||
download.excel(data, t('TemplateManagement.PrintTemplate.exportFilename'))
|
|
||||||
} catch {
|
|
||||||
} finally {
|
|
||||||
exportLoading.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleSelectionChange = (rows: any[]) => {
|
|
||||||
selectedIds.value = rows?.map((row) => row.id).filter((id) => id !== undefined) ?? []
|
|
||||||
}
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
getList()
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue