Compare commits

..

32 Commits

Author SHA1 Message Date
‘937886381’
35fb0d8bfb Merge branch 'projects/line-new' into projects/line-new-zhp 2025-12-24 16:35:44 +08:00
‘937886381’
0c52306cc6 修改 2025-12-24 16:34:37 +08:00
a5fba28ff7 Merge pull request 'projects/line-new-zhp' (#468) from projects/line-new-zhp into projects/line-new
Reviewed-on: #468
2025-12-23 08:53:19 +08:00
‘937886381’
1f8b994218 Merge branch 'projects/line-new' into projects/line-new-zhp 2025-12-23 08:49:07 +08:00
‘937886381’
ccfa73f3bc xiugai 2025-12-23 08:46:44 +08:00
‘937886381’
89ff79bfd7 修改 2025-12-23 08:35:46 +08:00
70a0fbb170 Merge pull request 'projects/line-new-zhp' (#466) from projects/line-new-zhp into projects/line-new
Reviewed-on: #466
2025-12-17 16:30:30 +08:00
‘937886381’
c86d94ac92 修改 2025-12-17 16:26:21 +08:00
‘937886381’
484ba6ca53 Merge branch 'projects/line-new' into projects/line-new-zhp 2025-12-15 10:45:49 +08:00
‘937886381’
f403375594 修改bug 2025-12-15 10:45:06 +08:00
1cd0b13aae Merge pull request 'projects/line-new-zhp' (#463) from projects/line-new-zhp into projects/line-new
Reviewed-on: #463
2025-12-12 16:54:55 +08:00
‘937886381’
d2b0565cd1 Merge branch 'projects/line-new' into projects/line-new-zhp 2025-12-12 16:53:32 +08:00
‘937886381’
7661dc5691 修改 2025-12-12 16:52:45 +08:00
1d698848c2 Merge pull request 'projects/line-new-zhp' (#461) from projects/line-new-zhp into projects/line-new
Reviewed-on: #461
2025-12-12 14:18:34 +08:00
‘937886381’
6d367b121c Merge branch 'projects/line-new' into projects/line-new-zhp 2025-12-12 14:17:56 +08:00
‘937886381’
e2385cf813 修改 2025-12-12 14:17:21 +08:00
552b1e6d6a Merge pull request '更新' (#460) from projects/line-new-zwq into projects/line-new
Reviewed-on: #460
2025-12-11 12:52:11 +08:00
zwq
4383067eb1 更新 2025-12-11 12:51:41 +08:00
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
177 changed files with 23175 additions and 22532 deletions

View File

@@ -12,8 +12,10 @@ ENV = 'development'
VUE_APP_TITLE = 智能监控分析系统 VUE_APP_TITLE = 智能监控分析系统
# 芋道管理系统/开发环境 # 芋道管理系统/开发环境
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://line.kszny.picaiba.com'
# VUE_APP_BASE_API = 'http://172.16.32.79:48082'
# 路由懒加载 # 路由懒加载
VUE_CLI_BABEL_TRANSPILE_MODULES = true VUE_CLI_BABEL_TRANSPILE_MODULES = true

BIN
dist.zip Normal file

Binary file not shown.

View File

@@ -6,7 +6,7 @@
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"local": "vue-cli-service serve --mode local", "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", "front": "vue-cli-service serve --mode front",
"build:prod": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build --mode prod", "build:prod": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build --mode prod",
"build:stage": "vue-cli-service build --mode stage", "build:stage": "vue-cli-service build --mode stage",
@@ -49,7 +49,7 @@
"bpmn-js-token-simulation": "0.10.0", "bpmn-js-token-simulation": "0.10.0",
"chinese-lunar": "^0.1.4", "chinese-lunar": "^0.1.4",
"clipboard": "2.0.8", "clipboard": "2.0.8",
"code-brick-zj": "^1.0.2", "code-brick-zj": "^1.1.1",
"core-js": "^3.26.0", "core-js": "^3.26.0",
"crypto-js": "^4.0.0", "crypto-js": "^4.0.0",
"diagram-js": "^12.3.0", "diagram-js": "^12.3.0",

View File

@@ -59,3 +59,34 @@ export function getEquipmentAll() {
method: 'get' method: 'get'
}) })
} }
export function getTree(query) {
return request({
url: '/base/factory/getTreeSimple',
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' 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) { export function getTeamReportPage(data) {
@@ -93,3 +102,17 @@ export function getProcessAutoReportNew(data) {
data: data, data: data,
}); });
} }
export function getPLlistByFactory(data) {
return request({
url: 'base/production-line/listByFactory',
method: 'post',
data: data,
});
}
export function getProcessAutoReportLastGroup(data) {
return request({
url: '/monitoring/production-monitor/getProcessAutoReportLastGroup',
method: 'post',
data: data,
});
}

View File

@@ -141,3 +141,13 @@ export function getPerView(data) {
data: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' method: 'get'
}) })
} }
// 检查更新-生产班组
export function updateIsProduction(id) {
return request({
url: '/base/group-team/updateIsProduction?id=' + id,
method: 'get'
})
}
// 获得班组基础信息分页 // 获得班组基础信息分页
export function getGroupPage(query) { export function getGroupPage(query) {

View File

@@ -90,3 +90,29 @@ export function getEnableData() {
method: 'get', 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,139 +0,0 @@
/*
* @Author: zwq
* @Date: 2025-11-17 09:25:12
* @LastEditors: zwq
* @LastEditTime: 2025-11-19 13:11:54
* @Description:
*/
import request from '@/utils/request'
// 获得原料分页
export function getProductPage(query) {
return request({
url: '/wms/material/page',
method: 'get',
params: query
})
}
// 获得原料
export function getProduct(id) {
return request({
url: '/wms/material/get?id=' + id,
method: 'get'
})
}
// 删除原料
export function deleteProduct(id) {
return request({
url: '/wms/material/delete?id=' + id,
method: 'delete'
})
}
// 更新
export function updateProduct(data) {
return request({
url: '/wms/material/update',
method: 'put',
data: data
})
}
// 创建
export function createProduct(data) {
return request({
url: '/wms/material/create',
method: 'post',
data: data
})
}
// 获得工艺分页
export function getProcessPage(query) {
return request({
url: '/wms/process/page',
method: 'get',
params: query
})
}
// 删除工艺
export function deleteProcess(id) {
return request({
url: '/wms/process/delete?id=' + id,
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

@@ -54,7 +54,7 @@ export default {
}; };
}, },
created() { created() {
this.currentMenu = this.menus[0]; // this.currentMenu = this.menus[0];
}, },
watch: { watch: {
currentMenu(val) { currentMenu(val) {

View File

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

View File

@@ -2,7 +2,7 @@
* @Author: zwq * @Author: zwq
* @Date: 2022-08-24 11:19:43 * @Date: 2022-08-24 11:19:43
* @LastEditors: zwq * @LastEditors: zwq
* @LastEditTime: 2025-11-19 13:20:30 * @LastEditTime: 2024-04-02 09:33:29
* @Description: * @Description:
*/ */
export default { export default {
@@ -16,7 +16,7 @@ export default {
}, },
tableData: [], //table数据 tableData: [], //table数据
listQuery: { //分页 listQuery: { //分页
pageSize: 10, pageSize: 20,
pageNo: 1, pageNo: 1,
total: 1, total: 1,
}, },
@@ -69,7 +69,7 @@ export default {
this.$refs.addOrUpdate.init(val.data.id); this.$refs.addOrUpdate.init(val.data.id);
}); });
} else if (val.type === "delete") { } 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 { } else {
this.otherMethods(val) this.otherMethods(val)
} }

View File

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

View File

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

View File

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

View File

@@ -176,13 +176,15 @@ service.interceptors.response.use(async res => {
+ '<div>5 分钟搭建本地环境</div>', + '<div>5 分钟搭建本地环境</div>',
}) })
return Promise.reject(new Error(msg)) return Promise.reject(new Error(msg))
} else if (code === 400) {
//【班组管理】【排班计划】提交的校验按照原型图补充完整,排班计划是否重叠code400 有两个不同的返回信息
return res.data
} else if (code !== 200) { } else if (code !== 200) {
if (msg === '无效的刷新令牌') { // hard coding忽略这个提示直接登出 if (msg === '无效的刷新令牌') { // hard coding忽略这个提示直接登出
console.log(msg) console.log(msg)
} else { } else {
Notification.error({ //【班组管理】【排班计划】提交的校验按照原型图补充完整,排班计划是否重叠code400 有两个不同的返回信息
title: msg return res.data
})
} }
return Promise.reject('error') return Promise.reject('error')
} else { } else {

View File

@@ -6,14 +6,8 @@
--> -->
<template> <template>
<el-drawer <el-drawer :visible="visible" :show-close="false" :wrapper-closable="false" class="drawer" custom-class="mes-drawer"
:visible="visible" :size="size || '50%'" @closed="$emit('destroy')">
:show-close="false"
:wrapper-closable="false"
class="drawer"
custom-class="mes-drawer"
:size="size || '50%'"
@closed="$emit('destroy')">
<SmallTitle slot="title"> <SmallTitle slot="title">
{{ {{
mode.includes('detail') mode.includes('detail')
@@ -29,9 +23,7 @@
<section v-for="(section, index) in sections" :key="section.key"> <section v-for="(section, index) in sections" :key="section.key">
<SmallTitle v-if="index != 0">{{ section.name }}</SmallTitle> <SmallTitle v-if="index != 0">{{ section.name }}</SmallTitle>
<div <div class="form-part" v-if="section.key == 'base'"
class="form-part"
v-if="section.key == 'base'"
style="border-bottom: 1px solid #dfdfdf; margin-bottom: 24px"> style="border-bottom: 1px solid #dfdfdf; margin-bottom: 24px">
<el-skeleton v-if="!showForm" animated /> <el-skeleton v-if="!showForm" animated />
<!-- <BaseInfoForm <!-- <BaseInfoForm
@@ -45,9 +37,7 @@
<!-- if --> <!-- if -->
<el-row v-if="mode.includes('detail')" style="margin-bottom: 24px"> <el-row v-if="mode.includes('detail')" style="margin-bottom: 24px">
<el-col :span="8"> <el-col :span="8">
<div <div class="title" style="font-weight: 700; font-size: 16px; margin: 8px 0">
class="title"
style="font-weight: 700; font-size: 16px; margin: 8px 0">
设备名 设备名
</div> </div>
<div class="value" style="font-size: 14px"> <div class="value" style="font-size: 14px">
@@ -55,9 +45,7 @@
</div> </div>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<div <div class="title" style="font-weight: 700; font-size: 16px; margin: 8px 0">
class="title"
style="font-weight: 700; font-size: 16px; margin: 8px 0">
关联表名 关联表名
</div> </div>
<div class="value" style="font-size: 14px"> <div class="value" style="font-size: 14px">
@@ -69,37 +57,16 @@
<el-row v-else style="margin-bottom: 24px" :gutter="20"> <el-row v-else style="margin-bottom: 24px" :gutter="20">
<el-form ref="form" :model="form"> <el-form ref="form" :model="form">
<el-col :span="8"> <el-col :span="8">
<el-form-item <el-form-item class="title" label="设备名" style="font-size: 16px; margin: 8px 0">
class="title" <el-select v-model="form.equipmentId" filterable clearable placeholder="请选择设备">
label="设备名" <el-option v-for="eq in eqList" :key="eq.id" :label="eq.name" :value="eq.id"></el-option>
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-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item <el-form-item class="title" label="设备关联表名" style="font-size: 16px; margin: 8px 0">
class="title" <el-select v-model="form.plcId" filterable clearable placeholder="请选择关联表">
label="设备关联表名" <el-option v-for="plc in plcList" :key="plc.id" :label="plc.plcTableName"
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> :value="plc.id"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
@@ -108,73 +75,44 @@
</el-row> </el-row>
</div> </div>
<div <div v-if="section.key == 'attrs'" style="position: relative; margin-top: 12px">
v-if="section.key == 'attrs'" <div v-if="!mode.includes('detail')" style="position: absolute; top: -40px; right: 0">
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"> <el-button @click="handleAddAttr" type="text">
<i class="el-icon-plus"></i> <i class="el-icon-plus"></i>
添加参数 添加参数
</el-button> </el-button>
</div> </div>
<base-table <base-table v-loading="attrListLoading" :table-props="section.props" :page="attrQuery?.params.pageNo || 1"
v-loading="attrListLoading" :limit="attrQuery?.params.pageSize || 10" :table-data="list" @emitFun="handleEmitFun">
: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 : '添加属性'" <!-- :add-button-show="mode.includes('detail') ? null : '添加属性'"
@emitButtonClick="handleAddAttr" --> @emitButtonClick="handleAddAttr" -->
<method-btn <method-btn v-if="section.tableBtn && !mode.includes('detail')" slot="handleBtn" label="操作"
v-if="section.tableBtn && !mode.includes('detail')" :method-list="tableBtn" @clickBtn="handleTableBtnClick" />
slot="handleBtn"
label="操作"
:method-list="tableBtn"
@clickBtn="handleTableBtnClick" />
</base-table> </base-table>
<!-- 分页组件 --> <!-- 分页组件 -->
<pagination <pagination v-show="total > 0" :total="total" :page.sync="attrQuery.params.pageNo"
v-show="total > 0" :limit.sync="attrQuery.params.pageSize" @pagination="getAttrList" />
:total="total"
:page.sync="attrQuery.params.pageNo"
:limit.sync="attrQuery.params.pageSize"
@pagination="getAttrList" />
</div> </div>
</section> </section>
</div> </div>
<div class="drawer-body__footer"> <div class="drawer-body__footer">
<el-button style="" @click="handleCancel">取消</el-button> <el-button style="" @click="handleCancel">取消</el-button>
<el-button <el-button type="primary" v-if="!mode.includes('detail')" @click="handleSave">
type="primary"
v-if="!mode.includes('detail')"
@click="handleSave">
保存 保存
</el-button> </el-button>
</div> </div>
</div> </div>
<!-- 属性对话框 --> <!-- 属性对话框 -->
<base-dialog <base-dialog v-if="sections[1].allowAdd" :dialogTitle="attrTitle" :dialogVisible="attrFormVisible" width="45%"
v-if="sections[1].allowAdd" :append-to-body="true" custom-class="baseDialog" @close="closeAttrForm" @cancel="closeAttrForm"
:dialogTitle="attrTitle"
:dialogVisible="attrFormVisible"
width="45%"
:append-to-body="true"
custom-class="baseDialog"
@close="closeAttrForm"
@cancel="closeAttrForm"
@confirm="submitAttrForm"> @confirm="submitAttrForm">
<!-- :disabled="mode.includes('detail')" --> <!-- :disabled="mode.includes('detail')" -->
<DialogForm <DialogForm v-if="attrFormVisible" ref="attrForm" v-model="attrForm" :data-form="attrForm"
v-if="attrFormVisible" :rows="attrRows"
ref="attrForm" @update="handleAttrFormUpdate"/>
v-model="attrForm"
:rows="attrRows" />
</base-dialog> </base-dialog>
</el-drawer> </el-drawer>
</template> </template>
@@ -233,6 +171,8 @@ export default {
description: '', description: '',
remark: '', remark: '',
alarmContent: '', alarmContent: '',
displayTip: false,
alarmTip: false,
}, },
attrFormVisible: false, attrFormVisible: false,
attrRows: [ attrRows: [
@@ -342,6 +282,26 @@ 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,
},
},
], ],
[ [
{ {
@@ -437,6 +397,23 @@ 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 }) { handleTableBtnClick({ type, data }) {
switch (type) { switch (type) {
case 'edit': case 'edit':
@@ -503,6 +480,7 @@ export default {
plcParamName: '', plcParamName: '',
unit: '', unit: '',
collection: 1, collection: 1,
minValue: '', minValue: '',
maxValue: '', maxValue: '',
defaultValue: '', defaultValue: '',
@@ -511,6 +489,8 @@ export default {
equipmentParamType: '', equipmentParamType: '',
productionParamType: '', productionParamType: '',
alarmContent: '', alarmContent: '',
displayTip: false,
alarmTip: false,
}; };
this.attrTitle = '添加参数绑定信息'; this.attrTitle = '添加参数绑定信息';
this.attrFormVisible = true; this.attrFormVisible = true;
@@ -524,7 +504,14 @@ export default {
params: { id: attrId }, params: { id: attrId },
}); });
if (res.code == 0) { if (res.code == 0) {
this.attrForm = res.data; 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.attrTitle = '编辑参数绑定信息';
this.attrFormVisible = true; this.attrFormVisible = true;
} }
@@ -564,6 +551,7 @@ export default {
if (!valid) { if (!valid) {
return; return;
} }
console.log('this.attrForm', this.attrForm);
const isEdit = this.attrForm.id != null; const isEdit = this.attrForm.id != null;
this.attrFormSubmitting = true; this.attrFormSubmitting = true;
@@ -583,8 +571,9 @@ export default {
type: 'success', type: 'success',
duration: 1500, duration: 1500,
onClose: () => { onClose: () => {
this.getAttrList();
this.shouldRefreshPageView = true; this.shouldRefreshPageView = true;
this.getAttrList();
}, },
}); });
} }

View File

@@ -89,6 +89,31 @@ export default {
}, },
created() {}, created() {},
methods: { methods: {
dataFormSubmit() {
this.$refs["dataForm"].validate((valid) => {
if (!valid) {
return false;
}
// 修改的提交
if (this.dataForm.id) {
this.urlOptions.updateURL(this.dataForm).then(response => {
this.$modal.msgSuccess("修改成功");
this.visible = false;
this.$emit("refreshDataList");
});
return;
}
// 添加的提交
this.urlOptions.createURL(this.dataForm).then(response => {
if (response.code === 1001033 || response.code === 1001034) {
return this.$modal.msgError(response.msg);
}
this.$modal.msgSuccess("新增成功");
this.visible = false;
this.$emit("refreshDataList");
});
});
},
}, },
}; };
</script> </script>

