Compare commits

..

14 Commits

Author SHA1 Message Date
f80644e07c Merge pull request 'projects/line-new-zhp' (#458) from projects/line-new-zhp into projects/line-new
Reviewed-on: #458
2025-12-09 17:03:35 +08:00
‘937886381’
1e12b653d6 Merge branch 'projects/line-new' into projects/line-new-zhp 2025-12-09 16:59:54 +08:00
‘937886381’
b7ba173ca3 修改 2025-12-09 16:57:38 +08:00
c203f1e1dd Merge pull request 'projects/line-new-zhp' (#457) from projects/line-new-zhp into projects/line-new
Reviewed-on: #457
2025-12-09 13:11:32 +08:00
‘937886381’
ccb925003e Merge branch 'projects/line-new' into projects/line-new-zhp 2025-12-09 13:10:45 +08:00
‘937886381’
b9f286005c 生产 2025-12-09 13:07:09 +08:00
0e343279ac Merge pull request '更新' (#456) from projects/line-new-zwq into projects/line-new
Reviewed-on: #456
2025-12-01 14:52:38 +08:00
zwq
00ac3dec45 更新 2025-12-01 14:52:21 +08:00
a84f765e73 Merge pull request '班组bug' (#455) from projects/line-new-zwq into projects/line-new
Reviewed-on: #455
2025-11-28 16:29:25 +08:00
zwq
ffa0b2e8dd 班组bug 2025-11-28 16:29:06 +08:00
1e6c6c5656 Merge pull request '班组bug' (#448) from projects/line-new-zwq into projects/line-new
Reviewed-on: #448
2025-11-11 15:38:56 +08:00
zwq
0e76fe7dbf 班组bug 2025-11-11 15:38:31 +08:00
399e2bc965 Merge pull request '更新班组' (#447) from projects/line-new-zwq into projects/line-new
Reviewed-on: #447
2025-11-05 13:58:22 +08:00
zwq
7bee1f7863 更新班组 2025-11-05 13:57:58 +08:00
196 changed files with 13504 additions and 17423 deletions

View File

@@ -12,10 +12,10 @@ ENV = 'development'
VUE_APP_TITLE = 智能监控分析系统
# 芋道管理系统/开发环境
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://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_CLI_BABEL_TRANSPILE_MODULES = true

BIN
dist.zip Normal file

Binary file not shown.

View File

@@ -6,7 +6,7 @@
"license": "MIT",
"scripts": {
"local": "vue-cli-service serve --mode local",
"dev": "vue-cli-service serve --mode dev",
"dev": "SET NODE_OPTIONS=--openssl-legacy-provider && 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

@@ -1,49 +0,0 @@
/*
* @Author: zwq
* @Date: 2025-11-17 09:25:12
* @LastEditors: zwq
* @LastEditTime: 2026-01-14 13:53:22
* @Description:
*/
import request from '@/utils/request'
// 获得巷道分页
export function getLanePage(query) {
return request({
url: '/wms/lane/page',
method: 'get',
params: query
})
}
// 获得巷道
export function getLane(id) {
return request({
url: '/wms/lane/get?id=' + id,
method: 'get'
})
}
// 删除巷道
export function deleteLane(id) {
return request({
url: '/wms/lane/delete?id=' + id,
method: 'delete'
})
}
// 更新
export function updateLane(data) {
return request({
url: '/wms/lane/update',
method: 'put',
data: data
})
}
// 创建
export function createLane(data) {
return request({
url: '/wms/lane/create',
method: 'post',
data: data
})
}

View File

@@ -1,66 +0,0 @@
/*
* @Author: zwq
* @Date: 2025-11-17 09:25:12
* @LastEditors: zwq
* @LastEditTime: 2026-01-14 14:26:15
* @Description:
*/
import request from '@/utils/request'
// 获得线边库分页
export function getLineEdgeLibraryPage(query) {
return request({
url: '/wms/line-edge-library/page',
method: 'get',
params: query
})
}
// 获得线边库
export function getLineEdgeLibrary(id) {
return request({
url: '/wms/line-edge-library/get?id=' + id,
method: 'get'
})
}
// 删除线边库
export function deleteLineEdgeLibrary(id) {
return request({
url: '/wms/line-edge-library/delete?id=' + id,
method: 'delete'
})
}
// 更新
export function updateLineEdgeLibrary(data) {
return request({
url: '/wms/line-edge-library/update',
method: 'put',
data: data
})
}
// 更新线边库实时pc --清空操作
export function QKLineEdgeLibrary(data) {
return request({
url: '/wms/line-edge-library/update/pc',
method: 'put',
data: data
})
}
// 创建
export function createLineEdgeLibrary(data) {
return request({
url: '/wms/line-edge-library/create',
method: 'post',
data: data
})
}
// 获得设备分页
export function getEquipmentPage(query) {
return request({
url: '/wms/equipment/page',
method: 'get',
params: query
})
}

View File

@@ -1,79 +0,0 @@
/*
* @Author: zwq
* @Date: 2026-01-06 15:18:38
* @LastEditors: zwq
* @LastEditTime: 2026-01-15 15:02:04
* @Description:
*/
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(params) {
return request({
url: '/wms/line-edge-library/list/region',
method: 'get',
params
})
}
// 获取区域总览
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

@@ -1,63 +0,0 @@
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

@@ -1,49 +0,0 @@
/*
* @Author: zwq
* @Date: 2025-11-17 09:25:12
* @LastEditors: zwq
* @LastEditTime: 2026-01-14 13:35:11
* @Description:
*/
import request from '@/utils/request'
// 获得区域分页
export function getRegionPage(query) {
return request({
url: '/wms/region/page',
method: 'get',
params: query
})
}
// 获得区域
export function getRegion(id) {
return request({
url: '/wms/region/get?id=' + id,
method: 'get'
})
}
// 删除区域
export function deleteRegion(id) {
return request({
url: '/wms/region/delete?id=' + id,
method: 'delete'
})
}
// 更新
export function updateRegion(data) {
return request({
url: '/wms/region/update',
method: 'put',
data: data
})
}
// 创建
export function createRegion(data) {
return request({
url: '/wms/region/create',
method: 'post',
data: data
})
}

View File

@@ -59,3 +59,34 @@ 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,3 +52,5 @@ export function exportEquipmentTypeExcel(query) {
responseType: 'blob'
})
}

View File

@@ -50,6 +50,15 @@ 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,3 +141,13 @@ 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,6 +26,13 @@ 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,3 +90,29 @@ 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

@@ -0,0 +1,56 @@
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

@@ -0,0 +1,63 @@
/*
* @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

@@ -1,162 +0,0 @@
/*
* @Author: zwq
* @Date: 2025-11-17 09:25:12
* @LastEditors: zwq
* @LastEditTime: 2026-01-13 16:13:53
* @Description:
*/
import request from '@/utils/request'
// 获得原料分页
export function getProductPage(query) {
return request({
url: '/wms/material/page',
method: 'get',
params: query
})
}
// 获得所有原料
export function getAllProductPage(query) {
return request({
url: '/wms/material/list/all/code',
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
})
}

View File

@@ -1,60 +0,0 @@
/*
* @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

@@ -1,9 +0,0 @@
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.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 461 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 321 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 312 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 244 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 137 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 165 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 139 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 170 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 929 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 321 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 320 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 261 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 416 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 305 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 325 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 259 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 420 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 321 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 326 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 622 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 220 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 379 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 355 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 325 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 562 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 611 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 MiB

View File

@@ -6,104 +6,48 @@
-->
<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"></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" @change="handleSwitchChange(col.prop)"></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>
@@ -134,7 +78,8 @@ const uploadedFile = {
data() {
return {};
},
methods: {
methods: {
handleDelete() {
this.$emit('delete', this.file);
},
@@ -251,7 +196,12 @@ export default {
// 处理 options
this.handleOptions();
},
methods: {
methods: {
handleSwitchChange(prop) {
// 触发 update 事件,将最新的 form 数据传递给父组件
this.$emit('update', { ...this.form });
console.log(`switch ${prop} 变化:`, this.form[prop]);
},
/** 模拟透传 ref */
validate(cb) {
return this.$refs.form.validate(cb);

View File

@@ -14,12 +14,7 @@
v-if="collapse"
key="collapse"
class="sidebar-logo-link"
:to="{
path: '/',
query: {
keyword: 'home',
},
}">
to="/">
<img v-if="logo" :src="logo" class="sidebar-logo" />
<h1
v-else
@@ -33,16 +28,7 @@
{{ title }}
</h1>
</router-link>
<router-link
v-else
key="expand"
class="sidebar-logo-link"
:to="{
path: '/',
query: {
keyword: 'home',
},
}">
<router-link v-else key="expand" class="sidebar-logo-link" to="/">
<img v-if="logo" :src="logo" class="sidebar-logo" />
<h1
class="sidebar-title"

View File

@@ -1,10 +1,3 @@
<!--
* @Author: zwq
* @Date: 2026-01-06 15:18:41
* @LastEditors: zwq
* @LastEditTime: 2026-01-15 09:52:23
* @Description:
-->
<template>
<div v-if="!item.hidden">
<template v-if="hasOneShowingChild(item.children,item) && (!onlyOneChild.children||onlyOneChild.noShowingChildren)&&!item.alwaysShow">

View File

@@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2022-08-24 11:19:43
* @LastEditors: zwq
* @LastEditTime: 2025-11-28 09:35:03
* @LastEditTime: 2024-04-02 09:33:29
* @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,val.data)
this.deleteHandle(val.data.id, val.data.name, val.data._pageIndex)
} else {
this.otherMethods(val)
}

View File

@@ -1,10 +1,3 @@
/*
* @Author: zwq
* @Date: 2026-01-06 15:18:38
* @LastEditors: zwq
* @LastEditTime: 2026-01-15 09:54:44
* @Description:
*/
import router from './router'
import store from './store'
import { Message } from 'element-ui'
@@ -16,7 +9,7 @@ import { isRelogin } from '@/utils/request'
NProgress.configure({ showSpinner: false })
// 增加三方登陆 update by 芋艿
const whiteList = ['/login', '/social-login', 'screenbg', '/auth-redirect', '/bind', '/register', '/oauthLogin/gitee']
const whiteList = ['/login', '/social-login', '/auth-redirect', '/bind', '/register', '/oauthLogin/gitee']
router.beforeEach((to, from, next) => {
NProgress.start()
@@ -24,12 +17,7 @@ router.beforeEach((to, from, next) => {
to.meta.title && store.dispatch('settings/setTitle', to.meta.title)
/* has token*/
if (to.path === '/login') {
next({
path: '/',
query: {
keyword: 'home',
},
})
next({ path: '/' })
NProgress.done()
} else {
if (store.getters.roles.length === 0) {
@@ -37,9 +25,9 @@ router.beforeEach((to, from, next) => {
// 获取字典数据 add by 芋艿
store.dispatch('dict/loadDictDatas')
// 判断当前用户是否已拉取完 user_info 信息
store.dispatch('GetInfo').then(userInfo => {
store.dispatch('GetInfo').then(() => {
isRelogin.show = false
store.dispatch('GenerateRoutes', userInfo.menus).then(accessRoutes => {
store.dispatch('GenerateRoutes').then(accessRoutes => {
// 根据 roles 权限生成可访问的路由表
router.addRoutes(accessRoutes) // 动态添加可访问路由表
next({ ...to, replace: true }) // hack方法 确保addRoutes已完成
@@ -47,12 +35,7 @@ router.beforeEach((to, from, next) => {
}).catch(err => {
store.dispatch('LogOut').then(() => {
Message.error(err)
next({
path: '/',
query: {
keyword: 'home',
},
})
next({ path: '/' })
})
})
} else {

View File

@@ -28,280 +28,223 @@ 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/productionVisualization/equipmentBoard'], resolve),
name: '首页',
meta: { title: '首页', icon: 'dashboard', affix: true },
hidden: true,
},
],
props: (route) => ({
keyword: 'home',
})
},
{
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),
},
],
},
];
{
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)
}]
}
]
// 防止连续点击多次路由报错
let routerPush = Router.prototype.push;

View File

@@ -1,4 +1,5 @@
import {constantRoutes} from '@/router'
import {getRouters} from '@/api/menu'
import Layout from '@/layout/index'
import ParentView from '@/components/ParentView';
import {toCamelCase} from "@/utils";
@@ -26,25 +27,22 @@ const permission = {
},
},
actions: {
/**
* 生成路由
*
* @param commit commit 函数
* @param menus 路由参数
*/
GenerateRoutes({commit}, menus) {
// 生成路由
GenerateRoutes({commit}) {
return new Promise(resolve => {
// 将 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)
// 向后端请求路由数据(菜单)
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)
})
})
}
}

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,36 +176,38 @@ 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 {
Notification.error({
title: msg
})
//【班组管理】【排班计划】提交的校验按照原型图补充完整,排班计划是否重叠code400 有两个不同的返回信息
return res.data
}
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) + "异常";
}
Message({
message: message,
type: 'error',
duration: 5 * 1000
})
return Promise.reject(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) + "异常";
}
Message({
message: message,
type: 'error',
duration: 5 * 1000
})
return Promise.reject(error)
}
)
export function getBaseHeader() {
@@ -219,10 +221,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

@@ -1,81 +0,0 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zwq
* @LastEditTime: 2025-11-28 14:38:31
* @Description:
-->
<template>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-width="80px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="物料编码" prop="materialCode">
<el-input
v-model="dataForm.materialCode"
clearable
placeholder="请输入物料编码" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="物料型号" prop="materialName">
<el-input
v-model="dataForm.materialName"
clearable
placeholder="请输入物料型号" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="物料规格" prop="material">
<el-input
v-model="dataForm.material"
clearable
placeholder="请输入物料规格" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import basicAdd from '@/mixins/basic-add';
import { createProduct, updateProduct,getProduct } from '@/api/ssdl/product&recipe';
export default {
mixins: [basicAdd],
data() {
return {
urlOptions: {
createURL: createProduct,
updateURL: updateProduct,
infoURL: getProduct,
},
dataForm: {
id: undefined,
material: undefined,
materialName: undefined,
materialCode: undefined,
},
typeArr: [],
dataRule: {
materialCode: [
{ required: true, message: '物料编码不能为空', trigger: 'blur' },
],
materialName: [
{ required: true, message: '物料型号不能为空', trigger: 'blur' },
],
material: [
{ required: true, message: '规格不能为空', trigger: 'blur' },
],
},
};
},
methods: {},
};
</script>

View File

@@ -1,62 +0,0 @@
<!--
* @Author: zwq
* @Date: 2025-10-11 14:41:12
* @LastEditors: zwq
* @LastEditTime: 2026-01-14 14:15:47
* @Description:
-->
<template>
<el-switch
@change="changeStatus"
size="small"
v-model="injectData.laneState"
:active-value="1"
:inactive-value="2"></el-switch>
</template>
<script>
import { updateLane } from '@/api/areavisual/lane';
export default {
props: {
injectData: {
type: Object,
default: () => ({}),
},
},
data() {
return {};
},
created() {},
methods: {
changeStatus(val) {
const pdata = { ...this.injectData, laneState: val };
this.$confirm(
`是否确认修改${'巷道 [ ' + this.injectData.laneName + ' ] '}的状态?`,
'更新状态',
{
confirmButtonText: '确认修改',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(() => {
updateLane(pdata).then((res) => {
if (res.code === 0 || res.code === 200) {
this.$modal.msgSuccess('修改成功');
this.$emit('emitData');
} else {
this.$modal.msg(res.msg);
}
});
})
.catch((res) => {
this.$emit('emitData');
this.$message({
type: 'info',
message: '已取消',
});
});
},
},
};
</script>

View File

@@ -1,191 +0,0 @@
<template>
<div class="app-container">
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<base-table
v-loading="dataListLoading"
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-data="tableData"
@emitFun="getDataList">
</base-table>
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" />
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="50%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
import basicPage from '@/mixins/basic-page';
import { parseTime } from '@/filter/code-filter';
import { deleteLane, getLanePage } from '@/api/areavisual/lane';
import changeStatus from './changeStatus.vue';
const lane = [
{
id: '1',
name: 'A巷道',
},
{
id: '2',
name: 'B巷道',
},
{
id: '3',
name: 'C巷道',
},
{
id: '4',
name: 'D巷道',
},
{
id: '5',
name: 'E巷道',
},
{
id: '6',
name: 'F巷道',
},
];
const tableProps = [
{
prop: 'laneCode',
label: '巷道编码',
},
{
prop: 'laneName',
label: '巷道名称',
},
{
prop: 'lane',
label: '巷道',
filter: (val) => {
return lane.find((i) => i.id == val)
? lane.find((i) => i.id == val).name
: '-';
},
},
{
prop: 'laneSort',
label: '巷道排序',
width:90,
},
{
prop: 'laneState',
label: '巷道状态',
width:90,
subcomponent: changeStatus,
},
{
prop: 'createTime',
label: '创建时间',
filter: parseTime,
width: 150,
},
];
export default {
mixins: [basicPage],
data() {
return {
urlOptions: {
getDataListURL: getLanePage,
deleteURL: deleteLane,
},
tableProps,
tableBtn: [
{
type: 'edit',
btnName: '编辑',
},
{
type: 'delete',
btnName: '删除',
},
].filter((v) => v),
tableData: [],
formConfig: [
{
type: 'input',
label: '名称',
placeholder: '名称',
param: 'name',
},
{
type: 'input',
label: '编码',
placeholder: '编码',
param: 'code',
},
{
type: 'select',
label: '巷道',
selectOptions: lane,
placeholder: '请选择巷道',
param: 'lane',
},
{
type: 'button',
btnName: '搜索',
name: 'search',
color: 'primary',
},
],
};
},
components: {
AddOrUpdate,
},
created() {},
methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 20;
this.listQuery.laneName = val.name;
this.listQuery.laneCode = val.code;
this.listQuery.lane = val.lane;
this.getDataList();
break;
case 'reset':
this.$refs.searchBarForm.resetForm();
this.listQuery = {
pageSize: 20,
pageNo: 1,
total: 1,
};
this.getDataList();
break;
case 'add':
this.addOrEditTitle = '新增';
this.addOrUpdateVisible = true;
this.addOrUpdateHandle();
break;
case 'export':
this.handleExport();
break;
default:
console.log(val);
}
},
},
};
</script>

