Compare commits

...

24 Commits

Author SHA1 Message Date
8ad8e3a5b4 Merge pull request '更新' (#399) from projects/zg-zwq into projects/zg-test
Reviewed-on: #399
2024-09-26 14:14:31 +08:00
zwq
6ca512392c 更新 2024-09-26 14:13:59 +08:00
a73502cda7 Merge pull request '更新' (#397) from projects/zg-zwq into projects/zg-test
Reviewed-on: #397
2024-09-14 09:02:43 +08:00
zwq
e32530e459 更新 2024-09-14 09:02:07 +08:00
64e1c1869d Merge pull request '更新' (#396) from projects/zg-zwq into projects/zg-test
Reviewed-on: #396
2024-09-11 13:59:37 +08:00
zwq
93ac1c4742 更新 2024-09-11 13:58:14 +08:00
a650f0ad9d Merge pull request '更新' (#394) from projects/zg-zwq into projects/zg-test
Reviewed-on: #394
2024-09-10 15:21:22 +08:00
zwq
e237737830 更新 2024-09-10 15:19:44 +08:00
09cce6c613 Merge pull request '更新自贡' (#345) from projects/zg-zwq into projects/zg-test
Reviewed-on: #345
2024-04-22 16:56:43 +08:00
zwq
07dd135daa 更新自贡 2024-04-22 16:55:59 +08:00
0757d2d47c Merge pull request '更新' (#338) from projects/zg-zwq into projects/zg-test
Reviewed-on: #338
2024-04-15 17:22:40 +08:00
zwq
4fbe72d314 更新 2024-04-15 17:22:10 +08:00
10219fd841 Merge pull request 'projects/line-lb' (#72) from projects/line-lb into projects/line-test
Reviewed-on: #72
2023-11-14 09:22:16 +08:00
lb
74a2a3b8e5 Merge branch 'projects/line-lb' of http://git.picaiba.com/mt-fe-group/yudao-dev into projects/line-lb 2023-11-14 09:15:58 +08:00
lb
c3b4223e5b update login 2023-11-14 09:15:30 +08:00
070e01c2c4 Merge pull request 'projects/line-lb' (#58) from projects/line-lb into projects/line-test
Reviewed-on: #58
2023-10-30 10:53:44 +08:00
lb
2665b6a0b0 Merge branch 'projects/line-test' into projects/line-lb 2023-10-30 10:52:08 +08:00
lb
a71fb90e6a update DialogForm v-model 2023-10-30 10:51:41 +08:00
ac85c83cf9 Merge pull request 'update' (#50) from projects/line-lb into projects/line-test
Reviewed-on: #50
2023-10-19 17:07:10 +08:00
lb
c2e987aee4 update 2023-10-19 17:06:15 +08:00
0e4ed597cd Merge pull request 'update ui' (#49) from projects/line-lb into projects/line-test
Reviewed-on: #49
2023-10-18 09:15:36 +08:00
lb
3e7914ac91 update ui 2023-10-17 17:02:33 +08:00
9c19a6197a Merge pull request 'update dashboard' (#48) from projects/line-lb into projects/line-test
Reviewed-on: #48
2023-10-17 09:44:37 +08:00
lb
074b35b6a6 update dashboard 2023-10-17 09:43:44 +08:00
158 changed files with 23116 additions and 10490 deletions

View File

@ -1,20 +1,20 @@
###
# @Author: Do not edit
# @Date: 2023-08-29 09:40:39
# @LastEditTime: 2023-10-16 09:22:52
# @LastEditors: DY
# @Description:
###
# @LastEditTime: 2024-09-10 14:43:39
# @LastEditors: zwq
# @Description:
###
# 开发环境配置
ENV = 'development'
# 页面标题
VUE_APP_TITLE = 产线监控系统
VUE_APP_TITLE = 成本管理系统
# 芋道管理系统/开发环境
# VUE_APP_BASE_API = 'http://192.168.1.49:48080'
# VUE_APP_BASE_API = 'http://192.168.1.8:48080'
VUE_APP_BASE_API = 'http://192.168.0.33:48080'
VUE_APP_BASE_API = 'http://line.kszny.picaiba.com'
# VUE_APP_BASE_API = 'http://192.168.1.40:48080'
# VUE_APP_BASE_API = 'http://192.168.1.188:48080'
# 路由懒加载

View File

@ -1,15 +1,24 @@
###
# @Author: zwq
# @Date: 2024-03-27 15:49:55
# @LastEditors: zwq
# @LastEditTime: 2024-09-10 15:19:19
# @Description:
###
# 生产环境配置
ENV = 'production'
# 页面标题
VUE_APP_TITLE = 产线监控系统
VUE_APP_TITLE = 成本管理系统
# 芋道管理系统/生产环境
VUE_APP_BASE_API = '/prod-api'
# VUE_APP_BASE_API = '/prod-api'
VUE_APP_BASE_API = ''
# 根据服务器或域名修改
# PUBLIC_PATH = 'http://my-pi.com:8888/yudao-admin/'
PUBLIC_PATH = 'http://192.168.0.33:8888/'
# PUBLIC_PATH = 'http://192.168.0.33:8888/'
PUBLIC_PATH = ''
# 二级部署路径
VUE_APP_APP_NAME ='yudao-admin'

View File

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

Binary file not shown.

View File

@ -0,0 +1,86 @@
/*
* @Author: zwq
* @Date: 2024-04-11 15:00:03
* @LastEditors: zwq
* @LastEditTime: 2024-04-12 10:25:30
* @Description:
*/
import request from '@/utils/request'
// 获得分页数据
export function energyQuantityManualPage(query) {
return request({
url: '/base/energy-quantity-manual/page',
method: 'get',
params: query
})
}
// 创建
export function energyQuantityManualCreate(data) {
return request({
url: '/base/energy-quantity-manual/create',
method: 'post',
data: data
})
}
// 更新
export function energyQuantityManualUpdate(data) {
return request({
url: '/base/energy-quantity-manual/update',
method: 'put',
data: data
})
}
//获得能源抄表(手动)
export function energyQuantityManualGet(query) {
return request({
url: '/base/energy-quantity-manual/get',
method: 'get',
params: query
})
}
//删除
export function energyQuantityManualDelete(query) {
return request({
url: '/base/energy-quantity-manual/delete',
method: 'delete',
params: query
})
}
//导出
export function energyQuantityManualExport(query) {
return request({
url: '/base/energy-quantity-manual/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}
// 获得能源表名配置分页
export function energyTablePage() {
return request({
url: '/base/energy-type-meter-bind/list',
method: 'get',
})
}
// 获得能源表名配置
export function energyTableGet(query) {
return request({
url: '/base/energy-type-meter-bind/list',
method: 'get',
params: query
})
}
// 更新能源表名配置
export function energyTableUpdate(data) {
return request({
url: '/base/energy-type-meter-bind/update',
method: 'put',
data: data
})
}

View File

@ -0,0 +1,53 @@
/*
* @Author: Do not edit
* @Date: 2024-02-21 13:43:02
* @LastEditTime: 2024-04-30 10:07:59
* @LastEditors: zwq
* @Description:
*/
import request from '@/utils/request'
// 获得关联表名
export function getplcAllList(query) {
return request({
url: '/base/equipment-plc/listAll',
method: 'get',
params: query
})
}
// 获得设备
export function getEquipmentList(query) {
return request({
url: '/base/core-equipment/page',
method: 'get',
params: query
})
}
// 根据产线获得工段
export function listByParentId(query) {
return request({
url: '/base/core-workshop-section/listByParentId',
method: 'get',
params: query
})
}
// 获得产线工段设备树形结构
export function getTree(query) {
return request({
url: '/base/factory/getTree',
method: 'get',
params: query
})
}
// 获得设备分组列表
export function getgroupAllList(query) {
return request({
url: '/base/equipment-group/listAll',
method: 'get',
params: query
})
}

75
src/api/base/material.js Normal file
View File

@ -0,0 +1,75 @@
/*
* @Author: zwq
* @Date: 2024-04-09 16:42:19
* @LastEditors: zwq
* @LastEditTime: 2024-04-10 14:33:52
* @Description:
*/
import request from '@/utils/request'
// 创建原料
export function createMaterial(data) {
return request({
url: '/base/material/create',
method: 'post',
data: data
})
}
// 更新原料
export function updateMaterial(data) {
return request({
url: '/base/material/update',
method: 'put',
data: data
})
}
// 获取code
export function getCode() {
return request({
url: '/base/material/autoCode',
method: 'POST'
})
}
// 删除原料
export function deleteMaterial(id) {
return request({
url: '/base/material/delete?id=' + id,
method: 'delete'
})
}
// 获得原料
export function getMaterial(id) {
return request({
url: '/base/material/get?id=' + id,
method: 'get'
})
}
// 获得原料分页
export function getMaterialPage(query) {
return request({
url: '/base/material/page',
method: 'get',
params: query
})
}
// 获得原料列表
export function getMaterialList() {
return request({
url: '/base/material/list',
method: 'get',
})
}
// 导出原料 Excel
export function exportMaterialExcel(query) {
return request({
url: '/base/material/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}

View File

@ -0,0 +1,68 @@
/*
* @Author: zwq
* @Date: 2024-04-09 16:42:19
* @LastEditors: zwq
* @LastEditTime: 2024-04-10 14:31:46
* @Description:
*/
import request from '@/utils/request'
// 创建原料
export function createMaterialPricing(data) {
return request({
url: '/base/material-pricing/create',
method: 'post',
data: data
})
}
// 更新原料
export function updateMaterialPricing(data) {
return request({
url: '/base/material-pricing/update',
method: 'put',
data: data
})
}
// 获取code
export function getCode() {
return request({
url: '/base/material-pricing/autoCode',
method: 'POST'
})
}
// 删除原料
export function deleteMaterialPricing(id) {
return request({
url: '/base/material-pricing/delete?id=' + id,
method: 'delete'
})
}
// 获得原料
export function getMaterialPricing(id) {
return request({
url: '/base/material-pricing/get?id=' + id,
method: 'get'
})
}
// 获得原料分页
export function getMaterialPricingPage(query) {
return request({
url: '/base/material-pricing/page',
method: 'get',
params: query
})
}
// 导出原料 Excel
export function exportMaterialPricingExcel(query) {
return request({
url: '/base/material-pricing/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}

View File

@ -1,3 +1,10 @@
/*
* @Author: zwq
* @Date: 2024-03-27 15:49:55
* @LastEditors: zwq
* @LastEditTime: 2024-09-10 14:36:19
* @Description:
*/
import request from '@/utils/request'
// 获得所有工厂产线列表
export function getLineAll() {
@ -5,4 +12,12 @@ export function getLineAll() {
url: '/base/production-line/listAll',
method: 'get'
})
}
}
// 获得产线分页
export function getLinePage(query) {
return request({
url: '/base/production-line/page',
method: 'get',
params: query
})
}

54
src/api/cost/allCost.js Normal file
View File

@ -0,0 +1,54 @@
/*
* @Author: zwq
* @Date: 2024-04-18 16:53:17
* @LastEditors: zwq
* @LastEditTime: 2024-09-06 14:35:13
* @Description:
*/
import request from '@/utils/request'
// 获得总成本统计-按日期分页
export function getCostSumPage(query) {
return request({
url: '/monitoring/cost-sum/page',
method: 'get',
params: query
})
}
// 更新总成本统计-按日期
export function updateCostSum(data) {
return request({
url: '/monitoring/cost-sum/update',
method: 'put',
data: data
})
}
// 获得原片成本统计成本查询分页
export function getRawCostStatisticsRealtimePage(query) {
return request({
url: '/monitoring/cost-sum/page',
method: 'get',
params: query
})
}
// 导出总成本统计-按日期 Excel
export function exportCostSumExcel(query) {
return request({
url: '/monitoring/cost-sum/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}
// 导出原片成本统计-历史成本 Excel
export function exportRawCostStatisticsHisExcel(query) {
return request({
url: '/monitoring/cost-sum/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}

View File

@ -0,0 +1,55 @@
/*
* @Author: zwq
* @Date: 2024-04-18 16:53:17
* @LastEditors: zwq
* @LastEditTime: 2024-09-06 15:00:09
* @Description:
*/
import request from '@/utils/request'
// 更新深加工良品率
export function updateDeepRatioHis(data) {
return request({
url: '/monitoring/cost-deep-ratio-his/update',
method: 'put',
data: data
})
}
// 获得深加工产线良品率
export function getDeepPDRatioHisPage(query) {
return request({
url: '/monitoring/cost-deep-ratio-his/page-pd',
method: 'get',
params: query
})
}
// 获得深加工工段良品率
export function getDeepWSRatioHisPage(query) {
return request({
url: '/monitoring/cost-deep-ratio-his/page-ws',
method: 'get',
params: query
})
}
// 导出深加工工段良品率 Excel
export function exportDeepWSRatioHisExcel(query) {
return request({
url: '/monitoring/cost-deep-ratio-his/export-excel-ws',
method: 'get',
params: query,
responseType: 'blob'
})
}
// 导出深加工产线良品率 Excel
export function exportDeepPDRatioHisExcel(query) {
return request({
url: '/monitoring/cost-deep-ratio-his/export-excel-pd',
method: 'get',
params: query,
responseType: 'blob'
})
}

View File

@ -0,0 +1,53 @@
/*
* @Author: zwq
* @Date: 2024-04-18 16:53:17
* @LastEditors: zwq
* @LastEditTime: 2024-04-19 16:11:19
* @Description:
*/
import request from '@/utils/request'
// 更新原片能源历史
export function updateEnergyHis(data) {
return request({
url: '/monitoring/cost-energy-his/update',
method: 'put',
data: data
})
}
// 获得原片能源历史分页
export function getEnergyHisPage(query) {
return request({
url: '/monitoring/cost-energy-his/page',
method: 'get',
params: query
})
}
// 获得原片能源-成本查询分页
export function getEnergyRealtimePage(query) {
return request({
url: '/monitoring/cost-energy-realtime/page',
method: 'get',
params: query
})
}
// 导出能源成本成本查询 Excel
export function exportEnergyRealtimeExcel(query) {
return request({
url: '/monitoring/cost-energy-realtime/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}
// 导出能源成本历史 Excel
export function exportEnergyHisExcel(query) {
return request({
url: '/monitoring/cost-energy-his/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}

View File

@ -0,0 +1,54 @@
/*
* @Author: zwq
* @Date: 2024-04-18 16:53:17
* @LastEditors: zwq
* @LastEditTime: 2024-09-06 15:19:24
* @Description:
*/
import request from '@/utils/request'
// 更新深加工能源历史
export function updateEnergyHis(data) {
return request({
url: '/monitoring/cost-deep-energy-his/update',
method: 'put',
data: data
})
}
// 获得深加工能源历史分页
export function getEnergyHisPage(query) {
return request({
url: '/monitoring/cost-deep-energy-his/page',
method: 'get',
params: query
})
}
// 获得深加工能源-成本查询分页
export function getEnergyRealtimePage(query) {
return request({
url: '/monitoring/cost-deep-energy-realtime/page',
method: 'get',
params: query
})
}
// 导出深加工能源成本成本查询 Excel
export function exportEnergyRealtimeExcel(query) {
return request({
url: '/monitoring/cost-deep-energy-realtime/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}
// 导出深加工能源成本历史 Excel
export function exportEnergyHisExcel(query) {
return request({
url: '/monitoring/cost-deep-energy-his/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}

View File

@ -0,0 +1,54 @@
/*
* @Author: zwq
* @Date: 2024-04-18 16:53:17
* @LastEditors: zwq
* @LastEditTime: 2024-09-05 13:55:30
* @Description:
*/
import request from '@/utils/request'
// 更新原料成本-历史
export function updateMaterialHis(data) {
return request({
url: '/monitoring/cost-material-his/update',
method: 'put',
data: data
})
}
// 获得原料成本-历史分页
export function getMaterialHisPage(query) {
return request({
url: '/monitoring/cost-material-his/page',
method: 'get',
params: query
})
}
// 获得原料成本-成本查询分页
export function getMaterialRealtimePage(query) {
return request({
url: '/monitoring/cost-material-realtime/page',
method: 'get',
params: query
})
}
// 导出原料成本成本查询 Excel
export function exportMaterialRealtimeExcel(query) {
return request({
url: '/monitoring/cost-material-realtime/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}
// 导出原料成本历史 Excel
export function exportMaterialHisExcel(query) {
return request({
url: '/monitoring/cost-material-his/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}

View File

@ -0,0 +1,36 @@
/*
* @Author: zwq
* @Date: 2024-04-18 16:53:17
* @LastEditors: zwq
* @LastEditTime: 2024-04-22 10:53:55
* @Description:
*/
import request from '@/utils/request'
// 更新原片良品率
export function updatecostOriginRatioHis(data) {
return request({
url: '/monitoring/cost-origin-ratio-his/update',
method: 'put',
data: data
})
}
// 获得原片良品率
export function getcostOriginRatioHisPage(query) {
return request({
url: '/monitoring/cost-origin-ratio-his/page',
method: 'get',
params: query
})
}
// 导出原片良品率 Excel
export function exportcostOriginRatioHisExcel(query) {
return request({
url: '/monitoring/cost-origin-ratio-his/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}

View File

@ -0,0 +1,53 @@
/*
* @Author: zwq
* @Date: 2024-04-18 16:53:17
* @LastEditors: zwq
* @LastEditTime: 2024-04-19 14:24:17
* @Description:
*/
import request from '@/utils/request'
// 更新原片其他成本-历史
export function updateRawOthercostHis(data) {
return request({
url: '/monitoring/cost-othercost-his/update',
method: 'put',
data: data
})
}
// 获得原片其他成本-历史分页
export function getRawOthercostHisPage(query) {
return request({
url: '/monitoring/cost-othercost-his/page',
method: 'get',
params: query
})
}
// 获得原片其他成本-成本查询分页
export function getRawOthercostSunPage(query) {
return request({
url: '/monitoring/cost-othercost-log/page-sum',
method: 'get',
params: query
})
}
// 导出原片其他成本-成本查询 Excel
export function exportRawOthercostSunExcel(query) {
return request({
url: '/monitoring/cost-othercost-log/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}
// 导出原片其他成本-历史 Excel
export function exportRawOthercostHisExcel(query) {
return request({
url: '/monitoring/cost-othercost-his/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}

View File

@ -0,0 +1,53 @@
/*
* @Author: zwq
* @Date: 2024-04-18 16:53:17
* @LastEditors: zwq
* @LastEditTime: 2024-09-06 15:13:20
* @Description:
*/
import request from '@/utils/request'
// 更新深加工其他成本-历史
export function updateRawOthercostHis(data) {
return request({
url: '/monitoring/cost-deep-othercost-his/update',
method: 'put',
data: data
})
}
// 获得深加工其他成本-历史分页
export function getRawOthercostHisPage(query) {
return request({
url: '/monitoring/cost-deep-othercost-his/page',
method: 'get',
params: query
})
}
// 获得深加工其他成本-成本查询分页
export function getRawOthercostSunPage(query) {
return request({
url: '/monitoring/cost-deep-othercost-log/page-sum',
method: 'get',
params: query
})
}
// 导出深加工其他成本-成本查询 Excel
export function exportRawOthercostSunExcel(query) {
return request({
url: '/monitoring/cost-deep-othercost-log/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}
// 导出深加工其他成本-历史 Excel
export function exportRawOthercostHisExcel(query) {
return request({
url: '/monitoring/cost-deep-othercost-his/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}

View File

@ -0,0 +1,68 @@
/*
* @Author: zwq
* @Date: 2024-04-15 17:01:20
* @LastEditors: zwq
* @LastEditTime: 2024-09-06 14:12:09
* @Description:
*/
import request from '@/utils/request'
// 创建原片其他成本-记录
export function createRawOthercostLog(data) {
return request({
url: '/monitoring/cost-othercost-log/create',
method: 'post',
data: data
})
}
// 更新原片其他成本-记录
export function updateRawOthercostLog(data) {
return request({
url: '/monitoring/cost-othercost-log/update',
method: 'put',
data: data
})
}
// 删除原片其他成本-记录
export function deleteRawOthercostLog(id) {
return request({
url: '/monitoring/cost-othercost-log/delete?id=' + id,
method: 'delete'
})
}
// 获得原片其他成本-记录
export function getRawOthercostLog(id) {
return request({
url: '/monitoring/cost-othercost-log/get?id=' + id,
method: 'get'
})
}
// 获得原片其他成本-记录分页
export function getRawOthercostLogPage(query) {
return request({
url: '/monitoring/cost-othercost-log/page',
method: 'get',
params: query
})
}
// 导出原片其他成本-记录 Excel
export function exportRawOthercostLogExcel(query) {
return request({
url: '/monitoring/cost-othercost-log/export-log-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}
// 获得所有原片其他成本-记录列表
export function getRawOthercostLogAll() {
return request({
url: '/monitoring/cost-othercost-log/listAll',
method: 'get'
})
}

View File

@ -0,0 +1,68 @@
/*
* @Author: zwq
* @Date: 2024-04-15 17:01:20
* @LastEditors: zwq
* @LastEditTime: 2024-04-22 14:59:35
* @Description:
*/
import request from '@/utils/request'
// 创建深加工其他成本-记录
export function createRawOthercostLog(data) {
return request({
url: '/monitoring/cost-deep-othercost-log/create',
method: 'post',
data: data
})
}
// 更新深加工其他成本-记录
export function updateRawOthercostLog(data) {
return request({
url: '/monitoring/cost-deep-othercost-log/update',
method: 'put',
data: data
})
}
// 删除深加工其他成本-记录
export function deleteRawOthercostLog(id) {
return request({
url: '/monitoring/cost-deep-othercost-log/delete?id=' + id,
method: 'delete'
})
}
// 获得深加工其他成本-记录
export function getRawOthercostLog(id) {
return request({
url: '/monitoring/cost-deep-othercost-log/get?id=' + id,
method: 'get'
})
}
// 获得深加工其他成本-记录分页
export function getRawOthercostLogPage(query) {
return request({
url: '/monitoring/cost-deep-othercost-log/page',
method: 'get',
params: query
})
}
// 导出深加工其他成本-记录 Excel
export function exportRawOthercostLogExcel(query) {
return request({
url: '/monitoring/cost-deep-othercost-log/export-log-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}
// 获得所有深加工其他成本-记录列表
export function getRawOthercostLogAll() {
return request({
url: '/monitoring/cost-deep-othercost-log/listAll',
method: 'get'
})
}

View File

@ -0,0 +1,53 @@
/*
* @Author: zwq
* @Date: 2024-04-18 16:53:17
* @LastEditors: zwq
* @LastEditTime: 2024-09-02 14:43:30
* @Description:
*/
import request from '@/utils/request'
// 获得深加工成本分页
export function getDeepCostStatisticsPage(query) {
return request({
url: '/monitoring/cost-deep-cost-his/page',
method: 'get',
params: query
})
}
// 更新深加工成本-历史
export function updateDeepCostStatistics(data) {
return request({
url: '/monitoring/cost-deep-cost-his/update',
method: 'put',
data: data
})
}
// 获得深加工成本统计成本查询分页
export function getDeepCostStatisticsRealtimePage(query) {
return request({
url: '/monitoring/cost-deep-cost-realtime/page',
method: 'get',
params: query
})
}
// 导出深加工成本统计成本查询 Excel
export function exportDeepStatisticsRealtimeExcel(query) {
return request({
url: '/monitoring/cost-deep-cost-realtime/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}
// 导出深加工成本统计-历史成本 Excel
export function exportDeepCostStatisticsHisExcel(query) {
return request({
url: '/monitoring/cost-deep-cost-his/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}

View File

@ -0,0 +1,68 @@
/*
* @Author: zwq
* @Date: 2024-04-15 17:01:20
* @LastEditors: zwq
* @LastEditTime: 2024-04-22 14:55:00
* @Description:
*/
import request from '@/utils/request'
// 创建深加工其他成本-配置
export function createRawOthercostRule(data) {
return request({
url: '/monitoring/cost-deep-othercost-rule/create',
method: 'post',
data: data
})
}
// 更新深加工其他成本-配置
export function updateRawOthercostRule(data) {
return request({
url: '/monitoring/cost-deep-othercost-rule/update',
method: 'put',
data: data
})
}
// 删除深加工其他成本-配置
export function deleteRawOthercostRule(id) {
return request({
url: '/monitoring/cost-deep-othercost-rule/delete?id=' + id,
method: 'delete'
})
}
// 获得深加工其他成本-配置
export function getRawOthercostRule(id) {
return request({
url: '/monitoring/cost-deep-othercost-rule/get?id=' + id,
method: 'get'
})
}
// 获得深加工其他成本-配置分页
export function getRawOthercostRulePage(query) {
return request({
url: '/monitoring/cost-deep-othercost-rule/page',
method: 'get',
params: query
})
}
// 导出深加工其他成本-配置 Excel
export function exportRawOthercostRuleExcel(query) {
return request({
url: '/monitoring/cost-deep-othercost-rule/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}
// 获得所有深加工其他成本-配置列表
export function getRawOthercostRuleAll() {
return request({
url: '/monitoring/cost-deep-othercost-rule/listAll',
method: 'get'
})
}

View File

@ -0,0 +1,54 @@
/*
* @Author: zwq
* @Date: 2024-04-18 16:53:17
* @LastEditors: zwq
* @LastEditTime: 2024-09-06 14:35:13
* @Description:
*/
import request from '@/utils/request'
// 获得原片成本分页
export function getRawCostStatisticsPage(query) {
return request({
url: '/monitoring/cost-origincost-his/page',
method: 'get',
params: query
})
}
// 更新原片成本-历史
export function updateRawCostStatistics(data) {
return request({
url: '/monitoring/cost-origincost-his/update',
method: 'put',
data: data
})
}
// 获得原片成本统计成本查询分页
export function getRawCostStatisticsRealtimePage(query) {
return request({
url: '/monitoring/cost-origin-cost-realtime/page',
method: 'get',
params: query
})
}
// 导出原片成本统计成本查询 Excel
export function exportRawStatisticsRealtimeExcel(query) {
return request({
url: '/monitoring/cost-origin-cost-realtime/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}
// 导出原片成本统计-历史成本 Excel
export function exportRawCostStatisticsHisExcel(query) {
return request({
url: '/monitoring/cost-origincost-his/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}

View File

@ -0,0 +1,68 @@
/*
* @Author: zwq
* @Date: 2024-04-15 17:01:20
* @LastEditors: zwq
* @LastEditTime: 2024-04-18 15:39:12
* @Description:
*/
import request from '@/utils/request'
// 创建原片其他成本-配置
export function createRawOthercostRule(data) {
return request({
url: '/monitoring/cost-othercost-rule/create',
method: 'post',
data: data
})
}
// 更新原片其他成本-配置
export function updateRawOthercostRule(data) {
return request({
url: '/monitoring/cost-othercost-rule/update',
method: 'put',
data: data
})
}
// 删除原片其他成本-配置
export function deleteRawOthercostRule(id) {
return request({
url: '/monitoring/cost-othercost-rule/delete?id=' + id,
method: 'delete'
})
}
// 获得原片其他成本-配置
export function getRawOthercostRule(id) {
return request({
url: '/monitoring/cost-othercost-rule/get?id=' + id,
method: 'get'
})
}
// 获得原片其他成本-配置分页
export function getRawOthercostRulePage(query) {
return request({
url: '/monitoring/cost-othercost-rule/page',
method: 'get',
params: query
})
}
// 导出原片其他成本-配置 Excel
export function exportRawOthercostRuleExcel(query) {
return request({
url: '/monitoring/cost-othercost-rule/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}
// 获得所有原片其他成本-配置列表
export function getRawOthercostRuleAll() {
return request({
url: '/monitoring/cost-othercost-rule/listAll',
method: 'get'
})
}

View File

@ -43,6 +43,14 @@ export function getEnergyOverlimitLogPage(data) {
})
}
// 获得手动抄表记录分页
export function getEnergyManualLogPage(data) {
return request({
url: '/monitoring/energy-overlimit-log/pageManual',
method: 'post',
data: data
})
}
// 导出能源超限记录 Excel
export function exportEnergyOverlimitLogExcel(query) {
return request({

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="14px" height="14px" viewBox="0 0 14 14" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>上传</title>
<g id="组件" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" opacity="0.65">
<g id="上传_Resources/Button" transform="translate(-12.000000, -9.000000)">
<g id="上传" transform="translate(12.000000, 9.000000)">
<g id="upload" transform="translate(0.875000, 0.875000)" fill="currentColor" fill-rule="nonzero">
<path d="M5.80371094,0.138085937 C5.8953125,0.046484375 6.01699219,0 6.13867188,0 C6.26035156,0 6.38066406,0.046484375 6.47363281,0.138085937 L8.60371094,2.26953125 C8.78828125,2.45410156 8.78828125,2.75351562 8.60371094,2.93808594 C8.51484375,3.02695312 8.39589844,3.07617188 8.27011719,3.07617188 C8.14433594,3.07617188 8.02539062,3.02695312 7.93652344,2.93808594 L6.61171875,1.61328125 L6.61171875,9.51289062 C6.61171875,9.77402344 6.39980469,9.9859375 6.13867188,9.9859375 C5.87753906,9.9859375 5.665625,9.77402344 5.665625,9.51289062 L5.665625,1.61328125 L4.34082031,2.93808594 C4.15625,3.12265625 3.85683594,3.12265625 3.67363281,2.93808594 C3.4890625,2.75351562 3.4890625,2.45410156 3.67226563,2.26953125 L5.80371094,0.138085937 Z M11.7769531,7.88046875 C11.5158203,7.88046875 11.3039063,8.09238281 11.3039063,8.35351563 L11.3039063,11.025 C11.3039063,11.1794922 11.178125,11.3066406 11.0222656,11.3066406 L1.22636719,11.3066406 C1.071875,11.3066406 0.944726562,11.1808594 0.944726562,11.025 L0.944726562,8.35214844 C0.944726562,8.09101563 0.7328125,7.87910156 0.471679688,7.87910156 C0.210546875,7.87910156 0,8.09238281 0,8.35214844 L0,11.3996094 C0,11.8685547 0.381445313,12.2486328 0.849023437,12.2486328 L11.4009766,12.2486328 C11.8699219,12.2486328 12.25,11.8671875 12.25,11.3996094 L12.25,8.35214844 C12.25,8.09238281 12.0380859,7.88046875 11.7769531,7.88046875 Z" id="Shape"></path>
</g>
<rect id="Rectangle-49" x="0" y="0" width="14" height="14"></rect>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 KiB

BIN
src/assets/logo/cnbm.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -1,10 +1,13 @@
/* ===== PC DESIGN ===== */
$W: 1000;
$W: 1080;
$H: 1920;
$picW: 438;
$picH: 560;
$formW: 320;
// $picW: 438;
// $picH: 560;
$picW: 1080;
$picH: 1118;
$formW: 420;
$tabW: $formW / 2;
// $rowH: 56;
$rowH: 56;
$buttonH: 50;
@ -15,6 +18,7 @@ $containerBgImage: '../assets/images/bg.png';
$logoWidth: 417px;
$logoHeight: 64px;
$logoImage: '../assets/logo/login-logo.png';
$cnbmLogo: '../assets/logo/cnbm.png';
// container-content
$contentWidth: round($W / $H * 100) * 1vw;
$contentHeight: round($picH / $W * 100) / 100 * $contentWidth;
@ -22,7 +26,8 @@ $contentBgColor: #ffffff;
// container-content-pic
$picWidth: round($picW / $H * 100) * 1vw;
$picHeight: inherit;
$picImage: '../assets/images/pic.png';
// $picImage: '../assets/images/pic.png';
$picImage: '../assets/images/login-bg.png';
// container-content-field
$fieldWidth: $contentWidth - $picWidth;
$fieldHeight: inherit;
@ -34,231 +39,310 @@ $buttonHeight: $buttonH * 1px;
// - - - - - 页面基础设置
.container {
.login-code {
width: 33%;
height: 38px;
float: right;
img {
cursor: pointer;
width:100%;max-width:100px; height:auto;
vertical-align: middle;
}
}
// 元素
width: inherit;
height: inherit;
min-width: 1080px;
min-height: 620px;
background-color: $containerBgColor;
background-image: url($containerBgImage);
background-size: cover;
// 定位
position: relative;
display: flex;
justify-content: center;
align-items: center;
// 文字
font-size: 14px;
font-family: Microsoft YaHei;
font-weight: 400;
.logo {
// 元素
width: $logoWidth;
height: $logoHeight;
// background-image: url($logoImage);
// background-size: contain;
// 定位
position: absolute;
top: 50px;
left: 50%;
margin-left: -$logoWidth/2;
}
.content {
// 元素
width: $contentWidth;
height: $contentHeight;
background-color: #ffffff;
box-shadow: 0px 16px 40px rgba(0, 0, 0, 0.07);
border-radius: 20px;
// 定位
position: relative;
.pic {
// 元素
width: $picWidth;
height: $picHeight;
background-image: url($picImage);
background-repeat: no-repeat;
background-size: cover;
border-radius: 20px 0 0 20px;
// 定位
position: absolute;
top: 0;
left: 0;
}
.field {
width: $fieldWidth;
height: $fieldHeight;
// 定位
position: absolute;
top: 0;
left: $picWidth;
display:flex;
justify-content: center;
align-items: center;
.pc-title{ width: 100%; clear: both;}
.mobile-title,
.mobile-switch {
display: none;
}
.form {
box-sizing: border-box;
width: $formWidth;
// - - - tab
:deep(.el-tabs__content) {
padding: 20px 0 0;
}
:deep(.el-tabs__item) {
// 元素
width: $tabWidth;
height: $rowHeight;
padding: 0;
// 文字
line-height: $rowHeight;
color: #666666;
}
:deep(.el-tabs__item.is-active) {
font-weight: bold;
color: #2F53EB;
}
:deep(.el-tabs__active-bar) {
height: 3px;
border-radius: 2px;
}
// - - - input
:deep(.el-input__inner) {
// 元素
width: 100%;
height: $rowHeight;
background: #f5f5f5;
border: 0;
border-radius: 28px;
// 文字
text-align: center;
line-height: 19px;
color: #262626;
}
.code:deep(.el-input__inner) {
padding: 0 24px;
// 文字
text-align: left;
}
:deep(.el-input__inner::-webkit-input-placeholder) { /* WebKit browsers */
font-weight: 400;
color: #8C8C8C;
}
:deep(.el-input__inner:-moz-placeholder) { /* Mozilla Firefox 4 to 18 */
font-weight: 400;
color: #8C8C8C;
}
:deep(.el-input__inner::-moz-placeholder) { /* Mozilla Firefox 19+ */
font-weight: 400;
color: #8C8C8C;
opacity:1;
}
:deep(.el-input__inner:-ms-input-placeholder) { /* Internet Explorer 10+ */
font-weight: 400;
color: #8C8C8C !important;
}
:deep(.el-form-item) {
position: relative;
.button-code {
// 元素
height: $rowHeight;
box-sizing: border-box;
// 定位
position: absolute;
top: 0;
right: 20px;
z-index: 1;
// 文字
line-height: 20px;
font-size: 14px;
font-family: PingFang SC;
font-weight: 400;
color: #2F53EB;
span {
padding-left: 15px;
border-left: 2px solid #D9D9D9;
}
}
}
:deep(.el-form-item__error) {
padding-left: 24px;
}
.button {
width: 100%;
height: $buttonHeight;
background: rgba(24, 144, 255, 0.2);
border: 0;
border-radius: 24px;
margin-bottom: 20px;
// 文字
line-height: 26px;
font-size: 20px;
color: #FFFFFF;
}
.button-active {
background: #2F53EB;
box-shadow: 0px 2px 8px rgba(0, 80, 184, 0.2);
}
}
}
}
.footer {
// 元素
height: 16px;
line-height: 16px;
font-size: 12px;
color: #8c8c8c;
// 定位
position: absolute;
bottom: 30px;
a,
a:hover,
a:active {
color: inherit;
text-decoration: none;
}
}
.login-code {
width: 33%;
height: 38px;
float: right;
img {
cursor: pointer;
width: 100%;
max-width: 100px;
height: auto;
vertical-align: middle;
}
}
// 元素
width: inherit;
height: inherit;
min-width: 1080px;
min-height: 620px;
background-color: $containerBgColor;
// background-image: url($containerBgImage);
background-size: cover;
// 定位
position: relative;
display: flex;
justify-content: center;
align-items: center;
// 文字
font-size: 14px;
font-family: Microsoft YaHei;
font-weight: 400;
.logo {
// 元素
width: $logoWidth;
height: $logoHeight;
// background-image: url($logoImage);
// background-size: contain;
// 定位
position: absolute;
top: 50px;
left: 50%;
margin-left: -$logoWidth/2;
}
.content {
// 元素
// width: $contentWidth;
// height: $contentHeight;
width: 100%;
height: 100%;
background-color: #ffffff;
// box-shadow: 0px 16px 40px rgba(0, 0, 0, 0.07);
// border-radius: 20px;
// 定位
position: relative;
display: flex;
.pic {
// 元素
width: $picWidth;
height: $picHeight;
background-image: url($picImage);
background-repeat: no-repeat;
background-size: 100% 100%;
background-position: 0 0;
position: relative;
&::after {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
// background: #f003;
display: inline-block;
}
}
.field {
// background: #ccc3;
position: relative;
padding-top: 196px;
flex: 1;
display: flex;
flex-direction: column;
// justify-content: center;
align-items: center;
.pc-title {
width: 100%;
text-align: center;
clear: both;
position: relative;
top: -36px;
// h3.title {
// position: relative;
// &::before {
// content: '';
// background: url($cnbmLogo) 100% / 100% no-repeat;
// height: 48px;
// width: 48px;
// position: absolute;
// left: 0px;
// top: 4px;
// display: inline-block;
// }
// }
}
.mobile-title,
.mobile-switch {
display: none;
}
.form {
margin-top: 32px;
box-sizing: border-box;
// width: $formWidth;
width: 100%;
// - - - tab
:deep(.el-tabs__nav) {
// background: #f0f3;
}
:deep(.el-tabs__content) {
padding: 20px 0 0;
}
:deep(.el-tabs__item) {
user-select: none;
// 元素
width: $tabWidth;
height: $rowHeight;
padding: 0;
// 文字
line-height: $rowHeight;
color: #666666;
font-size: 18px;
font-weight: 400;
text-align: center;
}
:deep(.el-tabs__item.is-active) {
font-weight: 500;
color: #2f53eb;
}
:deep(.el-tabs__active-bar) {
height: 3px;
border-radius: 2px;
}
// - - - input
:deep(.el-input__inner) {
// 元素
width: 100%;
height: $rowHeight;
background: #f5f5f5;
border: 0;
border-radius: 28px;
// 文字
text-align: center;
line-height: 19px;
color: #262626;
}
.code:deep(.el-input__inner) {
padding: 0 24px;
// 文字
text-align: left;
}
:deep(.el-input__inner::-webkit-input-placeholder) {
/* WebKit browsers */
font-weight: 400;
color: #8c8c8c;
}
:deep(.el-input__inner:-moz-placeholder) {
/* Mozilla Firefox 4 to 18 */
font-weight: 400;
color: #8c8c8c;
}
:deep(.el-input__inner::-moz-placeholder) {
/* Mozilla Firefox 19+ */
font-weight: 400;
color: #8c8c8c;
opacity: 1;
}
:deep(.el-input__inner:-ms-input-placeholder) {
/* Internet Explorer 10+ */
font-weight: 400;
color: #8c8c8c !important;
}
:deep(.el-form-item) {
position: relative;
.button-code {
// 元素
height: $rowHeight;
box-sizing: border-box;
// 定位
position: absolute;
top: 0;
right: 20px;
z-index: 1;
// 文字
line-height: 20px;
font-size: 14px;
font-family: PingFang SC;
font-weight: 400;
color: #2f53eb;
span {
padding-left: 15px;
border-left: 2px solid #d9d9d9;
}
}
}
:deep(.el-form-item__error) {
padding-left: 24px;
}
.button {
width: 100%;
height: $buttonHeight;
background: rgba(24, 144, 255, 0.2);
border: 0;
border-radius: 24px;
margin-bottom: 20px;
// 文字
line-height: 26px;
font-size: 20px;
color: #ffffff;
}
.button-active {
background: #2f53eb;
box-shadow: 0px 2px 8px rgba(0, 80, 184, 0.2);
}
}
}
}
.login-form {
* {
user-select: none;
}
// - - - input
:deep(.el-input__inner) {
// 元素
width: 420px;
height: 66px;
color: #262626;
font-size: 18px;
}
:deep(.el-checkbox__label) {
font-size: 18px;
line-height: 14px;
}
}
.footer {
user-select: none;
// 元素
height: 16px;
line-height: 16px;
font-size: 12px;
color: #8c8c8c;
// 定位
position: absolute;
bottom: 30px;
a,
a:hover,
a:active {
color: inherit;
text-decoration: none;
}
}
}
// - - - - - PC 最小尺寸设置
@media screen and (min-width: 599px) and (max-width: 1366px) {
.container {
.content {
width: 710px;
height: 397px;
.pic {
width: 314px;
}
.field {
width: calc(710px - 314px);
left: 314px;
.form {
width: 320px;
:deep(.el-input__inner) {
width: 320px;
height: 56px;
}
.button {
height: 50px;
}
}
}
}
}
}
.container {
min-width: 599px;
.content {
// width: 710px;
// height: 397px;
width: 100%;
height: 100%;
.pic {
// width: 314px;
display: none;
}
.field {
// width: calc(710px - 314px);
// left: 314px;
// justify-content: center;
width: 100%;
.pc-title {
h3 {
font-size: 2.4rem !important;
}
}
.form {
// width: 320px;
:deep(.el-input__inner) {
width: 320px;
height: 56px;
}
.button {
height: 50px;
}
}
}
}
}
}
/* ===== MOBILE DESIGN ===== */
$mobileW: 375;
@ -273,115 +357,142 @@ $mobileButtonH: 48;
$mobileContainerBgImage: '../assets/images/bg-mobile.png';
// container-content
$mobileContentWidth: round($mobileContentW / $mobileW * 100) * 1vw;
$mobileContentHeight: round($mobileContentH / $mobileW * 100) / 100 * $mobileContentWidth;
$mobileContentHeight: round($mobileContentH / $mobileW * 100) / 100 *
$mobileContentWidth;
// container-content-field-form
$mobileFormWidth: round($mobileFormW / $mobileW *100) * 1vw;
$mobileFormWidth: round($mobileFormW / $mobileW * 100) * 1vw;
$mobileRowHeight: $mobileRowH * 1px;
$mobileButtonHeight: $mobileButtonH * 1px;
$iconBgImage: '../assets/images/icon.png';
// - - - - - 移动端设置
@media screen and (max-width: 599px) {
.container {
// 元素
background-image: url($mobileContainerBgImage);
min-width: 280px;
min-height: 568px;
// 文字
font-size: 17px;
font-family: PingFang SC;
font-weight: bold;
.logo {
display: none;
}
.container {
// 元素
background-image: url($mobileContainerBgImage);
min-width: 280px;
min-height: 568px;
// 文字
font-size: 14px;
font-family: PingFang SC;
font-weight: bold;
.logo {
display: none;
}
.content {
// 元素
width: $mobileContentWidth;
height: $mobileContentHeight;
min-width: 250px;
min-height: 340px;
// 定位
display: flex;
justify-content: center;
align-items: center;
.pic {
display: none;
}
.field {
// 元素
width: inherit;
min-height: inherit;
// 定位
left: 0;
display: flex;
flex-direction: column;
.mobile-title {
// 元素
margin: 0 0 20px;
display: block;
}
.form {
width: $mobileFormWidth;
// - - - tab
:deep(.el-tabs__header) {
display: none;
}
:deep(.el-tabs__content) {
padding: 0;
}
// - - - input
:deep(.el-input__inner) {
height: $mobileRowHeight;
line-height: 24px;
// 文字
text-align: center;
color: #262626;
}
:deep(.el-form-item) {
.button-code {
// 元素
height: $mobileRowHeight;
}
}
.button {
height: $mobileButtonHeight;
line-height: 24px;
color: #FFFFFF;
}
}
.mobile-switch {
display: block;
line-height: 20px;
font-size: 14px;
font-weight: 400;
color: #595959;
.pc-title {
display: none;
}
.content {
// 元素
width: $mobileContentWidth;
height: $mobileContentHeight;
min-width: 250px;
min-height: 340px;
// 定位
display: flex;
justify-content: center;
align-items: center;
.pic {
display: none;
}
.field {
padding: 0;
// 元素
width: inherit;
min-height: inherit;
// 定位
left: 0;
display: flex;
flex-direction: column;
.mobile-title {
// 元素
margin: 0;
display: block;
}
.form {
margin: 0;
.icon {
width: 14px;
height: 14px;
display: inline-block;
background-image: url($iconBgImage);
background-size: cover;
}
}
.mobile-switch:hover {
cursor: pointer;
}
}
}
.footer {
// 元素
font-size: 12px;
font-family: PingFang SC;
font-weight: 400;
line-height: 17px;
color: #333333;
opacity: 0.6;
// 定位
position: absolute;
bottom: 20px;
}
}
width: $mobileFormWidth;
// - - - tab
:deep(.el-tabs__header) {
display: none;
}
:deep(.el-tabs__content) {
padding: 0;
}
// - - - input
:deep(.el-input__inner) {
height: $mobileRowHeight;
line-height: 24px;
// 文字
text-align: center;
color: #262626;
}
:deep(.el-form-item) {
.button-code {
// 元素
height: $mobileRowHeight;
}
}
.button {
height: $mobileButtonHeight;
line-height: 24px;
color: #ffffff;
}
}
.login-form {
:deep(.el-input__inner) {
height: $mobileRowHeight;
line-height: 24px;
// 文字
text-align: center;
color: #262626;
}
:deep(#button-form-item) {
margin: 0 !important;
button {
// 元素
height: $mobileRowHeight;
}
}
}
.mobile-switch {
display: block;
line-height: 20px;
font-size: 14px;
font-weight: 400;
color: #595959;
margin: 0;
.icon {
width: 14px;
height: 14px;
display: inline-block;
background-image: url($iconBgImage);
background-size: cover;
}
}
.mobile-switch:hover {
cursor: pointer;
}
}
}
.footer {
// 元素
font-size: 12px;
font-family: PingFang SC;
font-weight: 400;
line-height: 17px;
color: #333333;
opacity: 0.6;
// 定位
// position: absolute;
bottom: -32px;
}
}
}

View File

@ -0,0 +1,132 @@
<!--
filename: index.vue
author: liubin
date: 2024-04-02 09:49:36
description:
-->
<template>
<!-- 按钮切换 -->
<div v-if="buttonMode" class="button-nav">
<button
v-for="m in menus"
:key="m"
@click="currentMenu = m"
:data-text="m"
:class="[m === currentMenu ? 'active' : '']"
></button>
</div>
<!-- 标签切换 -->
<div v-else class="custom-tabs" style="height: 100%; width: 100%">
<el-tabs class="tag-nav" v-model="currentMenu" style="height: 100%">
<el-tab-pane
v-for="(m, idx) in menus"
:key="m"
:label="idx == 0 ? `\u2002${m}\u2002` : `\u3000${m}\u3000`"
:name="m"
>
<slot :name="`tab${idx + 1}`"></slot>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script>
export default {
name: "ButtonNav",
props: {
menus: {
type: Array,
required: true,
default: () => [],
validator: (val) => {
return val.length > 0;
},
},
buttonMode: {
type: Boolean,
default: true,
},
},
data() {
return {
currentMenu: "",
};
},
created() {
this.currentMenu = this.menus[0];
},
watch: {
currentMenu(val) {
this.$emit("change", val);
},
},
};
</script>
<style scoped lang="scss">
.button-nav {
width: 100%;
display: flex;
gap: 12px;
* {
user-select: none;
}
button {
cursor: pointer;
appearance: none;
outline: none;
border: none;
background: #fff;
border-radius: 8px;
padding: 15px;
color: #888;
letter-spacing: 2px;
flex: 1;
box-sizing: padding-box;
position: relative;
&::after {
content: attr(data-text);
position: absolute;
top: 5px;
left: 50%;
font-size: 16px;
font-weight: 500;
transform: translate(-50%);
}
&.active {
color: #111;
//border-bottom: 2px solid #0b58ff;
box-shadow: 0px 2px 1px 1px #0b58ff;
}
}
}
</style>
<style scoped>
.custom-tabs >>> .el-tabs__header {
margin-bottom: 8px;
display: inline-block;
/* transform: translateY(-12px); */
}
.custom-tabs >>> .el-tabs__item {
padding-left: 0px !important;
padding-right: 0px !important;
line-height: 36px !important;
height: 36px;
}
.custom-tabs >>> .el-tabs__content {
height: calc(100% - 42px);
}
.custom-tabs >>> .el-tab-pane {
box-sizing: border-box;
height: 100%;
padding: 20px;
border: 10px solid #f002;
}
</style>

View File

@ -83,6 +83,9 @@
:on-success="handleUploadSuccess"
v-bind="col.bind">
<el-button size="mini" :disabled="col.bind?.disabled || false">
<svg-icon
icon-class="icon-upload"
style="color: inherit"></svg-icon>
上传文件
</el-button>
<div class="el-upload__tip" slot="tip" v-if="col.uploadTips">
@ -94,6 +97,7 @@
class="file"
v-for="file in form[col.prop] || []"
:file="file"
:key="file.fileUrl"
@delete="handleDeleteFile(file)" />
</div>
</el-form-item>
@ -132,7 +136,6 @@ const uploadedFile = {
},
methods: {
handleDelete() {
console.log('emit delete event')
this.$emit('delete', this.file);
},
},
@ -187,6 +190,10 @@ export default {
type: Boolean,
default: false,
},
hasFile: {
type: Boolean,
default: false,
},
labelPosition: {
type: String,
default: 'right',
@ -219,7 +226,6 @@ export default {
watch: {
rows: {
handler() {
console.log('watch triggered!');
this.$nextTick(() => {
this.handleOptions('watch');
});
@ -230,6 +236,9 @@ export default {
dataForm: {
handler(val) {
this.form = JSON.parse(JSON.stringify(val));
if (this.hasFile) {
this.form.files = this.form.files ?? [];
}
},
deep: true,
immediate: true,
@ -367,7 +376,9 @@ export default {
},
handleDeleteFile(file) {
this.form.files = this.form.files.filter(item => item.fileUrl != file.fileUrl);
this.form.files = this.form.files.filter(
(item) => item.fileUrl != file.fileUrl
);
this.$emit('update', this.form);
},
},

94
src/filter/code-filter.js Normal file
View File

@ -0,0 +1,94 @@
/*
* @Date: 2020-12-29 16:49:28
* @LastEditors: zwq
* @LastEditTime: 2024-09-11 13:40:48
* @FilePath: \basic-admin\src\filters\basicData\index.js
* @Description:
*/
const table = {
lineStatus: {
1: '生产中',
2: '停止',
3: '未知',
},
deactivate: {
1: '启用',
0: '停用',
},
wareType: {
1: '缓存',
2: '活动',
3: '其它',
},
reportType: {
2: '日',
3: '周',
4: '月',
5: '年',
},
manual: {
1: '手动',
0: '自动',
},
}
// 日期格式化
export function parseTime(time, pattern) {
if (arguments.length === 0 || !time) {
return null
}
const format = pattern || '{y}-{m}-{d} {h}:{i}:{s}'
let date
if (typeof time === 'object') {
date = time
} else {
if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
time = parseInt(time)
} else if (typeof time === 'string') {
time = time.replace(new RegExp(/-/gm), '/').replace('T', ' ').replace(new RegExp(/\.\d{3}/gm), '');
}
if ((typeof time === 'number') && (time.toString().length === 10)) {
time = time * 1000
}
date = new Date(time)
}
const formatObj = {
y: date.getFullYear(),
m: date.getMonth() + 1,
d: date.getDate(),
h: date.getHours(),
i: date.getMinutes(),
s: date.getSeconds(),
a: date.getDay(),
w: '',
}
const time_str = format.replace(/{([ymdhisaw])+}/g, (result, key) => {
let value = formatObj[key]
// Note: getDay() returns 0 on Sunday
if (key === 'a') {
return ['日', '一', '二', '三', '四', '五', '六'][value]
}
if (key === 'w') {
const current = new Date(time);
current.setHours(0, 0, 0);
current.setDate(current.getDate() + 4 - (current.getDay() || 7));
const firstThursday = new Date(current.getFullYear(), 0, 4);
firstThursday.setDate(firstThursday.getDate() + 4 - (firstThursday.getDay() || 7));
const time1 = current.getTime() - firstThursday.getTime();
const weeks = Math.ceil(time1 / (7 * 24 * 3600 * 1000));
return (weeks + 1)
}
if (result.length > 0 && value < 10) {
value = '0' + value
}
return value || 0
})
return time_str
}
export default function (dictTable) {
return function (val) {
return table?.[dictTable]?.[val]
}
}

122
src/mixins/basic-add.js Normal file
View File

@ -0,0 +1,122 @@
/*
* @Author: zwq
* @Date: 2022-08-24 11:19:43
* @LastEditors: zwq
* @LastEditTime: 2024-04-10 15:46:19
* @Description:
*/
import { listData } from "@/api/system/dict/data"; //数据字典接口
export default {
data() {
/* eslint-disable */
return {
urlOptions: {
createURL: '', //新增接口
updateURL: '', //编辑提交接口
infoURL: '', //编辑时获取单条数据接口
codeURL: '', //获取code接口返回结果为dataForm.code字段
optionArrUrl: [], //需要获取下拉框的方法数组
optionArr: {}, //需要获取下拉框的方法数组的返回结果
dictNameList: [], //数据字典name数组
dictArr: {}, //需要获取数据字典的方法数组的返回结果
},
visible: false,
setData: false, // 是否需要【编辑时获取单条数据接口】返回的数据操作
}
},
created() {
},
activated() {
},
methods: {
init(id) {
this.dataForm.id = id || null;
this.visible = true;
if (this.urlOptions.optionArrUrl.length > 0) {
this.getArr()
}
if (this.urlOptions.dictNameList.length > 0) {
this.getDict()
}
this.$nextTick(() => {
this.$refs["dataForm"].resetFields();
if (this.dataForm.id) {
this.urlOptions.infoURL(id).then(response => {
this.dataForm = response.data;
if (this.setData) {
this.setDataForm()
}
});
} else {
if (this.urlOptions.codeURL) {
this.getCode()
}
}
});
},
/** 获取code */
getCode() {
this.urlOptions.codeURL()
.then(({ data: res }) => {
this.dataForm.code = res;
})
.catch(() => {});
},
/** 获取下拉框数组 */
getArr() {
const params = {
pageSize: 100,
pageNo: 1,
}
this.urlOptions.optionArrUrl.forEach((item, index) => {
item(params).then(({ data: res }) => {
this.$set(this.urlOptions.optionArr, `arr${index}`, res.list)
})
.catch(() => {
});
});
},
/** 查询字典数据列表 */
getDict() {
this.urlOptions.dictNameList.forEach((item,index)=>{
const queryParams = {
pageNo: 1,
pageSize: 99,
dictType: item,
}
listData(queryParams).then(response => {
this.$set(this.urlOptions.dictArr, `dict${index}`, response.data.list)
});
})
},
// 表单提交
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 => {
this.$modal.msgSuccess("新增成功");
this.visible = false;
this.$emit("refreshDataList");
});
});
},
/** 清空form */
formClear() {
if (this.$refs.dataForm!==undefined) {
this.$refs.dataForm.resetFields();
}
}
}
}

128
src/mixins/basic-page.js Normal file
View File

@ -0,0 +1,128 @@
/*
* @Author: zwq
* @Date: 2022-08-24 11:19:43
* @LastEditors: zwq
* @LastEditTime: 2024-04-02 09:33:29
* @Description:
*/
export default {
data() {
/* eslint-disable */
return {
urlOptions: {
getDataListURL: '', //获取table接口
deleteURL: '', //删除接口
exportURL: '' //导出接口
},
tableData: [], //table数据
listQuery: { //分页
pageSize: 10,
pageNo: 1,
total: 1,
},
exportLoading: false, //导出完成的加载状态是否开启
dataListLoading: false, //获取table的加载状态是否开启
addOrEditTitle: '', //dialog的title
addOrUpdateVisible: false, //dialog状态
}
},
created() {
},
mounted() {
this.getDataList()
},
methods: {
// 获取数据列表
getDataList() {
this.dataListLoading = true;
this.urlOptions.getDataListURL(this.listQuery).then(response => {
this.tableData = response.data.list;
this.listQuery.total = response.data.total;
this.dataListLoading = false;
});
},
// 每页数
sizeChangeHandle(val) {
this.listQuery.pageSize = val;
this.listQuery.pageNo = 1;
this.getDataList();
},
// 当前页
currentChangeHandle(val) {
this.listQuery.pageNo = val;
this.getDataList();
},
// 新增
addOrUpdateHandle(id) {
this.addOrEditTitle = "新增";
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id);
});
},
//tableBtn点击
handleClick(val) {
if (val.type === "edit") {
this.addOrUpdateVisible = true;
this.addOrEditTitle = "编辑";
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data.id);
});
} else if (val.type === "delete") {
this.deleteHandle(val.data.id, val.data.name, val.data._pageIndex)
} else {
this.otherMethods(val)
}
},
// 删除
deleteHandle(id, name, index) {
this.$confirm(`是否确认删除${name ? '名称为"' + name + '"' : '序号为"' + index + '"'}的数据项?`, "系统提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
this.urlOptions.deleteURL(id).then(({ data }) => {
this.$message({
message: "操作成功",
type: "success",
duration: 1500,
onClose: () => {
this.getDataList();
},
});
});
})
.catch(() => { });
},
// dialog取消
handleCancel() {
this.$refs.addOrUpdate.formClear()
this.addOrUpdateVisible = false
this.addOrEditTitle = ''
},
// dialog确定
handleConfirm() {
this.$refs.addOrUpdate.dataFormSubmit()
},
// dialog的父组件方法this.$emit("refreshDataList");
successSubmit() {
this.handleCancel()
this.getDataList()
},
/** 导出按钮操作 */
handleExport() {
// 处理查询参数
let params = { ...this.queryParams };
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal.confirm('是否确认导出所有数据项?').then(() => {
this.exportLoading = true;
return this.urlOptions.exportURL(params);
}).then(response => {
this.$download.excel(response, '报表.xls');
this.exportLoading = false;
}).catch(() => { });
}
}
}

View File

@ -0,0 +1,20 @@
export default {
data() {
return {
tableH: this.tableHeight(260),
};
},
created() {
this.tableH = this?.heightNum ? this.tableHeight(this.heightNum) : this.tableHeight(260);
window.addEventListener('resize', this._setTableHeight);
},
destroyed() {
window.removeEventListener('resize', this._setTableHeight);
},
methods: {
_setTableHeight() {
this.tableH = this?.heightNum ? this.tableHeight(this.heightNum) : this.tableHeight(260);
// this.tableH = this.tableHeight(260);
},
},
};

View File

@ -70,17 +70,18 @@ export const constantRoutes = [
hidden: true
},
{
path: '/',
path: "",
component: Layout,
redirect: 'core/base/factory',
// children: [{
// path: 'index',
// redirect: 'core/base/factory',
// component: (resolve) => require(['@/views/index'], resolve),
// name: '首页',
// meta: { title: '首页', icon: 'dashboard', affix: true }
// }
// ]
redirect: "index",
children: [
{
path: "index",
component: (resolve) => require(["@/views/cost/raw/costMaterial/index"], resolve),
name: "首页",
meta: { title: "首页", icon: "dashboard", affix: true },
hidden: true
},
],
},
{
path: '/user',

View File

@ -48,6 +48,50 @@ export function parseTime(time, pattern) {
return time_str
}
// 日期格式化(仅适用表格)
export function parseTimeTable(pattern) {
return function(time){
if (arguments.length === 0 || !time) {
return null
}
const format = pattern || '{y}-{m}-{d} {h}:{i}:{s}'
let date
if (typeof time === 'object') {
date = time
} else {
if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
time = parseInt(time)
} else if (typeof time === 'string') {
time = time.replace(new RegExp(/-/gm), '/').replace('T', ' ').replace(new RegExp(/\.\d{3}/gm),'');
}
if ((typeof time === 'number') && (time.toString().length === 10)) {
time = time * 1000
}
date = new Date(time)
}
const formatObj = {
y: date.getFullYear(),
m: date.getMonth() + 1,
d: date.getDate(),
h: date.getHours(),
i: date.getMinutes(),
s: date.getSeconds(),
a: date.getDay()
}
const time_str = format.replace(/{([ymdhisa])+}/g, (result, key) => {
let value = formatObj[key]
// Note: getDay() returns 0 on Sunday
if (key === 'a') {
return ['日', '一', '二', '三', '四', '五', '六'][value]
}
if (result.length > 0 && value < 10) {
value = '0' + value
}
return value || 0
})
return time_str
}
}
// 表单重置
export function resetForm(refName) {
if (this.$refs[refName]) {

View File

@ -6,7 +6,9 @@
-->
<template>
<div ref="dataBoard" class=""></div>
<div ref="dataBoard" class="data-board">
<el-button type="text" @click="goback" class="go-back--btn">返回</el-button>
</div>
</template>
<script>
@ -24,39 +26,42 @@ export default {
mainFooter: null, // dom
};
},
mounted() {
this.$nextTick(() => {
this.modify();
});
},
activated() {
this.modify();
},
deactivated() {
this.recover();
},
beforeDestroy() {
this.recover();
},
// mounted() {
// this.$nextTick(() => {
// this.modify();
// });
// },
// activated() {
// this.modify();
// },
// deactivated() {
// this.recover();
// },
// beforeDestroy() {
// this.recover();
// },
methods: {
modify() {
// margin
this.appMain = document.querySelector('.app-main');
// this.appMain.style.minHeight = 'calc(100vh - 90px)';
this.appMain.style.margin = 0;
// main-footer
// this.mainFooter = document.querySelector('.main-footer').cloneNode(true);
// document.querySelector('.main-footer').remove();
this.$refs.dataBoard.classList.add('data-board');
},
recover() {
this.$refs.dataBoard.classList.remove('data-board');
this.$nextTick(() => {
this.appMain.style.margin = this.parentStyle.margin;
// this.appMain.style.minHeight = this.parentStyle.minHeight;
// this.appMain.insertAdjacentElement('afterend', this.mainFooter);
});
},
// modify() {
// // margin
// this.appMain = document.querySelector('.app-main');
// // this.appMain.style.minHeight = 'calc(100vh - 90px)';
// this.appMain.style.margin = 0;
// // main-footer
// // this.mainFooter = document.querySelector('.main-footer').cloneNode(true);
// // document.querySelector('.main-footer').remove();
// this.$refs.dataBoard.classList.add('data-board');
// },
// recover() {
// this.$refs.dataBoard.classList.remove('data-board');
// this.$nextTick(() => {
// this.appMain.style.margin = this.parentStyle.margin;
// // this.appMain.style.minHeight = this.parentStyle.minHeight;
// // this.appMain.insertAdjacentElement('afterend', this.mainFooter);
// });
// },
goback() {
this.$router.go(-1);
}
},
};
</script>
@ -71,4 +76,25 @@ export default {
background: url('../../../assets/images/DataBoard.png') 100% 100% / contain
no-repeat;
}
.go-back--btn {
position: fixed;
top: 28px;
left: 24px;
color: #fff;
font-size: 18px;
letter-spacing: 6px;
&:hover {
text-decoration: underline;
}
&::after {
content: "\2BAA";
position: absolute;
top: 6px;
right: -26px;
font-size: 24px;
}
}
</style>

View File

@ -1,8 +1,8 @@
<!--
<!--
filename: EquipmentDrawer.vue
author: liubin
date: 2023-08-22 14:38:56
description:
description:
-->
<template>
@ -320,7 +320,7 @@ export default {
//
handleAddAttr() {
if (!this.dataId) return this.$message.error('请先创建设备分组信息');
if (!this.dataId) return this.$message.warning('请先创建设备分组信息');
this.attrForm = {
id: null,
equipmentGroupId: this.dataId,

View File

@ -38,7 +38,7 @@
@close="cancel"
@cancel="cancel"
@confirm="submitForm">
<DialogForm v-if="open" ref="form" :dataForm="form" :rows="rows" />
<DialogForm v-if="open" ref="form" v-model="form" :rows="rows" />
</base-dialog>
<!-- 抽屉 详情 -->

View File

@ -1,8 +1,8 @@
<!--
<!--
filename: EquipmentDrawer.vue
author: liubin
date: 2023-08-22 14:38:56
description:
description:
-->
<template>
@ -36,7 +36,7 @@
v-if="showForm"
ref="form"
:disabled="mode.includes('detail')"
:dataForm="form"
v-model="form"
:rows="formRows" />
</div>
@ -320,7 +320,7 @@ export default {
//
handleAddAttr() {
if (!this.dataId) return this.$message.error('请先创建设备分组信息');
if (!this.dataId) return this.$message.warning('请先创建设备分组信息');
this.attrForm = {
id: null,
equipmentGroupId: this.dataId,

View File

@ -38,7 +38,7 @@
@close="cancel"
@cancel="cancel"
@confirm="submitForm">
<DialogForm v-if="open" ref="form" :dataForm="form" :rows="rows" />
<DialogForm v-if="open" ref="form" v-model="form" :rows="rows"/>
</base-dialog>
<!-- 抽屉 详情 -->

View File

@ -280,7 +280,7 @@ export default {
/** 新增按钮操作 */
handleAdd() {
if (this.queryParams.equipmentGroupId == null)
return this.$message.error('没有检测到设备分组信息');
return this.$message.warning('没有检测到设备分组信息');
this.reset();
this.open = true;
this.title = '添加设备分组报警明细';

View File

@ -38,7 +38,7 @@
@close="cancel"
@cancel="cancel"
@confirm="submitForm">
<DialogForm v-if="open" ref="form" :dataForm="form" :rows="rows" />
<DialogForm v-if="open" ref="form" v-model="form" :rows="rows" />
</base-dialog>
</div>
</template>

View File

@ -0,0 +1,388 @@
<!--
filename: TableConfig.vue
author: liubin
date: 2023-10-30 10:09:03
description:
-->
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<SearchBar
:formConfigs="searchBarFormConfig"
ref="search-bar"
@headBtnClick="handleSearchBarBtnClick" />
<!-- 列表 -->
<base-table
:table-props="tableProps"
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-data="list"
ref="pageTable"
@emitFun="handleEmitFun"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
label="操作"
:method-list="tableBtn"
@clickBtn="handleTableBtnClick" />
</base-table>
<!-- 分页组件 -->
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
@pagination="getList" />
<!-- 对话框(添加 / 修改) -->
<base-dialog
:dialogTitle="title"
:dialogVisible="open"
width="700px"
@close="cancel"
@cancel="cancel"
@confirm="submitForm">
<DialogForm v-if="open" ref="form" v-model="form" :rows="rows" />
</base-dialog>
</div>
</template>
<script>
import {
createEquipmentPlc,
updateEquipmentPlc,
deleteEquipmentPlc,
getEquipmentPlc,
getEquipmentPlcPage,
exportEquipmentPlcExcel,
} from '@/api/base/equipmentPlc';
import basicPageMixin from '@/mixins/lb/basicPageMixin';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
const switchBtn = {
name: 'SwitchBtn',
props: ['injectData'],
data() {
return {};
},
computed: {
active() {
return +this.injectData[this.injectData.prop] == 1 ? true : false;
},
},
methods: {},
render: function (h) {
return h(
'el-switch',
{
props: {
value: this.active,
},
on: {
change: (newVal) => {
this.$emit('emitData', {
action: 'update-collect',
payload: {
...this.injectData,
collection: newVal ? 1 : 0,
},
});
},
},
},
null
);
},
};
export default {
name: 'EquipmentPlc',
mixins: [basicPageMixin, tableHeightMixin],
components: {},
data() {
return {
tableKey: Math.random(),
searchBarKeys: ['name', 'plcTableName'],
tableBtn: [
this.$auth.hasPermiAnd([
'base:equipment-plc:update',
'base:equipment-plc:query'
])
? {
type: 'edit',
btnName: '修改',
}
: undefined,
this.$auth.hasPermi('base:equipment-plc:delete')
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v) => v),
tableProps: [
// {
// prop: 'createTime',
// label: '',
// fixed: true,
// width: 180,
// filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
// },
{ prop: 'code', label: '编码', width: 180, showOverflowtooltip: true },
{ prop: 'plcTableName', label: '关联表名', width: 150, showOverflowtooltip: true },
{ prop: 'name', label: '标识名称', width: 150, showOverflowtooltip: true },
{ prop: 'enName', label: '英文名称', width: 150, showOverflowtooltip: true },
{
prop: 'collection',
label: '是否采集',
subcomponent: switchBtn,
},
{ prop: 'description', label: '描述', minWidth: 150, showOverflowtooltip: true },
],
searchBarFormConfig: [
{
type: 'input',
label: '表名',
placeholder: '请输入表名',
param: 'plcTableName',
},
{
type: 'input',
label: '标识',
placeholder: '请输入标识',
param: 'name',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: this.$auth.hasPermi('base:equipment-plc:create')
? 'separate' : '',
},
{
type: this.$auth.hasPermi('base:equipment-plc:create')
? 'button' : '',
btnName: '新增',
name: 'add',
plain: true,
color: 'success',
},
// {
// type: this.$auth.hasPermi('equipment:realtime-table-config:export') ? 'button' : '',
// btnName: '',
// name: 'export',
// color: 'warning',
// },
],
rows: [
[
{
input: true,
label: '关联表名',
prop: 'plcTableName',
rules: [{ required: true, message: '关联表名不能为空', trigger: 'blur' }],
// bind: {
// disabled: true, // some condition, like detail mode...
// }
},
{
input: true,
label: '编码',
prop: 'code',
url: '/base/energy-plc/getCode',
rules: [{ required: true, message: '编码不能为空', trigger: 'blur' }],
},
],
[
{
input: true,
label: '标识',
prop: 'name',
rules: [{ required: true, message: '标识不能为空', trigger: 'blur' }],
// bind: {
// disabled: true, // some condition, like detail mode...
// }
},
{
input: true,
label: '英文名',
prop: 'enName',
},
],
[
{
switch: true,
label: '是否采集', // 0 , 1
prop: 'collection',
bind: {
'active-value': 1,
'inactive-value': 0,
value: 1,
},
},
],
[
{
textarea: true,
label: '描述',
prop: 'description',
bind: {
placeholder: '请输入备注',
},
},
],
],
//
open: false,
//
queryParams: {
pageNo: 1,
pageSize: 20,
plcTableName: null,
name: null,
},
//
form: {},
};
},
created() {
this.getList();
},
methods: {
/** 覆盖 handleEmitFun 的默认实现 */
handleEmitFun({ action, payload }) {
switch (action) {
case 'update-collect':
this.reset();
const tempForm = {};
Object.keys(this.form).forEach((key) => {
tempForm[key] = payload[key];
});
updateEquipmentPlc(tempForm).then((response) => {
this.$modal.msgSuccess('修改成功');
this.open = false;
this.getList();
});
break;
}
},
/** 查询列表 */
getList() {
this.loading = true;
//
getEquipmentPlcPage(this.queryParams).then((response) => {
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
// this.tableKey = Math.random(); // method 1
});
},
/** 取消按钮 */
cancel() {
this.open = false;
this.reset();
},
/** 表单重置 */
reset() {
this.form = {
id: undefined,
plcTableName: undefined,
code: undefined,
name: undefined,
enName: undefined,
description: undefined,
collection: 1,
};
this.resetForm('form');
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm('queryForm');
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = '添加实时数据采集配置';
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id;
getEquipmentPlc(id).then((response) => {
this.form = response.data;
this.open = true;
this.title = '修改实时数据采集配置';
});
},
/** 提交按钮 */
submitForm() {
this.$refs['form'].validate((valid) => {
if (!valid) {
return;
}
//
if (this.form.id != null) {
updateEquipmentPlc(this.form).then((response) => {
this.$modal.msgSuccess('修改成功');
this.open = false;
this.getList();
});
return;
}
//
createEquipmentPlc(this.form).then((response) => {
this.$modal.msgSuccess('新增成功');
this.open = false;
this.getList();
});
});
},
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
this.$modal
.confirm('是否确认删除该配置?')
.then(function () {
return deleteEquipmentPlc(id);
})
.then(() => {
this.getList();
this.$modal.msgSuccess('删除成功');
})
.catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
//
let params = { ...this.queryParams };
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal
.confirm('是否确认导出所有实时数据采集配置数据项?')
.then(() => {
this.exportLoading = true;
return exportEquipmentPlcExcel(params);
})
.then((response) => {
this.$download.excel(response, '实时数据采集配置.xls');
this.exportLoading = false;
})
.catch(() => {});
},
},
};
</script>

View File

@ -0,0 +1,151 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zwq
* @LastEditTime: 2024-04-30 10:01:41
* @Description:
-->
<template>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-width="100px">
<el-form-item label="设备" prop="equipmentId">
<el-cascader
placeholder="请选择设备"
v-model="dataForm.equipmentId"
:options="plLineList"
:props="{value: 'id', label: 'name', children: 'children'}"
style="width: 100%"
filterable />
</el-form-item>
<el-form-item label="关联表名" prop="plcId">
<el-select
v-model="dataForm.plcId"
filterable
placeholder="请选择关联表"
style="width: 100%">
<el-option
v-for="dict in plcList"
:key="dict.id"
:label="dict.plcTableName"
:value="dict.id" />
</el-select>
</el-form-item>
</el-form>
</template>
<script>
import basicAdd from './components/basic-add';
import { createEquipmentPlcConnect, updateEquipmentPlcConnect } from '@/api/base/equipmentPlcConnect';
import { getplcAllList, getTree } from "@/api/base/equipmentConfig";
export default {
mixins: [basicAdd],
data() {
return {
urlOptions: {
createURL: createEquipmentPlcConnect,
updateURL: updateEquipmentPlcConnect,
},
dataForm: {
id: undefined,
equipmentId: undefined,
plcId: undefined
},
plcList: [],
plLineList: [],
dataRule: {
equipmentId: [{ required: true, message: "设备不能为空", trigger: "blur" }],
plcId: [{ required: true, message: "关联表名不能为空", trigger: "blur" }]
},
options: [{
value: 'zhinan',
label: '指南',
children: [{
value: 'shejiyuanze',
label: '设计原则',
children: [{
value: 'yizhi',
label: '一致'
}, {
value: 'fankui',
label: '反馈'
}, {
value: 'xiaolv',
label: '效率'
}, {
value: 'kekong',
label: '可控'
}]
}, {
value: 'daohang',
label: '导航'
}]
}]
};
},
created() {
this.getDict()
},
methods: {
init() {
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
})
},
async getDict() {
//
const res = await getplcAllList();
this.plcList = res.data;
//
const res1 = await getTree();
this.plLineList = res1.data;
// const res1 = await getCorePLList();
// this.plLineList = res1.data;
// this.plLineList.forEach(item => {
// listByParentId({ id: item.id }).then(resp => {
// if (resp.data.length > 0) {
// // item.children = resp.data
// this.$set(item, 'children', resp.data)
// // this.$forceUpdate()
// }
// })
// })
},
//
dataFormSubmit() {
this.$refs["dataForm"].validate((valid) => {
if (!valid) {
return false;
}
//
if (this.dataForm.id) {
updateEquipmentPlcConnect({
id: this.dataForm.id,
equipmentId: this.dataForm.equipmentId[this.dataForm.equipmentId.length],
plcId: this.dataForm.plcId
}).then(response => {
this.$modal.msgSuccess("修改成功");
this.visible = false;
this.$emit("refreshDataList");
});
return;
}
//
createEquipmentPlcConnect({
id: this.dataForm.id,
equipmentId: this.dataForm.equipmentId[this.dataForm.equipmentId.length - 1],
plcId: this.dataForm.plcId
}).then(response => {
this.$modal.msgSuccess("新增成功");
this.visible = false;
this.$emit("refreshDataList");
});
});
}
}
};
</script>

View File

@ -0,0 +1,574 @@
<!--
filename: EquipmentDrawer.vue
author: liubin
date: 2023-08-22 14:38:56
description:
-->
<template>
<el-drawer
:visible="visible"
:show-close="false"
:wrapper-closable="false"
class="drawer"
custom-class="mes-drawer"
size="60%"
@closed="$emit('destroy')">
<SmallTitle slot="title">
{{
mode.includes('detail')
? '详情'
: mode.includes('edit')
? '编辑'
: '新增'
}}
</SmallTitle>
<div class="drawer-body flex">
<div class="drawer-body__content">
<section v-for="(section, index) in sections" :key="section.key">
<SmallTitle v-if="index != 0">{{ section.name }}</SmallTitle>
<div class="form-part" v-if="section.key == 'base'">
<el-skeleton v-if="!showForm" animated />
<BaseInfoForm
key="drawer-dialog-form"
v-if="showForm"
ref="form"
:disabled="mode.includes('detail')"
v-model="form"
:rows="formRows" />
</div>
<div v-if="section.key == 'attrs'" style="margin-top: 12px">
<base-table
v-loading="attrListLoading"
:table-props="section.props"
:page="attrQuery?.params.pageNo || 1"
:limit="attrQuery?.params.pageSize || 10"
:table-data="list"
:add-button-show="mode.includes('detail') ? null : '添加属性'"
@emitButtonClick="handleAddAttr"
@emitFun="handleEmitFun">
<method-btn
v-if="section.tableBtn"
slot="handleBtn"
label="操作"
:method-list="tableBtn"
@clickBtn="handleTableBtnClick" />
</base-table>
<!-- 分页组件 -->
<pagination
v-show="total > 0"
:total="total"
:page.sync="attrQuery.params.pageNo"
:limit.sync="attrQuery.params.pageSize"
@pagination="getAttrList" />
</div>
</section>
</div>
<div class="drawer-body__footer">
<el-button style="" @click="handleCancel">取消</el-button>
<el-button v-if="mode == 'detail'" type="primary" @click="toggleEdit">
编辑
</el-button>
<el-button v-else type="primary" @click="handleCancel">确定</el-button>
<!-- sections的第二项必须是 属性列表 -->
<!-- <el-button
v-if="sections[1].allowAdd"
type="primary"
@click="handleAddAttr">
添加属性
</el-button> -->
</div>
</div>
<!-- 属性对话框 -->
<base-dialog
v-if="sections[1].allowAdd"
:dialogTitle="attrTitle"
:dialogVisible="attrFormVisible"
width="45%"
:append-to-body="true"
custom-class="baseDialog"
@close="closeAttrForm"
@cancel="closeAttrForm"
@confirm="submitAttrForm">
<DialogForm
v-if="attrFormVisible"
ref="attrForm"
:disabled="mode.includes('detail')"
v-model="attrForm"
:rows="attrRows" />
</base-dialog>
</el-drawer>
</template>
<script>
import BaseInfoForm from '@/components/DialogForm';
const SmallTitle = {
name: 'SmallTitle',
props: ['size'],
data() {
return {};
},
methods: {},
render: function (h) {
return h(
'span',
{
class: 'small-title',
style: {
fontSize: '18px',
lineHeight:
this.size == 'lg' ? '24px' : this.size == 'sm' ? '18px' : '20px',
fontWeight: 500,
fontFamily: '微软雅黑, Microsoft YaHei, Arial, Helvetica, sans-serif',
},
},
this.$slots.default
);
},
};
export default {
components: { SmallTitle, DialogForm: BaseInfoForm, BaseInfoForm },
props: ['sections', 'defaultMode', 'infoData'],
data() {
return {
mode: '',
visible: false,
showForm: false,
total: 0,
form: {},
list: [],
attrTitle: '',
attrForm: {
id: null,
name: '',
plcParamName: '',
unit: '',
collection: 1,
minValue: '',
maxValue: '',
defaultValue: '',
description: '',
remark: '',
alarmContent: '',
equipmentParamType: '',
productionParamType: '',
},
attrFormVisible: false,
attrRows: [
[
{
input: true,
label: '参数列名',
prop: 'plcParamName',
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
},
{
input: true,
label: '参数名称',
prop: 'name',
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
},
],
[
{
select: true,
label: '单位',
prop: 'unit',
options: this.getDictDatas(this.DICT_TYPE.UNIT_DICT),
// rules: [{ required: true, message: '', trigger: 'blur' }],
},
{
switch: true,
label: '是否采集',
prop: 'collection',
bind: {
'active-value': 1,
'inactive-value': 0,
},
},
],
[
{
select: true,
label: '设备参数类型',
prop: 'equipmentParamType',
options: [
{ label: '一般参数', value: 1 },
{ label: '工艺参数', value: 2 },
{ label: '报警参数', value: 3 },
],
rules: [
{
required: true,
message: '设备参数类型不能为空',
trigger: 'blur',
},
],
},
{
select: true,
label: '生产参数类型',
prop: 'productionParamType',
options: [
// { label: '', value: 1 },
// { label: '', value: 2 },
// { label: '', value: 3 },
// { label: '', value: 4 },
{ label: '进口计数', value: 1 },
{ label: '出口计数', value: 2 },
{ label: '损耗计数', value: 3 },
{ label: '无类型', value: 4 },
],
rules: [
{
required: true,
message: '生产参数类型不能为空',
trigger: 'blur',
},
],
},
],
[
{
input: true,
label: '最小值',
prop: 'minValue',
rules: [
{
type: 'number',
message: '请输入正确的数字',
trigger: 'change',
transform: (val) => Number(val),
},
],
},
{
input: true,
label: '最大值',
prop: 'maxValue',
rules: [
{
required: false,
},
{
type: 'number',
message: '请输入正确的数字',
trigger: 'change',
transform: (val) => Number(val),
},
],
// rules: [{ required: true, message: '', trigger: 'blur' }],
},
],
[
{
input: true,
label: '标准值',
prop: 'defaultValue',
// rules: [{ required: true, message: '', trigger: 'blur' }],
},
{
input: true,
label: '描述',
prop: 'description',
// rules: [{ required: true, message: '', trigger: 'blur' }],
},
],
[
{
input: true,
label: '备注',
prop: 'remark',
// rules: [{ required: true, message: '', trigger: 'blur' }],
},
],
],
attrQuery: {
params: {
pageNo: 1,
pageSize: 10,
},
}, //
infoQuery: null, //
attrFormSubmitting: false,
attrListLoading: false,
};
},
computed: {
formRows() {
return this.sections[0].rows.map((row) => {
return row.map((col) => {
return {
...col,
bind: {
//
// disabled: this.mode == 'detail',
disabled: true,
},
};
});
});
},
tableBtn() {
return this.mode == 'detail' ? [] : this.sections[1].tableBtn;
},
},
mounted() {
this.mode = this.defaultMode || 'detail';
for (const section of this.sections) {
//
if ('url' in section) {
const query = {
url: section.url,
method: section.method || 'get',
params: section.queryParams || null,
data: section.data || null,
};
// debugger;
this.$axios(query).then(({ data }) => {
if (section.key == 'base') {
this.form = data;
this.showForm = true;
this.infoQuery = query;
} else if (section.key == 'attrs') {
this.attrQuery = query;
this.list = data.list;
this.total = data.total;
}
});
} else if (section.key == 'base') {
this.form = this.infoData;
this.showForm = true;
}
}
},
methods: {
handleTableBtnClick({ type, data }) {
switch (type) {
case 'edit':
this.handleEditAttr(data.id);
break;
case 'delete':
this.handleDeleteAttr(data.id);
break;
}
},
handleEmitFun(val) {
console.log('handleEmitFun', val);
},
init() {
this.visible = true;
},
async getAttrList() {
this.attrListLoading = true;
const res = await this.$axios(this.attrQuery);
if (res.code == 0) {
this.list = res.data.list;
this.total = res.data.total;
}
this.attrListLoading = false;
},
//
handleSave() {
this.$refs['form'][0].validate(async (valid) => {
if (valid) {
const isEdit = this.mode == 'edit';
await this.$axios({
url: this.sections[0][isEdit ? 'urlUpdate' : 'urlCreate'],
method: isEdit ? 'put' : 'post',
data: this.form,
});
this.$modal.msgSuccess(`${isEdit ? '更新' : '创建'}成功`);
this.visible = false;
this.$emit('refreshDataList');
}
});
},
handleCancel() {
this.visible = false;
},
//
toggleEdit() {
this.mode = 'edit';
},
//
handleAddAttr() {
this.attrForm = {
id: null,
name: '',
plcParamName: '',
unit: '',
collection: 1,
minValue: '',
maxValue: '',
defaultValue: '',
description: '',
remark: '',
alarmContent: '',
};
this.attrTitle = '添加设备绑定信息';
this.attrFormVisible = true;
},
//
async handleEditAttr(attrId) {
const res = await this.$axios({
url: this.sections[1].urlDetail,
method: 'get',
params: { id: attrId },
});
if (res.code == 0) {
this.attrForm = res.data;
this.attrTitle = '编辑设备绑定信息';
this.attrFormVisible = true;
}
},
//
handleDeleteAttr(attrId) {
this.$confirm('确定删除该分组报警?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(async () => {
const res = await this.$axios({
url: this.sections[1].urlDelete,
method: 'delete',
params: { id: attrId },
});
if (res.code == 0) {
this.$message({
message: '删除成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getAttrList();
},
});
}
})
.catch(() => {});
},
//
async submitAttrForm() {
this.$refs['attrForm'].validate((valid) => {
if (!valid) {
return false;
}
});
const isEdit = this.attrForm.id != null;
this.attrFormSubmitting = true;
const res = await this.$axios({
url: isEdit ? this.sections[1].urlUpdate : this.sections[1].urlCreate,
method: isEdit ? 'put' : 'post',
data: {
...this.attrForm,
connectId: this.infoData.id
},
});
if (res.code == 0) {
this.closeAttrForm();
this.$message({
message: `${isEdit ? '更新' : '创建'}成功`,
type: 'success',
duration: 1500,
onClose: () => {
this.getAttrList();
},
});
}
this.attrFormSubmitting = false;
},
closeAttrForm() {
this.attrFormVisible = false;
},
handleClick(raw) {
if (raw.type === 'delete') {
this.$confirm(`确定删除该报警?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
deleteProductAttr(raw.data.id).then(({ data }) => {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getList();
},
});
});
})
.catch(() => {});
} else {
this.addNew(raw.data.id);
}
},
},
};
</script>
<style scoped>
.drawer >>> .el-drawer {
border-radius: 8px 0 0 8px;
}
.drawer >>> .el-drawer__header {
margin: 0;
padding: 32px 32px 24px;
border-bottom: 1px solid #dcdfe6;
margin-bottom: 0px;
}
.small-title::before {
content: '';
display: inline-block;
vertical-align: top;
width: 4px;
height: 22px;
border-radius: 1px;
margin-right: 8px;
background-color: #0b58ff;
}
.drawer-body {
display: flex;
flex-direction: column;
height: 100%;
}
.drawer-body__content {
flex: 1;
/* background: #eee; */
padding: 20px 30px;
overflow-y: auto;
}
.drawer-body__footer {
display: flex;
justify-content: flex-end;
padding: 18px;
}
</style>

View File

@ -1,8 +1,8 @@
<!--
<!--
filename: EquipmentDrawer.vue
author: liubin
date: 2023-08-22 14:38:56
description:
description:
-->
<template>
@ -12,7 +12,7 @@
:wrapper-closable="false"
class="drawer"
custom-class="mes-drawer"
size="60%"
:size="size || '50%'"
@closed="$emit('destroy')">
<SmallTitle slot="title">
{{
@ -29,29 +29,107 @@
<section v-for="(section, index) in sections" :key="section.key">
<SmallTitle v-if="index != 0">{{ section.name }}</SmallTitle>
<div class="form-part" v-if="section.key == 'base'">
<div
class="form-part"
v-if="section.key == 'base'"
style="border-bottom: 1px solid #dfdfdf; margin-bottom: 24px">
<el-skeleton v-if="!showForm" animated />
<BaseInfoForm
<!-- <BaseInfoForm
key="drawer-dialog-form"
v-if="showForm"
ref="form"
:disabled="mode.includes('detail')"
:dataForm="form"
:rows="formRows" />
v-model="form"
:rows="formRows" /> -->
<!-- if -->
<el-row v-if="mode.includes('detail')" style="margin-bottom: 24px">
<el-col :span="8">
<div
class="title"
style="font-weight: 700; font-size: 16px; margin: 8px 0">
设备名
</div>
<div class="value" style="font-size: 14px">
{{ form.equipmentName }}
</div>
</el-col>
<el-col :span="8">
<div
class="title"
style="font-weight: 700; font-size: 16px; margin: 8px 0">
关联表名
</div>
<div class="value" style="font-size: 14px">
{{ form.plcName }}
</div>
</el-col>
</el-row>
<!-- else -->
<el-row v-else style="margin-bottom: 24px" :gutter="20">
<el-form ref="form" :model="form">
<el-col :span="8">
<el-form-item
class="title"
label="设备名"
style="font-size: 16px; margin: 8px 0">
<el-select
v-model="form.equipmentId"
filterable
clearable
placeholder="请选择设备">
<el-option
v-for="eq in eqList"
:key="eq.id"
:label="eq.name"
:value="eq.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item
class="title"
label="设备关联表名"
style="font-size: 16px; margin: 8px 0">
<el-select
v-model="form.plcId"
filterable
clearable
placeholder="请选择关联表">
<el-option
v-for="plc in plcList"
:key="plc.id"
:label="plc.plcTableName"
:value="plc.id"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-form>
</el-row>
</div>
<div v-if="section.key == 'attrs'" style="margin-top: 12px">
<div
v-if="section.key == 'attrs'"
style="position: relative; margin-top: 12px">
<div
v-if="!mode.includes('detail')"
style="position: absolute; top: -40px; right: 0">
<el-button @click="handleAddAttr" type="text">
<i class="el-icon-plus"></i>
添加参数
</el-button>
</div>
<base-table
v-loading="attrListLoading"
:table-props="section.props"
:page="attrQuery?.params.pageNo || 1"
:limit="attrQuery?.params.pageSize || 10"
:table-data="list"
:add-button-show="mode.includes('detail') ? null : '添加属性'"
@emitButtonClick="handleAddAttr"
@emitFun="handleEmitFun">
<!-- :add-button-show="mode.includes('detail') ? null : '添加属性'"
@emitButtonClick="handleAddAttr" -->
<method-btn
v-if="section.tableBtn"
v-if="section.tableBtn && !mode.includes('detail')"
slot="handleBtn"
label="操作"
:method-list="tableBtn"
@ -71,17 +149,12 @@
<div class="drawer-body__footer">
<el-button style="" @click="handleCancel">取消</el-button>
<el-button v-if="mode == 'detail'" type="primary" @click="toggleEdit">
编辑
<el-button
type="primary"
v-if="!mode.includes('detail')"
@click="handleSave">
保存
</el-button>
<el-button v-else type="primary" @click="handleCancel">确定</el-button>
<!-- sections的第二项必须是 属性列表 -->
<!-- <el-button
v-if="sections[1].allowAdd"
type="primary"
@click="handleAddAttr">
添加属性
</el-button> -->
</div>
</div>
@ -96,10 +169,10 @@
@close="closeAttrForm"
@cancel="closeAttrForm"
@confirm="submitAttrForm">
<!-- :disabled="mode.includes('detail')" -->
<DialogForm
v-if="attrFormVisible"
ref="attrForm"
:disabled="mode.includes('detail')"
v-model="attrForm"
:rows="attrRows" />
</base-dialog>
@ -136,7 +209,7 @@ const SmallTitle = {
export default {
components: { SmallTitle, DialogForm: BaseInfoForm, BaseInfoForm },
props: ['sections', 'defaultMode', 'infoData'],
props: ['sections', 'defaultMode', 'infoData', 'size'],
data() {
return {
mode: '',
@ -145,6 +218,8 @@ export default {
total: 0,
form: {},
list: [],
eqList: [],
plcList: [],
attrTitle: '',
attrForm: {
id: null,
@ -166,13 +241,17 @@ export default {
input: true,
label: '参数列名',
prop: 'plcParamName',
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
rules: [
{ required: true, message: '参数列名不能为空', trigger: 'blur' },
],
},
{
input: true,
label: '参数名称',
prop: 'name',
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
rules: [
{ required: true, message: '参数名称不能为空', trigger: 'blur' },
],
},
],
[
@ -181,7 +260,6 @@ export default {
label: '单位',
prop: 'unit',
options: this.getDictDatas(this.DICT_TYPE.UNIT_DICT),
// rules: [{ required: true, message: '', trigger: 'blur' }],
},
{
switch: true,
@ -193,6 +271,47 @@ export default {
},
},
],
[
{
select: true,
label: '设备参数类型',
prop: 'equipmentParamType',
options: [
{ label: '一般参数', value: 1 },
{ label: '工艺参数', value: 2 },
{ label: '报警参数', value: 3 },
],
rules: [
{
required: true,
message: '设备参数类型不能为空',
trigger: 'blur',
},
],
},
{
select: true,
label: '生产参数类型',
prop: 'productionParamType',
options: [
// { label: '', value: 1 },
// { label: '', value: 2 },
// { label: '', value: 3 },
// { label: '', value: 4 },
{ label: '进口计数', value: 1 },
{ label: '出口计数', value: 2 },
{ label: '损耗计数', value: 3 },
{ label: '无类型', value: 4 },
],
rules: [
{
required: true,
message: '生产参数类型不能为空',
trigger: 'blur',
},
],
},
],
[
{
input: true,
@ -222,7 +341,6 @@ export default {
transform: (val) => Number(val),
},
],
// rules: [{ required: true, message: '', trigger: 'blur' }],
},
],
[
@ -230,13 +348,11 @@ export default {
input: true,
label: '标准值',
prop: 'defaultValue',
// rules: [{ required: true, message: '', trigger: 'blur' }],
},
{
input: true,
label: '描述',
prop: 'description',
// rules: [{ required: true, message: '', trigger: 'blur' }],
},
],
[
@ -244,7 +360,6 @@ export default {
input: true,
label: '备注',
prop: 'remark',
// rules: [{ required: true, message: '', trigger: 'blur' }],
},
],
],
@ -257,6 +372,7 @@ export default {
infoQuery: null, //
attrFormSubmitting: false,
attrListLoading: false,
shouldRefreshPageView: false,
};
},
computed: {
@ -275,11 +391,24 @@ export default {
});
},
tableBtn() {
return this.mode == 'detail' ? [] : this.sections[1].tableBtn;
return this.sections[1].tableBtn;
// return this.mode == 'detail' ? [] : this.sections[1].tableBtn;
},
},
mounted() {
this.shouldRefreshPageView = false;
this.mode = this.defaultMode || 'detail';
if (this.mode != 'detail') {
this.$axios('/base/equipment/listAll').then(({ code, data }) => {
this.eqList = data;
});
this.$axios({
url: '/base/equipment-plc/listAll',
}).then(({ code, data }) => {
this.plcList = data;
});
}
for (const section of this.sections) {
//
if ('url' in section) {
@ -341,7 +470,7 @@ export default {
handleSave() {
this.$refs['form'][0].validate(async (valid) => {
if (valid) {
const isEdit = this.mode == 'edit';
const isEdit = !this.mode.includes('detail');
await this.$axios({
url: this.sections[0][isEdit ? 'urlUpdate' : 'urlCreate'],
method: isEdit ? 'put' : 'post',
@ -355,6 +484,9 @@ export default {
},
handleCancel() {
if (this.shouldRefreshPageView) {
this.$emit('refreshDataList');
}
this.visible = false;
},
@ -376,9 +508,11 @@ export default {
defaultValue: '',
description: '',
remark: '',
equipmentParamType: '',
productionParamType: '',
alarmContent: '',
};
this.attrTitle = '添加设备绑定信息';
this.attrTitle = '添加参数绑定信息';
this.attrFormVisible = true;
},
@ -391,14 +525,14 @@ export default {
});
if (res.code == 0) {
this.attrForm = res.data;
this.attrTitle = '编辑设备绑定信息';
this.attrTitle = '编辑参数绑定信息';
this.attrFormVisible = true;
}
},
//
handleDeleteAttr(attrId) {
this.$confirm('确定删除该分组报警?', '提示', {
this.$confirm('确定删除该参数?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
@ -410,6 +544,7 @@ export default {
params: { id: attrId },
});
if (res.code == 0) {
this.shouldRefreshPageView = true;
this.$message({
message: '删除成功',
type: 'success',
@ -424,35 +559,37 @@ export default {
},
//
async submitAttrForm() {
this.$refs['attrForm'].validate((valid) => {
submitAttrForm() {
this.$refs['attrForm'].validate(async (valid) => {
if (!valid) {
return;
}
});
const isEdit = this.attrForm.id != null;
this.attrFormSubmitting = true;
const res = await this.$axios({
url: isEdit ? this.sections[1].urlUpdate : this.sections[1].urlCreate,
method: isEdit ? 'put' : 'post',
data: {
...this.attrForm,
connectId: this.infoData.id
},
});
if (res.code == 0) {
this.closeAttrForm();
this.$message({
message: `${isEdit ? '更新' : '创建'}成功`,
type: 'success',
duration: 1500,
onClose: () => {
this.getAttrList();
const isEdit = this.attrForm.id != null;
this.attrFormSubmitting = true;
const res = await this.$axios({
url: isEdit ? this.sections[1].urlUpdate : this.sections[1].urlCreate,
method: isEdit ? 'put' : 'post',
data: {
...this.attrForm,
connectId: this.infoData.id,
},
});
}
this.attrFormSubmitting = false;
if (res.code == 0) {
this.closeAttrForm();
this.$message({
message: `${isEdit ? '更新' : '创建'}成功`,
type: 'success',
duration: 1500,
onClose: () => {
this.getAttrList();
this.shouldRefreshPageView = true;
},
});
}
this.attrFormSubmitting = false;
});
},
closeAttrForm() {
@ -461,7 +598,7 @@ export default {
handleClick(raw) {
if (raw.type === 'delete') {
this.$confirm(`确定删除该报警?`, '提示', {
this.$confirm(`确定删除该参数?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',

View File

@ -0,0 +1,100 @@
/*
* @Author: zwq
* @Date: 2022-08-24 11:19:43
* @LastEditors: zhp
* @LastEditTime: 2023-12-13 15:52:53
* @Description:
*/
export default {
data() {
/* eslint-disable */
return {
urlOptions: {
createURL: '',
updateURL: '',
infoURL: '',
codeURL: '',
getOption: false,
isGetCode: false,
optionArrUrl: [],
optionArr: {}
},
visible: false,
setData: false
}
},
created() {
},
activated() {
},
methods: {
init(id) {
this.dataForm.id = id || "";
this.visible = true;
if (this.urlOptions.getOption) {
this.getArr()
}
this.$nextTick(() => {
this.$refs["dataForm"].resetFields();
if (this.dataForm.id) {
this.urlOptions.infoURL(id).then(response => {
this.dataForm = response.data
if (this.setData) {
this.setDataForm()
}
});
} else {
if (this.urlOptions.isGetCode) {
this.getCode()
}
}
});
},
getCode() {
this.urlOptions.codeURL()
.then(({ data: res }) => {
this.dataForm.code = res;
})
.catch(() => {});
},
getArr() {
const params = {
pageSize: 100,
pageNo: 1,
}
this.urlOptions.optionArrUrl.forEach((item, index) => {
item(params).then(({ data: res }) => {
this.$set(this.urlOptions.optionArr, `arr${index}`, res.list)
})
.catch(() => {
});
});
},
// 表单提交
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 => {
this.$modal.msgSuccess("新增成功");
this.visible = false;
this.$emit("refreshDataList");
});
});
},
formClear() {
this.$refs.dataForm.resetFields()
}
}
}

View File

@ -0,0 +1,535 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<SearchBar
:formConfigs="searchBarFormConfig"
ref="search-bar"
@headBtnClick="handleSearchBarBtnClick" />
<!-- 列表 -->
<base-table
:table-props="tableProps"
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-data="list"
@emitFun="handleEmitFun">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
label="操作"
:width="120"
:method-list="tableBtn"
@clickBtn="handleTableBtnClick" />
</base-table>
<!-- 分页组件 -->
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
@pagination="getList" />
<!-- 对话框(添加 / 修改) -->
<base-dialog
:dialogTitle="title"
:dialogVisible="open"
width="700px"
@close="cancel"
@cancel="cancel"
@confirm="submitForm">
<DialogForm v-if="open" ref="form" v-model="form" :rows="rows" />
</base-dialog>
<!-- 抽屉 详情 -->
<BasicDrawer
v-if="editVisible"
ref="drawer"
:default-mode="editMode"
:info-data="alarmForm"
:sections="[
{
name: '基本信息',
key: 'base',
rows: drawerBaseInfoRows,
},
{
name: '属性列表',
key: 'attrs',
props: drawerListProps,
url: '/base/equipment-plc-param/page',
urlCreate: '/base/equipment-plc-param/create',
urlUpdate: '/base/equipment-plc-param/update',
urlDelete: '/base/equipment-plc-param/delete',
urlDetail: '/base/equipment-plc-param/get',
queryParams: {
connectId: alarmForm.id,
pageNo: 1,
pageSize: 10,
},
tableBtn: [
this.$auth.hasPermi('base:equipment-plc-param:update')
? {
type: 'edit',
btnName: '修改',
}
: undefined,
this.$auth.hasPermi('base:equipment-plc-param:delete')
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v) => v),
allowAdd: true,
},
]"
@refreshDataList="getList"
@cancel="editVisible = false"
@destroy="editVisible = false" />
</div>
</template>
<script>
import {
createEquipmentPlcConnect,
updateEquipmentPlcConnect,
deleteEquipmentPlcConnect,
getEquipmentPlcConnect,
getEquipmentPlcConnectPage,
exportEquipmentPlcConnectExcel,
} from '@/api/base/equipmentPlcConnect';
import moment from 'moment';
import basicPageMixin from '@/mixins/lb/basicPageMixin';
// import './http';
import BasicDrawer from './components/BasicDrawer.vue';
import { publicFormatter } from '@/utils/dict';
export default {
name: 'EquipmentPlcConnect',
mixins: [basicPageMixin],
components: { BasicDrawer },
data() {
return {
searchBarKeys: ['equipmentId', 'plcId'],
// tableBtn: [
// this.$auth.hasPermi('base:equipment-plc:update')
// ? {
// type: 'edit',
// btnName: '',
// }
// : undefined,
// this.$auth.hasPermi('base:equipment-plc:delete')
// ? {
// type: 'delete',
// btnName: '',
// }
// : undefined,
// ].filter((v) => v),
tableBtn: [
{
type: 'detail',
btnName: '参数绑定',
},
{
type: 'edit',
btnName: '修改',
},
// {
// type: 'params-bind',
// btnName: '',
// },
{
type: 'delete',
btnName: '删除',
},
],
tableProps: [
// {
// prop: 'createTime',
// label: '',
// fixed: true,
// width: 180,
// filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
// },
{ prop: 'productionLine', label: '产线' },
{ prop: 'workshopSection', label: '工段' },
{ prop: 'equipmentName', label: '设备名' },
{ prop: 'equipmentCode', label: '设备编码' },
{ prop: 'plcCode', label: '关联表编码' },
{ prop: 'plcTableName', label: '关联表名' },
{ prop: 'plcName', label: '标识名称' },
{ prop: 'bindingParameters', label: '绑定参数数量' },
// {
// _action: 'params-bind',
// label: '',
// subcomponent: {
// props: ['injectData'],
// render: function (h) {
// const _this = this;
// return h(
// 'el-button',
// {
// props: { type: 'text' },
// on: {
// click: function () {
// console.log('inejctdata', _this.injectData);
// _this.$emit('emitData', {
// action: _this.injectData._action,
// payload: _this.injectData,
// });
// },
// },
// },
// ''
// );
// },
// },
// },
],
searchBarFormConfig: [
{
type: 'select',
label: '设备名',
placeholder: '请选择设备',
param: 'equipmentId',
selectOptions: [],
},
{
type: 'select',
label: '编码',
placeholder: '请选择编码',
param: 'plcId',
selectOptions: [],
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
// type: this.$auth.hasPermi('base:equipment-plc:create')
// ? 'button'
// : '',
type: 'button',
btnName: '新增',
name: 'add',
plain: true,
color: 'success',
},
// {
// type: this.$auth.hasPermi('base:equipment-plc:export') ? 'button' : '',
// btnName: '',
// name: 'export',
// color: 'warning',
// },
],
rows: [
[
{
select: true,
label: '关联表名',
prop: 'plcId',
labelKey: `plcTableName`,
url: '/base/equipment-plc/listAll',
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
bind: {
filterable: true,
},
},
],
[
{
select: true,
label: '设备',
prop: 'equipmentId',
url: '/base/equipment/page?pageNo=1&pageSize=99',
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
bind: {
filterable: true,
},
},
],
],
open: false,
//
queryParams: {
pageNo: 1,
pageSize: 10,
plcId: null,
equipmentId: null,
},
//
form: {},
//
editVisible: false,
editMode: '',
drawerBaseInfoRows: [
[
{
input: true,
label: '设备名',
prop: 'equipmentName',
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
// bind: {
// disabled: this.editMode == 'detail', // some condition, like detail mode...
// }
},
{
input: true,
label: '关联表名',
prop: 'plcTableName',
// url: '/base/equipment/getCode',
},
],
],
drawerListProps: [
{ prop: 'plcParamName', label: '参数列名' },
{ prop: 'name', label: '参数名称' },
{
prop: 'unit',
label: '单位',
filter: publicFormatter('unit_dict'),
},
{
prop: 'equipmentParamType',
label: '设备参数类型',
filter: (val) =>
val != null
? ['', '一般参数', '工艺参数', '报警参数', ''][val]
: '-',
},
{
prop: 'productionParamType',
label: '生产参数类型',
filter: (val) =>
val != null
? // ? ['', '', '', '', '', ''][val]
['', '进口计数', '出口计数', '损耗计数', '无类型', ''][val]
: '-',
},
{
prop: 'collection',
label: '是否采集',
filter: (val) => (val != null ? ['否', '是'][val] : '-'),
},
{ prop: 'minValue', label: '最小值' },
{ prop: 'maxValue', label: '最大值' },
{ prop: 'defaultValue', label: '标准值' },
{ prop: 'description', label: '描述' },
{ prop: 'remark', label: '备注' },
],
alarmForm: {
id: undefined,
equipmentName: undefined,
plcTableName: undefined,
},
};
},
created() {
this.getList();
this.initSearchOptions();
},
methods: {
async getEquipmentOptions() {
const res = await this.$axios({
url: '/base/equipment/listAll',
method: 'get',
});
return res.data;
},
async getPlcOptions() {
const res = await this.$axios({
url: '/base/equipment-plc/listAll',
method: 'get',
});
return res.data;
},
/** 初始化查询条件 */
async initSearchOptions() {
Promise.all([this.getEquipmentOptions(), this.getPlcOptions()]).then(
([eqList, plcList]) => {
this.searchBarFormConfig[0].selectOptions = eqList.map((item) => {
return {
name: item.name,
id: item.id,
};
});
this.searchBarFormConfig[1].selectOptions = plcList.map((item) => {
return {
name: item.name,
id: item.id,
};
});
}
);
},
/** 覆盖 handleEmitFun 的默认实现 */
handleEmitFun({ action, payload }) {
switch (action) {
case 'params-bind':
this.reset();
const {
id,
equipmentName,
equipmentId,
plcId,
plcName,
plcTableName,
} = payload;
// console.log('Cha', id, equipmentName, plcTableName);
this.$router.push({
name: 'EquipmentPlcParam',
params: {
id,
equipmentName,
plcTableName,
},
});
break;
}
},
/** 查询列表 */
getList() {
this.loading = true;
//
getEquipmentPlcConnectPage(this.queryParams).then((response) => {
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
});
},
/** 取消按钮 */
cancel() {
this.open = false;
this.reset();
},
/** 表单重置 */
reset() {
this.form = {
id: undefined,
plcId: undefined,
equipmentId: undefined,
};
this.resetForm('form');
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm('queryForm');
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = '添加设备与实时采集关系表(一对多)';
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id;
getEquipmentPlcConnect(id).then((response) => {
this.form = response.data;
this.open = true;
this.title = '修改设备与实时采集关系表(一对多)';
});
},
/** 提交按钮 */
submitForm() {
this.$refs['form'].validate((valid) => {
if (!valid) {
return;
}
//
if (this.form.id != null) {
updateEquipmentPlcConnect(this.form).then((response) => {
this.$modal.msgSuccess('修改成功');
this.open = false;
this.getList();
});
return;
}
//
createEquipmentPlcConnect(this.form).then((response) => {
this.$modal.msgSuccess('新增成功');
this.open = false;
this.getList();
});
});
},
//
handleDetail(row) {
// debugger;
const {
id,
bindingParameters,
equipmentCode,
equipmentId,
equipmentName,
plcCode,
plcId,
plcName,
plcTableName,
productionLine,
workshopSection,
} = row;
//
this.editMode = 'detail';
this.alarmForm.id = id;
this.alarmForm.plcTableName = plcTableName; //
this.alarmForm.equipmentName = equipmentName;
this.editVisible = true;
this.$nextTick(() => {
this.$refs['drawer'].init();
});
},
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
this.$modal
.confirm('是否删除该配置?')
.then(function () {
return deleteEquipmentPlcConnect(id);
})
.then(() => {
this.getList();
this.$modal.msgSuccess('删除成功');
})
.catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
//
let params = { ...this.queryParams };
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal
.confirm('是否确认导出所有设备与实时采集关系表(一对多)数据项?')
.then(() => {
this.exportLoading = true;
return exportEquipmentPlcConnectExcel(params);
})
.then((response) => {
this.$download.excel(response, '设备与实时采集关系表(一对多).xls');
this.exportLoading = false;
})
.catch(() => {});
},
},
};
</script>

View File

@ -1,3 +1,10 @@
<!--
filename: CollectionConfig.vue
author: liubin
date: 2023-10-30 10:09:03
description:
-->
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
@ -12,7 +19,8 @@
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-data="list"
@emitFun="handleEmitFun">
@emitFun="handleEmitFun"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
@ -34,17 +42,21 @@
<base-dialog
:dialogTitle="title"
:dialogVisible="open"
width="700px"
width="30%"
@close="cancel"
@cancel="cancel"
@confirm="submitForm">
<DialogForm v-if="open" ref="form" :dataForm="form" :rows="rows" />
<!-- <DialogForm v-if="open" ref="form" v-model="form" :rows="rows" /> -->
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit" />
</base-dialog>
<!-- 抽屉 详情 -->
<BasicDrawer
v-if="editVisible"
ref="drawer"
size="45%"
:default-mode="editMode"
:info-data="alarmForm"
:sections="[
@ -52,9 +64,13 @@
name: '基本信息',
key: 'base',
rows: drawerBaseInfoRows,
url: '/base/equipment-plc-connect/get',
urlUpdate: '/base/equipment-plc-connect/update',
urlCreate: '/base/equipment-plc-connect/create',
queryParams: { id: alarmForm.id },
},
{
name: '属性列表',
name: '采集参数',
key: 'attrs',
props: drawerListProps,
url: '/base/equipment-plc-param/page',
@ -68,18 +84,26 @@
pageSize: 10,
},
tableBtn: [
this.$auth.hasPermi('base:equipment-plc-param:update')
? {
type: 'edit',
btnName: '修改',
}
: undefined,
this.$auth.hasPermi('base:equipment-plc-param:delete')
? {
type: 'delete',
btnName: '删除',
}
: undefined,
{
type: 'edit',
btnName: '修改',
},
{
type: 'delete',
btnName: '删除',
},
// this.$auth.hasPermi('equipment:collection-config-param:update')
// ? {
// type: 'edit',
// btnName: '',
// }
// : undefined,
// this.$auth.hasPermi('equipment:collection-config-param:delete')
// ? {
// type: 'delete',
// btnName: '',
// }
// : undefined,
].filter((v) => v),
allowAdd: true,
},
@ -99,67 +123,60 @@ import {
getEquipmentPlcConnectPage,
exportEquipmentPlcConnectExcel,
} from '@/api/base/equipmentPlcConnect';
import moment from 'moment';
import basicPageMixin from '@/mixins/lb/basicPageMixin';
// import './http';
import BasicDrawer from './components/BasicDrawer.vue';
import { publicFormatter } from '@/utils/dict';
import AddOrUpdate from './add-or-updata';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
export default {
name: 'EquipmentPlcConnect',
mixins: [basicPageMixin],
components: { BasicDrawer },
mixins: [basicPageMixin, tableHeightMixin],
components: { BasicDrawer, AddOrUpdate },
data() {
return {
searchBarKeys: ['equipmentId', 'plcId'],
// tableBtn: [
// this.$auth.hasPermi('base:equipment-plc:update')
// ? {
// type: 'edit',
// btnName: '',
// }
// : undefined,
// this.$auth.hasPermi('base:equipment-plc:delete')
// ? {
// type: 'delete',
// btnName: '',
// }
// : undefined,
// ].filter((v) => v),
tableBtn: [
{
type: 'detail',
btnName: '参数绑定',
},
{
type: 'edit',
btnName: '修改',
},
// {
// type: 'params-bind',
// btnName: '',
// },
{
type: 'delete',
btnName: '删除',
},
],
this.$auth.hasPermiAnd([
'base:equipment-plc-connect:query',
'base:equipment-plc-param:query'
])
? {
type: 'detail',
btnName: '参数绑定',
} : undefined,
this.$auth.hasPermiAnd([
'base:equipment-plc-connect:update',
'base:equipment-plc-connect:query',
'base:equipment-plc-param:create',
'base:equipment-plc-param:update',
'base:equipment-plc-param:delete',
'base:equipment-plc-param:query'
])
? {
type: 'edit',
btnName: '修改',
}
: undefined,
this.$auth.hasPermi('base:equipment-plc-connect:delete')
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v) => v),
tableProps: [
// {
// prop: 'createTime',
// label: '',
// fixed: true,
// width: 180,
// filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
// },
{ prop: 'productionLine', label: '产线' },
{ prop: 'workshopSection', label: '工段' },
{ prop: 'equipmentName', label: '设备名' },
{ prop: 'equipmentCode', label: '设备编码' },
{ prop: 'plcCode', label: '关联表编码' },
{ prop: 'plcTableName', label: '关联表名' },
{ prop: 'plcName', label: '标识名称' },
{ prop: 'bindingParameters', label: '绑定参数数量' },
{ prop: 'productionLine', label: '产线', minWidth: 120, showOverflowtooltip: true },
{ prop: 'workshopSection', label: '工段', minWidth: 120, showOverflowtooltip: true },
{ prop: 'equipmentName', label: '设备名', minWidth: 120, showOverflowtooltip: true },
{ prop: 'equipmentCode', label: '设备编码', minWidth: 200, showOverflowtooltip: true },
{ prop: 'plcCode', label: '关联表编码', minWidth: 220, showOverflowtooltip: true },
{ prop: 'plcTableName', label: '关联表名', minWidth: 150, showOverflowtooltip: true },
{ prop: 'plcName', label: '标识名称', minWidth: 150, showOverflowtooltip: true },
{ prop: 'bindingParameters', label: '绑定参数数量', minWidth: 120, showOverflowtooltip: true },
// {
// _action: 'params-bind',
// label: '',
@ -194,13 +211,15 @@ export default {
placeholder: '请选择设备',
param: 'equipmentId',
selectOptions: [],
filterable: true,
},
{
type: 'select',
label: '编码',
placeholder: '请选择编码',
label: '关联表编码',
placeholder: '请选择关联表编码',
param: 'plcId',
selectOptions: [],
filterable: true,
},
{
type: 'button',
@ -209,20 +228,21 @@ export default {
color: 'primary',
},
{
type: 'separate',
type: this.$auth.hasPermi('base:equipment-plc-connect:create')
? 'separate' : '',
},
{
// type: this.$auth.hasPermi('base:equipment-plc:create')
// ? 'button'
// : '',
type: 'button',
type: this.$auth.hasPermi('base:equipment-plc-connect:create')
? 'button'
: '',
// type: 'button',
btnName: '新增',
name: 'add',
plain: true,
color: 'success',
},
// {
// type: this.$auth.hasPermi('base:equipment-plc:export') ? 'button' : '',
// type: this.$auth.hasPermi('equipment:collection-config:export') ? 'button' : '',
// btnName: '',
// name: 'export',
// color: 'warning',
@ -236,7 +256,9 @@ export default {
prop: 'plcId',
labelKey: `plcTableName`,
url: '/base/equipment-plc/listAll',
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
rules: [
{ required: true, message: '关联表名不能为空', trigger: 'blur' },
],
bind: {
filterable: true,
},
@ -247,8 +269,10 @@ export default {
select: true,
label: '设备',
prop: 'equipmentId',
url: '/base/equipment/page?pageNo=1&pageSize=99',
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
url: '/base/core-equipment/page?pageNo=1&pageSize=99',
rules: [
{ required: true, message: '设备不能为空', trigger: 'blur' },
],
bind: {
filterable: true,
},
@ -259,7 +283,7 @@ export default {
//
queryParams: {
pageNo: 1,
pageSize: 10,
pageSize: 20,
plcId: null,
equipmentId: null,
},
@ -274,7 +298,9 @@ export default {
input: true,
label: '设备名',
prop: 'equipmentName',
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
rules: [
{ required: true, message: '设备名不能为空', trigger: 'blur' },
],
// bind: {
// disabled: this.editMode == 'detail', // some condition, like detail mode...
// }
@ -283,7 +309,7 @@ export default {
input: true,
label: '关联表名',
prop: 'plcTableName',
// url: '/base/equipment/getCode',
// url: '/base/core-equipment/getCode',
},
],
],
@ -295,6 +321,23 @@ export default {
label: '单位',
filter: publicFormatter('unit_dict'),
},
{
prop: 'equipmentParamType',
label: '设备参数类型',
filter: (val) =>
val != null
? ['', '一般参数', '工艺参数', '报警参数', ''][val]
: '-',
},
{
prop: 'productionParamType',
label: '生产参数类型',
filter: (val) =>
val != null
? // ? ['', '', '', '', '', ''][val]
['', '进口计数', '出口计数', '损耗计数', '无类型', ''][val]
: '-',
},
{
prop: 'collection',
label: '是否采集',
@ -318,6 +361,10 @@ export default {
this.initSearchOptions();
},
methods: {
successSubmit() {
this.cancel()
this.getList()
},
async getEquipmentOptions() {
const res = await this.$axios({
url: '/base/equipment/listAll',
@ -325,7 +372,6 @@ export default {
});
return res.data;
},
async getPlcOptions() {
const res = await this.$axios({
url: '/base/equipment-plc/listAll',
@ -346,7 +392,7 @@ export default {
});
this.searchBarFormConfig[1].selectOptions = plcList.map((item) => {
return {
name: item.name,
name: item.code,
id: item.id,
};
});
@ -403,6 +449,19 @@ export default {
};
this.resetForm('form');
},
handleTableBtnClick({ data, type }) {
switch (type) {
case 'edit':
this.handleDetail(data, 'edit');
break;
case 'delete':
this.handleDelete(data);
break;
case 'detail':
this.handleDetail(data);
break;
}
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
@ -417,7 +476,10 @@ export default {
handleAdd() {
this.reset();
this.open = true;
this.title = '添加设备与实时采集关系表(一对多)';
this.title = '添加设备采集配置';
this.$nextTick(() => {
this.$refs.addOrUpdate.init()
})
},
/** 修改按钮操作 */
handleUpdate(row) {
@ -426,35 +488,16 @@ export default {
getEquipmentPlcConnect(id).then((response) => {
this.form = response.data;
this.open = true;
this.title = '修改设备与实时采集关系表(一对多)';
this.title = '修改设备采集配置';
});
},
/** 提交按钮 */
submitForm() {
this.$refs['form'].validate((valid) => {
if (!valid) {
return;
}
//
if (this.form.id != null) {
updateEquipmentPlcConnect(this.form).then((response) => {
this.$modal.msgSuccess('修改成功');
this.open = false;
this.getList();
});
return;
}
//
createEquipmentPlcConnect(this.form).then((response) => {
this.$modal.msgSuccess('新增成功');
this.open = false;
this.getList();
});
});
this.$refs.addOrUpdate.dataFormSubmit()
},
//
handleDetail(row) {
handleDetail(row, mode = 'detail') {
// debugger;
const {
id,
@ -470,7 +513,7 @@ export default {
workshopSection,
} = row;
//
this.editMode = 'detail';
this.editMode = mode;
this.alarmForm.id = id;
this.alarmForm.plcTableName = plcTableName; //
this.alarmForm.equipmentName = equipmentName;

View File

@ -38,7 +38,7 @@
@close="cancel"
@cancel="cancel"
@confirm="submitForm">
<DialogForm v-if="open" ref="form" :dataForm="form" :rows="rows" />
<DialogForm v-if="open" ref="form" v-model="form" :rows="rows" />
</base-dialog>
</div>
</template>

View File

@ -0,0 +1,94 @@
<!--
* @Author: zwq
* @Date: 2023-08-01 13:52:10
* @LastEditors: zwq
* @LastEditTime: 2024-04-10 09:30:06
* @Description:
-->
<template>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
v-if="visible"
@keyup.enter.native="dataFormSubmit()"
label-width="100px"
label-position="top">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="原料名称" prop="name">
<el-input v-model="dataForm.name" clearable
placeholder="请输入原料名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="原料等级" prop="level">
<el-input v-model="dataForm.level" clearable
placeholder="请输入原料等级" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="原料编码" prop="code">
<el-input v-model="dataForm.code" readonly />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="单位" prop="unit">
<el-select
v-model="dataForm.unit"
filterable
clearable
:style="{ width: '100%' }"
placeholder="请选择单位">
<el-option
v-for="item in urlOptions.dictArr.dict0"
:key="item.id"
:label="item.label"
:value="item.value"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import basicAdd from '@/mixins/basic-add';
import {
createMaterial,
updateMaterial,
getMaterial,
getCode
} from '@/api/base/material';
export default {
mixins: [basicAdd],
data() {
return {
urlOptions: {
createURL: createMaterial,
updateURL: updateMaterial,
infoURL: getMaterial,
codeURL: getCode, //codedataForm.code
dictNameList: ['unit_dict'], //name
},
dataForm: {
id: undefined,
code: '',
name: '',
unit: '',
level: '',
},
dataRule: {
name: [
{ required: true, message: '原料不能为空', trigger: 'blur' },
],
code: [{ required: true, message: '编码不能为空', trigger: 'blur' }],
},
};
},
created() {},
methods: {
},
};
</script>

View File

@ -0,0 +1,180 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<!-- 列表 -->
<base-table
v-loading="dataListLoading"
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-data="tableData">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="90"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" />
<!-- 对话框(添加 / 修改) -->
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="40%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
import basicPage from '@/mixins/basic-page';
import { parseTime } from '@/filter/code-filter';
import { publicFormatter } from "@/utils/dict";
import {
deleteMaterial,
getMaterialPage,
} from '@/api/base/material';
const tableProps = [
{
prop: 'createTime',
label: '添加时间',
filter: parseTime,
minWidth: 150
},
{
prop: 'name',
label: '原料名称',
},
{
prop: 'code',
label: '原料编码',
width: 180,
},
{
prop: 'unit',
label: '单位',
filter: publicFormatter('unit_dict'),
},
];
export default {
mixins: [basicPage],
data() {
return {
urlOptions: {
getDataListURL: getMaterialPage,
deleteURL: deleteMaterial,
},
tableProps,
tableBtn: [
this.$auth.hasPermi(`base:material:update`)
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
this.$auth.hasPermi(`base:material:delete`)
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v) => v),
tableData: [],
formConfig: [
{
type: 'input',
label: '原料名称',
placeholder: '原料名称',
param: 'name'
},
{
type: 'input',
label: '原料编码',
placeholder: '原料编码',
param: 'code'
},
{
type: this.$auth.hasPermi('base:material:query')
? 'button'
: '',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type:
this.$auth.hasPermi('base:material:create') &&
this.$auth.hasPermi('base:material:query')
? 'separate'
: '',
},
{
type: this.$auth.hasPermi('base:material:create')
? 'button'
: '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true,
},
],
};
},
components: {
AddOrUpdate,
},
created() {
},
methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.name = val.name;
this.listQuery.code = val.code;
this.getDataList();
break;
case 'reset':
this.$refs.searchBarForm.resetForm();
this.listQuery = {
pageSize: 20,
pageNo: 1,
total: 1,
};
this.getDataList();
break;
case 'add':
this.addOrEditTitle = '新增';
this.addOrUpdateVisible = true;
this.addOrUpdateHandle();
break;
case 'export':
this.handleExport();
break;
default:
console.log(val);
}
},
},
};
</script>

View File

@ -0,0 +1,156 @@
<!--
* @Author: zwq
* @Date: 2023-08-01 13:52:10
* @LastEditors: zwq
* @LastEditTime: 2024-04-11 09:05:16
* @Description:
-->
<template>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
v-if="visible"
@keyup.enter.native="dataFormSubmit()"
label-width="100px"
label-position="top">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="原料名称" prop="materialId">
<el-select
v-model="dataForm.materialId"
filterable
@change="setCode"
:style="{ width: '100%' }"
placeholder="请选择原料名称">
<el-option
v-for="item in MaterialList"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="原料编码" prop="code">
<el-input v-model="dataForm.code" clearable readonly />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="生效开始时间" prop="startTime">
<el-date-picker
v-model="dataForm.startTime"
type="date"
value-format="timestamp"
:style="{ width: '100%' }"
placeholder="选择开始时间"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="生效结束时间" prop="endTime">
<el-date-picker
v-model="dataForm.endTime"
type="date"
value-format="timestamp"
:style="{ width: '100%' }"
placeholder="选择结束时间"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="单价" prop="price">
<el-input-number
:min="0"
style="width: 75%"
v-model="dataForm.price"
clearable
placeholder="请输入允许留存时间" />
{{ unit }}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="备注" prop="remark">
<el-input
v-model="dataForm.remark"
clearable
placeholder="请输入备注" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import basicAdd from '@/mixins/basic-add';
import {
createMaterialPricing,
updateMaterialPricing,
getMaterialPricing,
} from '@/api/base/materialPricing';
import { getMaterialPage } from '@/api/base/material';
export default {
mixins: [basicAdd],
data() {
return {
urlOptions: {
createURL: createMaterialPricing,
updateURL: updateMaterialPricing,
infoURL: getMaterialPricing,
optionArrUrl: [getMaterialPage], //
dictNameList: ['unit_dict'], //name
},
dataForm: {
id: null,
code: '',
materialId: '',
price: '',
startTime: new Date().getTime(),
endTime: null,
remark: '',
},
setData: true,
MaterialList: [],
unit: '元/吨',
dataRule: {
materialId: [
{ required: true, message: '原料不能为空', trigger: 'blur' },
],
price: [{ required: true, message: '单价不能为空', trigger: 'blur' }],
startTime: [
{
required: true,
message: '生效开始时间不能为空',
trigger: 'change',
},
],
},
};
},
created() {},
methods: {
getArr() {
getMaterialPage({ pageSize: 100, pageNo: 1 }).then((response) => {
this.MaterialList = response.data.list;
});
},
setDataForm() {
if (this.MaterialList.length > 0) {
this.setCode();
} else {
setTimeout(this.setCode(), 1000);
}
},
setCode() {
this.MaterialList.forEach((item) => {
if (item.id === this.dataForm.materialId) {
this.dataForm.code = item.code;
this.unit =
'元/' +
this.urlOptions.dictArr.dict0.find((d) => d.value === item.unit)
.label;
}
});
},
},
};
</script>

View File

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

View File

@ -0,0 +1,182 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<!-- 列表 -->
<base-table
v-loading="dataListLoading"
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-data="tableData">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="90"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" />
<!-- 对话框(添加 / 修改) -->
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="40%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
import connectTime from './connectTime';
import basicPage from '@/mixins/basic-page';
import { parseTime } from '@/filter/code-filter';
import {
deleteMaterialPricing,
getMaterialPricingPage,
} from '@/api/base/materialPricing';
import { getMaterialPage } from '@/api/base/material';
const tableProps = [
{
prop: 'name',
label: '原料名称',
},
{
prop: 'code',
label: '原料编码',
width: 180,
},
{
prop: 'price',
label: '单价(元/吨)',
align: 'right',
},
{
prop: 'createTime',
label: '生效时间',
width: 235,
subcomponent: connectTime,
},
{
prop: 'remark',
label: '备注',
},
];
export default {
mixins: [basicPage],
data() {
return {
urlOptions: {
getDataListURL: getMaterialPricingPage,
deleteURL: deleteMaterialPricing,
},
tableProps,
tableBtn: [
this.$auth.hasPermi(`base:material-pricing:update`)
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
this.$auth.hasPermi(`base:material-pricing:delete`)
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v) => v),
tableData: [],
formConfig: [
{
type: 'select',
label: '原料名称',
selectOptions: [],
param: 'name',
filterable: true,
},
{
type: this.$auth.hasPermi('base:material-pricing:query')
? 'button'
: '',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type:
this.$auth.hasPermi('base:material-pricing:create') &&
this.$auth.hasPermi('base:material-pricing:query')
? 'separate'
: '',
},
{
type: this.$auth.hasPermi('base:material-pricing:create')
? 'button'
: '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true,
},
],
};
},
components: {
AddOrUpdate,
},
created() {
getMaterialPage({ pageSize: 100, pageNo: 1 }).then((response) => {
this.formConfig[0].selectOptions = response.data.list;
});
},
methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.materialId = val.name;
this.getDataList();
break;
case 'reset':
this.$refs.searchBarForm.resetForm();
this.listQuery = {
pageSize: 20,
pageNo: 1,
total: 1,
};
this.getDataList();
break;
case 'add':
this.addOrEditTitle = '新增';
this.addOrUpdateVisible = true;
this.addOrUpdateHandle();
break;
case 'export':
this.handleExport();
break;
default:
console.log(val);
}
},
},
};
</script>

View File

@ -299,7 +299,7 @@ export default {
}
})
clipboard.on('error', e => {
this.$message.error('代码复制失败')
this.$message.warning('代码复制失败')
})
},
created() {

View File

@ -42,7 +42,7 @@ export default {
created() {
this.leaveId = this.id || this.$route.query.id;
if (!this.leaveId) {
this.$message.error('未传递 id 参数,无法查看 OA 请假信息');
this.$message.warning('未传递 id 参数,无法查看 OA 请假信息');
return;
}
this.getDetail();

View File

@ -167,7 +167,7 @@ export default {
created() {
this.id = this.$route.query.id;
if (!this.id) {
this.$message.error('未传递 id 参数,无法查看流程信息');
this.$message.warning('未传递 id 参数,无法查看流程信息');
return;
}
this.getDetail();
@ -185,7 +185,7 @@ export default {
this.processInstanceLoading = true;
getProcessInstance(this.id).then(response => {
if (!response.data) {
this.$message.error('查询不到流程信息!');
this.$message.warning('查询不到流程信息!');
return;
}
//

View File

@ -1,4 +1,4 @@
<!--
<!--
filename: AssetsUpload.vue
author: liubin
date: 2023-10-12 16:40:14
@ -18,9 +18,16 @@
预览
</div> -->
</section>
<section class="file-area">
<section
class="file-area"
:style="{
height: expand ? 'auto' : isPicMode ? '180px' : '152px',
gap: isPicMode ? '0 24px' : '24px',
gridAutoRows: isPicMode ? '180px' : '152px',
}">
<el-upload
class="equipment-upload"
:style="{ marginBottom: isPicMode ? '48px' : '24px' }"
:disabled="disabled"
drag
:action="uploadUrl"
@ -56,7 +63,6 @@
v-for="(file, index) in files"
:key="file.fileName"
:style="{
display: index > 3 && !expand ? 'none' : 'block',
background: isPicMode
? `url(${file.fileUrl}) no-repeat`
: `url(${defaultBg}) no-repeat`,
@ -211,7 +217,7 @@ export default {
response.data == null ||
response.data.trim() == ''
) {
this.$message.error('上传出错了!');
this.$message.warning('上传出错了!');
return;
}
this.files.push({
@ -226,7 +232,7 @@ export default {
clearTimeout(this.updateTimer);
}
this.updateTimer = setTimeout(() => {
console.log('[AssetsUpload] 更新上传列表');
// console.log('[AssetsUpload] ');
this.emitFilelist();
clearTimeout(this.updateTimer);
this.updateTimer = null;
@ -314,7 +320,6 @@ export default {
}
:deep(.equipment-upload) {
background: #ccc4;
.el-upload-dragger {
width: 188px;
height: 128px;
@ -346,6 +351,10 @@ export default {
}
}
.equipment-upload {
margin-bottom: 24px;
}
.file-list {
padding: 12px;
border: 1px solid #ccc;
@ -354,13 +363,14 @@ export default {
// custom
.file-area {
display: grid;
grid-template-columns: repeat(5, 188px);
grid-auto-rows: 128px;
gap: 24px 18px;
place-content: center;
grid-template-columns: repeat(auto-fill, 188px);
grid-auto-rows: 152px;
gap: 48px 24px;
overflow: hidden;
}
.file-list__item {
height: 128px;
background-color: #fff;
border: 1px dashed #d9d9d9;
border-radius: 6px;

View File

@ -1,32 +0,0 @@
<!--
filename: EquipmentAssets.vue
author: liubin
date: 2023-08-22 11:11:18
description: 设备资产
-->
<template>
<div class="equipment-assets"></div>
</template>
<script>
export default {
name: "EquipmentAssets",
components: {},
props: {},
data() {
return {}
},
computed: {},
methods: {},
}
</script>
<style scoped lang="scss">
.equipment-assets {
background: #f1f1f1;
padding: 12px;
min-height: 128px;
margin-top: 8px;
}
</style>

View File

@ -1,8 +1,8 @@
<!--
<!--
filename: EquipmentDrawer.vue
author: liubin
date: 2023-08-22 14:38:56
description:
description:
-->
<template>
@ -361,7 +361,7 @@ export default {
//
handleAddAttr() {
if (!this.dataId) return this.$message.error('请先创建设备信息');
if (!this.dataId) return this.$message.warning('请先创建设备信息');
this.attrForm = {
id: null,
equipmentId: this.dataId,

View File

@ -1,111 +0,0 @@
<!--
filename: EquipmentPics.vue
author: liubin
date: 2023-08-18 16:29:39
description:
-->
<template>
<div class="equipment-pics">
<div v-for="(url, idx) in images" :key="url">
<img :src="url" :alt="url" />
<figure class="big-img" :style="inlineStyle">
<img :src="url" :alt="url" />
<figcaption>{{ desc[idx] }}</figcaption>
</figure>
</div>
</div>
</template>
<script>
export default {
name: 'EquipmentPics',
components: {},
props: {
inlineStyle: {
type: Object,
default: () => ({}),
},
},
data() {
return {
desc: [
'车间设备 - 1',
'车间设备 - 2',
'车间设备 - 3',
'车间设备 - 4',
'车间设备 - 5',
'车间设备 - 6',
'车间设备 - 7',
'车间设备 - 8',
'车间设备 - 9',
'车间设备 - 10',
'车间设备 - 11',
'车间设备 - 12',
],
images: Array(10)
.fill(1)
.map((_, index) => require(`../assets/eq${index + 1}.jpg`)),
};
},
methods: {},
};
</script>
<style scoped lang="scss">
.equipment-pics {
// background: #cfcfcf;
padding: 12px;
// margin: 8px;
display: flex;
overflow-x: auto;
}
.equipment-pics > div {
height: 100px;
position: relative;
cursor: pointer;
}
.equipment-pics > div:not(:last-child) {
margin-right: 12px;
}
.equipment-pics > div > img {
height: 95%;
}
.equipment-pics > div > figure {
display: none;
position: fixed;
// inset: 0;
// margin: auto;
top: 0;
right: 0;
// width: 640px;
// height: 480px;
background: #000;
overflow: hidden;
padding: 8px 8px 0;
}
.equipment-pics > div:hover > figure {
margin: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.equipment-pics > div > figure > img {
flex: 1;
}
.equipment-pics > div > figure > figcaption {
height: 24px;
margin-top: 8px;
font-size: 18px;
line-height: 1;
color: #fff;
}
</style>

View File

@ -44,8 +44,9 @@
ref="form"
label-position="top"
size="small"
:dataForm="form"
:rows="computedRows" />
v-model="form"
:rows="computedRows"
:has-file="true" />
</base-dialog>
<!-- 设备 详情 - 编辑 -->
@ -105,9 +106,6 @@
<script>
import moment from 'moment';
import basicPageMixin from '@/mixins/lb/basicPageMixin';
import { getAccessToken } from '@/utils/auth';
import EquipmentPics from './components/EquipmentPics';
import EquipmentAssets from './components/EquipmentAssets';
import EquipmentDrawer from './components/EquipmentDrawer';
import {
@ -132,6 +130,12 @@ export default {
return {
searchBarKeys: ['name', 'code'],
tableBtn: [
this.$auth.hasPermi(`base:equipment:update`)
? {
type: 'detail',
btnName: '详情',
}
: undefined,
this.$auth.hasPermi('base:equipment:update')
? {
type: 'edit',
@ -144,12 +148,6 @@ export default {
btnName: '删除',
}
: undefined,
this.$auth.hasPermi(`base:equipment:update`)
? {
type: 'detail',
btnName: '详情',
}
: undefined,
].filter((v) => v),
tableProps: [
{
@ -213,6 +211,12 @@ export default {
{
type: 'separate',
},
{
type: this.$auth.hasPermi('base:equipment:export') ? 'button' : '',
btnName: '导出',
name: 'export',
color: 'warning',
},
{
type: this.$auth.hasPermi('base:equipment:create') ? 'button' : '',
btnName: '新增',
@ -220,12 +224,6 @@ export default {
plain: true,
color: 'success',
},
{
type: this.$auth.hasPermi('base:equipment:export') ? 'button' : '',
btnName: '导出',
name: 'export',
color: 'warning',
},
],
rows: [
[

View File

@ -37,7 +37,12 @@
@close="cancel"
@cancel="cancel"
@confirm="submitForm">
<DialogForm v-if="open" ref="form" v-model="form" :rows="rows" />
<DialogForm
v-if="open"
ref="form"
v-model="form"
:rows="rows"
:has-file="true" />
</base-dialog>
</div>
</template>
@ -207,8 +212,6 @@ export default {
name: undefined,
parentId: undefined,
remark: undefined,
fileNames: [],
fileUrls: [],
};
this.resetForm('form');
},

View File

@ -51,7 +51,7 @@ const tableProps = [
{
prop: 'code',
label: '工厂编码'
},
},
{
prop: 'name',
label: '工厂名称'

View File

@ -1,8 +1,8 @@
<!--
* @Author: zwq
* @Date: 2023-08-01 13:52:10
* @LastEditors: DY
* @LastEditTime: 2023-09-21 15:45:07
* @LastEditors: zwq
* @LastEditTime: 2024-04-10 16:31:51
* @Description:
-->
<template>
@ -65,6 +65,21 @@
placeholder="请输入额外编码" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item prop="pdType" label="产线类型">
<el-select
v-model="dataForm.pdType"
filterable
clearable
placeholder="请选择产线类型">
<el-option
v-for="item in pdTypeArr"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="备注" prop="remark">
<el-input
@ -120,7 +135,18 @@ export default {
externalCode: undefined,
remark: undefined,
description: undefined,
pdType: undefined,
},
pdTypeArr: [
{
id: 0,
name: '深加工'
},
{
id: 1,
name: '原片'
}
],
dataRule: {
code: [
{ required: true, message: '产线编码不能为空', trigger: 'blur' },

View File

@ -13,7 +13,7 @@
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="120"
:width="90"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
@ -52,7 +52,8 @@ import {
const tableProps = [
{
prop: 'code',
label: '产线编码'
label: '产线编码',
width: 160,
},
{
prop: 'name',
@ -66,6 +67,11 @@ const tableProps = [
prop: 'externalCode',
label: '额外编码'
},
{
prop: 'pdType',
label: '产线类型',
filter: codeFilter('pdType'),
},
{
prop: 'status',
label: '当前状态',
@ -73,16 +79,19 @@ const tableProps = [
},
{
prop: 'description',
label: '描述'
label: '描述',
showOverflowtooltip: true,
},
{
prop: 'remark',
label: '备注'
label: '备注',
showOverflowtooltip: true,
},
{
prop: 'createTime',
label: '创建时间',
filter: parseTime
filter: parseTime,
width: 160,
},
];

View File

@ -69,7 +69,7 @@ export default {
.post(this.urlOptions.statusUrl, { id })
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg);
return this.$message.warning(res.msg);
}
this.$refs["popover-" + id].showPopper = false;
this.$message({

View File

@ -17,7 +17,11 @@ const table = {
1: '日',
2: '周',
3: '月'
}
},
pdType: {
1: '原片',
0: '深加工',
},
}
// 日期格式化

View File

@ -3,7 +3,7 @@
* @Date: 2023-08-29 14:59:29
* @LastEditTime: 2023-10-16 15:10:42
* @LastEditors: DY
* @Description:
* @Description:
-->
<template>
<div class="app-container">
@ -197,8 +197,7 @@ export default {
type: 'button',
btnName: '导出',
name: 'export',
color: 'primary',
plain: true
color: 'warning',
}
],
};
@ -257,7 +256,7 @@ export default {
this.dialogVisible = false
this.showData = this.tableData
}, 600)
},
exportXlsx() {
this.exportECL()

View File

@ -3,7 +3,7 @@
* @Date: 2023-08-29 14:59:29
* @LastEditTime: 2023-10-16 15:18:23
* @LastEditors: DY
* @Description:
* @Description:
-->
<template>
<div class="app-container">
@ -147,8 +147,7 @@ export default {
type: 'button',
btnName: '导出',
name: 'export',
color: 'primary',
plain: true
color: 'warning',
}
],
};
@ -237,7 +236,7 @@ export default {
this.dialogVisible = false
this.showData = this.tableData
}, 600)
},
exportXlsx() {
this.exportECL()

View File

@ -3,7 +3,7 @@
* @Date: 2023-08-29 14:59:29
* @LastEditTime: 2023-10-16 15:19:04
* @LastEditors: DY
* @Description:
* @Description:
-->
<template>
<div class="app-container">
@ -190,8 +190,7 @@ export default {
type: 'button',
btnName: '导出',
name: 'export',
color: 'primary',
plain: true
color: 'warning',
}
],
};
@ -275,7 +274,7 @@ export default {
this.dialogVisible = false
this.showData = this.tableData
}, 600)
},
exportXlsx() {
this.exportECL()

View File

@ -142,8 +142,7 @@ export default {
type: 'button',
btnName: '导出',
name: 'export',
color: 'primary',
plain: true
color: 'warning',
}
],
};
@ -258,7 +257,7 @@ export default {
this.dialogVisible = false
this.showData = this.tableData
}, 600)
},
exportXlsx() {
this.exportECL()

View File

View File

@ -0,0 +1,142 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zwq
* @LastEditTime: 2024-09-11 15:49:14
* @Description:
-->
<template>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-position="top"
label-width="80px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="日期" prop="recTime">
<el-date-picker
v-model="dataForm.recTime"
type="date"
value-format="timestamp"
:style="{ width: '100%' }"
disabled
placeholder="日期"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="总成本" prop="price">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.price"
disabled
placeholder="总成本" />
()
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="原片下片面积" prop="originArea">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.originArea"
clearable
placeholder="请输入原片下片面积" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="深加工下片面积" prop="deepArea">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.deepArea"
clearable
placeholder="请输入深加工下片面积" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="原片成本" prop="originPrice">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.originPrice"
clearable
placeholder="请输入原片成本" />
()
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="深加工成本" prop="deepPrice">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.deepPrice"
clearable
placeholder="请输入深加工成本" />
()
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import basicAdd from '@/mixins/basic-add';
import { updateCostSum } from '@/api/cost/allCost';
export default {
mixins: [basicAdd],
data() {
return {
urlOptions: {
updateURL: updateCostSum,
},
dataForm: {
id: undefined,
originArea: undefined,
deepArea: undefined,
originPrice: undefined,
deepPrice: undefined,
price: undefined,
},
dataRule: {
},
};
},
methods: {
init(val, statisticType) {
this.visible = true;
this.$nextTick(() => {
this.$refs['dataForm'].resetFields();
this.dataForm = JSON.parse(JSON.stringify(val));
this.dataForm.statisticType = statisticType;
});
},
//
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
return false;
}
const data = {
id: this.dataForm.id,
statisticType: this.dataForm.statisticType,
modifyOriginArea: this.dataForm.originArea,
modifyOriginPrice: this.dataForm.originPrice,
modifyDeepArea: this.dataForm.deepArea,
modifyDeepPrice: this.dataForm.deepPrice,
modifyPrice: this.dataForm.deepPrice + this.dataForm.originPrice,
};
//
this.urlOptions.updateURL(data).then((response) => {
this.$modal.msgSuccess('修改成功');
this.visible = false;
this.$emit('refreshDataList');
});
});
},
},
};
</script>

View File

@ -0,0 +1,400 @@
<template>
<div>
<div style="background: #f2f4f9; height: 40px; width: 100%">
<ButtonNav :menus="['按日期', '按规格']" @change="currentMenu">
<template v-slot:tab1>
<div>按日期</div>
</template>
<template v-slot:tab2>
<div>按规格</div>
</template>
</ButtonNav>
</div>
<div class="app-container energyOverlimitLog">
<div v-show="activeName === 'his'">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
</div>
<div v-show="activeName === 'now'">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig2"
ref="searchBarForm2"
@headBtnClick="buttonClick" />
</div>
<!-- 列表 -->
<div v-if="activeName === 'his'">
<base-table
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-props="tableProps"
:table-data="tableData"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="80"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
</div>
<div v-if="activeName === 'now'">
<base-table
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-props="tableProps2"
:table-data="tableData2"
:max-height="tableH" />
</div>
<pagination
:page.sync="listQuery.pageNo"
:limit.sync="listQuery.pageSize"
:total="listQuery.total"
@pagination="getDataList" />
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="50%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div>
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
import basicPage from '@/mixins/basic-page';
import {
getCostSumPage,
getRawCostStatisticsRealtimePage,
exportRawStatisticsRealtimeExcel,
exportCostSumExcel
} from '@/api/cost/allCost';
import { parseTime } from '@/filter/code-filter';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
import typeRule from './typeRule';
import ButtonNav from '@/components/ButtonNav';
const tableProps = [
{
prop: 'recTime',
label: '日期',
filter: (val) => parseTime(val, '{y}年{m}月{d}日'),
},
{
prop: 'originArea',
label: '原片下片面积',
},
{
prop: 'deepArea',
label: '深加工下片面积',
},
{
prop: 'originPrice',
label: '原片成本/元',
align: 'right',
},
{
prop: 'deepPrice',
label: '深加工成本/元',
align: 'right',
},
{
prop: 'price',
label: '总成本/元',
align: 'right',
},
];
const tableProps2 = [
{
prop: 'bindObjectName',
label: '产品名称',
},
{
prop: 'spec',
label: '规格',
},
{
prop: 'costSum',
label: '原片单片成本/元',
align: 'right',
},
{
prop: 'costPiece',
label: '深加工单片成本/元',
align: 'right',
},
{
prop: 'costPiece',
label: '成品单片成本/元',
align: 'right',
},
{
prop: 'costArea',
label: '每平米成本/元',
align: 'right',
},
];
export default {
name: 'allCost',
mixins: [basicPage, tableHeightMixin],
data() {
return {
urlOptions: {
getDataListURL: getCostSumPage,
},
formConfig: [
{
type: 'select',
label: '维度',
selectOptions: [
{ id: 1, name: '日' },
{ id: 2, name: '周' },
{ id: 3, name: '月' },
],
param: 'statisticType',
defaultSelect: 1, // ,
clearable: false,
},
{
type: 'datePicker',
label: '时间范围',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'searchTime',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
],
formConfig2: [
{
type: 'datePicker',
label: '时间范围',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'searchTime',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
],
listQuery: {
statisticType: 1,
},
activeName: 'his',
tableProps,
tableProps2,
tableBtn: [
{
type: 'edit',
btnName: '编辑',
}
].filter((v) => v),
tableData: [],
tableData2: [],
};
},
components: {
AddOrUpdate,
ButtonNav,
},
created() {
},
methods: {
buttonClick(val) {
if (val.statisticType === 2) {
this.tableProps[0].filter = (val) =>
parseTime(val, '{y}年第{w}周');
}else{
this.tableProps[0].filter = (val) =>
parseTime(val, '{y}年{m}月{d}日');
}
this.formConfig2[0].startPlaceholder = '开始时间';
this.formConfig2[0].endPlaceholder = '结束时间';
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.bindObjectId = val.name || null;
this.listQuery.statisticType = val.statisticType || 1;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59'
: null;
if (this.activeName === 'his') {
this.getDataList();
} else {
this.getDataList2();
}
break;
case 'add':
this.addOrUpdateHandle();
break;
case 'export':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.bindObjectId = val.name || null;
this.listQuery.statisticType = val.statisticType || 1;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59'
: null;
this.handleExport();
break;
default:
console.log(val);
}
},
currentMenu(val) {
this.activeName = val === '按日期' ? 'his' : 'now';
if (this.activeName === 'his') {
this.$refs.searchBarForm.resetForm();
this.listQuery.name = null;
this.listQuery.startTime = null;
this.listQuery.endTime = null;
this.listQuery.statisticType = 1;
this.listQuery.pageNo = 1;
this.getDataList();
} else {
this.$refs.searchBarForm2.resetForm();
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
this.listQuery.startTime = parseTime(start).substr(0, 10) + ' 00:00:00';
this.listQuery.endTime = parseTime(end).substr(0, 10) + ' 23:59:59';
this.formConfig2[0].startPlaceholder = parseTime(start).substr(0, 10);
this.formConfig2[0].endPlaceholder = parseTime(end).substr(0, 10);
this.listQuery.name = null;
this.listQuery.pageNo = 1;
this.getDataList2();
}
},
// 2
getDataList2() {
if (this.listQuery.startTime) {
getRawCostStatisticsRealtimePage(this.listQuery).then((response) => {
this.tableData2 = response.data.list;
this.listQuery.total = response.data.total;
});
} else {
this.$message.warning('请选择时间范围');
}
},
//tableBtn
handleClick(val) {
if (val.type === 'edit') {
this.addOrUpdateVisible = true;
this.addOrEditTitle = '编辑';
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data, this.listQuery.statisticType);
});
} else {
this.otherMethods(val);
}
},
/** 导出按钮操作 */
handleExport() {
let exportURL, title;
if (this.activeName === 'his') {
exportURL = exportCostSumExcel;
title = '总成本统计-按日期';
} else {
exportURL = exportRawStatisticsRealtimeExcel;
title = '总成本统计-按规格';
}
//
let params = { ...this.listQuery };
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal
.confirm('是否确认导出所有数据项?')
.then(() => {
return exportURL(params);
})
.then((response) => {
this.$download.excel(response, title + '报表.xls');
})
.catch(() => {});
},
},
};
</script>
<style lang="scss">
.energyOverlimitLog {
.el-tabs__nav::after {
content: '';
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 2px;
background-color: #e4e7ed;
}
.el-tabs__nav-wrap::after {
width: 0;
}
.el-tabs__item {
padding: 0 10px;
}
.el-tabs__item:hover {
color: rgba(0, 0, 0, 0.85);
}
.el-tabs__item.is-active {
color: rgba(0, 0, 0, 0.85);
}
.el-tabs__item {
color: rgba(0, 0, 0, 0.45);
}
.searchBarBox {
margin-bottom: 0;
}
}
</style>

View File

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

View File

@ -0,0 +1,104 @@
<template>
<div class="app-container">
<base-table
v-loading="dataListLoading"
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:max-height="tableH"
:table-data="tableData">
</base-table>
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" />
</div>
</template>
<script>
import basicPage from '@/mixins/basic-page';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
import { parseTime } from '@/filter/code-filter';
import {
deleteRawOthercostLog,
getRawOthercostLogPage,
exportRawOthercostLogExcel,
} from '@/api/cost/costOthercostLog';
import { getRawOthercostRulePage } from '@/api/cost/rawOthercostRule';
const tableProps = [
{
prop: 'otherCostName',
label: '成本名称',
},
{
prop: 'recTime',
label: '日期',
filter: (val) => parseTime(val, '{y}年{m}月{d}日'),
},
{
prop: 'price',
label: '成本金额',
align: 'right',
},
{
prop: 'remark',
label: '备注',
},
];
export default {
mixins: [basicPage, tableHeightMixin],
data() {
return {
urlOptions: {
getDataListURL: getRawOthercostLogPage,
deleteURL: deleteRawOthercostLog,
exportURL: exportRawOthercostLogExcel,
},
tableProps,
tableData: [],
};
},
components: {
},
created() {
const params = {
pageNo: 1,
pageSize: 100,
};
getRawOthercostRulePage(params).then((response) => {
this.formConfig[0].selectOptions = response.data.list;
});
},
methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.name = val.name||null;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59'
: null;
this.getDataList();
break;
case 'add':
this.addOrUpdateHandle();
break;
case 'export':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.name = val.name;
this.listQuery.recTime = val.searchTime;
this.handleExport();
break;
default:
console.log(val);
}
},
},
};
</script>

View File

@ -0,0 +1,114 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zwq
* @LastEditTime: 2024-09-05 15:34:49
* @Description:
-->
<template>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-position="top"
label-width="80px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="能源类型" prop="energyTypeName">
<el-input
v-model="dataForm.energyTypeName"
disabled
placeholder="请输入能源类型" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="日期" prop="recTime">
<el-date-picker
v-model="dataForm.recTime"
type="date"
value-format="timestamp"
:style="{ width: '100%' }"
readonly
placeholder="选择日期"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="总价" prop="price">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.price"
clearable
placeholder="请输入总价" />
()
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="累计用量" prop="quantity">
<el-input-number
:min="0"
style="width: 100%"
v-model="dataForm.quantity"
clearable
placeholder="请输入累计用量" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import basicAdd from '@/mixins/basic-add';
import { updateEnergyHis } from '@/api/cost/costEnergyDeep';
export default {
mixins: [basicAdd],
data() {
return {
urlOptions: {
updateURL: updateEnergyHis,
},
dataForm: {
id: undefined,
price: undefined,
quantity: undefined,
energyTypeName: undefined,
recTime: undefined,
},
dataRule: {
price: [{ required: true, message: '总价不能为空', trigger: 'blur' }],
quantity: [
{ required: true, message: '累计用量不能为空', trigger: 'blur' },
],
},
};
},
methods: {
init(val, statisticType) {
this.visible = true;
this.$nextTick(() => {
this.$refs['dataForm'].resetFields();
this.dataForm = JSON.parse(JSON.stringify(val));
this.dataForm.statisticType = statisticType;
});
},
//
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
return false;
}
this.dataForm.modifyPrice = this.dataForm.price;
this.dataForm.modifyQuantity = this.dataForm.quantity;
//
this.urlOptions.updateURL(this.dataForm).then((response) => {
this.$modal.msgSuccess('修改成功');
this.visible = false;
this.$emit('refreshDataList');
});
});
},
},
};
</script>

View File

@ -0,0 +1,418 @@
<template>
<div>
<div style="background: #f2f4f9; height: 40px; width: 100%">
<ButtonNav :menus="['历史成本', '成本查询']" @change="currentMenu">
<template v-slot:tab1>
<div>历史成本</div>
</template>
<template v-slot:tab2>
<div>成本查询</div>
</template>
</ButtonNav>
</div>
<div class="app-container energyOverlimitLog">
<div v-show="activeName === 'his'">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
</div>
<div v-show="activeName === 'now'">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig2"
ref="searchBarForm2"
@headBtnClick="buttonClick" />
</div>
<!-- 列表 -->
<div v-if="activeName === 'his'">
<base-table
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-props="tableProps"
:table-data="tableData"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="80"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
</div>
<div v-if="activeName === 'now'">
<base-table
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-props="tableProps2"
:table-data="tableData2"
:max-height="tableH" />
</div>
<pagination
:page.sync="listQuery.pageNo"
:limit.sync="listQuery.pageSize"
:total="listQuery.total"
@pagination="getDataList" />
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="50%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div>
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
import basicPage from '@/mixins/basic-page';
import { getEnergyTypePage } from '@/api/base/energyType';
import {
getEnergyHisPage,
getEnergyRealtimePage,
exportEnergyRealtimeExcel,
exportEnergyHisExcel,
} from '@/api/cost/costEnergyDeep';
import { parseTime } from '@/filter/code-filter';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
import ButtonNav from '@/components/ButtonNav';
const tableProps = [
{
prop: 'recTime',
label: '日期',
filter: (val) => parseTime(val, '{y}年{m}月{d}日'),
},
{
prop: 'energyTypeName',
label: '能源类型',
},
{
prop: 'bindObjectName',
label: '监控对象',
filter: (val) => (val != null ? val : '--'),
},
{
prop: 'meterName',
label: '抄表名',
filter: (val) => (val != null ? val : '--'),
},
{
prop: 'quantity',
label: '累计使用量',
},
{
prop: 'price',
label: '总价(元)',
align: 'right',
},
];
const tableProps2 = [
{
prop: 'energyTypeName',
label: '能源类型',
},
{
prop: 'bindObjectName',
label: '监控对象',
filter: (val) => (val != null ? val : '--'),
},
{
prop: 'meter',
label: '抄表名',
filter: (val) => (val != null ? val : '--'),
},
{
prop: 'quantity',
label: '累计使用量',
},
{
prop: 'price',
label: '总价(元)',
align: 'right',
},
];
export default {
name: 'costEnergy',
mixins: [basicPage, tableHeightMixin],
data() {
return {
urlOptions: {
getDataListURL: getEnergyHisPage,
},
formConfig: [
{
type: 'select',
label: '维度',
selectOptions: [
{ id: 1, name: '日' },
{ id: 2, name: '周' },
{ id: 3, name: '月' },
],
param: 'statisticType',
defaultSelect: 1, // ,
clearable: false,
},
{
type: 'select',
label: '能源类型',
selectOptions: [],
param: 'name',
labelField: 'name',
filterable: true,
},
{
type: 'datePicker',
label: '时间范围',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'searchTime',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
],
formConfig2: [
{
type: 'select',
label: '能源类型',
selectOptions: [],
param: 'name',
labelField: 'name',
filterable: true,
},
{
type: 'datePicker',
label: '时间范围',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'searchTime',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
],
listQuery: {
statisticType: 1,
},
activeName: 'his',
tableProps,
tableProps2,
tableBtn: [{
type: 'edit',
btnName: '编辑',
}
].filter((v) => v),
tableData: [],
tableData2: [],
};
},
components: {
AddOrUpdate,
ButtonNav,
},
created() {
const params = {
pageNo: 1,
pageSize: 100,
};
getEnergyTypePage(params).then((response) => {
this.formConfig[1].selectOptions = response.data.list;
this.formConfig2[0].selectOptions = response.data.list;
});
},
methods: {
buttonClick(val) {
if (val.statisticType === 2) {
this.tableProps[0].filter = (val) =>
parseTime(val, '{y}年第{w}周');
}else{
this.tableProps[0].filter = (val) =>
parseTime(val, '{y}年{m}月{d}日');
}
this.formConfig2[1].startPlaceholder = '开始时间';
this.formConfig2[1].endPlaceholder = '结束时间';
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.energyTypeId = val.name || null;
this.listQuery.statisticType = val.statisticType || 1;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59'
: null;
if (this.activeName === 'his') {
this.getDataList();
} else {
this.getDataList2();
}
break;
case 'add':
this.addOrUpdateHandle();
break;
case 'export':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.energyTypeId = val.name || null;
this.listQuery.statisticType = val.statisticType || 1;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59'
: null;
this.handleExport();
break;
default:
console.log(val);
}
},
currentMenu(val) {
this.activeName = val === '历史成本' ? 'his' : 'now';
if (this.activeName === 'his') {
this.$refs.searchBarForm.resetForm();
this.listQuery.name = null;
this.listQuery.startTime = null;
this.listQuery.endTime = null;
this.listQuery.statisticType = 1;
this.listQuery.pageNo = 1;
this.getDataList();
} else {
this.$refs.searchBarForm2.resetForm();
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
this.listQuery.startTime = parseTime(start).substr(0, 10) + ' 00:00:00';
this.listQuery.endTime = parseTime(end).substr(0, 10) + ' 23:59:59';
this.formConfig2[1].startPlaceholder = parseTime(start).substr(0, 10);
this.formConfig2[1].endPlaceholder = parseTime(end).substr(0, 10);
this.listQuery.name = null;
this.listQuery.pageNo = 1;
this.getDataList2();
}
},
// 2
getDataList2() {
if (this.listQuery.startTime) {
getEnergyRealtimePage(this.listQuery).then((response) => {
this.tableData2 = response.data.list;
this.listQuery.total = response.data.total;
});
} else {
this.$message.warning('请选择时间范围');
}
},
//tableBtn
handleClick(val) {
if (val.type === 'edit') {
this.addOrUpdateVisible = true;
this.addOrEditTitle = '编辑';
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data, this.listQuery.statisticType);
});
} else {
this.otherMethods(val);
}
},
/** 导出按钮操作 */
handleExport() {
let exportURL, title;
if (this.activeName === 'his') {
exportURL = exportEnergyHisExcel;
title = '深加工能源成本-历史成本';
} else {
exportURL = exportEnergyRealtimeExcel;
title = '深加工能源成本-成本查询';
}
//
let params = { ...this.listQuery };
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal
.confirm('是否确认导出所有数据项?')
.then(() => {
return exportURL(params);
})
.then((response) => {
this.$download.excel(response, title + '报表.xls');
})
.catch(() => {});
},
},
};
</script>
<style lang="scss">
.energyOverlimitLog {
.el-tabs__nav::after {
content: '';
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 2px;
background-color: #e4e7ed;
}
.el-tabs__nav-wrap::after {
width: 0;
}
.el-tabs__item {
padding: 0 10px;
}
.el-tabs__item:hover {
color: rgba(0, 0, 0, 0.85);
}
.el-tabs__item.is-active {
color: rgba(0, 0, 0, 0.85);
}
.el-tabs__item {
color: rgba(0, 0, 0, 0.45);
}
.searchBarBox {
margin-bottom: 0;
}
}
</style>

View File

@ -0,0 +1,115 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zwq
* @LastEditTime: 2024-09-05 15:36:49
* @Description:
-->
<template>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-width="80px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="成本名称" prop="name">
<el-select
v-model="dataForm.name"
disabled
:style="{ width: '100%' }"
placeholder="请选择成本名称">
<el-option
v-for="item in nameArr"
:key="item.name"
:label="item.label"
:value="item.name"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="总价" prop="price">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.price"
clearable
placeholder="请输入总价" />
()
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="所属日期" prop="recTime">
<el-date-picker
v-model="dataForm.recTime"
type="date"
value-format="timestamp"
:style="{ width: '100%' }"
disabled
placeholder="选择所属日期"></el-date-picker>
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import basicAdd from '@/mixins/basic-add';
import {
updateRawOthercostHis,
} from '@/api/cost/costOthercostHisDeep';
export default {
mixins: [basicAdd],
props: {
nameArr: {
type: Array,
default: () => [],
},
},
data() {
return {
urlOptions: {
updateURL: updateRawOthercostHis,
},
dataForm: {
id: undefined,
price: undefined,
name: undefined,
recTime: undefined,
},
dataRule: {
price: [
{ required: true, message: '总价不能为空', trigger: 'blur' },
],
},
};
},
methods: {
init(val,statisticType) {
this.visible = true;
this.$nextTick(() => {
this.$refs["dataForm"].resetFields();
this.dataForm = JSON.parse(JSON.stringify(val))
this.dataForm.statisticType = statisticType
});
},
//
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
return false;
}
this.dataForm.modifyPrice = this.dataForm.price
//
this.urlOptions.updateURL(this.dataForm).then((response) => {
this.$modal.msgSuccess('修改成功');
this.visible = false;
this.$emit('refreshDataList');
});
});
},
},
};
</script>

View File

@ -0,0 +1,389 @@
<template>
<div>
<div style="background: #f2f4f9; height: 40px; width: 100%">
<ButtonNav :menus="['历史成本', '成本查询']" @change="currentMenu">
<template v-slot:tab1>
<div>历史成本</div>
</template>
<template v-slot:tab2>
<div>成本查询</div>
</template>
</ButtonNav>
</div>
<div class="app-container energyOverlimitLog">
<div v-show="activeName === 'his'">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
</div>
<div v-show="activeName === 'now'">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig2"
ref="searchBarForm2"
@headBtnClick="buttonClick" />
</div>
<!-- 列表 -->
<div v-if="activeName === 'his'">
<base-table
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-props="tableProps"
:table-data="tableData"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="80"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
</div>
<div v-if="activeName === 'now'">
<base-table
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-props="tableProps2"
:table-data="tableData2"
:max-height="tableH" />
</div>
<pagination
:page.sync="listQuery.pageNo"
:limit.sync="listQuery.pageSize"
:total="listQuery.total"
@pagination="getDataList" />
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="50%">
<add-or-update
ref="addOrUpdate"
:name-arr="formConfig[1].selectOptions"
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div>
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
import basicPage from '@/mixins/basic-page';
import { getRawOthercostRulePage } from '@/api/cost/deepOthercostRule';
import {
getRawOthercostHisPage,
getRawOthercostSunPage,
exportRawOthercostSunExcel,
exportRawOthercostHisExcel
} from '@/api/cost/costOthercostHisDeep';
import { parseTime } from '@/filter/code-filter';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
import ButtonNav from '@/components/ButtonNav';
const tableProps = [
{
prop: 'recTime',
label: '日期',
filter: (val) => parseTime(val, '{y}年{m}月{d}日'),
},
{
prop: 'otherCostName',
label: '成本名称',
},
{
prop: 'price',
label: '总价(元)',
align: 'right',
},
];
const tableProps2 = [
{
prop: 'otherCostName',
label: '成本名称',
},
{
prop: 'price',
label: '总价(元)',
align: 'right',
},
];
export default {
name: 'costOthercostHis',
mixins: [basicPage, tableHeightMixin],
data() {
return {
urlOptions: {
getDataListURL: getRawOthercostHisPage,
},
formConfig: [
{
type: 'select',
label: '维度',
selectOptions: [
{ id: 1, name: '日' },
{ id: 2, name: '周' },
{ id: 3, name: '月' },
],
param: 'statisticType',
defaultSelect: 1, // ,
clearable: false,
},
{
type: 'select',
label: '成本名称',
selectOptions: [],
param: 'name',
labelField: 'label',
valueField: 'name',
filterable: true,
},
{
type: 'datePicker',
label: '时间范围',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'searchTime',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
],
formConfig2: [
{
type: 'select',
label: '成本名称',
selectOptions: [],
param: 'name',
labelField: 'label',
valueField: 'name',
filterable: true,
},
{
type: 'datePicker',
label: '时间范围',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'searchTime',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
],
listQuery: {
statisticType: 1,
},
activeName: 'his',
tableProps,
tableProps2,
tableBtn: [{
type: 'edit',
btnName: '编辑',
}
].filter((v) => v),
tableData: [],
tableData2: [],
};
},
components: {
AddOrUpdate,
ButtonNav,
},
created() {
const params = {
pageNo: 1,
pageSize: 100,
};
getRawOthercostRulePage(params).then((response) => {
this.formConfig[1].selectOptions = response.data.list;
this.formConfig2[0].selectOptions = response.data.list;
});
},
methods: {
buttonClick(val) {
if (val.statisticType === 2) {
this.tableProps[0].filter = (val) =>
parseTime(val, '{y}年第{w}周');
}else{
this.tableProps[0].filter = (val) =>
parseTime(val, '{y}年{m}月{d}日');
}
this.formConfig2[1].startPlaceholder = '开始时间';
this.formConfig2[1].endPlaceholder = '结束时间';
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.name = val.name || null;
this.listQuery.statisticType = val.statisticType || 1;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59'
: null;
if (this.activeName === 'his') {
this.getDataList();
} else {
this.getDataList2();
}
break;
case 'add':
this.addOrUpdateHandle();
break;
case 'export':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.name = val.name || null;
this.listQuery.statisticType = val.statisticType || 1;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59'
: null;
this.handleExport();
break;
default:
console.log(val);
}
},
currentMenu(val) {
this.activeName = val === '历史成本' ? 'his' : 'now';
if (this.activeName === 'his') {
this.$refs.searchBarForm.resetForm();
this.listQuery.name = null;
this.listQuery.startTime = null;
this.listQuery.endTime = null;
this.listQuery.statisticType = 1;
this.listQuery.pageNo = 1;
this.getDataList();
} else {
this.$refs.searchBarForm2.resetForm();
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
this.listQuery.startTime = parseTime(start).substr(0, 10) + ' 00:00:00';
this.listQuery.endTime = parseTime(end).substr(0, 10) + ' 23:59:59';
this.formConfig2[1].startPlaceholder = parseTime(start).substr(0, 10);
this.formConfig2[1].endPlaceholder = parseTime(end).substr(0, 10);
this.listQuery.name = null;
this.listQuery.pageNo = 1;
this.getDataList2();
}
},
// 2
getDataList2() {
getRawOthercostSunPage(this.listQuery).then((response) => {
this.tableData2 = response.data.list;
this.listQuery.total = response.data.total;
});
},
//tableBtn
handleClick(val) {
if (val.type === 'edit') {
this.addOrUpdateVisible = true;
this.addOrEditTitle = '编辑';
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data, this.listQuery.statisticType);
});
} else {
this.otherMethods(val);
}
},
/** 导出按钮操作 */
handleExport() {
let exportURL, title;
if (this.activeName === 'his') {
exportURL = exportRawOthercostHisExcel;
title = '深加工其它成本-历史成本';
} else {
exportURL = exportRawOthercostSunExcel;
title = '深加工其它成本-成本查询';
}
//
let params = { ...this.listQuery };
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal
.confirm('是否确认导出所有数据项?')
.then(() => {
return exportURL(params);
})
.then((response) => {
this.$download.excel(response, title + '报表.xls');
})
.catch(() => {});
},
},
};
</script>
<style lang="scss">
.energyOverlimitLog {
.el-tabs__nav::after {
content: '';
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 2px;
background-color: #e4e7ed;
}
.el-tabs__nav-wrap::after {
width: 0;
}
.el-tabs__item {
padding: 0 10px;
}
.el-tabs__item:hover {
color: rgba(0, 0, 0, 0.85);
}
.el-tabs__item.is-active {
color: rgba(0, 0, 0, 0.85);
}
.el-tabs__item {
color: rgba(0, 0, 0, 0.45);
}
.searchBarBox {
margin-bottom: 0;
}
}
</style>

View File

@ -0,0 +1,124 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zwq
* @LastEditTime: 2024-09-05 15:35:07
* @Description:
-->
<template>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-position="top"
label-width="80px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="成本名称" prop="name">
<el-select
v-model="dataForm.name"
filterable
clearable
:style="{ width: '100%' }"
@change="setLabel"
placeholder="请选择成本名称">
<el-option
v-for="item in nameArr"
:key="item.name"
:label="item.label"
:value="item.name"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="成本金额" prop="price">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.price"
clearable
placeholder="请输入成本金额" />
()
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="所属日期" prop="recTime">
<el-date-picker
v-model="dataForm.recTime"
type="date"
value-format="timestamp"
:style="{ width: '100%' }"
placeholder="选择所属日期"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="备注" prop="remark">
<el-input
v-model="dataForm.remark"
clearable
placeholder="请输入备注" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import basicAdd from '@/mixins/basic-add';
import {
createRawOthercostLog,
updateRawOthercostLog,
getRawOthercostLog,
} from '@/api/cost/costOthercostLogDeep';
import moment from 'moment';
const nowData = moment().format('YYYY-MM-DD').valueOf()
export default {
mixins: [basicAdd],
props: {
nameArr: {
type: Array,
default: () => [],
},
},
data() {
return {
urlOptions: {
createURL: createRawOthercostLog,
updateURL: updateRawOthercostLog,
infoURL: getRawOthercostLog,
},
dataForm: {
id: undefined,
price: undefined,
name: undefined,
recTime: new Date().getTime(),
remark: undefined,
},
dataRule: {
price: [
{ required: true, message: '成本金额不能为空', trigger: 'blur' },
],
name: [
{ required: true, message: ' 成本名称不能为空', trigger: 'blur' },
],
recTime: [
{
required: true,
message: '所属日期不能为空',
trigger: 'change',
},
],
},
};
},
methods: {
setLabel(val){
this.dataForm.label = this.nameArr.find(item=>item.name===val).label
}
},
};
</script>

View File

@ -0,0 +1,223 @@
<template>
<div class="app-container">
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<base-table
v-loading="dataListLoading"
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:max-height="tableH"
:table-data="tableData">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="120"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" />
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="50%">
<add-or-update
ref="addOrUpdate"
:name-arr="formConfig[0].selectOptions"
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
import basicPage from '@/mixins/basic-page';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
import { parseTime } from '@/filter/code-filter';
import {
deleteRawOthercostLog,
getRawOthercostLogPage,
exportRawOthercostLogExcel,
} from '@/api/cost/costOthercostLogDeep';
import { getRawOthercostRulePage } from '@/api/cost/deepOthercostRule';
const tableProps = [
{
prop: 'otherCostName',
label: '成本名称',
},
{
prop: 'recTime',
label: '日期',
filter: (val) => parseTime(val, '{y}年{m}月{d}日'),
},
{
prop: 'price',
label: '成本金额',
align: 'right',
},
{
prop: 'remark',
label: '备注',
},
];
export default {
mixins: [basicPage, tableHeightMixin],
data() {
return {
urlOptions: {
getDataListURL: getRawOthercostLogPage,
deleteURL: deleteRawOthercostLog,
exportURL: exportRawOthercostLogExcel,
},
tableProps,
tableBtn: [{
type: 'edit',
btnName: '编辑',
},{
type: 'delete',
btnName: '删除',
}
].filter((v) => v),
tableData: [],
formConfig: [
{
type: 'select',
label: '成本名称',
selectOptions: [],
param: 'name',
labelField: 'label',
valueField: 'name',
filterable: true,
},
{
type: 'datePicker',
label: '时间范围',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'searchTime',
},
{
type: 'button',
btnName: '搜索',
name: 'search',
color: 'primary',
},
{
type: this.$auth.hasPermi('monitoring:cost-deep-othercost-log:create')
? 'separate'
: '',
},
{
type: this.$auth.hasPermi('monitoring:cost-deep-othercost-log:create')
? 'button'
: '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true,
},
// {
// type: this.$auth.hasPermi('monitoring:cost-othercost-log:create') ? 'separate' : '',
// },
{
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
],
};
},
components: {
AddOrUpdate,
},
created() {
const params = {
pageNo: 1,
pageSize: 100,
};
getRawOthercostRulePage(params).then((response) => {
this.formConfig[0].selectOptions = response.data.list;
});
},
methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.name = val.name||null;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59'
: null;
this.getDataList();
break;
case 'add':
this.addOrUpdateHandle();
break;
case 'export':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.name = val.name||null;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59'
: null;
this.handleExport();
break;
default:
console.log(val);
}
},
//tableBtn
handleClick(val) {
if (val.type === "edit") {
this.addOrUpdateVisible = true;
this.addOrEditTitle = "编辑";
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data.id);
});
} else if (val.type === "delete") {
this.deleteHandle(val.data.id, val.data.otherCostName, val.data._pageIndex)
} else {
this.otherMethods(val)
}
},
/** 导出按钮操作 */
handleExport() {
let title;
title = '深加工其它成本-成本记录';
//
let params = { ...this.listQuery };
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal
.confirm('是否确认导出所有数据项?')
.then(() => {
return this.urlOptions.exportURL(params);
})
.then((response) => {
this.$download.excel(response, title + '报表.xls');
})
.catch(() => {});
},
},
};
</script>

View File

@ -0,0 +1,159 @@
<!--
* @Author: zwq
* @Date: 2023-08-01 13:52:10
* @LastEditors: zwq
* @LastEditTime: 2024-09-03 14:52:51
* @Description:
-->
<template>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
v-if="visible"
@keyup.enter.native="dataFormSubmit()"
label-width="100px"
label-position="top">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="成本名称" prop="label">
<el-input v-model="dataForm.label" clearable disabled />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="自动计算策略" prop="type">
<el-radio-group v-model="dataForm.type" @input="setType">
<el-radio :label="1">每天等价</el-radio>
<el-radio :label="2">折旧</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="12" v-if="dataForm.type === 1" key="one">
<el-form-item label="价格" prop="price">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.price"
clearable />
()
</el-form-item>
</el-col>
<el-col :span="12" v-if="dataForm.type === 2" key="two">
<el-form-item label="总价" prop="price">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.price"
clearable />
()
</el-form-item>
</el-col>
<el-col :span="12" v-if="dataForm.type === 2" key="three">
<el-form-item label="年折旧率" prop="ratio">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.ratio"
clearable />
(%)
</el-form-item>
</el-col>
<el-col :span="12" v-if="dataForm.type === 2" key="four">
<el-form-item label="折旧年限" prop="timeLimit">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.timeLimit"
clearable />
()
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="备注" prop="remark">
<el-input
@input="$forceUpdate()"
v-model="dataForm.remark"
clearable
placeholder="请输入备注" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import {
updateRawOthercostRule,
getRawOthercostRule,
} from '@/api/cost/deepOthercostRule';
export default {
data() {
return {
urlOptions: {
updateURL: updateRawOthercostRule,
infoURL: getRawOthercostRule,
},
dataForm: {
label: undefined,
type: 1,
price: 0,
ratio: 0,
timeLimit: 1,
remark: '',
},
visible: false,
dataRule: {
price: [{ required: true, message: '价格不能为空', trigger: 'blur' }],
ratio: [{ required: true, message: '折旧率不能为空', trigger: 'blur' }],
timeLimit: [
{ required: true, message: '折旧年限不能为空', trigger: 'blur' },
],
},
};
},
created() {},
methods: {
init(val) {
this.dataForm = {
label: undefined,
type: 1,
price: 0,
ratio: 0,
timeLimit: 1,
remark: '',
};
this.visible = true;
this.$nextTick(() => {
this.$refs['dataForm'].resetFields();
this.dataForm = JSON.parse(JSON.stringify(val));
});
},
setType(val) {
if (val === 1) {
} else {
}
},
//
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
return false;
}
//
this.urlOptions.updateURL(this.dataForm).then((response) => {
this.$modal.msgSuccess('修改成功');
this.visible = false;
this.$emit('refreshDataList');
});
});
},
/** 清空form */
formClear() {
if (this.$refs.dataForm !== undefined) {
this.$refs.dataForm.resetFields();
}
},
},
};
</script>

View File

@ -0,0 +1,106 @@
<!--
* @Author: zwq
* @Date: 2024-04-15 16:52:38
* @LastEditors: zwq
* @LastEditTime: 2024-09-11 15:30:41
* @Description:
-->
<template>
<div class="app-container">
<!-- 列表 -->
<base-table
v-loading="dataListLoading"
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:max-height="tableH"
:table-data="tableData">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="80"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" />
<!-- 对话框(添加 / 修改) -->
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="40%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
import basicPage from '@/mixins/basic-page';
import typeRule from './typeRule';
import {
getRawOthercostRulePage,
} from '@/api/cost/deepOthercostRule';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
const tableProps = [
{
prop: 'label',
label: '成本名称',
},
{
prop: 'type',
label: '自动计算方式',
subcomponent: typeRule,
},
{
prop: 'remark',
label: '备注',
},
];
export default {
mixins: [basicPage,tableHeightMixin],
data() {
return {
urlOptions: {
getDataListURL: getRawOthercostRulePage,
},
tableProps,
tableBtn: [{
type: 'edit',
btnName: '编辑',
}
].filter((v) => v),
tableData: [],
};
},
components: {
AddOrUpdate,
},
created() {
},
methods: {
//tableBtn
handleClick(val) {
if (val.type === "edit") {
this.addOrUpdateVisible = true;
this.addOrEditTitle = "编辑";
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data);
});
}
},
},
};
</script>

View File

@ -0,0 +1,31 @@
<!--
* @Author: zwq
* @Date: 2023-12-05 13:45:59
* @LastEditors: zwq
* @LastEditTime: 2024-04-15 17:12:03
* @Description
-->
<template>
<div>
<span>
{{
injectData.type == 1
? `每天等价,${injectData.price}`
: injectData.type == 2
? `总价${injectData.price}元,年折旧率${injectData.ratio}%,折旧年限${injectData.timeLimit}`
: '-'
}}
</span>
</div>
</template>
<script>
export default {
name: '',
props: {
injectData: {
type: Object,
default: () => ({}),
},
},
};
</script>

View File

@ -0,0 +1,132 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zwq
* @LastEditTime: 2024-09-05 15:35:29
* @Description:
-->
<template>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-position="top"
label-width="80px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="产线" prop="productionLineName">
<el-input
style="width: 100%"
v-model="dataForm.productionLineName"
disabled />
</el-form-item>
</el-col>
<el-col :span="12" v-if="activeName==='now'">
<el-form-item label="工段" prop="workshopSectionName">
<el-input
style="width: 100%"
v-model="dataForm.workshopSectionName"
readonly />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="activeName==='his'?'上片数量':'进片数量'" prop="innum">
<el-input-number
:min="0"
style="width: 90%"
v-model="dataForm.innum"
clearable
placeholder="请输入数量" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="activeName==='his'?'下片数量':'出片数量'" prop="outnum">
<el-input-number
:min="0"
style="width: 90%"
v-model="dataForm.outnum"
clearable
placeholder="请输入数量" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="良品率" prop="ratio">
<el-input-number
:min="0"
style="width: 90%"
v-model="dataForm.ratio"
clearable
placeholder="请输入良品率" />
(%)
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import basicAdd from '@/mixins/basic-add';
import { updateDeepRatioHis } from '@/api/cost/costDeepRatioHis';
export default {
mixins: [basicAdd],
props: {
nameArr: {
type: Array,
default: () => [],
},
},
data() {
return {
urlOptions: {
updateURL: updateDeepRatioHis,
},
dataForm: {
id: undefined,
productionLineName: undefined,
innum: undefined,
outnum: undefined,
ratio: undefined,
},
dataRule: {},
activeName: 'his'
};
},
methods: {
init(val, statisticType, activeName) {
this.activeName = activeName
this.visible = true;
this.$nextTick(() => {
this.$refs['dataForm'].resetFields();
this.dataForm = JSON.parse(JSON.stringify(val));
this.dataForm.statisticType = statisticType;
this.dataForm.ratio =
this.dataForm.ratio >= 0 ? this.dataForm.ratio * 100 : '';
});
},
//
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
return false;
}
const udata = {
id: this.dataForm.id,
statisticType: this.dataForm.statisticType,
modifyInnum: this.dataForm.innum,
modifyOutnum: this.dataForm.outnum,
modifyRatio:
this.dataForm.ratio >= 0 ? this.dataForm.ratio / 100 : '',
};
//
this.urlOptions.updateURL(udata).then((response) => {
this.$modal.msgSuccess('修改成功');
this.visible = false;
this.$emit('refreshDataList');
});
});
},
},
};
</script>

View File

@ -0,0 +1,380 @@
<template>
<div>
<div style="background: #f2f4f9; height: 40px; width: 100%">
<ButtonNav :menus="['产线良品率', '工段良品率']" @change="currentMenu">
<template v-slot:tab1>
<div>产线良品率</div>
</template>
<template v-slot:tab2>
<div>工段良品率</div>
</template>
</ButtonNav>
</div>
<div class="app-container energyOverlimitLog">
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<!-- 列表 -->
<div v-if="activeName === 'his'">
<base-table
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-props="tableProps"
:table-data="tableData"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="80"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
</div>
<div v-if="activeName === 'now'">
<base-table
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-props="tableProps2"
:table-data="tableData2"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="80"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
</div>
<pagination
:page.sync="listQuery.pageNo"
:limit.sync="listQuery.pageSize"
:total="listQuery.total"
@pagination="getDataList" />
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="50%">
<add-or-update
ref="addOrUpdate"
:name-arr="formConfig[1].selectOptions"
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div>
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
import basicPage from '@/mixins/basic-page';
import { getLinePage } from '@/api/base/productionLine';
import {
getDeepPDRatioHisPage,
getDeepWSRatioHisPage,
exportDeepWSRatioHisExcel,
exportDeepPDRatioHisExcel,
} from '@/api/cost/costDeepRatioHis';
import { parseTime } from '@/filter/code-filter';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
import ButtonNav from '@/components/ButtonNav';
const tableProps = [
{
prop: 'recTime',
label: '日期',
filter: (val) => parseTime(val, '{y}年{m}月{d}日'),
},
{
prop: 'productionLineName',
label: '产线',
},
{
prop: 'spec',
label: '规格',
},
{
prop: 'innum',
label: '上片数量',
},
{
prop: 'outnum',
label: '下片数量',
},
{
prop: 'ratio',
label: '良品率',
filter: (val) => (val ? val * 100 + '%' : '-'),
},
];
const tableProps2 = [
{
prop: 'recTime',
label: '日期',
filter: (val) => parseTime(val, '{y}年{m}月{d}日'),
},
{
prop: 'productionLineName',
label: '产线',
},
{
prop: 'workshopSectionName',
label: '工段',
},
{
prop: 'innum',
label: '进片数量',
},
{
prop: 'outnum',
label: '出片数量',
},
{
prop: 'ratio',
label: '良品率',
filter: (val) => (val ? val * 100 + '%' : '-'),
},
];
export default {
name: 'costDeepRatioHis',
mixins: [basicPage, tableHeightMixin],
data() {
return {
urlOptions: {
getDataListURL: getDeepPDRatioHisPage,
},
formConfig: [
{
type: 'select',
label: '维度',
selectOptions: [
{ id: 1, name: '日' },
{ id: 2, name: '周' },
{ id: 3, name: '月' },
],
param: 'statisticType',
defaultSelect: 1, // ,
clearable: false,
},
{
type: 'select',
label: '产线',
selectOptions: [],
param: 'name',
filterable: true,
},
{
type: 'datePicker',
label: '时间范围',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'searchTime',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
],
listQuery: {
statisticType: 1,
},
activeName: 'his',
tableProps,
tableProps2,
tableBtn: [{
type: 'edit',
btnName: '编辑',
}
].filter((v) => v),
tableData: [],
tableData2: [],
};
},
components: {
AddOrUpdate,
ButtonNav,
},
created() {
const params ={
pageNo: 1,
pageSize: 100,
pdType: 0
}
getLinePage(params).then((response) => {
this.formConfig[1].selectOptions = response.data.list;
});
},
methods: {
buttonClick(val) {
if (val.statisticType === 2) {
this.tableProps[0].filter = (val) =>
parseTime(val, '{y}年第{w}周');
}else{
this.tableProps[0].filter = (val) =>
parseTime(val, '{y}年{m}月{d}日');
}
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.productionLineId = val.name || null;
this.listQuery.statisticType = val.statisticType || 1;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59'
: null;
if (this.activeName === 'his') {
this.getDataList();
} else {
this.getDataList2();
}
break;
case 'add':
this.addOrUpdateHandle();
break;
case 'export':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.productionLineId = val.name || null;
this.listQuery.statisticType = val.statisticType || 1;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59'
: null;
this.handleExport();
break;
default:
console.log(val);
}
},
currentMenu(val) {
this.activeName = val === '产线良品率' ? 'his' : 'now';
if (this.activeName === 'his') {
this.$refs.searchBarForm.resetForm();
this.listQuery.productionLineId = null;
this.listQuery.startTime = null;
this.listQuery.endTime = null;
this.listQuery.statisticType = 1;
this.listQuery.pageNo = 1;
this.getDataList();
} else {
this.$refs.searchBarForm.resetForm();
this.listQuery.productionLineId = null;
this.listQuery.startTime = null;
this.listQuery.endTime = null;
this.listQuery.statisticType = 1;
this.listQuery.pageNo = 1;
this.getDataList2();
}
},
// 2
getDataList2() {
getDeepWSRatioHisPage(this.listQuery).then((response) => {
this.tableData2 = response.data.list;
this.listQuery.total = response.data.total;
});
},
//tableBtn
handleClick(val) {
if (val.type === 'edit') {
this.addOrUpdateVisible = true;
this.addOrEditTitle = '编辑';
this.$nextTick(() => {
this.$refs.addOrUpdate.init(
val.data,
this.listQuery.statisticType,
this.activeName
);
});
} else {
this.otherMethods(val);
}
},
successSubmit() {
this.handleCancel();
const val = this.activeName === 'his' ? '产线良品率' : 'now';
this.currentMenu(val);
},
/** 导出按钮操作 */
handleExport() {
let exportURL, title;
if (this.activeName === 'his') {
exportURL = exportDeepPDRatioHisExcel;
title = '深加工-产线良品率';
} else {
exportURL = exportDeepWSRatioHisExcel;
title = '深加工-工段良品率';
}
//
let params = { ...this.listQuery };
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal
.confirm('是否确认导出所有数据项?')
.then(() => {
return exportURL(params);
})
.then((response) => {
this.$download.excel(response, title + '报表.xls');
})
.catch(() => {});
},
},
};
</script>
<style lang="scss">
.energyOverlimitLog {
.el-tabs__nav::after {
content: '';
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 2px;
background-color: #e4e7ed;
}
.el-tabs__nav-wrap::after {
width: 0;
}
.el-tabs__item {
padding: 0 10px;
}
.el-tabs__item:hover {
color: rgba(0, 0, 0, 0.85);
}
.el-tabs__item.is-active {
color: rgba(0, 0, 0, 0.85);
}
.el-tabs__item {
color: rgba(0, 0, 0, 0.45);
}
.searchBarBox {
margin-bottom: 0;
}
}
</style>

View File

@ -0,0 +1,160 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zwq
* @LastEditTime: 2024-09-02 15:54:20
* @Description:
-->
<template>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-position="top"
label-width="80px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="产线" prop="bindObjectName">
<el-input
v-model="dataForm.bindObjectName"
disabled
placeholder="产线" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="上片数量" prop="inCount">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.inCount"
clearable
placeholder="请输入上片数量" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="下片数量" prop="outCount">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.outCount"
clearable
placeholder="请输入下片数量" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="良品率" prop="ratio">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.ratio"
clearable
placeholder="请输入良品率" />
(%)
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="深加工成本" prop="costSum">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.costSum"
clearable
placeholder="请输入深加工成本" />
()
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="单片成本" prop="costPiece">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.costPiece"
clearable
placeholder="请输入单片成本" />
()
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="每平米成本" prop="costArea">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.costArea"
clearable
placeholder="请输入每平米成本" />
()
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import basicAdd from '@/mixins/basic-add';
import { updateDeepCostStatistics } from '@/api/cost/deepCostStatistics';
export default {
mixins: [basicAdd],
data() {
return {
urlOptions: {
updateURL: updateDeepCostStatistics,
},
dataForm: {
id: undefined,
bindObjectName: undefined,
inCount: undefined,
ratio: undefined,
costPiece: undefined,
costArea: undefined,
costSum: undefined,
outCount: undefined,
},
dataRule: {
costSum: [
{ required: true, message: '深加工成本不能为空', trigger: 'blur' },
],
},
};
},
methods: {
init(val, statisticType) {
this.visible = true;
this.$nextTick(() => {
this.$refs['dataForm'].resetFields();
this.dataForm = JSON.parse(JSON.stringify(val));
this.dataForm.statisticType = statisticType;
this.dataForm.ratio =
this.dataForm.ratio >= 0 ? this.dataForm.ratio * 100 : '';
});
},
//
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
return false;
}
const data = {
id: this.dataForm.id,
statisticType: this.dataForm.statisticType,
bindObjectName: this.dataForm.bindObjectName,
modifyInCount: this.dataForm.inCount,
modifyRatio:
this.dataForm.ratio >= 0 ? this.dataForm.ratio / 100 : '',
modifyCostPiece: this.dataForm.costPiece,
modifyCostArea: this.dataForm.costArea,
modifyCostSum: this.dataForm.costSum,
modifyOutCount: this.dataForm.outCount,
};
//
this.urlOptions.updateURL(data).then((response) => {
this.$modal.msgSuccess('修改成功');
this.visible = false;
this.$emit('refreshDataList');
});
});
},
},
};
</script>

View File

@ -0,0 +1,444 @@
<template>
<div>
<div style="background: #f2f4f9; height: 40px; width: 100%">
<ButtonNav :menus="['历史成本', '成本查询']" @change="currentMenu">
<template v-slot:tab1>
<div>历史成本</div>
</template>
<template v-slot:tab2>
<div>成本查询</div>
</template>
</ButtonNav>
</div>
<div class="app-container energyOverlimitLog">
<div v-show="activeName === 'his'">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
</div>
<div v-show="activeName === 'now'">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig2"
ref="searchBarForm2"
@headBtnClick="buttonClick" />
</div>
<!-- 列表 -->
<div v-if="activeName === 'his'">
<base-table
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-props="tableProps"
:table-data="tableData"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="80"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
</div>
<div v-if="activeName === 'now'">
<base-table
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-props="tableProps2"
:table-data="tableData2"
:max-height="tableH" />
</div>
<pagination
:page.sync="listQuery.pageNo"
:limit.sync="listQuery.pageSize"
:total="listQuery.total"
@pagination="getDataList" />
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="50%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div>
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
import basicPage from '@/mixins/basic-page';
import { getLinePage } from '@/api/base/productionLine';
import {
getDeepCostStatisticsPage,
getDeepCostStatisticsRealtimePage,
exportDeepStatisticsRealtimeExcel,
exportDeepCostStatisticsHisExcel,
} from '@/api/cost/deepCostStatistics';
import { parseTime } from '@/filter/code-filter';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
import typeRule from './typeRule';
import ButtonNav from '@/components/ButtonNav';
const tableProps = [
{
prop: 'recTime',
label: '时间',
filter: (val) => parseTime(val, '{y}年{m}月{d}日'),
},
{
prop: 'bindObjectName',
label: '产线',
},
{
prop: 'spec',
label: '规格',
},
{
prop: 'inCount',
label: '上片数量',
},
{
prop: 'outCount',
label: '下片数量',
},
{
prop: 'ratio',
label: '良品率',
filter: (val) => (val ? val * 100 + '%' : '-'),
},
{
prop: 'costSum',
label: '深加工成本/元',
align: 'right',
},
{
prop: 'costPiece',
label: '单片成本/元',
align: 'right',
},
{
prop: 'costArea',
label: '每平米成本/元',
align: 'right',
},
];
const tableProps2 = [
{
prop: 'bindObjectName',
label: '产线',
},
{
prop: 'spec',
label: '规格',
},
{
prop: 'inCount',
label: '上片数量',
},
{
prop: 'outCount',
label: '下片数量',
},
{
prop: 'ratio',
label: '良品率',
filter: (val) => (val ? val * 100 + '%' : '-'),
},
{
prop: 'costSum',
label: '深加工成本/元',
align: 'right',
},
{
prop: 'costPiece',
label: '单片成本/元',
align: 'right',
},
{
prop: 'costArea',
label: '每平米成本/元',
align: 'right',
},
];
export default {
name: 'costMaterial',
mixins: [basicPage, tableHeightMixin],
data() {
return {
urlOptions: {
getDataListURL: getDeepCostStatisticsPage,
},
formConfig: [
{
type: 'select',
label: '维度',
selectOptions: [
{ id: 1, name: '日' },
{ id: 2, name: '周' },
{ id: 3, name: '月' },
],
param: 'statisticType',
defaultSelect: 1, // ,
clearable: false,
},
{
type: 'select',
label: '产线',
selectOptions: [],
param: 'name',
filterable: true,
},
{
type: 'datePicker',
label: '时间范围',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'searchTime',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
],
formConfig2: [
{
type: 'datePicker',
label: '时间范围',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'searchTime',
},
{
type: 'select',
label: '产线',
selectOptions: [],
param: 'name',
filterable: true,
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
],
listQuery: {
statisticType: 1,
},
activeName: 'his',
tableProps,
tableProps2,
tableBtn: [{
type: 'edit',
btnName: '编辑',
}
].filter((v) => v),
tableData: [],
tableData2: [],
};
},
components: {
AddOrUpdate,
ButtonNav,
},
created() {
const params ={
pageNo: 1,
pageSize: 100,
pdType: 0
}
getLinePage(params).then((response) => {
this.formConfig[1].selectOptions = response.data.list;
this.formConfig2[1].selectOptions = response.data.list;
});
},
methods: {
buttonClick(val) {
if (val.statisticType === 2) {
this.tableProps[0].filter = (val) =>
parseTime(val, '{y}年第{w}周');
}else{
this.tableProps[0].filter = (val) =>
parseTime(val, '{y}年{m}月{d}日');
}
this.formConfig2[0].startPlaceholder = '开始时间';
this.formConfig2[0].endPlaceholder = '结束时间';
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.bindObjectId = val.name || null;
this.listQuery.statisticType = val.statisticType || 1;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59'
: null;
if (this.activeName === 'his') {
this.getDataList();
} else {
this.getDataList2();
}
break;
case 'add':
this.addOrUpdateHandle();
break;
case 'export':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.bindObjectId = val.name || null;
this.listQuery.statisticType = val.statisticType || 1;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59'
: null;
this.handleExport();
break;
default:
console.log(val);
}
},
currentMenu(val) {
this.activeName = val === '历史成本' ? 'his' : 'now';
if (this.activeName === 'his') {
this.$refs.searchBarForm.resetForm();
this.listQuery.name = null;
this.listQuery.startTime = null;
this.listQuery.endTime = null;
this.listQuery.statisticType = 1;
this.listQuery.pageNo = 1;
this.getDataList();
} else {
this.$refs.searchBarForm2.resetForm();
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
this.listQuery.startTime = parseTime(start).substr(0, 10) + ' 00:00:00';
this.listQuery.endTime = parseTime(end).substr(0, 10) + ' 23:59:59';
this.formConfig2[0].startPlaceholder = parseTime(start).substr(0, 10);
this.formConfig2[0].endPlaceholder = parseTime(end).substr(0, 10);
this.listQuery.name = null;
this.listQuery.pageNo = 1;
this.getDataList2();
}
},
// 2
getDataList2() {
if (this.listQuery.startTime) {
getDeepCostStatisticsRealtimePage(this.listQuery).then((response) => {
this.tableData2 = response.data.list;
this.listQuery.total = response.data.total;
});
} else {
this.$message.warning('请选择时间范围');
}
},
//tableBtn
handleClick(val) {
if (val.type === 'edit') {
this.addOrUpdateVisible = true;
this.addOrEditTitle = '编辑';
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data, this.listQuery.statisticType);
});
} else {
this.otherMethods(val);
}
},
/** 导出按钮操作 */
handleExport() {
let exportURL, title;
if (this.activeName === 'his') {
exportURL = exportDeepCostStatisticsHisExcel;
title = '深加工成本统计-历史成本';
} else {
exportURL = exportDeepStatisticsRealtimeExcel;
title = '深加工成本统计-成本查询';
}
//
let params = { ...this.listQuery };
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal
.confirm('是否确认导出所有数据项?')
.then(() => {
return exportURL(params);
})
.then((response) => {
this.$download.excel(response, title + '报表.xls');
})
.catch(() => {});
},
},
};
</script>
<style lang="scss">
.energyOverlimitLog {
.el-tabs__nav::after {
content: '';
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 2px;
background-color: #e4e7ed;
}
.el-tabs__nav-wrap::after {
width: 0;
}
.el-tabs__item {
padding: 0 10px;
}
.el-tabs__item:hover {
color: rgba(0, 0, 0, 0.85);
}
.el-tabs__item.is-active {
color: rgba(0, 0, 0, 0.85);
}
.el-tabs__item {
color: rgba(0, 0, 0, 0.45);
}
.searchBarBox {
margin-bottom: 0;
}
}
</style>

View File

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

View File

@ -0,0 +1,104 @@
<template>
<div class="app-container">
<base-table
v-loading="dataListLoading"
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:max-height="tableH"
:table-data="tableData">
</base-table>
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" />
</div>
</template>
<script>
import basicPage from '@/mixins/basic-page';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
import { parseTime } from '@/filter/code-filter';
import {
deleteRawOthercostLog,
getRawOthercostLogPage,
exportRawOthercostLogExcel,
} from '@/api/cost/costOthercostLog';
import { getRawOthercostRulePage } from '@/api/cost/rawOthercostRule';
const tableProps = [
{
prop: 'otherCostName',
label: '成本名称',
},
{
prop: 'recTime',
label: '日期',
filter: (val) => parseTime(val, '{y}年{m}月{d}日'),
},
{
prop: 'price',
label: '成本金额',
align: 'right',
},
{
prop: 'remark',
label: '备注',
},
];
export default {
mixins: [basicPage, tableHeightMixin],
data() {
return {
urlOptions: {
getDataListURL: getRawOthercostLogPage,
deleteURL: deleteRawOthercostLog,
exportURL: exportRawOthercostLogExcel,
},
tableProps,
tableData: [],
};
},
components: {
},
created() {
const params = {
pageNo: 1,
pageSize: 100,
};
getRawOthercostRulePage(params).then((response) => {
this.formConfig[0].selectOptions = response.data.list;
});
},
methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.name = val.name||null;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59'
: null;
this.getDataList();
break;
case 'add':
this.addOrUpdateHandle();
break;
case 'export':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.name = val.name;
this.listQuery.recTime = val.searchTime;
this.handleExport();
break;
default:
console.log(val);
}
},
},
};
</script>

View File

@ -0,0 +1,130 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zwq
* @LastEditTime: 2024-09-05 15:34:14
* @Description:
-->
<template>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-position="top"
label-width="80px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="能源类型" prop="energyTypeName">
<el-input
v-model="dataForm.energyTypeName"
disabled
placeholder="请输入能源类型" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="日期" prop="recTime">
<el-date-picker
v-model="dataForm.recTime"
type="date"
value-format="timestamp"
:style="{ width: '100%' }"
disabled
placeholder="选择日期"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
:label="dataForm.bindObjectName ? '监控对象' : '抄表名'"
prop="showName">
<el-input
v-model="dataForm.showName"
disabled
:placeholder="dataForm.bindObjectName ? '监控对象' : '抄表名'" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="累计用量" prop="quantity">
<el-input-number
:min="0"
style="width: 100%"
v-model="dataForm.quantity"
clearable
placeholder="请输入累计用量" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="总价" prop="price">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.price"
clearable
placeholder="请输入总价" />
()
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import basicAdd from '@/mixins/basic-add';
import { updateEnergyHis } from '@/api/cost/costEnergy';
export default {
mixins: [basicAdd],
data() {
return {
urlOptions: {
updateURL: updateEnergyHis,
},
dataForm: {
id: undefined,
price: undefined,
quantity: undefined,
energyTypeName: undefined,
recTime: undefined,
showName: undefined
},
dataRule: {
price: [{ required: true, message: '总价不能为空', trigger: 'blur' }],
quantity: [
{ required: true, message: '累计用量不能为空', trigger: 'blur' },
],
},
};
},
methods: {
init(val, statisticType) {
this.visible = true;
this.$nextTick(() => {
this.$refs['dataForm'].resetFields();
this.dataForm = JSON.parse(JSON.stringify(val));
this.dataForm.statisticType = statisticType;
if(this.dataForm.bindObjectName){
this.dataForm.showName = this.dataForm.bindObjectName
}else{
this.dataForm.showName = this.dataForm.meterName
}
});
},
//
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
return false;
}
this.dataForm.modifyPrice = this.dataForm.price;
this.dataForm.modifyQuantity = this.dataForm.quantity;
//
this.urlOptions.updateURL(this.dataForm).then((response) => {
this.$modal.msgSuccess('修改成功');
this.visible = false;
this.$emit('refreshDataList');
});
});
},
},
};
</script>

View File

@ -0,0 +1,418 @@
<template>
<div>
<div style="background: #f2f4f9; height: 40px; width: 100%">
<ButtonNav :menus="['历史成本', '成本查询']" @change="currentMenu">
<template v-slot:tab1>
<div>历史成本</div>
</template>
<template v-slot:tab2>
<div>成本查询</div>
</template>
</ButtonNav>
</div>
<div class="app-container energyOverlimitLog">
<div v-show="activeName === 'his'">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
</div>
<div v-show="activeName === 'now'">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig2"
ref="searchBarForm2"
@headBtnClick="buttonClick" />
</div>
<!-- 列表 -->
<div v-if="activeName === 'his'">
<base-table
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-props="tableProps"
:table-data="tableData"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="80"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
</div>
<div v-if="activeName === 'now'">
<base-table
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-props="tableProps2"
:table-data="tableData2"
:max-height="tableH" />
</div>
<pagination
:page.sync="listQuery.pageNo"
:limit.sync="listQuery.pageSize"
:total="listQuery.total"
@pagination="getDataList" />
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="50%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div>
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
import basicPage from '@/mixins/basic-page';
import { getEnergyTypePage } from '@/api/base/energyType';
import {
getEnergyHisPage,
getEnergyRealtimePage,
exportEnergyRealtimeExcel,
exportEnergyHisExcel,
} from '@/api/cost/costEnergy';
import { parseTime } from '@/filter/code-filter';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
import ButtonNav from '@/components/ButtonNav';
const tableProps = [
{
prop: 'recTime',
label: '日期',
filter: (val) => parseTime(val, '{y}年{m}月{d}日'),
},
{
prop: 'energyTypeName',
label: '能源类型',
},
{
prop: 'bindObjectName',
label: '监控对象',
filter: (val) => (val != null ? val : '--'),
},
{
prop: 'meterName',
label: '抄表名',
filter: (val) => (val != null ? val : '--'),
},
{
prop: 'quantity',
label: '累计使用量',
},
{
prop: 'price',
label: '总价(元)',
align: 'right',
},
];
const tableProps2 = [
{
prop: 'energyTypeName',
label: '能源类型',
},
{
prop: 'bindObjectName',
label: '监控对象',
filter: (val) => (val != null ? val : '--'),
},
{
prop: 'meter',
label: '抄表名',
filter: (val) => (val != null ? val : '--'),
},
{
prop: 'quantity',
label: '累计使用量',
},
{
prop: 'price',
label: '总价(元)',
align: 'right',
},
];
export default {
name: 'costEnergy',
mixins: [basicPage, tableHeightMixin],
data() {
return {
urlOptions: {
getDataListURL: getEnergyHisPage,
},
formConfig: [
{
type: 'select',
label: '维度',
selectOptions: [
{ id: 1, name: '日' },
{ id: 2, name: '周' },
{ id: 3, name: '月' },
],
param: 'statisticType',
defaultSelect: 1, // ,
clearable: false,
},
{
type: 'select',
label: '能源类型',
selectOptions: [],
param: 'name',
labelField: 'name',
filterable: true,
},
{
type: 'datePicker',
label: '时间范围',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'searchTime',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
],
formConfig2: [
{
type: 'select',
label: '能源类型',
selectOptions: [],
param: 'name',
labelField: 'name',
filterable: true,
},
{
type: 'datePicker',
label: '时间范围',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'searchTime',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
],
listQuery: {
statisticType: 1,
},
activeName: 'his',
tableProps,
tableProps2,
tableBtn: [{
type: 'edit',
btnName: '编辑',
}
].filter((v) => v),
tableData: [],
tableData2: [],
};
},
components: {
AddOrUpdate,
ButtonNav,
},
created() {
const params = {
pageNo: 1,
pageSize: 100,
};
getEnergyTypePage(params).then((response) => {
this.formConfig[1].selectOptions = response.data.list;
this.formConfig2[0].selectOptions = response.data.list;
});
},
methods: {
buttonClick(val) {
if (val.statisticType === 2) {
this.tableProps[0].filter = (val) =>
parseTime(val, '{y}年第{w}周');
}else{
this.tableProps[0].filter = (val) =>
parseTime(val, '{y}年{m}月{d}日');
}
this.formConfig2[1].startPlaceholder = '开始时间';
this.formConfig2[1].endPlaceholder = '结束时间';
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.energyTypeId = val.name || null;
this.listQuery.statisticType = val.statisticType || 1;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59'
: null;
if (this.activeName === 'his') {
this.getDataList();
} else {
this.getDataList2();
}
break;
case 'add':
this.addOrUpdateHandle();
break;
case 'export':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.energyTypeId = val.name || null;
this.listQuery.statisticType = val.statisticType || 1;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59'
: null;
this.handleExport();
break;
default:
console.log(val);
}
},
currentMenu(val) {
this.activeName = val === '历史成本' ? 'his' : 'now';
if (this.activeName === 'his') {
this.$refs.searchBarForm.resetForm();
this.listQuery.name = null;
this.listQuery.startTime = null;
this.listQuery.endTime = null;
this.listQuery.statisticType = 1;
this.listQuery.pageNo = 1;
this.getDataList();
} else {
this.$refs.searchBarForm2.resetForm();
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
this.listQuery.startTime = parseTime(start).substr(0, 10) + ' 00:00:00';
this.listQuery.endTime = parseTime(end).substr(0, 10) + ' 23:59:59';
this.formConfig2[1].startPlaceholder = parseTime(start).substr(0, 10);
this.formConfig2[1].endPlaceholder = parseTime(end).substr(0, 10);
this.listQuery.name = null;
this.listQuery.pageNo = 1;
this.getDataList2();
}
},
// 2
getDataList2() {
if (this.listQuery.startTime) {
getEnergyRealtimePage(this.listQuery).then((response) => {
this.tableData2 = response.data.list;
this.listQuery.total = response.data.total;
});
} else {
this.$message.warning('请选择时间范围');
}
},
//tableBtn
handleClick(val) {
if (val.type === 'edit') {
this.addOrUpdateVisible = true;
this.addOrEditTitle = '编辑';
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data, this.listQuery.statisticType);
});
} else {
this.otherMethods(val);
}
},
/** 导出按钮操作 */
handleExport() {
let exportURL, title;
if (this.activeName === 'his') {
exportURL = exportEnergyHisExcel;
title = '能源成本-历史成本';
} else {
exportURL = exportEnergyRealtimeExcel;
title = '能源成本-成本查询';
}
//
let params = { ...this.listQuery };
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal
.confirm('是否确认导出所有数据项?')
.then(() => {
return exportURL(params);
})
.then((response) => {
this.$download.excel(response, title + '报表.xls');
})
.catch(() => {});
},
},
};
</script>
<style lang="scss">
.energyOverlimitLog {
.el-tabs__nav::after {
content: '';
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 2px;
background-color: #e4e7ed;
}
.el-tabs__nav-wrap::after {
width: 0;
}
.el-tabs__item {
padding: 0 10px;
}
.el-tabs__item:hover {
color: rgba(0, 0, 0, 0.85);
}
.el-tabs__item.is-active {
color: rgba(0, 0, 0, 0.85);
}
.el-tabs__item {
color: rgba(0, 0, 0, 0.45);
}
.searchBarBox {
margin-bottom: 0;
}
}
</style>

View File

@ -0,0 +1,115 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zwq
* @LastEditTime: 2024-09-05 15:34:28
* @Description:
-->
<template>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-position="top"
label-width="80px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="原料名称" prop="materialName">
<el-input
v-model="dataForm.materialName"
disabled
placeholder="请输入原料名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="单价" prop="matPrice">
<el-input
v-model="dataForm.matPrice"
disabled
style="width: 70%"
placeholder="请输入单价" />
(/)
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="累计用量" prop="quantity">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.quantity"
clearable
placeholder="请输入累计用量" />
()
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="总价" prop="price">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.price"
clearable
placeholder="请输入总价" />
()
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import basicAdd from '@/mixins/basic-add';
import { updateMaterialHis } from '@/api/cost/costMaterial';
export default {
mixins: [basicAdd],
data() {
return {
urlOptions: {
updateURL: updateMaterialHis,
},
dataForm: {
id: undefined,
price: undefined,
quantity: undefined,
matPrice: undefined,
materialName: undefined,
recTime: undefined,
},
dataRule: {
price: [{ required: true, message: '总价不能为空', trigger: 'blur' }],
quantity: [
{ required: true, message: '累计用量不能为空', trigger: 'blur' },
],
},
};
},
methods: {
init(val, statisticType) {
this.visible = true;
this.$nextTick(() => {
this.$refs['dataForm'].resetFields();
this.dataForm = JSON.parse(JSON.stringify(val));
this.dataForm.statisticType = statisticType;
});
},
//
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
return false;
}
this.dataForm.modifyPrice = this.dataForm.price;
this.dataForm.modifyQuantity = this.dataForm.quantity;
//
this.urlOptions.updateURL(this.dataForm).then((response) => {
this.$modal.msgSuccess('修改成功');
this.visible = false;
this.$emit('refreshDataList');
});
});
},
},
};
</script>

View File

@ -0,0 +1,415 @@
<template>
<div>
<div style="background: #f2f4f9; height: 40px; width: 100%">
<ButtonNav :menus="['历史成本', '成本查询']" @change="currentMenu">
<template v-slot:tab1>
<div>历史成本</div>
</template>
<template v-slot:tab2>
<div>成本查询</div>
</template>
</ButtonNav>
</div>
<div class="app-container energyOverlimitLog">
<div v-show="activeName === 'his'">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
</div>
<div v-show="activeName === 'now'">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig2"
ref="searchBarForm2"
@headBtnClick="buttonClick" />
</div>
<!-- 列表 -->
<div v-if="activeName === 'his'">
<base-table
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-props="tableProps"
:table-data="tableData"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="80"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
</div>
<div v-if="activeName === 'now'">
<base-table
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-props="tableProps2"
:table-data="tableData2"
:max-height="tableH" />
</div>
<pagination
:page.sync="listQuery.pageNo"
:limit.sync="listQuery.pageSize"
:total="listQuery.total"
@pagination="getDataList" />
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="50%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div>
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
import basicPage from '@/mixins/basic-page';
import { getMaterialPage } from '@/api/base/material';
import {
getMaterialHisPage,
getMaterialRealtimePage,
exportMaterialRealtimeExcel,
exportMaterialHisExcel,
} from '@/api/cost/costMaterial';
import { parseTime } from '@/filter/code-filter';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
import typeRule from './typeRule';
import ButtonNav from '@/components/ButtonNav';
const tableProps = [
{
prop: 'recTime',
label: '日期',
filter: (val) => parseTime(val, '{y}年{m}月{d}日'),
},
{
prop: 'materialName',
label: '原料名称',
},
{
prop: 'quantity',
label: '累计使用量(吨)',
},
{
prop: 'matPrice',
label: '单价(元/吨)',
align: 'right',
},
{
prop: 'price',
label: '总价(元)',
align: 'right',
},
];
const tableProps2 = [
{
prop: 'materialName',
label: '原料名称',
},
{
prop: 'time',
label: '单价生效时间',
subcomponent: typeRule,
width: 300,
},
{
prop: 'quantity',
label: '累计使用量(吨)',
},
{
prop: 'materialPrice',
label: '单价(元/吨)',
align: 'right',
},
{
prop: 'price',
label: '总价(元)',
align: 'right',
},
];
export default {
name: 'costMaterial',
mixins: [basicPage, tableHeightMixin],
data() {
return {
urlOptions: {
getDataListURL: getMaterialHisPage,
},
formConfig: [
{
type: 'select',
label: '维度',
selectOptions: [
{ id: 1, name: '日' },
{ id: 2, name: '周' },
{ id: 3, name: '月' },
],
param: 'statisticType',
defaultSelect: 1, // ,
clearable: false,
},
{
type: 'select',
label: '原料名称',
selectOptions: [],
param: 'name',
labelField: 'name',
filterable: true,
},
{
type: 'datePicker',
label: '时间范围',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'searchTime',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
],
formConfig2: [
{
type: 'select',
label: '原料名称',
selectOptions: [],
param: 'name',
labelField: 'name',
filterable: true,
},
{
type: 'datePicker',
label: '时间范围',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'searchTime',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
],
listQuery: {
statisticType: 1,
},
activeName: 'his',
tableProps,
tableProps2,
tableBtn: [{
type: 'edit',
btnName: '编辑',
}
].filter((v) => v),
tableData: [],
tableData2: [],
};
},
components: {
AddOrUpdate,
ButtonNav,
},
created() {
const params = {
pageNo: 1,
pageSize: 100,
};
getMaterialPage(params).then((response) => {
this.formConfig[1].selectOptions = response.data.list;
this.formConfig2[0].selectOptions = response.data.list;
});
},
methods: {
buttonClick(val) {
if (val.statisticType === 2) {
this.tableProps[0].filter = (val) =>
parseTime(val, '{y}年第{w}周');
}else{
this.tableProps[0].filter = (val) =>
parseTime(val, '{y}年{m}月{d}日');
}
this.formConfig2[1].startPlaceholder = '开始时间';
this.formConfig2[1].endPlaceholder = '结束时间';
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.materialId = val.name || null;
this.listQuery.statisticType = val.statisticType || 1;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59'
: null;
if (this.activeName === 'his') {
this.getDataList();
} else {
this.getDataList2();
}
break;
case 'add':
this.addOrUpdateHandle();
break;
case 'export':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.materialId = val.name || null;
this.listQuery.statisticType = val.statisticType || 1;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59'
: null;
this.handleExport();
break;
default:
console.log(val);
}
},
currentMenu(val) {
this.activeName = val === '历史成本' ? 'his' : 'now';
if (this.activeName === 'his') {
this.$refs.searchBarForm.resetForm();
this.listQuery.name = null;
this.listQuery.startTime = null;
this.listQuery.endTime = null;
this.listQuery.statisticType = 1;
this.listQuery.pageNo = 1;
this.getDataList();
} else {
this.$refs.searchBarForm2.resetForm();
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
this.listQuery.startTime = parseTime(start).substr(0, 10) + ' 00:00:00';
this.listQuery.endTime = parseTime(end).substr(0, 10) + ' 23:59:59';
this.formConfig2[1].startPlaceholder = parseTime(start).substr(0, 10);
this.formConfig2[1].endPlaceholder = parseTime(end).substr(0, 10);
this.listQuery.name = null;
this.listQuery.pageNo = 1;
this.getDataList2();
}
},
// 2
getDataList2() {
if (this.listQuery.startTime) {
getMaterialRealtimePage(this.listQuery).then((response) => {
this.tableData2 = response.data.list;
this.listQuery.total = response.data.total;
});
} else {
this.$message.warning('请选择时间范围');
}
},
//tableBtn
handleClick(val) {
if (val.type === 'edit') {
this.addOrUpdateVisible = true;
this.addOrEditTitle = '编辑';
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data, this.listQuery.statisticType);
});
} else {
this.otherMethods(val);
}
},
/** 导出按钮操作 */
handleExport() {
let exportURL, title;
if (this.activeName === 'his') {
exportURL = exportMaterialHisExcel;
title = '原料成本-历史成本';
} else {
exportURL = exportMaterialRealtimeExcel;
title = '原料成本-成本查询';
}
//
let params = { ...this.listQuery };
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal
.confirm('是否确认导出所有数据项?')
.then(() => {
return exportURL(params);
})
.then((response) => {
this.$download.excel(response, title + '报表.xls');
})
.catch(() => {});
},
},
};
</script>
<style lang="scss">
.energyOverlimitLog {
.el-tabs__nav::after {
content: '';
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 2px;
background-color: #e4e7ed;
}
.el-tabs__nav-wrap::after {
width: 0;
}
.el-tabs__item {
padding: 0 10px;
}
.el-tabs__item:hover {
color: rgba(0, 0, 0, 0.85);
}
.el-tabs__item.is-active {
color: rgba(0, 0, 0, 0.85);
}
.el-tabs__item {
color: rgba(0, 0, 0, 0.45);
}
.searchBarBox {
margin-bottom: 0;
}
}
</style>

View File

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

View File

@ -0,0 +1,172 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zwq
* @LastEditTime: 2024-09-05 15:33:16
* @Description:
-->
<template>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-position="top"
label-width="80px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="产线" prop="bindObjectName">
<el-input
style="width: 100%"
v-model="dataForm.bindObjectName"
disabled />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="所属日期" prop="recTime">
<el-date-picker
v-model="dataForm.recTime"
type="date"
value-format="timestamp"
:style="{ width: '100%' }"
disabled
placeholder="选择所属日期"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="厚度" prop="thick">
<el-input-number
:min="0"
style="width: 85%"
v-model="dataForm.thick"
clearable
placeholder="请输入厚度" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="在线速度" prop="speed">
<el-input-number
:min="0"
style="width: 85%"
v-model="dataForm.speed"
clearable
placeholder="请输入在线速度" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="掰边宽度" prop="width">
<el-input-number
:min="0"
style="width: 85%"
v-model="dataForm.width"
clearable
placeholder="请输入掰边宽度" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="拉引量" prop="inArea">
<el-input-number
:min="0"
style="width: 85%"
v-model="dataForm.inArea"
clearable
placeholder="请输入拉引量" />
()
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="下片面积" prop="outArea">
<el-input-number
:min="0"
style="width: 85%"
v-model="dataForm.outArea"
clearable
placeholder="请输入下片面积" />
()
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="良品率" prop="ratio">
<el-input-number
:min="0"
style="width: 85%"
v-model="dataForm.ratio"
clearable
placeholder="请输入良品率" />
(%)
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import basicAdd from '@/mixins/basic-add';
import { updatecostOriginRatioHis } from '@/api/cost/costOriginRatioHis';
export default {
mixins: [basicAdd],
props: {
nameArr: {
type: Array,
default: () => [],
},
},
data() {
return {
urlOptions: {
updateURL: updatecostOriginRatioHis,
},
dataForm: {
id: undefined,
bindObjectName: undefined,
thick: undefined,
speed: undefined,
width: undefined,
inArea: undefined,
outArea: undefined,
ratio: undefined,
recTime: undefined,
},
dataRule: {},
};
},
methods: {
init(val, statisticType) {
this.visible = true;
this.$nextTick(() => {
this.$refs['dataForm'].resetFields();
this.dataForm = JSON.parse(JSON.stringify(val));
this.dataForm.statisticType = statisticType;
this.dataForm.ratio =
this.dataForm.ratio >= 0 ? this.dataForm.ratio * 100 : '';
});
},
//
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
return false;
}
const udata = {
id: this.dataForm.id,
statisticType: this.dataForm.statisticType,
modifyThick: this.dataForm.thick,
modifySpeed: this.dataForm.speed,
modifyWidth: this.dataForm.width,
modifyInArea: this.dataForm.inArea,
modifyOutArea: this.dataForm.outArea,
modifyRatio:
this.dataForm.ratio >= 0 ? this.dataForm.ratio / 100 : '',
};
//
this.urlOptions.updateURL(udata).then((response) => {
this.$modal.msgSuccess('修改成功');
this.visible = false;
this.$emit('refreshDataList');
});
});
},
},
};
</script>

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