Compare commits
49 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
13133c28be | 2 days ago |
|
|
2d20ec5344 | 2 days ago |
|
|
ae6ef128ee | 2 days ago |
|
|
4f6ee86798 | 2 days ago |
|
|
5ff4d7e41a | 2 days ago |
|
|
288d10f3c7 | 2 days ago |
|
|
f3be54dd9f | 2 days ago |
|
|
ad79342616 | 3 days ago |
|
|
e472d4cb86 | 4 days ago |
|
|
4648bdca93 | 4 days ago |
|
|
1418015844 | 4 days ago |
|
|
a28acd5991 | 4 days ago |
|
|
68c960317d | 4 days ago |
|
|
88797b7760 | 4 days ago |
|
|
0d7ae49a10 | 4 days ago |
|
|
e6a3e05220 | 4 days ago |
|
|
a12ed938c1 | 4 days ago |
|
|
63d7ab3c8d | 4 days ago |
|
|
e99351440d | 4 days ago |
|
|
1461cb2b25 | 4 days ago |
|
|
985e92ee2b | 4 days ago |
|
|
aa3111131d | 4 days ago |
|
|
a6d2265622 | 4 days ago |
|
|
9f7a3c81b6 | 4 days ago |
|
|
2a6b73e566 | 5 days ago |
|
|
1bdd5c276f | 5 days ago |
|
|
e68b934593 | 6 days ago |
|
|
cb0ade38e0 | 6 days ago |
|
|
152a906c16 | 6 days ago |
|
|
e13fdef1f6 | 6 days ago |
|
|
2295788977 | 6 days ago |
|
|
d9b062419d | 6 days ago |
|
|
d0db5f5a90 | 6 days ago |
|
|
80e2cda424 | 6 days ago |
|
|
176a3dc607 | 6 days ago |
|
|
182e9e9712 | 7 days ago |
|
|
84101b7866 | 7 days ago |
|
|
2872f52d57 | 7 days ago |
|
|
8c3f7a5aec | 7 days ago |
|
|
fc6f348ad6 | 7 days ago |
|
|
0ff6eaef69 | 7 days ago |
|
|
f88765448b | 1 week ago |
|
|
bedd8d9bca | 1 week ago |
|
|
4abb93deab | 1 week ago |
|
|
21fdceb26f | 1 week ago |
|
|
d8a88b6fd7 | 1 week ago |
|
|
0dbdf57204 | 1 week ago |
|
|
da56f8d359 | 1 week ago |
|
|
85b759406d | 1 week ago |
@ -0,0 +1,62 @@
|
||||
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
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,47 @@
|
||||
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 })
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
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.
|
After Width: | Height: | Size: 366 B |
@ -0,0 +1,174 @@
|
||||
<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>
|
||||
@ -0,0 +1,234 @@
|
||||
<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
@ -0,0 +1,125 @@
|
||||
<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>
|
||||
@ -0,0 +1,169 @@
|
||||
<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