View File

@@ -1,324 +0,0 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zwq
* @LastEditTime: 2026-01-15 09:16:36
* @Description:
-->
<template>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-width="80px">
<div class="stat-card">
<div class="stat-icon">
<i class="el-icon-s-grid" style="color: #fff"></i>
</div>
<div class="stat-title">库位信息</div>
<div class="stat-content">
<div class="stat-value">{{ lineInfo.lineEdgeLibraryCode }}</div>
<div class="stat-label">{{ lineInfo.lineEdgeLibraryName }}</div>
</div>
</div>
<el-row :gutter="20">
<el-col :span="24">
<el-form-item label="物料" prop="materialId">
<el-select
style="width: 100%"
v-model="dataForm.materialId"
filterable
@change="setMaterial"
placeholder="请选择物料">
<el-option
v-for="item in productArr"
:key="item.id"
:label="
item.materialCode +
'-' +
item.materialName +
'-' +
item.material
"
:value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="本盘长度" prop="cableLength">
<el-input-number
v-model="dataForm.cableLength"
:min="0"
:precision="2"></el-input-number>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="设备" prop="equipmentId">
<el-select
v-model="dataForm.equipmentId"
@change="setEquipment"
placeholder="请选择绞体">
<el-option
v-for="item in options1"
:key="item.id"
:label="item.equipmentName"
:value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="应用套号" prop="suite">
<el-select v-model="dataForm.suite" placeholder="请选择应用套号">
<el-option
v-for="item in options2"
:key="item.value"
:label="item.label"
:value="item.value"></el-option>
</el-select>
</el-form-item>
</el-col>
<span v-if="dataForm.suite == 2">
<el-col :span="8">
<el-form-item label="选择套号" prop="time">
<el-date-picker
v-model="dataForm.time"
value-format="yyyy-MM-dd"
type="date"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="" prop="productionLine">
<el-select v-model="dataForm.productionLine">
<el-option
v-for="item in options3"
:key="item.value"
:label="item.label"
:value="item.value"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="" prop="numb">
<el-select v-model="dataForm.numb">
<el-option
v-for="item in options4"
:key="item.value"
:label="item.label"
:value="item.value"></el-option>
</el-select>
</el-form-item>
</el-col>
</span>
</el-row>
</el-form>
</template>
<script>
import basicAdd from '@/mixins/basic-add';
import { getAllProductPage } from '@/api/ssdl/product&recipe';
import {
QKLineEdgeLibrary,
getEquipmentPage,
} from '@/api/areavisual/lineEdgeLibrary';
import { parseTime } from '@/filter/code-filter';
export default {
mixins: [basicAdd],
data() {
return {
urlOptions: {
createURL: QKLineEdgeLibrary,
},
dataForm: {
id: undefined,
materialId: undefined,
materialName: undefined,
materialCode: undefined,
material: undefined,
cableLength: undefined,
equipmentId: undefined,
equipmentName: undefined,
suite: undefined, //是否成套
suiteCode: undefined, //套号
time: this.parseTime(new Date(), '{y}-{m}-{d}'),
productionLine: undefined,
numb: undefined,
},
lineInfo: {},
productArr: [],
options1: [],
options2: [
{
value: 2,
label: '是',
},
{
value: 1,
label: '否',
},
],
options3: [
{
value: '6#',
label: '6#',
},
{
value: '7#',
label: '7#',
},
{
value: '8#',
label: '8#',
},
],
options4: [
{
value: 0,
label: '0',
},
{
value: 1,
label: '1',
},
{
value: 2,
label: '2',
},
{
value: 3,
label: '3',
},
{
value: 4,
label: '4',
},
{
value: 5,
label: '5',
},
{
value: 6,
label: '6',
},
],
dataRule: {
materialId: [
{ required: true, message: '物料不能为空', trigger: 'change' },
],
time: [{ required: true, message: '不能为空', trigger: 'change' }],
productionLine: [
{ required: true, message: '不能为空', trigger: 'change' },
],
numb: [{ required: true, message: '不能为空', trigger: 'change' }],
},
};
},
methods: {
showLine(val) {
getAllProductPage().then((res) => {
this.productArr = res.data;
});
getEquipmentPage({ pageNo: 1, pageSize: 100, equipmentType: 2 }).then(
(res) => {
this.options1 = res.data.list;
}
);
this.lineInfo = { ...val };
},
setMaterial() {
const data = this.productArr.find(
(i) => i.id === this.dataForm.materialId
);
this.dataForm.materialName = data.materialName;
this.dataForm.material = data.material;
this.dataForm.materialCode = data.materialCode;
},
setEquipment() {
const data = this.options1.find(
(i) => i.id === this.dataForm.equipmentId
);
this.dataForm.equipmentName = data.equipmentName;
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
return false;
}
if (this.dataForm.suite == 2) {
this.dataForm.suiteCode =
this.dataForm.time +
'-' +
this.dataForm.productionLine +
'-' +
this.dataForm.numb;
}
QKLineEdgeLibrary({
...this.lineInfo,
...this.dataForm,
lineEdgeLibraryState: 1,
id: this.lineInfo.id,
}).then((response) => {
this.$modal.msgSuccess('操作成功');
this.visible = false;
this.$emit('refreshDataList');
});
return;
});
},
},
};
</script>
<style scoped>
.stat-card {
display: flex;
align-items: center;
padding: 10px;
background: white;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
transition: all 0.3s ease;
border-left: 4px solid;
border-color: #1a56db;
margin-bottom: 30px;
}
/* .stat-card:hover {
transform: translateY(-5px);
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
} */
.stat-title {
margin: 0 10px;
color: #0051ff;
font-size: 20px;
}
.stat-icon {
display: flex;
align-items: center;
justify-content: center;
width: 60px;
height: 60px;
border-radius: 12px;
margin-right: 15px;
background: linear-gradient(to right, #1a56db, #0d47a1);
}
.stat-content {
display: flex;
flex-direction: column;
}
.stat-value {
font-size: 28px;
font-weight: 700;
line-height: 1.2;
color: #1a56db;
}
.stat-label {
font-size: 14px;
color: #64748b;
}
</style>

View File

@@ -1,318 +0,0 @@
<template>
<div class="app-container">
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<base-table
v-loading="dataListLoading"
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-data="tableData"
@emitFun="getDataList">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="110"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" />
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
destroy-on-close
width="50%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
import basicPage from '@/mixins/basic-page';
import { parseTime } from '@/filter/code-filter';
import {
deleteLineEdgeLibrary,
getLineEdgeLibraryPage,
QKLineEdgeLibrary,
} from '@/api/areavisual/lineEdgeLibrary';
const laneRow = [
{
id: '1',
name: '第一排',
},
{
id: '2',
name: '第二排',
},
{
id: '3',
name: '第三排',
},
{
id: '4',
name: '第四排',
},
{
id: '5',
name: '第五排',
},
{
id: '6',
name: '第六排',
},
];
const tableProps = [
{
prop: 'lineEdgeLibraryCode',
label: '线边库编码',
},
{
prop: 'lineEdgeLibraryName',
label: '线边库名称',
},
{
prop: 'agvGroundCode',
label: 'agv码',
},
{
prop: 'lineEdgeLibraryState',
label: '线边库状态',
width: 90,
filter: (val) => {
return val ? '满位' : '空闲';
},
},
{
prop: 'usableState',
label: '是否可用',
width: 90,
filter: (val) => {
return ['', '可用', '不可用', '锁定'][val];
},
},
{
prop: 'trayType',
label: '托盘类型',
width: 90,
filter: (val) => {
return val ? '笼式' : '盘式';
},
},
{
prop: 'productionLine',
label: '产线',
},
{
prop: 'equipmentName',
label: '设备',
},
{
prop: 'suiteCode',
label: '套号',
},
{
prop: 'laneRow',
label: '巷道排',
filter: (val) => {
return laneRow.find((i) => i.id == val)
? laneRow.find((i) => i.id == val).name
: '-';
},
},
{
prop: 'materialCode',
label: '物料',
},
{
prop: 'batch',
label: '批次',
},
{
prop: 'cableLength',
label: '线缆长度',
},
{
prop: 'createTime',
label: '创建时间',
filter: parseTime,
width: 150,
},
];
export default {
mixins: [basicPage],
data() {
return {
urlOptions: {
getDataListURL: getLineEdgeLibraryPage,
deleteURL: deleteLineEdgeLibrary,
},
tableProps,
tableData: [],
tableBtn: [
{
type: 'clear',
btnName: '清空',
},
{
type: 'add',
btnName: '添加',
},
].filter((v) => v),
formConfig: [
{
type: 'input',
label: '线边库名称',
placeholder: '线边库名称',
param: 'name',
},
{
type: 'input',
label: '线边库编码',
placeholder: '线边库编码',
param: 'code',
},
{
type: 'select',
label: '巷道排',
selectOptions: laneRow,
placeholder: '请选择巷道排',
param: 'laneRow',
},
{
type: 'button',
btnName: '搜索',
name: 'search',
color: 'primary',
},
// {
// type: 'separate',
// },
// {
// type: 'button',
// btnName: '重置',
// name: 'reset',
// },
// {
// type: 'separate',
// },
// {
// type: 'button',
// btnName: '新增',
// name: 'add',
// color: 'success',
// plain: true,
// },
// {
// type: this.$auth.hasPermi('base:factory:create') ? 'separate' : '',
// },
// {
// type: this.$auth.hasPermi('base:factory:export') ? 'button' : '',
// btnName: '导出',
// name: 'export',
// color: 'warning',
// },
],
};
},
components: {
AddOrUpdate,
},
created() {},
methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 20;
this.listQuery.lineEdgeLibraryName = val.name;
this.listQuery.lineEdgeLibraryCode = val.code;
this.listQuery.laneRow = val.laneRow;
this.getDataList();
break;
case 'reset':
this.$refs.searchBarForm.resetForm();
this.listQuery = {
pageSize: 20,
pageNo: 1,
total: 1,
};
this.getDataList();
break;
case 'add':
this.addOrEditTitle = '新增';
this.addOrUpdateVisible = true;
this.addOrUpdateHandle();
break;
case 'export':
this.handleExport();
break;
default:
console.log(val);
}
},
otherMethods(val) {
if (val.type == 'clear') {
if (val.data.usableState == 3) {
this.$confirm(
`当前库位为锁定状态,代表该库位有未完成的任务关联,是否确认清空${
'线边库名称为 ' + val.data.lineEdgeLibraryName + ' '
}的数据项?`,
'锁定库位清空提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(() => {
QKLineEdgeLibrary({...val.data,lineEdgeLibraryState:0,usableState:1 }).then(({ data }) => {
this.$message({
message: data,
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList();
},
});
});
})
.catch(() => {});
} else {
QKLineEdgeLibrary({...val.data,lineEdgeLibraryState:0,usableState:1 }).then(({ data }) => {
this.$message({
message: data,
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList();
},
});
});
}
} else if (val.type === 'add') {
this.addOrEditTitle = '添加货物';
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init();
this.$refs.addOrUpdate.showLine(val.data);
});
}
},
},
};
</script>