View File

@@ -63,7 +63,7 @@
style="width: 75%" style="width: 75%"
v-model="dataForm.price" v-model="dataForm.price"
clearable clearable
placeholder="请输入允许留存时间" /> placeholder="请输入单价" />
{{ unit }} {{ unit }}
</el-form-item> </el-form-item>
</el-col> </el-col>
@@ -103,7 +103,7 @@ export default {
id: null, id: null,
code: '', code: '',
materialId: '', materialId: '',
price: '', price: undefined,
startTime: new Date().getTime(), startTime: new Date().getTime(),
endTime: null, endTime: null,
remark: '', remark: '',
@@ -141,15 +141,40 @@ export default {
} }
}, },
setCode() { setCode() {
console.log('this.MaterialList', this.urlOptions.dictArr.dict0);
this.MaterialList.forEach((item) => { this.MaterialList.forEach((item) => {
if (item.id === this.dataForm.materialId) { if (item.id === this.dataForm.materialId) {
this.dataForm.code = item.code; this.dataForm.code = item.code;
this.unit = this.unit =
'元/' + '元/' +
this.urlOptions.dictArr.dict0.find((d) => d.value === item.unit) this.urlOptions.dictArr.dict0.find((d) => d.value == item.unit)
.label; .label;
} }
}); });
},
dataFormSubmit() {
this.$refs["dataForm"].validate((valid) => {
if (!valid) {
return false;
}
// 修改的提交
if (this.dataForm.id) {
this.urlOptions.updateURL(this.dataForm).then(response => {
this.$modal.msgSuccess("修改成功");
this.visible = false;
this.$emit("refreshDataList");
});
return;
}
// 添加的提交
this.urlOptions.createURL(this.dataForm).then(response => {
// console.log('response',);
this.$modal.msgSuccess("新增成功");
this.visible = false;
this.$emit("refreshDataList");
});
});
}, },
}, },
}; };

View File

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

View File

