Compare commits

..

18 Commits

Author SHA1 Message Date
gtz
8226b45a03 merge 2025-12-10 15:21:00 +08:00
gtz
dde04cf93f 1 2025-12-10 15:11:28 +08:00
63a67e58de Merge pull request '更新' (#454) from projects/ssdl-zwq into projects/ssdl-test
Reviewed-on: #454
2025-11-28 16:28:10 +08:00
zwq
48e9f70625 更新 2025-11-28 16:27:50 +08:00
f5f250cb16 Merge pull request '更新' (#453) from projects/ssdl-zwq into projects/ssdl-test
Reviewed-on: #453
2025-11-20 14:48:36 +08:00
zwq
b6241fe7c4 更新 2025-11-20 14:48:07 +08:00
94edd04a08 Merge pull request '更新' (#452) from projects/ssdl-zwq into projects/ssdl-test
Reviewed-on: #452
2025-11-20 14:45:08 +08:00
zwq
b926559a7d 更新 2025-11-20 14:44:10 +08:00
b2984ed4cf Merge pull request 'projects/ssdl-zhp' (#451) from projects/ssdl-zhp into projects/ssdl-test
Reviewed-on: #451
2025-11-20 13:24:50 +08:00
‘937886381’
4ade2dfcdc Merge branch 'projects/ssdl-test' into projects/ssdl-zhp 2025-11-20 13:23:31 +08:00
‘937886381’
852a3f17a0 修改 2025-11-20 13:22:19 +08:00
cba14b1f61 Merge pull request 'projects/ssdl-zhp' (#450) from projects/ssdl-zhp into projects/ssdl-test
Reviewed-on: #450
2025-11-18 17:02:28 +08:00
‘937886381’
33c00785df 大屏 2025-11-18 17:00:40 +08:00
‘937886381’
d8acff21e3 Merge branch 'projects/ssdl-test' into projects/ssdl-zhp 2025-11-18 09:32:16 +08:00
‘937886381’
c0a38c568f 大屏 2025-11-18 09:31:39 +08:00
gtz
be86cbd9b3 1 2025-11-17 10:58:44 +08:00
6a8a9ed28d Merge pull request '更新' (#449) from projects/ssdl-zwq into projects/ssdl-test
Reviewed-on: #449
2025-11-17 09:24:30 +08:00
zwq
a2213f4f7e 更新 2025-11-17 09:23:55 +08:00
181 changed files with 15016 additions and 13417 deletions

View File

@@ -12,10 +12,10 @@ ENV = 'development'
VUE_APP_TITLE = 智能监控分析系统
# 芋道管理系统/开发环境
# VUE_APP_BASE_API = 'http://172.16.33.187:48082'
# VUE_APP_BASE_API = 'http://line.kszny.picaiba.com'
VUE_APP_BASE_API = 'http://172.16.32.79:48082'
VUE_APP_BASE_API = 'http://192.168.0.31:48080'
# VUE_APP_BASE_API = 'http://172.16.32.76:48080'
# VUE_APP_BASE_API = 'http://line.kszny.picaiba.com'
# 路由懒加载
VUE_CLI_BABEL_TRANSPILE_MODULES = true

BIN
dist.zip

Binary file not shown.

View File

@@ -6,7 +6,7 @@
"license": "MIT",
"scripts": {
"local": "vue-cli-service serve --mode local",
"dev": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --mode dev",
"dev": "vue-cli-service serve --mode dev",
"front": "vue-cli-service serve --mode front",
"build:prod": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build --mode prod",
"build:stage": "vue-cli-service build --mode stage",

View File

@@ -0,0 +1,72 @@
import request from '@/utils/request'
// 获取区域列表
export function getAreaList(params) {
return request({
url: '/wms/region/page',
method: 'get',
params
})
}
// 获取区域空满数量
export function postAllAreaInfo(data) {
return request({
url: '/wms/region/lsit/count',
method: 'post',
data
})
}
// 获取指定库区库位信息
export function postAreaInfo(data) {
return request({
url: '/wms/line-edge-library/list/region',
method: 'post',
data
})
}
// 获取区域总览
export function postAllAreaOverview(data) {
return request({
url: '/wms/line-edge-library/line/count',
method: 'post',
data
})
}
// 删除能源实时数据库plc相关
export function deleteEnergyPlc(id) {
return request({
url: '/base/energy-plc/delete?id=' + id,
method: 'delete'
})
}
// 获取关联表编码
export function getCode() {
return request({
url: '/base/energy-plc/getCode',
method: 'get'
})
}
// 获得能源实时数据库plc相关分页
export function getEnergyPlcPage(data) {
return request({
url: '/base/energy-plc/page',
method: 'post',
data: data
})
}
// 导出能源实时数据库plc相关 Excel
export function exportEnergyPlcExcel(query) {
return request({
url: '/base/energy-plc/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}

View File

@@ -0,0 +1,63 @@
import request from '@/utils/request'
// 获取出入库历史任务分页
export function getRecordPage(params) {
return request({
url: '/wms/job-main-task-history/page',
method: 'get',
params
})
}
// 获取巷道列表
export function getLaneList(params) {
return request({
url: '/wms/lane/page',
method: 'get',
params
})
}
// 更新能源实时数据库plc相关
export function updateEnergyPlc(data) {
return request({
url: '/base/energy-plc/update',
method: 'put',
data: data
})
}
// 删除能源实时数据库plc相关
export function deleteEnergyPlc(id) {
return request({
url: '/base/energy-plc/delete?id=' + id,
method: 'delete'
})
}
// 获取关联表编码
export function getCode() {
return request({
url: '/base/energy-plc/getCode',
method: 'get'
})
}
// 获得能源实时数据库plc相关分页
export function getEnergyPlcPage(data) {
return request({
url: '/base/energy-plc/page',
method: 'post',
data: data
})
}
// 导出能源实时数据库plc相关 Excel
export function exportEnergyPlcExcel(query) {
return request({
url: '/base/energy-plc/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}

View File

@@ -59,34 +59,3 @@ export function getEquipmentAll() {
method: 'get'
})
}
export function getTree(query) {
return request({
url: '/base/factory/getTree',
method: 'get',
params: query
})
}
export function getEquipmentOverall(data) {
return request({
url: '/monitoring/equipment-overall/get',
method: 'post',
data: data,
});
}
export function getParamMonitor(data) {
return request({
url: '/monitoring/equipment-monitor/paramMonitor',
method: 'post',
data: data,
});
}
export function getAlarmDet(data) {
return request({
url: 'monitoring/equipment-overall/alarmDet',
method: 'post',
data: data,
});
}

View File

@@ -52,5 +52,3 @@ export function exportEquipmentTypeExcel(query) {
responseType: 'blob'
})
}

View File

@@ -50,15 +50,6 @@ export function getPdlAutoReportNewSearchNow(data) {
});
}
export function getPdlAutoReportNewSearchLastGroup(data) {
return request({
url: '/monitoring/production-monitor/getPdlAutoReportNewSearchLastGroup',
method: 'post',
data: data,
timeout: 60000,
});
}
// 班组自动报表分页
export function getTeamReportPage(data) {

View File

@@ -141,13 +141,3 @@ export function getPerView(data) {
data:data
})
}
// 导出 Excel
export function exportExcel(query) {
return request({
url: '/base/group-scheduling-plan/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}

View File

@@ -26,13 +26,6 @@ export function getGroup(id) {
method: 'get'
})
}
// 检查更新-生产班组
export function updateIsProduction(id) {
return request({
url: '/base/group-team/updateIsProduction?id=' + id,
method: 'get'
})
}
// 获得班组基础信息分页
export function getGroupPage(query) {

View File

@@ -90,29 +90,3 @@ export function getEnableData() {
method: 'get',
})
}
// 解除继承节假日
export function disExtends(data) {
return request({
url: '/base/group-holiday/disExtends',
method: 'post',
data: data
})
}
// 恢复继承节假日
export function reExtends(data) {
return request({
url: '/base/group-holiday/reExtends',
method: 'post',
data: data
})
}
// 获得部门节假日继承设置信息设置
export function getSet(query) {
return request({
url: '/base/group-holiday-dept-set/getSet',
method: 'get',
params: query
})
}

View File

@@ -1,56 +0,0 @@
import request from '@/utils/request'
// 创建能源监控配置
export function getDefectSummaryTable(data) {
return request({
url: '/extend/check-gaozhun-record/defectSummaryTable',
method: 'post',
data: data,
});
}
export function getTranslucentPage(data) {
return request({
url: '/monitoring/translucent/page',
method: 'get',
params: data,
});
}
export function exportTranslucent(data) {
return request({
url: '/monitoring/translucent/export-excel',
method: 'get',
params: data,
responseType: 'blob',
});
}
export function getDefectAnalysis(data) {
return request({
url: '/extend/check-gaozhun-record/defectAnalysis',
method: 'post',
data: data,
});
}
export function getSectionDefect(data) {
return request({
url: '/extend/check-gaozhun-record/sectionDefect',
method: 'post',
data: data,
});
}
export function getDefectSummaryChart(data) {
return request({
url: '/extend/check-gaozhun-record/defectSummaryChart',
method: 'post',
data: data,
});
}
export function getDefectSummaryDet(data) {
return request({
url: '/extend/check-gaozhun-record/defectSummaryDet',
method: 'post',
data: data,
});
}

View File

@@ -1,63 +0,0 @@
/*
* @Author: zhp
* @Date: 2023-12-08 15:26:59
* @LastEditTime: 2023-12-11 15:21:44
* @LastEditors: zhp
* @Description:
*/
import request from '@/utils/request'
export function getQualityIsraPage(query) {
return request({
url: '/extend/check-isra-statistics/getIsraData',
method: 'get',
params: query,
});
}
export function getQualityIsraDayMap(query) {
return request({
url: '/base/quality-isra-statistics/dayMap',
method: 'get',
params: query
})
}
export function getQualityIsraWeekMap(query) {
return request({
url: '/base/quality-isra-statistics/weekMap',
method: 'get',
params: query
})
}
export function getQualityIsraMonthMap(query) {
return request({
url: '/base/quality-isra-statistics/monthMap',
method: 'get',
params: query
})
}
export function getQualityIsraDayList(query) {
return request({
url: '/base/quality-isra-statistics/dayList',
method: 'get',
params: query
})
}
export function getQualityIsraWeekList(query) {
return request({
url: '/base/quality-isra-statistics/weekList',
method: 'get',
params: query
})
}
export function getQualityIsraMonthList(query) {
return request({
url: '/base/quality-isra-statistics/monthList',
method: 'get',
params: query
})
}

View File

@@ -0,0 +1,154 @@
/*
* @Author: zwq
* @Date: 2025-11-17 09:25:12
* @LastEditors: zwq
* @LastEditTime: 2025-11-28 09:29:14
* @Description:
*/
import request from '@/utils/request'
// 获得原料分页
export function getProductPage(query) {
return request({
url: '/wms/material/page',
method: 'get',
params: query
})
}
// 获得原料
export function getProduct(id) {
return request({
url: '/wms/material/get?id=' + id,
method: 'get'
})
}
// 删除原料
export function deleteProduct(id) {
return request({
url: '/wms/material/delete?id=' + id,
method: 'delete'
})
}
// 更新
export function updateProduct(data) {
return request({
url: '/wms/material/update',
method: 'put',
data: data
})
}
// 创建
export function createProduct(data) {
return request({
url: '/wms/material/create',
method: 'post',
data: data
})
}
// 获得工艺分页
export function getProcessPage(query) {
return request({
url: '/wms/process/page/group/by',
method: 'get',
params: query
})
}
// 获得工艺点击展开表格
export function getProcessDetailPage(query) {
return request({
url: '/wms/process/page/group/by/detail',
method: 'get',
params: query
})
}
// 删除工艺
export function deleteProcess(id) {
return request({
url: '/wms/process/delete?id=' + id,
method: 'delete'
})
}
// 批量删除工艺
export function deleteProcessList(ids) {
return request({
url: '/wms/process/delete-list?ids=' + ids,
method: 'delete'
})
}
// 更新
export function updateProcess(data) {
return request({
url: '/wms/process/update',
method: 'put',
data: data
})
}
// 创建
export function createProcess(data) {
return request({
url: '/wms/process/create',
method: 'post',
data: data
})
}
// 获得工艺
export function getProcess(id) {
return request({
url: '/wms/process/get?id=' + id,
method: 'get'
})
}
// 工艺设备原料分页
export function getProcessMaterialPage(query) {
return request({
url: '/wms/process-equipment-material/page',
method: 'get',
params: query
})
}
// 删除工艺设备原料
export function deleteProcessMaterial(id) {
return request({
url: '/wms/process-equipment-material/delete?id=' + id,
method: 'delete'
})
}
// 更新
export function updateProcessMaterial(data) {
return request({
url: '/wms/process-equipment-material/update',
method: 'put',
data: data
})
}
// 创建
export function createProcessMaterial(data) {
return request({
url: '/wms/process-equipment-material/create',
method: 'post',
data: data
})
}
// 获得工艺
export function getProcessMaterial(id) {
return request({
url: '/wms/process-equipment-material/get?id=' + id,
method: 'get'
})
}
// 获得设备分页
export function getEquipmentPage(query) {
return request({
url: '/wms/equipment/page',
method: 'get',
params: query
})
}

60
src/api/ssdl/taskList.js Normal file
View File

@@ -0,0 +1,60 @@
/*
* @Author: zwq
* @Date: 2025-11-17 09:25:12
* @LastEditors: zwq
* @LastEditTime: 2025-11-18 15:42:19
* @Description:
*/
import request from '@/utils/request'
// 获得任务分页
export function getTaskPage(query) {
return request({
url: '/wms/job-main-task/page',
method: 'get',
params: query
})
}
// 获得任务
export function getTask(id) {
return request({
url: '/wms/job-main-task/get?id=' + id,
method: 'get'
})
}
// 获得任务日志分页
export function getTaskLogPage(query) {
return request({
url: '/wms/job-main-task-log/page',
method: 'get',
params: query
})
}
// 更新
export function updateTask(data) {
return request({
url: '/wms/job-main-task/update',
method: 'put',
data: data
})
}
// 根据区域id获取该区域下的库位信息
export function getRegion(id) {
return request({
url: '/wms/line-edge-library/get-by-region-id?regionId=' + id,
method: 'get'
})
}
// 创建
export function createPCTask(data) {
return request({
url: '/wms/job-main-task/pc-create-task',
method: 'post',
data: data
})
}

View File

@@ -0,0 +1,9 @@
import request from '@/utils/request'
export function getLineEdgeLibraryList(data) {
return request({
url: '/wms/line-edge-library/list',
method: 'get',
params: data,
});
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.1 KiB

BIN
src/assets/img/ABN.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 461 B

BIN
src/assets/img/ABNScale.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 321 B

BIN
src/assets/img/DIS.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 B

BIN
src/assets/img/DISScale.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 B

BIN
src/assets/img/EP.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 B

BIN
src/assets/img/EPScale.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 B

BIN
src/assets/img/FP.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 B

BIN
src/assets/img/FPScale.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 B

BIN
src/assets/img/IDL.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 929 B

BIN
src/assets/img/IDLScale.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 321 B

BIN
src/assets/img/IT.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 320 B

BIN
src/assets/img/ITScale.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 261 B

BIN
src/assets/img/LCK.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 416 B

BIN
src/assets/img/LCKScale.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 305 B

BIN
src/assets/img/OCC.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 325 B

BIN
src/assets/img/OCCScale.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 259 B

BIN
src/assets/img/RES.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 420 B

BIN
src/assets/img/RESScale.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 321 B

BIN
src/assets/img/Top1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

BIN
src/assets/img/Top2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

BIN
src/assets/img/Top3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

BIN
src/assets/img/Top4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

BIN
src/assets/img/Top5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

BIN
src/assets/img/agvCar.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
src/assets/img/chargeBg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 622 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 B

BIN
src/assets/img/recycle.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 379 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 355 B

BIN
src/assets/img/runBg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 325 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 562 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 611 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 MiB

View File

@@ -6,48 +6,104 @@
-->
<template>
<el-form ref="form" :model="form" :label-width="`${labelWidth}px`" :size="size" :label-position="labelPosition"
v-loading="formLoading">
<el-row :gutter="20" v-for="(row, rindex) in rows" :key="rindex">
<el-col v-for="col in row" :key="col.label" :span="24 / row.length">
<el-form-item :label="col.label" :prop="col.prop" :rules="col.rules">
<el-input v-if="col.input" v-model="form[col.prop]" @change="$emit('update', form)"
:placeholder="`请输入${col.label}`" v-bind="col.bind" />
<el-input v-if="col.textarea" type="textarea" v-model="form[col.prop]" @change="$emit('update', form)"
:placeholder="`请输入${col.label}`" v-bind="col.bind" />
<el-select v-if="col.select" v-model="form[col.prop]" :placeholder="`请选择${col.label}`"
@change="$emit('update', form)" v-bind="col.bind">
<el-option v-for="opt in optionListOf[col.prop]" :key="opt.value" :label="opt.label" :value="opt.value" />
</el-select>
<el-date-picker v-if="col.datetime" v-model="form[col.prop]" type="datetime" :placeholder="`请选择${col.label}`"
value-format="timestamp" v-bind="col.bind"></el-date-picker>
<el-switch v-if="col.switch" v-model="form[col.prop]" active-color="#0b58ff" inactive-color="#e1e1e1"
v-bind="col.bind" @change="handleSwitchChange(col.prop)"></el-switch>
<component v-if="col.subcomponent" :key="col.key" :is="col.subcomponent" :inlineStyle="col.style"></component>
<el-form
ref="form"
:model="form"
:label-width="`${labelWidth}px`"
:size="size"
:label-position="labelPosition"
v-loading="formLoading">
<el-row :gutter="20" v-for="(row, rindex) in rows" :key="rindex">
<el-col v-for="col in row" :key="col.label" :span="24 / row.length">
<el-form-item :label="col.label" :prop="col.prop" :rules="col.rules">
<el-input
v-if="col.input"
v-model="form[col.prop]"
@change="$emit('update', form)"
:placeholder="`请输入${col.label}`"
v-bind="col.bind" />
<el-input
v-if="col.textarea"
type="textarea"
v-model="form[col.prop]"
@change="$emit('update', form)"
:placeholder="`请输入${col.label}`"
v-bind="col.bind" />
<el-select
v-if="col.select"
v-model="form[col.prop]"
:placeholder="`请选择${col.label}`"
@change="$emit('update', form)"
v-bind="col.bind">
<el-option
v-for="opt in optionListOf[col.prop]"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
<el-date-picker
v-if="col.datetime"
v-model="form[col.prop]"
type="datetime"
:placeholder="`请选择${col.label}`"
value-format="timestamp"
v-bind="col.bind"></el-date-picker>
<el-switch
v-if="col.switch"
v-model="form[col.prop]"
active-color="#0b58ff"
inactive-color="#e1e1e1"
v-bind="col.bind"></el-switch>
<component
v-if="col.subcomponent"
:key="col.key"
:is="col.subcomponent"
:inlineStyle="col.style"></component>
<div class="upload-area" :class="uploadOpen ? '' : 'height-48'" ref="uploadArea" v-if="col.upload">
<span class="close-icon" :class="uploadOpen ? 'open' : ''">
<el-button type="text" icon="el-icon-arrow-right" @click="handleFilesOpen" />
</span>
<!-- :file-list="uploadedFileList" -->
<el-upload class="upload-in-dialog" v-if="col.upload" :action="uploadUrl" :headers="uploadHeaders"
:show-file-list="false" icon="el-icon-upload2" :before-upload="beforeUpload"
:on-success="handleUploadSuccess" v-bind="col.bind">
<el-button size="mini" :disabled="col.bind?.disabled || false">
<svg-icon icon-class="icon-upload" style="color: inherit"></svg-icon>
上传文件
</el-button>
<div class="el-upload__tip" slot="tip" v-if="col.uploadTips">
{{ col.uploadTips || '只能上传jpg/png文件, 大小不超过2MB' }}
</div>
</el-upload>
<uploadedFile class="file" v-for="file in form[col.prop] || []" :file="file" :key="file.fileUrl"
@delete="handleDeleteFile(file)" @Preview="handlePreview(file)" />
</div>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div
class="upload-area"
:class="uploadOpen ? '' : 'height-48'"
ref="uploadArea"
v-if="col.upload">
<span class="close-icon" :class="uploadOpen ? 'open' : ''">
<el-button
type="text"
icon="el-icon-arrow-right"
@click="handleFilesOpen" />
</span>
<!-- :file-list="uploadedFileList" -->
<el-upload
class="upload-in-dialog"
v-if="col.upload"
:action="uploadUrl"
:headers="uploadHeaders"
:show-file-list="false"
icon="el-icon-upload2"
:before-upload="beforeUpload"
:on-success="handleUploadSuccess"
v-bind="col.bind">
<el-button size="mini" :disabled="col.bind?.disabled || false">
<svg-icon
icon-class="icon-upload"
style="color: inherit"></svg-icon>
上传文件
</el-button>
<div class="el-upload__tip" slot="tip" v-if="col.uploadTips">
{{ col.uploadTips || '只能上传jpg/png文件, 大小不超过2MB' }}
</div>
</el-upload>
<uploadedFile
class="file"
v-for="file in form[col.prop] || []"
:file="file"
:key="file.fileUrl"
@delete="handleDeleteFile(file)"
@Preview="handlePreview(file)" />
</div>
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
@@ -78,8 +134,7 @@ const uploadedFile = {
data() {
return {};
},
methods: {
methods: {
handleDelete() {
this.$emit('delete', this.file);
},
@@ -196,12 +251,7 @@ export default {
// 处理 options
this.handleOptions();
},
methods: {
handleSwitchChange(prop) {
// 触发 update 事件,将最新的 form 数据传递给父组件
this.$emit('update', { ...this.form });
console.log(`switch ${prop} 变化:`, this.form[prop]);
},
methods: {
/** 模拟透传 ref */
validate(cb) {
return this.$refs.form.validate(cb);

View File

@@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2022-08-24 11:19:43
* @LastEditors: zwq
* @LastEditTime: 2024-04-02 09:33:29
* @LastEditTime: 2025-11-28 09:35:03
* @Description:
*/
export default {
@@ -69,7 +69,7 @@ export default {
this.$refs.addOrUpdate.init(val.data.id);
});
} else if (val.type === "delete") {
this.deleteHandle(val.data.id, val.data.name, val.data._pageIndex)
this.deleteHandle(val.data.id, val.data.name, val.data._pageIndex,val.data)
} else {
this.otherMethods(val)
}

View File

@@ -9,7 +9,7 @@ import { isRelogin } from '@/utils/request'
NProgress.configure({ showSpinner: false })
// 增加三方登陆 update by 芋艿
const whiteList = ['/login', '/social-login', '/auth-redirect', '/bind', '/register', '/oauthLogin/gitee']
const whiteList = ['/login', '/social-login','screenbg', '/auth-redirect', '/bind', '/register', '/oauthLogin/gitee']
router.beforeEach((to, from, next) => {
NProgress.start()
@@ -25,9 +25,9 @@ router.beforeEach((to, from, next) => {
// 获取字典数据 add by 芋艿
store.dispatch('dict/loadDictDatas')
// 判断当前用户是否已拉取完 user_info 信息
store.dispatch('GetInfo').then(() => {
store.dispatch('GetInfo').then(userInfo => {
isRelogin.show = false
store.dispatch('GenerateRoutes').then(accessRoutes => {
store.dispatch('GenerateRoutes', userInfo.menus).then(accessRoutes => {
// 根据 roles 权限生成可访问的路由表
router.addRoutes(accessRoutes) // 动态添加可访问路由表
next({ ...to, replace: true }) // hack方法 确保addRoutes已完成

View File

@@ -28,223 +28,277 @@ Vue.use(Router)
// 公共路由
export const constantRoutes = [
{
path: '/redirect',
component: Layout,
hidden: true,
children: [
{
path: '/redirect/:path(.*)',
component: (resolve) => require(['@/views/redirect'], resolve)
}
]
},
{
path: '/login',
component: (resolve) => require(['@/views/login'], resolve),
hidden: true
},
{
path: '/sso',
component: (resolve) => require(['@/views/sso'], resolve),
hidden: true
},
{
path: '/social-login',
component: (resolve) => require(['@/views/socialLogin'], resolve),
hidden: true
},
{
path: '/404',
component: (resolve) => require(['@/views/error/404'], resolve),
hidden: true
},
{
path: '/401',
component: (resolve) => require(['@/views/error/401'], resolve),
hidden: true
},
{
path: '/print-design',
component: (resolve) => require(['@/views/print/design'], resolve),
hidden: true
},
{
path: "",
component: Layout,
redirect: "index",
children: [
{
path: "index",
component: (resolve) => require(["@/views/home/index"], resolve),
name: "首页",
meta: { title: "首页", icon: "dashboard", affix: true },
hidden: true
},
],
},
{
path: '/user',
component: Layout,
hidden: true,
redirect: 'noredirect',
children: [{
path: 'profile',
component: (resolve) => require(['@/views/system/user/profile/index'], resolve),
name: 'Profile',
meta: { title: '个人中心', icon: 'user' }
}, {
path: 'notify-message',
component: (resolve) => require(['@/views/system/notify/my/index'], resolve),
name: 'MyNotifyMessage',
meta: { title: '我的站内信', icon: 'message' },
}]
},
{
path: '/dict',
component: Layout,
hidden: true,
children: [{
path: 'type/data/:dictId(\\d+)',
component: (resolve) => require(['@/views/system/dict/data'], resolve),
name: 'SystemDictData',
meta: { title: '字典数据', icon: '', activeMenu: '/system/dict' }
}
]
},
{
path: '/job',
component: Layout,
hidden: true,
children: [{
path: 'log',
component: (resolve) => require(['@/views/infra/job/log'], resolve),
name: 'InfraJobLog',
meta: { title: '调度日志', activeMenu: '/infra/job' }
}
]
}, {
path: '/codegen',
component: Layout,
hidden: true,
children: [{
path: 'edit/:tableId(\\d+)',
component: (resolve) => require(['@/views/infra/codegen/editTable'], resolve),
name: 'InfraCodegenEditTable',
meta: { title: '修改生成配置', activeMenu: '/infra/codegen' }
}
]
},
{
path: '/bpm',
component: Layout,
hidden: true,
redirect: 'noredirect',
children: [{
path: 'oa/leave/create',
component: (resolve) => require(['@/views/bpm/oa/leave/create'], resolve),
name: 'BpmOALeaveCreate',
meta: { title: '发起 OA 请假', icon: 'form', activeMenu: '/bpm/oa/leave' }
}, {
path: 'oa/leave/detail',
component: (resolve) => require(['@/views/bpm/oa/leave/detail'], resolve),
name: 'BpmOALeaveDetail',
meta: { title: '查看 OA 请假', icon: 'view', activeMenu: '/bpm/oa/leave' }
}
]
},
{
path: '/bpm',
component: Layout,
hidden: true,
children: [{
path: 'manager/form/edit',
component: (resolve) => require(['@/views/bpm/form/formEditor'], resolve),
name: 'BpmFormEditor',
meta: { title: '流程表单-编辑', activeMenu: '/bpm/manager/form' }
}, {
path: 'manager/definition',
component: (resolve) => require(['@/views/bpm/definition/index'], resolve),
name: 'BpmProcessDefinition',
meta: { title: '流程定义', activeMenu: '/bpm/manager/model' }
}, {
path: 'manager/model/design',
component: (resolve) => require(['@/views/bpm/model/modelEditor'], resolve),
name: 'BpmModelEditor',
meta: { title: '设计流程', activeMenu: '/bpm/manager/model' }
}, {
path: 'process-instance/create',
component: (resolve) => require(['@/views/bpm/processInstance/create'], resolve),
name: 'BpmProcessInstanceCreate',
meta: { title: '发起流程', activeMenu: '/bpm/task/my' }
}, {
path: 'process-instance/detail',
component: (resolve) => require(['@/views/bpm/processInstance/detail'], resolve),
name: 'BpmProcessInstanceDetail',
meta: { title: '流程详情', activeMenu: '/bpm/task/my' }
}
]
},
{
path: '/property',
component: Layout,
hidden: true,
children: [{
path: 'value/:propertyId(\\d+)',
component: (resolve) => require(['@/views/mall/product/property/value'], resolve),
name: 'ProductPropertyValue',
meta: { title: '商品属性值', icon: '', activeMenu: '/product/property' }
}
]
},
{
path: '/spu',
component: Layout,
hidden: true,
children: [{
path: 'edit/:spuId(\\d+)',
component: (resolve) => require(['@/views/mall/product/spu/save'], resolve),
name: 'ProductSpuUpdate',
meta: { title: '修改商品', activeMenu: '/product/spu' }
},
{
path: 'add',
component: (resolve) => require(['@/views/mall/product/spu/save'], resolve),
name: 'ProductSpuCreate',
meta: { title: '添加商品', activeMenu: '/product/spu' }
}
]
},
{
path: '/trade/order',
component: Layout,
hidden: true,
children: [
{
path: 'detail',
name: 'TradeOrderDetail',
hidden: true,
meta: { title: '订单详情' },
component: (resolve) => require(['@/views/mall/trade/order/detail'], resolve)
}
]
},
{
path: '/pay',
component: Layout,
hidden: true,
children: [{
path: 'order/submit',
name: 'PayOrderSubmit',
hidden: true,
meta: {
title: '收银台',
noCache: true
},
component: (resolve) => require(['@/views/pay/order/submit'], resolve)
}]
}
]
{
path: '/redirect',
component: Layout,
hidden: true,
children: [
{
path: '/redirect/:path(.*)',
component: (resolve) => require(['@/views/redirect'], resolve),
},
],
},
{
path: '/login',
component: (resolve) => require(['@/views/login'], resolve),
// hidden: true,
},
{
path: '/sso',
component: (resolve) => require(['@/views/sso'], resolve),
hidden: true,
},
{
path: '/social-login',
component: (resolve) => require(['@/views/socialLogin'], resolve),
hidden: true,
},
{
path: '/404',
component: (resolve) => require(['@/views/error/404'], resolve),
hidden: true,
},
{
path: '/401',
component: (resolve) => require(['@/views/error/401'], resolve),
hidden: true,
},
{
path: '/print-design',
component: (resolve) => require(['@/views/print/design'], resolve),
hidden: true,
},
{
path: '',
component: Layout,
redirect: 'index',
children: [
{
path: 'index',
component: (resolve) => require(['@/views/home/index'], resolve),
name: '首页',
meta: { title: '首页', icon: 'dashboard', affix: true },
hidden: true,
},
],
},
{
path: '/screenbg',
component: () =>
import(
/* webpackChunkName: "about" */ '@/views/productionVisualization/equipmentBoard'
),
name: 'screenbg',
meta: { title: '大屏', icon: 'chart' },
},
{
path: '/user',
component: Layout,
hidden: true,
redirect: 'noredirect',
children: [
{
path: 'profile',
component: (resolve) =>
require(['@/views/system/user/profile/index'], resolve),
name: 'Profile',
meta: { title: '个人中心', icon: 'user' },
},
{
path: 'notify-message',
component: (resolve) =>
require(['@/views/system/notify/my/index'], resolve),
name: 'MyNotifyMessage',
meta: { title: '我的站内信', icon: 'message' },
},
],
},
{
path: '/dict',
component: Layout,
hidden: true,
children: [
{
path: 'type/data/:dictId(\\d+)',
component: (resolve) => require(['@/views/system/dict/data'], resolve),
name: 'SystemDictData',
meta: { title: '字典数据', icon: '', activeMenu: '/system/dict' },
},
],
},
{
path: '/job',
component: Layout,
hidden: true,
children: [
{
path: 'log',
component: (resolve) => require(['@/views/infra/job/log'], resolve),
name: 'InfraJobLog',
meta: { title: '调度日志', activeMenu: '/infra/job' },
},
],
},
{
path: '/codegen',
component: Layout,
hidden: true,
children: [
{
path: 'edit/:tableId(\\d+)',
component: (resolve) =>
require(['@/views/infra/codegen/editTable'], resolve),
name: 'InfraCodegenEditTable',
meta: { title: '修改生成配置', activeMenu: '/infra/codegen' },
},
],
},
{
path: '/bpm',
component: Layout,
hidden: true,
redirect: 'noredirect',
children: [
{
path: 'oa/leave/create',
component: (resolve) =>
require(['@/views/bpm/oa/leave/create'], resolve),
name: 'BpmOALeaveCreate',
meta: {
title: '发起 OA 请假',
icon: 'form',
activeMenu: '/bpm/oa/leave',
},
},
{
path: 'oa/leave/detail',
component: (resolve) =>
require(['@/views/bpm/oa/leave/detail'], resolve),
name: 'BpmOALeaveDetail',
meta: {
title: '查看 OA 请假',
icon: 'view',
activeMenu: '/bpm/oa/leave',
},
},
],
},
{
path: '/bpm',
component: Layout,
hidden: true,
children: [
{
path: 'manager/form/edit',
component: (resolve) =>
require(['@/views/bpm/form/formEditor'], resolve),
name: 'BpmFormEditor',
meta: { title: '流程表单-编辑', activeMenu: '/bpm/manager/form' },
},
{
path: 'manager/definition',
component: (resolve) =>
require(['@/views/bpm/definition/index'], resolve),
name: 'BpmProcessDefinition',
meta: { title: '流程定义', activeMenu: '/bpm/manager/model' },
},
{
path: 'manager/model/design',
component: (resolve) =>
require(['@/views/bpm/model/modelEditor'], resolve),
name: 'BpmModelEditor',
meta: { title: '设计流程', activeMenu: '/bpm/manager/model' },
},
{
path: 'process-instance/create',
component: (resolve) =>
require(['@/views/bpm/processInstance/create'], resolve),
name: 'BpmProcessInstanceCreate',
meta: { title: '发起流程', activeMenu: '/bpm/task/my' },
},
{
path: 'process-instance/detail',
component: (resolve) =>
require(['@/views/bpm/processInstance/detail'], resolve),
name: 'BpmProcessInstanceDetail',
meta: { title: '流程详情', activeMenu: '/bpm/task/my' },
},
],
},
{
path: '/property',
component: Layout,
hidden: true,
children: [
{
path: 'value/:propertyId(\\d+)',
component: (resolve) =>
require(['@/views/mall/product/property/value'], resolve),
name: 'ProductPropertyValue',
meta: {
title: '商品属性值',
icon: '',
activeMenu: '/product/property',
},
},
],
},
{
path: '/spu',
component: Layout,
hidden: true,
children: [
{
path: 'edit/:spuId(\\d+)',
component: (resolve) =>
require(['@/views/mall/product/spu/save'], resolve),
name: 'ProductSpuUpdate',
meta: { title: '修改商品', activeMenu: '/product/spu' },
},
{
path: 'add',
component: (resolve) =>
require(['@/views/mall/product/spu/save'], resolve),
name: 'ProductSpuCreate',
meta: { title: '添加商品', activeMenu: '/product/spu' },
},
],
},
{
path: '/trade/order',
component: Layout,
hidden: true,
children: [
{
path: 'detail',
name: 'TradeOrderDetail',
hidden: true,
meta: { title: '订单详情' },
component: (resolve) =>
require(['@/views/mall/trade/order/detail'], resolve),
},
],
},
{
path: '/pay',
component: Layout,
hidden: true,
children: [
{
path: 'order/submit',
name: 'PayOrderSubmit',
hidden: true,
meta: {
title: '收银台',
noCache: true,
},
component: (resolve) => require(['@/views/pay/order/submit'], resolve),
},
],
},
];
// 防止连续点击多次路由报错
let routerPush = Router.prototype.push;

View File

@@ -1,5 +1,4 @@
import {constantRoutes} from '@/router'
import {getRouters} from '@/api/menu'
import Layout from '@/layout/index'
import ParentView from '@/components/ParentView';
import {toCamelCase} from "@/utils";
@@ -27,22 +26,25 @@ const permission = {
},
},
actions: {
// 生成路由
GenerateRoutes({commit}) {
/**
* 生成路由
*
* @param commit commit 函数
* @param menus 路由参数
*/
GenerateRoutes({commit}, menus) {
return new Promise(resolve => {
// 向后端请求路由数据(菜单)
getRouters().then(res => {
const sdata = JSON.parse(JSON.stringify(res.data)) // 【重要】用于菜单中的数据
const rdata = JSON.parse(JSON.stringify(res.data)) // 用于最后添加到 Router 中的数据
const sidebarRoutes = filterAsyncRouter(sdata)
const rewriteRoutes = filterAsyncRouter(rdata, false, true)
rewriteRoutes.push({path: '*', redirect: '/404', hidden: true})
commit('SET_ROUTES', rewriteRoutes)
commit('SET_SIDEBAR_ROUTERS', constantRoutes.concat(sidebarRoutes))
commit('SET_DEFAULT_ROUTES', sidebarRoutes)
commit('SET_TOPBAR_ROUTES', sidebarRoutes)
resolve(rewriteRoutes)
})
// 将 menus 菜单,转换为 route 路由数组
const sdata = JSON.parse(JSON.stringify(menus)) // 【重要】用于菜单中的数据
const rdata = JSON.parse(JSON.stringify(menus)) // 用于最后添加到 Router 中的数据
const sidebarRoutes = filterAsyncRouter(sdata)
const rewriteRoutes = filterAsyncRouter(rdata, false, true)
rewriteRoutes.push({path: '*', redirect: '/404', hidden: true})
commit('SET_ROUTES', rewriteRoutes)
commit('SET_SIDEBAR_ROUTERS', constantRoutes.concat(sidebarRoutes))
commit('SET_DEFAULT_ROUTES', sidebarRoutes)
commit('SET_TOPBAR_ROUTES', sidebarRoutes)
resolve(rewriteRoutes)
})
}
}

View File

@@ -1,10 +1,10 @@
import axios from 'axios'
import { Message, MessageBox, Notification, Loading } from 'element-ui'
import {Message, MessageBox, Notification, Loading} from 'element-ui'
import store from '@/store'
import { getAccessToken, getRefreshToken, getTenantId, setToken } from '@/utils/auth'
import {getAccessToken, getRefreshToken, getTenantId, setToken} from '@/utils/auth'
import errorCode from '@/utils/errorCode'
import { getPath, getTenantEnable } from "@/utils/ruoyi";
import { refreshToken } from "@/api/login";
import {getPath, getTenantEnable} from "@/utils/ruoyi";
import {refreshToken} from "@/api/login";
// 需要忽略的提示。忽略后,自动 Promise.reject('error')
const ignoreMsgs = [
@@ -86,7 +86,7 @@ service.interceptors.request.use(config => {
for (const propName of Object.keys(config.params)) {
const value = config.params[propName];
const part = encodeURIComponent(propName) + '='
if (value !== null && typeof (value) !== "undefined") {
if (value !== null && typeof(value) !== "undefined") {
if (typeof value === 'object') {
for (const key of Object.keys(value)) {
let params = propName + '[' + key + ']';
@@ -104,9 +104,9 @@ service.interceptors.request.use(config => {
}
return config
}, error => {
tryHideFullScreenLoading()
console.log(error)
Promise.reject(error)
tryHideFullScreenLoading()
console.log(error)
Promise.reject(error)
})
// 响应拦截器
@@ -176,38 +176,36 @@ service.interceptors.response.use(async res => {
+ '<div>5 分钟搭建本地环境</div>',
})
return Promise.reject(new Error(msg))
} else if (code === 400) {
//【班组管理】【排班计划】提交的校验按照原型图补充完整,排班计划是否重叠code400 有两个不同的返回信息
return res.data
} else if (code !== 200) {
if (msg === '无效的刷新令牌') { // hard coding忽略这个提示直接登出
console.log(msg)
} else {
//【班组管理】【排班计划】提交的校验按照原型图补充完整,排班计划是否重叠code400 有两个不同的返回信息
return res.data
Notification.error({
title: msg
})
}
return Promise.reject('error')
} else {
return res.data
}
}, error => {
tryHideFullScreenLoading()
console.log('err' + error)
let { message } = error;
if (message === "Network Error") {
message = "后端接口连接异常";
} else if (message.includes("timeout")) {
message = "系统接口请求超时";
} else if (message.includes("Request failed with status code")) {
message = "系统接口" + message.substr(message.length - 3) + "异常";
tryHideFullScreenLoading()
console.log('err' + error)
let {message} = error;
if (message === "Network Error") {
message = "后端接口连接异常";
} else if (message.includes("timeout")) {
message = "系统接口请求超时";
} else if (message.includes("Request failed with status code")) {
message = "系统接口" + message.substr(message.length - 3) + "异常";
}
Message({
message: message,
type: 'error',
duration: 5 * 1000
})
return Promise.reject(error)
}
Message({
message: message,
type: 'error',
duration: 5 * 1000
})
return Promise.reject(error)
}
)
export function getBaseHeader() {
@@ -221,10 +219,10 @@ function handleAuthorized() {
if (!isRelogin.show) {
isRelogin.show = true;
MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', {
confirmButtonText: '重新登录',
cancelButtonText: '取消',
type: 'warning'
}
confirmButtonText: '重新登录',
cancelButtonText: '取消',
type: 'warning'
}
).then(() => {
isRelogin.show = false;
store.dispatch('LogOut').then(() => {

View File

@@ -0,0 +1,125 @@
<template>
<div
:class="className"
:style="{ height: height, width: width, marginLeft: '10px' }" />
</template>
<script>
import * as echarts from 'echarts';
require('echarts/theme/macarons'); // echarts theme
import resize from '@/utils/chartMixins/resize';
const animationDuration = 1000;
export default {
mixins: [resize],
props: {
className: {
type: String,
default: 'chart',
},
title: {
type: String,
default: '',
},
width: {
type: String,
default: '100%',
},
height: {
type: String,
default: '300px',
},
ringData: {
type: Object,
default: () => {},
},
},
data() {
return {
chart: null,
targetId: '',
};
},
beforeDestroy() {
if (!this.chart) {
return;
}
this.chart.dispose();
this.chart = null;
},
methods: {
initChart() {
this.chart = echarts.init(this.$el, 'macarons');
const _this = this;
this.chart.setOption({
title: {
text: this.title
? '{space|}{tip|}{space|}{value|' + this.title + '}'
: '',
textStyle: {
rich: {
tip: {
width: 6,
height: 6,
borderRadius: 50,
backgroundColor: '#288AFF',
},
space: {
width: 8,
},
value: {
fontSize: 14,
color: 'black',
},
},
},
},
color: ['#33B36B', '#3A8DFF', '#F59A23'],
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
crossStyle: {
color: '#999',
},
},
},
legend: {
data: ['当前满位', '当前空位', '在途'],
},
grid: {
containLabel: true,
},
series: [
{
// name: '投入',
type: 'pie',
radius: '50%',
data: [
{
name: '当前满位',
value: this.ringData.occupiedQuantity
},
{
name: '当前空位',
value: this.ringData.idleQuantity
},
{
name: '在途',
value: this.ringData.transitQuantity
},
],
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}
],
});
},
},
};
</script>

View File

@@ -0,0 +1,262 @@
<template>
<div class="app-container">
<el-row class="overview-container">
<el-col :span="4" class="overview-container-left">
<el-row style="font-size: 18px; font-weight: bold; line-height: 36px">库区选择</el-row>
<el-input
v-model="areaSearchForm.regionName"
placeholder="库区名称"
@blur="getArea"
clearable
/>
<el-tree
:data="areaList"
:node-key="'id'"
:props="{label: 'regionName'}"
@node-click="nodeClick"
/>
</el-col>
<el-col :span="16" v-if="changeType === 0" class="overview-container-main">
<el-row>
<el-col :span="8" class="allarea-box" v-for="item in allAreaList" :key="item.id">
<div class="areainfo-box">
<div class="areainfo-box-header">
{{ item.regionName }}
</div>
<div class="areainfo-box-line">
<div class="areainfo-box-line-item" :style="{width: `${(item.occupiedQuantity / (item.totalInventory + item.transitQuantity) * 100).toFixed(2)}%`, backgroundColor: '#33B36B'}"></div>
<div class="areainfo-box-line-item" :style="{width: `${(item.idleQuantity / (item.totalInventory + item.transitQuantity) * 100).toFixed(2)}%`, backgroundColor: '#3A8DFF'}"></div>
<div class="areainfo-box-line-item" :style="{width: `${(item.transitQuantity / (item.totalInventory + item.transitQuantity) * 100).toFixed(2)}%`, backgroundColor: '#F59A23'}"></div>
</div>
<el-row class="areainfo-box-info">
<el-col class="areainfo-box-info-item" :span="6">
<p class="areainfo-box-info-item-count">{{item.totalInventory}}</p>
<p class="areainfo-box-info-item-title">库位总数</p>
</el-col>
<el-col class="areainfo-box-info-item" :span="6">
<p class="areainfo-box-info-item-count" style="color: #33B36B">{{item.occupiedQuantity}}</p>
<p class="areainfo-box-info-item-title"></p>
</el-col>
<el-col class="areainfo-box-info-item" :span="6">
<p class="areainfo-box-info-item-count" style="color: #3A8DFF">{{item.idleQuantity}}</p>
<p class="areainfo-box-info-item-title"></p>
</el-col>
<el-col class="areainfo-box-info-item" :span="6">
<p class="areainfo-box-info-item-count" style="color: #F59A23">{{item.transitQuantity}}</p>
<p class="areainfo-box-info-item-title">在途</p>
</el-col>
</el-row>
</div>
</el-col>
</el-row>
</el-col>
<el-col :span="4" v-if="changeType === 0" class="overview-container-right">
<el-tabs v-model="activeName" @tab-click="handleClickRight">
<el-tab-pane label="概览" name="first">
<el-row class="overview-container-right-alloverview">
<el-col class="overview-container-right-alloverview-item" :span="8">
<p class="overview-container-right-alloverview-item-count">{{allAreaInfo.totalInventory}}</p>
<p class="overview-container-right-alloverview-item-title">库位总数</p>
</el-col>
<el-col class="overview-container-right-alloverview-item" :span="8">
<p class="overview-container-right-alloverview-item-count">{{allAreaInfo.occupiedQuantity}}</p>
<p class="overview-container-right-alloverview-item-title">当前满位</p>
</el-col>
<el-col class="overview-container-right-alloverview-item" :span="8">
<p class="overview-container-right-alloverview-item-count">{{allAreaInfo.idleQuantity}}</p>
<p class="overview-container-right-alloverview-item-title">当前空位</p>
</el-col>
<el-col class="overview-container-right-alloverview-item" :span="8">
<p class="overview-container-right-alloverview-item-count">{{allAreaInfo.transitQuantity}}</p>
<p class="overview-container-right-alloverview-item-title">在途</p>
</el-col>
</el-row>
<ringChart :ring-data="allAreaInfo" ref="ringChart" />
</el-tab-pane>
<el-tab-pane label="在途任务" name="second">在途任务</el-tab-pane>
</el-tabs>
</el-col>
<el-col :span="20" v-if="changeType === 1" class="overview-container-main"></el-col>
</el-row>
</div>
</template>
<script>
// import basicPage from '@/mixins/basic-page';
import ringChart from './components/ringChart.vue';
import { getAreaList, postAllAreaInfo, postAllAreaOverview, postAreaInfo } from '@/api/areavisual/overview';
export default {
name: 'overview',
// mixins: [basicPage],
data() {
return {
areaList: [
{
id: 0,
regionName: "全部库区"
}
],
areaSearchForm: {
pageNo: 1,
pageSize: 100,
regionName: ''
},
changeType: 0,
allAreaList: [],
allAreaInfo: {
totalInventory: 0,
occupiedQuantity: 0,
idleQuantity: 0,
transitQuantity: 0
},
areaInfo: [],
activeName: 'first'
};
},
components: {
ringChart
},
async created() {
this.getArea()
this.getAllAreaInfo()
this.getAllAreaOverview()
},
watch: {
activeName: (val) => {
if (val === 'first') {
this.getAllAreaOverview()
} else if (val === 'second') {
this.getNowTaskList()
}
}
},
methods: {
// 获取库区列表
async getArea() {
const res = await getAreaList(this.areaSearchForm)
if (res.code === 0 && res.data) {
this.areaList = [
{
id: 0,
regionName: "全部库区"
}
],
this.areaList.push(...(res.data.list))
}
},
// 库区选择
nodeClick(data, node, components) {
if (data.id === 0) {
this.changeType = 0
this.activeName = 'first'
this.getAllAreaInfo()
} else {
this.changeType = 1
this.getAreaInfo(data.id)
}
},
// 获取全部库区概览信息
async getAllAreaInfo() {
const res = await postAllAreaInfo([])
console.log(res)
if (res.code === 0 && res.data) {
this.allAreaList = res.data
}
},
// 获取库区概览
async getAllAreaOverview() {
const res = await postAllAreaOverview([])
console.log(res)
if (res.code === 0 && res.data) {
this.allAreaInfo = res.data
this.$refs.ringChart.initChart();
}
},
// 获取在途任务
async getNowTaskList() {},
// 获取单库区信息
async getAreaInfo (id) {
const res = await postAreaInfo({id})
console.log(res)
if (res.code === 0 && res.data) {
this.areaInfo = res.data
}
},
// 全部库区右侧分页点击
handleClickRight (tab, event) {
console.log(tab, event)
}
},
};
</script>
<style lang="scss" scoped>
.overview-container {
max-height: calc(100vh - 120px - 8px);
overflow: scroll;
.overview-container-left {
padding-right: 12px;
}
.overview-container-main {
.allarea-box {
padding: 10px;
.areainfo-box {
border: 1px solid #bbb;
border-radius: 5px;
padding: 10px;
.areainfo-box-header {
font-size: 16px;
font-weight: bold;
white-space: nowrap; /* 禁止换行 */
overflow: hidden; /* 隐藏溢出内容 */
text-overflow: ellipsis; /* 溢出部分显示省略号 */
}
.areainfo-box-line {
width: 100%;
.areainfo-box-line-item {
height: 5px;
display: inline-block;
}
}
.areainfo-box-info {
.areainfo-box-info-item {
text-align: center;
font-size: 12px;
.areainfo-box-info-item-count {
font-weight: bold;
font-size: 14px;
}
}
}
}
}
}
.overview-container-right {
.overview-container-right-alloverview {
.overview-container-right-alloverview-item {
text-align: center;
.overview-container-right-alloverview-item-count {
font-size: 14px;
font-weight: bold;
}
}
}
}
}
</style>
<style lang="scss">
.el-tree-node__content {
height: 40px;
line-height: 40px;
}
.el-tree-node__label {
display: block;
width: calc(100% - 24px);
text-align: center;
white-space: nowrap; /* 禁止换行 */
overflow: hidden; /* 隐藏溢出内容 */
text-overflow: ellipsis; /* 溢出部分显示省略号 */
}
</style>

View File

@@ -0,0 +1,519 @@
<!--
filename: EquipmentDrawer.vue
author: liubin
date: 2023-08-22 14:38:56
description:
-->
<template>
<el-drawer
:visible="visible"
:show-close="false"
:wrapper-closable="false"
class="drawer"
custom-class="mes-drawer"
size="60%"
@closed="$emit('destroy')">
<SmallTitle slot="title">
{{
mode.includes('detail')
? '详情'
: mode.includes('edit')
? '编辑'
: '新增'
}}
</SmallTitle>
<div class="drawer-body flex">
<div class="drawer-body__content">
<section v-for="(section, index) in sections" :key="section.key">
<SmallTitle v-if="index != 0">{{ section.name }}</SmallTitle>
<div
class="form-part"
v-if="section.key == 'base'"
style="margin-bottom: 32px">
<el-skeleton v-if="!showForm" animated />
<!-- <EquipmentInfoForm
key="drawer-dialog-form"
v-if="showForm"
:disabled="mode.includes('detail')"
:sync-filelist="syncFileListFlag"
v-model="form" /> -->
</div>
<div v-if="section.key == 'attrs'" style="margin-top: 12px">
<base-table
v-loading="attrListLoading"
:table-props="section.props"
:page="attrQuery?.params.pageNo || 1"
:limit="attrQuery?.params.pageSize || 10"
:table-data="list"
:add-button-show="mode.includes('detail') ? null : '添加属性'"
@emitButtonClick="handleAddAttr"
@emitFun="handleEmitFun">
<method-btn
v-if="section.tableBtn"
slot="handleBtn"
label="操作"
:method-list="tableBtn"
@clickBtn="handleTableBtnClick" />
</base-table>
<!-- 分页组件 -->
<pagination
v-show="total > 0"
:total="total"
:page.sync="attrQuery.params.pageNo"
:limit.sync="attrQuery.params.pageSize"
@pagination="getAttrList" />
</div>
</section>
</div>
<div class="drawer-body__footer">
<el-button style="" @click="handleCancel">取消</el-button>
<el-button v-if="mode == 'detail'" type="primary" @click="toggleEdit">
编辑
</el-button>
<el-button v-else type="primary" @click="handleConfirm">确定</el-button>
<!-- sections的第二项必须是 属性列表 -->
<!-- <el-button
v-if="sections[1].allowAdd"
type="primary"
@click="handleAddAttr">
添加属性
</el-button> -->
</div>
</div>
</el-drawer>
</template>
<script>
const SmallTitle = {
name: 'SmallTitle',
props: ['size'],
components: {},
data() {
return {};
},
methods: {},
render: function (h) {
return h(
'span',
{
class: 'small-title',
style: {
fontSize: '18px',
lineHeight:
this.size == 'lg' ? '24px' : this.size == 'sm' ? '18px' : '20px',
fontWeight: 500,
fontFamily: '微软雅黑, Microsoft YaHei, Arial, Helvetica, sans-serif',
},
},
this.$slots.default
);
},
};
export default {
components: { SmallTitle },
props: ['sections', 'mode', 'dataId'], // dataId 作为一个通用的存放id的字段
data() {
return {
visible: false,
showForm: false,
btnLoading: false,
total: 0,
form: {},
list: [],
attrTitle: '',
attrForm: {
id: null,
equipmentId: null,
name: '',
value: '',
},
attrFormVisible: false,
attrRows: [
[
{
input: true,
label: '属性名称',
prop: 'name',
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
},
],
[
{
input: true,
label: '属性值',
prop: 'value',
},
],
],
attrQuery: {
params: {
pageNo: 1,
pageSize: 10,
},
}, // 属性列表的请求
infoQuery: null, // 基本信息的请求
attrFormSubmitting: false,
attrListLoading: false,
syncFileListFlag: null,
};
},
computed: {
formRows() {
return this.sections[0].rows.map((row) => {
return row.map((col) => {
if (col.key == 'eq-pics') {
// 重置图片的位置
return {
...col,
bind: {
...col.bind,
},
style: {
left: 0,
right: 'unset',
},
};
}
return {
...col,
bind: {
...col.bind,
// 详情 模式下,禁用各种输入
disabled: this.mode == 'detail',
},
};
});
});
},
tableBtn() {
return this.mode == 'detail' ? [] : this.sections[1].tableBtn;
},
},
mounted() {
for (const section of this.sections) {
// 请求具体信息
if ('url' in section) {
const query = {
url: section.url,
method: section.method || 'get',
params: section.queryParams || null,
data: section.data || null,
};
this.$axios(query).then(({ data }) => {
if (section.key == 'base') {
this.form = data;
// this.form = {
// code: 'gj',
// name: '下片机',
// enName: 'unload',
// abbr: '',
// equipmentTypeId: 21084,
// remark: '备注',
// id: '1712367395052384257',
// createTime: 1697095176000,
// enterTime: 0,
// productionTime: 0,
// files: [
// {
// fileName: '测试.xlsx',
// fileUrl: 'https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2022%2F0108%2F0f0c6f30j00r5cle9000sc000hs00gtc.jpg&thumbnail=660x2147483647&quality=80&type=jpg',
// fileType: 1
// },
// {
// fileName: '测试2.xlsx',
// fileUrl: 'https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2022%2F0415%2F2cd23619j00racb96000kc000hs00hsc.jpg&thumbnail=660x2147483647&quality=80&type=jpg',
// fileType: 1
// },
// {
// fileName: '测试3.xlsx',
// fileUrl: 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fsafe-img.xhscdn.com%2Fbw1%2F1fea91a0-d088-409e-b145-e0e61254b28b%3FimageView2%2F2%2Fw%2F1080%2Fformat%2Fjpg&refer=http%3A%2F%2Fsafe-img.xhscdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1700031689&t=2e0fe7d1de7f54adff3007efe133d67c',
// fileType: 1
// },
// {
// fileName: '测试4.xlsx',
// fileUrl: 'https://pics5.baidu.com/feed/b7003af33a87e950cdfb4b4546eed044faf2b40d.jpeg?token=1d7484cfe4b014dd201f8c8725cab945',
// fileType: 2
// },
// {
// fileName: '测试5.xlsx',
// fileUrl: 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fsafe-img.xhscdn.com%2Fbw1%2Fe3500876-9c46-4b70-8d37-4799520cdd13%3FimageView2%2F2%2Fw%2F1080%2Fformat%2Fjpg&refer=http%3A%2F%2Fsafe-img.xhscdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1700031689&t=4abc1df930e62730e5361a7d3765e0f2',
// fileType: 2
// },
// ],
// tvalue: 0,
// processingTime: 0,
// manufacturer: '',
// spec: '',
// description: '描述',
// };
this.showForm = true;
this.infoQuery = query;
} else if (section.key == 'attrs') {
this.attrQuery = query;
this.list = data.list;
this.total = data.total;
}
});
}
}
},
methods: {
handleTableBtnClick({ type, data }) {
switch (type) {
case 'edit':
this.handleEditAttr(data.id);
break;
case 'delete':
this.handleDeleteAttr(data.id);
break;
}
},
async handleConfirm() {
this.btnLoading = true;
this.syncFileListFlag = Math.random();
this.$nextTick(async () => {
const { code, data } = await this.$axios({
url: this.sections[0].urlUpdate,
method: 'put',
data: this.form,
});
if (code == 0) {
this.$modal.msgSuccess('更新成功');
this.$emit('refreshDataList');
}
this.btnLoading = false;
this.handleCancel();
});
},
handleEmitFun(val) {
console.log('handleEmitFun', val);
},
init() {
this.visible = true;
},
async getAttrList() {
this.attrListLoading = true;
const res = await this.$axios(this.attrQuery);
if (res.code == 0) {
this.list = res.data.list;
this.total = res.data.total;
}
this.attrListLoading = false;
},
// 保存表单
handleSave() {
this.$refs['form'][0].validate(async (valid) => {
if (valid) {
const isEdit = this.mode == 'edit';
await this.$axios({
url: this.sections[0][isEdit ? 'urlUpdate' : 'urlCreate'],
method: isEdit ? 'put' : 'post',
data: this.form,
});
this.$modal.msgSuccess(`${isEdit ? '更新' : '创建'}成功`);
this.visible = false;
this.$emit('refreshDataList');
}
});
},
handleCancel() {
this.visible = false;
},
// 开启编辑
toggleEdit() {
this.$emit('update-mode', 'edit');
},
// 新增属性
handleAddAttr() {
if (!this.dataId) return this.$message.warning('请先创建设备信息');
this.attrForm = {
id: null,
equipmentId: this.dataId,
name: '',
value: '',
};
this.attrTitle = '添加设备属性';
this.attrFormVisible = true;
},
// 编辑属性
async handleEditAttr(attrId) {
const res = await this.$axios({
url: this.sections[1].urlDetail,
method: 'get',
params: { id: attrId },
});
if (res.code == 0) {
this.attrForm = res.data;
this.attrTitle = '编辑设备属性';
this.attrFormVisible = true;
}
},
// 删除属性
handleDeleteAttr(attrId) {
this.$confirm('确定删除该属性?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(async () => {
const res = await this.$axios({
url: this.sections[1].urlDelete,
method: 'delete',
params: { id: attrId },
});
if (res.code == 0) {
this.$message({
message: '删除成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getAttrList();
},
});
}
})
.catch(() => {});
},
// 提交属性表
submitAttrForm() {
this.$refs['attrForm'].validate(async (valid) => {
if (!valid) {
return;
}
try {
const isEdit = this.attrForm.id != null;
this.attrFormSubmitting = true;
const res = await this.$axios({
url: isEdit
? this.sections[1].urlUpdate
: this.sections[1].urlCreate,
method: isEdit ? 'put' : 'post',
data: this.attrForm,
});
if (res.code == 0) {
this.closeAttrForm();
this.$message({
message: `${isEdit ? '更新' : '创建'}成功`,
type: 'success',
duration: 1500,
onClose: () => {
this.getAttrList();
},
});
}
this.attrFormSubmitting = false;
} catch (err) {
this.$message({
message: err,
type: 'error',
duration: 1500,
});
this.attrFormSubmitting = false;
}
});
},
closeAttrForm() {
this.attrFormVisible = false;
},
handleClick(raw) {
if (raw.type === 'delete') {
this.$confirm(
`确定对${
raw.data.name
? '[名称=' + raw.data.name + ']'
: '[序号=' + raw.data._pageIndex + ']'
}进行删除操作?`,
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(() => {
deleteProductAttr(raw.data.id).then(({ data }) => {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getList();
},
});
});
})
.catch(() => {});
} else {
this.addNew(raw.data.id);
}
},
},
};
</script>
<style scoped>
.drawer >>> .el-drawer {
border-radius: 8px 0 0 8px;
}
.drawer >>> .el-drawer__header {
margin: 0;
padding: 32px 32px 24px;
border-bottom: 1px solid #dcdfe6;
margin-bottom: 0px;
}
.small-title::before {
content: '';
display: inline-block;
vertical-align: top;
width: 4px;
height: 22px;
border-radius: 1px;
margin-right: 8px;
background-color: #0b58ff;
}
.drawer-body {
display: flex;
flex-direction: column;
height: 100%;
}
.drawer-body__content {
flex: 1;
/* background: #eee; */
padding: 20px 30px;
overflow-y: auto;
}
.drawer-body__footer {
display: flex;
justify-content: flex-end;
padding: 18px;
}
</style>

View File

@@ -0,0 +1,277 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<SearchBar
:formConfigs="searchBarFormConfig"
ref="search-bar"
isFold
@headBtnClick="handleSearchBarBtnClick" />
<!-- 列表 -->
<base-table
:table-props="tableProps"
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-data="list"
@emitFun="handleEmitFun">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="120"
label="操作"
:method-list="tableBtn"
@clickBtn="handleTableBtnClick" />
</base-table>
<!-- 分页组件 -->
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
@pagination="getList" />
<!-- 设备 详情 - 编辑 -->
<RecordDrawer
v-if="open"
ref="drawer"
:mode="editMode"
@update-mode="editMode = $event"
:data-id="form.id"
@refreshDataList="getList"
@cancel="cancelEdit"
@destroy="cancelEdit" />
</div>
</template>
<script>
import moment from 'moment';
import basicPageMixin from '@/mixins/lb/basicPageMixin';
import RecordDrawer from './components/RecordDrawer';
import { getRecordPage, getLaneList } from '@/api/areavisual/record';
export default {
name: 'Equipment',
components: {
RecordDrawer,
},
mixins: [basicPageMixin],
data() {
return {
searchBarKeys: ['name', 'code'],
// this.$auth.hasPermi(`base:equipment:update`)
tableBtn: [
{
type: 'detail',
btnName: '详情'
}
].filter((v) => v),
tableProps: [
{
prop: 'recordCode',
label: '出/入库单编号',
fixed: true,
width: 180,
// filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
// showOverflowtooltip: true,
},
{
prop: 'type',
label: '业务类型',
filter: (val) => val === 1 ? '出库' : '入库',
},
{
width: 180,
prop: 'recordTime',
label: '出/入库时间',
filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss')
},
{ prop: 'recordArea', label: '出/入库库区' },
{ prop: 'recordLane', label: '出/入库巷道' },
{ prop: 'recordRegion', label: '出/入库库位号' },
{ prop: 'target', label: '搬运对象' },
{ prop: 'productName', label: '产品名称' },
{ prop: 'specification', label: '型号规格' },
{ prop: 'recordMan', label: '出/入库人' },
{ prop: 'remark', label: '备注' }
],
searchBarFormConfig: [
{
type: 'input',
label: '关键字',
placeholder: '请输入出/入库编码、产品名称、规格型号、库位号',
param: 'query',
width: 350
},
{
type: 'select',
label: '业务类型',
selectOptions: [
{
id: '1',
name:'出库'
},
{
id: '2',
name:'入库'
},
],
placeholder: '请选择业务类型',
param: 'type',
},
{
type: 'select',
label: '出/入库巷道',
selectOptions: [],
placeholder: '请选择出/入库巷道',
param: 'recordLane',
},
{
type: 'select',
label: '来源',
selectOptions: [
{
id: '1',
name:'WMS'
},
{
id: '2',
name:'MES'
},
],
placeholder: '请选择来源',
param: 'source',
},
{
type: 'select',
label: '出/入库人',
selectOptions: [],
placeholder: '请选择出/入库人',
param: 'recordMan',
},
{
type: 'datePicker',
label: '出/入库时间',
placeholder: '请选择出/入库时间',
param: 'recordTime',
dateType: 'datetimerange',
rangeSeparator: '至'
},
{
type: 'select',
label: '载具类型',
selectOptions: [
{
id: '1',
name:'AGV'
},
{
id: '2',
name:'人工叉车'
},
],
placeholder: '请选择载具类型',
param: 'vehicleType',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'button',
btnName: '重置',
name: 'reset',
color: 'info',
}
],
editVisible: false,
editMode: 'detail', // 'edit', 'detail'
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNo: 1,
pageSize: 20,
query: '',
type: '',
source: '',
recordLane: '',
recordMan: '',
recordTime: '',
vehicleType: ''
},
form: {}
};
},
created() {
this.getLane()
this.getList();
},
computed: {},
methods: {
/** 查询列表 */
getList() {
this.loading = true;
// 执行查询
getRecordPage(this.queryParams).then((response) => {
console.log(response)
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
});
},
async getLane() {
const res = await getLaneList({
pageNo: 1,
pageSize: 100
})
if (res.code === 0 && res.data) {
console.log(res.data)
this.searchBarFormConfig[2].selectOptions = res.data.list.map(item => {
return { id: item.id, name: item.lane }
})
console.log(this.searchBarFormConfig)
}
},
/** 取消按钮 */
cancel() {
this.open = false;
},
// /** 导出按钮操作 */
// handleExport() {
// // 处理查询参数
// let params = { ...this.queryParams };
// params.pageNo = undefined;
// params.pageSize = undefined;
// this.$modal
// .confirm('是否确认导出所有设备数据项?')
// .then(() => {
// this.exportLoading = true;
// return exportEquipmentExcel(params);
// })
// .then((response) => {
// this.$download.excel(response, '设备.xls');
// this.exportLoading = false;
// })
// .catch(() => {});
// },
handleTableBtnClick ({data, type}) {
switch (type) {
case 'detail':
this.viewDetail(data.id)
}
},
// 查看详情
viewDetail(id) {
this.editMode = 'detail';
this.open = true;
this.form.id = id;
this.$nextTick(() => {
this.$refs['drawer'].init();
});
},
},
};
</script>

View File

@@ -6,27 +6,35 @@
-->
<template>
<el-drawer :visible="visible" :show-close="false" :wrapper-closable="false" class="drawer" custom-class="mes-drawer"
:size="size || '50%'" @closed="$emit('destroy')">
<SmallTitle slot="title">
{{
mode.includes('detail')
? '详情'
: mode.includes('edit')
? '编辑'
: '新增'
}}
</SmallTitle>
<el-drawer
:visible="visible"
:show-close="false"
:wrapper-closable="false"
class="drawer"
custom-class="mes-drawer"
:size="size || '50%'"
@closed="$emit('destroy')">
<SmallTitle slot="title">
{{
mode.includes('detail')
? '详情'
: mode.includes('edit')
? '编辑'
: '新增'
}}
</SmallTitle>
<div class="drawer-body flex">
<div class="drawer-body__content">
<section v-for="(section, index) in sections" :key="section.key">
<SmallTitle v-if="index != 0">{{ section.name }}</SmallTitle>
<div class="drawer-body flex">
<div class="drawer-body__content">
<section v-for="(section, index) in sections" :key="section.key">
<SmallTitle v-if="index != 0">{{ section.name }}</SmallTitle>
<div class="form-part" v-if="section.key == 'base'"
style="border-bottom: 1px solid #dfdfdf; margin-bottom: 24px">
<el-skeleton v-if="!showForm" animated />
<!-- <BaseInfoForm
<div
class="form-part"
v-if="section.key == 'base'"
style="border-bottom: 1px solid #dfdfdf; margin-bottom: 24px">
<el-skeleton v-if="!showForm" animated />
<!-- <BaseInfoForm
key="drawer-dialog-form"
v-if="showForm"
ref="form"
@@ -34,87 +42,141 @@
v-model="form"
:rows="formRows" /> -->
<!-- if -->
<el-row v-if="mode.includes('detail')" style="margin-bottom: 24px">
<el-col :span="8">
<div class="title" style="font-weight: 700; font-size: 16px; margin: 8px 0">
设备名
</div>
<div class="value" style="font-size: 14px">
{{ form.equipmentName }}
</div>
</el-col>
<el-col :span="8">
<div class="title" style="font-weight: 700; font-size: 16px; margin: 8px 0">
关联表名
</div>
<div class="value" style="font-size: 14px">
{{ form.plcName }}
</div>
</el-col>
</el-row>
<!-- else -->
<el-row v-else style="margin-bottom: 24px" :gutter="20">
<el-form ref="form" :model="form">
<el-col :span="8">
<el-form-item class="title" label="设备名" style="font-size: 16px; margin: 8px 0">
<el-select v-model="form.equipmentId" filterable clearable placeholder="请选择设备">
<el-option v-for="eq in eqList" :key="eq.id" :label="eq.name" :value="eq.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item class="title" label="设备关联表名" style="font-size: 16px; margin: 8px 0">
<el-select v-model="form.plcId" filterable clearable placeholder="请选择关联表">
<el-option v-for="plc in plcList" :key="plc.id" :label="plc.plcTableName"
:value="plc.id"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-form>
</el-row>
</div>
<!-- if -->
<el-row v-if="mode.includes('detail')" style="margin-bottom: 24px">
<el-col :span="8">
<div
class="title"
style="font-weight: 700; font-size: 16px; margin: 8px 0">
设备名
</div>
<div class="value" style="font-size: 14px">
{{ form.equipmentName }}
</div>
</el-col>
<el-col :span="8">
<div
class="title"
style="font-weight: 700; font-size: 16px; margin: 8px 0">
关联表名
</div>
<div class="value" style="font-size: 14px">
{{ form.plcName }}
</div>
</el-col>
</el-row>
<!-- else -->
<el-row v-else style="margin-bottom: 24px" :gutter="20">
<el-form ref="form" :model="form">
<el-col :span="8">
<el-form-item
class="title"
label="设备名"
style="font-size: 16px; margin: 8px 0">
<el-select
v-model="form.equipmentId"
filterable
clearable
placeholder="请选择设备">
<el-option
v-for="eq in eqList"
:key="eq.id"
:label="eq.name"
:value="eq.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item
class="title"
label="设备关联表名"
style="font-size: 16px; margin: 8px 0">
<el-select
v-model="form.plcId"
filterable
clearable
placeholder="请选择关联表">
<el-option
v-for="plc in plcList"
:key="plc.id"
:label="plc.plcTableName"
:value="plc.id"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-form>
</el-row>
</div>
<div v-if="section.key == 'attrs'" style="position: relative; margin-top: 12px">
<div v-if="!mode.includes('detail')" style="position: absolute; top: -40px; right: 0">
<el-button @click="handleAddAttr" type="text">
<i class="el-icon-plus"></i>
添加参数
</el-button>
</div>
<base-table v-loading="attrListLoading" :table-props="section.props" :page="attrQuery?.params.pageNo || 1"
:limit="attrQuery?.params.pageSize || 10" :table-data="list" @emitFun="handleEmitFun">
<!-- :add-button-show="mode.includes('detail') ? null : '添加属性'"
<div
v-if="section.key == 'attrs'"
style="position: relative; margin-top: 12px">
<div
v-if="!mode.includes('detail')"
style="position: absolute; top: -40px; right: 0">
<el-button @click="handleAddAttr" type="text">
<i class="el-icon-plus"></i>
添加参数
</el-button>
</div>
<base-table
v-loading="attrListLoading"
:table-props="section.props"
:page="attrQuery?.params.pageNo || 1"
:limit="attrQuery?.params.pageSize || 10"
:table-data="list"
@emitFun="handleEmitFun">
<!-- :add-button-show="mode.includes('detail') ? null : '添加属性'"
@emitButtonClick="handleAddAttr" -->
<method-btn v-if="section.tableBtn && !mode.includes('detail')" slot="handleBtn" label="操作"
:method-list="tableBtn" @clickBtn="handleTableBtnClick" />
</base-table>
<method-btn
v-if="section.tableBtn && !mode.includes('detail')"
slot="handleBtn"
label="操作"
:method-list="tableBtn"
@clickBtn="handleTableBtnClick" />
</base-table>
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="attrQuery.params.pageNo"
:limit.sync="attrQuery.params.pageSize" @pagination="getAttrList" />
</div>
</section>
</div>
<!-- 分页组件 -->
<pagination
v-show="total > 0"
:total="total"
:page.sync="attrQuery.params.pageNo"
:limit.sync="attrQuery.params.pageSize"
@pagination="getAttrList" />
</div>
</section>
</div>
<div class="drawer-body__footer">
<el-button style="" @click="handleCancel">取消</el-button>
<el-button type="primary" v-if="!mode.includes('detail')" @click="handleSave">
保存
</el-button>
</div>
</div>
<div class="drawer-body__footer">
<el-button style="" @click="handleCancel">取消</el-button>
<el-button
type="primary"
v-if="!mode.includes('detail')"
@click="handleSave">
保存
</el-button>
</div>
</div>
<!-- 属性对话框 -->
<base-dialog v-if="sections[1].allowAdd" :dialogTitle="attrTitle" :dialogVisible="attrFormVisible" width="45%"
:append-to-body="true" custom-class="baseDialog" @close="closeAttrForm" @cancel="closeAttrForm"
@confirm="submitAttrForm">
<!-- :disabled="mode.includes('detail')" -->
<DialogForm v-if="attrFormVisible" ref="attrForm" v-model="attrForm" :data-form="attrForm"
:rows="attrRows"
@update="handleAttrFormUpdate"/>
</base-dialog>
</el-drawer>
<!-- 属性对话框 -->
<base-dialog
v-if="sections[1].allowAdd"
:dialogTitle="attrTitle"
:dialogVisible="attrFormVisible"
width="45%"
:append-to-body="true"
custom-class="baseDialog"
@close="closeAttrForm"
@cancel="closeAttrForm"
@confirm="submitAttrForm">
<!-- :disabled="mode.includes('detail')" -->
<DialogForm
v-if="attrFormVisible"
ref="attrForm"
v-model="attrForm"
:rows="attrRows" />
</base-dialog>
</el-drawer>
</template>
<script>
@@ -170,9 +232,7 @@ export default {
defaultValue: '',
description: '',
remark: '',
alarmContent: '',
displayTip: false,
alarmTip: false,
alarmContent: '',
},
attrFormVisible: false,
attrRows: [
@@ -282,27 +342,7 @@ export default {
},
],
},
],
[
{
switch: true,
label: '是否展示',
prop: 'displayTip',
bind: {
'active-value': true,
'inactive-value': false,
},
},
{
switch: true,
label: '超出阈值是否报警',
prop: 'alarmTip',
bind: {
'active-value': true,
'inactive-value': false,
},
},
],
],
[
{
input: true,
@@ -396,24 +436,7 @@ export default {
}
}
},
methods: {
handleAttrFormUpdate(updatedForm) {
console.log('updatedForm', updatedForm);
// 只同步需要的字段,避免覆盖其他数据
this.attrForm = {
...this.attrForm,
...updatedForm,
// 确保开关值是布尔类型(双重保险)
displayTip: Boolean(updatedForm.displayTip),
alarmTip: Boolean(updatedForm.alarmTip),
collection: Number(updatedForm.collection) // 采集开关保持数字类型
};
console.log('开关值同步:', {
displayTip: this.attrForm.displayTip,
alarmTip: this.attrForm.alarmTip
});
},
methods: {
handleTableBtnClick({ type, data }) {
switch (type) {
case 'edit':
@@ -479,8 +502,7 @@ export default {
name: '',
plcParamName: '',
unit: '',
collection: 1,
collection: 1,
minValue: '',
maxValue: '',
defaultValue: '',
@@ -488,9 +510,7 @@ export default {
remark: '',
equipmentParamType: '',
productionParamType: '',
alarmContent: '',
displayTip: false,
alarmTip: false,
alarmContent: '',
};
this.attrTitle = '添加参数绑定信息';
this.attrFormVisible = true;
@@ -503,15 +523,8 @@ export default {
method: 'get',
params: { id: attrId },
});
if (res.code == 0) {
console.log('res.data', res.data);
this.attrForm = {
...res.data,
// // 强制转为数字类型,避免字符串类型导致绑定失败
// displayTip: Number(res.data.displayTip) || 0,
// alarmTip: Number(res.data.alarmTip) || 0
};
if (res.code == 0) {
this.attrForm = res.data;
this.attrTitle = '编辑参数绑定信息';
this.attrFormVisible = true;
}
@@ -550,8 +563,7 @@ export default {
this.$refs['attrForm'].validate(async (valid) => {
if (!valid) {
return;
}
console.log('this.attrForm', this.attrForm);
}
const isEdit = this.attrForm.id != null;
this.attrFormSubmitting = true;
@@ -571,9 +583,8 @@ export default {
type: 'success',
duration: 1500,
onClose: () => {
this.shouldRefreshPageView = true;
this.getAttrList();
this.getAttrList();
this.shouldRefreshPageView = true;
},
});
}

View File

@@ -103,7 +103,7 @@ export default {
id: null,
code: '',
materialId: '',
price: undefined,
price: '',
startTime: new Date().getTime(),
endTime: null,
remark: '',

View File

@@ -47,15 +47,15 @@ const tableProps = [
prop: 'equipmentName',
label: '设备',
},
// {
// prop: 'size',
// label: '规格',
// showOverflowtooltip: true,
// },
// {
// prop: 'process',
// label: '产品工艺',
// },
{
prop: 'size',
label: '规格',
showOverflowtooltip: true,
},
{
prop: 'process',
label: '产品工艺',
},
{
prop: 'standardCt',
label: '标准节拍pcs/min',

View File

@@ -72,6 +72,16 @@ export default {
dateLabelList: [],
optionArrUrl: [getProductionLinePage],
formConfig: [
{
type: 'select',
label: '产线',
selectOptions: [],
param: 'lineIds',
defaultSelect: [],
multiple: true,
filterable: true,
width: 200,
},
{
type: 'datePicker',
label: '时间',
@@ -82,17 +92,7 @@ export default {
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'time',
},
{
type: 'select',
label: '产线',
selectOptions: [],
param: 'lineIds',
defaultSelect: [],
multiple: true,
filterable: true,
width: 300,
},
},
{
type: 'button',
btnName: '查询',
@@ -113,7 +113,7 @@ export default {
};
this.optionArrUrl.forEach((item, index) => {
item(params).then((response) => {
this.formConfig[1].selectOptions = response.data.list;
this.formConfig[index].selectOptions = response.data.list;
// this.formConfig[0].defaultSelect = response.data.list[0].id
// this.$set(this.formConfig[0], 'defaultSelect', response.data.list[0].id)
});

View File

@@ -279,8 +279,7 @@ export default {
filterable: true,
clearable: true,
},
},
},
// {
// select: true,
// label: '设备分组',

View File

@@ -92,7 +92,7 @@ export default {
filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
},
{ prop: 'name', label: '设备类型名称' },
{ prop: 'code', label: '设备类型编码' },
{ prop: 'code', label: '检测类型编码' },
{ prop: 'remark', label: '备注' },
],
searchBarFormConfig: [

View File

@@ -66,16 +66,16 @@
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="完成单位产品用时(S)" prop="processTime">
<el-input :disabled="isdetail" v-model="dataForm.processTime" placeholder="请输入完成单位产品用时(S)" />
<el-form-item label="完成单位产品用时" prop="processTime">
<el-input :disabled="isdetail" v-model="dataForm.processTime" placeholder="请输入完成单位产品用时" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label=" 产品工艺" prop="processTypes">
<el-select :disabled="isdetail" collapse-tags multiple v-model="dataForm.processTypes" clearable
style="width: 100%" placeholder="请选择产品工艺">
<el-option v-for="dict in processTypeList" :key="dict.value" :label="dict.label"
:value="dict.value" />
<el-form-item label=" 加工属性" prop="processType">
<el-select v-model="dataForm.processType" clearable style="width: 100%" :disabled="isdetail"
placeholder="请选择加工属性">
<el-option v-for="dict in processTypeList" :key="dict.id" :label="dict.label"
:value="dict.id" />
</el-select>
</el-form-item>
</el-col>
@@ -191,7 +191,7 @@ export default {
unitDictValue: '', // 单位id
originalSpecifications: '', // 原片规格
originalArea: 0, // 原片单位平方数
processTypes: [],
processType:undefined,
},
listQuery: {
pageSize: 10,
@@ -200,18 +200,18 @@ export default {
},
processTypeList: [
{
value: '1',
id: '0',
label:'压花丝印'
},
{
value: '2',
id: '1',
label: '无印打孔'
},
{
value: '3',
id: '2',
label: '单层镀膜'
}, {
value: '4',
id: '3',
label: '双层镀膜'
}
],
@@ -276,8 +276,7 @@ export default {
init(id, isdetail) {
this.initData();
this.isdetail = isdetail || false;
this.dataForm.id = id || null;
// this.dataForm.processTypes = [] // 清空工艺选择
this.dataForm.id = id || null;
this.visible = true;
this.$nextTick(() => {
@@ -285,26 +284,9 @@ export default {
if (this.dataForm.id) {
// 获取产品详情
getProduct(id).then((res) => {
const resData = res.data || {};
// 逐个字段赋值(保留响应式)
this.dataForm.name = resData.name || '';
this.dataForm.code = resData.code || '';
this.dataForm.area = resData.area || 0;
this.dataForm.typeDictValue = resData.typeDictValue || null;
this.dataForm.processTime = resData.processTime || null;
this.dataForm.specifications = resData.specifications || '';
this.dataForm.unitDictValue = resData.unitDictValue || '';
this.dataForm.originalSpecifications = resData.originalSpecifications || '';
this.dataForm.originalArea = resData.originalArea || 0;
// 处理工艺列表:确保是数组,过滤空值
this.dataForm.processTypes = resData.processType
? resData.processType.split(',').filter(Boolean)
: [];
console.log('工艺列表(编辑时):', this.dataForm.processTypes); // 验证是否为 ["1","2"] 格式
});
getProduct(id).then((response) => {
this.dataForm = response.data;
});
// 获取产品的属性列表
this.getList();
} else {
@@ -360,7 +342,7 @@ export default {
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
if (valid) {
// 修改的提交
if (this.dataForm.id) {
updateProduct(this.dataForm).then((response) => {

View File

@@ -1,142 +1,139 @@
<template>
<el-dialog v-loading="isLoading" loading-text="处理中..." loading-spinner="el-icon-loading"
loading-background="rgba(255, 255, 255, 0.7)" :visible.sync="visible" :width="'35%'" :append-to-body="true"
:close-on-click-modal="false" class="dialog">
<template #title>
<slot name="title">
<div class="titleStyle">
{{ !dataForm.id ? '新增' : '编辑' }}
</div>
</slot>
</template>
<el-dialog
:visible.sync="visible"
:width="'35%'"
:append-to-body="true"
:close-on-click-modal="false"
class="dialog">
<template #title>
<slot name="title">
<div class="titleStyle">
{{ !dataForm.id ? '新增' : '编辑' }}
</div>
</slot>
</template>
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="100px"
@keyup.enter.native="dataFormSubmit()">
<el-form-item label="属性名" prop="name">
<el-input v-model="dataForm.name" placeholder="请输入属性名" clearable />
</el-form-item>
<el-form-item label="属性值" prop="value">
<el-input v-model="dataForm.value" placeholder="请输入属性" clearable />
</el-form-item>
</el-form>
<el-form
ref="dataForm"
:model="dataForm"
:rules="dataRule"
label-width="100px"
@keyup.enter.native="dataFormSubmit()">
<el-form-item label="属性" prop="name">
<el-input
v-model="dataForm.name"
placeholder="请输入属性名"
clearable />
</el-form-item>
<el-form-item label="属性值" prop="value">
<el-input
v-model="dataForm.value"
placeholder="请输入属性值"
clearable />
</el-form-item>
</el-form>
<el-row style="text-align: right">
<el-button @click="visible = false">取消</el-button>
<el-button :loading="isLoading" type="primary" @click="dataFormSubmit()">确定</el-button>
</el-row>
</el-dialog>
<el-row style="text-align: right">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</el-row>
</el-dialog>
</template>
<script>
import {
createProductAttr,
updateProductAttr,
getProductAttr,
createProductAttr,
updateProductAttr,
getProductAttr,
} from '@/api/core/base/productAttr';
export default {
props: {
productId: {
type: String,
default: '',
},
},
data() {
return {
visible: false,
isLoading: false,
dataForm: {
id: 0,
name: '',
value: '',
},
dataRule: {
name: [{ required: true, message: '名称不能为空', trigger: 'blur' }],
},
};
},
methods: {
init(id) {
this.dataForm.id = id || '';
this.visible = true;
this.$nextTick(() => {
this.$refs['dataForm'].resetFields();
if (this.dataForm.id) {
getProductAttr(this.dataForm.id).then((res) => {
const { name, value } = res.data;
this.dataForm.name = name;
this.dataForm.value = value;
}).catch(err => {
console.error('获取属性详情失败:', err);
this.$modal.msgError('获取数据失败,请重试');
});
}
});
},
// 表单提交(优化加载状态和错误处理)
async dataFormSubmit() {
// 先验证表单
const valid = await new Promise((resolve) => {
this.$refs['dataForm'].validate((isValid) => resolve(isValid));
});
if (!valid) return;
this.isLoading = true; // 开始加载
try {
if (this.dataForm.id) {
// 编辑操作
await updateProductAttr({
...this.dataForm,
productId: this.productId,
});
this.$modal.msgSuccess('修改成功');
} else {
// 新增操作
await createProductAttr({
...this.dataForm,
productId: this.productId,
});
this.$modal.msgSuccess('新增成功');
}
this.visible = false;
this.$emit('refreshDataList');
} catch (error) {
// 错误处理
console.error('提交失败:', error);
this.$modal.msgError('操作失败,请重试');
} finally {
// 无论成功失败,都关闭加载状态
this.isLoading = false;
}
},
},
props: {
productId: {
type: String,
default: '',
},
},
data() {
return {
visible: false,
dataForm: {
id: 0,
name: '',
value: '',
},
dataRule: {
name: [{ required: true, message: '名称不能为空', trigger: 'blur' }],
},
};
},
methods: {
init(id) {
this.dataForm.id = id || '';
this.visible = true;
this.$nextTick(() => {
this.$refs['dataForm'].resetFields();
if (this.dataForm.id) {
getProductAttr(this.dataForm.id).then((res) => {
const { name, value } = res.data;
this.dataForm.name = name;
this.dataForm.value = value;
});
}
});
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
// 修改的提交
if (this.dataForm.id) {
updateProductAttr({
...this.dataForm,
productId: this.productId,
}).then((response) => {
this.$modal.msgSuccess('修改成功');
this.visible = false;
this.$emit('refreshDataList');
});
return;
}
// 添加的提交
createProductAttr({
...this.dataForm,
productId: this.productId,
}).then((response) => {
this.$modal.msgSuccess('新增成功');
this.visible = false;
this.$emit('refreshDataList');
});
}
});
},
},
};
</script>
<style scoped>
.dialog>>>.el-dialog__body {
padding: 30px 24px;
.dialog >>> .el-dialog__body {
padding: 30px 24px;
}
.dialog>>>.el-dialog__header {
font-size: 16px;
color: rgba(0, 0, 0, 0.85);
font-weight: 500;
padding: 13px 24px;
border-bottom: 1px solid #e9e9e9;
.dialog >>> .el-dialog__header {
font-size: 16px;
color: rgba(0, 0, 0, 0.85);
font-weight: 500;
padding: 13px 24px;
border-bottom: 1px solid #e9e9e9;
}
.dialog>>>.el-dialog__header .titleStyle::before {
content: '';
display: inline-block;
width: 4px;
height: 16px;
background-color: #0b58ff;
border-radius: 1px;
margin-right: 8px;
position: relative;
top: 2px;
.dialog >>> .el-dialog__header .titleStyle::before {
content: '';
display: inline-block;
width: 4px;
height: 16px;
background-color: #0b58ff;
border-radius: 1px;
margin-right: 8px;
position: relative;
top: 2px;
}
</style>

View File

@@ -262,14 +262,6 @@ export default {
tooltip: {
valueFormatter: (value) => `${value} %`,
},
label: {
show: true,
position: 'top',
distance: 6,
fontSize: 11,
color: '#333333',
formatter: (params) => `${params.value}` // 显示单位
},
data: this.barData.map((item) => item.processingRatio),
},
],

View File

@@ -34,7 +34,7 @@
<el-tabs v-model="activeLabel" :stretch="true" @tab-click="handleTabClick">
<el-tab-pane :label="'全部数据'" name="table">
<base-table-s ref="lineCurrentShiftTable" style="margin-bottom: 16px;" v-if="activeLabel == 'table'"
:page="1" :limit="100" :table-props="tableProps" :table-data="tableData" :max-height="300" />
:page="1" :limit="100" :table-props="tableProps" :table-data="tableData" :max-height="210" />
</el-tab-pane>
<el-tab-pane :label="'\u3000当天生产折线图\u3000'" name="graph">
<div style="height: 230px;" v-if="activeLabel == 'graph'" class="graph">
@@ -57,7 +57,7 @@
<el-tabs v-model="activeLabelDay" :stretch="true" @tab-click="handleTabClick">
<el-tab-pane :label="'全部数据'" name="table">
<base-table-s ref="lineTodayTable" style="margin-bottom: 16px;" v-if="activeLabelDay == 'table'"
:page="1" :limit="100" :table-props="tableProps" :table-data="tableData2" :max-height="300" />
:page="1" :limit="100" :table-props="tableProps" :table-data="tableData2" :max-height="210" />
</el-tab-pane>
<el-tab-pane :label="'\u3000当天生产折线图\u3000'" name="graph">
<div style="height: 230px;" v-if="activeLabelDay == 'graph'" class="graph">
@@ -71,55 +71,9 @@
</el-row>
</div>
</div>
<div class="content-inner" v-if="listQuery.timeType === 3">
<!-- 当班数据占1/2剩余高度 -->
<div class="content-card energyOverlimitLog">
<span class="blue-block"></span>
<span class="tip">上一班数据</span>
<el-row style="margin-top: 10px;">
<el-col class="custom-tabs">
<el-tabs v-model="activeLabel" :stretch="true" @tab-click="handleTabClick">
<el-tab-pane :label="'全部数据'" name="table">
<base-table-s ref="lineCurrentShiftTable" style="margin-bottom: 16px;" v-if="activeLabel == 'table'"
:page="1" :limit="100" :table-props="tableProps" :table-data="tableData" :max-height="300" />
</el-tab-pane>
<el-tab-pane :label="'\u3000当天生产折线图\u3000'" name="graph">
<div style="height: 230px;" v-if="activeLabel == 'graph'" class="graph">
<barChart v-if="tableData && tableData.length > 0" ref="barChart" height="230px"
:bar-data="tableData" />
<div v-else class="no-data-bg"></div>
</div>
</el-tab-pane>
</el-tabs>
</el-col>
</el-row>
</div>
<!-- 当天数据占1/2剩余高度 -->
<div class="content-card energyOverlimitLog">
<span class="blue-block"></span>
<span class="tip">当天数据</span>
<el-row style="margin-top: 10px;">
<el-col class="custom-tabs">
<el-tabs v-model="activeLabelDay" :stretch="true" @tab-click="handleTabClick">
<el-tab-pane :label="'全部数据'" name="table">
<base-table-s ref="lineTodayTable" style="margin-bottom: 16px;" v-if="activeLabelDay == 'table'"
:page="1" :limit="100" :table-props="tableProps" :table-data="tableData2" :max-height="300" />
</el-tab-pane>
<el-tab-pane :label="'\u3000当天生产折线图\u3000'" name="graph">
<div style="height: 230px;" v-if="activeLabelDay == 'graph'" class="graph">
<barChart v-if="tableData2 && tableData2.length > 0" ref="barChart" height="230px"
:bar-data="tableData2" />
<div v-else class="no-data-bg"></div>
</div>
</el-tab-pane>
</el-tabs>
</el-col>
</el-row>
</div>
</div>
<!-- 3.2 时间维度为自定义时的内容两个平分高度的div -->
<div class="content-inner" v-if="listQuery.timeType === 2">
<div class="content-inner" v-else>
<div class="content-card energyOverlimitLog">
<span class="blue-block"></span>
<span class="tip" v-if="listQuery.startTime && listQuery.endTime">
@@ -132,7 +86,7 @@
<span class="tip" v-else>生产表格数据 </span>
<div class="graph">
<base-table-s ref="lineCustomTable" style="margin-bottom: 16px;" v-if="activeLabel == 'table'" :page="1"
:limit="100" :table-props="tableProps" :max-height="300" :table-data="tableDataCustom" />
:limit="100" :table-props="tableProps" :max-height="210" :table-data="tableDataCustom" />
</div>
</div>
@@ -159,7 +113,7 @@
<span class="tip">当班数据</span>
<base-table-s ref="productCurrentShiftTable" style="margin-bottom: 16px;" v-if="activeLabel == 'table'"
:page="1" :limit="100" :table-props="productTableProps" :table-data="productTableData"
:max-height="300" />
:max-height="210" />
</div>
<!-- 当天数据占1/2剩余高度 -->
@@ -168,7 +122,7 @@
<span class="tip">当天数据</span>
<base-table-s ref="productTodayTable" style="margin-bottom: 16px;" v-if="activeLabelDay == 'table'"
:page="1" :limit="100" :table-props="productTablePropsDay" :table-data="productTableDataDay"
:max-height="300" />
:max-height="210" />
</div>
</div>
</div>
@@ -188,7 +142,7 @@
</span>
<span class="tip" v-else>生产表格数据 </span>
<base-table-s ref="productCustomTable" style="margin-bottom: 16px;" v-if="activeLabel == 'table'" :page="1"
:limit="100" :table-props="productTableProps" :table-data="productTableData" :max-height="300" />
:limit="100" :table-props="productTableProps" :table-data="productTableData" :max-height="210" />
</div>
</div>
</div>
@@ -200,7 +154,7 @@
import { parseTime } from '@/filter/code-filter';
import {
getLineAuto, getPdList, getPdlAutoReportNewSearchNow, getProductAuto,
getProcessAutoReportGroup, getProcessAutoReportDay, getProcessAutoReportNew, getPdlAutoReportNewSearchLastGroup
getProcessAutoReportGroup, getProcessAutoReportDay, getProcessAutoReportNew
} from '@/api/core/monitoring/auto';
import { getFactoryPage } from '@/api/core/base/factory';
import * as XLSX from 'xlsx';
@@ -211,11 +165,11 @@ import ButtonNav from '@/components/ButtonNav';
import { listData } from '@/api/system/dict/data';
// 表格列配置
const tableProps = [
{
prop: 'factoryName',
label: '工厂',
fixed: true
},
// {
// prop: 'factoryName',
// label: '工厂',
// fixed: true
// },
{
prop: 'lineName',
label: '产线',
@@ -414,27 +368,15 @@ export default {
productTableDataDay: [],
tableDataCustom: [],
list: [], // 折线图数据
timeTypeOptions: {
productLine: [ // 按产线监控(包含上一班)
{ id: 1, name: '当天' },
{ id: 2, name: '自定义' },
{ id: 3, name: '上一班' }
],
product: [ // 按产品监控(不含上一班)
{ id: 1, name: '当天' },
{ id: 2, name: '自定义' }
]
},
formConfig: [
{
type: 'select',
label: '时间维度',
selectOptions: [
{ id: 1, name: '当天' },
{ id: 2, name: '自定义' },
{ id: 3, name: '上一班' }
{ id: 2, name: '自定义' }
],
width: 100,
width: 80,
onchange: true,
// defaultSelect: 1,
clearable: false,
@@ -495,7 +437,6 @@ export default {
{ id: 3, name: '月' },
{ id: 4, name: '年' }
],
onchange: true,
width: 80,
param: 'reportType'
},
@@ -526,13 +467,6 @@ export default {
productTableProps() {
// 当班数据的完整表头(基础列 + 当班动态表头)
const baseColumns = [
{
prop: 'sizes',
label: '规格',
width: 105,
showOverflowtooltip: true,
fixed: true
},
{
prop: 'process',
label: '产品工艺',
@@ -542,8 +476,7 @@ export default {
prop: 'processType',
label: '产品类型',
filter: (val) => (val != 1 ? '面板' : '背板'),
fixed: true,
sortable: true,
fixed: true
},
{
prop: 'factoryName',
@@ -580,16 +513,13 @@ export default {
this.$nextTick(() => {
if (this.$refs.buttonNav) {
this.$refs.buttonNav.currentMenu = '按产线监控';
this.formConfig[0].selectOptions = this.timeTypeOptions.productLine;
}
if (this.$refs.searchBarForm) {
// this.$refs.searchBarForm.formInline.timeVal = [
// yesterday.getTime(),
// end.getTime()
// ];
this.$refs.searchBarForm.formInline.timeType = 1
}
});
@@ -646,26 +576,18 @@ export default {
// 3. 执行公共重置
resetCommon();
// if (this.activeName === 'productLine') {
// } else {
// }
// 4. 根据类型设置差异化的表单配置(仅处理不同的部分)
if (isProductLine) {
// 按产线监控:显示产线,隐藏产品工艺和类型,时间维度包含上一班
this.formConfig[0].selectOptions = this.timeTypeOptions.productLine; // 恢复上一班选项
// 按产线监控:显示产线,隐藏产品工艺和类型
this.formConfig[3].type = 'select'; // 显示产线
this.formConfig[4].type = ''; // 隐藏产品工艺
this.formConfig[5].type = ''; // 隐藏产品类型
this.getDayDataList();
} else {
// 按产品监控:显示产品工艺和类型,隐藏产线,时间维度移除上一班
this.formConfig[0].selectOptions = this.timeTypeOptions.product; // 不含上一班
// 按产品监控:显示产品工艺和类型,隐藏产线
this.formConfig[3].type = ''; // 隐藏产线
this.formConfig[4].type = 'select'; // 显示产品工艺
this.formConfig[5].type = 'select'; // 显示产品类型
this.getProductList();
}
},
@@ -679,12 +601,6 @@ export default {
{ ref: 'lineCurrentShiftTable', name: '产线监控_当班数据' },
{ ref: 'lineTodayTable', name: '产线监控_当天数据' }
], '产线监控_当班及当天数据汇总'); // 传入自定义汇总文件名
} else if (this.listQuery.timeType === 1) {
// 产线-当天:导出当班 + 当天两个表格(自定义汇总文件名)
this.exportMultipleTables([
{ ref: 'lineCurrentShiftTable', name: '产线监控_上一班数据' },
{ ref: 'lineTodayTable', name: '产线监控_当天数据' }
], '产线监控_当班及当天数据汇总'); // 传入自定义汇总文件名
} else {
// 产线-自定义:导出一个表格(自定义文件名)
this.exportSingleTable('lineCustomTable', '产线监控_自定义时间数据');
@@ -885,126 +801,31 @@ export default {
this.formConfig[2].selectOptions = res.data.list || [];
});
},
getWeekTimeRange(date) {
const targetDate = new Date(date);
const day = targetDate.getDay() || 7; // 周日转为7
const year = targetDate.getFullYear();
const month = targetDate.getMonth();
const dateNum = targetDate.getDate();
// 本周一 00:00:00
const startDate = new Date(year, month, dateNum - day + 1);
startDate.setHours(0, 0, 0, 0);
// 本周日 23:59:59
const endDate = new Date(year, month, dateNum - day + 7);
endDate.setHours(23, 59, 59, 999);
return {
startTime: startDate.getTime(),
endTime: endDate.getTime()
};
},
// 辅助函数获取本年的开始和结束时间戳1月1日00:00:00 到 12月31日23:59:59
getYearTimeRange(date) {
const targetDate = new Date(date);
const year = targetDate.getFullYear();
// 本年1月1日 00:00:00
const startDate = new Date(year, 0, 1);
startDate.setHours(0, 0, 0, 0);
// 本年12月31日 23:59:59
const endDate = new Date(year, 11, 31);
endDate.setHours(23, 59, 59, 999);
return {
startTime: startDate.getTime(),
endTime: endDate.getTime()
};
},
// 搜索/导出按钮点击
buttonClick(val) {
if (this.activeName === 'productLine') {
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.factoryId = val.factoryId || undefined;
this.listQuery.process = val.process ? val.process : [];
this.listQuery.lineId = val.lineId ? val.lineId : [];
this.listQuery.processType = val.processType ? val.processType : [];
this.listQuery.reportType = val.reportType || undefined;
this.listQuery.timeType = val.timeType || undefined;
this.listQuery.searchType = val.searchType || undefined;
// 处理不同时间选择类型
if (val.timeVal) {
this.listQuery.startTime = val.timeVal[0];
this.listQuery.endTime = val.timeVal[1];
} else if (val.timeValWeek) {
// 周选择器
const { startTime, endTime } = this.getWeekTimeRange(val.timeValWeek);
this.listQuery.startTime = startTime;
this.listQuery.endTime = endTime;
} else if (val.timeValMonth) {
// 月选择器
this.listQuery.startTime = val.timeValMonth[0];
this.listQuery.endTime = val.timeValMonth[1];
} else if (val.timeValYear) {
// 年选择器
const { startTime, endTime } = this.getYearTimeRange(val.timeValYear);
this.listQuery.startTime = startTime;
this.listQuery.endTime = endTime;
} else {
this.listQuery.startTime = undefined;
this.listQuery.endTime = undefined;
}
} else {
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.factoryId = val.factoryId || []
this.listQuery.process = val.process ? val.process : [];
this.listQuery.lineId = undefined;
this.listQuery.processType = val.processType ? val.processType : [];
this.listQuery.reportType = val.reportType || undefined;
this.listQuery.timeType = val.timeType || undefined;
this.listQuery.searchType = val.searchType || undefined;
// 处理不同时间选择类型
if (val.timeVal) {
this.listQuery.startTime = val.timeVal[0];
this.listQuery.endTime = val.timeVal[1];
} else if (val.timeValWeek) {
// 周选择器
const { startTime, endTime } = this.getWeekTimeRange(val.timeValWeek);
this.listQuery.startTime = startTime;
this.listQuery.endTime = endTime;
} else if (val.timeValMonth) {
// 月选择器
this.listQuery.startTime = val.timeValMonth[0];
this.listQuery.endTime = val.timeValMonth[1];
} else if (val.timeValYear) {
// 年选择器
const { startTime, endTime } = this.getYearTimeRange(val.timeValYear);
this.listQuery.startTime = startTime;
this.listQuery.endTime = endTime;
} else {
this.listQuery.startTime = undefined;
this.listQuery.endTime = undefined;
}
}
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.factoryId = val.factoryId || undefined;
this.listQuery.process = val.process ? val.process : [];
this.listQuery.lineId = val.lineId ? val.lineId : [];
this.listQuery.processType = val.processType ? val.processType : [];
this.listQuery.reportType = val.reportType || undefined;
this.listQuery.timeType = val.timeType || undefined;
this.listQuery.searchType = val.searchType || undefined;
this.listQuery.startTime = val.timeVal ? val.timeVal[0] : undefined;
this.listQuery.endTime = val.timeVal ? val.timeVal[1] : undefined;
if (this.activeName === 'productLine') {
if (this.listQuery.timeType === 1) {
this.getDayDataList();
} else if (this.listQuery.timeType === 3) {
this.getLastDayDataList();
} else {
this.getDataList();
}
} else {
this.getProductList();
}
break;
case 'export':
@@ -1013,9 +834,6 @@ export default {
case 'reset':
this.$refs.searchBarForm.resetForm();
this.$refs.searchBarForm.formInline.timeType = 1;
this.formConfig[0].selectOptions = this.activeName === 'productLine'
? this.timeTypeOptions.productLine
: this.timeTypeOptions.product;
this.listQuery = {
pageSize: 100,
pageNo: 1,
@@ -1024,9 +842,12 @@ export default {
};
if (this.activeName === 'productLine') {
this.getDayDataList();
} else {
this.getProductList();
}
break;
default:
console.log(val);
@@ -1276,28 +1097,6 @@ export default {
return [...lineColumns, totalColumn];
},
// 为当天时调用的接口
getLastDayDataList() {
getPdlAutoReportNewSearchLastGroup().then((response) => {
this.tableData = response.data.classData.map((item, index) => {
item.originalLossNum = item.original?.lossNum;
item.originalLossArea = item.original?.lossArea;
item.edgeLossNum = item.edge?.lossNum;
item.edgeLossArea = item.edge?.lossArea;
item.drillLossNum = item.drill?.lossNum;
item.drillLossArea = item.drill?.lossArea;
item.coatingLossNum = item.coating?.lossNum;
item.coatingLossArea = item.coating?.lossArea;
item.silkLossNum = item.silk?.lossNum;
item.silkLossArea = item.silk?.lossArea;
item.temperingLossNum = item.tempering?.lossNum;
item.temperingLossArea = item.tempering?.lossArea;
item.packingLossNum = item.packing?.lossNum;
item.packingLossArea = item.packing?.lossArea;
return item;
});
// console.log(this.tableData, this.tableData2);
});
},
getDayDataList() {
getPdlAutoReportNewSearchNow().then((response) => {
this.tableData = response.data.classData.map((item, index) => {
@@ -1357,21 +1156,24 @@ export default {
console.log(value);
this.listQuery.timeType = value;
if (value === 2) {
// 切换为“自定义”:显示查询类型和时间范围
this.formConfig[1].type = 'select';
this.$refs.searchBarForm.formInline.timeType = value;
this.listQuery.timeType = value;
this.formConfig[7].type = 'datePicker';
} else {
if (value === 1) {
// 切换为“当天”:隐藏查询类型、报表类型、时间范围
this.formConfig[1].type = '';
this.formConfig[6].type = '';
this.formConfig[7].type = '';
this.$refs.searchBarForm.formInline.timeType = value;
this.listQuery.timeType = value;
this.$refs.searchBarForm.formInline.searchType = undefined;
this.$refs.searchBarForm.formInline.reportType = undefined;
this.$refs.searchBarForm.formInline.timeVal = undefined;
} else {
// 切换为“自定义”:显示查询类型和时间范围
this.formConfig[1].type = 'select';
this.$refs.searchBarForm.formInline.timeType = value;
this.listQuery.timeType = value;
this.formConfig[7].type = 'datePicker';
}
} else if (param === 'searchType') {
if (value === 1) {
@@ -1385,74 +1187,7 @@ export default {
this.formConfig[7].type = 'datePicker';
}
} else if (param === 'reportType') {
if (this.$refs.searchBarForm && this.$refs.searchBarForm.formInline) {
const formInline = this.$refs.searchBarForm.formInline;
// 精准判断只有字段存在时才置为undefined不存在则不处理
if ('timeVal' in formInline) {
formInline.timeVal = undefined;
}
if ('timeValWeek' in formInline) {
formInline.timeValWeek = undefined;
}
if ('timeValMonth' in formInline) {
formInline.timeValMonth = undefined;
}
if ('timeValYear' in formInline) {
formInline.timeValYear = undefined;
}
}
this.listQuery.startTime = undefined;
this.listQuery.endTime = undefined;
if (value === 1) {
this.formConfig[7] = {
type: 'datePicker',
label: '时间范围',
dateType: 'datetimerange',
format: 'yyyy-MM-dd HH:mm:ss',
valueFormat: 'timestamp',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'timeVal',
width: 350
};
} else if (value === 2) {
this.formConfig[7] = {
type: 'datePicker',
label: '时间范围',
dateType: 'week',
placeholder: '选择日期',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd',
param: 'timeValWeek',
width: 250,
};
} else if (value === 3) {
this.formConfig[7] = {
type: 'datePicker',
label: '时间范围',
dateType: 'monthrange',
format: 'yyyy-MM-dd',
valueFormat: 'timestamp',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'timeValMonth',
defaultTime: ['00:00:00', '23:59:59'],
width: 250,
};
} else if (value === 4) {
this.formConfig[7] = {
type: 'datePicker',
label: '时间范围',
dateType: 'year',
placeholder: '选择年份',
format: 'yyyy',
valueFormat: 'timestamp',
param: 'timeValYear',
width: 250,
};
}
this.$refs.searchBarForm.formInline.timeVal = undefined;
} else if (param === 'factoryId') {
// 切换工厂时刷新产线列表
this.listQuery.lineId = [];
@@ -1499,7 +1234,7 @@ export default {
.content-wrapper {
// flex: 1;
width: 100%;
height: calc(100vh - 280px);
height: calc(100vh - 303px);
// overflow: hidden;
}

View File

@@ -77,7 +77,7 @@ const tableProps = [
},
{
prop: 'palletNum',
label: '一托玻璃数量/片'
label: '下片托数'
},
{
prop: 'startTime',
@@ -92,7 +92,7 @@ const tableProps = [
width: 160
},
{
prop: 'length',
prop: 'outputNum',
label: '玻璃长度/mm'
},
{
@@ -314,10 +314,9 @@ export default {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.productionLineId = val.productionLineId ? val.productionLineId : undefined;
this.listQuery.thick = val.thick ? val.thick : undefined;
this.listQuery.startTime = val.timeVal ? val.timeVal[0] : undefined;
this.listQuery.endTime = val.timeVal ? val.timeVal[1] : undefined;
this.listQuery.productId = val.productId ? val.productId : undefined;
this.listQuery.startTime = val.timeVal ? val.timeVal[0]: undefined;
this.listQuery.endTime = val.timeVal ? val.timeVal[1]: undefined;
//this.listQuery.reportEndTime = val.timeVal ? [new Date(val.timeVal[1]).getTime()] : undefined;
this.getDataList();

View File

@@ -77,7 +77,7 @@ const tableProps = [
},
{
prop: 'palletNum',
label: '一托玻璃数量/片'
label: '下片托数'
},
{
prop: 'startTime',
@@ -92,7 +92,7 @@ const tableProps = [
width: 160
},
{
prop: 'length',
prop: 'outputNum',
label: '玻璃长度/mm'
},
{

View File

@@ -262,14 +262,6 @@ export default {
tooltip: {
valueFormatter: (value) => `${value} %`,
},
label: {
show: true,
position: 'top',
distance: 6,
fontSize: 11,
color: '#333333',
formatter: (params) => `${params.value}` // 显示单位
},
data: this.barData.map((item) => item.processingRatio),
},
],

View File

@@ -34,7 +34,7 @@
<el-tabs v-model="activeLabel" :stretch="true" @tab-click="handleTabClick">
<el-tab-pane :label="'全部数据'" name="table">
<base-table-s ref="lineCurrentShiftTable" style="margin-bottom: 16px;" v-if="activeLabel == 'table'"
:page="1" :limit="100" :table-props="tableProps" :table-data="tableData" :max-height="300" />
:page="1" :limit="100" :table-props="tableProps" :table-data="tableData" :max-height="210" />
</el-tab-pane>
<el-tab-pane :label="'\u3000当天生产折线图\u3000'" name="graph">
<div style="height: 230px;" v-if="activeLabel == 'graph'" class="graph">
@@ -57,7 +57,7 @@
<el-tabs v-model="activeLabelDay" :stretch="true" @tab-click="handleTabClick">
<el-tab-pane :label="'全部数据'" name="table">
<base-table-s ref="lineTodayTable" style="margin-bottom: 16px;" v-if="activeLabelDay == 'table'"
:page="1" :limit="100" :table-props="tableProps" :table-data="tableData2" :max-height="300" />
:page="1" :limit="100" :table-props="tableProps" :table-data="tableData2" :max-height="210" />
</el-tab-pane>
<el-tab-pane :label="'\u3000当天生产折线图\u3000'" name="graph">
<div style="height: 230px;" v-if="activeLabelDay == 'graph'" class="graph">
@@ -71,68 +71,22 @@
</el-row>
</div>
</div>
<div class="content-inner" v-if="listQuery.timeType === 3">
<!-- 当班数据占1/2剩余高度 -->
<div class="content-card energyOverlimitLog">
<span class="blue-block"></span>
<span class="tip">上一班数据</span>
<el-row style="margin-top: 10px;">
<el-col class="custom-tabs">
<el-tabs v-model="activeLabel" :stretch="true" @tab-click="handleTabClick">
<el-tab-pane :label="'全部数据'" name="table">
<base-table-s ref="lineCurrentShiftTable" style="margin-bottom: 16px;" v-if="activeLabel == 'table'"
:page="1" :limit="100" :table-props="tableProps" :table-data="tableData" :max-height="300" />
</el-tab-pane>
<el-tab-pane :label="'\u3000当天生产折线图\u3000'" name="graph">
<div style="height: 230px;" v-if="activeLabel == 'graph'" class="graph">
<barChart v-if="tableData && tableData.length > 0" ref="barChart" height="230px"
:bar-data="tableData" />
<div v-else class="no-data-bg"></div>
</div>
</el-tab-pane>
</el-tabs>
</el-col>
</el-row>
</div>
<!-- 当天数据占1/2剩余高度 -->
<div class="content-card energyOverlimitLog">
<span class="blue-block"></span>
<span class="tip">当天数据</span>
<el-row style="margin-top: 10px;">
<el-col class="custom-tabs">
<el-tabs v-model="activeLabelDay" :stretch="true" @tab-click="handleTabClick">
<el-tab-pane :label="'全部数据'" name="table">
<base-table-s ref="lineTodayTable" style="margin-bottom: 16px;" v-if="activeLabelDay == 'table'"
:page="1" :limit="100" :table-props="tableProps" :table-data="tableData2" :max-height="300" />
</el-tab-pane>
<el-tab-pane :label="'\u3000当天生产折线图\u3000'" name="graph">
<div style="height: 230px;" v-if="activeLabelDay == 'graph'" class="graph">
<barChart v-if="tableData2 && tableData2.length > 0" ref="barChart" height="230px"
:bar-data="tableData2" />
<div v-else class="no-data-bg"></div>
</div>
</el-tab-pane>
</el-tabs>
</el-col>
</el-row>
</div>
</div>
<!-- 3.2 时间维度为自定义时的内容两个平分高度的div -->
<div class="content-inner" v-if="listQuery.timeType === 2">
<div class="content-inner" v-else>
<div class="content-card energyOverlimitLog">
<span class="blue-block"></span>
<span class="tip" v-if="listQuery.startTime && listQuery.endTime">
<span>{{ reportTypeMap[listQuery.reportType] }}</span>
<span>
{{ parseTime(listQuery.startTime) }} {{
parseTime(listQuery.endTime) }}
parseTime(listQuery.endTime) }}
</span>
</span>
<span class="tip" v-else>生产表格数据 </span>
<div class="graph">
<base-table-s ref="lineCustomTable" style="margin-bottom: 16px;" v-if="activeLabel == 'table'" :page="1"
:limit="100" :table-props="tableProps" :max-height="300" :table-data="tableDataCustom" />
:limit="100" :table-props="tableProps" :max-height="210" :table-data="tableDataCustom" />
</div>
</div>
@@ -159,7 +113,7 @@
<span class="tip">当班数据</span>
<base-table-s ref="productCurrentShiftTable" style="margin-bottom: 16px;" v-if="activeLabel == 'table'"
:page="1" :limit="100" :table-props="productTableProps" :table-data="productTableData"
:max-height="300" />
:max-height="210" />
</div>
<!-- 当天数据占1/2剩余高度 -->
@@ -168,7 +122,7 @@
<span class="tip">当天数据</span>
<base-table-s ref="productTodayTable" style="margin-bottom: 16px;" v-if="activeLabelDay == 'table'"
:page="1" :limit="100" :table-props="productTablePropsDay" :table-data="productTableDataDay"
:max-height="300" />
:max-height="210" />
</div>
</div>
</div>
@@ -188,7 +142,7 @@
</span>
<span class="tip" v-else>生产表格数据 </span>
<base-table-s ref="productCustomTable" style="margin-bottom: 16px;" v-if="activeLabel == 'table'" :page="1"
:limit="100" :table-props="productTableProps" :table-data="productTableData" :max-height="300" />
:limit="100" :table-props="productTableProps" :table-data="productTableData" :max-height="210" />
</div>
</div>
</div>
@@ -200,7 +154,7 @@
import { parseTime } from '@/filter/code-filter';
import {
getLineAuto, getPdList, getPdlAutoReportNewSearchNow, getProductAuto,
getProcessAutoReportGroup, getProcessAutoReportDay, getProcessAutoReportNew, getPdlAutoReportNewSearchLastGroup
getProcessAutoReportGroup, getProcessAutoReportDay, getProcessAutoReportNew
} from '@/api/core/monitoring/auto';
import { getFactoryPage } from '@/api/core/base/factory';
import * as XLSX from 'xlsx';
@@ -211,11 +165,11 @@ import ButtonNav from '@/components/ButtonNav';
import { listData } from '@/api/system/dict/data';
// 表格列配置
const tableProps = [
{
prop: 'factoryName',
label: '工厂',
fixed: true
},
// {
// prop: 'factoryName',
// label: '工厂',
// fixed: true
// },
{
prop: 'lineName',
label: '产线',
@@ -414,27 +368,15 @@ export default {
productTableDataDay: [],
tableDataCustom: [],
list: [], // 折线图数据
timeTypeOptions: {
productLine: [ // 按产线监控(包含上一班)
{ id: 1, name: '当天' },
{ id: 2, name: '自定义' },
{ id: 3, name: '上一班' }
],
product: [ // 按产品监控(不含上一班)
{ id: 1, name: '当天' },
{ id: 2, name: '自定义' }
]
},
formConfig: [
{
type: 'select',
label: '时间维度',
selectOptions: [
{ id: 1, name: '当天' },
{ id: 2, name: '自定义' },
{ id: 3, name: '上一班' }
{ id: 2, name: '自定义' }
],
width: 100,
width: 80,
onchange: true,
// defaultSelect: 1,
clearable: false,
@@ -496,7 +438,6 @@ export default {
{ id: 4, name: '年' }
],
width: 80,
onchange: true,
param: 'reportType'
},
{
@@ -572,20 +513,17 @@ export default {
this.$nextTick(() => {
if (this.$refs.buttonNav) {
this.$refs.buttonNav.currentMenu = '按产品监控';
this.formConfig[0].selectOptions = this.timeTypeOptions.product;
}
if (this.$refs.searchBarForm) {
// this.$refs.searchBarForm.formInline.timeVal = [
// yesterday.getTime(),
// end.getTime()
// ];
this.$refs.searchBarForm.formInline.timeType = 1
}
});
this.getDayDataList();
this.getProductList();
this.getPdLineList();
const queryParams = {
pageNo: 1,
@@ -641,21 +579,15 @@ export default {
// 4. 根据类型设置差异化的表单配置(仅处理不同的部分)
if (isProductLine) {
// 按产线监控:显示产线,隐藏产品工艺和类型,时间维度包含上一班
this.formConfig[0].selectOptions = this.timeTypeOptions.productLine; // 恢复上一班选项
// 按产线监控:显示产线,隐藏产品工艺和类型
this.formConfig[3].type = 'select'; // 显示产线
this.formConfig[4].type = ''; // 隐藏产品工艺
this.formConfig[5].type = ''; // 隐藏产品类型
this.getDayDataList();
} else {
// 按产品监控:显示产品工艺和类型,隐藏产线,时间维度移除上一班
this.formConfig[0].selectOptions = this.timeTypeOptions.product; // 不含上一班
// 按产品监控:显示产品工艺和类型,隐藏产线
this.formConfig[3].type = ''; // 隐藏产线
this.formConfig[4].type = 'select'; // 显示产品工艺
this.formConfig[5].type = 'select'; // 显示产品类型
this.getProductList();
}
},
@@ -664,52 +596,48 @@ export default {
// 按产线监控
if (this.activeName === 'productLine') {
if (this.listQuery.timeType === 1) {
// 产线-当天:导出当班 + 当天两个表格(自定义汇总文件名)
// 产线-当天:导出当班 + 当天两个表格
this.exportMultipleTables([
{ ref: 'lineCurrentShiftTable', name: '产线监控_当班数据' },
{ ref: 'lineTodayTable', name: '产线监控_当天数据' }
], '产线监控_当班及当天数据汇总'); // 传入自定义汇总文件名
} else if (this.listQuery.timeType === 1) {
// 产线-当天:导出当班 + 当天两个表格(自定义汇总文件名)
this.exportMultipleTables([
{ ref: 'lineCurrentShiftTable', name: '产线监控_上一班数据' },
{ ref: 'lineTodayTable', name: '产线监控_当天数据' }
], '产线监控_当班及当天数据汇总'); // 传入自定义汇总文件名
]);
} else {
// 产线-自定义:导出一个表格(自定义文件名)
// 产线-自定义:导出一个表格
this.exportSingleTable('lineCustomTable', '产线监控_自定义时间数据');
}
}
// 按产品监控
else {
if (this.listQuery.timeType === 1) {
// 产品-当天:导出当班 + 当天两个表格(自定义汇总文件名)
// 产品-当天:导出当班 + 当天两个表格
this.exportMultipleTables([
{ ref: 'productCurrentShiftTable', name: '产品监控_当班数据' },
{ ref: 'productTodayTable', name: '产品监控_当天数据' }
], '产品监控_当班及当天数据汇总'); // 传入自定义汇总文件名
]);
} else {
// 产品-自定义:导出一个表格(自定义文件名)
// 产品-自定义:导出一个表格
this.exportSingleTable('productCustomTable', '产品监控_自定义时间数据');
}
}
},
// 导出单个表格(保持原有逻辑,文件名由调用方传入,已区分不同场景)
// 导出单个表格
exportSingleTable(refName, fileName) {
const table = this.getTableDom(refName);
if (!table) return;
// 克隆表格并移除固定列
const clonedTable = table.cloneNode(true);
this.adjustTableForExport(clonedTable);
this.removeFixedColumns(clonedTable);
// 转换为工作簿并导出
const workbook = XLSX.utils.table_to_book(clonedTable);
const fullName = `${fileName}_${this.formatDate()}.xlsx`;
XLSX.writeFile(workbook, fullName);
},
// 导出多个表格(新增自定义汇总文件名参数,适配不同选项卡
exportMultipleTables(tables, customSummaryName) {
// 导出多个表格(同一个Excel的不同sheet
exportMultipleTables(tables) {
const workbook = XLSX.utils.book_new();
let hasValidTable = false;
@@ -718,9 +646,11 @@ export default {
if (!table) return;
hasValidTable = true;
// 克隆表格并移除固定列
const clonedTable = table.cloneNode(true);
this.adjustTableForExport(clonedTable);
this.removeFixedColumns(clonedTable);
// 转换为sheet并添加到工作簿
const worksheet = XLSX.utils.table_to_sheet(clonedTable);
XLSX.utils.book_append_sheet(workbook, worksheet, name);
});
@@ -730,128 +660,31 @@ export default {
return;
}
// 动态生成汇总文件名:自定义名称 + 日期
const fullName = `${customSummaryName}_${this.formatDate()}.xlsx`;
// 导出包含多个sheet的Excel
const fullName = `生产监控数据汇总_${this.formatDate()}.xlsx`;
XLSX.writeFile(workbook, fullName);
},
// 辅助方法获取表格DOM元素包含表头
// 辅助方法获取表格DOM元素
getTableDom(refName) {
const tableComponent = this.$refs[refName];
if (!tableComponent) {
this.$message.warning(`未找到${refName}表格`);
return null;
}
// 获取完整表格容器(包含表头和表体)
const tableContainer = tableComponent.$el.querySelector('.el-table');
if (!tableContainer) {
// 获取表格组件内部的el-table DOM
const tableDom = tableComponent.$el.querySelector('.el-table__body-wrapper table');
if (!tableDom) {
this.$message.warning(`${refName}表格数据为空`);
return null;
}
return tableContainer;
return tableDom;
},
// 重点修复:调整表格结构(解决表头重复问题
adjustTableForExport(tableContainer) {
// 1. 移除空表格提示和分页等无关元素
const emptyCells = tableContainer.querySelectorAll('.el-table__empty-block, .el-pagination');
emptyCells.forEach(cell => cell.remove());
// 2. 定位核心元素
const mainTable = tableContainer.querySelector('.el-table__body-wrapper table'); // 主表体
const fixedLeft = tableContainer.querySelector('.el-table__fixed'); // 左固定列容器
const fixedRight = tableContainer.querySelector('.el-table__fixed-right'); // 右固定列容器
// 3. 提取所有表头行(支持多级表头,按层级收集)
const allHeaderRows = []; // 存储所有层级的表头行(每行是一个单元格数组)
// 辅助函数:提取某个容器内的所有表头行(处理多级表头)
const extractHeaderRows = (container) => {
const headerWrapper = container?.querySelector('.el-table__header-wrapper table');
if (!headerWrapper) return [];
const thead = headerWrapper.querySelector('thead');
if (!thead) return [];
// 多级表头可能有多个tr
const headerRows = Array.from(thead.querySelectorAll('tr'));
return headerRows.map(row => Array.from(row.querySelectorAll('th'))); // 每行的单元格数组
};
// 收集左固定列的表头行(可能有多层)
const fixedLeftHeaderRows = extractHeaderRows(fixedLeft);
// 收集主表头的表头行(可能有多层)
const mainHeaderRows = extractHeaderRows(tableContainer);
// 收集右固定列的表头行(可能有多层)
const fixedRightHeaderRows = extractHeaderRows(fixedRight);
// 4. 合并表头行(按层级对齐,左固定列 → 主表头 → 右固定列)
// 确定最大表头层级(多级表头的行数)
const maxLevel = Math.max(
fixedLeftHeaderRows.length,
mainHeaderRows.length,
fixedRightHeaderRows.length
);
// 按层级合并每行的单元格
for (let i = 0; i < maxLevel; i++) {
const rowCells = [];
// 左固定列当前层级的单元格(不足则补空)
rowCells.push(...(fixedLeftHeaderRows[i] || []));
// 主表头当前层级的单元格(不足则补空)
rowCells.push(...(mainHeaderRows[i] || []));
// 右固定列当前层级的单元格(不足则补空)
rowCells.push(...(fixedRightHeaderRows[i] || []));
allHeaderRows.push(rowCells);
}
// 5. 清理所有原有表头和固定列容器(避免干扰)
tableContainer.querySelectorAll('thead').forEach(thead => thead.remove());
tableContainer.querySelectorAll('.el-table__header-wrapper').forEach(wrapper => wrapper.remove());
[fixedLeft, fixedRight].forEach(container => container?.remove());
// 6. 构建唯一表头并添加到主表体(支持多级表头)
if (mainTable && allHeaderRows.length > 0) {
const newThead = document.createElement('thead');
// 按层级添加表头行
allHeaderRows.forEach(cells => {
const newTr = document.createElement('tr');
cells.forEach(cell => {
// 复制单元格避免DOM残留引用问题
const clonedCell = cell.cloneNode(true);
newTr.appendChild(clonedCell);
});
newThead.appendChild(newTr);
});
// 将新表头插入主表体最前面
mainTable.insertBefore(newThead, mainTable.firstChild);
}
// 7. 合并固定列数据到主表体仅处理tbody数据
// 合并左固定列数据
if (fixedLeft && mainTable) {
const fixedLeftRows = fixedLeft.querySelectorAll('.el-table__body-wrapper tbody tr');
const mainRows = mainTable.querySelectorAll('tbody tr');
fixedLeftRows.forEach((fixedRow, index) => {
if (mainRows[index]) {
const fixedCells = Array.from(fixedRow.querySelectorAll('td'));
fixedCells.forEach(cell => {
mainRows[index].insertBefore(cell.cloneNode(true), mainRows[index].firstChild);
});
}
});
}
// 合并右固定列数据
if (fixedRight && mainTable) {
const fixedRightRows = fixedRight.querySelectorAll('.el-table__body-wrapper tbody tr');
const mainRows = mainTable.querySelectorAll('tbody tr');
fixedRightRows.forEach((fixedRow, index) => {
if (mainRows[index]) {
const fixedCells = Array.from(fixedRow.querySelectorAll('td'));
fixedCells.forEach(cell => {
mainRows[index].appendChild(cell.cloneNode(true));
});
}
});
}
// 辅助方法:移除固定列(避免重复导出
removeFixedColumns(table) {
const fixedColumns = table.querySelectorAll('.el-table__fixed, .el-table__fixed-right');
fixedColumns.forEach(col => col.remove());
},
// 辅助方法:格式化日期(用于文件名)
@@ -865,6 +698,7 @@ export default {
String(date.getMinutes()).padStart(2, '0')
].join('');
},
// 获取产线和工厂列表
getPdLineList() {
getPdList().then(res => {
@@ -878,85 +712,28 @@ export default {
// 搜索/导出按钮点击
buttonClick(val) {
if (this.activeName === 'productLine') {
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.factoryId = val.factoryId || undefined;
this.listQuery.process = val.process ? val.process : [];
this.listQuery.lineId = val.lineId ? val.lineId : [];
this.listQuery.processType = val.processType ? val.processType : [];
this.listQuery.reportType = val.reportType || undefined;
this.listQuery.timeType = val.timeType || undefined;
this.listQuery.searchType = val.searchType || undefined;
// 处理不同时间选择类型
if (val.timeVal) {
this.listQuery.startTime = val.timeVal[0];
this.listQuery.endTime = val.timeVal[1];
} else if (val.timeValWeek) {
// 周选择器
const { startTime, endTime } = this.getWeekTimeRange(val.timeValWeek);
this.listQuery.startTime = startTime;
this.listQuery.endTime = endTime;
} else if (val.timeValMonth) {
// 月选择器
this.listQuery.startTime = val.timeValMonth[0];
this.listQuery.endTime = val.timeValMonth[1];
} else if (val.timeValYear) {
// 年选择器
const { startTime, endTime } = this.getYearTimeRange(val.timeValYear);
this.listQuery.startTime = startTime;
this.listQuery.endTime = endTime;
} else {
this.listQuery.startTime = undefined;
this.listQuery.endTime = undefined;
}
} else {
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.factoryId = val.factoryId || []
this.listQuery.process = val.process ? val.process : [];
this.listQuery.lineId = undefined;
this.listQuery.processType = val.processType ? val.processType : [];
this.listQuery.reportType = val.reportType || undefined;
this.listQuery.timeType = val.timeType || undefined;
this.listQuery.searchType = val.searchType || undefined;
// 处理不同时间选择类型
if (val.timeVal) {
this.listQuery.startTime = val.timeVal[0];
this.listQuery.endTime = val.timeVal[1];
} else if (val.timeValWeek) {
// 周选择器
const { startTime, endTime } = this.getWeekTimeRange(val.timeValWeek);
this.listQuery.startTime = startTime;
this.listQuery.endTime = endTime;
} else if (val.timeValMonth) {
// 月选择器
this.listQuery.startTime = val.timeValMonth[0];
this.listQuery.endTime = val.timeValMonth[1];
} else if (val.timeValYear) {
// 年选择器
const { startTime, endTime } = this.getYearTimeRange(val.timeValYear);
this.listQuery.startTime = startTime;
this.listQuery.endTime = endTime;
} else {
this.listQuery.startTime = undefined;
this.listQuery.endTime = undefined;
}
}
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.factoryId = val.factoryId || undefined;
this.listQuery.process = val.process ? val.process : [];
this.listQuery.lineId = val.lineId ? val.lineId : [];
this.listQuery.processType = val.processType ? val.processType : [];
this.listQuery.reportType = val.reportType || undefined;
this.listQuery.timeType = val.timeType || undefined;
this.listQuery.searchType = val.searchType || undefined;
this.listQuery.startTime = val.timeVal ? val.timeVal[0] : undefined;
this.listQuery.endTime = val.timeVal ? val.timeVal[1] : undefined;
if (this.activeName === 'productLine') {
if (this.listQuery.timeType === 1) {
this.getDayDataList();
} else if (this.listQuery.timeType === 3) {
this.getLastDayDataList();
} else {
this.getDataList();
}
} else {
this.getProductList();
this.getProductList();
}
break;
case 'export':
@@ -965,9 +742,6 @@ export default {
case 'reset':
this.$refs.searchBarForm.resetForm();
this.$refs.searchBarForm.formInline.timeType = 1;
this.formConfig[0].selectOptions = this.activeName === 'productLine'
? this.timeTypeOptions.productLine
: this.timeTypeOptions.product;
this.listQuery = {
pageSize: 100,
pageNo: 1,
@@ -976,9 +750,12 @@ export default {
};
if (this.activeName === 'productLine') {
this.getDayDataList();
} else {
this.getProductList();
}
break;
default:
console.log(val);
@@ -986,8 +763,8 @@ export default {
},
getDataList() {
if (!this.listQuery.startTime && !this.listQuery.endTime) {
return this.$modal.msgError('请选择时间');
if(!this.listQuery.startTime &&!this.listQuery.endTime ){
return this.$modal.msgError('请选择时间');
}
this.dataListLoading = true;
// const arr = ['日', '周', '月', '年'];
@@ -1021,7 +798,7 @@ export default {
console.log('resGroup');
if (this.listQuery.timeType === 2) {
const resGroup = await getProcessAutoReportNew(this.listQuery);
console.log('resGroup', resGroup);
console.log('resGroup',resGroup);
// 格式化数据lineDetList提取到外层键名加lineId前缀
const formatData = (rawList) => {
@@ -1050,7 +827,7 @@ export default {
// 处理当班和当天数据(分别存储)
this.productTableData = formatData(resGroup.data.list); // 当班数据
console.log(this.productTableData, 'productTableData');
console.log(this.productTableData,'productTableData');
// --------------------------
// 生成当班数据的动态表头
@@ -1228,28 +1005,6 @@ export default {
return [...lineColumns, totalColumn];
},
// 为当天时调用的接口
getLastDayDataList() {
getPdlAutoReportNewSearchLastGroup().then((response) => {
this.tableData = response.data.classData.map((item, index) => {
item.originalLossNum = item.original?.lossNum;
item.originalLossArea = item.original?.lossArea;
item.edgeLossNum = item.edge?.lossNum;
item.edgeLossArea = item.edge?.lossArea;
item.drillLossNum = item.drill?.lossNum;
item.drillLossArea = item.drill?.lossArea;
item.coatingLossNum = item.coating?.lossNum;
item.coatingLossArea = item.coating?.lossArea;
item.silkLossNum = item.silk?.lossNum;
item.silkLossArea = item.silk?.lossArea;
item.temperingLossNum = item.tempering?.lossNum;
item.temperingLossArea = item.tempering?.lossArea;
item.packingLossNum = item.packing?.lossNum;
item.packingLossArea = item.packing?.lossArea;
return item;
});
// console.log(this.tableData, this.tableData2);
});
},
getDayDataList() {
getPdlAutoReportNewSearchNow().then((response) => {
this.tableData = response.data.classData.map((item, index) => {
@@ -1305,26 +1060,28 @@ export default {
// 搜索栏下拉选择变化
handleSearchBarChanged({ param, value }) {
console.log(value, param);
if (param === 'timeType') {
console.log(value);
this.listQuery.timeType = value;
if (value === 2) {
// 切换为“自定义”:显示查询类型和时间范围
this.formConfig[1].type = 'select';
this.$refs.searchBarForm.formInline.timeType = value;
this.listQuery.timeType = value;
this.formConfig[7].type = 'datePicker';
} else {
if (value === 1) {
// 切换为“当天”:隐藏查询类型、报表类型、时间范围
this.formConfig[1].type = '';
this.formConfig[6].type = '';
this.formConfig[7].type = '';
this.$refs.searchBarForm.formInline.timeType = value;
this.listQuery.timeType = value;
this.$refs.searchBarForm.formInline.searchType = undefined;
this.$refs.searchBarForm.formInline.reportType = undefined;
this.$refs.searchBarForm.formInline.timeVal = undefined;
} else {
// 切换为“自定义”:显示查询类型和时间范围
this.formConfig[1].type = 'select';
this.$refs.searchBarForm.formInline.timeType = value;
this.listQuery.timeType = value;
this.formConfig[7].type = 'datePicker';
}
} else if (param === 'searchType') {
if (value === 1) {
@@ -1338,74 +1095,7 @@ export default {
this.formConfig[7].type = 'datePicker';
}
} else if (param === 'reportType') {
if (this.$refs.searchBarForm && this.$refs.searchBarForm.formInline) {
const formInline = this.$refs.searchBarForm.formInline;
// 精准判断只有字段存在时才置为undefined不存在则不处理
if ('timeVal' in formInline) {
formInline.timeVal = undefined;
}
if ('timeValWeek' in formInline) {
formInline.timeValWeek = undefined;
}
if ('timeValMonth' in formInline) {
formInline.timeValMonth = undefined;
}
if ('timeValYear' in formInline) {
formInline.timeValYear = undefined;
}
}
this.listQuery.startTime = undefined;
this.listQuery.endTime = undefined;
if (value === 1) {
this.formConfig[7] = {
type: 'datePicker',
label: '时间范围',
dateType: 'datetimerange',
format: 'yyyy-MM-dd HH:mm:ss',
valueFormat: 'timestamp',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'timeVal',
width: 350
};
} else if (value === 2) {
this.formConfig[7] = {
type: 'datePicker',
label: '时间范围',
dateType: 'week',
placeholder: '选择日期',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd',
param: 'timeValWeek',
width: 250,
};
} else if (value === 3) {
this.formConfig[7] = {
type: 'datePicker',
label: '时间范围',
dateType: 'monthrange',
format: 'yyyy-MM-dd',
valueFormat: 'timestamp',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'timeValMonth',
defaultTime: ['00:00:00', '23:59:59'],
width: 250,
};
} else if (value === 4) {
this.formConfig[7] = {
type: 'datePicker',
label: '时间范围',
dateType: 'year',
placeholder: '选择年份',
format: 'yyyy',
valueFormat: 'timestamp',
param: 'timeValYear',
width: 250,
};
}
this.$refs.searchBarForm.formInline.timeVal = undefined;
} else if (param === 'factoryId') {
// 切换工厂时刷新产线列表
this.listQuery.lineId = [];
@@ -1452,7 +1142,7 @@ export default {
.content-wrapper {
// flex: 1;
width: 100%;
height: calc(100vh - 280px);
height: calc(100vh - 303px);
// overflow: hidden;
}

View File

@@ -1,8 +1,14 @@
<!--
* @Author: Do not edit
* @Date: 2023-08-29 14:59:29
* @LastEditTime: 2024-12-02 13:44:47
* @LastEditors: zwq
* @Description:
-->
<template>
<div class="app-container">
<!-- :isFold="true" 控制展开 -->
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick"
@select-changed="selectType" />
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
<base-table v-if="tableData.length" class="right-aside" v-loading="dataListLoading" :table-props="tableProps"
:page="listQuery.pageNo" :limit="listQuery.pageSize" :table-data="tableData">
<method-btn v-if="tableBtn.length" slot="handleBtn" :width="120" label="操作" :method-list="tableBtn"
@@ -11,47 +17,34 @@
<div v-else class="no-data-bg"></div>
<pagination :limit.sync="listQuery.pageSize" :page.sync="listQuery.pageNo" :total="listQuery.total"
@pagination="getDataList" />
<!-- <el-dialog
title="提示"
:visible.sync="dialogVisible"
width="30%"
:before-close="handleClose">
<el-button type="primary" @click="exportXlsx">xlsx</el-button>
<el-button type="success" @click="exportPdf">pdf</el-button>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary" @click="dialogVisible = false"> </el-button>
</span>
</el-dialog> -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" />
</div>
</template>
<script>
import Vue from 'vue';
import AddOrUpdate from './add-or-updata';
import { parseTime } from '../../mixins/code-filter';
import { getCostOriginRadioHisData, getPdList } from '@/api/core/monitoring/index';
import { getCostOriginRadioHisData, getPdList } from '@/api/core/monitoring/index'
import * as XLSX from 'xlsx'
import FileSaver from 'file-saver'
import jsPDF from 'jspdf'
import html2canvas from 'html2canvas'
import { exportCostOriginRadioHisData } from '../../../../api/core/monitoring';
// Vue2 中注册全局方法(如果需要)
Vue.prototype.$download = Vue.prototype.$download || {
excel: (response, fileName) => {
const blob = new Blob([response.data], { type: 'application/vnd.ms-excel' });
const url = window.URL.createObjectURL(blob);
const aLink = document.createElement('a');
aLink.style.display = 'none';
aLink.href = url;
aLink.setAttribute('download', fileName);
document.body.appendChild(aLink);
aLink.click();
document.body.removeChild(aLink);
window.URL.revokeObjectURL(url);
}
};
Vue.prototype.$modal = Vue.prototype.$modal || {
confirm: (message) => {
return new Promise((resolve, reject) => {
if (window.confirm(message)) {
resolve();
} else {
reject();
}
});
}
};
const tableProps = [
{
prop: 'reportType',
label: '报表类型'
@@ -59,11 +52,12 @@ const tableProps = [
{
prop: 'time',
label: '日期',
// filter: parseTime,
width: 160
},
{
{
prop: 'bindObjectName',
label: '产线'
label: '产线'
},
{
prop: 'thick',
@@ -73,11 +67,11 @@ const tableProps = [
prop: 'speed',
label: '在线速度'
},
{
{
prop: 'width',
label: '掰边宽度'
},
{
},
{
prop: 'inArea',
label: '拉引量/㎡'
},
@@ -85,83 +79,21 @@ const tableProps = [
prop: 'outArea',
label: '下片面积/㎡'
},
{
{
prop: 'ratio',
label: '良品率/%'
},
label: '良品率'
},
];
/**
* 工具函数获取选择时间所在周的起始和结束时间Vue2 兼容)
* @param {String|Date} selectTime - 选择的时间支持格式yyyy-MM-dd、yyyy-MM-dd HH:mm:ss 或 Date 对象)
* @returns {Array} [startDate, endDate] - 所在周周一 00:00:00 至 周日 23:59:59Date 对象)
*/
function getSelectedWeekRange(selectTime) {
// 兼容 String 类型时间和 Date 对象,统一转为 Date 实例
const targetDate = new Date(selectTime);
// 处理无效日期(若传入非法时间,返回当前时间的本周范围)
// if (isNaN(targetDate.getTime())) {
// console.warn('传入的时间格式无效,将使用当前时间计算本周范围');
// return getCurrentWeekRange(); // 可根据需求改为抛出错误或返回空
// }
const day = targetDate.getDay() || 7; // 周日为 7避免周日 -0 天仍为周日)
const start = new Date(targetDate);
start.setDate(targetDate.getDate() - day + 1); // 计算所在周的周一
start.setHours(0, 0, 0, 0); // 重置时分秒为 00:00:00.000
const end = new Date(start);
end.setDate(start.getDate() + 6); // 周一 +6 天 = 周日
end.setHours(23, 59, 59, 999); // 重置时分秒为 23:59:59.999
return [start, end];
}
/**
* 工具函数获取选择时间所在年的起始和结束时间Vue2 兼容)
* @param {String|Date} selectTime - 选择的时间支持格式yyyy-MM-dd、yyyy-MM-dd HH:mm:ss 或 Date 对象)
* @returns {Array} [startDate, endDate] - 所在年 1月1日 00:00:00 至 12月31日 23:59:59Date 对象)
*/
function getSelectedYearRange(selectTime) {
// 兼容 String 类型时间和 Date 对象,统一转为 Date 实例
const targetDate = new Date(selectTime);
// 处理无效日期(若传入非法时间,返回当前时间的本年范围)
// if (isNaN(targetDate.getTime())) {
// console.warn('传入的时间格式无效,将使用当前时间计算本年范围');
// return getCurrentYearRange(); // 可根据需求改为抛出错误或返回空
// }
const year = targetDate.getFullYear(); // 获取选择时间的年份
const start = new Date(year, 0, 1); // 所在年 1月1日月份从 0 开始)
start.setHours(0, 0, 0, 0); // 重置时分秒为 00:00:00.000
const end = new Date(year, 11, 31); // 所在年 12月31日11 代表 12 月)
end.setHours(23, 59, 59, 999); // 重置时分秒为 23:59:59.999
return [start, end];
}
// 格式化时间为 yyyy-MM-dd HH:mm:ssVue2 兼容)
function formatDateTime(date) {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
const hours = String(date.getHours()).padStart(2, '0');
const minutes = String(date.getMinutes()).padStart(2, '0');
const seconds = String(date.getSeconds()).padStart(2, '0');
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
}
export default {
components: {
AddOrUpdate
},
data() {
return {
urlOptions: {
getDataListURL: getCostOriginRadioHisData
},
data() {
return {
urlOptions: {
getDataListURL: getCostOriginRadioHisData
},
tableData: [],
listQuery: {
pageSize: 10,
@@ -169,366 +101,181 @@ export default {
total: 1,
bindObjectId: undefined,
statisticType: undefined,
startTime: undefined,
endTime: undefined
},
pdLineList: [],
pdLineList:[],
exportLoading: false,
dataListLoading: false,
selectedList: [],
dialogVisible: false,
selectedList: [],
dialogVisible: false,
addOrEditTitle: '',
addOrUpdateVisible: false,
tableProps,
tableProps,
tableBtn: [
{
type: 'edit',
btnName: '编辑',
},
].filter(v => v),
fileName: '',
].filter((v) => v),
tableData: [],
fileName: '',
formConfig: [
{
type: 'select',
label: '报表类型',
onchange: true,
label: '维度',
selectOptions: [
{ id: '0', name: '班组' },
{ id: '1', name: '日' },
{ id: '2', name: '周' },
{ id: '3', name: '月' },
{ id: '4', name: '年' }
],
param: 'statisticType',
index: 1,
extraOptions: [
{
parent: 'statisticType',
type: 'datePicker',
label: '统计时间',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'timeVal',
defaultTime: ['00:00:00', '23:59:59'],
defaultSelect: [],
width: 250,
key: 'datePicker-0', // 唯一 key触发重新渲染
appendToBody: true // 优化定位:挂载到 body 下
id: '0',
name:'班组'
},
// 日 - 日期范围选择
{
parent: 'statisticType',
type: 'datePicker',
label: '统计时间',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'timeValDay',
defaultTime: ['00:00:00', '23:59:59'],
defaultSelect: [],
width: 250,
key: 'datePicker-1', // 唯一 key触发重新渲染
appendToBody: true // 优化定位:挂载到 body 下
id: '1',
name: '日'
},
// 周 - 单个日期选择(自动获取本周范围)
{
parent: 'statisticType',
type: 'datePicker',
label: '统计时间',
dateType: 'week',
placeholder: '选择日期',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd',
param: 'timeValWeek',
width: 250,
key: 'datePicker-2', // 唯一 key触发重新渲染
appendToBody: true // 优化定位:挂载到 body 下
id: '2',
name: '周'
},
// 月 - 日期范围选择
{
parent: 'statisticType',
type: 'datePicker',
label: '统计时间',
dateType: 'monthrange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'timeValMonth',
defaultTime: ['00:00:00', '23:59:59'],
width: 250,
key: 'datePicker-3', // 唯一 key触发重新渲染
appendToBody: true // 优化定位:挂载到 body 下
id: '3',
name: '月'
},
// 年 - 单个日期选择(自动获取本年范围)
{
parent: 'statisticType',
type: 'datePicker',
label: '统计时间',
dateType: 'year',
placeholder: '选择年份',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd',
param: 'timeValYear',
width: 250,
key: 'datePicker-4', // 唯一 key触发重新渲染
appendToBody: true // 优化定位:挂载到 body 下
id: '4',
name: '年'
}
]
],
param: 'statisticType'
},
{
type: 'select',
label: '产线',
selectOptions: [],
{
type: 'select',
label: '产线',
selectOptions: [],
param: 'bindObjectId'
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
{
type: 'datePicker',
label: '统计开始时间',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: "yyyy-MM-dd HH:mm:ss",
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'timeVal',
defaultTime: ['00:00:00', '23:59:59'],
defaultSelect: []
},
{
type: 'separate',
},
{
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
}
],
};
},
watch: {
// 监听报表类型变化,强制刷新日期选择器
'listQuery.statisticType'(newVal, oldVal) {
if (newVal !== oldVal && this.$refs.searchBarForm) {
// 触发 search-bar 组件重新渲染(如果 search-bar 支持)
if (this.$refs.searchBarForm.$forceUpdate) {
this.$refs.searchBarForm.$forceUpdate();
}
// 延迟重置定位,确保 DOM 已更新
setTimeout(() => {
const datePickerEl = this.$refs.searchBarForm.$el.querySelector('.el-date-picker');
if (datePickerEl) {
// 触发 Element UI 日期选择器重新计算定位(内部方法)
const datePickerInstance = datePickerEl.__vue__;
if (datePickerInstance && datePickerInstance.updatePopper) {
datePickerInstance.updatePopper();
}
}
}, 100);
}
}
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
// type: this.$auth.hasPermi('base:factory:export') ? 'button' : '',
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
}
],
};
},
mounted() {
// Vue2 中 $refs 需在 $nextTick 中访问(确保 DOM 渲染完成)
this.$nextTick(() => {
if (this.$refs.searchBarForm) {
this.$refs.searchBarForm.formInline.statisticType = '1';
}
});
this.$refs.searchBarForm.formInline.statisticType = '1';
this.listQuery.statisticType = '1';
this.getDataList();
this.getPdLineList();
},
this.getDataList()
this.getPdLineList()
},
methods: {
selectType(val) {
// 报表类型切换时的回调(如需扩展可在此添加逻辑)
console.log('报表类型切换:', val);
},
handleClick(val) {
console.log('操作按钮点击:', val);
console.log(val);
if (val.type === 'edit') {
this.addOrUpdateVisible = true;
// Vue2 中 $nextTick 确保子组件已渲染
this.addOrUpdateVisible= true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data);
});
}
},
getPdLineList() {
getPdList().then(res => {
// Vue2 中数组赋值需确保响应式
this.$set(this.formConfig[1], 'selectOptions', res.data || []);
this.pdLineList = res.data || [];
}).catch(err => {
console.error('获取产线列表失败:', err);
});
},
selectChange(val) {
console.log('选择变更:', val);
this.selectedList = val;
},
getPdLineList() {
getPdList().then((res) => {
this.formConfig[1].selectOptions = res.data || []
this.pdLineList = res.data || []; // 保存产线数据
})
},
selectChange(val) {
console.log(val)
this.selectedList = val
},
buttonClick(val) {
console.log('头部按钮点击:', val);
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
console.log('val', val);
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.bindObjectId = val.bindObjectId ? val.bindObjectId : undefined;
this.listQuery.statisticType = val.statisticType ? val.statisticType : undefined;
this.listQuery.startTime = val.timeVal ? val.timeVal[0]: undefined;
this.listQuery.endTime = val.timeVal ? val.timeVal[1]: undefined;
// 处理不同时间维度的时间范围
this.handleTimeRange(val);
this.getDataList();
break;
case 'export':
this.handleExport();
break;
default:
console.log('未知按钮:', val);
}
},
// 处理不同时间维度的时间范围
handleTimeRange(val) {
const statisticType = val.statisticType;
const timeVal = val.timeVal;
const timeValDay = val.timeValDay;
const timeValWeek = val.timeValWeek;
const timeValMonth = val.timeValMonth;
const timeValYear = val.timeValYear;
// 重置时间参数
this.listQuery.startTime = undefined;
this.listQuery.endTime = undefined;
switch (statisticType) {
case '0': // 班组 - 沿用原时间范围
if (timeVal && timeVal.length === 2) {
this.listQuery.startTime = timeVal[0];
this.listQuery.endTime = timeVal[1];
}
break;
case '1': // 日 - 沿用原时间范围
if (timeValDay && timeValDay.length === 2) {
this.listQuery.startTime = timeValDay[0];
this.listQuery.endTime = timeValDay[1];
}
break;
case '3': // 月 - 沿用原时间范围
if (timeValMonth && timeValMonth.length === 2) {
this.listQuery.startTime = timeValMonth[0];
this.listQuery.endTime = timeValMonth[1];
}
break;
case '2': // 周 - 自动计算本周范围
if (timeValWeek) {
const [start, end] = getSelectedWeekRange(timeValWeek);
this.listQuery.startTime = formatDateTime(start);
this.listQuery.endTime = formatDateTime(end);
}
break;
case '4': // 年 - 自动计算本年范围
if (timeValYear) {
const [start, end] = getSelectedYearRange(timeValYear);
this.listQuery.startTime = formatDateTime(start);
this.listQuery.endTime = formatDateTime(end);
}
break;
}
},
// 获取数据列表
//this.listQuery.reportEndTime = val.timeVal ? [new Date(val.timeVal[1]).getTime()] : undefined;
this.getDataList();
break;
case 'export':
this.handleExport();
break;
default:
console.log(val);
}
},
// 获取数据列表
getDataList() {
this.dataListLoading = true;
this.urlOptions.getDataListURL(this.listQuery)
.then(response => {
const arr = ['班组', '日', '周', '月', '年'];
// Vue2 中数组赋值确保响应式
this.tableData = (response.data?.list || []).map(item => {
item.reportType = arr[this.listQuery.statisticType] || '';
item.statisticType = this.listQuery.statisticType;
this.urlOptions.getDataListURL(this.listQuery).then(response => {
const arr = ['班组','日', '周', '月', '年'];
this.tableData = response.data?.list?.map((item) => {
item.reportType = arr[this.listQuery.statisticType];
item.statisticType = this.listQuery.statisticType
// 匹配产线名称
const targetLine = this.pdLineList.find(line => line.id === item.bindObjectId);
item.bindObjectName = targetLine ? targetLine.name : '';
return item;
});
this.listQuery.total = response.data?.total || 0;
})
.catch(err => {
console.error('获取数据失败:', err);
this.tableData = [];
this.listQuery.total = 0;
})
.finally(() => {
this.dataListLoading = false;
// 匹配 bindObjectName
const targetLine = this.pdLineList.find(line => line.id === item.bindObjectId);
item.bindObjectName = targetLine ? targetLine.name : ''; // 赋值名称,无匹配则为空
return item;
});
this.listQuery.total = response.data.total;
this.dataListLoading = false;
});
},
// 每页数变更
// 每页数
sizeChangeHandle(val) {
this.listQuery.pageSize = val;
this.listQuery.pageNo = 1;
this.getDataList();
},
// 当前页变更
// 当前页
currentChangeHandle(val) {
this.listQuery.pageNo = val;
this.getDataList();
},
// 导出处理
handleExport() {
const params = { ...this.listQuery };
// 移除分页参数
delete params.pageNo;
delete params.pageSize;
delete params.total;
this.$modal.confirm('是否确认导出原片报表?')
.then(() => {
this.exportLoading = true;
return exportCostOriginRadioHisData(params);
})
.then(response => {
this.$download.excel(response, '原片报表.xls');
})
.catch(err => {
console.error('导出失败:', err);
})
.finally(() => {
this.exportLoading = false;
});
// 处理查询参数
let params = { ...this.listQuery };
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal.confirm('是否确认导出原片报表?').then(() => {
this.exportLoading = true;
return exportCostOriginRadioHisData(params);
}).then(response => {
this.$download.excel(response, '原片报表.xls');
this.exportLoading = false;
}).catch(() => { });
}
},
// Vue2 中监听数据变化(如需)
watch: {
'listQuery.statisticType'(newVal) {
console.log('报表类型变更:', newVal);
// 可添加类型变更后的额外逻辑
}
}
},
};
</script>
<style scoped>
.app-container {
padding: 16px;
}
.no-data-bg {
height: 400px;
background-color: #f5f7fa;
display: flex;
align-items: center;
justify-content: center;
color: #999;
}
.right-aside {
margin-bottom: 16px;
}
</style>

View File

@@ -1,274 +0,0 @@
<template>
<div class="searchBarBox divHeight" ref="searchBarRef" :style="{ paddingRight: isFold ? '55px' : '0px' }">
<el-form :inline="true" ref="searchBarForm" :model="formInline" class="searchBar">
<span class="blue-block" v-if="removeBlue ? false : true"></span>
<template v-for="item in formConfig">
<el-form-item v-if="item.type !== ''" :key="item.param" :label="item.label ? item.label : ''"
:required="item.required ? item.required : false">
<el-input v-if="item.type === 'input'" v-model="formInline[item.param]"
:size="item.size ? item.size : 'small'" clearable :disabled="item.disabled ? item.disabled : false"
:style="item.width ? 'width:' + item.width + 'px' : 'width:200px'"
:placeholder="item.placeholder ? item.placeholder : ''" />
<el-select v-if="item.type === 'select'" v-model="formInline[item.param]"
:size="item.size ? item.size : 'small'" :filterable="item.filterable ? item.filterable : false"
:multiple="item.multiple ? item.multiple : false" :clearable="item.clearable === false ? false : true"
:style="item.width ? 'width:' + item.width + 'px' : 'width:200px'" :placeholder="item.label" @change="
item.onchange
? $emit('select-changed', {
param: item.param,
value: formInline[item.param]
})
: null
">
<el-option v-for="(sub, i) in item.selectOptions" :key="i"
:label="item.labelField ? sub[item.labelField] : sub['name']"
:value="item.valueField ? sub[item.valueField] : sub['id']" />
</el-select>
<el-date-picker v-if="item.type === 'datePicker'" :key="item.param" :size="item.size ? item.size : 'small'"
v-model="formInline[item.param]" :type="item.dateType" :format="item.format ? item.format : 'yyyy-MM-dd'"
:value-format="item.valueFormat ? item.valueFormat : null" :default-time="item.defaultTime || null"
:range-separator="item.rangeSeparator || null" :start-placeholder="item.startPlaceholder || null"
:end-placeholder="item.endPlaceholder || null" :placeholder="item.placeholder"
:picker-options="item.pickerOptions ? item.pickerOptions : null"
:clearable="item.clearable === false ? false : true"
:style="item.width ? 'width:' + item.width + 'px' : (item.dateType === 'datetimerange' ? 'width:340px' : (item.dateType === 'daterange' ? 'width:220px' : 'width:140px'))" />
<el-autocomplete v-if="item.type === 'autocomplete'" v-model="formInline[item.param]"
:value-key="item.valueKey ? item.valueKey : 'value'" :size="item.size ? item.size : 'small'"
:fetch-suggestions="item.querySearch" :placeholder="item.placeholder"
:clearable="item.clearable === false ? false : true"
:style="item.width ? 'width:' + item.width + 'px' : 'width:200px'" filterable />
<el-cascader v-if="item.type === 'cascader'" v-model="formInline[item.param]" :options="item.selectOptions"
:props="item.cascaderProps" :size="item.size ? item.size : 'small'"
:clearable="item.clearable === false ? false : true"
:show-all-levels="item.showAllLevels === false ? false : true"
:collapse-tags="item.collapseTags === true ? true : false"
:style="item.width ? 'width:' + item.width + 'px' : 'width:200px'" @change="
item.onChange
? $emit('cascader-change', {
param: item.param,
value: formInline[item.param]
})
: null
"></el-cascader>
<el-button v-if="item.type === 'button'" :type="item.color" :size="item.size ? item.size : 'small'"
:plain="item.plain ? item.plain : false" :round="item.round ? item.round : false"
@click="headBtnClick(item.name)">{{ item.btnName }}</el-button>
<span v-if="item.type === 'separate'" class="separateStyle"></span>
<!-- 可用于显示其他按钮 -->
</el-form-item>
</template>
<el-form-item>
<slot></slot>
</el-form-item>
</el-form>
<span v-if="isFold" class="foldClass" @click='switchMode'>
{{ isExpand ? '收起' : '展开' }}
<i class="iconfont" :class="isExpand ? 'icon-upward' : 'icon-downward'"></i>
</span>
</div>
</template>
<script>
export default {
name: 'SearchBar',
props: {
formConfigs: {
type: Array,
default: () => {
return []
}
},
removeBlue: {
type: Boolean,
default: false
},
isFold: {// 多行模式(默认否)
type: Boolean,
default: false
}
},
data() {
const formInline = {}
const formConfig = this.formConfigs
let hasExtraOptions = false
for (const obj of formConfig) {
if (obj.type !== 'button') {
if (obj.defaultSelect === false || obj.defaultSelect === 0) {
formInline[obj.param] = obj.defaultSelect
} else {
formInline[obj.param] = obj.defaultSelect || '' // defaultSelect下拉框默认选中项
}
}
if (obj.extraOptions) {
hasExtraOptions = true
}
}
return {
formInline,
formConfig,
hasExtraOptions,
isExpand: false // 是否展开(默认否)
}
},
watch: {
formConfig: {
handler() {
for (const obj of this.formConfig) {
if (obj.defaultSelect) {
this.formInline[obj.param] = obj.defaultSelect
} else if (obj.defaultSelect === null) {
// 需要手动从外部清除选项缓存的情况确保在外部配置项中可直接设置null
this.formInline[obj.param] = ''
}
}
},
deep: true,
immediate: true
},
formInline: {
handler: function () {
this.$forceUpdate()
},
deep: true,
immediate: true
}
},
mounted() {
this.$nextTick(() => {
this.init()
})
},
methods: {
init() {
if (this.hasExtraOptions) {
// 如果有额外参数就处理,如果没有就算了
for (const obj of this.formConfig) {
if (obj.extraOptions) {
// 注: 对obj.extraOptions的选择是互斥的!
this.$watch(
`formInline.${obj.param}`,
function (newVal) {
let deleteCount = 0
if (obj.index + 1 < this.formConfig.length) {
// 如果obj不是最后一个配置
const nextConfig = this.formConfig[obj.index + 1]
if (nextConfig.parent && nextConfig.parent === obj.param)
deleteCount = 1
}
const currentConfig = Object.assign(
{},
obj.extraOptions[newVal]
)
this.formConfig.splice(
obj.index + 1,
deleteCount,
currentConfig
)
// 修改 formInline
this.$set(this.formInline, currentConfig.param, '')
},
{ immediate: true }
)
}
}
}
},
headBtnClick(btnName) {
this.formInline.btnName = btnName
this.$emit('headBtnClick', this.formInline)
},
resetForm() {
this.$refs.searchBarForm.resetFields()
const formInline = {}
const formConfig = this.formConfigs
for (const obj of formConfig) {
if (obj.type !== 'button') {
if (obj.defaultSelect === false || obj.defaultSelect === 0) {
formInline[obj.param] = obj.defaultSelect
} else {
formInline[obj.param] = obj.defaultSelect || '' // defaultSelect下拉框默认选中项
}
}
}
this.formInline = formInline
},
switchMode() {// 展开和收起切换
this.isExpand = !this.isExpand
const element = this.$refs.searchBarRef
if (this.isExpand) {
element.classList.remove('divHeight')
} else {
element.classList.add('divHeight')
}
}
}
}
</script>
<style>
.searchBarBox {
width: 100%;
position: relative;
margin-bottom: 8px;
}
.searchBarBox::after {
content: "";
display: block;
clear: both;
}
.divHeight {
height: 45px;
overflow: hidden;
}
.searchBar .blue-block {
display: inline-block;
float: left;
width: 4px;
height: 16px;
background-color: #0B58FF;
border-radius: 1px;
margin-right: 8px;
margin-top: 12px;
}
.searchBar .el-form-item {
margin-bottom: 4px;
}
.searchBar .el-date-editor .el-range__icon {
font-size: 16px;
color: #0B58FF;
}
.searchBar .el-input__prefix .el-icon-date {
font-size: 16px;
color: #0B58FF;
}
.searchBar .el-input__prefix .el-icon-time {
font-size: 16px;
color: #0B58FF;
}
.searchBar .separateStyle {
display: inline-block;
width: 1px;
height: 24px;
background: #E8E8E8;
vertical-align: middle;
}
.searchBarBox .foldClass {
position: absolute;
top: 14px;
right: 0;
cursor: pointer;
font-size: 12px;
color: #0B58FF;
}
.searchBarBox .foldClass .iconfont {
font-size: 14px;
}
</style>

View File

@@ -0,0 +1,65 @@
<!--
* @Author: zwq
* @Date: 2023-08-01 15:27:31
* @LastEditors: zwq
* @LastEditTime: 2023-08-01 16:25:54
* @Description:
-->
<template>
<div :class="[className, { 'p-0': noPadding }]">
<slot />
</div>
</template>
<script>
export default {
props: {
size: {
// 取值范围: xl lg md sm
type: String,
default: 'de',
validator: function (val) {
return ['xl', 'lg', 'de', 'md', 'sm'].indexOf(val) !== -1;
},
},
noPadding: {
type: Boolean,
default: false,
},
},
computed: {
className: function () {
return `${this.size}-title`;
},
},
};
</script>
<style lang="scss" scoped>
$pxls: (xl, 28px) (lg, 24px) (de, 20px) (md, 18px) (sm, 16px);
$mgr: 8px;
@each $size, $height in $pxls {
.#{$size}-title {
font-size: $height;
line-height: $height;
color: #000;
font-weight: 500;
font-family: '微软雅黑', 'Microsoft YaHei', Arial, Helvetica, sans-serif;
&::before {
content: '';
display: inline-block;
vertical-align: top;
width: 4px;
height: $height + 2px;
border-radius: 1px;
margin-right: $mgr;
background-color: #0b58ff;
}
}
}
.p-0 {
padding: 0;
}
</style>

View File

@@ -0,0 +1,442 @@
<!--
* @Author: zwq
* @Date: 2025-10-13 15:07:24
* @LastEditors: zwq
* @LastEditTime: 2025-11-07 15:35:14
* @Description:
-->
<template>
<div>
<div class="circle-container">
<div v-for="(item, index) in dotArr" :key="index" class="circle-wrapper">
<div
class="circle"
:style="{
background: stepNum == index + 1 ? '#0B58FF' : '',
}">
{{ index + 1 }}
</div>
<div
class="circle-text"
:style="{
color: stepNum == index + 1 ? '#0B58FF' : '',
}">
{{ item.name }}
</div>
<!-- 圆点后面的虚线 -->
<div v-if="index < 2" class="connector" />
</div>
</div>
<div v-if="stepNum == 1">
<div class="topTip">
1.可选择库区巷道同批次创建任务搬运仅支持同一产品型号
<br />
2.须在本页下方填写搬运数量搬运数量仅支持双数且数量当前可用库存总量
</div>
<small-title style="margin: 16px 0" size="sm" :no-padding="true">
步骤一选择产品及起点
</small-title>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-position="top"
label-width="80px">
<el-row :gutter="10">
<el-col :span="6">
<el-form-item label="搬运对象" prop="val1">
<el-select
style="width: 100%"
v-model="dataForm.val1"
placeholder="请选择搬运对象">
<el-option
v-for="item in options1"
:key="item.value"
:label="item.label"
:value="item.value"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6" v-if="dataForm.val1 == 1">
<el-form-item label="产品名称" prop="val1">
<el-select
style="width: 100%"
v-model="dataForm.val2"
placeholder="请选择产品名称">
<el-option
v-for="item in options1"
:key="item.value"
:label="item.label"
:value="item.value"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6" v-if="dataForm.val1 == 1">
<el-form-item label="规格型号" prop="val1">
<el-select
style="width: 100%"
v-model="dataForm.val2"
placeholder="请选择规格型号">
<el-option
v-for="item in options1"
:key="item.value"
:label="item.label"
:value="item.value"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="搬运数量" prop="val4">
<el-input
v-model="dataForm.val4"
oninput="value=value.replace(/^(0+)|[^\d]+/g,'')">
<template slot="append"></template>
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="10">
<el-col :span="12">
<el-form-item label="起点信息" prop="val5">
<el-radio-group v-model="dataForm.val5">
<el-radio :label="1">按策略自动选择</el-radio>
<el-radio :label="2">指定起点</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div v-if="dataForm.val5 == 2" class="potBG-div">
<div>
<el-row :gutter="10">
<el-col :span="10">
起点库区:
<el-select
style="width: 200px; margin-left: 10px"
v-model="startPot"
size="small"
placeholder="请选择起点库区">
<el-option
v-for="item in options1"
:key="item.value"
:label="item.label"
:value="item.value"></el-option>
</el-select>
</el-col>
<el-col :span="13" style="text-align: right; line-height: 36px">
<span
class="num1-startPot-status"
style="background-color: #5ab45a" />
可选
<span class="num1-startPot-status" />
不可选
<span
class="num1-startPot-status"
style="background-color: #e9b100" />
已选
</el-col>
</el-row>
<div class="potTitleBG">
<div v-for="item in Object.keys(startPotList)" :key="item">
<div class="potTitle">
{{ item }}
</div>
<div class="potList">
<div
class="pot"
v-for="sitem in startPotList[item]"
:key="sitem.id"
:style="{
backgroundColor: potBGcolor[sitem.status],
cursor: sitem.status > 0 ? 'pointer' : '',
}"
@click="sitem.status > 0 && setStartPot(sitem)"
:title="sitem.name">
{{ sitem.name }}
</div>
</div>
</div>
</div>
<el-divider></el-divider>
<div style="text-align: right">可用库存总量 <span style="color:#409EFF;font-size:16px">12</span> </div>
</div>
</div>
</div>
<div v-if="stepNum == 2">
<div class="topTip">
1.指定终点库位下发后会锁定所属巷道仅本批次任务进入
<br />
2.指定终点库位选位规则仅可从巷道最里空对位选位
<br />
3.只选择库区或巷道时该方式下当前终点为候选位置系统将根据策略与现场实际情况自动确定最终终点库位
</div>
<small-title style="margin: 16px 0" size="sm" :no-padding="true">
步骤二选择终点
</small-title>
</div>
<div v-if="stepNum == 3">
<small-title style="margin: 16px 0" size="sm" :no-padding="true">
步骤三预览与下发
</small-title>
</div>
</div>
</template>
<script>
import SmallTitle from './SmallTitle';
export default {
components: {
SmallTitle,
},
data() {
return {
dotArr: [
{
name: '选择起点',
},
{
name: '选择终点',
},
{
name: '预览下发',
},
],
potBGcolor: ['', '#dafadc', '#f8f0c4'],
stepNum: 1, // 当前第几步
//第一步参数
dataForm: {
id: undefined,
val1: undefined,
val2: undefined,
val3: undefined,
val4: undefined,
val5: 1,
},
options1: [
{
label: '产品',
value: 1,
},
{
label: '空盘',
value: 2,
},
],
dataRule: {},
startPot: undefined, //起点库区选择的类型
startPotList: {
//起点库区List
G01: [
{
id: '001',
name: 'L001',
status: 1,
},
{
id: '002',
name: 'R002',
status: 1,
},
{
id: '003',
name: 'L003',
status: 0,
},
{
id: '004',
name: 'R004',
status: 0,
},
],
G02: [
{
id: '005',
name: 'L005',
},
{
id: '006',
name: 'R006',
},
{
id: '007',
name: 'L007',
},
{
id: '008',
name: 'R008',
},
],
},
};
},
methods: {
init(id) {
this.dataForm.id = id || undefined;
this.$nextTick(() => {
if (this.dataForm.id) {
} else {
}
});
},
//上一步
upSubmit() {
if (this.stepNum == 2) {
this.stepNum -= 1;
this.$emit('setSN', this.stepNum);
} else if (this.stepNum == 3) {
this.stepNum -= 1;
this.$emit('setSN', this.stepNum);
}
},
//下一步
nextSubmit() {
if (this.stepNum == 1) {
this.stepNum += 1;
this.$emit('setSN', this.stepNum);
return;
}
if (this.stepNum == 2) {
this.stepNum += 1;
this.$emit('setSN', this.stepNum);
return;
}
if (this.stepNum == 3) {
this.stepNum = 1;
this.$emit('setSN', this.stepNum);
return;
}
},
cancelStep() {},
// 第一步方法
setStartPot(data) {
data.status = data.status == 1 ? 2 : 1;
},
},
};
</script>
<style scoped>
.topTip {
background-color: #ebebeb;
padding: 10px 20px;
border-radius: 5px;
line-height: 25px;
}
</style>
<!-- //库位点的样式 -->
<style scoped>
.potBG-div {
width: 100%;
margin: 10px;
border: 1px solid gainsboro;
box-shadow: 2px 2px 2px gainsboro, -1px -1px 3px gainsboro;
padding: 15px;
}
.num1-startPot-status {
margin-left: 5px;
display: inline-block;
width: 14px;
height: 14px;
border: 1px solid gainsboro;
}
.potTitleBG {
margin-top: 10px;
overflow-x: auto;
display: flex;
}
.potTitle {
width: 82px;
background-color: rgb(169, 235, 249);
border-radius: 3px;
margin-right: 5px;
text-align: center;
color: #000000;
letter-spacing: 1px;
margin-bottom: 10px;
}
.potList {
width: 82px;
display: grid;
grid-template-columns: 40px 40px;
gap: 2px;
}
.pot {
width: 40px;
text-align: center;
border: 1px solid gainsboro;
border-radius: 3px;
padding: 5px 0;
margin-bottom: 5px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
</style>
<!-- //序号圆点 -->
<style scoped>
.circle-container {
height: 110px;
display: flex;
align-items: center;
justify-content: center;
padding: 20px;
width: 90%;
overflow-x: auto;
margin: auto;
}
.circle-wrapper {
position: relative;
display: flex;
align-items: center;
}
.circle {
width: 52px;
height: 52px;
border-radius: 50%;
background: #8db1ff;
font-weight: 500;
font-size: 31px;
color: #ffffff;
display: flex;
justify-content: center;
align-items: center;
position: relative;
z-index: 2;
cursor: pointer;
}
.circle-text {
position: absolute;
top: 60px;
left: -15px;
color: #8db1ff;
width: 82px;
text-align: center;
}
/* 下半圆虚线边框 */
.circle::after {
content: '';
position: absolute;
bottom: -6px; /* 2px边框 + 2px间隙 */
left: -4px;
right: -4px;
height: 30px; /* 半圆高度 */
border-radius: 0 0 60px 60px;
border: 1px dashed #0b58ff;
border-top: none;
z-index: 1;
}
.connector {
width: 160px; /* 计算连接线长度 */
height: 2px;
border-bottom: 1px dashed rgb(11, 88, 255, 1);
margin: 0 5px;
z-index: 1;
}
</style>

View File

@@ -0,0 +1,273 @@
<!--
* @Author: zwq
* @Date: 2025-11-07 17:01:51
* @LastEditors: zwq
* @LastEditTime: 2025-11-07 22:31:17
* @Description:
-->
<template>
<el-drawer
:visible.sync="visible"
:with-header="false"
size="50%"
@close="closeD"
:show-close="false">
<div class="bgDiv1">
<el-row :gutter="20" style="margin-bottom: 15px">
<el-col :span="8" style="font-size: 20px; font-weight: 600">
TSK202510230001
</el-col>
<el-col :span="8">满盘搬运自动</el-col>
<el-col :span="8">
上次刷新{{ parseTime(Date.now()) }}
<el-button type="text" @click="refresh">刷新</el-button>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8">任务状态</el-col>
<el-col :span="8">优先级</el-col>
<el-col :span="8">执行车辆</el-col>
</el-row>
<el-row :gutter="20" style="margin-bottom: 15px">
<el-col :span="8">
<span
:style="{ backgroundColor: statusColor[1].color }"
class="taskStatus">
{{ statusColor[1].label }}
</span>
</el-col>
<el-col :span="8"></el-col>
<el-col :span="8">--</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8">执行时长</el-col>
<el-col :span="8">创建人</el-col>
<el-col :span="8">创建时间</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8">--</el-col>
<el-col :span="8">系统/张三</el-col>
<el-col :span="8">{{ parseTime(Date.now()) }}</el-col>
</el-row>
</div>
<div class="bgDiv2">
<el-steps
:active="stepNum"
finish-status="success"
:process-status="stepStatus"
align-center>
<el-step title="待下发"></el-step>
<el-step title="待执行"></el-step>
<el-step title="执行中"></el-step>
<el-step title="已完成"></el-step>
</el-steps>
<div class="abnormal">任务异常无效路径</div>
</div>
<div class="bgDiv3">
<small-title style="margin: 0 0 8px 0" size="sm" :no-padding="true">
搬运对象
</small-title>
<el-row :gutter="20">
<el-col :span="12">
<div class="pan-info">
<div class="pan-title">L盘</div>
</div>
</el-col>
<el-col :span="12">
<div class="pan-info">
<div class="pan-title">R盘</div>
</div>
</el-col>
</el-row>
</div>
<div class="bgDiv4">
<small-title style="margin: 0 0 8px 0" size="sm" :no-padding="true">
回收信息
</small-title>
<el-descriptions :column="2" size="medium" border>
<el-descriptions-item label="回收方式">他车回收</el-descriptions-item>
<el-descriptions-item label="回收任务编号">
18100000000
</el-descriptions-item>
<el-descriptions-item label="回收库位">
CK-01-A05-L / R
</el-descriptions-item>
<el-descriptions-item label="执行车辆">AGV-06</el-descriptions-item>
</el-descriptions>
</div>
<div class="bgDiv5">
<small-title style="margin: 0 0 8px 0" size="sm" :no-padding="true">
任务明细
</small-title>
<el-descriptions :column="2" size="medium" border>
<el-descriptions-item label="起点库位(L/R)">
CK-01-A05-L / R
</el-descriptions-item>
<el-descriptions-item label="终点库位(L/R)">
CC-02-B03-L/R (候选 )
</el-descriptions-item>
<el-descriptions-item label="起点策略">--</el-descriptions-item>
<el-descriptions-item label="终点策略">入库策略</el-descriptions-item>
<el-descriptions-item label="FMS任务号">--</el-descriptions-item>
<el-descriptions-item label="车辆位置">--</el-descriptions-item>
<el-descriptions-item label="电量">--</el-descriptions-item>
<el-descriptions-item label="是否载货">--</el-descriptions-item>
<el-descriptions-item label="创建方式">自动/人工</el-descriptions-item>
<el-descriptions-item label="任务来源">
PDA/PC/系统
</el-descriptions-item>
<el-descriptions-item label="关联叫料单">--</el-descriptions-item>
<el-descriptions-item label=""></el-descriptions-item>
</el-descriptions>
</div>
<div class="bgDiv6">
<small-title style="margin: 0 0 8px 0" size="sm" :no-padding="true">
任务日志
</small-title>
<el-timeline style="padding: 0">
<el-timeline-item
v-for="(activity, index) in activities"
:key="index"
:type="activity.type"
:color="activity.color"
size="large"
hide-timestamp>
<span>{{ activity.content }}</span>
<span style="float: right">{{ activity.timestamp }}</span>
</el-timeline-item>
</el-timeline>
</div>
<el-divider></el-divider>
<!-- 底部按钮 -->
<div class="drawer-body__footer">
<el-button @click="closeD"> </el-button>
</div>
</el-drawer>
</template>
<script>
import SmallTitle from './SmallTitle';
export default {
name: '',
data() {
return {
visible: false,
title: '',
statusColor: [
//bgDiv1的任务状态
{ label: '待下发', color: '#fa8c16' },
{ label: '待执行', color: '#1890ff' },
{ label: '执行中', color: '#1890ff' },
{ label: '已完成', color: '#52c41a' },
{ label: '暂停中', color: '#8c8c8c' },
{ label: '已终止', color: '#faad14' },
{ label: '异常', color: '#ff4d4f' },
{ label: '禁用', color: '#d9d9d9' },
],
//bgDiv2的步骤条
stepNum: 2,
stepStatus: 'finish',
//bgDiv6的时间线
activities: [
{
content: 'FMS | 卸货完成,任务完成',
timestamp: '2018-04-12 20:46',
type: 'primary',
},
{
content: 'FMS | 取货完成',
timestamp: '2018-04-03 20:46',
},
{
content: 'FMS | 派车AGV-03前往起点取货',
timestamp: '2018-04-03 20:46',
},
{
content: '张三 | 任务扫码配对完成,进入待下发',
timestamp: '2018-04-03 20:46',
},
],
};
},
components: {
SmallTitle,
},
created() {},
methods: {
init(val) {
this.visible = true;
},
//刷新
refresh() {},
closeD() {
this.visible = false
this.$emit('closeDrawer');
},
},
};
</script>
<style lang="scss" scoped>
.bgDiv1 {
background-color: rgba(242, 242, 242, 0.5);
padding: 20px;
line-height: 25px;
font-size: 15px;
border-bottom: 1px solid rgba(121, 121, 121, 0.5);
.taskStatus {
text-align: center;
border-radius: 3px;
padding: 2px 5px;
color: #fff;
}
}
.bgDiv2 {
border-bottom: 1px solid rgba(121, 121, 121, 0.5);
padding: 18px 0;
.abnormal {
width: 80%;
margin: auto;
border-radius: 5px;
height: 40px;
font-size: 22px;
line-height: 40px;
text-align: center;
background-color: rgba(217, 0, 27, 0.1);
color: rgba(217, 0, 27, 1);
border: 1px solid rgba(217, 0, 27, 1);
}
}
.bgDiv3 {
padding: 20px 20px 0;
.pan-info {
height: 350px;
border: 1px solid rgba(121, 121, 121, 0.8);
border-radius: 5px;
.pan-title {
background-color: rgba(242, 242, 242, 0.5);
height: 35px;
font-size: 20px;
line-height: 35px;
padding: 0 20px;
border-bottom: 1px solid rgba(121, 121, 121, 0.5);
letter-spacing: 2px;
}
}
}
.bgDiv4 {
padding: 20px 20px 0;
}
.bgDiv5 {
padding: 20px 20px 0;
}
.bgDiv6 {
padding: 20px 20px 0;
}
.drawer-body__footer {
display: flex;
justify-content: flex-end;
padding: 0 18px 10px;
}
</style>

View File

@@ -0,0 +1,65 @@
<!--
* @Author: zwq
* @Date: 2025-11-08 17:44:05
* @LastEditors: zwq
* @LastEditTime: 2025-11-08 18:13:25
* @Description:
-->
<template>
<div>
<div>请选择要执行的终止方式系统会根据选择进行处理</div>
<el-radio-group v-model="radio" class="stockRadioDiv">
<el-radio :label="1" border style="margin: 10px 0">
仅终止稍后回收
<div style="font-weight: 400">
任务立即终止车辆保持暂停稍后可在任务列表中手动回收
</div>
</el-radio>
<el-radio :label="2" border style="margin: 10px 0">
终止并立即回收
<div style="font-weight: 400">
任务立即终止立即选择货物回收方式生成任务或更新卸货点
</div>
</el-radio>
</el-radio-group>
<div>
终止原因
<el-input
type="textarea"
:rows="3"
style="margin: 10px 0"
placeholder="请输入终止原因"
v-model="textarea" />
</div>
</div>
</template>
<script>
export default {
data() {
return {
radio: 1,
textarea: '',
};
},
methods: {
init(val) {},
submit() {
if(this.textarea){
}else{
this.$message('请输入终止原因');
}
},
},
};
</script>
<style scoped>
.stockRadioDiv >>> .el-radio--medium.is-bordered {
display: flex;
align-items: center;
height: 70px;
line-height: 20px;
}
</style>

View File

@@ -0,0 +1,32 @@
<!--
* @Author: zwq
* @Date: 2025-10-13 16:18:41
* @LastEditors: zwq
* @LastEditTime: 2025-11-06 15:19:24
* @Description:
-->
<template>
<span>
{{
(injectData.val2
? ['满盘搬运', '空盘搬运', '备料搬运', '临时搬运'][injectData.val2]
: '-')
}}
</span>
</template>
<script>
export default {
props: {
injectData: {
type: Object,
default: () => ({}),
},
},
data() {
return {};
},
created() {},
methods: {},
};
</script>

View File

@@ -0,0 +1,32 @@
<!--
* @Author: zwq
* @Date: 2025-10-13 16:18:41
* @LastEditors: zwq
* @LastEditTime: 2025-11-06 15:20:43
* @Description:
-->
<template>
<span>
{{
(injectData.val3
? ['待下发', '待执行', '执行中', '已完成', '暂停中', '已终止', '异常'][injectData.val3]
: '-')
}}
</span>
</template>
<script>
export default {
props: {
injectData: {
type: Object,
default: () => ({}),
},
},
data() {
return {};
},
created() {},
methods: {},
};
</script>

View File

@@ -0,0 +1,57 @@
<!--
* @Author: zwq
* @Date: 2025-10-13 16:18:41
* @LastEditors: zwq
* @LastEditTime: 2025-11-06 15:37:02
* @Description:
-->
<template>
<div>
<div style="display: flex; align-items: center">
<div
style="
width: 16px;
height: 16px;
border-radius: 5px;
background-color: #e89b24;
color: #fff;
text-align:center;
line-height:16px
">
L
</div>
产品名称+产品规格
</div>
<div style="display: flex; align-items: center">
<div
style="
width: 16px;
height: 16px;
border-radius: 5px;
background-color: #6a96ec;
color: #fff;
text-align:center;
line-height:16px
">
R
</div>
产品名称+产品规格
</div>
</div>
</template>
<script>
export default {
props: {
injectData: {
type: Object,
default: () => ({}),
},
},
data() {
return {};
},
created() {},
methods: {},
};
</script>

View File

@@ -0,0 +1,32 @@
<!--
* @Author: zwq
* @Date: 2025-10-13 16:18:41
* @LastEditors: zwq
* @LastEditTime: 2025-11-06 15:19:24
* @Description:
-->
<template>
<span>
{{
(injectData.val2
? ['满盘搬运', '空盘搬运', '备料搬运', '临时搬运'][injectData.val2]
: '-')
}}
</span>
</template>
<script>
export default {
props: {
injectData: {
type: Object,
default: () => ({}),
},
},
data() {
return {};
},
created() {},
methods: {},
};
</script>

View File

@@ -0,0 +1,23 @@
<!--
* @Author: zwq
* @Date: 2023-12-05 13:45:59
* @LastEditors: zwq
* @LastEditTime: 2024-04-15 17:12:03
* @Description
-->
<template>
<div>
<span>{{ parseTime(injectData.startTime,'{y}年{m}月{d}日') + '-' + (parseTime(injectData.endTime)?parseTime(injectData.endTime,'{y}年{m}月{d}日'):'永久') }}</span>
</div>
</template>
<script>
export default {
name: '',
props: {
injectData: {
type: Object,
default: () => ({}),
},
},
};
</script>

View File

@@ -1,145 +1,5 @@
<template>
<div class="home-page">
<div class="date-tabs">
<!-- @tab-click="handleClick" -->
<el-tabs v-model="activeName" @tab-click="timedayChange" :stretch="true">
<el-tab-pane
:label="'\u2002\u2002日\u2002\u2002'"
name="日"></el-tab-pane>
<el-tab-pane
:label="'\u2002\u2002周\u2002\u2002'"
name="周"></el-tab-pane>
<el-tab-pane
:label="'\u2002\u2002月\u2002\u2002'"
name="月"></el-tab-pane>
<el-tab-pane
:label="'\u2002\u2002年\u2002\u2002'"
name="年"></el-tab-pane>
</el-tabs>
<div class="detail">
<el-date-picker
v-model="timeday"
align="right"
type="date"
format="yyyy-MM-dd"
valueFormat="yyyy-MM-dd"
:clearable="false"
@change="timedayChange"
placeholder="选择日期"
:picker-options="pickerOptions"></el-date-picker>
</div>
</div>
<el-row class="main-top" :gutter="16">
<el-col :span="24" style="position: relative">
<div class="title">
<svg-icon icon-class="home-produce" />
<span class="title-inner">生产总成本</span>
</div>
<el-row class="box">
<el-col :span="4" class="num-box shadow">
<div class="num-style">{{ homeData.priceS }}万元</div>
<div class="unit-style">总计成本</div>
</el-col>
<el-col :span="4" class="num-box shadow">
<div class="num-style">{{ homeData.matPriceS }}万元</div>
<div class="unit-style">原料成本</div>
</el-col>
<el-col :span="4" class="num-box shadow">
<div class="num-style">{{ homeData.energyPriceS }}万元</div>
<div class="unit-style">能源成本</div>
</el-col>
<el-col :span="4" class="num-box shadow">
<div class="num-style">{{ homeData.otherPriceS }}万元</div>
<div class="unit-style">其他成本</div>
</el-col>
<!-- <el-col :span="4" class="num-box shadow">
<div class="num-style">{{ homeData.ratioS }}</div>
<div class="unit-style">综合良品率/%</div>
</el-col> -->
<el-col :span="4" class="num-box shadow">
<div class="num-style">{{ homeData.areaPriceS }}</div>
<div class="unit-style">综合每平米成本</div>
</el-col>
</el-row>
</el-col>
<el-col :span="24" style="position: relative">
<div class="title">
<svg-icon icon-class="home-produce" />
<span class="title-inner">原片成本</span>
</div>
<el-row class="box">
<el-col :span="4" class="num-box shadow">
<div class="num-style">{{ homeData.priceO }}万元</div>
<div class="unit-style">原片总成本</div>
</el-col>
<el-col :span="4" class="num-box shadow">
<div class="num-style">{{ homeData.matPriceO }}万元</div>
<div class="unit-style">原料成本</div>
</el-col>
<el-col :span="4" class="num-box shadow">
<div class="num-style">{{ homeData.energyPriceO }}万元</div>
<div class="unit-style">能源成本</div>
</el-col>
<el-col :span="4" class="num-box shadow">
<div class="num-style">{{ homeData.otherPriceO }}万元</div>
<div class="unit-style">其他成本</div>
</el-col>
<el-col :span="4" class="num-box shadow">
<div class="num-style">{{ homeData.ratioO }}</div>
<div class="unit-style">原片良品率/%</div>
</el-col>
<el-col :span="4" class="num-box shadow">
<div class="num-style">{{ homeData.areaPriceO }}</div>
<div class="unit-style">原片每平米成本</div>
</el-col>
</el-row>
</el-col>
<el-col :span="24" style="position: relative">
<div class="title">
<svg-icon icon-class="home-produce" />
<span class="title-inner">深加工成本</span>
</div>
<el-row class="box">
<el-col :span="4" class="num-box shadow">
<div class="num-style">{{ homeData.priceD }}万元</div>
<div class="unit-style">深加工总成本</div>
</el-col>
<el-col :span="4" class="num-box shadow">
<div class="num-style">{{ homeData.energyPriceD }}万元</div>
<div class="unit-style">能源成本</div>
</el-col>
<el-col :span="4" class="num-box shadow">
<div class="num-style">{{ homeData.otherPriceD }}万元</div>
<div class="unit-style">其他成本</div>
</el-col>
<el-col :span="4" class="num-box shadow">
<div class="num-style">{{ homeData.ratioD }}</div>
<div class="unit-style">深加工良品率/%</div>
</el-col>
<el-col :span="4" class="num-box shadow">
<div class="num-style">{{ homeData.areaPriceD }}</div>
<div class="unit-style">深加工每平米成本</div>
</el-col>
</el-row>
</el-col>
</el-row>
<el-row class="main-bottom" :gutter="16" v-if="false">
<el-col :span="9">
<div class="chart-wrapper">
<line-chart :chart-data="lineChartData" />
</div>
</el-col>
<el-col :span="7">
<div class="chart-wrapper">
<pie-chart />
</div>
</el-col>
<el-col :span="8">
<div class="chart-wrapper">
<bar-chart />
</div>
</el-col>
</el-row>
<div
class="main-footer"
style="
@@ -157,267 +17,29 @@
</template>
<script>
import moment from 'moment';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
import LineChart from '../dashboard/LineChart';
import PieChart from '../dashboard/PieChart';
import BarChart from '../dashboard/BarChart';
import PanelGroup from '../dashboard/PanelGroup';
import { getData } from '@/api/cost/allCost';
import { getUserProfile } from '@/api/system/user';
const lineChartData = {
newVisitis: {
expectedData: [100, 120, 161, 134, 105, 160, 165],
actualData: [120, 82, 91, 154, 162, 140, 145],
},
messages: {
expectedData: [200, 192, 120, 144, 160, 130, 140],
actualData: [180, 160, 151, 106, 145, 150, 130],
},
purchases: {
expectedData: [80, 100, 121, 104, 105, 90, 100],
actualData: [120, 90, 100, 138, 142, 130, 130],
},
shoppings: {
expectedData: [130, 140, 141, 142, 145, 150, 160],
actualData: [120, 82, 91, 154, 162, 140, 130],
},
};
export default {
name: 'Home',
mixins: [tableHeightMixin],
components: {
LineChart,
PieChart,
PanelGroup,
BarChart,
},
computed: {
gradientBackground() {
return {
'background-image':
'linear-gradient(90deg, #f0f0f0 25%, rgba(255, 255, 255, 0) 25%, rgba(255, 255, 255, 0) 50%, #f0f0f0 50%, #f0f0f0 75%, rgba(255, 255, 255, 0) 75%, rgba(255, 255, 255, 0))',
'background-size': '100px 100px', // 调整条纹的大小
};
},
},
mixins: [],
components: {},
computed: {},
data() {
return {
activeName: '日',
user: '',
lineChartData: lineChartData.newVisitis,
homeData: {},
timeday: moment(new Date()).subtract(1, 'days').format('YYYY-MM-DD'),
startTime:
moment(new Date()).subtract(0, 'days').format('YYYY-MM-DD') +
' 00:00:00',
endTime:
moment(new Date()).subtract(-1, 'days').format('YYYY-MM-DD') +
' 00:00:00',
pickerOptions: {
disabledDate(time) {
return time.getTime() + 3600 * 1000 * 24 > Date.now();
},
shortcuts: [
{
text: '今天',
onClick(picker) {
picker.$emit('pick', new Date());
},
},
{
text: '昨天',
onClick(picker) {
const date = new Date();
date.setTime(date.getTime() - 3600 * 1000 * 24);
picker.$emit('pick', date);
},
},
{
text: '一周前',
onClick(picker) {
const date = new Date();
date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);
picker.$emit('pick', date);
},
},
],
},
};
return {};
},
created() {
},
beforeDestroy() {
},
methods: {
getData() {
let listQuery = {
//分页
pageSize: 10,
pageNo: 1,
statisticType: ['', '日', '周', '月', '年'].indexOf(this.activeName),
startTime: this.timeday + ' 00:00:00',
};
getData(listQuery).then((response) => {
this.homeData = response.data;
for (let i in this.homeData) {
this.homeData[i] = Number(this.homeData[i]).toFixed(2);
}
});
},
timedayChange() {
let listQuery = {
//分页
pageSize: 10,
pageNo: 1,
statisticType: ['', '日', '周', '月', '年'].indexOf(this.activeName),
startTime: this.timeday + ' 00:00:00',
};
getData(listQuery).then((response) => {
this.homeData = response.data;
for (let i in this.homeData) {
this.homeData[i] = Number(this.homeData[i]).toFixed(2);
}
});
},
goDetail() {
this.$router.push({ path: 'indexDetail' });
},
},
};
</script>
<style lang="scss" scoped>
.home-page::before {
background-image: url('~@/assets/img/home-bg.png');
background-size: cover;
background-repeat: no-repeat;
background-position: center;
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
transform: rotate(180deg);
}
.date-tabs {
padding-left: 40px;
padding-top: 20px;
position: relative;
margin-bottom: 20px;
}
:deep(.date-tabs) {
.el-tabs__header {
margin-bottom: 8px;
display: inline-block;
transform: translateY(-12px);
}
.el-tabs__content {
overflow: visible;
}
.el-tabs__item {
font-size: 18px;
color: #fff;
padding-left: 0 !important;
padding-right: 0 !important;
line-height: 36px !important;
height: 36px;
}
.el-tabs__item.is-active {
color: #0b58ff;
}
}
.detail {
display: inline-block;
position: absolute;
left: 260px;
top: 10px;
}
:deep(.detail) {
.el-input__inner {
background-color: transparent;
color: white;
}
}
// .current-date {
// color: #fff;
// font-size: 18px;
// position: absolute;
// left: 260px;
// top: 14px;
// }
.current-time {
color: #fff;
font-size: 18px;
position: absolute;
right: 38px;
top: 14px;
}
.main-top {
width: 100%;
padding: 0 20px 0 40px;
.title {
position: absolute;
left: 34px;
top: 20px;
width: 180px;
font-size: 32px;
z-index: 10;
.title-inner {
position: absolute;
left: 42px;
top: 5px;
font-size: calc(100vw * 20 / 1920);
}
}
.box {
background-color: #fff;
border-radius: 24px;
height: 192px;
padding: 40px 24px 32px 24px;
margin-bottom: 20px;
box-shadow: 0 8px 8px 0 gray;
.num-box {
height: 120px;
padding-top: 26px;
text-align: center;
.num-style {
color: #000;
font-size: calc(100vw * 40 / 1920);
}
.unit-style {
color: rgba(0, 0, 0, 0.7);
font-size: calc(100vw * 18 / 1920);
}
}
.shadow {
background: linear-gradient(90deg, #ffffff 80%, #f2f4f9 100%);
}
}
}
.main-bottom {
width: 100%;
margin-top: 20px;
.chart-wrapper {
margin-left: 10px;
height: 425px;
background: #fff;
border-radius: 5px;
box-shadow: 0 3px 3px 0 gray;
}
}
</style>
<style lang="scss">
.home-page {
.el-progress-bar__inner {
background-image: url('~@/assets/img/home-progress-bg.png');
background-size: cover;
}
}
</style>

View File

@@ -0,0 +1,35 @@
<template>
<el-switch
@change="changeStatus"
size="small"
v-model="list.enabled"
:active-value="1"
:inactive-value="0"></el-switch>
</template>
<script>
import { updateGroup } from '@/api/group/groupSetting';
export default {
props: {
injectData: {
type: Object,
default: () => ({}),
},
},
data() {
return {
list: this.injectData,
};
},
created() {},
methods: {
changeStatus(val) {
const data = { ...this.injectData, enabled: val };
updateGroup(data).then((res) => {
this.$modal.msgSuccess('修改成功');
this.$emit('emitData');
});
},
},
};
</script>

View File

@@ -1,134 +0,0 @@
<template>
<el-dialog :visible.sync="visible" width="40%">
<small-title slot="title" :no-padding="true">
{{ this.dataForm.lineId + '·' + this.dataForm.equipmentName }}
</small-title>
<div class="content">
<div class="visual-part">
<base-table :table-props="tableProps"
:page="listQuery.pageNo" :limit="listQuery.pageSize" :table-data="tableData">
<!-- <method-btn v-if="tableBtn.length" slot="handleBtn" :width="120" label="操作" :method-list="tableBtn"
@clickBtn="handleClick" /> -->
</base-table>
</div>
</div>
<!-- <div slot="footer" class="dialog-footer">
<el-button style="" @click="goback()">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">
确定
</el-button>
</div> -->
</el-dialog>
</template>
<script>
const tableProps = [
{
prop: 'paramName',
label: '参数名称'
},
{
prop: 'paramValue',
label: '当前值',
// filter: parseTime,
// width: 160
},
];
import { getParamMonitor } from '@/api/base/equipment';
// import { parseTime } from '../../mixins/code-filter';
import SmallTitle from './SmallTitle';
export default {
components: { SmallTitle },
data() {
return {
visible: false,
tableProps,
tableData:[],
listQuery: {
pageNo: 1,
pageSize:100,
},
addOrUpdateVisible: false,
dataForm: {
equipmentId:undefined,
equipmentName: undefined,
lineId: undefined,
},
};
},
methods: {
init(data) {
console.log(data.paramMonitors,'data');
this.dataForm.equipmentId = data.equipmentId || '';
this.dataForm.equipmentName = data.equipmentName || '';
this.dataForm.lineId = data.lineId || '';
this.visible = true;
this.$nextTick(() => {
// this.$refs['dataForm'].resetFields();
// getParamMonitor({
// equipmentId:this.dataForm.equipmentId
// }).then((res) => {
this.tableData = data.paramMonitors
// })
});
}
},
};
</script>
<style scoped>
.drawer >>> .el-drawer {
border-radius: 8px 0 0 8px;
display: flex;
flex-direction: column;
}
.drawer >>> .el-form-item__label {
padding: 0;
}
.drawer >>> .el-drawer__header {
margin: 0;
padding: 32px 32px 24px;
border-bottom: 1px solid #dcdfe6;
}
.drawer >>> .el-drawer__body {
flex: 1;
height: 1px;
display: flex;
flex-direction: column;
}
.drawer >>> .content {
padding: 30px 24px;
flex: 1;
display: flex;
flex-direction: column;
/* height: 100%; */
}
.drawer >>> .visual-part {
flex: 1 auto;
max-height: 76vh;
overflow: hidden;
overflow-y: scroll;
padding-right: 10px; /* 调整滚动条样式 */
}
.drawer >>> .el-form,
.drawer >>> .attr-list {
padding: 0 16px;
}
.drawer-body__footer {
display: flex;
justify-content: flex-end;
padding: 18px;
}
</style>

View File

@@ -1,561 +0,0 @@
<template>
<el-dialog :visible.sync="visible" width="80%" @close="handleClose" title-class="dialog-title">
<small-title slot="title" :no-padding="true">
{{ dataForm.lineId + '·' + dataForm.equipmentName }}
</small-title>
<search-bar removeBlue :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
<el-tabs class="custom-tabs" v-model="activeLabel" :stretch="true" @tab-click="handleTabClick">
<el-tab-pane :label="'\u3000报警时长\u3000'" name="duration"></el-tab-pane>
<el-tab-pane :label="'\u3000报警次数\u3000'" name="times"></el-tab-pane>
</el-tabs>
<div class="content">
<div class="visual-part">
<div v-if="hasData" style="display: flex; justify-content: space-around; gap: 20px; padding: 10px 0;">
<!-- 移除 v-if始终渲染两个图表容器 -->
<div id="barChart" style="width: 48%; height: 400px;"></div>
<div id="pieChart" style="width: 48%; height: 400px;"></div>
</div>
<div v-if="!hasData" class="no-data">
<el-empty description="暂无相关报警数据"></el-empty>
</div>
</div>
</div>
</el-dialog>
</template>
<script>
import { getAlarmDet } from '@/api/base/equipment';
import * as echarts from 'echarts';
import SmallTitle from './SmallTitle';
const CHART_CONFIG = {
barColor: '#288AFF',
pieColors: [
'#288AFF', '#4096FF', '#69B1FF', '#91CFFF', '#B8E0FF',
'#E0F2FF', '#1890FF', '#096DD9', '#0050B3', '#003A8C'
],
fontColor: '#333',
lightFontColor: '#666',
borderRadius: 4
};
export default {
components: { SmallTitle },
data() {
return {
visible: false,
hasData: false,
listQuery: {
pageNo: 1,
pageSize: 100,
equipmentId: undefined,
startTime: undefined,
endTime: undefined
},
formConfig: [
{
type: 'datePicker',
label: '时间段',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'timestamp',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'timeVal',
defaultTime: ['00:00:00', '23:59:59'],
defaultSelect: []
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary'
}
],
activeLabel: 'duration', // 默认选中「报警时长」
dataForm: {
equipmentId: undefined,
equipmentName: undefined,
lineId: undefined
},
chartInstances: {
bar: null,
pie: null
},
isDomReady: false,
originData: null // 存储原始数据
};
},
mounted() {
this.$nextTick(() => {
this.isDomReady = true;
if (this.listQuery.equipmentId) {
this.getDataList();
}
});
},
watch: {
// Tab 切换时自动刷新图表(无需额外操作,依赖 handleTabClick 触发查询)
activeLabel() {
if (this.isDomReady && this.originData) {
this.$nextTick(() => {
this.renderBothCharts(); // 切换 Tab 后重新渲染两个图表
});
}
}
},
methods: {
initDefaultDate() {
const today = new Date();
const start = new Date(today.getFullYear(), today.getMonth(), today.getDate(), 0, 0, 0, 0).getTime();
const end = new Date(today.getFullYear(), today.getMonth(), today.getDate(), 23, 59, 59, 0).getTime();
this.formConfig[0].defaultSelect = [start, end];
this.listQuery.startTime = start;
this.listQuery.endTime = end;
if (this.$refs.searchBarForm) {
this.$refs.searchBarForm.form.timeVal = [start, end];
}
},
handleTabClick() {
// 切换 Tab 时重新查询数据(或直接复用已有数据渲染)
this.getDataList();
},
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.startTime = val.timeVal?.[0];
this.listQuery.endTime = val.timeVal?.[1];
this.getDataList();
break;
default:
}
},
async getDataList() {
try {
if (!this.listQuery.equipmentId) {
console.warn('设备ID不能为空');
this.hasData = false;
return;
}
const queryParams = {
equipmentId: this.listQuery.equipmentId,
startTime: this.listQuery.startTime,
endTime: this.listQuery.endTime,
};
const res = await getAlarmDet(queryParams);
const originData = res.data || [];
this.originData = originData;
this.hasData = originData.length > 0;
if (this.hasData && this.isDomReady) {
this.$nextTick(() => {
this.renderBothCharts(); // 数据查询成功后,同时渲染两个图表
});
} else {
this.destroyAllCharts();
}
} catch (error) {
console.error('获取报警数据失败:', error);
this.hasData = false;
this.destroyAllCharts();
}
},
// 核心方法:同时渲染柱状图和饼图(根据当前 Tab 类型)
renderBothCharts() {
if (this.activeLabel === 'duration') {
// 报警时长:柱状图(时长排序)+ 饼图(时长占比)
this.renderBarChart('duration');
this.renderPieChart('duration');
} else {
// 报警次数:柱状图(次数排序)+ 饼图(次数占比)
this.renderBarChart('times');
this.renderPieChart('times');
}
},
// 渲染柱状图(支持两种数据类型)
renderBarChart(type) {
this.destroyChart('bar');
const chartDom = document.getElementById('barChart');
if (!chartDom || !this.originData.length) return;
// 根据类型排序和提取数据
let sortedData, xData, seriesData, yAxisName;
if (type === 'duration') {
// 报警时长:按时长降序
sortedData = [...this.originData].sort((a, b) => b.alarmDuration - a.alarmDuration);
seriesData = sortedData.map(item => item.alarmDuration);
yAxisName = '报警时长';
} else {
// 报警次数:按次数降序
sortedData = [...this.originData].sort((a, b) => b.alarmCount - a.alarmCount);
seriesData = sortedData.map(item => item.alarmCount);
yAxisName = '报警次数';
}
xData = sortedData.map(item => this.truncateText(item.alarmContent, 8));
try {
this.chartInstances.bar = echarts.init(chartDom);
const option = {
title: {
text: `${yAxisName}统计(柱状图)`,
left: 'center',
textStyle: { fontSize: 14, color: CHART_CONFIG.fontColor }
},
tooltip: {
trigger: 'axis',
axisPointer: { type: 'shadow' },
padding: 10,
textStyle: { fontSize: 11 },
formatter: (params) => {
const index = params[0].dataIndex;
const item = sortedData[index];
return `
<div style="text-align: left;">
<div>${item.alarmContent}</div>
<div>${yAxisName}${type === 'duration' ? item.alarmDuration : item.alarmCount}</div>
<div>占比:${type === 'duration' ? item.alarmDurationRatio.toFixed(2) : item.alarmCountRatio.toFixed(2)}%</div>
</div>
`;
}
},
grid: {
left: '5%',
right: '5%',
bottom: '18%',
top: '15%',
containLabel: true
},
xAxis: [
{
type: 'category',
data: xData,
axisTick: { alignWithLabel: true },
axisLabel: {
interval: 0,
fontSize: 12,
color: CHART_CONFIG.lightFontColor
},
axisLine: { lineStyle: { color: '#e8e8e8' } }
}
],
yAxis: [
{
type: 'value',
name: yAxisName,
nameTextStyle: { fontSize: 11, color: CHART_CONFIG.lightFontColor },
axisLabel: {
fontSize: 11,
color: CHART_CONFIG.lightFontColor,
},
axisLine: { lineStyle: { color: '#e8e8e8' } },
splitLine: { lineStyle: { color: '#f5f5f5' } },
max: (value) => value.max * 1.2
}
],
series: [
{
name: yAxisName,
type: 'bar',
itemStyle: {
color: CHART_CONFIG.barColor,
borderRadius: [CHART_CONFIG.borderRadius, CHART_CONFIG.borderRadius, 0, 0],
shadowBlur: 3,
shadowColor: 'rgba(40, 138, 255, 0.2)',
shadowOffsetY: 2
},
barWidth: '16',
data: seriesData,
label: {
show: true,
position: 'top',
distance: 6,
fontSize: 11,
color: CHART_CONFIG.fontColor,
formatter: (params) => `${params.value}`
}
}
]
};
this.chartInstances.bar.setOption(option);
this.addResizeListener('bar');
} catch (error) {
console.error(`${yAxisName}柱状图初始化失败:`, error);
setTimeout(() => this.renderBarChart(type), 200);
}
},
// 渲染饼图(支持两种数据类型)
renderPieChart(type) {
this.destroyChart('pie');
const chartDom = document.getElementById('pieChart');
if (!chartDom || !this.originData.length) return;
// 根据类型处理饼图数据
let pieData, seriesName;
if (type === 'duration') {
// 报警时长:按时长占比处理
seriesName = '报警时长';
pieData = this.handlePieData(this.originData, 'alarmDuration', 'alarmDurationRatio');
} else {
// 报警次数:按次数占比处理
seriesName = '报警次数';
pieData = this.handlePieData(this.originData, 'alarmCount', 'alarmCountRatio');
}
try {
this.chartInstances.pie = echarts.init(chartDom);
const option = {
title: {
text: `${seriesName}统计(饼图)`,
left: 'center',
textStyle: { fontSize: 14, color: CHART_CONFIG.fontColor }
},
tooltip: {
trigger: 'item',
padding: 10,
textStyle: { fontSize: 11 },
formatter: (params) => {
return `
<div style="text-align: left;">
<div>${params.name}</div>
<div>${seriesName}${params.value}${type === 'duration' ? '' : '次'}</div>
<div>占比:${params.percent.toFixed(2)}%</div>
</div>
`;
}
},
series: [
{
name: seriesName,
type: 'pie',
radius: ['50%', '70%'],
center: ['50%', '55%'],
color: CHART_CONFIG.pieColors,
label: {
show: true,
position: 'outside',
distance: 15,
fontSize: 11,
color: CHART_CONFIG.lightFontColor,
formatter: (params) => {
const truncatedName = this.truncateText(params.name, 8);
return `${truncatedName}(${params.value}${type === 'duration' ? '' : '次'}, ${params.percent.toFixed(1)}%)`;
},
align: 'center',
baseline: 'middle'
},
labelLine: {
show: true,
length: 15,
length2: 20,
lineStyle: {
color: '#ccc',
width: 1,
type: 'solid'
},
smooth: 0.2
},
data: pieData,
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowColor: 'rgba(0, 0, 0, 0.1)'
},
label: {
color: CHART_CONFIG.fontColor,
fontSize: 12,
fontWeight: 500
},
labelLine: {
lineStyle: {
color: CHART_CONFIG.barColor,
width: 1.5
}
}
}
}
]
};
this.chartInstances.pie.setOption(option);
this.addResizeListener('pie');
} catch (error) {
console.error(`${seriesName}饼图初始化失败:`, error);
setTimeout(() => this.renderPieChart(type), 200);
}
},
// 通用饼图数据处理(支持动态字段)
handlePieData(data, valueKey, ratioKey) {
const threshold = 5; // 占比低于5%合并为「其他」
let otherCount = 0;
const mainData = data.filter(item => {
if (item[ratioKey] >= threshold) {
return true;
} else {
otherCount += item[valueKey];
return false;
}
}).map(item => ({
name: item.alarmContent,
value: item[valueKey],
ratio: item[ratioKey]
}));
if (otherCount > 0) {
mainData.push({
name: '其他',
value: otherCount,
ratio: 100 - mainData.reduce((sum, item) => sum + item.ratio, 0)
});
}
return mainData;
},
truncateText(text, maxLength) {
if (!text) return '';
return text.length > maxLength ? text.slice(0, maxLength) + '...' : text;
},
addResizeListener(type) {
const chart = this.chartInstances[type];
if (chart) {
const resizeHandler = () => chart.resize();
window.addEventListener('resize', resizeHandler);
chart.resizeHandler = resizeHandler;
}
},
destroyChart(type) {
const chart = this.chartInstances[type];
if (chart) {
window.removeEventListener('resize', chart.resizeHandler);
chart.dispose();
this.chartInstances[type] = null;
}
},
destroyAllCharts() {
Object.keys(this.chartInstances).forEach(type => {
this.destroyChart(type);
});
},
handleClose() {
this.destroyAllCharts();
this.formConfig[0].defaultSelect = [];
this.listQuery.startTime = undefined;
this.listQuery.endTime = undefined;
this.originData = null;
this.hasData = true;
if (this.$refs.searchBarForm) {
this.$refs.searchBarForm.form.timeVal = [];
}
},
init(data) {
this.dataForm = {
equipmentId: data.equipmentId || '',
equipmentName: data.equipmentName || '',
lineId: data.lineId || ''
};
this.activeLabel = 'duration'
this.listQuery.equipmentId = data.equipmentId || undefined;
this.visible = true;
this.originData = null;
this.hasData = false;
this.initDefaultDate();
this.$nextTick(() => {
this.$nextTick(() => {
this.isDomReady = true;
this.getDataList();
});
});
}
},
beforeDestroy() {
this.destroyAllCharts();
}
};
</script>
<style scoped>
/* 保持原有样式,优化图表容器布局 */
.drawer>>>.el-drawer {
border-radius: 8px 0 0 8px;
display: flex;
flex-direction: column;
}
.drawer>>>.el-form-item__label {
padding: 0;
}
.drawer>>>.el-drawer__header {
margin: 0;
padding: 32px 32px 24px;
border-bottom: 1px solid #dcdfe6;
}
.drawer>>>.el-drawer__body {
flex: 1;
height: 1px;
display: flex;
flex-direction: column;
}
.drawer>>>.content {
padding: 30px 24px;
flex: 1;
display: flex;
flex-direction: column;
}
.drawer>>>.visual-part {
flex: 1 auto;
max-height: 76vh;
overflow: hidden;
padding: 10px 0;
}
/* 优化图表容器响应式布局 */
@media (max-width: 1200px) {
.visual-part>div {
flex-direction: column;
}
#barChart,
#pieChart {
width: 100% !important;
height: 350px !important;
margin-bottom: 20px;
}
}
.drawer>>>.el-form,
.drawer>>>.attr-list {
padding: 0 16px;
}
.drawer-body__footer {
display: flex;
justify-content: flex-end;
padding: 18px;
}
</style>

File diff suppressed because it is too large Load Diff

View File

@@ -2,14 +2,14 @@
* @Author: zwq
* @Date: 2025-10-23 13:43:55
* @LastEditors: zwq
* @LastEditTime: 2025-11-14 21:13:10
* @LastEditTime: 2025-10-23 16:50:43
* @Description:
-->
<template>
<div class="app-container" style="padding-top: 0">
<div class="app-container">
<div v-for="item in groupClassArr" :key="item.planId">
<small-title style="margin: 16px 0" size="sm" :no-padding="true">
{{ item.deptName + ' - ' + item.planName }}
{{item.planName}}
</small-title>
<base-table
:table-props="tableProps"
@@ -59,14 +59,13 @@ export default {
},
created() {},
methods: {
init(det, detSort) {
init(det) {
this.tableData = det;
//返回计划名和id
const arr = det.map((item) => {
const obj = {
planName: item.schedulingPlanName,
planId: item.schedulingPlanId,
deptName: item.belongDeptName,
};
return obj;
});
@@ -77,19 +76,7 @@ export default {
map.set(item.planId, item);
}
});
const newArr = Array.from(map.values());
// 创建B数组中id的顺序映射
const orderMap = new Map();
detSort.forEach((item, index) => {
orderMap.set(item, index);
});
// 根据B的顺序对A进行排序
this.groupClassArr = [...newArr].sort((a, b) => {
const orderA = orderMap.get(a.planId);
const orderB = orderMap.get(b.planId);
return orderA - orderB;
});
this.groupClassArr = Array.from(map.values());
},
},
};

Some files were not shown because too many files have changed in this diff Show More