View File

@@ -1,324 +0,0 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zwq
* @LastEditTime: 2026-01-15 09:16:36
* @Description:
-->
<template>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-width="80px">
<div class="stat-card">
<div class="stat-icon">
<i class="el-icon-s-grid" style="color: #fff"></i>
</div>
<div class="stat-title">库位信息</div>
<div class="stat-content">
<div class="stat-value">{{ lineInfo.lineEdgeLibraryCode }}</div>
<div class="stat-label">{{ lineInfo.lineEdgeLibraryName }}</div>
</div>
</div>
<el-row :gutter="20">
<el-col :span="24">
<el-form-item label="物料" prop="materialId">
<el-select
style="width: 100%"
v-model="dataForm.materialId"
filterable
@change="setMaterial"
placeholder="请选择物料">
<el-option
v-for="item in productArr"
:key="item.id"
:label="
item.materialCode +
'-' +
item.materialName +
'-' +
item.material
"
:value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="本盘长度" prop="cableLength">
<el-input-number
v-model="dataForm.cableLength"
:min="0"
:precision="2"></el-input-number>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="设备" prop="equipmentId">
<el-select
v-model="dataForm.equipmentId"
@change="setEquipment"
placeholder="请选择绞体">
<el-option
v-for="item in options1"
:key="item.id"
:label="item.equipmentName"
:value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="应用套号" prop="suite">
<el-select v-model="dataForm.suite" placeholder="请选择应用套号">
<el-option
v-for="item in options2"
:key="item.value"
:label="item.label"
:value="item.value"></el-option>
</el-select>
</el-form-item>
</el-col>
<span v-if="dataForm.suite == 2">
<el-col :span="8">
<el-form-item label="选择套号" prop="time">
<el-date-picker
v-model="dataForm.time"
value-format="yyyy-MM-dd"
type="date"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="" prop="productionLine">
<el-select v-model="dataForm.productionLine">
<el-option
v-for="item in options3"
:key="item.value"
:label="item.label"
:value="item.value"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="" prop="numb">
<el-select v-model="dataForm.numb">
<el-option
v-for="item in options4"
:key="item.value"
:label="item.label"
:value="item.value"></el-option>
</el-select>
</el-form-item>
</el-col>
</span>
</el-row>
</el-form>
</template>
<script>
import basicAdd from '@/mixins/basic-add';
import { getAllProductPage } from '@/api/ssdl/product&recipe';
import {
QKLineEdgeLibrary,
getEquipmentPage,
} from '@/api/areavisual/lineEdgeLibrary';
import { parseTime } from '@/filter/code-filter';
export default {
mixins: [basicAdd],
data() {
return {
urlOptions: {
createURL: QKLineEdgeLibrary,
},
dataForm: {
id: undefined,
materialId: undefined,
materialName: undefined,
materialCode: undefined,
material: undefined,
cableLength: undefined,
equipmentId: undefined,
equipmentName: undefined,
suite: undefined, //是否成套
suiteCode: undefined, //套号
time: this.parseTime(new Date(), '{y}-{m}-{d}'),
productionLine: undefined,
numb: undefined,
},
lineInfo: {},
productArr: [],
options1: [],
options2: [
{
value: 2,
label: '是',
},
{
value: 1,
label: '否',
},
],
options3: [
{
value: '6#',
label: '6#',
},
{
value: '7#',
label: '7#',
},
{
value: '8#',
label: '8#',
},
],
options4: [
{
value: 0,
label: '0',
},
{
value: 1,
label: '1',
},
{
value: 2,
label: '2',
},
{
value: 3,
label: '3',
},
{
value: 4,
label: '4',
},
{
value: 5,
label: '5',
},
{
value: 6,
label: '6',
},
],
dataRule: {
materialId: [
{ required: true, message: '物料不能为空', trigger: 'change' },
],
time: [{ required: true, message: '不能为空', trigger: 'change' }],
productionLine: [
{ required: true, message: '不能为空', trigger: 'change' },
],
numb: [{ required: true, message: '不能为空', trigger: 'change' }],
},
};
},
methods: {
showLine(val) {
getAllProductPage().then((res) => {
this.productArr = res.data;
});
getEquipmentPage({ pageNo: 1, pageSize: 100, equipmentType: 2 }).then(
(res) => {
this.options1 = res.data.list;
}
);
this.lineInfo = { ...val };
},
setMaterial() {
const data = this.productArr.find(
(i) => i.id === this.dataForm.materialId
);
this.dataForm.materialName = data.materialName;
this.dataForm.material = data.material;
this.dataForm.materialCode = data.materialCode;
},
setEquipment() {
const data = this.options1.find(
(i) => i.id === this.dataForm.equipmentId
);
this.dataForm.equipmentName = data.equipmentName;
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
return false;
}
if (this.dataForm.suite == 2) {
this.dataForm.suiteCode =
this.dataForm.time +
'-' +
this.dataForm.productionLine +
'-' +
this.dataForm.numb;
}
QKLineEdgeLibrary({
...this.lineInfo,
...this.dataForm,
lineEdgeLibraryState: 1,
id: this.lineInfo.id,
}).then((response) => {
this.$modal.msgSuccess('操作成功');
this.visible = false;
this.$emit('refreshDataList');
});
return;
});
},
},
};
</script>
<style scoped>
.stat-card {
display: flex;
align-items: center;
padding: 10px;
background: white;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
transition: all 0.3s ease;
border-left: 4px solid;
border-color: #1a56db;
margin-bottom: 30px;
}
/* .stat-card:hover {
transform: translateY(-5px);
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
} */
.stat-title {
margin: 0 10px;
color: #0051ff;
font-size: 20px;
}
.stat-icon {
display: flex;
align-items: center;
justify-content: center;
width: 60px;
height: 60px;
border-radius: 12px;
margin-right: 15px;
background: linear-gradient(to right, #1a56db, #0d47a1);
}
.stat-content {
display: flex;
flex-direction: column;
}
.stat-value {
font-size: 28px;
font-weight: 700;
line-height: 1.2;
color: #1a56db;
}
.stat-label {
font-size: 14px;
color: #64748b;
}
</style>

View File

@@ -1,125 +0,0 @@
<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

@@ -1,665 +0,0 @@
<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">
<div class="stat-card">
<div class="stat-icon">
<i class="el-icon-s-grid" style="color: #fff"></i>
</div>
<div class="stat-title">库区信息</div>
<div class="stat-content">
<div class="stat-value">{{ getAreaInfoInfo.regionName }}</div>
<div class="stat-label">{{ getAreaInfoInfo.regionCode }}</div>
</div>
</div>
<div class="area-body">
<div v-for="item in Object.keys(areaInfo)" :key="item">
<div class="potTitle">{{ item }}</div>
<div class="potList">
<div v-for="sitem in areaInfo[item]" :key="sitem.id">
<div v-if="sitem.empty" class="area-div-empty" />
<div v-else class="area-div" :title="sitem.lineEdgeLibraryName">
<el-popover
placement="top-start"
:title="sitem.lineEdgeLibraryCode"
width="200"
trigger="hover">
<div class="point" />
<span style="font-weight: 600">名称:</span>
{{ sitem.lineEdgeLibraryName }}
<br />
<div class="point" />
<span style="font-weight: 600">状态:</span>
{{
sitem.usableState == 3
? '锁定'
: sitem.usableState == 2
? '不可用'
: sitem.lineEdgeLibraryState == 1
? '满位'
: '空闲'
}}
<br />
<span
v-if="
sitem.usableState == 1 &&
sitem.lineEdgeLibraryState == 1
">
<span style="font-weight: 600">物料:</span>
{{ sitem.materialCode || '' }}
<br />
<span style="font-weight: 600">设备:</span>
{{ sitem.equipmentName || '' }}
<br />
<span style="font-weight: 600">套号:</span>
{{ sitem.suiteCode || '' }}
<br />
</span>
<el-button type="text" @click="clearLine(sitem)">
清空
</el-button>
<el-button type="text" @click="addLine(sitem)">
添加
</el-button>
<div
class="area-icon"
:style="{
backgroundColor:
sitem.usableState == 3
? '#E6A23C'
: sitem.usableState == 2
? 'gray'
: sitem.lineEdgeLibraryState == 1
? '#67C23A'
: '',
}"
slot="reference">
<i
:class="
sitem.usableState == 3
? 'el-icon-lock'
: 'el-icon-s-grid'
"
style="color: #fff"></i>
</div>
</el-popover>
</div>
</div>
</div>
</div>
</div>
</el-col>
</el-row>
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
destroy-on-close
width="50%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div>
</template>
<script>
// import basicPage from '@/mixins/basic-page';
import ringChart from './components/ringChart.vue';
import AddOrUpdate from './components/add-or-updata';
import basicPage from '@/mixins/basic-page';
import {
getAreaList,
postAllAreaInfo,
postAllAreaOverview,
postAreaInfo,
} from '@/api/areavisual/overview';
import { QKLineEdgeLibrary } from '@/api/areavisual/lineEdgeLibrary';
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',
getAreaInfoInfo: {},
};
},
components: {
ringChart,
AddOrUpdate,
},
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.getAreaInfoInfo = data; //把库区存下,方便刷新
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 });
if (res.code === 0 && res.data) {
// 按巷道号分组
this.areaInfo = res.data.reduce((result, item) => {
// 提取巷道号
const laneNumber = item.lineEdgeLibraryCode.substring(3, 5) + ' 巷道';
// 如果该巷道还没有分组,创建一个空数组
if (!result[laneNumber]) {
result[laneNumber] = [];
}
// 将当前项添加到对应巷道的数组中
result[laneNumber].push(item);
return result;
}, {});
Object.keys(this.areaInfo).forEach((key) => {
const arr = this.areaInfo[key];
let emptyNum = 0;
let insetEmpty = [];
arr.forEach((item, index) => {
if (
!item.empty &&
item.lineEdgeLibraryCode.substring(5, 7) !=
Math.floor(index / 2) + 1 + emptyNum &&
item.lineEdgeLibraryCode[item.lineEdgeLibraryCode.length - 1] ==
'L'
) {
let num =
Number(item.lineEdgeLibraryCode.substring(5, 7)) -
(Math.floor(index / 2) + 1 + emptyNum);
insetEmpty.push({
index,
num,
});
emptyNum += num;
}
});
insetEmpty.forEach((item) => {
const arrEmpty = Array.from({ length: item.num * 2 }, () => ({
empty: true,
}));
arr.splice(item.index, 0, ...arrEmpty);
});
});
}
},
getDataList() {},
// 全部库区右侧分页点击
handleClickRight(tab, event) {
console.log(tab, event);
},
clearLine(val) {
if (val.usableState == 3) {
this.$confirm(
`当前库位为锁定状态,代表该库位有未完成的任务关联,是否确认清空${
'线边库名称为 ' + val.lineEdgeLibraryName + ' '
}的数据项?`,
'锁定库位清空提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(() => {
QKLineEdgeLibrary({
...val,
lineEdgeLibraryState: 0,
usableState: 1,
}).then(({ data }) => {
this.$message({
message: data,
type: 'success',
duration: 1500,
onClose: () => {
this.getAreaInfo(this.getAreaInfoInfo.id);
},
});
});
})
.catch(() => {});
} else {
QKLineEdgeLibrary({
...val,
lineEdgeLibraryState: 0,
usableState: 1,
}).then(({ data }) => {
this.$message({
message: data,
type: 'success',
duration: 1500,
onClose: () => {
this.getAreaInfo(this.getAreaInfoInfo.id);
},
});
});
}
},
addLine(val) {
this.addOrEditTitle = '添加货物';
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init();
this.$refs.addOrUpdate.showLine(val);
});
},
// dialog的父组件方法this.$emit("refreshDataList");
successSubmit() {
this.handleCancel();
this.getAreaInfo(this.getAreaInfoInfo.id);
},
},
};
</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>
<style scoped>
.area-body {
margin-top: 10px;
margin-left: 10px;
overflow-x: auto;
display: flex;
}
.potTitle {
width: 190px;
background-color: rgb(169, 235, 249);
border-radius: 3px;
margin-right: 5px;
text-align: center;
color: #000000;
letter-spacing: 1px;
margin-bottom: 10px;
font-size: 16px;
}
.potList {
width: 190px;
display: grid;
grid-template-columns: 90px 90px;
gap: 8px;
}
.area-div {
padding: 10px;
background: white;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
transition: all 0.3s ease;
border: 4px solid #1a56db;
margin-bottom: 30px;
}
.area-div-empty {
background: white;
width: 90px;
height: 88px;
margin-bottom: 30px;
}
.point {
width: 5px;
height: 5px;
border-radius: 50%;
background-color: #409eff;
float: left;
margin-top: 7px;
margin-right: 5px;
}
.area-icon {
display: flex;
align-items: center;
justify-content: center;
margin: auto;
width: 60px;
height: 60px;
border-radius: 12px;
}
</style>
<style scoped>
.stat-card {
margin-top: 10px;
display: flex;
align-items: center;
padding: 10px;
background: white;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
transition: all 0.3s ease;
border-left: 4px solid;
border-color: #1a56db;
margin-bottom: 30px;
}
/* .stat-card:hover {
transform: translateY(-5px);
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
} */
.stat-title {
margin: 0 10px;
color: #0051ff;
font-size: 20px;
}
.stat-icon {
display: flex;
align-items: center;
justify-content: center;
width: 60px;
height: 60px;
border-radius: 12px;
margin-right: 15px;
background: linear-gradient(to right, #1a56db, #0d47a1);
}
.stat-content {
display: flex;
flex-direction: column;
}
.stat-value {
font-size: 28px;
font-weight: 700;
line-height: 1.2;
color: #1a56db;
}
.stat-label {
font-size: 14px;
color: #64748b;
}
</style>

View File

@@ -1,519 +0,0 @@
<!--
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

@@ -1,277 +0,0 @@
<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

@@ -1,81 +0,0 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zwq
* @LastEditTime: 2025-11-28 14:38:31
* @Description:
-->
<template>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-width="80px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="物料编码" prop="materialCode">
<el-input
v-model="dataForm.materialCode"
clearable
placeholder="请输入物料编码" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="物料型号" prop="materialName">
<el-input
v-model="dataForm.materialName"
clearable
placeholder="请输入物料型号" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="物料规格" prop="material">
<el-input
v-model="dataForm.material"
clearable
placeholder="请输入物料规格" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import basicAdd from '@/mixins/basic-add';
import { createProduct, updateProduct,getProduct } from '@/api/ssdl/product&recipe';
export default {
mixins: [basicAdd],
data() {
return {
urlOptions: {
createURL: createProduct,
updateURL: updateProduct,
infoURL: getProduct,
},
dataForm: {
id: undefined,
material: undefined,
materialName: undefined,
materialCode: undefined,
},
typeArr: [],
dataRule: {
materialCode: [
{ required: true, message: '物料编码不能为空', trigger: 'blur' },
],
materialName: [
{ required: true, message: '物料型号不能为空', trigger: 'blur' },
],
material: [
{ required: true, message: '规格不能为空', trigger: 'blur' },
],
},
};
},
methods: {},
};
</script>

View File

@@ -1,62 +0,0 @@
<!--
* @Author: zwq
* @Date: 2025-10-11 14:41:12
* @LastEditors: zwq
* @LastEditTime: 2026-01-14 14:13:14
* @Description:
-->
<template>
<el-switch
@change="changeStatus"
size="small"
v-model="injectData.regionState"
:active-value="1"
:inactive-value="2"></el-switch>
</template>
<script>
import { updateRegion } from '@/api/areavisual/region';
export default {
props: {
injectData: {
type: Object,
default: () => ({}),
},
},
data() {
return {};
},
created() {},
methods: {
changeStatus(val) {
const pdata = { ...this.injectData, regionState: val };
this.$confirm(
`是否确认修改${'区域 [ ' + this.injectData.regionName + ' ] '}的状态?`,
'更新状态',
{
confirmButtonText: '确认修改',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(() => {
updateRegion(pdata).then((res) => {
if (res.code === 0 || res.code === 200) {
this.$modal.msgSuccess('修改成功');
this.$emit('emitData');
} else {
this.$modal.msg(res.msg);
}
});
})
.catch((res) => {
this.$emit('emitData');
this.$message({
type: 'info',
message: '已取消',
});
});
},
},
};
</script>

View File

@@ -1,221 +0,0 @@
<template>
<div class="app-container">
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<base-table
v-loading="dataListLoading"
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-data="tableData"
@emitFun="getDataList">
</base-table>
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" />
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="50%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
import basicPage from '@/mixins/basic-page';
import { parseTime } from '@/filter/code-filter';
import { deleteRegion, getRegionPage } from '@/api/areavisual/region';
import changeStatus from './changeStatus.vue';
const region = [
{
id: '1',
name: 'A区域',
},
{
id: '2',
name: 'B区域',
},
{
id: '3',
name: 'C区域',
},
{
id: '4',
name: 'D区域',
},
{
id: '5',
name: 'E区域',
},
{
id: '6',
name: 'F区域',
},
{
id: '7',
name: 'G区域',
},
{
id: '8',
name: 'H区域',
},
];
const regionType = [
{
id: '1',
name: '拉丝缓存区',
},
{
id: '2',
name: '满盘存储区',
},
{
id: '3',
name: '空盘存储区',
},
{
id: '4',
name: '复绕区',
},
];
const tableProps = [
{
prop: 'regionCode',
label: '区域编码',
},
{
prop: 'regionName',
label: '区域名称',
},
{
prop: 'region',
label: '区域',
filter: (val) => {
return region.find((i) => i.id == val)
? region.find((i) => i.id == val).name
: '-';
},
},
{
prop: 'regionType',
label: '区域类型',
filter: (val) => {
return regionType.find((i) => i.id == val)
? regionType.find((i) => i.id == val).name
: '-';
},
},
{
prop: 'rowNum',
label: '行数',
width:90,
},
{
prop: 'columnNum',
label: '列数',
width:90,
},
{
prop: 'regionState',
label: '区域状态',
width:90,
subcomponent: changeStatus,
},
{
prop: 'createTime',
label: '创建时间',
filter: parseTime,
width: 150,
},
];
export default {
mixins: [basicPage],
data() {
return {
urlOptions: {
getDataListURL: getRegionPage,
deleteURL: deleteRegion,
},
tableProps,
tableData: [],
formConfig: [
{
type: 'input',
label: '名称',
placeholder: '名称',
param: 'name',
},
{
type: 'input',
label: '编码',
placeholder: '编码',
param: 'code',
},
{
type: 'select',
label: '区域',
selectOptions: region,
placeholder: '请选择区域',
param: 'region',
},
{
type: 'button',
btnName: '搜索',
name: 'search',
color: 'primary',
},
],
};
},
components: {
AddOrUpdate,
},
created() {},
methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 20;
this.listQuery.regionName = val.name;
this.listQuery.regionCode = val.code;
this.listQuery.region = val.region;
this.getDataList();
break;
case 'reset':
this.$refs.searchBarForm.resetForm();
this.listQuery = {
pageSize: 20,
pageNo: 1,
total: 1,
};
this.getDataList();
break;
case 'add':
this.addOrEditTitle = '新增';
this.addOrUpdateVisible = true;
this.addOrUpdateHandle();
break;
case 'export':
this.handleExport();
break;
default:
console.log(val);
}
},
},
};
</script>