@@ -64,7 +64,7 @@
<script> <script>
import eqDetail from './eq-detail'; import eqDetail from './eq-detail';
import { parseTime } from '../../mixins/code-filter'; import { parseTime } from '../../mixins/code-filter';
import { getPdList } from '@/api/core/monitoring/auto'; import { getPLlistByFactory } from '@/api/core/monitoring/auto';
import { getNewCTNow, getNewCTCharts } from '@/api/core/analysis/index'; import { getNewCTNow, getNewCTCharts } from '@/api/core/analysis/index';
import { getFactoryPage } from '@/api/core/base/factory'; import { getFactoryPage } from '@/api/core/base/factory';
// import codeFilter from '../../mixins/code-filter' // import codeFilter from '../../mixins/code-filter'
@@ -135,6 +135,8 @@ export default {
label: '工厂', label: '工厂',
selectOptions: [], selectOptions: [],
param: 'factoryId', param: 'factoryId',
collapseTags: true,
multiple: true,
onchange: true, onchange: true,
}, },
{ {
@@ -142,6 +144,7 @@ export default {
label: '产线', label: '产线',
selectOptions: [], selectOptions: [],
param: 'lineId', param: 'lineId',
collapseTags: true,
multiple: true, multiple: true,
}, },
{ {
@@ -232,9 +235,9 @@ export default {
return exportTableOut; return exportTableOut;
}, },
getPdLineList() { getPdLineList() {
getPdList().then((res) => { // getPLlistByFactory().then((res) => {
this.formConfig[1].selectOptions = res.data || []; // this.formConfig[1].selectOptions = res.data || [];
}); // });
const params = { const params = {
pageSize: 100, pageSize: 100,
pageNo: 1, pageNo: 1,
@@ -274,7 +277,7 @@ export default {
handleSearchBarChanged({ param, value }) { handleSearchBarChanged({ param, value }) {
this.listQuery.lineId = []; this.listQuery.lineId = [];
this.$refs.searchBarForm.formInline.lineId = undefined; this.$refs.searchBarForm.formInline.lineId = undefined;
getPdList(value).then((res) => { getPLlistByFactory({ factoryIds: this.$refs.searchBarForm.formInline.factoryId }).then((res) => {
this.formConfig[1].selectOptions = res.data || []; this.formConfig[1].selectOptions = res.data || [];
}); });
}, },

View File

@@ -1,56 +1,21 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<search-bar <search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<div v-if="tableData.length"> <div v-if="tableData.length">
<base-table <base-table v-loading="dataListLoading" :table-props="tableProps" :max-height="tableH" :table-data="tableData" />
v-loading="dataListLoading"
:table-props="tableProps"
:max-height="tableH"
:table-data="tableData" />
<SearchBar :formConfigs="[{ label: '产品产量对比图', type: 'title' }]" /> <SearchBar :formConfigs="[{ label: '产品产量对比图', type: 'title' }]" />
<line-chart ref="lineChart" /> <line-chart ref="lineChart" />
</div> </div>
<div v-else class="no-data-bg"></div> <div v-else class="no-data-bg"></div>
<!-- <pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" /> -->
</div> </div>
</template> </template>
<script> <script>
// import basicPage from '../../mixins/basic-page';
import { parseTime } from '../../mixins/code-filter'; import { parseTime } from '../../mixins/code-filter';
import { getYieldAnalysisPageData } from '@/api/core/analysis/index'; import { getYieldAnalysisPageData } from '@/api/core/analysis/index';
import { getProductionLinePage } from '@/api/core/base/productionLine'; import { getProductionLinePage } from '@/api/core/base/productionLine';
import lineChart from '../LineChart'; import lineChart from '../LineChart';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin'; import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
// import { getWorkshopSectionPage } from '@/api/core/base/workshopSection';
// const tableProps = [
// // {
// // prop: 'lineName',
// // label: '产线',
// // align: 'center',
// // },
// // {
// // prop: 'sum',
// // label: '合计',
// // align: 'center',
// // },
// // {
// // prop: 'dynamicValue',
// // label: 'dynamicName',
// // align: 'center',
// // children:[
// // ]
// // }
// ];
export default { export default {
components: { components: {
@@ -67,31 +32,30 @@ export default {
tableData: [], tableData: [],
listQuery: { listQuery: {
lineIds: [], lineIds: [],
time: '', time: '', // 存储时间选择器的选中值(时间戳/格式化字符串,根据接口要求调整)
}, },
dateLabelList: [], dateLabelList: [],
optionArrUrl: [getProductionLinePage], optionArrUrl: [getProductionLinePage],
formConfig: [ formConfig: [
{
type: 'datePicker',
label: '时间',
dateType: 'month', // 单个月份选择
format: 'yyyy-MM', // 显示格式
valueFormat: 'yyyy-MM-dd HH:mm:ss', // 绑定值的格式
param: 'time',
defaultSelect: '', // 新增:默认月份值
},
{ {
type: 'select', type: 'select',
label: '产线', label: '产线',
selectOptions: [], selectOptions: [],
param: 'lineIds', param: 'lineIds',
defaultSelect: [], defaultSelect: [], // 产线默认选择值(多选数组)
multiple: true, multiple: true,
collapseTags: true,
filterable: true, filterable: true,
width: 200, width: 300,
},
{
type: 'datePicker',
label: '时间',
dateType: 'month',
format: 'yyyy-MM',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'time',
}, },
{ {
type: 'button', type: 'button',
@@ -102,28 +66,60 @@ export default {
], ],
}; };
}, },
created() { mounted() {
// 1. 初始化默认当月时间
this.initDefaultMonth();
// 2. 获取产线数据
this.getArr(); this.getArr();
}, },
methods: { methods: {
/**
* 初始化默认当月时间(单个月份)
*/
initDefaultMonth() {
const now = new Date();
const year = now.getFullYear();
const month = now.getMonth(); // 月份从0开始直接使用取当月1号
// 创建当月1号0点0分0秒的日期对象
const firstDayOfMonth = new Date(year, month, 1, 0, 0, 0);
// 转换为时间戳(毫秒级)
const defaultTimeStamp = firstDayOfMonth.getTime();
// 给时间选择器赋值默认值
this.formConfig[0].defaultSelect = firstDayOfMonth;
// this.listQuery.time = defaultTimeStamp;
},
/**
* 获取产线数据
*/
getArr() { getArr() {
const params = { const params = {
page: 1, page: 1,
limit: 500, limit: 500,
}; };
this.optionArrUrl.forEach((item, index) => { // 原代码forEach遍历冗余直接调用第一个方法即可
item(params).then((response) => { this.optionArrUrl[0](params)
this.formConfig[index].selectOptions = response.data.list; .then((response) => {
// this.formConfig[0].defaultSelect = response.data.list[0].id const lineList = response.data.list;
// this.$set(this.formConfig[0], 'defaultSelect', response.data.list[0].id) this.formConfig[1].selectOptions = lineList;
}); // 产线默认选择第一条数据(多选需用数组格式)
if (lineList.length > 0) {
const firstLineId = lineList[0].id;
this.formConfig[1].defaultSelect = [firstLineId];
// 给查询参数赋值
this.listQuery.lineIds = [firstLineId];
}
})
.catch((err) => {
console.error('获取产线数据失败:', err);
}); });
}, },
/**
* 获取产量分析数据
*/
getData() { getData() {
// this.listQuery.lineIds = ['1672847052717821953'] this.dataListLoading = true; // 开启加载状态
// this.listQuery.productId = val.productId; this.urlOptions.getDataListURL(this.listQuery)
// this.listQuery.time = '1694486098000'; .then((res) => {
this.urlOptions.getDataListURL(this.listQuery).then((res) => {
let arr = [ let arr = [
{ {
prop: 'lineName', prop: 'lineName',
@@ -142,49 +138,39 @@ export default {
children: [], children: [],
}, },
]; ];
// console.log(res.data.nameData.slice(1))
let xData = []; let xData = [];
let yAllData = []; let yAllData = [];
let lineName = []; let lineName = [];
if (res.data) { if (res.data) {
// 处理日期标签去重
let tempDateList = []; let tempDateList = [];
res.data.nameData.forEach((date) => { res.data.nameData.forEach((date) => {
tempDateList.push(date.name); tempDateList.push(date.name);
}); });
this.dateLabelList = Array.from(new Set(tempDateList)); this.dateLabelList = Array.from(new Set(tempDateList));
// 构造表头children和echarts横坐标
this.dateLabelList.forEach((item) => { this.dateLabelList.forEach((item) => {
if (item.indexOf('年') === -1) { if (item.indexOf('年') === -1) {
// 构造表头 arr[2].children.push({
const props = {
prop: item, prop: item,
label: item, label: item,
}; });
arr[2].children.push(props);
// 构造echarts横坐标
xData.push(item); xData.push(item);
} }
}); });
// res.data.nameData.slice(1).forEach(item => {
// const props = { // 构造表格数据
// 'prop': item.name,
// 'label': item.name,
// 'align': 'center'
// }
// arr[2].children.push(props)
// })
let tableDataArr = []; let tableDataArr = [];
res.data.data.forEach((item) => { res.data.data.forEach((item) => {
let obj = {}; let obj = {
(obj.lineName = item.lineName), lineName: item.lineName,
(obj.sum = item.sum), sum: item.sum,
item.data.forEach((ele, index) => { };
// console.log(ele) item.data.forEach((ele) => {
ele.children.forEach((e) => { ele.children.forEach((e) => {
console.log(e.dynamicName); obj[e.dynamicName] = e.dynamicValue;
obj['' + e.dynamicName + ''] = e.dynamicValue;
console.log(obj['' + e.dynamicName + '']);
}); });
}); });
tableDataArr.push(obj); tableDataArr.push(obj);
@@ -192,29 +178,17 @@ export default {
this.tableData = tableDataArr; this.tableData = tableDataArr;
this.tableProps = arr; this.tableProps = arr;
// let tempList = [] // 构造图表数据
// res.data.nameData.slice(1).forEach(item => {
// tempList.push(item.name)
// // arr[2].children.push(props)
// })
// xData = Array.from(new Set(tempList))
res.data.data.forEach((item) => { res.data.data.forEach((item) => {
let yData = []; let yData = [];
lineName.push(item.lineName); lineName.push(item.lineName);
// let obj = {} item.data.forEach((ele) => {
// obj.lineName = item.lineName,
// obj.sum = item.sum,
item.data.forEach((ele, index) => {
// console.log(ele)
ele.children.forEach((e) => { ele.children.forEach((e) => {
// let yData = []
yData.push(e.dynamicValue); yData.push(e.dynamicValue);
}); });
}); });
yAllData.push(yData); yAllData.push(yData);
}); });
console.log(lineName);
} else { } else {
this.tableProps = arr; this.tableProps = arr;
this.tableData = []; this.tableData = [];
@@ -222,47 +196,61 @@ export default {
yAllData = []; yAllData = [];
lineName = []; lineName = [];
} }
// res.data.data[0].data[0].children.forEach((item, index) => {
// // console.log(item) // 初始化图表
// yData.push(item.dynamicValue)
// // let data = 'data' + Number(index+1)
// // obj['' + item.dynamicName + ''] = item.dynamicValue
// })
// console.log(this.yData)
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.lineChart.initChart(xData, yAllData, lineName); this.$refs.lineChart.initChart(xData, yAllData, lineName);
}); });
// this.total = response.data.total; })
// this.dataListLoading = false; .catch((err) => {
console.error('获取产量数据失败:', err);
this.tableData = [];
})
.finally(() => {
this.dataListLoading = false; // 关闭加载状态
}); });
}, },
/**
* 搜索栏按钮点击事件
* @param {Object} val - 按钮/表单传递的参数
*/
buttonClick(val) { buttonClick(val) {
switch (val.btnName) { switch (val.btnName) {
case 'search': case 'search':
this.listQuery.lineIds = val.lineIds ? val.lineIds : undefined; // 处理产线参数避免undefined空值设为空数组
// this.listQuery.productId = val.productId; this.listQuery.lineIds = val.lineIds || [];
this.listQuery.time = val.time // 处理时间参数:如果是时间字符串,可转换为时间戳(根据接口要求调整)
? new Date(val.time).getTime()
: undefined;
// this.listQuery.pageNo = 1;
// this.listQuery.pageSize = 10;
if (val.time) { if (val.time) {
this.getData(); // this.listQuery.time = val.time;
// 若接口需要时间戳,取消下面注释:
this.listQuery.time = new Date(val.time).getTime();
} else { } else {
this.$message({ this.$message({
message: '请选择时间', message: '请选择时间',
type: 'warning', type: 'warning',
}); });
return;
} }
// 验证产线是否选择(可选,根据业务需求调整)
if (this.listQuery.lineIds.length === 0) {
this.$message({
message: '请选择至少一条产线',
type: 'warning',
});
return;
}
this.getData();
break; break;
case 'reset': case 'reset':
// 重置表单
this.$refs.searchBarForm.resetForm(); this.$refs.searchBarForm.resetForm();
// 恢复默认值
this.listQuery = { this.listQuery = {
pageSize: 10, lineIds: this.formConfig[1].defaultSelect || [],
pageNo: 1, time: this.formConfig[0].defaultValue || '',
total: 1,
}; };
this.getDataList();
break; break;
default: default:
console.log(val); console.log(val);

View File

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

View File

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

View File

@@ -66,20 +66,30 @@
</el-row> </el-row>
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12"> <el-col :span="12">
<el-form-item label="完成单位产品用时" prop="processTime"> <el-form-item label="完成单位产品用时(S)" prop="processTime">
<el-input :disabled="isdetail" v-model="dataForm.processTime" placeholder="请输入完成单位产品用时" /> <el-input :disabled="isdetail" v-model="dataForm.processTime" placeholder="请输入完成单位产品用时(S)" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label=" 加工属性" prop="processType"> <el-form-item label=" 产品工艺" prop="processTypes">
<el-select v-model="dataForm.processType" clearable style="width: 100%" :disabled="isdetail" <el-select :disabled="isdetail" collapse-tags multiple v-model="dataForm.processTypes" clearable
placeholder="请选择加工属性"> style="width: 100%" placeholder="请选择产品工艺">
<el-option v-for="dict in processTypeList" :key="dict.id" :label="dict.label" <el-option v-for="dict in processTypeList" :key="dict.value" :label="dict.label"
:value="dict.id" /> :value="dict.value" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<!-- <el-row :gutter="20">
<el-col :span="12">
<el-form-item label=" 基板类型" prop="typeDictValue">
<el-select :disabled="isdetail" v-model="dataForm.typeDictValue" clearable
style="width: 100%" placeholder="请选择基板类型">
<el-option v-for="dict in typeList" :key="dict.value" :label="dict.label" :value="dict.value" />
</el-select>
</el-form-item>
</el-col>
</el-row> -->
</el-form> </el-form>
<small-title style="margin: 16px 0; padding-left: 8px" :no-padding="true"> <small-title style="margin: 16px 0; padding-left: 8px" :no-padding="true">
@@ -144,7 +154,7 @@ import {
import productAttrAdd from './attr-add'; import productAttrAdd from './attr-add';
import { parseTime } from '../../mixins/code-filter'; import { parseTime } from '../../mixins/code-filter';
import SmallTitle from './SmallTitle'; import SmallTitle from './SmallTitle';
import { listData } from "@/api/system/dict/data"; //数据字典接口
const tableBtn = [ const tableBtn = [
{ {
type: 'edit', type: 'edit',
@@ -191,29 +201,31 @@ export default {
unitDictValue: '', // 单位id unitDictValue: '', // 单位id
originalSpecifications: '', // 原片规格 originalSpecifications: '', // 原片规格
originalArea: 0, // 原片单位平方数 originalArea: 0, // 原片单位平方数
processType:undefined, processTypes: [],
typeDictValue: null,
}, },
typeList:[],
listQuery: { listQuery: {
pageSize: 10, pageSize: 10,
pageNo: 1, pageNo: 1,
total: 0, total: 0,
}, },
processTypeList: [ processTypeList: [
{ // {
id: '0', // value: '1',
label:'压花丝印' // label: '压花丝印'
}, // },
{ // {
id: '1', // value: '2',
label: '无印打孔' // label: '无印打孔'
}, // },
{ // {
id: '2', // value: '3',
label: '单层镀膜' // label: '单层镀膜'
}, { // }, {
id: '3', // value: '4',
label: '双层镀膜' // label: '双层镀膜'
} // }
], ],
dataRule: { dataRule: {
code: [ code: [
@@ -269,14 +281,37 @@ export default {
}; };
}, },
methods: { methods: {
initData() { async initData() {
this.productAttributeList.splice(0); this.productAttributeList.splice(0);
this.listQuery.total = 0; this.listQuery.total = 0;
const typeRes = await listData({
pageNo:
1,
pageSize
: 10,
dictType
: 'product_type'
})
this.typeList = typeRes.data.list
console.log('typeRes', this.typeList);
const processTypeRes = await listData({
pageNo:
1,
pageSize
: 10,
dictType
: 'process_type'
})
this.processTypeList = processTypeRes.data.list
console.log('typeRes', this.typeList);
}, },
init(id, isdetail) { init(id, isdetail) {
this.initData(); this.initData();
this.isdetail = isdetail || false; this.isdetail = isdetail || false;
this.dataForm.id = id || null; this.dataForm.id = id || null;
// this.dataForm.processTypes = [] // 清空工艺选择
this.visible = true; this.visible = true;
this.$nextTick(() => { this.$nextTick(() => {
@@ -284,8 +319,25 @@ export default {
if (this.dataForm.id) { if (this.dataForm.id) {
// 获取产品详情 // 获取产品详情
getProduct(id).then((response) => { getProduct(id).then((res) => {
this.dataForm = response.data; 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(); this.getList();
@@ -310,8 +362,7 @@ export default {
handleClick(raw) { handleClick(raw) {
if (raw.type === 'delete') { if (raw.type === 'delete') {
this.$confirm( this.$confirm(
`确定对${ `确定对${raw.data.name
raw.data.name
? '[名称=' + raw.data.name + ']' ? '[名称=' + raw.data.name + ']'
: '[序号=' + raw.data._pageIndex + ']' : '[序号=' + raw.data._pageIndex + ']'
}进行删除操作?`, }进行删除操作?`,
@@ -343,6 +394,7 @@ export default {
dataFormSubmit() { dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => { this.$refs['dataForm'].validate((valid) => {
if (valid) { if (valid) {
// 修改的提交 // 修改的提交
if (this.dataForm.id) { if (this.dataForm.id) {
updateProduct(this.dataForm).then((response) => { updateProduct(this.dataForm).then((response) => {
@@ -411,6 +463,7 @@ export default {
padding: 32px 32px 24px; padding: 32px 32px 24px;
border-bottom: 1px solid #dcdfe6; border-bottom: 1px solid #dcdfe6;
} }
.drawer>>>.el-drawer__body { .drawer>>>.el-drawer__body {
flex: 1; flex: 1;
height: 1px; height: 1px;
@@ -431,7 +484,8 @@ export default {
max-height: 76vh; max-height: 76vh;
overflow: hidden; overflow: hidden;
overflow-y: scroll; overflow-y: scroll;
padding-right: 10px; /* 调整滚动条样式 */ padding-right: 10px;
/* 调整滚动条样式 */
} }
.drawer>>>.el-form, .drawer>>>.el-form,

View File

@@ -1,10 +1,7 @@
<template> <template>
<el-dialog <el-dialog v-loading="isLoading" loading-text="处理中..." loading-spinner="el-icon-loading"
:visible.sync="visible" loading-background="rgba(255, 255, 255, 0.7)" :visible.sync="visible" :width="'35%'" :append-to-body="true"
:width="'35%'" :close-on-click-modal="false" class="dialog">
:append-to-body="true"
:close-on-click-modal="false"
class="dialog">
<template #title> <template #title>
<slot name="title"> <slot name="title">
<div class="titleStyle"> <div class="titleStyle">
@@ -13,29 +10,19 @@
</slot> </slot>
</template> </template>
<el-form <el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="100px"
ref="dataForm"
:model="dataForm"
:rules="dataRule"
label-width="100px"
@keyup.enter.native="dataFormSubmit()"> @keyup.enter.native="dataFormSubmit()">
<el-form-item label="属性名" prop="name"> <el-form-item label="属性名" prop="name">
<el-input <el-input v-model="dataForm.name" placeholder="请输入属性名" clearable />
v-model="dataForm.name"
placeholder="请输入属性名"
clearable />
</el-form-item> </el-form-item>
<el-form-item label="属性值" prop="value"> <el-form-item label="属性值" prop="value">
<el-input <el-input v-model="dataForm.value" placeholder="请输入属性值" clearable />
v-model="dataForm.value"
placeholder="请输入属性值"
clearable />
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-row style="text-align: right"> <el-row style="text-align: right">
<el-button @click="visible = false">取消</el-button> <el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button> <el-button :loading="isLoading" type="primary" @click="dataFormSubmit()">确定</el-button>
</el-row> </el-row>
</el-dialog> </el-dialog>
</template> </template>
@@ -57,6 +44,7 @@ export default {
data() { data() {
return { return {
visible: false, visible: false,
isLoading: false,
dataForm: { dataForm: {
id: 0, id: 0,
name: '', name: '',
@@ -78,37 +66,50 @@ export default {
const { name, value } = res.data; const { name, value } = res.data;
this.dataForm.name = name; this.dataForm.name = name;
this.dataForm.value = value; this.dataForm.value = value;
}).catch(err => {
console.error('获取属性详情失败:', err);
this.$modal.msgError('获取数据失败,请重试');
}); });
} }
}); });
}, },
// 表单提交 // 表单提交(优化加载状态和错误处理)
dataFormSubmit() { async dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => { // 先验证表单
if (valid) { const valid = await new Promise((resolve) => {
// 修改的提交 this.$refs['dataForm'].validate((isValid) => resolve(isValid));
});
if (!valid) return;
this.isLoading = true; // 开始加载
try {
if (this.dataForm.id) { if (this.dataForm.id) {
updateProductAttr({ // 编辑操作
await updateProductAttr({
...this.dataForm, ...this.dataForm,
productId: this.productId, productId: this.productId,
}).then((response) => { });
this.$modal.msgSuccess('修改成功'); this.$modal.msgSuccess('修改成功');
this.visible = false; } else {
this.$emit('refreshDataList'); // 新增操作
}); await createProductAttr({
return;
}
// 添加的提交
createProductAttr({
...this.dataForm, ...this.dataForm,
productId: this.productId, productId: this.productId,
}).then((response) => { });
this.$modal.msgSuccess('新增成功'); this.$modal.msgSuccess('新增成功');
}
this.visible = false; this.visible = false;
this.$emit('refreshDataList'); this.$emit('refreshDataList');
}); } catch (error) {
// 错误处理
console.error('提交失败:', error);
this.$modal.msgError('操作失败,请重试');
} finally {
// 无论成功失败,都关闭加载状态
this.isLoading = false;
} }
});
}, },
}, },
}; };
@@ -118,6 +119,7 @@ export default {
.dialog>>>.el-dialog__body { .dialog>>>.el-dialog__body {
padding: 30px 24px; padding: 30px 24px;
} }
.dialog>>>.el-dialog__header { .dialog>>>.el-dialog__header {
font-size: 16px; font-size: 16px;
color: rgba(0, 0, 0, 0.85); color: rgba(0, 0, 0, 0.85);
@@ -125,6 +127,7 @@ export default {
padding: 13px 24px; padding: 13px 24px;
border-bottom: 1px solid #e9e9e9; border-bottom: 1px solid #e9e9e9;
} }
.dialog>>>.el-dialog__header .titleStyle::before { .dialog>>>.el-dialog__header .titleStyle::before {
content: ''; content: '';
display: inline-block; display: inline-block;

View File

@@ -104,6 +104,10 @@ export default {
getDataListURL: getProductionLinePage, getDataListURL: getProductionLinePage,
deleteURL: deleteProductionLine, deleteURL: deleteProductionLine,
exportURL: exportProductionLineExcel, exportURL: exportProductionLineExcel,
},
listQuery: {
pageSize: 20,
pageNo:1
}, },
tableProps, tableProps,
tableBtn: [ tableBtn: [
@@ -212,7 +216,7 @@ export default {
switch (val.btnName) { switch (val.btnName) {
case 'search': case 'search':
this.listQuery.pageNo = 1; this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10; this.listQuery.pageSize = 20;
this.listQuery.factoryId = val.factoryId || undefined; this.listQuery.factoryId = val.factoryId || undefined;
this.listQuery.name = val.name; this.listQuery.name = val.name;
this.getDataList(); this.getDataList();
@@ -220,7 +224,7 @@ export default {
case 'reset': case 'reset':
this.$refs.searchBarForm.resetForm(); this.$refs.searchBarForm.resetForm();
this.listQuery = { this.listQuery = {
pageSize: 10, pageSize: 20,
pageNo: 1, pageNo: 1,
total: 1, total: 1,
}; };

View File

@@ -262,6 +262,14 @@ export default {
tooltip: { tooltip: {
valueFormatter: (value) => `${value} %`, 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), data: this.barData.map((item) => item.processingRatio),
}, },
], ],

File diff suppressed because it is too large Load Diff

View File

@@ -77,7 +77,7 @@ const tableProps = [
}, },
{ {
prop: 'palletNum', prop: 'palletNum',
label: '下片托数' label: '一托玻璃数量/片'
}, },
{ {
prop: 'startTime', prop: 'startTime',
@@ -92,7 +92,7 @@ const tableProps = [
width: 160 width: 160
}, },
{ {
prop: 'outputNum', prop: 'length',
label: '玻璃长度/mm' label: '玻璃长度/mm'
}, },
{ {
@@ -101,7 +101,7 @@ const tableProps = [
}, },
{ {
prop: 'thick', prop: 'thick',
label: '玻璃度/mm' label: '玻璃度/mm'
}, },
]; ];
@@ -204,93 +204,87 @@ export default {
); );
}); });
}, },
test() {
var target = document.getElementsByClassName("right-aside")[0]
target.style.background = '#FFFFFF'
var that = this
setTimeout(() => {
html2canvas(target).then(function(canvas) {
var contentWidth = canvas.width
var contentHeight = canvas.height
// 一页pdf显示html页面生成的canvas高度
var pageHeight = contentHeight / 592.28 * 841.89
// 未生成pdf的html页面高度
var leftHeight = contentHeight
// 页面偏移
var position = 0
// a4纸的尺寸[595.28,841.89]html页面生成的canvas在pdf中图片的高度
var imgWidth = 595.28
var imgHeight = 592.28 / contentWidth * contentHeight
var pageData = canvas.toDataURL('image/jpeg', 1.0)
console.log('nihc URL', leftHeight, pageHeight)
var pdf = new jsPDF('', 'pt', 'a4')
if (leftHeight < pageHeight) {
pdf.addImage(pageData, 'JPEG', 0, 20, imgWidth, imgHeight)
} else {
while(leftHeight > 0) {
pdf.addImage(pageData, 'JPEG', 0, position, imgWidth, imgHeight)
leftHeight -= pageHeight
position -= 841.89
// 避免空白页
if (leftHeight > 0) {
pdf.addPage()
}
}
}
pdf.save(that.fileName + '工段统计.pdf')
})
}, 300)
},
exportECL() {
let tables = document.querySelector('.el-table').cloneNode(true)
const fix = tables.querySelector('.el-table__fixed')
const fixRight = tables.querySelector('.el-table__fixed-right')
if (fix) {
tables.removeChild(tables.querySelector('.el-table__fixed'))
}
if (fixRight) {
tables.removeChild(tables.querySelector('.el-table__fixed-right'))
}
let exportTable = XLSX.utils.table_to_book(tables)
var exportTableOut = XLSX.write(exportTable, {
bookType: 'xlsx', bookSST: true, type: 'array'
})
// sheetjs.xlsx为导出表格的标题名称
try {
FileSaver.saveAs(new Blob([exportTableOut], {
type: 'application/octet-stream'
}), this.fileName + '工段统计.xlsx')
} catch (e) {
if (typeof console !== 'undefined') console.log(e, exportTableOut)
}
return exportTableOut
},
exportPdf() {
this.test()
setTimeout(() =>{
this.dialogVisible = false
this.showData = this.tableData
}, 600)
},
exportXlsx() { exportXlsx() {
this.exportECL() if (!this.showData.length) {
this.dialogVisible = false this.$message.warning('暂无数据可导出');
this.showData = this.tableData return;
}, }
handleClose(done) {
this.$confirm('确认关闭?') this.exportLoading = true;
.then(_ => {
done(); try {
}) // 1. 处理导出数据(格式化时间字段)
.catch(_ => {}); const exportData = this.showData.map(item => {
const formatItem = { ...item };
// 格式化时间字段
if (formatItem.startTime) formatItem.startTime = parseTime(formatItem.startTime);
if (formatItem.endTime) formatItem.endTime = parseTime(formatItem.endTime);
return formatItem;
});
// 2. 构建表头映射:{ prop: label },只保留表格配置中存在的列
const headerMap = {};
this.tableProps.forEach(col => {
if (col.prop && col.label) {
headerMap[col.prop] = col.label;
}
});
// 3. 转换数据将prop键名替换为label按tableProps顺序排列列
const formattedData = exportData.map(item => {
const newItem = {};
// 按表格配置顺序遍历列确保Excel列顺序与表格一致
this.tableProps.forEach(col => {
const prop = col.prop;
const label = col.label;
if (prop && label) {
// 处理可能的undefined值避免导出为空字符串
newItem[label] = item[prop] ?? '';
}
});
return newItem;
});
// 4. 创建工作表使用处理后的带label表头的数据
const worksheet = XLSX.utils.json_to_sheet(formattedData);
// 5. 创建工作簿并添加工作表
const workbook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(workbook, worksheet, '下片日志数据');
// 6. 生成Excel文件
const excelBuffer = XLSX.write(workbook, {
bookType: 'xlsx',
type: 'array'
});
// 7. 保存文件
const blob = new Blob([excelBuffer], {
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
});
// 8. 生成文件名(包含查询条件信息)
let fileName = '下片历史';
if (this.listQuery.productionLineId) {
const lineItem = this.formConfig[0].selectOptions.find(
item => item.id === this.listQuery.productionLineId
);
if (lineItem) fileName += lineItem.name + '_';
}
if (this.listQuery.thick) {
fileName += this.listQuery.thick + '_';
}
// 添加时间戳避免文件名重复
fileName + '.xlsx';
FileSaver.saveAs(blob, fileName);
this.$message.success('导出成功');
} catch (error) {
console.error('导出失败:', error);
this.$message.error('导出失败,请重试');
} finally {
this.exportLoading = false;
}
}, },
getPdLineList() { getPdLineList() {
getPdList().then((res) => { getPdList().then((res) => {
@@ -314,7 +308,8 @@ export default {
case 'search': case 'search':
this.listQuery.pageNo = 1; this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10; this.listQuery.pageSize = 10;
this.listQuery.productId = val.productId ? val.productId : 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.startTime = val.timeVal ? val.timeVal[0] : undefined;
this.listQuery.endTime = val.timeVal ? val.timeVal[1] : undefined; this.listQuery.endTime = val.timeVal ? val.timeVal[1] : undefined;
@@ -322,7 +317,7 @@ export default {
this.getDataList(); this.getDataList();
break; break;
case 'export': case 'export':
this.handleExport(); this.exportXlsx();
break; break;
default: default:
console.log(val); console.log(val);
@@ -350,12 +345,6 @@ export default {
this.listQuery.pageNo = val; this.listQuery.pageNo = val;
this.getDataList(); this.getDataList();
}, },
handleExport() {
if (this.selectedList.length > 0) {
this.showData = this.selectedList
}
this.dialogVisible = true
}
}, },
}; };
</script> </script>

View File

@@ -77,7 +77,7 @@ const tableProps = [
}, },
{ {
prop: 'palletNum', prop: 'palletNum',
label: '下片托数' label: '一托玻璃数量/片'
}, },
{ {
prop: 'startTime', prop: 'startTime',
@@ -92,7 +92,7 @@ const tableProps = [
width: 160 width: 160
}, },
{ {
prop: 'outputNum', prop: 'length',
label: '玻璃长度/mm' label: '玻璃长度/mm'
}, },
{ {
@@ -358,8 +358,6 @@ export default {
handleExport() { handleExport() {
// 处理查询参数 // 处理查询参数
let params = { ...this.listQuery }; let params = { ...this.listQuery };
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal.confirm('是否确认导出下片日志?').then(() => { this.$modal.confirm('是否确认导出下片日志?').then(() => {
this.exportLoading = true; this.exportLoading = true;
return exportDownLogData(params); return exportDownLogData(params);

View File

@@ -262,6 +262,14 @@ export default {
tooltip: { tooltip: {
valueFormatter: (value) => `${value} %`, 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), data: this.barData.map((item) => item.processingRatio),
}, },
], ],

File diff suppressed because it is too large Load Diff

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> <template>
<div class="app-container"> <div class="app-container">
<!-- :isFold="true" 控制展开 --> <!-- :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" <base-table v-if="tableData.length" class="right-aside" v-loading="dataListLoading" :table-props="tableProps"
:page="listQuery.pageNo" :limit="listQuery.pageSize" :table-data="tableData"> :page="listQuery.pageNo" :limit="listQuery.pageSize" :table-data="tableData">
<method-btn v-if="tableBtn.length" slot="handleBtn" :width="120" label="操作" :method-list="tableBtn" <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> <div v-else class="no-data-bg"></div>
<pagination :limit.sync="listQuery.pageSize" :page.sync="listQuery.pageNo" :total="listQuery.total" <pagination :limit.sync="listQuery.pageSize" :page.sync="listQuery.pageNo" :total="listQuery.total"
@pagination="getDataList" /> @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" /> <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" />
</div> </div>
</template> </template>
<script> <script>
import Vue from 'vue';
import AddOrUpdate from './add-or-updata'; import AddOrUpdate from './add-or-updata';
import { parseTime } from '../../mixins/code-filter'; import { parseTime } from '../../mixins/code-filter';
import { getCostOriginRadioHisData, getPdList } from '@/api/core/monitoring/index' import { getCostOriginRadioHisData, getPdList } from '@/api/core/monitoring/index';
import * as XLSX from 'xlsx'
import FileSaver from 'file-saver'
import jsPDF from 'jspdf'
import html2canvas from 'html2canvas'
import { exportCostOriginRadioHisData } from '../../../../api/core/monitoring'; 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', prop: 'reportType',
label: '报表类型' label: '报表类型'
@@ -52,7 +59,6 @@ const tableProps = [
{ {
prop: 'time', prop: 'time',
label: '日期', label: '日期',
// filter: parseTime,
width: 160 width: 160
}, },
{ {
@@ -81,10 +87,72 @@ const tableProps = [
}, },
{ {
prop: 'ratio', 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 { export default {
components: { components: {
AddOrUpdate AddOrUpdate
@@ -101,6 +169,8 @@ export default {
total: 1, total: 1,
bindObjectId: undefined, bindObjectId: undefined,
statisticType: undefined, statisticType: undefined,
startTime: undefined,
endTime: undefined
}, },
pdLineList: [], pdLineList: [],
exportLoading: false, exportLoading: false,
@@ -115,36 +185,107 @@ export default {
type: 'edit', type: 'edit',
btnName: '编辑', btnName: '编辑',
}, },
].filter((v) => v), ].filter(v => v),
tableData: [],
fileName: '', fileName: '',
formConfig: [ formConfig: [
{ {
type: 'select', type: 'select',
label: '维度', label: '报表类型',
onchange: true,
selectOptions: [ selectOptions: [
{ { id: '0', name: '班组' },
id: '0', { id: '1', name: '日' },
name:'班组' { id: '2', name: '周' },
}, { id: '3', name: '月' },
{ { id: '4', 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 第 WW 周',
pickerOptions: {
firstDayOfWeek: 1 // 数字1表示周一作为周的第一天0=周日1=周一,依此类推)
},
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', type: 'select',
@@ -152,20 +293,6 @@ export default {
selectOptions: [], selectOptions: [],
param: 'bindObjectId' 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', type: 'button',
btnName: '查询', btnName: '查询',
@@ -176,7 +303,6 @@ export default {
type: 'separate', type: 'separate',
}, },
{ {
// type: this.$auth.hasPermi('base:factory:export') ? 'button' : '',
type: 'button', type: 'button',
btnName: '导出', btnName: '导出',
name: 'export', name: 'export',
@@ -185,97 +311,226 @@ export default {
], ],
}; };
}, },
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() { mounted() {
// Vue2 中 $refs 需在 $nextTick 中访问(确保 DOM 渲染完成)
this.$nextTick(() => {
if (this.$refs.searchBarForm) {
this.$refs.searchBarForm.formInline.statisticType = '1'; this.$refs.searchBarForm.formInline.statisticType = '1';
}
});
this.listQuery.statisticType = '1'; this.listQuery.statisticType = '1';
this.getDataList() this.getDataList();
this.getPdLineList() this.getPdLineList();
}, },
methods: { methods: {
selectType(val) {
// 报表类型切换时的回调(如需扩展可在此添加逻辑)
console.log('报表类型切换:', val);
},
handleClick(val) { handleClick(val) {
console.log(val); console.log('操作按钮点击:', val);
if (val.type === 'edit') { if (val.type === 'edit') {
this.addOrUpdateVisible= true this.addOrUpdateVisible = true;
// Vue2 中 $nextTick 确保子组件已渲染
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data); this.$refs.addOrUpdate.init(val.data);
}); });
} }
}, },
getPdLineList() { getPdLineList() {
getPdList().then((res) => { getPdList().then(res => {
this.formConfig[1].selectOptions = res.data || [] // Vue2 中数组赋值需确保响应式
this.pdLineList = res.data || []; // 保存产线数据 this.$set(this.formConfig[1], 'selectOptions', res.data || []);
}) this.pdLineList = res.data || [];
}).catch(err => {
console.error('获取产线列表失败:', err);
});
}, },
selectChange(val) { selectChange(val) {
console.log(val) console.log('选择变更:', val);
this.selectedList = val this.selectedList = val;
}, },
buttonClick(val) { buttonClick(val) {
console.log('val', val); console.log('头部按钮点击:', val);
switch (val.btnName) { switch (val.btnName) {
case 'search': case 'search':
this.listQuery.pageNo = 1; this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10; this.listQuery.pageSize = 10;
this.listQuery.bindObjectId = val.bindObjectId ? val.bindObjectId : undefined; this.listQuery.bindObjectId = val.bindObjectId ? val.bindObjectId : undefined;
this.listQuery.statisticType = val.statisticType ? val.statisticType : 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.handleTimeRange(val);
this.getDataList(); this.getDataList();
break; break;
case 'export': case 'export':
this.handleExport(); this.handleExport();
break; break;
default: default:
console.log(val); 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() { getDataList() {
this.dataListLoading = true; this.dataListLoading = true;
this.urlOptions.getDataListURL(this.listQuery).then(response => { this.urlOptions.getDataListURL(this.listQuery)
.then(response => {
const arr = ['班组', '日', '周', '月', '年']; const arr = ['班组', '日', '周', '月', '年'];
this.tableData = response.data?.list?.map((item) => { // Vue2 中数组赋值确保响应式
item.reportType = arr[this.listQuery.statisticType]; this.tableData = (response.data?.list || []).map(item => {
item.statisticType = this.listQuery.statisticType item.reportType = arr[this.listQuery.statisticType] || '';
item.statisticType = this.listQuery.statisticType;
// 匹配 bindObjectName // 匹配产线名称
const targetLine = this.pdLineList.find(line => line.id === item.bindObjectId); // const targetLine = this.pdLineList.find(line => line.id === item.bindObjectId);
item.bindObjectName = targetLine ? targetLine.name : ''; // 赋值名称,无匹配则为空 // item.bindObjectName = targetLine ? targetLine.name : ''
return item; return item;
}); })
this.listQuery.total = response.data.total; this.listQuery.total = response.data?.total || 0;
})
.catch(err => {
console.error('获取数据失败:', err);
this.tableData = [];
this.listQuery.total = 0;
})
.finally(() => {
this.dataListLoading = false; this.dataListLoading = false;
}); });
}, },
// 每页数 // 每页数变更
sizeChangeHandle(val) { sizeChangeHandle(val) {
this.listQuery.pageSize = val; this.listQuery.pageSize = val;
this.listQuery.pageNo = 1; this.listQuery.pageNo = 1;
this.getDataList(); this.getDataList();
}, },
// 当前页 // 当前页变更
currentChangeHandle(val) { currentChangeHandle(val) {
this.listQuery.pageNo = val; this.listQuery.pageNo = val;
this.getDataList(); this.getDataList();
}, },
// 导出处理
handleExport() { handleExport() {
// 处理查询参数 const params = { ...this.listQuery };
let params = { ...this.listQuery }; // 移除分页参数
params.pageNo = undefined; delete params.pageNo;
params.pageSize = undefined; delete params.pageSize;
this.$modal.confirm('是否确认导出原片报表?').then(() => { delete params.total;
this.$modal.confirm('是否确认导出原片报表?')
.then(() => {
this.exportLoading = true; this.exportLoading = true;
return exportCostOriginRadioHisData(params); return exportCostOriginRadioHisData(params);
}).then(response => { })
.then(response => {
this.$download.excel(response, '原片报表.xls'); this.$download.excel(response, '原片报表.xls');
})
.catch(err => {
console.error('导出失败:', err);
})
.finally(() => {
this.exportLoading = false; this.exportLoading = false;
}).catch(() => { }); });
} }
}, },
// Vue2 中监听数据变化(如需)
watch: {
'listQuery.statisticType'(newVal) {
console.log('报表类型变更:', newVal);
// 可添加类型变更后的额外逻辑
}
}
}; };
</script> </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>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,423 +1,430 @@
<template> <template>
<div class="home-page"> <div class="app-container">
<div class="date-tabs"> <!-- 顶部日期&筛选栏 -->
<!-- @tab-click="handleClick" --> <el-row :gutter="20" class="top-bar">
<el-tabs v-model="activeName" @tab-click="timedayChange" :stretch="true"> <el-col :span="8">
<el-tab-pane
:label="'\u2002\u2002日\u2002\u2002'"
name="日"></el-tab-pane>
<el-tab-pane
:label="'\u2002\u2002周\u2002\u2002'"
name="周"></el-tab-pane>
<el-tab-pane
:label="'\u2002\u2002月\u2002\u2002'"
name="月"></el-tab-pane>
<el-tab-pane
:label="'\u2002\u2002年\u2002\u2002'"
name="年"></el-tab-pane>
</el-tabs>
<div class="detail">
<el-date-picker <el-date-picker
v-model="timeday" v-model="dateRange"
align="right" type="daterange"
type="date" range-separator="~"
format="yyyy-MM-dd" start-placeholder="开始日期"
valueFormat="yyyy-MM-dd" end-placeholder="结束日期"
:clearable="false" value-format="yyyy-MM-dd" />
@change="timedayChange" <el-button type="primary" style="margin-left: 10px">查询</el-button>
placeholder="选择日期"
:picker-options="pickerOptions"></el-date-picker>
</div>
</div>
<el-row class="main-top" :gutter="16">
<el-col :span="24" style="position: relative">
<div class="title">
<svg-icon icon-class="home-produce" />
<span class="title-inner">生产总成本</span>
</div>
<el-row class="box">
<el-col :span="4" class="num-box shadow">
<div class="num-style">{{ homeData.priceS }}万元</div>
<div class="unit-style">总计成本</div>
</el-col> </el-col>
<el-col :span="4" class="num-box shadow"> <el-col :span="16">
<div class="num-style">{{ homeData.matPriceS }}万元</div> <el-tag type="info" @click="changeTime('yesterday')">昨日</el-tag>
<div class="unit-style">原料成本</div> <el-tag type="info" @click="changeTime('week')">本周</el-tag>
</el-col> <el-tag type="info" @click="changeTime('month')">本月</el-tag>
<el-col :span="4" class="num-box shadow"> <el-tag type="info" @click="changeTime('year')">本年</el-tag>
<div class="num-style">{{ homeData.energyPriceS }}万元</div>
<div class="unit-style">能源成本</div>
</el-col>
<el-col :span="4" class="num-box shadow">
<div class="num-style">{{ homeData.otherPriceS }}万元</div>
<div class="unit-style">其他成本</div>
</el-col>
<!-- <el-col :span="4" class="num-box shadow">
<div class="num-style">{{ homeData.ratioS }}</div>
<div class="unit-style">综合良品率/%</div>
</el-col> -->
<el-col :span="4" class="num-box shadow">
<div class="num-style">{{ homeData.areaPriceS }}</div>
<div class="unit-style">综合每平米成本</div>
</el-col> </el-col>
</el-row> </el-row>
</el-col>
<el-col :span="24" style="position: relative"> <!-- 成本概览卡片 -->
<div class="title"> <el-row :gutter="20" class="card-row">
<svg-icon icon-class="home-produce" /> <el-col :span="8">
<span class="title-inner">原片成本</span> <el-card class="cost-card">
<div class="card-title">总制造成本/平米</div>
<div class="card-content">
<div>
目标
<span class="target-val">16</span>
</div> </div>
<el-row class="box"> <div>
<el-col :span="4" class="num-box shadow"> 实际
<div class="num-style">{{ homeData.priceO }}万元</div> <span class="actual-val">12.8</span>
<div class="unit-style">原片总成本</div>
</el-col>
<el-col :span="4" class="num-box shadow">
<div class="num-style">{{ homeData.matPriceO }}万元</div>
<div class="unit-style">原料成本</div>
</el-col>
<el-col :span="4" class="num-box shadow">
<div class="num-style">{{ homeData.energyPriceO }}万元</div>
<div class="unit-style">能源成本</div>
</el-col>
<el-col :span="4" class="num-box shadow">
<div class="num-style">{{ homeData.otherPriceO }}万元</div>
<div class="unit-style">其他成本</div>
</el-col>
<el-col :span="4" class="num-box shadow">
<div class="num-style">{{ homeData.ratioO }}</div>
<div class="unit-style">原片良品率/%</div>
</el-col>
<el-col :span="4" class="num-box shadow">
<div class="num-style">{{ homeData.areaPriceO }}</div>
<div class="unit-style">原片每平米成本</div>
</el-col>
</el-row>
</el-col>
<el-col :span="24" style="position: relative">
<div class="title">
<svg-icon icon-class="home-produce" />
<span class="title-inner">深加工成本</span>
</div> </div>
<el-row class="box"> <el-progress :stroke-width="13" :percentage="80" color="#42b983" />
<el-col :span="4" class="num-box shadow">
<div class="num-style">{{ homeData.priceD }}万元</div>
<div class="unit-style">深加工总成本</div>
</el-col>
<el-col :span="4" class="num-box shadow">
<div class="num-style">{{ homeData.energyPriceD }}万元</div>
<div class="unit-style">能源成本</div>
</el-col>
<el-col :span="4" class="num-box shadow">
<div class="num-style">{{ homeData.otherPriceD }}万元</div>
<div class="unit-style">其他成本</div>
</el-col>
<el-col :span="4" class="num-box shadow">
<div class="num-style">{{ homeData.ratioD }}</div>
<div class="unit-style">深加工良品率/%</div>
</el-col>
<el-col :span="4" class="num-box shadow">
<div class="num-style">{{ homeData.areaPriceD }}</div>
<div class="unit-style">深加工每平米成本</div>
</el-col>
</el-row>
</el-col>
</el-row>
<el-row class="main-bottom" :gutter="16" v-if="false">
<el-col :span="9">
<div class="chart-wrapper">
<line-chart :chart-data="lineChartData" />
</div>
</el-col>
<el-col :span="7">
<div class="chart-wrapper">
<pie-chart />
</div> </div>
</el-card>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<div class="chart-wrapper"> <el-card class="cost-card">
<bar-chart /> <div class="card-title">原片成本/平米</div>
<div class="card-content">
<div>
目标
<span class="target-val">16</span>
</div> </div>
<div>
实际
<span class="actual-val">12.8</span>
</div>
<el-progress :stroke-width="13" :percentage="99" color="#42b983" />
</div>
</el-card>
</el-col>
<el-col :span="8">
<el-card class="cost-card">
<div class="card-title">加工成本/平米</div>
<div class="card-content">
<div>
目标
<span class="target-val">16</span>
</div>
<div>
实际
<span class="actual-val">12.8</span>
</div>
<el-progress :stroke-width="13" :percentage="99" color="#42b983" />
</div>
</el-card>
</el-col> </el-col>
</el-row> </el-row>
<!-- 成本构成区域 -->
<el-row :gutter="20" class="composition-row">
<!-- 饼图 -->
<el-col :span="6">
<el-card class="composition-card">
<div class="card-title">成本构成</div>
<div id="costPie" class="chart" style="height: 350px"></div>
</el-card>
</el-col>
<!-- 原片/加工成本子项 -->
<el-col :span="18">
<el-card class="composition-card">
<div class="card-title">成本构成</div>
<!-- 原片成本子项 -->
<div class="sub-cost-group">
<div class="sub-cost-title">原片成本</div>
<div class="sub-cost">
<div <div
class="main-footer" v-for="(item, idx) in rawSubCosts"
style=" :key="idx"
color: #c7c7c7; class="sub-cost-div">
user-select: none; <div class="sub-cost-name">
font-size: 14px; {{ item.name }}
letter-spacing: 1px; <div class="sub-cost-val">{{ item.val }}</div>
height: 30px;
display: grid;
place-content: center;
">
&copy; 中建材智能自动化研究院有限公司
</div> </div>
<div style="text-align: center">
<el-progress
type="circle"
:percentage="89"
:width="60"
:stroke-width="10"
:show-text="false"
color="#e74c3c" />
</div>
<div class="sub-cost-name">
目标
<span class="red-text">{{ item.target }}</span>
</div>
<div class="sub-cost-name">
完成率
<span class="red-text">89%</span>
</div>
</div>
</div>
</div>
<el-divider></el-divider>
<!-- 加工成本子项 -->
<div class="sub-cost-group" style="margin-top: 20px">
<div class="sub-cost-title">加工成本</div>
<div class="sub-cost">
<div
v-for="(item, idx) in processSubCosts"
:key="idx"
class="sub-cost-div">
<div class="sub-cost-name">
{{ item.name }}
<div class="sub-cost-val">{{ item.val }}</div>
</div>
<div style="text-align: center">
<el-progress
type="circle"
:percentage="89"
:width="60"
:stroke-width="10"
:show-text="false"
color="#e74c3c" />
</div>
<div class="sub-cost-name">
目标
<span class="red-text">{{ item.target }}</span>
</div>
<div class="sub-cost-name">
完成率
<span class="red-text">89%</span>
</div>
</div>
</div>
</div>
</el-card>
</el-col>
</el-row>
<!-- 趋势图区域 -->
<el-row :gutter="20" class="trend-row">
<!-- 总制造成本趋势 -->
<el-col :span="8">
<el-card class="trend-card">
<div class="card-title">总制造成本趋势</div>
<div id="totalTrend" class="chart" style="height: 300px"></div>
</el-card>
</el-col>
<!-- 原片/加工成本趋势 -->
<el-col :span="8">
<el-card class="trend-card">
<div class="card-title">原片/加工成本趋势</div>
<el-tabs v-model="costTab" type="card" style="margin-bottom: 10px">
<el-tab-pane label="原片成本" name="raw"></el-tab-pane>
<el-tab-pane label="加工成本" name="process"></el-tab-pane>
</el-tabs>
<div id="rawProcessTrend" class="chart" style="height: 300px"></div>
</el-card>
</el-col>
<!-- 单项成本趋势 -->
<el-col :span="8">
<el-card class="trend-card">
<div class="card-title">单项成本趋势</div>
<el-tabs v-model="itemTab" type="card" style="margin-bottom: 10px">
<el-tab-pane label="人工成本" name="labor"></el-tab-pane>
<el-tab-pane label="原料成本" name="material"></el-tab-pane>
<el-tab-pane label="制造费用" name="expense"></el-tab-pane>
<el-tab-pane label="玻璃热耗" name="heat"></el-tab-pane>
<el-tab-pane label="原片成品率" name="yield"></el-tab-pane>
</el-tabs>
<div id="itemTrend" class="chart" style="height: 300px"></div>
</el-card>
</el-col>
</el-row>
</div> </div>
</template> </template>
<script> <script>
import moment from 'moment'; import * as echarts from 'echarts';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
import LineChart from '../dashboard/LineChart';
import PieChart from '../dashboard/PieChart';
import BarChart from '../dashboard/BarChart';
import PanelGroup from '../dashboard/PanelGroup';
import { getData } from '@/api/cost/allCost';
import { getUserProfile } from '@/api/system/user';
const lineChartData = {
newVisitis: {
expectedData: [100, 120, 161, 134, 105, 160, 165],
actualData: [120, 82, 91, 154, 162, 140, 145],
},
messages: {
expectedData: [200, 192, 120, 144, 160, 130, 140],
actualData: [180, 160, 151, 106, 145, 150, 130],
},
purchases: {
expectedData: [80, 100, 121, 104, 105, 90, 100],
actualData: [120, 90, 100, 138, 142, 130, 130],
},
shoppings: {
expectedData: [130, 140, 141, 142, 145, 150, 160],
actualData: [120, 82, 91, 154, 162, 140, 130],
},
};
export default { export default {
name: 'Home', name: 'CostDashboard',
mixins: [tableHeightMixin],
components: {
LineChart,
PieChart,
PanelGroup,
BarChart,
},
computed: {
gradientBackground() {
return {
'background-image':
'linear-gradient(90deg, #f0f0f0 25%, rgba(255, 255, 255, 0) 25%, rgba(255, 255, 255, 0) 50%, #f0f0f0 50%, #f0f0f0 75%, rgba(255, 255, 255, 0) 75%, rgba(255, 255, 255, 0))',
'background-size': '100px 100px', // 调整条纹的大小
};
},
},
data() { data() {
return { return {
activeName: '日', dateRange: ['2023-05-06', '2023-05-06'],
user: '', costTab: 'raw',
lineChartData: lineChartData.newVisitis, itemTab: 'labor',
homeData: {}, // 原片成本子项
timeday: moment(new Date()).subtract(1, 'days').format('YYYY-MM-DD'), rawSubCosts: [
startTime: { name: '人工成本', val: 4.56, target: 4.32 },
moment(new Date()).subtract(0, 'days').format('YYYY-MM-DD') + { name: '原料成本', val: 4.56, target: 4.32 },
' 00:00:00', { name: '原片制造费用', val: 4.56, target: 4.32 },
endTime: { name: '玻璃热耗', val: 4.56, target: 4.32 },
moment(new Date()).subtract(-1, 'days').format('YYYY-MM-DD') + { name: '原片成品率', val: 4.56, target: 4.32 },
' 00:00:00',
pickerOptions: {
disabledDate(time) {
return time.getTime() + 3600 * 1000 * 24 > Date.now();
},
shortcuts: [
{
text: '今天',
onClick(picker) {
picker.$emit('pick', new Date());
},
},
{
text: '昨天',
onClick(picker) {
const date = new Date();
date.setTime(date.getTime() - 3600 * 1000 * 24);
picker.$emit('pick', date);
},
},
{
text: '一周前',
onClick(picker) {
const date = new Date();
date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);
picker.$emit('pick', date);
},
},
], ],
}, // 加工成本子项
processSubCosts: [
{ name: '人工成本', val: 4.56, target: 4.32 },
{ name: '加工动力成本', val: 4.56, target: 4.32 },
{ name: '加工制造费用', val: 4.56, target: 4.32 },
{ name: '加工投入产出率', val: 4.56, target: 4.32 },
],
// 趋势图模拟数据
trendX: ['00:00', '01:00', '02:00'],
trendY: [20, 40, 50],
targetY: 12.54,
}; };
}, },
created() { mounted() {
}, this.initCostPie();
beforeDestroy() { this.initTotalTrend();
this.initRawProcessTrend();
this.initItemTrend();
}, },
methods: { methods: {
getData() { // 切换时间范围(示例)
let listQuery = { changeTime(type) {
//分页 // 实际项目中需根据type请求对应数据
pageSize: 10, console.log('切换时间:', type);
pageNo: 1,
statisticType: ['', '日', '周', '月', '年'].indexOf(this.activeName),
startTime: this.timeday + ' 00:00:00',
};
getData(listQuery).then((response) => {
this.homeData = response.data;
for (let i in this.homeData) {
this.homeData[i] = Number(this.homeData[i]).toFixed(2);
}
});
}, },
timedayChange() { // 初始化成本构成饼图
let listQuery = { initCostPie() {
//分页 const pieChart = echarts.init(document.getElementById('costPie'));
pageSize: 10, pieChart.setOption({
pageNo: 1, tooltip: { trigger: 'item' },
statisticType: ['', '日', '周', '月', '年'].indexOf(this.activeName), legend: {
startTime: this.timeday + ' 00:00:00', orient: 'horizontal', // 水平排列
}; bottom: 0, // 放在底部
getData(listQuery).then((response) => { icon: 'circle',
this.homeData = response.data; left: 'center',
for (let i in this.homeData) { formatter: function (name) {
this.homeData[i] = Number(this.homeData[i]).toFixed(2); return name;
}
});
}, },
goDetail() { },
this.$router.push({ path: 'indexDetail' }); series: [
{
type: 'pie',
data: [
{ name: '原料成本(4.2元)', value: 29.9 },
{ name: '动力成本(2.1元)', value: 24 },
{ name: '人工成本(1.5元)', value: 24 },
{ name: '辅料成本(0.5元)', value: 21.2 },
{ name: '制造费用(0.5元)', value: 21.2 },
],
label: { show: false },
labelLine: { show: false },
bottom: 10,
},
],
});
window.addEventListener('resize', () => pieChart.resize());
},
// 初始化总制造成本趋势图
initTotalTrend() {
const totalChart = echarts.init(document.getElementById('totalTrend'));
totalChart.setOption({
grid: { top: 20, bottom: 30, left: 30, right: 10 },
xAxis: { type: 'category', data: this.trendX },
yAxis: { type: 'value', min: -20, max: 60 },
series: [
{
name: '实际值',
type: 'line',
data: this.trendY,
lineStyle: { color: '#409eff' },
},
{
name: '目标值',
type: 'line',
data: [this.targetY, this.targetY, this.targetY],
lineStyle: { type: 'dashed', color: '#e6a23c' },
},
],
});
window.addEventListener('resize', () => totalChart.resize());
},
// 初始化原片/加工成本趋势图
initRawProcessTrend() {
const rpChart = echarts.init(document.getElementById('rawProcessTrend'));
rpChart.setOption({
grid: { top: 10, bottom: 20, left: 20, right: 10 },
xAxis: { type: 'category', data: this.trendX },
yAxis: { type: 'value', min: -20, max: 60 },
series: [
{
name: '实际值',
type: 'line',
data: this.trendY,
lineStyle: { color: '#409eff' },
},
{
name: '目标值',
type: 'line',
data: [this.targetY, this.targetY, this.targetY],
lineStyle: { type: 'dashed', color: '#e6a23c' },
},
],
});
window.addEventListener('resize', () => rpChart.resize());
},
// 初始化单项成本趋势图
initItemTrend() {
const itemChart = echarts.init(document.getElementById('itemTrend'));
itemChart.setOption({
grid: { top: 10, bottom: 20, left: 20, right: 10 },
xAxis: { type: 'category', data: this.trendX },
yAxis: { type: 'value', min: -20, max: 60 },
series: [
{
name: '实际值',
type: 'line',
data: this.trendY,
lineStyle: { color: '#409eff' },
},
{
name: '目标值',
type: 'line',
data: [this.targetY, this.targetY, this.targetY],
lineStyle: { type: 'dashed', color: '#e6a23c' },
},
],
});
window.addEventListener('resize', () => itemChart.resize());
}, },
}, },
}; };
</script> </script>
<style lang="scss" scoped> <style scoped>
.home-page::before { .top-bar {
background-image: url('~@/assets/img/home-bg.png');
background-size: cover;
background-repeat: no-repeat;
background-position: center;
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
transform: rotate(180deg);
}
.date-tabs {
padding-left: 40px;
padding-top: 20px;
position: relative;
margin-bottom: 20px; margin-bottom: 20px;
} }
:deep(.date-tabs) { .card-row,
.el-tabs__header { .composition-row {
margin-bottom: 8px;
display: inline-block;
transform: translateY(-12px);
}
.el-tabs__content {
overflow: visible;
}
.el-tabs__item {
font-size: 18px;
color: #fff;
padding-left: 0 !important;
padding-right: 0 !important;
line-height: 36px !important;
height: 36px;
}
.el-tabs__item.is-active {
color: #0b58ff;
}
}
.detail {
display: inline-block;
position: absolute;
left: 260px;
top: 10px;
}
:deep(.detail) {
.el-input__inner {
background-color: transparent;
color: white;
}
}
// .current-date {
// color: #fff;
// font-size: 18px;
// position: absolute;
// left: 260px;
// top: 14px;
// }
.current-time {
color: #fff;
font-size: 18px;
position: absolute;
right: 38px;
top: 14px;
}
.main-top {
width: 100%;
padding: 0 20px 0 40px;
.title {
position: absolute;
left: 34px;
top: 20px;
width: 180px;
font-size: 32px;
z-index: 10;
.title-inner {
position: absolute;
left: 42px;
top: 5px;
font-size: calc(100vw * 20 / 1920);
}
}
.box {
background-color: #fff;
border-radius: 24px;
height: 192px;
padding: 40px 24px 32px 24px;
margin-bottom: 20px; margin-bottom: 20px;
box-shadow: 0 8px 8px 0 gray; }
.num-box { .cost-card .card-title {
height: 120px; font-size: 22px;
padding-top: 26px; font-weight: bold;
margin-bottom: 15px;
}
.cost-card .card-content {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
gap: 10px;
align-items: center;
font-size: 18px;
}
.target-val {
color: #666;
margin-left: 5px;
font-size: 20px;
}
.actual-val {
color: #42b983;
margin-left: 5px;
font-size: 20px;
}
.composition-card {
height: 480px;
}
.composition-card .card-title {
font-size: 18px;
font-weight: bold;
margin-bottom: 15px;
}
.sub-cost {
display: grid;
grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
gap: 10px;
align-items: center;
}
.sub-cost-group .sub-cost-title {
font-size: 16px;
font-weight: bold;
margin-bottom: 10px;
}
.sub-cost-group .sub-cost-div {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 10px;
align-items: center;
border: 1px solid rgb(220, 220, 220, 0.5);
padding: 10px;
}
.sub-cost-name {
text-align: center; text-align: center;
.num-style { margin-top: 5px;
color: #000; font-size: 14px;
font-size: calc(100vw * 40 / 1920);
} }
.unit-style { .sub-cost-val {
color: rgba(0, 0, 0, 0.7); font-size: 16px;
font-size: calc(100vw * 18 / 1920); font-weight: bold;
} }
.completion {
text-align: center;
font-size: 12px;
color: #666;
} }
.shadow { .red-text {
background: linear-gradient(90deg, #ffffff 80%, #f2f4f9 100%); color: #e74c3c;
} }
.trend-card {
height: 450px;
} }
} .trend-card .card-title {
.main-bottom { font-size: 16px;
width: 100%; font-weight: bold;
margin-top: 20px; margin-bottom: 10px;
.chart-wrapper {
margin-left: 10px;
height: 425px;
background: #fff;
border-radius: 5px;
box-shadow: 0 3px 3px 0 gray;
}
}
</style>
<style lang="scss">
.home-page {
.el-progress-bar__inner {
background-image: url('~@/assets/img/home-progress-bg.png');
background-size: cover;
}
} }
</style> </style>

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

@@ -2,13 +2,19 @@
* @Author: zwq * @Author: zwq
* @Date: 2025-10-23 13:43:55 * @Date: 2025-10-23 13:43:55
* @LastEditors: zwq * @LastEditors: zwq
* @LastEditTime: 2025-10-24 11:14:55 * @LastEditTime: 2025-11-25 09:39:43
* @Description: * @Description:
--> -->
<template> <template>
<el-row :gutter="10" style="background-color: #f2f4f9"> <div
<!--部门数据--> class="app-container"
<el-col :span="4"> style="
background-color: #f2f4f9;
padding: 0;
display: grid;
grid-template-columns: 1fr 5fr;
gap: 10px;
">
<div class="head-container"> <div class="head-container">
<el-tabs v-model="activeName" stretch @tab-click="tabsClick"> <el-tabs v-model="activeName" stretch @tab-click="tabsClick">
<el-tab-pane label="部门" name="first"></el-tab-pane> <el-tab-pane label="部门" name="first"></el-tab-pane>
@@ -28,6 +34,7 @@
:expand-on-click-node="false" :expand-on-click-node="false"
:filter-node-method="filterNode" :filter-node-method="filterNode"
ref="tree" ref="tree"
node-key="id"
default-expand-all default-expand-all
highlight-current highlight-current
@node-click="handleNodeClick" /> @node-click="handleNodeClick" />
@@ -46,13 +53,12 @@
:expand-on-click-node="false" :expand-on-click-node="false"
:filter-node-method="filterNode" :filter-node-method="filterNode"
ref="tree1" ref="tree1"
node-key="id"
default-expand-all default-expand-all
highlight-current highlight-current
@node-click="handleNodeClick1" /> @node-click="handleNodeClick1" />
</div> </div>
</div> </div>
</el-col>
<el-col :span="20">
<div class="groupTeamScheduling"> <div class="groupTeamScheduling">
<div class="operationArea"> <div class="operationArea">
<el-form :inline="true" class="demo-form-inline"> <el-form :inline="true" class="demo-form-inline">
@@ -71,10 +77,15 @@
v-if="activeName == 'first'"> v-if="activeName == 'first'">
提示排班日历仅展示当前选中部门的节假日设置若休假日中仍有排班则表示下级组织已通过自定义假期进行排班 提示排班日历仅展示当前选中部门的节假日设置若休假日中仍有排班则表示下级组织已通过自定义假期进行排班
</span> </span>
<span v-else> <span v-else style="margin-left: 10px">
组长:{{ showTeamName?.leaderName || '-' }} 组长电话:{{ 组长:
showTeamName?.leaderPhone || '-' <span style="font-weight: 600; margin: 0 10px">
}} {{ showTeamName?.leaderName || '-' }}
</span>
组长电话:
<span style="font-weight: 600; margin: 0 10px">
{{ showTeamName?.leaderPhone || '-' }}
</span>
</span> </span>
</el-form-item> </el-form-item>
<el-form-item style="float: right"> <el-form-item style="float: right">
@@ -128,9 +139,7 @@
effect="dark" effect="dark"
content="本日节假日变更已影响当前排班计划,但尚未同步,请及时处理。" content="本日节假日变更已影响当前排班计划,但尚未同步,请及时处理。"
placement="top"> placement="top">
<i <i class="el-icon-warning" style="color: #f56c6c"></i>
class="el-icon-warning"
style="color: #f56c6c"></i>
</el-tooltip> </el-tooltip>
</div> </div>
</div> </div>
@@ -159,15 +168,16 @@
<div <div
class="holiday-div" class="holiday-div"
:style="{ :style="{
backgroundColor: backgroundColor: holidayDivColor[item?.classesCode],
holidayDivColor[item?.classesCode],
}" }"
@click=" @click="
holidayLog( holidayLog(
HolidayList[Number(data.day.split('-')[2]) - 1] HolidayList[Number(data.day.split('-')[2]) - 1]
?.det, ?.det,
HolidayList[Number(data.day.split('-')[2]) - 1] HolidayList[Number(data.day.split('-')[2]) - 1]
?.date ?.date,
HolidayList[Number(data.day.split('-')[2]) - 1]
?.detSort
) )
" "
:title=" :title="
@@ -207,7 +217,6 @@
</el-calendar> </el-calendar>
</div> </div>
</div> </div>
</el-col>
<base-dialog <base-dialog
:dialogTitle="dialogTitle" :dialogTitle="dialogTitle"
:dialogVisible="logVisible" :dialogVisible="logVisible"
@@ -228,7 +237,7 @@
</slot> </slot>
</template> </template>
</base-dialog> </base-dialog>
</el-row> </div>
</template> </template>
<script> <script>
@@ -339,13 +348,43 @@ export default {
getEnableData().then((response) => { getEnableData().then((response) => {
// 处理 deptOptions 参数 // 处理 deptOptions 参数
this.deptOptions = []; this.deptOptions = [];
this.deptOptions.push(...this.handleTree(response.data, 'id')); this.deptOptions.push(...this.handleTree1(response.data, 'id'));
this.$nextTick(() => {
this.$refs.tree.setCurrentKey(this.deptId);
});
}); });
listByDeptId(this.topDept.id).then((response) => { listByDeptId(this.topDept.id).then((response) => {
this.groupOptions = []; this.groupOptions = [];
this.groupOptions.push(...response.data); this.groupOptions.push(...response.data);
}); });
}, },
//大整数精度丢失
handleTree1(data, fid) {
const id = fid || 'id';
const parentId = 'parentId';
const children = 'children';
const rootId =
data
.map((item) => item[parentId].toString())
.reduce((min, current) => {
if (current.length < min.length) return current;
if (current.length > min.length) return min;
return current < min ? current : min;
}) || 0;
//对源数据深度克隆
const cloneData = JSON.parse(JSON.stringify(data));
//循环所有项
const treeData = cloneData.filter((father) => {
let branchArr = cloneData.filter((child) => {
//返回每一项的子级数组
return father[id] == child[parentId];
});
branchArr.length > 0 ? (father.children = branchArr) : '';
//返回第一层
return father[parentId] == rootId;
});
return treeData !== '' ? treeData : data;
},
// 筛选节点 // 筛选节点
filterNode(value, data) { filterNode(value, data) {
if (!value) return true; if (!value) return true;
@@ -358,8 +397,14 @@ export default {
leaderName: this.groupOptions[0].leaderName || '-', leaderName: this.groupOptions[0].leaderName || '-',
leaderPhone: this.groupOptions[0].leaderPhone || '-', leaderPhone: this.groupOptions[0].leaderPhone || '-',
}; };
this.$nextTick(() => {
this.$refs.tree1.setCurrentKey(this.teamId);
});
} else if (this.activeName == 'first') { } else if (this.activeName == 'first') {
this.deptId = this.topDept.id; this.deptId = this.topDept.id;
this.$nextTick(() => {
this.$refs.tree.setCurrentKey(this.deptId);
});
} }
this.getHolidayPage(); this.getHolidayPage();
}, },
@@ -441,11 +486,11 @@ export default {
return ''; return '';
} }
}, },
holidayLog(det, date) { holidayLog(det, date, detSort) {
this.dialogTitle = this.showDeptName + '-' + date + '-排班详情'; this.dialogTitle = this.showDeptName + '-' + date + '-排班详情';
this.logVisible = true; this.logVisible = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.holidayLogRef.init(det); this.$refs.holidayLogRef.init(det, detSort);
}); });
}, },
cancelLog() { cancelLog() {
@@ -459,8 +504,8 @@ export default {
.head-container { .head-container {
padding: 20px 10px 0; padding: 20px 10px 0;
background-color: #fff; background-color: #fff;
min-height: calc(100vh - 120px - 8px);
border-radius: 8px; border-radius: 8px;
height: 100%;
} }
.groupTeamScheduling { .groupTeamScheduling {
.operationArea { .operationArea {

View File

@@ -2,7 +2,7 @@
* @Author: zwq * @Author: zwq
* @Date: 2025-10-11 14:27:37 * @Date: 2025-10-11 14:27:37
* @LastEditors: zwq * @LastEditors: zwq
* @LastEditTime: 2025-10-29 17:12:04 * @LastEditTime: 2025-11-14 22:00:10
* @Description: * @Description:
--> -->
<template> <template>
@@ -25,7 +25,7 @@
</template> </template>
<script> <script>
import { listByDeptId } from '@/api/group/Schedule'; import { getGroupPage } from '@/api/group/groupSetting';
const tableProps = [ const tableProps = [
{ {
@@ -39,7 +39,7 @@ const tableProps = [
width: 100, width: 100,
}, },
{ {
prop: 'deptId', prop: 'deptName',
label: '所属部门', label: '所属部门',
}, },
{ {
@@ -57,7 +57,7 @@ export default {
data() { data() {
return { return {
urlOptions: { urlOptions: {
getDataListURL: listByDeptId, getDataListURL: getGroupPage,
}, },
tableProps, tableProps,
tableData: [], tableData: [],
@@ -86,16 +86,16 @@ export default {
pageSize: 100, pageSize: 100,
code: '', code: '',
name: '', name: '',
deptId: undefined,
}, },
selectedList: [], selectedList: [],
selectedArr: [], //已选的班组,从父组件传过来的 selectedArr: [], //已选的班组,从父组件传过来的
deptId: undefined,
}; };
}, },
created() {}, created() {},
methods: { methods: {
init(id, tableData) { init(id, tableData) {
this.deptId = id; this.formInline.deptId = id;
this.selectedArr = tableData || []; this.selectedArr = tableData || [];
this.$nextTick(() => { this.$nextTick(() => {
this.getDataList(); this.getDataList();
@@ -103,8 +103,9 @@ export default {
}, },
// 获取数据列表 // 获取数据列表
getDataList() { getDataList() {
this.urlOptions.getDataListURL(this.deptId).then((response) => { this.urlOptions.getDataListURL(this.formInline).then((response) => {
this.tableData = response.data; this.tableData = response.data.list.filter(item=>item.enabled===1);
this.tableData.forEach(item=>item.teamId= item.id)
this.$nextTick(() => { this.$nextTick(() => {
if (this.selectedArr.length > 0) { if (this.selectedArr.length > 0) {
this.setSelectedRows(); this.setSelectedRows();
@@ -119,12 +120,12 @@ export default {
table.clearSelection(); table.clearSelection();
this.selectedArr.forEach((item) => { this.selectedArr.forEach((item) => {
const rowInTable = this.tableData.find((i) => i.id === item.id); const rowInTable = this.tableData.find((i) => i.teamId === item.teamId);
if (rowInTable) { if (rowInTable) {
//这里一定要用table.tableData这样才是指向同一个数组 //这里一定要用table.tableData这样才是指向同一个数组
this.$set(table.store.states, 'selection', [ this.$set(table.store.states, 'selection', [
...table.store.states.selection, ...table.store.states.selection,
table.tableData.find((i) => i.id === item.id), table.tableData.find((i) => i.teamId === item.teamId),
]); ]);
} }
}); });
@@ -149,22 +150,19 @@ export default {
selectChange(val) { selectChange(val) {
this.selectedList = val; this.selectedList = val;
}, },
// 判断两个数组是否有重复的 id // 判断两个数组是否有重复的 id,去重
hasDuplicateIds(arr1, arr2) { hasDuplicateIds(arr1, arr2) {
const idSet = new Set(arr1.map((item) => item.id)); return arr2.filter(
return arr2.some((item) => idSet.has(item.id)); (item2) => !arr1.some((item1) => item1.teamId === item2.teamId)
);
}, },
dataFormSubmit() { dataFormSubmit() {
if (this.selectedList && this.selectedList.length > 0) { if (this.selectedList && this.selectedList.length > 0) {
const haveData = this.hasDuplicateIds( this.selectedList = this.hasDuplicateIds(
this.selectedArr, this.selectedArr,
this.selectedList this.selectedList
); );
if (haveData) {
this.$message('请不要重复添加数组');
return;
}
this.$emit('refreshTableData', this.selectedList); this.$emit('refreshTableData', this.selectedList);
} else if (this.selectedArr.length > 0) { } else if (this.selectedArr.length > 0) {
this.$message('请不要重复添加数组'); this.$message('请不要重复添加数组');

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