View File

@@ -6,35 +6,27 @@
-->
<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"
@@ -42,141 +34,87 @@
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"
:rows="attrRows" />
</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" :data-form="attrForm"
:rows="attrRows"
@update="handleAttrFormUpdate"/>
</base-dialog>
</el-drawer>
</template>
<script>
@@ -232,7 +170,9 @@ export default {
defaultValue: '',
description: '',
remark: '',
alarmContent: '',
alarmContent: '',
displayTip: false,
alarmTip: false,
},
attrFormVisible: false,
attrRows: [
@@ -342,7 +282,27 @@ 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,
@@ -436,7 +396,24 @@ export default {
}
}
},
methods: {
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
});
},
handleTableBtnClick({ type, data }) {
switch (type) {
case 'edit':
@@ -502,7 +479,8 @@ export default {
name: '',
plcParamName: '',
unit: '',
collection: 1,
collection: 1,
minValue: '',
maxValue: '',
defaultValue: '',
@@ -510,7 +488,9 @@ export default {
remark: '',
equipmentParamType: '',
productionParamType: '',
alarmContent: '',
alarmContent: '',
displayTip: false,
alarmTip: false,
};
this.attrTitle = '添加参数绑定信息';
this.attrFormVisible = true;
@@ -523,8 +503,15 @@ export default {
method: 'get',
params: { id: attrId },
});
if (res.code == 0) {
this.attrForm = res.data;
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
};
this.attrTitle = '编辑参数绑定信息';
this.attrFormVisible = true;
}
@@ -563,7 +550,8 @@ 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;
@@ -583,8 +571,9 @@ export default {
type: 'success',
duration: 1500,
onClose: () => {
this.getAttrList();
this.shouldRefreshPageView = true;
this.shouldRefreshPageView = true;
this.getAttrList();
},
});
}

View File

@@ -103,7 +103,7 @@ export default {
id: null,
code: '',
materialId: '',
price: '',
price: undefined,
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,16 +72,6 @@ export default {
dateLabelList: [],
optionArrUrl: [getProductionLinePage],
formConfig: [
{
type: 'select',
label: '产线',
selectOptions: [],
param: 'lineIds',
defaultSelect: [],
multiple: true,
filterable: true,
width: 200,
},
{
type: 'datePicker',
label: '时间',
@@ -92,7 +82,17 @@ 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[index].selectOptions = response.data.list;
this.formConfig[1].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,7 +279,8 @@ 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="完成单位产品用时" prop="processTime">
<el-input :disabled="isdetail" v-model="dataForm.processTime" placeholder="请输入完成单位产品用时" />
<el-form-item label="完成单位产品用时(S)" prop="processTime">
<el-input :disabled="isdetail" v-model="dataForm.processTime" placeholder="请输入完成单位产品用时(S)" />
</el-form-item>
</el-col>
<el-col :span="12">
<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-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-select>
</el-form-item>
</el-col>
@@ -191,7 +191,7 @@ export default {
unitDictValue: '', // 单位id
originalSpecifications: '', // 原片规格
originalArea: 0, // 原片单位平方数
processType:undefined,
processTypes: [],
},
listQuery: {
pageSize: 10,
@@ -200,18 +200,18 @@ export default {
},
processTypeList: [
{
id: '0',
value: '1',
label:'压花丝印'
},
{
id: '1',
value: '2',
label: '无印打孔'
},
{
id: '2',
value: '3',
label: '单层镀膜'
}, {
id: '3',
value: '4',
label: '双层镀膜'
}
],
@@ -276,7 +276,8 @@ export default {
init(id, isdetail) {
this.initData();
this.isdetail = isdetail || false;
this.dataForm.id = id || null;
this.dataForm.id = id || null;
// this.dataForm.processTypes = [] // 清空工艺选择
this.visible = true;
this.$nextTick(() => {
@@ -284,9 +285,26 @@ export default {
if (this.dataForm.id) {
// 获取产品详情
getProduct(id).then((response) => {
this.dataForm = response.data;
});
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"] 格式
});
// 获取产品的属性列表
this.getList();
} else {
@@ -342,7 +360,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,139 +1,142 @@
<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-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-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 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 :loading="isLoading" 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,
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');
});
}
});
},
},
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;
}
},
},
};
</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,6 +262,14 @@ 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="210" />
: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">
@@ -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="210" />
: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">
@@ -71,9 +71,55 @@
</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-else>
<div class="content-inner" v-if="listQuery.timeType === 2">
<div class="content-card energyOverlimitLog">
<span class="blue-block"></span>
<span class="tip" v-if="listQuery.startTime && listQuery.endTime">
@@ -86,7 +132,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="210" :table-data="tableDataCustom" />
:limit="100" :table-props="tableProps" :max-height="300" :table-data="tableDataCustom" />
</div>
</div>
@@ -113,7 +159,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="210" />
:max-height="300" />
</div>
<!-- 当天数据占1/2剩余高度 -->
@@ -122,7 +168,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="210" />
:max-height="300" />
</div>
</div>
</div>
@@ -142,7 +188,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="210" />
:limit="100" :table-props="productTableProps" :table-data="productTableData" :max-height="300" />
</div>
</div>
</div>
@@ -154,7 +200,7 @@
import { parseTime } from '@/filter/code-filter';
import {
getLineAuto, getPdList, getPdlAutoReportNewSearchNow, getProductAuto,
getProcessAutoReportGroup, getProcessAutoReportDay, getProcessAutoReportNew
getProcessAutoReportGroup, getProcessAutoReportDay, getProcessAutoReportNew, getPdlAutoReportNewSearchLastGroup
} from '@/api/core/monitoring/auto';
import { getFactoryPage } from '@/api/core/base/factory';
import * as XLSX from 'xlsx';
@@ -165,11 +211,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: '产线',
@@ -368,15 +414,27 @@ 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: 2, name: '自定义' },
{ id: 3, name: '上一班' }
],
width: 80,
width: 100,
onchange: true,
// defaultSelect: 1,
clearable: false,
@@ -437,6 +495,7 @@ export default {
{ id: 3, name: '月' },
{ id: 4, name: '年' }
],
onchange: true,
width: 80,
param: 'reportType'
},
@@ -467,6 +526,13 @@ export default {
productTableProps() {
// 当班数据的完整表头(基础列 + 当班动态表头)
const baseColumns = [
{
prop: 'sizes',
label: '规格',
width: 105,
showOverflowtooltip: true,
fixed: true
},
{
prop: 'process',
label: '产品工艺',
@@ -476,7 +542,8 @@ export default {
prop: 'processType',
label: '产品类型',
filter: (val) => (val != 1 ? '面板' : '背板'),
fixed: true
fixed: true,
sortable: true,
},
{
prop: 'factoryName',
@@ -513,13 +580,16 @@ 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
}
});
@@ -576,18 +646,26 @@ 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();
}
},
@@ -601,6 +679,12 @@ 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', '产线监控_自定义时间数据');
@@ -801,31 +885,126 @@ 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':
@@ -834,6 +1013,9 @@ 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,
@@ -842,12 +1024,9 @@ export default {
};
if (this.activeName === 'productLine') {
this.getDayDataList();
} else {
this.getProductList();
}
break;
default:
console.log(val);
@@ -1097,6 +1276,28 @@ 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) => {
@@ -1156,24 +1357,21 @@ export default {
console.log(value);
this.listQuery.timeType = value;
if (value === 1) {
// 切换为“当天”:隐藏查询类型、报表类型、时间范围
if (value === 2) {
// 切换为“自定义”:显示查询类型和时间范围
this.formConfig[1].type = 'select';
this.$refs.searchBarForm.formInline.timeType = value;
this.listQuery.timeType = value;
this.formConfig[7].type = 'datePicker';
} else {
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) {
@@ -1187,7 +1385,74 @@ export default {
this.formConfig[7].type = 'datePicker';
}
} else if (param === 'reportType') {
this.$refs.searchBarForm.formInline.timeVal = undefined;
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,
};
}
} else if (param === 'factoryId') {
// 切换工厂时刷新产线列表
this.listQuery.lineId = [];
@@ -1234,7 +1499,7 @@ export default {
.content-wrapper {
// flex: 1;
width: 100%;
height: calc(100vh - 303px);
height: calc(100vh - 280px);
// 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: 'outputNum',
prop: 'length',
label: '玻璃长度/mm'
},
{
@@ -314,9 +314,10 @@ export default {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
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.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.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: 'outputNum',
prop: 'length',
label: '玻璃长度/mm'
},
{

View File

@@ -262,6 +262,14 @@ 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="210" />
: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">
@@ -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="210" />
: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">
@@ -71,22 +71,68 @@
</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-else>
<div class="content-inner" v-if="listQuery.timeType === 2">
<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="210" :table-data="tableDataCustom" />
:limit="100" :table-props="tableProps" :max-height="300" :table-data="tableDataCustom" />
</div>
</div>
@@ -113,7 +159,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="210" />
:max-height="300" />
</div>
<!-- 当天数据占1/2剩余高度 -->
@@ -122,7 +168,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="210" />
:max-height="300" />
</div>
</div>
</div>
@@ -142,7 +188,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="210" />
:limit="100" :table-props="productTableProps" :table-data="productTableData" :max-height="300" />
</div>
</div>
</div>
@@ -154,7 +200,7 @@
import { parseTime } from '@/filter/code-filter';
import {
getLineAuto, getPdList, getPdlAutoReportNewSearchNow, getProductAuto,
getProcessAutoReportGroup, getProcessAutoReportDay, getProcessAutoReportNew
getProcessAutoReportGroup, getProcessAutoReportDay, getProcessAutoReportNew, getPdlAutoReportNewSearchLastGroup
} from '@/api/core/monitoring/auto';
import { getFactoryPage } from '@/api/core/base/factory';
import * as XLSX from 'xlsx';
@@ -165,11 +211,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: '产线',
@@ -368,15 +414,27 @@ 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: 2, name: '自定义' },
{ id: 3, name: '上一班' }
],
width: 80,
width: 100,
onchange: true,
// defaultSelect: 1,
clearable: false,
@@ -438,6 +496,7 @@ export default {
{ id: 4, name: '年' }
],
width: 80,
onchange: true,
param: 'reportType'
},
{
@@ -513,17 +572,20 @@ 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.getProductList();
this.getDayDataList();
this.getPdLineList();
const queryParams = {
pageNo: 1,
@@ -579,15 +641,21 @@ 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();
}
},
@@ -596,48 +664,52 @@ 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.removeFixedColumns(clonedTable);
this.adjustTableForExport(clonedTable);
// 转换为工作簿并导出
const workbook = XLSX.utils.table_to_book(clonedTable);
const fullName = `${fileName}_${this.formatDate()}.xlsx`;
XLSX.writeFile(workbook, fullName);
},
// 导出多个表格(同一个Excel的不同sheet
exportMultipleTables(tables) {
// 导出多个表格(新增自定义汇总文件名参数,适配不同选项卡
exportMultipleTables(tables, customSummaryName) {
const workbook = XLSX.utils.book_new();
let hasValidTable = false;
@@ -646,11 +718,9 @@ export default {
if (!table) return;
hasValidTable = true;
// 克隆表格并移除固定列
const clonedTable = table.cloneNode(true);
this.removeFixedColumns(clonedTable);
this.adjustTableForExport(clonedTable);
// 转换为sheet并添加到工作簿
const worksheet = XLSX.utils.table_to_sheet(clonedTable);
XLSX.utils.book_append_sheet(workbook, worksheet, name);
});
@@ -660,31 +730,128 @@ export default {
return;
}
// 导出包含多个sheet的Excel
const fullName = `生产监控数据汇总_${this.formatDate()}.xlsx`;
// 动态生成汇总文件名:自定义名称 + 日期
const fullName = `${customSummaryName}_${this.formatDate()}.xlsx`;
XLSX.writeFile(workbook, fullName);
},
// 辅助方法获取表格DOM元素
// 辅助方法获取表格DOM元素包含表头
getTableDom(refName) {
const tableComponent = this.$refs[refName];
if (!tableComponent) {
this.$message.warning(`未找到${refName}表格`);
return null;
}
// 获取表格组件内部的el-table DOM
const tableDom = tableComponent.$el.querySelector('.el-table__body-wrapper table');
if (!tableDom) {
// 获取完整表格容器(包含表头和表体)
const tableContainer = tableComponent.$el.querySelector('.el-table');
if (!tableContainer) {
this.$message.warning(`${refName}表格数据为空`);
return null;
}
return tableDom;
return tableContainer;
},
// 辅助方法:移除固定列(避免重复导出
removeFixedColumns(table) {
const fixedColumns = table.querySelectorAll('.el-table__fixed, .el-table__fixed-right');
fixedColumns.forEach(col => col.remove());
// 重点修复:调整表格结构(解决表头重复问题
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));
});
}
});
}
},
// 辅助方法:格式化日期(用于文件名)
@@ -698,7 +865,6 @@ export default {
String(date.getMinutes()).padStart(2, '0')
].join('');
},
// 获取产线和工厂列表
getPdLineList() {
getPdList().then(res => {
@@ -712,28 +878,85 @@ 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':
@@ -742,6 +965,9 @@ 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,
@@ -750,12 +976,9 @@ export default {
};
if (this.activeName === 'productLine') {
this.getDayDataList();
} else {
this.getProductList();
}
break;
default:
console.log(val);
@@ -763,8 +986,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 = ['日', '周', '月', '年'];
@@ -798,7 +1021,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) => {
@@ -827,7 +1050,7 @@ export default {
// 处理当班和当天数据(分别存储)
this.productTableData = formatData(resGroup.data.list); // 当班数据
console.log(this.productTableData,'productTableData');
console.log(this.productTableData, 'productTableData');
// --------------------------
// 生成当班数据的动态表头
@@ -1005,6 +1228,28 @@ 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) => {
@@ -1060,28 +1305,26 @@ export default {
// 搜索栏下拉选择变化
handleSearchBarChanged({ param, value }) {
console.log(value, param);
if (param === 'timeType') {
console.log(value);
this.listQuery.timeType = value;
if (value === 1) {
// 切换为“当天”:隐藏查询类型、报表类型、时间范围
if (value === 2) {
// 切换为“自定义”:显示查询类型和时间范围
this.formConfig[1].type = 'select';
this.$refs.searchBarForm.formInline.timeType = value;
this.listQuery.timeType = value;
this.formConfig[7].type = 'datePicker';
} else {
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) {
@@ -1095,7 +1338,74 @@ export default {
this.formConfig[7].type = 'datePicker';
}
} else if (param === 'reportType') {
this.$refs.searchBarForm.formInline.timeVal = undefined;
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,
};
}
} else if (param === 'factoryId') {
// 切换工厂时刷新产线列表
this.listQuery.lineId = [];
@@ -1142,7 +1452,7 @@ export default {
.content-wrapper {
// flex: 1;
width: 100%;
height: calc(100vh - 303px);
height: calc(100vh - 280px);
// overflow: hidden;
}

View File

@@ -1,14 +1,8 @@
<!--
* @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" />
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick"
@select-changed="selectType" />
<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"
@@ -17,34 +11,47 @@
<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 * as XLSX from 'xlsx'
import FileSaver from 'file-saver'
import jsPDF from 'jspdf'
import html2canvas from 'html2canvas'
import { getCostOriginRadioHisData, getPdList } from '@/api/core/monitoring/index';
import { exportCostOriginRadioHisData } from '../../../../api/core/monitoring';
const tableProps = [
// 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: '报表类型'
@@ -52,12 +59,11 @@ const tableProps = [
{
prop: 'time',
label: '日期',
// filter: parseTime,
width: 160
},
{
{
prop: 'bindObjectName',
label: '产线'
label: '产线'
},
{
prop: 'thick',
@@ -67,11 +73,11 @@ const tableProps = [
prop: 'speed',
label: '在线速度'
},
{
{
prop: 'width',
label: '掰边宽度'
},
{
},
{
prop: 'inArea',
label: '拉引量/㎡'
},
@@ -79,21 +85,83 @@ 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,
@@ -101,181 +169,366 @@ 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),
tableData: [],
fileName: '',
].filter(v => v),
fileName: '',
formConfig: [
{
type: 'select',
label: '维度',
label: '报表类型',
onchange: true,
selectOptions: [
{
id: '0',
name:'班组'
},
{
id: '1',
name: '日'
},
{
id: '2',
name: '周'
},
{
id: '3',
name: '月'
},
{
id: '4',
name: '年'
}
{ id: '0', name: '班组' },
{ id: '1', name: '日' },
{ id: '2', name: '周' },
{ id: '3', name: '月' },
{ id: '4', name: '年' }
],
param: 'statisticType'
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 下
},
// 日 - 日期范围选择
{
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 下
},
// 周 - 单个日期选择(自动获取本周范围)
{
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 下
},
// 月 - 日期范围选择
{
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 下
},
// 年 - 单个日期选择(自动获取本年范围)
{
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 下
}
]
},
{
type: 'select',
label: '产线',
selectOptions: [],
{
type: 'select',
label: '产线',
selectOptions: [],
param: 'bindObjectId'
},
{
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: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
// type: this.$auth.hasPermi('base:factory:export') ? 'button' : '',
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
}
],
};
},
{
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);
}
}
},
mounted() {
this.$refs.searchBarForm.formInline.statisticType = '1';
// Vue2 中 $refs 需在 $nextTick 中访问(确保 DOM 渲染完成)
this.$nextTick(() => {
if (this.$refs.searchBarForm) {
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
this.addOrUpdateVisible = true;
// Vue2 中 $nextTick 确保子组件已渲染
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data);
});
}
},
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', 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.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 = ['班组','日', '周', '月', '年'];
this.tableData = response.data?.list?.map((item) => {
item.reportType = arr[this.listQuery.statisticType];
item.statisticType = this.listQuery.statisticType
// 匹配 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;
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;
},
buttonClick(val) {
console.log('头部按钮点击:', 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.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;
}
},
// 获取数据列表
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;
// 匹配产线名称
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;
});
},
// 每页数变更
sizeChangeHandle(val) {
this.listQuery.pageSize = val;
this.listQuery.pageNo = 1;
this.getDataList();
},
// 当前页
// 当前页变更
currentChangeHandle(val) {
this.listQuery.pageNo = val;
this.getDataList();
},
// 导出处理
handleExport() {
// 处理查询参数
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(() => { });
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;
});
}
},
},
// 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

@@ -0,0 +1,274 @@
<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

@@ -1,65 +0,0 @@
<!--
* @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>

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