projects/mes-dy #70

Merged
gtz217 merged 2 commits from projects/mes-dy into projects/mes-test 2023-11-11 21:40:47 +08:00
103 changed files with 11744 additions and 413 deletions
Showing only changes of commit e6158cd59b - Show all commits

View File

@ -1,7 +1,7 @@
###
# @Author: Do not edit
# @Date: 2023-08-29 09:40:39
# @LastEditTime: 2023-11-10 17:06:02
# @LastEditTime: 2023-11-11 20:50:30
# @LastEditors: DY
# @Description:
###
@ -13,15 +13,14 @@ VUE_APP_TITLE = MES系统
# 芋道管理系统/开发环境
# VUE_APP_BASE_API = 'http://100.64.0.26:48082'
VUE_APP_BASE_API = 'http://192.168.0.33:48082'
# VUE_APP_BASE_API = 'http://192.168.0.33:48082'
# VUE_APP_BASE_API = 'http://192.168.4.173:48080'
# VUE_APP_BASE_API = 'http://192.168.2.173:48080'
# 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:48082'
# VUE_APP_BASE_API = 'http://192.168.1.56:48080'
# VUE_APP_BASE_API = 'http://192.168.1.188:48080'
# VUE_APP_BASE_API = 'http://192.168.2.159:48080'
# VUE_APP_BASE_API = 'http://192.168.4.159:48080'
# 路由懒加载
VUE_CLI_BABEL_TRANSPILE_MODULES = true
@ -36,3 +35,4 @@ VUE_APP_DOC_ENABLE = true
# 百度统计
# VUE_APP_BAIDU_CODE = fadc1bd5db1a1d6f581df60a1807f8ab

View File

@ -1,3 +1,4 @@
# 开发环境配置
ENV = 'development'

View File

@ -2,14 +2,14 @@
ENV = 'production'
# 页面标题
VUE_APP_TITLE = 产线监控系统
VUE_APP_TITLE = MES系统
# 芋道管理系统/生产环境
VUE_APP_BASE_API = '/prod-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:8889/'
# 二级部署路径
VUE_APP_APP_NAME ='yudao-admin'

12
.env.production Normal file
View File

@ -0,0 +1,12 @@
###
# @Author: zhp
# @Date: 2023-10-30 14:18:30
# @LastEditTime: 2023-11-02 16:16:09
# @LastEditors: zhp
# @Description:
###
# just a flag
ENV = 'production'
# base api
# VUE_APP_BASE_API = '/api'

View File

@ -23,3 +23,4 @@ VUE_APP_DOC_ENABLE = false
# 百度统计
VUE_APP_BAIDU_CODE = fadc1bd5db1a1d6f581df60a1807f8ab

View File

@ -71,3 +71,21 @@ export function deliveryLogDetCreate(data) {
data: data
})
}
// 获得一条发货详细
export function deliveryLogDetGet(query) {
return request({
url: '/extend/delivery-log-det/get',
method: 'get',
params: query
})
}
// 编辑发货详情
export function deliveryLogDetUpdate(data) {
return request({
url: '/extend/delivery-log-det/update',
method: 'put',
data: data
})
}

View File

@ -138,3 +138,12 @@ export function bomUseNum(query) {
params: query
})
}
// 完成订单
export function orderFinish(query) {
return request({
url: '/base/order/finish',
method: 'post',
params: query
})
}

View File

@ -0,0 +1,69 @@
/*
* @Author: zhp
* @Date: 2023-11-06 15:38:12
* @LastEditTime: 2023-11-06 15:39:39
* @LastEditors: zhp
* @Description:
*/
import request from '@/utils/request'
// 创建质量检测类型基础
export function createQualityScrapDet(data) {
return request({
url: '/base/quality-scrap-det/create',
method: 'post',
data: data
})
}
// 更新质量检测类型基础
export function updateQualityScrapDet(data) {
return request({
url: '/base/quality-scrap-det/update',
method: 'put',
data: data
})
}
// 删除质量检测类型基础
export function deleteQualityScrapDet(id) {
return request({
url: '/base/quality-scrap-det/delete?id=' + id,
method: 'delete'
})
}
// 获得质量检测类型基础
export function getQualityScrapDet(id) {
return request({
url: '/base/quality-scrap-det/get?id=' + id,
method: 'get'
})
}
// 获得质量检测类型基础分页
export function getQualityScrapDetPage(query) {
return request({
url: '/base/quality-scrap-det/page',
method: 'get',
params: query
})
}
// 导出质量检测类型基础 Excel
export function exportQualityScrapTypeExcel(query) {
return request({
url: '/base/quality-scrap-type/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}
export function getCode(query) {
return request({
url: '/base/quality-scrap-det/getCode',
method: 'get',
params: query
})
}

View File

@ -0,0 +1,100 @@
/*
* @Author: zhp
* @Date: 2023-11-07 15:02:37
* @LastEditTime: 2023-11-07 18:32:07
* @LastEditors: zhp
* @Description:
*/
import request from '@/utils/request'
// 创建质量检测类型基础
export function createQualityScrapLog(data) {
return request({
url: '/base/quality-scrap-log/create',
method: 'post',
data: data
})
}
// 更新质量检测类型基础
export function updateQualityScrapLog(data) {
return request({
url: '/base/quality-scrap-log/update',
method: 'put',
data: data
})
}
// 删除质量检测类型基础
export function deleteQualityScrapLog(id) {
return request({
url: '/base/quality-scrap-log/delete?id=' + id,
method: 'delete'
})
}
// 获得质量检测类型基础
export function getQualityScrapLog(id) {
return request({
url: '/base/quality-scrap-log/get?id=' + id,
method: 'get'
})
}
// 获得质量检测类型基础分页
export function getQualityScrapLogPage(query) {
return request({
url: '/base/quality-scrap-log/page',
method: 'get',
params: query
})
}
// 导出质量检测类型基础 Excel
export function exportQualityScrapTypeExcel(query) {
return request({
url: '/base/quality-scrap-type/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}
export function getCode(query) {
return request({
url: '/base/quality-scrap-log/getCode',
method: 'get',
params: query
})
}
export function getWorkOrderList(query) {
return request({
url: '/base/core-work-order/listbyfilter',
method: 'get',
params: query,
})
}
export function getTeamList(query) {
return request({
url: '/base/group-team/listAll',
method: 'get',
params: query,
})
}
export function getLineList(query) {
return request({
url: '/base/core-production-line/listAll',
method: 'get',
params: query,
})
}
export function getDetList(query) {
return request({
url: '/base/quality-scrap-det/listAll',
method: 'get',
params: query,
})
}

View File

@ -0,0 +1,76 @@
/*
* @Author: zhp
* @Date: 2023-11-04 18:27:11
* @LastEditTime: 2023-11-06 15:55:24
* @LastEditors: zhp
* @Description:
*/
import request from '@/utils/request'
// 创建质量检测类型基础
export function createQualityScrapType(data) {
return request({
url: '/base/quality-scrap-type/create',
method: 'post',
data: data
})
}
// 更新质量检测类型基础
export function updateQualityScrapType(data) {
return request({
url: '/base/quality-scrap-type/update',
method: 'put',
data: data
})
}
// 删除质量检测类型基础
export function deleteQualityScrapType(id) {
return request({
url: '/base/quality-scrap-type/delete?id=' + id,
method: 'delete'
})
}
// 获得质量检测类型基础
export function getQualityScrapType(id) {
return request({
url: '/base/quality-scrap-type/get?id=' + id,
method: 'get'
})
}
// 获得质量检测类型基础分页
export function getQualityScrapTypePage(query) {
return request({
url: '/base/quality-scrap-type/page',
method: 'get',
params: query
})
}
// 导出质量检测类型基础 Excel
export function exportQualityScrapTypeExcel(query) {
return request({
url: '/base/quality-scrap-type/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}
export function getCode(query) {
return request({
url: '/base/quality-scrap-type/getCode',
method: 'get',
params: query
})
}
export function getList(query) {
return request({
url: 'base/quality-scrap-type/listAll',
method: 'get',
params: query
})
}

View File

@ -0,0 +1,106 @@
/*
* @Author: zhp
* @Date: 2023-11-07 19:47:48
* @LastEditTime: 2023-11-08 16:59:32
* @LastEditors: zhp
* @Description:
*/
import request from '@/utils/request'
// 获得能耗统计查询分页
export function processEquMaterialBomPage(data) {
return request({
url: '/extend/process-equ-material-bom/page',
method: 'get',
data: data
})
}
export function updateProcessEquMaterialBom(data) {
return request({
url: '/extend/process-equ-material-bom/update',
method: 'put',
data: data
})
}
export function createProcessEquMaterialBom(data) {
return request({
url: '/extend/process-equ-material-bom/create',
method: 'post',
data: data
})
}
export function getProcessEquMaterialBom(data) {
return request({
url: '/extend/process-equ-material-bom/get',
method: 'get',
params: data
})
}
export function deleteProcessEquMaterialBom(id) {
return request({
url: '/extend/process-equ-material-bom/delete?id=' + id,
method: 'delete',
// data: data
})
}
export function getEquipmentList(data) {
return request({
url: '/base/core-equipment/listAll',
method: 'get',
data: data
})
}
export function deleteProcessEquMaterialBomDet(id) {
return request({
url: '/extend/process-equ-material-bom-det/delete?id=' + id,
method: 'delete',
// data: data
})
}
export function processEquMaterialBomDetPage(data) {
return request({
url: '/extend/process-equ-material-bom-det/page',
method: 'get',
params: data
})
}
export function updateProcessEquMaterialBomDet(data) {
return request({
url: '/extend/process-equ-material-bom-det/update',
method: 'put',
data: data
})
}
export function createProcessEquMaterialBomDet(data) {
return request({
url: '/extend/process-equ-material-bom-det/create',
method: 'post',
data: data
})
}
export function getProcessEquMaterialBomDet(data) {
return request({
url: '/extend/process-equ-material-bom-det/get',
method: 'get',
params: data
})
}
export function getMaterialList(data) {
return request({
url: '/base/material/listbyfilter',
method: 'get',
data: data
})
}

View File

@ -0,0 +1,106 @@
/*
* @Author: zhp
* @Date: 2023-11-09 09:37:14
* @LastEditTime: 2023-11-09 14:20:02
* @LastEditors: zhp
* @Description:
*/
import request from '@/utils/request'
// 获得能耗统计查询分页
export function processEquValueBomPage(data) {
return request({
url: '/extend/process-equ-value-bom/page',
method: 'get',
data: data
})
}
export function updateProcessEquValueBom(data) {
return request({
url: '/extend/process-equ-value-bom/update',
method: 'put',
data: data
})
}
export function createProcessEquValueBom(data) {
return request({
url: '/extend/process-equ-value-bom/create',
method: 'post',
data: data
})
}
export function getProcessEquValueBom(data) {
return request({
url: '/extend/process-equ-value-bom/get',
method: 'get',
params: data
})
}
export function deleteProcessEquValueBom(id) {
return request({
url: '/extend/process-equ-value-bom/delete?id=' + id,
method: 'delete',
// data: data
})
}
export function getEquipmentList(data) {
return request({
url: '/base/core-equipment/listAll',
method: 'get',
data: data
})
}
export function deleteProcessEquValueBomDet(id) {
return request({
url: '/extend/process-equ-value-bom-det/delete?id=' + id,
method: 'delete',
// data: data
})
}
export function processEquValueBomDetPage(data) {
return request({
url: '/extend/process-equ-value-bom-det/page',
method: 'get',
params: data
})
}
export function updateProcessEquValueBomDet(data) {
return request({
url: '/extend/process-equ-value-bom-det/update',
method: 'put',
data: data
})
}
export function createProcessEquValueBomDet(data) {
return request({
url: '/extend/process-equ-value-bom-det/create',
method: 'post',
data: data
})
}
export function getProcessEquValueBomDet(data) {
return request({
url: '/extend/process-equ-value-bom-det/get',
method: 'get',
params: data
})
}
export function getValueList(data) {
return request({
url: '/extend/process-equ-value-bom-det/getEnableValuesByEquId',
method: 'get',
params: data
})
}

View File

@ -1,9 +1,16 @@
/*
* @Author: zhp
* @Date: 2023-10-17 09:26:38
* @LastEditTime: 2023-11-02 17:00:17
* @LastEditors: zhp
* @Description:
*/
import request from '@/utils/request'
// 创建质量检查信息记录表
export function createQualityInspectionRecord(data) {
return request({
url: '/monitoring/quality-inspection-record/create',
url: '/base/quality-inspection-record/create',
method: 'post',
data: data
})
@ -12,7 +19,7 @@ export function createQualityInspectionRecord(data) {
// 更新质量检查信息记录表
export function updateQualityInspectionRecord(data) {
return request({
url: '/monitoring/quality-inspection-record/update',
url: '/base/quality-inspection-record/update',
method: 'put',
data: data
})
@ -21,7 +28,7 @@ export function updateQualityInspectionRecord(data) {
// 删除质量检查信息记录表
export function deleteQualityInspectionRecord(id) {
return request({
url: '/monitoring/quality-inspection-record/delete?id=' + id,
url: '/base/quality-inspection-record/delete?id=' + id,
method: 'delete'
})
}
@ -29,7 +36,7 @@ export function deleteQualityInspectionRecord(id) {
// 获得质量检查信息记录表
export function getQualityInspectionRecord(id) {
return request({
url: '/monitoring/quality-inspection-record/get?id=' + id,
url: '/base/quality-inspection-record/get?id=' + id,
method: 'get'
})
}
@ -37,7 +44,7 @@ export function getQualityInspectionRecord(id) {
// 获得质量检查信息记录表分页
export function getQualityInspectionRecordPage(query) {
return request({
url: '/monitoring/quality-inspection-record/page',
url: '/base/quality-inspection-record/page',
method: 'get',
params: query
})
@ -46,7 +53,7 @@ export function getQualityInspectionRecordPage(query) {
// 导出质量检查信息记录表 Excel
export function exportQualityInspectionRecordExcel(query) {
return request({
url: '/monitoring/quality-inspection-record/export-excel',
url: '/base/quality-inspection-record/export-excel',
method: 'get',
params: query,
responseType: 'blob'

View File

@ -0,0 +1,40 @@
/*
* @Author: zhp
* @Date: 2023-11-07 14:10:18
* @LastEditTime: 2023-11-07 16:29:55
* @LastEditors: zhp
* @Description:
*/
import request from '@/utils/request'
// 获得质量检查信息记录表分页
export function getStatisticalDataPage(query) {
return request({
url: '/base/statistical-data/getStatisticData',
method: 'get',
data: query
})
}
export function getWorkOrderList(query) {
return request({
url: '/base/core-work-order/listbyfilter',
method: 'get',
params: query,
})
}
export function getProductList(query) {
return request({
url: '/base/core-product/listAll',
method: 'get',
params: query,
})
}
export function getInspectionData(query) {
return request({
url: '/base/statistical-data/getInspectionData',
method: 'get',
params: query,
})
}

View File

@ -0,0 +1,35 @@
/*
* @Author: zhp
* @Date: 2023-10-18 09:33:57
* @LastEditTime: 2023-11-03 09:31:17
* @LastEditors: zhp
* @Description:
*/
import request from '@/utils/request'
// 获得物料信息追溯page
export function getTreeData(query) {
return request({
url: '/base/core-factory/getTreeByWorkOrder',
method: 'get',
params: query
})
}
export function getWorkOrderList(query) {
return request({
url: '/base/core-work-order/listbyfilter',
method: 'get',
params: query,
})
}
// 导出物料信息
export function exportEnergyPlcExcel(query) {
return request({
url: '/base/material-use-log/materialTraceExport',
method: 'get',
params: query,
responseType: 'blob'
})
}

View File

@ -0,0 +1,35 @@
/*
* @Author: zhp
* @Date: 2023-10-18 09:33:57
* @LastEditTime: 2023-10-31 10:28:51
* @LastEditors: zhp
* @Description:
*/
import request from '@/utils/request'
// 获得物料信息追溯page
export function getMaterialUseLogPage(query) {
return request({
url: '/base/material-use-log/materialTrace',
method: 'get',
params: query
})
}
export function getWorkOrderList(query) {
return request({
url: '/base/core-work-order/listbyfilter',
method: 'get',
params: query,
})
}
// 导出物料信息
export function exportEnergyPlcExcel(query) {
return request({
url: '/base/material-use-log/materialTraceExport',
method: 'get',
params: query,
responseType: 'blob'
})
}

View File

@ -0,0 +1,35 @@
/*
* @Author: zhp
* @Date: 2023-10-31 15:05:06
* @LastEditTime: 2023-11-03 09:05:50
* @LastEditors: zhp
* @Description:
*/
import request from '@/utils/request'
// 获得工艺信息追溯page
export function getProcessTraceabilityPage(query) {
return request({
url: '/extend/process-retrospect/get',
method: 'post',
data: query
})
}
export function getWorkOrderList(query) {
return request({
url: '/base/core-work-order/listbyfilter',
method: 'get',
params: query,
})
}
// 导出物料信息
// export function exportEnergyPlcExcel(query) {
// return request({
// url: '/base/material-use-log/materialTraceExport',
// method: 'get',
// params: query,
// responseType: 'blob'
// })
// }

View File

@ -0,0 +1,43 @@
/*
* @Author: zhp
* @Date: 2023-10-18 09:33:57
* @LastEditTime: 2023-11-09 15:33:20
* @LastEditors: zhp
* @Description:
*/
import request from '@/utils/request'
// 获得物料信息追溯page
export function getDetMaterial(query) {
return request({
url: '/extend/process-retrospect/getDetMaterial',
method: 'post',
data: query
})
}
export function getDetValue(query) {
return request({
url: '/extend/process-retrospect/getDetValue',
method: 'post',
data: query
})
}
// export function getWorkOrderList(query) {
// return request({
// url: '/base/core-work-order/listbyfilter',
// method: 'get',
// params: query,
// })
// }
// // 导出物料信息
// export function exportEnergyPlcExcel(query) {
// return request({
// url: '/base/material-use-log/materialTraceExport',
// method: 'get',
// params: query,
// responseType: 'blob'
// })
// }

View File

@ -0,0 +1,35 @@
/*
* @Author: zhp
* @Date: 2023-10-31 10:55:20
* @LastEditTime: 2023-10-31 15:05:30
* @LastEditors: zhp
* @Description:
*/
import request from '@/utils/request'
// 获得原料信息追溯page
export function getRawMaterialPage(query) {
return request({
url: '/base/core-work-order-material/page',
method: 'get',
params: query
})
}
export function getWorkOrderList(query) {
return request({
url: '/base/core-work-order/listbyfilter',
method: 'get',
params: query,
})
}
// 导出物料信息
export function exportEnergyPlcExcel(query) {
return request({
url: '/base/material-use-log/materialTraceExport',
method: 'get',
params: query,
responseType: 'blob'
})
}

View File

@ -134,7 +134,7 @@ import printPreview from './preview'
import { MessageBox } from 'element-ui'
import { hiprint } from 'vue-plugin-hiprint'
import providers from './providers'
import printData from './print-data'
// import printData from './print-data'
import $ from 'jquery'
import SmallTitle from './SmallTitle.vue'
let hiprintTemplate = null
@ -160,6 +160,7 @@ export default {
// width: 220,
// height: 80
},
printData:{},
drawer: false,
//
paperTypes: {
@ -355,13 +356,13 @@ export default {
},
preView() {
const { width } = this.curPaper
this.$refs.preView.show(hiprintTemplate, printData, width)
this.$refs.preView.show(hiprintTemplate, this.printData, width)
},
print() {
// if (window.hiwebSocket.opened) {
const printerList = hiprintTemplate.getPrinterList()
console.log(printerList)
hiprintTemplate.print2(printData, { printer: '', title: '预览打印' })
hiprintTemplate.print2(this.printData, { printer: '', title: '预览打印' })
// return
// }
// this.$message.error(',')

View File

@ -1,8 +1,8 @@
/*
* @Author: zwq
* @Date: 2022-08-24 11:19:43
* @LastEditors: DY
* @LastEditTime: 2023-09-21 16:02:07
* @LastEditors: zhp
* @LastEditTime: 2023-11-01 10:30:12
* @Description:
*/
export default {
@ -101,7 +101,7 @@ export default {
},
// 删除
deleteHandle(id, name, index) {
this.$confirm(`确定对${name ? '[名称=' + name + ']' : '[序号=' + index + ']'}进行删除操作?`, "提示", {
this.$confirm(`是否确认删除${name ? '[' + name + ']' : '[' + index + ']'}数据项?`, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",

View File

@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2023-08-01 14:55:51
* @LastEditors: zhp
* @LastEditTime: 2023-10-30 10:44:48
* @LastEditTime: 2023-11-07 19:28:18
* @Description:
-->
<template>
@ -47,6 +47,7 @@ import {
import {
deletePacking,
getPackingPage,
getWorkOrderList,
exportPackingExcel,
} from '@/api/base/packingInfo';
@ -102,35 +103,39 @@ export default {
btnName: '编辑',
}
: undefined,
{
type: 'print',
btnName: '打印',
},
this.$auth.hasPermi(`base:packaging-print-log:delete`)
? {
type: 'delete',
btnName: '删除',
}
: undefined,
{
type: 'print',
btnName: '打印',
},
].filter((v) => v),
tableData: [],
formConfig: [
{
type: 'input',
type: 'select',
label: '工单',
placeholder: '工单',
param: 'workOrderId',
selectOptions: [],
labelField: 'name',
valueField: 'id',
param: 'workOrderId'
},
{
// parent: 'dateFilterType',
//
//
type: 'datePicker',
label: '时间',
dateType: 'date',
placeholder: '选择日期',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd',
// label: '',
dateType: 'daterange',
format: 'yyyy-MM-dd HH:mm:ss',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
defaultTime: ['00:00:00', '00:00:00'],
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'createTime',
},
{
@ -173,7 +178,9 @@ export default {
components: {
AddOrUpdate,
},
created() {},
created() {
this.getDict()
},
methods: {
getDataList() {
this.dataListLoading = true;
@ -183,6 +190,30 @@ export default {
this.dataListLoading = false;
});
},
getDict() {
//
// getCustomerList().then((response) => {
// console.log(response);
// this.customerList = response.data
// // this.listQuery.total = response.data.total;
// })
// getModelList().then((response) => {
// console.log(response);
// this.modelList = response.data
// // this.listQuery.total = response.data.total;
// })
getWorkOrderList().then((response) => {
// console.log(response);
this.formConfig[0].selectOptions = response.data.map((item) => {
return {
name: item.name,
id: item.id
}
})
console.log(this.formConfig[0].selectOptions);
// this.listQuery.total = response.data.total;
})
},
handlePrint(id) {
if (id) {
getPackingModel(id).then(res => {
@ -259,8 +290,14 @@ export default {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.packagingCode = val.packagingCode;
this.listQuery.createTime = val.createTime;
this.listQuery.workOrderId = val.workOrderId;
if (val.createTime && val.createTime.length != 0) {
this.listQuery.createTime = val.createTime
// this.listQuery.createTime[1] = val.timeVal[1]
} else {
this.listQuery.createTime = undefined
// this.listQuery.endTime = undefined
}
this.getDataList();
console.log(this.tableData)
break;

View File

@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2023-08-01 14:55:51
* @LastEditors: zhp
* @LastEditTime: 2023-10-30 10:45:23
* @LastEditTime: 2023-11-01 10:28:29
* @Description:
-->
<template>
@ -44,7 +44,7 @@ const tableProps = [
{
prop: 'printModel',
label: '打印方式',
filter: (val) => val ==1 ? '自动打印' : '动打印',
filter: (val) => val ==1 ? '自动打印' : '动打印',
},
{
prop: 'remark',
@ -71,17 +71,16 @@ export default {
btnName: '编辑',
}
: undefined,
{
type: 'print',
btnName: '打印',
},
this.$auth.hasPermi(`base:packaging-print-model:delete`)
? {
type: 'delete',
btnName: '删除',
}
: undefined,
{
type: 'print',
btnName: '查看',
},
].filter((v) => v),
tableData: [],
formConfig: [
@ -102,12 +101,12 @@ export default {
// valueFormat: 'yyyy-MM-dd',
// param: 'createTime',
// },
{
type: 'button',
btnName: '搜索',
name: 'search',
color: 'primary',
},
// {
// type: 'button',
// btnName: '',
// name: 'search',
// color: 'primary',
// },
// {
// type: 'separate',
// },
@ -121,7 +120,7 @@ export default {
},
{
type: this.$auth.hasPermi('base:packaging-print-model:create') ? 'button' : '',
btnName: '新增',
btnName: '新增模板',
name: 'add',
color: 'success',
plain: true,

View File

@ -1,8 +1,8 @@
/*
* @Author: zwq
* @Date: 2022-08-24 11:19:43
* @LastEditors: zwq
* @LastEditTime: 2023-08-03 14:21:04
* @LastEditors: zhp
* @LastEditTime: 2023-11-06 15:59:53
* @Description:
*/
export default {

View File

@ -1,4 +1,5 @@
<template>
<div>
<el-drawer
title="发货清单详情"
size="60%"
@ -28,7 +29,16 @@
:table-props="tableProps"
:table-data="tableData"
:max-height="tableH"
>
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="80"
label="操作"
:method-list="tableBtn"
@clickBtn="editDetDetail"
/>
</base-table>
<pagination
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
@ -37,10 +47,23 @@
/>
</div>
</el-drawer>
<!-- 编辑详情 -->
<base-dialog
dialogTitle="编辑"
:dialogVisible="detailEditVisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="50%"
>
<edit-detail ref="editDetail" @successSubmit="successSubmit" />
</base-dialog>
</div>
</template>
<script>
import { parseTime } from '@/utils/ruoyi'
import { deliveryLogDetPage } from '@/api/base/delivery'
import EditDetail from './editDetail.vue'
const tableProps = [
{
prop: 'createTime',
@ -51,6 +74,7 @@ const tableProps = [
{
prop: 'deliveryCarCode',
label: '装车单号',
minWidth: 100,
showOverflowtooltip: true
},
{
@ -96,11 +120,21 @@ export default {
total: 0,
tableProps,
tableData: [],
tableBtn: [
this.$auth.hasPermi('extend:delivery-log:update')
? {
type: 'edit',
btnName: '编辑'
}
: undefined
].filter((v) => v),
tableH: this.tableHeight(275),
orderName: '',
code: ''
code: '',
detailEditVisible: false
}
},
components: { EditDetail },
mounted() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(275)
@ -128,6 +162,23 @@ export default {
this.queryParams.logId = ''
this.tableData = []
this.total = 0
},
editDetDetail(val) {
this.detailEditVisible = true
this.$nextTick(() => {
this.$refs.editDetail.init(val.data.id)
})
},
handleCancel() {
this.$refs.editDetail.formClear()
this.detailEditVisible = false
},
handleConfirm() {
this.$refs.editDetail.submitForm()
},
successSubmit() {
this.handleCancel()
this.getList()
}
}
}
@ -154,11 +205,13 @@ export default {
padding: 8px 8px 8px 40px;
.title {
height: 16px;
font-size: 14px;
font-weight: 600;
color: rgba(0,0,0,0.85);
}
.text {
height: 16px;
font-size: 14px;
font-weight: 400;
color: rgba(102,102,102,0.75);
}

View File

@ -0,0 +1,124 @@
<template>
<el-form ref="addOrUpdate" :rules="rules" label-width="130px" :model="form">
<el-row>
<el-col :span='12'>
<el-form-item label="装车单号" prop="deliveryCarCode">
<el-input v-model="form.deliveryCarCode"></el-input>
</el-form-item>
</el-col>
<el-col :span='12'>
<el-form-item label="装车时间" prop="loadTime">
<el-date-picker
v-model="form.loadTime"
type="datetime"
format='yyyy-MM-dd HH:mm:ss'
value-format="timestamp"
style="width: 100%;"
placeholder="选择日期">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span='12'>
<el-form-item label="装车产品" prop="productId">
<el-select v-model="form.productId" disabled placeholder="请选择" style="width: 100%;">
<el-option
v-for="item in productList"
: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="packagingSize">
<el-input-number v-model="form.packagingSize" :min="0" :max='9999999999' style="width:100%"></el-input-number>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span='12'>
<el-form-item label="产品批次" prop="productDate">
<el-input v-model="form.productDate" placeholder="多个批次用','隔开"></el-input>
</el-form-item>
</el-col>
<el-col :span='12'>
<el-form-item label="箱/托数" prop="packagingNum">
<el-input-number v-model="form.packagingNum" :min="0" :max='9999999999' style="width:100%"></el-input-number>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span='12'>
<el-form-item label="装车总量" prop="quantity">
<el-input-number v-model="form.quantity" :min="0" :max='9999999999' style="width:100%"></el-input-number>
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import { getProductAll } from '@/api/base/product'
import { deliveryLogDetGet, deliveryLogDetUpdate } from '@/api/base/delivery'
export default {
name: 'editDetail',
data() {
return {
form: {
logId: '',
deliveryCarCode: '',
loadTime: null,
productId: '',
packagingSize: null,
productDate: '',
packagingNum: null,
quantity: null
},
rules: {
deliveryCarCode: [{ required: true, message: "装车单号不能为空", trigger: "blur" }],
productId: [{ required: true, message: "装车产品不能为空", trigger: "change" }],
packagingSize: [{ required: true, message: "装箱规格不能为空", trigger: "blur" }],
packagingNum: [{ required: true, message: "箱/托数不能为空", trigger: "blur" }],
quantity: [{ required: true, message: "装车总量不能为空", trigger: "blur" }]
},
productList: []
}
},
mounted() {
this.getSelectList()
},
methods: {
init(id) {
deliveryLogDetGet({id}).then(res => {
console.log(res)
this.form = res.data
})
},
getSelectList() {
getProductAll().then(res => {
this.productList = res.data || []
})
},
submitForm() {
this.$refs['addOrUpdate'].validate((valid) => {
if (valid) {
console.log(this.form)
deliveryLogDetUpdate({ ...this.form }).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess("操作成功");
this.$emit('successSubmit')
}
})
} else {
return false
}
})
},
formClear() {
this.$refs.addOrUpdate.resetFields()
}
}
}
</script>

View File

@ -39,7 +39,7 @@
</el-col>
<el-col :span='12'>
<el-form-item label="装车产品" prop="productId">
<el-select v-model="form.productId" placeholder="请选择" style="width: 100%;">
<el-select v-model="form.productId" disabled placeholder="请选择" style="width: 100%;">
<el-option
v-for="item in productList"
:key="item.id"
@ -79,6 +79,7 @@
<script>
import { getProductAll } from '@/api/base/product'
import { deliveryLogDetCreate } from '@/api/base/delivery'
import { orderDetail } from '@/api/base/orderManage'
export default {
name: 'LoadedPage',
data() {
@ -107,16 +108,25 @@ export default {
}
},
methods: {
init(id, code) {
init(id, code, orderId) {
this.getSelectList()
this.form.logId = id
this.code = code
this.getProductId(orderId)
},
getSelectList() {
getProductAll().then(res => {
this.productList = res.data || []
})
},
//
getProductId(orderId) {
orderDetail({
id: orderId
}).then(res => {
this.form.productId = res.data.planProductId || ''
})
},
submitForm() {
this.$refs['addOrUpdate'].validate((valid) => {
if (valid) {

View File

@ -119,7 +119,8 @@ export default {
{
type: 'input',
label: '订单名',
param: 'orderName'
param: 'orderName',
defaultSelect: ''
},
{
type: 'input',
@ -138,10 +139,10 @@ export default {
color: 'primary'
},
{
type: 'separate'
type: this.$auth.hasPermi('extend:delivery-log:create') ? 'separate' : '',
},
{
type: 'button',
type: this.$auth.hasPermi('extend:delivery-log:create') ? 'button' : '',
btnName: '新增',
name: 'add',
color: 'success',
@ -161,25 +162,25 @@ export default {
tableH: this.tableHeight(260),
total: 0,
tableBtn: [
this.$auth.hasPermi('base:group-team:update')
this.$auth.hasPermi('extend:delivery-log:loaded')
? {
type: 'loaded',
btnName: '装车'
}
: undefined,
this.$auth.hasPermi('base:group-team:update')
this.$auth.hasPermi('extend:delivery-log:detail')
? {
type: 'detail',
btnName: '详情'
}
: undefined,
this.$auth.hasPermi('base:group-team:update')
this.$auth.hasPermi('extend:delivery-log:update')
? {
type: 'edit',
btnName: '编辑'
}
: undefined,
this.$auth.hasPermi('base:group-team:delete')
this.$auth.hasPermi('extend:delivery-log:delete')
? {
type: 'delete',
btnName: '删除'
@ -196,10 +197,32 @@ export default {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260)
})
if (location.href.indexOf('?') > 0) {
let arr = location.href.split('?')[1]
this.formConfig[0].defaultSelect = decodeURI(arr.split('=')[1])
} else {
this.formConfig[0].defaultSelect = ''
}
this.queryParams.orderName = this.formConfig[0].defaultSelect
this.getList();
},
components: { AddOrUpdate, LoadedPage, DeliveryLogDetail },
watch: {
$route: 'initData'
},
methods: {
initData(to) {
if (to.name === 'DeliveryLog') {
if (location.href.indexOf('?') > 0) {
let arr = location.href.split('?')[1]
this.formConfig[0].defaultSelect = decodeURI(arr.split('=')[1])
} else {
this.formConfig[0].defaultSelect = ''
}
this.queryParams.orderName = this.formConfig[0].defaultSelect
this.getList()
}
},
getList() {
deliveryLogPage({...this.queryParams}).then(res => {
this.list = res.data.list || []
@ -236,7 +259,7 @@ export default {
case 'loaded':
this.centervisible2 = true
this.$nextTick(() => {
this.$refs.loadedPage.init(val.data.id, val.data.code)
this.$refs.loadedPage.init(val.data.id, val.data.code, val.data.orderId)
})
break
default:
@ -279,7 +302,7 @@ export default {
successSubmit2() {
this.handleCancel2()
this.getList()
},
}
}
}
</script>

View File

@ -19,11 +19,11 @@
<div class="lightTip">{{orderMsg.num ? orderMsg.num : '-'}}</div>
</div>
<div class="box_col">
<div class="blodTip">占比(%)</div>
<div class="blodTip">占比(%)</div>
<div class="lightTip">{{orderMsg.rate ? orderMsg.rate : '-'}}</div>
</div>
<div class="box_col">
<div class="blodTip">运输费用</div>
<div class="blodTip">运输费用</div>
<div class="lightTip">{{orderMsg.cost ? orderMsg.cost : '-'}}</div>
</div>
</div>
@ -305,8 +305,11 @@ export default {
}
},
legend: {
bottom: '5%',
left: 'center',
type: 'scroll',
orient: 'vertical',
right: '10%',
top: 20,
bottom: 20,
icon: 'rect',
itemHeight: 8,
itemWidth: 8
@ -379,12 +382,14 @@ export default {
padding: 8px 8px 8px 40px;
.blodTip {
height: 16px;
font-size: 14px;
font-weight: 600;
color: rgba(0,0,0,0.85);
margin-bottom: 8px;
}
.lightTip {
height: 16px;
font-size: 14px;
font-weight: 400;
color: rgba(102,102,102,0.75);
}
@ -415,11 +420,13 @@ export default {
padding: 8px 8px 8px 40px;
.title {
height: 16px;
font-size: 14px;
font-weight: 600;
color: rgba(0,0,0,0.85);
}
.text {
height: 16px;
font-size: 14px;
font-weight: 400;
color: rgba(102,102,102,0.75);
}

View File

@ -61,7 +61,7 @@ const tableProps = [
},
{
prop: 'rate',
label: '累积发货比例(%'
label: '累计发货比例(%)'
}
]
export default {
@ -92,7 +92,7 @@ export default {
tableH: this.tableHeight(260),
total: 0,
tableBtn: [
this.$auth.hasPermi('base:group-team:update')
this.$auth.hasPermi('extend:delivery-log-det:detail')
? {
type: 'detail',
btnName: '详情'

View File

@ -92,7 +92,7 @@ export default {
color: 'primary'
},
{
type: 'separate'
type: this.$auth.hasPermi('base:energy-type:create') ? 'separate' : '',
},
{
type: this.$auth.hasPermi('base:energy-type:create') ? 'button' : '',

View File

@ -62,8 +62,9 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="消耗量阈值" prop="limitValue">
<el-input-number v-model="form.limitValue" :min="0" :max="10000000000000000" style="width: 100%;"></el-input-number>
<el-form-item label="消耗量阈值">
<el-input-number v-model="form.minValue" placeholder="最小值" :max="10000000000000000" style="width: 50%;"></el-input-number>
<el-input-number v-model="form.maxValue" placeholder="最大值" :max="10000000000000000" style="width: 50%;"></el-input-number>
</el-form-item>
</el-col>
</el-row>
@ -96,14 +97,16 @@ export default {
type: '',
plcParamId: '',
limitType: '',
limitValue: ''
minValue: null,
maxValue: null
},
objIds: [],//
isEdit: false, //
rules: {
objectId: [{ required: true, message: '对象不能为空', trigger: 'change' }],
energyTypeId: [{ required: true, message: '能源类型不能为空', trigger: 'change' }],
type: [{ required: true, message: '监控模式不能为空', trigger: 'change' }]
type: [{ required: true, message: '监控模式不能为空', trigger: 'change' }],
limitType: [{ required: true, message: '指标类型不能为空', trigger: 'change' }]
},
detailList: []
}
@ -199,6 +202,12 @@ export default {
this.$modal.msgError("监控模式为详细时,详细参数为必填");
return false
}
if (this.form.minValue && this.form.maxValue) {
if (this.form.minValue > this.form.maxValue) {
this.$modal.msgError("消耗量阈值,最小值不能大于最大值");
return false
}
}
// this.form.limitType = Number(this.form.limitType)
if (this.isEdit) {
//
@ -223,6 +232,10 @@ export default {
},
formClear() {
this.$refs.form.resetFields()
this.form.type = ''
this.form.plcParamId = ''
this.form.minValue = null
this.form.maxValue = null
this.objIds = ''
this.detailList = []
this.isEdit = false

View File

@ -37,6 +37,7 @@
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width='60%'
>
<energy-limit-add ref="energyLimit" @successSubmit="successSubmit" :energyTypeList="energyTypeList" :objList="objList"/>
</base-dialog>
@ -199,6 +200,15 @@ export default {
item.type = i.label
}
})
if (item.minValue && item.maxValue) {
item.limitValue = item.minValue + '-' + item.maxValue
} else if(item.minValue){
item.limitValue = '最小值' + item.minValue
}else if(item.maxValue){
item.limitValue = '最大值' + item.maxValue
} else {
item.limitValue = ''
}
})
this.list = arr
this.total = response.data.total;

View File

@ -136,6 +136,15 @@ export default {
item.type = i.name
}
})
if (item.minValue && item.maxValue) {
item.limitValue = item.minValue + '-' + item.maxValue
} else if(item.minValue){
item.limitValue = '最小值' + item.minValue
}else if(item.maxValue){
item.limitValue = '最大值' + item.maxValue
} else {
item.limitValue = ''
}
})
this.list = arr
this.total = response.data.total;

View File

@ -121,8 +121,9 @@ export default {
this.tableH = this.tableHeight(260)
this.isFold = this.searchBarWidth('energyReportSearchBox', 1180)
})
if (this.$route.params.startTime && this.$route.params.endTime) {
this.formConfig[2].defaultSelect = [this.$route.params.startTime, this.$route.params.endTime]
if (location.href.indexOf('?') > 0) {
let arr = location.href.split('?')[1].split('&')
this.formConfig[2].defaultSelect = [arr[0].split('=')[1], arr[1].split('=')[1]]
} else {
this.formConfig[2].defaultSelect = [Date.now() - 7*24*3600000, Date.now()]
}
@ -138,8 +139,9 @@ export default {
methods: {
initData(to) {
if (to.name === 'EnergyReportSearch') {
if (this.$route.params.startTime && this.$route.params.endTime) {
this.formConfig[2].defaultSelect = [this.$route.params.startTime, this.$route.params.endTime]
if (location.href.indexOf('?') > 0) {
let arr = location.href.split('?')[1].split('&')
this.formConfig[2].defaultSelect = [arr[0].split('=')[1], arr[1].split('=')[1]]
} else {
this.formConfig[2].defaultSelect = [Date.now() - 7*24*3600000, Date.now()]
}

View File

@ -115,7 +115,7 @@ export default {
type: 'select',
label: '能源类型',
selectOptions: [],
param: 'objType',
param: 'energyTypeId',
filterable: true,
width: 120,
clearable: false
@ -126,7 +126,7 @@ export default {
selectOptions: this.getDictDatas(this.DICT_TYPE.OBJECT_TYPE),
labelField: 'label',
valueField: 'value',
param: 'energyTypeId',
param: 'objType',
width: 100,
clearable: false
},

View File

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

View File

@ -0,0 +1,379 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zhp
* @LastEditTime: 2023-11-10 16:26:08
* @Description:
-->
<template>
<el-drawer :visible.sync="visible" :show-close="false" :wrapper-closable="false" class="drawer" size="50%">
<small-title slot="title" :no-padding="true">
{{ isdetail ? '详情' : !dataForm.id ? '新增' : '编辑' }}
</small-title>
<div class="content">
<div class="visual-part">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()"
label-width="100px" label-position="top">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="设备名称" prop="equipmentId">
<el-select v-model="dataForm.equipmentId" filterable :disabled="isdetail" style="width: 100%"
@change="getCode" placeholder="请选择设备名称">
<el-option v-for="dict in equipmentList" :key=" dict.id" :label="dict.name" :value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="设备编码" prop="equipmentCode">
<el-input v-model="dataForm.equipmentCode" clearable :disabled="isdetail" placeholder="请输入设备编码" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="设备Bom编码" prop="code">
<el-input v-model="dataForm.code" clearable :disabled="isdetail" placeholder="请输入设备Bom编码" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="设备物料BOM名称" prop="name">
<el-input v-model="dataForm.name" clearable :disabled="isdetail" placeholder="请输入设备物料BOM名称" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="当前状态" prop="enabled">
<el-switch v-model="dataForm.enabled" :active-value="1" :inactive-value="0" />
</el-form-item>
</el-col>
</el-row>
<el-form-item label="备注" prop="remark">
<el-input v-model="dataForm.remark" :disabled="isdetail" clearable placeholder="请输入备注" />
</el-form-item>
</el-form>
</div>
<div class="drawer-body__footer">
<el-button style="" @click="goback()">取消</el-button>
<el-button v-if="isdetail" type="primary" @click="goEdit()">
编辑
</el-button>
<el-button v-else type="primary" @click="dataFormSubmit()">确定</el-button>
</div>
<div class="attr-list" v-if="idAttrShow">
<small-title style="margin: 16px 0; padding-left: 8px" :no-padding="true">
设备物料明细
</small-title>
<div v-if="!isdetail" class="action_btn">
<template>
<span style="display: inline-block;">
<el-button type="text" @click="addNew()" icon="el-icon-plus">新增</el-button>
</span>
</template>
</div>
<base-table :table-props="tableProps" :page="listQuery.pageNo" :limit="listQuery.pageSize"
:table-data="productAttrList">
<method-btn v-if="!isdetail" slot="handleBtn" :width="120" label="操作" :method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination v-show="listQuery.total > 0" :total="listQuery.total" :page.sync="listQuery.pageNo"
:limit.sync="listQuery.pageSize" :page-sizes="[5, 10, 15]" @pagination="getList" />
<div class="drawer-body__footer">
<el-button type="primary" @click="goback()">关闭</el-button>
</div>
</div>
</div>
<attr-add v-if="addOrUpdateVisible" ref="addOrUpdate" :product-id="dataForm.id" @refreshDataList="getList" />
</el-drawer>
</template>
<script>
import basicAdd from '../../core/mixins/basic-add';
import {
getProcessEquMaterialBom,
createProcessEquMaterialBom,
updateProcessEquMaterialBom,
getEquipmentList,
processEquMaterialBomDetPage,
deleteProcessEquMaterialBomDet
} from '@/api/extend/processEquMaterialBom';
import SmallTitle from './SmallTitle';
import { parseTime } from '../../core/mixins/code-filter';
import attrAdd from './attr-add';
// import {DICT_TYPE, getDictDatas} from "@/utils/dict";
import { publicFormatter } from '@/utils/dict';
const tableBtn = [
{
type: 'edit',
btnName: '编辑',
},
{
type: 'delete',
btnName: '删除',
},
];
const tableProps = [
{
prop: 'materialName',
label: '物料名称',
},
{
prop: 'materialCode',
label: '物料编码',
},
{
prop: 'unit',
label: '单位',
filter: publicFormatter('unit_dict')
},
{
prop: 'num',
label: '数量',
},
{
prop: 'remark',
label: '备注',
},
];
const topBtnConfig = [
{
type: 'add',
btnName: 'btn.add'
}
]
export default {
mixins: [basicAdd],
components: { SmallTitle, attrAdd },
data() {
return {
tableBtn,
tableProps,
topBtnConfig,
addOrUpdateVisible: false,
urlOptions: {
isGetCode: false,
// codeURL: getCode,
createURL:createProcessEquMaterialBom,
updateURL: updateProcessEquMaterialBom,
infoURL: getProcessEquMaterialBom,
},
listQuery: {
pageSize: 10,
pageNo: 1,
total: 0,
},
equipmentList:[],
dataForm: {
id: undefined,
code: undefined,
name: '',
equipmentId: undefined,
equipmentCode: undefined,
enabled:undefined,
// area: undefined,
// specifications: undefined,
// processTime: 0,
remark: undefined,
// unit: undefined
},
productAttrList: [],
visible: false,
isdetail: false,
idAttrShow: false,
dataRule: {
// code: [{ required: true, message: "", trigger: "blur" }],
name: [{ required: true, message: "设备物料名称不能为空", trigger: "blur" }],
equipmentId: [{ required: true, message: "设备名称不能为空", trigger: "change" }],
// : [{ required: true, message: "", trigger: "change" }],
// processTime: [{ required: true, message: "线", trigger: "blur" }]
}
};
},
mounted() {
this.getDict()
},
methods: {
getCode(val) {
this.equipmentList.forEach((ele) => {
if (val === ele.id) {
this.dataForm.equipmentCode = ele.code
}
})
},
// clickTopBtn(val) {
// if (val === 'add') {
// this.addNew()
// }
// },
initData() {
this.productAttrList.splice(0);
this.listQuery.total = 0;
},
getDict() {
getEquipmentList().then((res) => {
// console.log(res);
// console.log(response);
this.equipmentList = res.data
})
},
handleClick(raw) {
if (raw.type === 'delete') {
this.$confirm(
`确定对${
raw.data.materialName
? '[物料名称为' + raw.data.materialName + ']'
: '[序号为' + raw.data.materialName + ']'
}进行删除操作?`,
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(() => {
deleteProcessEquMaterialBomDet(raw.data.id).then(({ data }) => {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getList();
},
});
});
})
.catch(() => {});
} else {
this.addNew(raw.data.id);
}
},
getList() {
//
processEquMaterialBomDetPage({
...this.listQuery,
bomId: this.dataForm.id,
}).then((response) => {
this.productAttrList = response.data.list;
this.listQuery.total = response.data.total;
});
},
init(id, isdetail) {
this.initData();
this.isdetail = isdetail || false;
this.dataForm.id = id || undefined;
this.visible = true;
if (id) {
this.idAttrShow = true
} else {
this.idAttrShow = false
}
this.$nextTick(() => {
this.$refs['dataForm'].resetFields();
if (this.dataForm.id) {
//
this.urlOptions.infoURL({
bomId: id,
pageNo: 1,
pageSize:10
}).then(response => {
this.dataForm = response.data
this.dataForm.unit = String(this.dataForm.unit)
this.dataForm.materialType = String(this.dataForm.materialType)
this.dataForm.productType = String(this.dataForm.productType)
});
//
this.getList();
} else {
if (this.urlOptions.isGetCode) {
this.getCode()
}
}
});
},
goback() {
this.$emit('refreshDataList');
this.visible = false;
// this.initData();
},
goEdit() {
this.isdetail = false;
},
// /
addNew(id) {
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id,this.dataForm.id);
});
}
}
};
</script>
<style scoped>
.drawer >>> .el-drawer {
border-radius: 8px 0 0 8px;
display: flex;
flex-direction: column;
}
.drawer >>> .el-form-item__label {
padding: 0;
}
.drawer >>> .el-drawer__header {
margin: 0;
padding: 32px 32px 24px;
border-bottom: 1px solid #dcdfe6;
}
.drawer >>> .el-drawer__body {
flex: 1;
height: 1px;
display: flex;
flex-direction: column;
}
.drawer >>> .content {
padding: 30px 24px;
flex: 1;
display: flex;
flex-direction: column;
/* height: 100%; */
}
.drawer >>> .visual-part {
flex: 1 auto;
max-height: 76vh;
overflow: hidden;
overflow-y: scroll;
padding-right: 10px; /* 调整滚动条样式 */
}
.drawer >>> .el-form,
.drawer >>> .attr-list {
padding: 0 16px;
}
.drawer-body__footer {
display: flex;
justify-content: flex-end;
padding: 18px;
}
.action_btn {
float: right;
margin: 5px 15px;
font-size: 14px;
}
.add {
color: #0b58ff;
}
</style>

View File

@ -0,0 +1,149 @@
<!--
* @Author: zhp
* @Date: 2023-11-08 15:30:27
* @LastEditTime: 2023-11-09 14:11:02
* @LastEditors: zhp
* @Description:
-->
<template>
<el-dialog :visible.sync="visible" :width="'35%'" :append-to-body="true" :close-on-click-modal="false" class="dialog">
<template #title>
<slot name="title">
<div class="titleStyle">
{{ !dataForm.id ? '新增' : '编辑' }}
</div>
</slot>
</template>
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="100px"
@keyup.enter.native="dataFormSubmit()">
<el-form-item label="物料名称" prop="materialId">
<el-select v-model="dataForm.materialId" filterable placeholder="请选择物料名称">
<el-option v-for="dict in materialList" :key=" dict.id" :label="dict.name" :value="dict.id" />
</el-select>
</el-form-item>
<el-form-item label="数量" prop="num">
<el-input v-model="dataForm.num" placeholder="请输入数量" clearable />
</el-form-item>
</el-form>
<el-row style="text-align: right">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</el-row>
</el-dialog>
</template>
<script>
import {
getProcessEquMaterialBomDet,
createProcessEquMaterialBomDet,
updateProcessEquMaterialBomDet,
getMaterialList
} from '@/api/extend/processEquMaterialBom';
export default {
props: {
productId: {
type: String,
default: '',
},
},
data() {
return {
visible: false,
materialList:[],
dataForm: {
id: undefined,
bomId: undefined,
materialId:null,
num: undefined,
},
dataRule: {
attrName: [{ required: true, message: '名称不能为空', trigger: 'blur' }],
},
};
},
mounted () {
this.getDict();
},
methods: {
init(id,bomId) {
this.dataForm.id = id || '';
this.dataForm.bomId = bomId || '';
console.log(bomId);
this.visible = true;
this.$nextTick(() => {
this.$refs['dataForm'].resetFields();
if (this.dataForm.id) {
getProcessEquMaterialBomDet({
id: this.dataForm.id
}).then((res) => {
this.dataForm = res.data;
// this.dataForm.materialId = materialId;
// this.dataForm.value = value;
});
}
});
},
getDict() {
getMaterialList().then((res) => [
this.materialList = res.data,
console.log(res)
])
},
//
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
//
if (this.dataForm.id) {
updateProcessEquMaterialBomDet({
...this.dataForm,
productId: this.productId,
}).then((response) => {
this.$modal.msgSuccess('修改成功');
this.visible = false;
this.$emit('refreshDataList');
});
return;
}
//
createProcessEquMaterialBomDet({
...this.dataForm,
productId: this.productId,
}).then((response) => {
this.$modal.msgSuccess('新增成功');
this.visible = false;
this.$emit('refreshDataList');
});
}
});
},
},
};
</script>
<style scoped>
.dialog >>> .el-dialog__body {
padding: 30px 24px;
}
.dialog >>> .el-dialog__header {
font-size: 16px;
color: rgba(0, 0, 0, 0.85);
font-weight: 500;
padding: 13px 24px;
border-bottom: 1px solid #e9e9e9;
}
.dialog >>> .el-dialog__header .titleStyle::before {
content: '';
display: inline-block;
width: 4px;
height: 16px;
background-color: #0b58ff;
border-radius: 1px;
margin-right: 8px;
position: relative;
top: 2px;
}
</style>

View File

@ -0,0 +1,203 @@
<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="120" label="操作" :method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination :limit.sync="listQuery.pageSize" :page.sync="listQuery.pageNo" :total="listQuery.total"
@pagination="getDataList" />
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" />
<!-- <detail-or-update v-if="detailOrUpdateVisible" ref="detailOrUpdate" @refreshDataList="successSubmit" /> -->
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
// import DetailOrUpdate from './detail-or-updata';
import basicPage from '../../core/mixins/basic-page';
import StatusBtn from './statusBtn.vue'
import {
processEquMaterialBomPage,
deleteProcessEquMaterialBom,
getEquipmentList
} from '@/api/extend/processEquMaterialBom';
const tableProps = [
{
prop: 'equipmentCode',
label: '设备编码',
},
{
prop: 'equipmentName',
label: '设备名称'
},
{
prop: 'code',
label: '物料配方编码'
},
{
prop: 'name',
label: '物料配方名称'
},
{
prop: 'enabled',
label: '当前激活状态',
subcomponent: StatusBtn
},
{
prop: 'remark',
label: '备注'
},
];
export default {
mixins: [basicPage],
data() {
return {
urlOptions: {
getDataListURL: processEquMaterialBomPage,
deleteURL: deleteProcessEquMaterialBom,
// exportURL: exportFactoryExcel,
},
tableProps,
tableBtn: [
this.$auth.hasPermi(`extend:process-equ-material-bom:update`)
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
this.$auth.hasPermi(`extend:process-equ-material-bom:detail`)
? {
type: 'detail',
btnName: '详情',
}
: undefined,
this.$auth.hasPermi(`extend:process-equ-material-bom:delete`)
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v)=>v),
tableData: [],
detailOrUpdateVisible:false,
formConfig: [
{
type: 'select',
label: '设备名称',
selectOptions: [],
labelField: 'name',
valueField: 'id',
param: 'equipmentId',
},
{
type: 'input',
label: '物料配方名称',
// selectOptions: [],
// labelField: 'name',
// valueField: 'id',
param: 'name',
},
{
type: 'input',
label: '物料配方编码',
// selectOptions: [],
// labelField: 'name',
// valueField: 'id',
param: 'code',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: this.$auth.hasPermi('extend:process-equ-material-bom:create') ? 'button' : '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true
},
],
};
},
components: {
AddOrUpdate,
// DetailOrUpdate
},
created() {
this.getDict()
},
methods: {
otherMethods(val) {
if (val.type === 'detail') {
this.addOrUpdateVisible = true;
this.addOrEditTitle = "详情";
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data.id, true);
});
}
},
getDict() {
getEquipmentList().then((res) => {
// console.log(res);
// console.log(response);
this.formConfig[0].selectOptions = res.data.map((item) => {
return {
name: item.name,
id: item.id
}
})
})
},
//
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;
});
},
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.equipmentId = val.equipmentId ? val.equipmentId : undefined;
this.listQuery.name = val.name ? val.name : undefined;
this.listQuery.name = val.name ? val.name : undefined;
this.getDataList();
break;
case 'reset':
this.$refs.searchBarForm.resetForm();
this.listQuery = {
pageSize: 10,
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,67 @@
<!--
* @Author: zhp
* @Date: 2023-11-08 14:00:52
* @LastEditTime: 2023-11-08 14:46:27
* @LastEditors: zhp
* @Description:
-->
<template>
<el-switch v-model="state" type="text" size="small" @change="changeHandler" />
</template>
<script>
import {
// processEquMaterialBomPage,
updateProcessEquMaterialBom,
// getWorkOrderList,
// getTeamList
} from '@/api/extend/processEquMaterialBom';
export default {
props: {
injectData: {
type: Object,
default: () => ({})
}
},
data() {
return {
state: false
}
},
// computed: {
// readonly() {
// return !!this.injectData.readonly
// }
// },
mounted() {
this.mapToState()
},
methods: {
mapToState() {
if (this.injectData.prop === 'enabled') {
this.state = this.injectData.enabled === 1 ? true : false
}
},
changeHandler() {
// let params = {}
let payload = {}
// params.name = 'state'
payload.id = this.injectData.id
payload.enabled = this.state ? '1' : '0'
payload.code = this.injectData.code
payload.name = this.injectData.name
payload.equipmentId = this.injectData.equipmentId
payload.remark = this.injectData.remark
// params.payload = payload
updateProcessEquMaterialBom(payload).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess("操作成功");
}
})
// this.$emit('emitData', params)
}
}
}
</script>

View File

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

View File

@ -0,0 +1,391 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zhp
* @LastEditTime: 2023-11-09 14:49:16
* @Description:
-->
<template>
<el-drawer :visible.sync="visible" :show-close="false" :wrapper-closable="false" class="drawer" size="50%">
<small-title slot="title" :no-padding="true">
{{ isdetail ? '详情' : !dataForm.id ? '新增' : '编辑' }}
</small-title>
<div class="content">
<div class="visual-part">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()"
label-width="100px" label-position="top">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="设备名称" prop="equipmentId">
<el-select v-model="dataForm.equipmentId" filterable :disabled="isdetail" style="width: 100%"
@change="getCode" placeholder="请选择设备名称">
<el-option v-for="dict in equipmentList" :key=" dict.id" :label="dict.name" :value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="设备编码" prop="equipmentCode">
<el-input v-model="dataForm.equipmentCode" clearable :disabled="isdetail" placeholder="请输入设备编码" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="参数Bom编码" prop="code">
<el-input v-model="dataForm.code" clearable :disabled="isdetail" placeholder="请输入参数Bom编码" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="设备参数BOM名称" prop="name">
<el-input v-model="dataForm.name" clearable :disabled="isdetail" placeholder="请输入设备参数BOM名称" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="当前状态" prop="enabled">
<el-switch v-model="dataForm.enabled" :active-value="1" :inactive-value="0" />
</el-form-item>
</el-col>
</el-row>
<el-form-item label="备注" prop="remark">
<el-input v-model="dataForm.remark" :disabled="isdetail" clearable placeholder="请输入备注" />
</el-form-item>
</el-form>
</div>
<div class="drawer-body__footer">
<el-button style="" @click="goback()">取消</el-button>
<el-button v-if="isdetail" type="primary" @click="goEdit()">
编辑
</el-button>
<el-button v-else type="primary" @click="dataFormSubmit()">确定</el-button>
</div>
<div class="attr-list" v-if="idAttrShow">
<small-title style="margin: 16px 0; padding-left: 8px" :no-padding="true">
设备物料明细
</small-title>
<div v-if="!isdetail" class="action_btn">
<template>
<span style="display: inline-block;">
<el-button type="text" @click="addNew()" icon="el-icon-plus">新增</el-button>
</span>
</template>
</div>
<base-table :table-props="tableProps" :page="listQuery.pageNo" :limit="listQuery.pageSize"
:table-data="productAttrList">
<method-btn v-if="!isdetail" slot="handleBtn" :width="120" label="操作" :method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination v-show="listQuery.total > 0" :total="listQuery.total" :page.sync="listQuery.pageNo"
:limit.sync="listQuery.pageSize" :page-sizes="[5, 10, 15]" @pagination="getList" />
<div class="drawer-body__footer">
<el-button type="primary" @click="goback()">关闭</el-button>
</div>
</div>
</div>
<attr-add v-if="addOrUpdateVisible" ref="addOrUpdate" :product-id="dataForm.id" @refreshDataList="getList" />
</el-drawer>
</template>
<script>
import basicAdd from '../../core/mixins/basic-add';
import {
getProcessEquValueBom,
createProcessEquValueBom,
updateProcessEquValueBom,
getEquipmentList,
processEquValueBomDetPage,
deleteProcessEquValueBomDet
} from '@/api/extend/processEquValueBom';
import SmallTitle from './SmallTitle';
import { parseTime } from '../../core/mixins/code-filter';
import attrAdd from './attr-add';
// import {DICT_TYPE, getDictDatas} from "@/utils/dict";
const tableBtn = [
{
type: 'edit',
btnName: '编辑',
},
{
type: 'delete',
btnName: '删除',
},
];
const tableProps = [
{
prop: 'valueName',
label: '参数名称',
},
{
prop: 'valueCode',
label: '参数编码',
},
{
prop: 'standardMinValue',
label: '最小值(标准)',
},
{
prop: 'standardMaxValue',
label: '最大值(标准)',
},
{
prop: 'minValue',
label: '最小值(工艺)',
},
{
prop: 'manValue',
label: '最大值(工艺)',
},
{
prop: 'defaultValue',
label: '标准值(工艺)',
},
{
prop: 'remark',
label: '备注',
},
];
const topBtnConfig = [
{
type: 'add',
btnName: 'btn.add'
}
]
export default {
mixins: [basicAdd],
components: { SmallTitle, attrAdd },
data() {
return {
tableBtn,
tableProps,
topBtnConfig,
addOrUpdateVisible: false,
urlOptions: {
isGetCode: false,
// codeURL: getCode,
createURL:createProcessEquValueBom,
updateURL: updateProcessEquValueBom,
infoURL: getProcessEquValueBom,
},
listQuery: {
pageSize: 10,
pageNo: 1,
total: 0,
},
equipmentList:[],
dataForm: {
id: undefined,
code: undefined,
name: '',
equipmentId: undefined,
equipmentCode: undefined,
enabled:undefined,
// area: undefined,
// specifications: undefined,
// processTime: 0,
remark: undefined,
// unit: undefined
},
productAttrList: [],
visible: false,
isdetail: false,
idAttrShow: false,
dataRule: {
// code: [{ required: true, message: "", trigger: "blur" }],
name: [{ required: true, message: "设备参数名称不能为空", trigger: "blur" }],
equipmentId: [{ required: true, message: "设备名称不能为空", trigger: "change" }],
// : [{ required: true, message: "", trigger: "change" }],
// processTime: [{ required: true, message: "线", trigger: "blur" }]
}
};
},
mounted() {
this.getDict()
},
methods: {
getCode(val) {
this.equipmentList.forEach((ele) => {
if (val === ele.id) {
this.dataForm.equipmentCode = ele.code
}
})
},
// clickTopBtn(val) {
// if (val === 'add') {
// this.addNew()
// }
// },
initData() {
this.productAttrList.splice(0);
this.listQuery.total = 0;
},
getDict() {
getEquipmentList().then((res) => {
// console.log(res);
// console.log(response);
this.equipmentList = res.data
})
},
handleClick(raw) {
if (raw.type === 'delete') {
this.$confirm(
`确定对${
raw.data.valueName
? '[物料名称为' + raw.data.valueName + ']'
: '[序号为' + raw.data.valueName + ']'
}进行删除操作?`,
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(() => {
deleteProcessEquValueBomDet(raw.data.id).then(({ data }) => {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getList();
},
});
});
})
.catch(() => {});
} else {
this.addNew(raw.data.id);
}
},
getList() {
//
processEquValueBomDetPage({
...this.listQuery,
bomId: this.dataForm.id,
}).then((response) => {
this.productAttrList = response.data.list;
this.listQuery.total = response.data.total;
});
},
init(id, isdetail) {
this.initData();
console.log(isdetail);
this.isdetail = isdetail || false;
this.dataForm.id = id || undefined;
this.visible = true;
if (id) {
this.idAttrShow = true
} else {
this.idAttrShow = false
}
this.$nextTick(() => {
this.$refs['dataForm'].resetFields();
if (this.dataForm.id) {
//
this.urlOptions.infoURL({
bomId: id,
pageNo: 1,
pageSize:10
}).then(response => {
this.dataForm = response.data
// this.dataForm.unit = String(this.dataForm.unit)
// this.dataForm.ValueType = String(this.dataForm.ValueType)
// this.dataForm.productType = String(this.dataForm.productType)
});
//
this.getList();
} else {
if (this.urlOptions.isGetCode) {
this.getCode()
}
}
});
},
goback() {
this.$emit('refreshDataList');
this.visible = false;
// this.initData();
},
goEdit() {
this.isdetail = false;
},
// /
addNew(id) {
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id,this.dataForm.id,this.dataForm.equipmentId);
});
}
}
};
</script>
<style scoped>
.drawer >>> .el-drawer {
border-radius: 8px 0 0 8px;
display: flex;
flex-direction: column;
}
.drawer >>> .el-form-item__label {
padding: 0;
}
.drawer >>> .el-drawer__header {
margin: 0;
padding: 32px 32px 24px;
border-bottom: 1px solid #dcdfe6;
}
.drawer >>> .el-drawer__body {
flex: 1;
height: 1px;
display: flex;
flex-direction: column;
}
.drawer >>> .content {
padding: 30px 24px;
flex: 1;
display: flex;
flex-direction: column;
/* height: 100%; */
}
.drawer >>> .visual-part {
flex: 1 auto;
max-height: 76vh;
overflow: hidden;
overflow-y: scroll;
padding-right: 10px; /* 调整滚动条样式 */
}
.drawer >>> .el-form,
.drawer >>> .attr-list {
padding: 0 16px;
}
.drawer-body__footer {
display: flex;
justify-content: flex-end;
padding: 18px;
}
.action_btn {
float: right;
margin: 5px 15px;
font-size: 14px;
}
.add {
color: #0b58ff;
}
</style>

View File

@ -0,0 +1,189 @@
<!--
* @Author: zhp
* @Date: 2023-11-08 15:30:27
* @LastEditTime: 2023-11-09 14:44:49
* @LastEditors: zhp
* @Description:
-->
<template>
<el-dialog :visible.sync="visible" :width="'35%'" :append-to-body="true" :close-on-click-modal="false" class="dialog">
<template #title>
<slot name="title">
<div class="titleStyle">
{{ !dataForm.id ? '新增' : '编辑' }}
</div>
</slot>
</template>
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="100px"
@keyup.enter.native="dataFormSubmit()">
<el-form-item label="参数名称" prop="paramId">
<el-select v-model="dataForm.paramId" filterable placeholder="参数名称" @change="getData">
<el-option v-for="dict in materialList" :key=" dict.id" :label="dict.name" :value="dict.id" />
</el-select>
</el-form-item>
<!-- <el-form-item label="参数编码" prop="code">
<el-input v-model="dataForm.code" placeholder="请输入参数编码" clearable />
</el-form-item> -->
<el-form-item label="标准最小值" prop="standardMinValue">
<el-input v-model="dataForm.standardMinValue" placeholder="请输入标准最小值" clearable />
</el-form-item>
<el-form-item label="标准最大值" prop="standardMaxValue">
<el-input v-model="dataForm.standardMaxValue" placeholder="请输入标准最大值" clearable />
</el-form-item>
<el-form-item label="工艺最小值" prop="minValue">
<el-input v-model="dataForm.minValue" placeholder="请输入工艺最小值" clearable />
</el-form-item>
<el-form-item label="工艺最大值" prop="maxValue">
<el-input v-model="dataForm.maxValue" placeholder="请输入工艺最大值" clearable />
</el-form-item>
<el-form-item label="工艺标准值" prop="defaultValue">
<el-input v-model="dataForm.defaultValue" placeholder="请输入工艺标准值" clearable />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="dataForm.remark" placeholder="请输入备注" clearable />
</el-form-item>
</el-form>
<el-row style="text-align: right">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</el-row>
</el-dialog>
</template>
<script>
import {
getProcessEquValueBomDet,
createProcessEquValueBomDet,
updateProcessEquValueBomDet,
getValueList
} from '@/api/extend/processEquValueBom';
export default {
props: {
productId: {
type: String,
default: '',
},
},
data() {
return {
visible: false,
materialList:[],
dataForm: {
id: undefined,
bomId: undefined,
paramId:undefined,
minValue:undefined,
maxValue: undefined,
defaultValue: undefined,
standardMinValue: undefined,
standardMaxValue: undefined,
remark:null
},
equipmentId:null,
dataRule: {
attrName: [{ required: true, message: '名称不能为空', trigger: 'blur' }],
},
};
},
mounted () {
},
methods: {
getData(val) {
this.materialList.forEach((ele) => {
if (val === ele.id) {
console.log(ele)
this.dataForm.code = ele.code
this.dataForm.standardMinValue = ele.minValue
this.dataForm.standardMaxValue = ele.maxValue
// this.dataForm.code = ele.id
}
})
},
init(id, bomId, equipmentId) {
console.log(equipmentId);
this.dataForm.id = id || '';
this.dataForm.bomId = bomId || '';
this.equipmentId = equipmentId
this.getDict()
console.log(bomId);
this.visible = true;
this.$nextTick(() => {
this.$refs['dataForm'].resetFields();
if (this.dataForm.id) {
getProcessEquValueBomDet({
id: this.dataForm.id
}).then((res) => {
this.dataForm = res.data;
// this.dataForm.materialId = materialId;
// this.dataForm.value = value;
});
}
});
},
getDict() {
console.log(this.equipmentId);
getValueList({
id: this.equipmentId
}).then((res) => [
this.materialList = res.data,
console.log(res)
])
},
//
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
//
if (this.dataForm.id) {
updateProcessEquValueBomDet({
...this.dataForm,
productId: this.productId,
}).then((response) => {
this.$modal.msgSuccess('修改成功');
this.visible = false;
this.$emit('refreshDataList');
});
return;
}
//
createProcessEquValueBomDet({
...this.dataForm,
productId: this.productId,
}).then((response) => {
this.$modal.msgSuccess('新增成功');
this.visible = false;
this.$emit('refreshDataList');
});
}
});
},
},
};
</script>
<style scoped>
.dialog >>> .el-dialog__body {
padding: 30px 24px;
}
.dialog >>> .el-dialog__header {
font-size: 16px;
color: rgba(0, 0, 0, 0.85);
font-weight: 500;
padding: 13px 24px;
border-bottom: 1px solid #e9e9e9;
}
.dialog >>> .el-dialog__header .titleStyle::before {
content: '';
display: inline-block;
width: 4px;
height: 16px;
background-color: #0b58ff;
border-radius: 1px;
margin-right: 8px;
position: relative;
top: 2px;
}
</style>

View File

@ -0,0 +1,203 @@
<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="120" label="操作" :method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination :limit.sync="listQuery.pageSize" :page.sync="listQuery.pageNo" :total="listQuery.total"
@pagination="getDataList" />
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" />
<!-- <detail-or-update v-if="detailOrUpdateVisible" ref="detailOrUpdate" @refreshDataList="successSubmit" /> -->
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
// import DetailOrUpdate from './detail-or-updata';
import basicPage from '../../core/mixins/basic-page';
import StatusBtn from './statusBtn.vue'
import {
processEquValueBomPage,
deleteProcessEquValueBom,
getEquipmentList
} from '@/api/extend/processEquValueBom';
const tableProps = [
{
prop: 'equipmentCode',
label: '设备编码',
},
{
prop: 'equipmentName',
label: '设备名称'
},
{
prop: 'code',
label: '参数配方编码'
},
{
prop: 'name',
label: '参数配方名称'
},
{
prop: 'enabled',
label: '当前激活状态',
subcomponent: StatusBtn
},
{
prop: 'remark',
label: '备注'
},
];
export default {
mixins: [basicPage],
data() {
return {
urlOptions: {
getDataListURL: processEquValueBomPage,
deleteURL: deleteProcessEquValueBom,
// exportURL: exportFactoryExcel,
},
tableProps,
tableBtn: [
this.$auth.hasPermi(`extend:process-equ-value-bom:update`)
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
this.$auth.hasPermi(`extend:process-equ-value-bom:detail`)
? {
type: 'detail',
btnName: '详情',
}
: undefined,
this.$auth.hasPermi(`extend:process-equ-value-bom:delete`)
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v)=>v),
tableData: [],
detailOrUpdateVisible:false,
formConfig: [
{
type: 'select',
label: '设备名称',
selectOptions: [],
labelField: 'name',
valueField: 'id',
param: 'equipmentId',
},
{
type: 'input',
label: '物料配方名称',
// selectOptions: [],
// labelField: 'name',
// valueField: 'id',
param: 'name',
},
{
type: 'input',
label: '物料配方编码',
// selectOptions: [],
// labelField: 'name',
// valueField: 'id',
param: 'code',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: this.$auth.hasPermi('extend:process-equ-value-bom:create') ? 'button' : '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true
},
],
};
},
components: {
AddOrUpdate,
// DetailOrUpdate
},
created() {
this.getDict()
},
methods: {
otherMethods(val) {
if (val.type === 'detail') {
this.addOrUpdateVisible = true;
this.addOrEditTitle = "详情";
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data.id, true);
});
}
},
getDict() {
getEquipmentList().then((res) => {
// console.log(res);
// console.log(response);
this.formConfig[0].selectOptions = res.data.map((item) => {
return {
name: item.name,
id: item.id
}
})
})
},
//
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;
});
},
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.equipmentId = val.equipmentId ? val.equipmentId : undefined;
this.listQuery.name = val.name ? val.name : undefined;
this.listQuery.name = val.name ? val.name : undefined;
this.getDataList();
break;
case 'reset':
this.$refs.searchBarForm.resetForm();
this.listQuery = {
pageSize: 10,
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,67 @@
<!--
* @Author: zhp
* @Date: 2023-11-08 14:00:52
* @LastEditTime: 2023-11-09 09:59:53
* @LastEditors: zhp
* @Description:
-->
<template>
<el-switch v-model="state" type="text" size="small" @change="changeHandler" />
</template>
<script>
import {
// processEquMaterialBomPage,
updateProcessEquValueBom,
// getWorkOrderList,
// getTeamList
} from '@/api/extend/processEquValueBom';
export default {
props: {
injectData: {
type: Object,
default: () => ({})
}
},
data() {
return {
state: false
}
},
// computed: {
// readonly() {
// return !!this.injectData.readonly
// }
// },
mounted() {
this.mapToState()
},
methods: {
mapToState() {
if (this.injectData.prop === 'enabled') {
this.state = this.injectData.enabled === 1 ? true : false
}
},
changeHandler() {
// let params = {}
let payload = {}
// params.name = 'state'
payload.id = this.injectData.id
payload.enabled = this.state ? 1 : 0
payload.code = this.injectData.code
payload.name = this.injectData.name
payload.equipmentId = this.injectData.equipmentId
payload.remark = this.injectData.remark
// params.payload = payload
updateProcessEquValueBom(payload).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess("操作成功");
}
})
// this.$emit('emitData', params)
}
}
}
</script>

View File

@ -40,7 +40,7 @@ import ProcessNode, { createProcessNode, CACHE_NAME, getSectionFrom } from './Pr
import DialogForm from '@/components/DialogForm';
// import { IdToName } from '@/utils'
Graph.registerNode('process-node', ProcessNode);
Graph.registerNode('process-node', ProcessNode,true);
export default {
name: 'ProcessGraph',

View File

@ -0,0 +1,267 @@
<!--
* @Author: zwq
* @Date: 2023-08-01 14:55:51
* @LastEditors: zhp
* @LastEditTime: 2023-11-10 10:23:33
* @Description:
-->
<template>
<div class="app-container">
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
<base-table :table-props="tableProps" :page="listQuery.pageNo" :limit="listQuery.pageSize" :table-data="list">
<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="getList" />
<!-- <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" /> -->
</div>
</template>
<script>
// import AddOrUpdate from './add-or-updata';
// import unitDict from './unitDict';
// import basicPage from '../mixins/basic-page';
import { parseTime } from '../../core/mixins/code-filter';
import {
getProcessTraceabilityPage,
getWorkOrderList,
// exportEnergyPlcExcel
} from '@/api/quality/processTraceability';
const tableProps = [
{
prop: 'name',
label: '工单名称'
},
{
prop: 'code',
label: '工单编码'
},
{
prop: 'planProductName',
label: '产品名'
},
{
prop: 'status',
label: '状态'
},
{
prop: 'startProduceTime',
label: '开始生产时间',
filter: parseTime
},
{
prop: 'finishProduceTime',
label: '结束生产时间',
filter: parseTime
},
{
prop: 'actualQuantity',
label: '生产数量'
},
{
prop: 'unit',
label: '单位'
},
{
prop: 'processFlowName',
label: '工艺名称'
},
{
prop: 'yield',
label: '成品率'
}
];
export default {
// mixins: [basicPage],
data() {
return {
// urlOptions: {
// getDataListURL: getMaterialUseLogPage,
// // deleteURL: deletePackingType,
// // exportURL: exportPackingExcel,
// },
tableProps,
tableBtn: [
// this.$auth.hasPermi(`base:packaging-print-log:update`)
// ? {
// type: 'edit',
// btnName: '',
// }
// : undefined,
{
type: 'processDetail',
btnName: '查看工艺详情',
},
].filter((v) => v),
list: [],
listQuery: {
pageSize: 10,
pageNo: 1,
// total: 0,
// orderName: '',
// startTime: undefined,
// endTime:undefined,
},
formConfig: [
{
type: 'select',
label: '工单',
selectOptions: [],
labelField: 'name',
valueField: 'id',
param: 'orderName'
},
// {
// type: 'datePicker',
// label: '',
// dateType: 'daterange',
// format: 'yyyy-MM-dd',
// valueFormat: "yyyy-MM-dd",
// rangeSeparator: '-',
// startPlaceholder: '',
// endPlaceholder: '',
// param: 'timeVal',
// defaultSelect: [],
// width: 250
// },
{
type: 'button',
btnName: '搜索',
name: 'search',
color: 'primary',
},
// {
// type: 'separate',
// },
// {
// type: 'button',
// btnName: '',
// name: 'reset',
// },
// {
// type: 'separate',
// },
// {
// type: this.$auth.hasPermi('base:packaging-print-log:create') ? 'button' : '',
// btnName: '',
// name: 'add',
// color: 'success',
// plain: true,
// },
// {
// type: 'separate',
// type: this.$auth.hasPermi('base:product:create') ? 'separate' : '',
// },
// {
// type: this.$auth.hasPermi('monitoring:materiel-date-from:export') ? 'button' : '',
// btnName: '',
// name: 'export',
// color: 'warning',
// },
],
};
},
components: {
// AddOrUpdate,
},
created() {
this.getList()
this.getDict()
},
methods: {
getList() {
getProcessTraceabilityPage(this.listQuery).then(res => {
this.list = res.data.list || []
this.listQuery.total = res.data.total || 0
})
},
handleClick(val) {
if (val.type === "processDetail") {
console.log(val);
this.$router.push({
name: 'process-traceability-detail',
params: {
id: '1715180991838887938',
orderId: val.data.id,
name: val.data.name,
productName: val.data.planProductName,
processFlowName: val.data.processFlowName
// equipmentName,
},
});
// this.deleteHandle(val.data.id, val.data.name, val.data._pageIndex)
}
},
getDict() {
//
// getCustomerList().then((response) => {
// console.log(response);
// this.customerList = response.data
// // this.listQuery.total = response.data.total;
// })
// getModelList().then((response) => {
// console.log(response);
// this.modelList = response.data
// // this.listQuery.total = response.data.total;
// })
getWorkOrderList().then((response) => {
// console.log(response);
this.formConfig[0].selectOptions = response.data.map((item) => {
return {
name: item.name,
id: item.name
}
})
console.log(this.formConfig[0].selectOptions);
// this.listQuery.total = response.data.total;
})
},
// handleExport() {
// //
// let params = { ...this.listQuery };
// params.pageNo = undefined;
// params.pageSize = undefined;
// this.$modal.confirm('?').then(() => {
// this.exportLoading = true;
// return exportEnergyPlcExcel(params);
// }).then(response => {
// this.$download.excel(response, ' ');
// this.exportLoading = false;
// }).catch(() => { });
// },
buttonClick(val) {
console.log(val)
if (val.btnName === 'search') {
this.listQuery.orderName = val.orderName ? val.orderName :undefined
// this.queryParams.status = val.status
// if (val.timeVal && val.timeVal.length != 0 ) {
// this.listQuery.startTime = val.timeVal[0] + ' 00:00:00'
// this.listQuery.endTime = val.timeVal[1] + ' 23:59:59'
// } else {
// this.listQuery.startTime = undefined
// this.listQuery.endTime = undefined
// }
this.getList()
} else {
// this.handleExport()
// this.addOrEditTitle = ''
// this.centervisible = true
// this.$nextTick(() => {
// this.$refs.orderAdd.init()
// })
}
},
otherMethods(val) {
this.addOrUpdateVisible = true;
this.addOrEditTitle = '详情';
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data.id, true);
});
},
},
};
</script>

View File

@ -0,0 +1,302 @@
<!--
filename: ProcessBomList.vue
author: liubin
date: 2023-10-20 15:00:58
description:
-->
<template>
<section class="process-bom">
<SearchBar :formConfigs="searchBarFormConfig" ref="search-bar" @headBtnClick="handleSearchBarBtnClick" />
<!-- <small-title :no-padding="true">
设备名称: {{ name }}
</small-title> -->
<div class="btns" style="
text-align: right;
position: absolute;
top: 20px;
right: 20px;
display: flex;
">
<!-- <el-input icon="el-icon-search" placeholder="搜索" v-model="searchText" style="margin-left: 20px">
<i slot="prefix" class="el-input__icon el-icon-search"></i>
</el-input>
<el-button type="primary" plain :disabled="currentDet == null" class="btn-create" icon="el-icon-plus">
分配设备
</el-button> -->
</div>
<!-- 列表 -->
<el-row>
<div style="margin-bottom: 10px;font-size: 16px;">设备名称{{ name }}</div>
<el-col class="custom-tabs">
<el-tabs v-model="activeName" :stretch="true" @tab-click="handleTabClick">
<el-tab-pane :label="'\u2002物料追溯\u2002'" name="material">
<!-- 列表 -->
<base-table class="base-table__margin" :table-props="materialTableProps" :page="1" :limit="10"
:table-data="materialList" @emitFun="handleEmitFun"></base-table>
</el-tab-pane>
<el-tab-pane :label="'\u3000参数追溯\u3000'" name="value" style="overflow: inherit">
<base-table class="base-table__margin" :table-props="valueTableProps" :page="1" :limit="10"
:table-data="valueList" @emitFun="handleEmitFun"></base-table>
</el-tab-pane>
</el-tabs>
</el-col>
</el-row>
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList" />
</section>
</template>
<script>
// import SmallTitle from './SmallTitle';
import {
getDetMaterial,
getDetValue
} from '@/api/quality/processTraceabilityDetail';
import StatusBtn from './statusBtn.vue'
export default {
name: 'ProcessBom',
components: {
// SmallTitle
},
props: {
currentDet: {
type: Object,
default: null
}
},
data() {
return {
detId:undefined,
activeName: 'material',
searchBarFormConfig: [{ label: '设备参数及物料追溯' },
{
type: 'datePicker',
label: '时间段',
dateType: 'daterange', // datetimerange
// format: 'yyyy-MM-dd HH:mm:ss',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始日期',
endPlaceholder: '结束日期',
defaultTime: ['00:00:00', '23:59:59'],
param: 'timeVal',
// width: 350,
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},],
materialTableProps: [
// {
// prop: 'createTime',
// label: '',
// fixed: true,
// width: 180,
// filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
// },
{ prop: 'name', label: '物料名称' },
{ prop: 'planNum', label: '预计使用数量' },
{ prop: 'actualNum', label: '实际使用数量' },
],
name:null,
materialList: [],
valueTableProps: [
// {
// prop: 'createTime',
// label: '',
// fixed: true,
// width: 180,
// filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
// },
{ prop: 'name', label: '参数名' },
{
prop: 'name', label: '设定范围最小- 最大 / 标准',
subcomponent: StatusBtn
},
{
prop: 'code', label: '最小值',
children: [
{
prop: 'minValueSet',
label: '值'
},
{
prop: 'minValueAppearTime',
label: '出现时间'
}
]
},
{
prop: 'code', label: '最大值',
children: [
{
prop: 'maxValueSet',
label: '值'
},
{
prop: 'maxValueAppearTime',
label: '出现时间'
}
]
},
{
prop: 'averageValueAppear', label: '平均值',
},
],
valueList: [],
total: 0,
tableBtn: [],
queryParams: {
pageNo: 1,
pageSize: 10,
},
searchText: ''
};
},
// components: {
// SmallTitle,
// },
watch: {
currentDet: {
handler(val) {
if (val != null) {
this.getList(val);
this.detId = val.detId
console.log(val);
} else {
this.clearList();
}
},
immediate: true,
deep: true
}
},
methods: {
handleSearchBarBtnClick(val) {
console.log(val)
getDetMaterial({
pageNo: 1,
pageSize: 10,
orderId: this.$route.params.orderId,
flowDetId: [this.detId],
// orderId: this.$route.params.orderId,
},).then((res) => {
console.log(res);
})
// if (timeVal && timeVal.length > 0) {
// this.queryParams.time = timeVal;
// } else {
// this.queryParams.time = [];
// }
// await this.handleQuery();
},
handleEmitFun() { },
handleTableBtnClick() { },
put(payload) {
return this.http(this.updateUrl, 'put', payload);
},
post(payload) {
return this.http(this.addUrl, 'post', payload);
},
recv(payload) {
return this.http(this.pageUrl, 'get', payload);
},
info(payload) {
return this.http(this.infoUrl, 'get', payload);
},
http(url, method, payload) {
return this.$axios({
url,
method,
params: method === 'get' ? payload : null,
data: method !== 'get' ? payload : null,
})
},
// getList({ detId, detName, detDesc, flowId, sectionName } = {}) {
// console.log('get list')
// },
handleTabClick(val) {
// console.log(this.activeName);
if (this.activeName === 'material') {
getDetMaterial({
pageNo: 1,
pageSize: 10,
orderId: this.$route.params.orderId,
flowDetId: [this.detId],
// orderId: this.$route.params.orderId,
},).then((res) => {
this.materialList = res.data[0].data
this.name = res.data[0].name
})
} else {
getDetValue({
pageNo: 1,
pageSize: 10,
orderId: this.$route.params.orderId,
flowDetId: [this.detId],
// orderId: this.$route.params.orderId,
}).then((res) => {
this.valueList = res.data[0].data
this.name = res.data[0].name
})
}
},
getList(val) {
console.log(val);
getDetMaterial({
pageNo: 1,
pageSize: 10,
orderId: this.$route.params.orderId,
flowDetId: [this.detId],
}).then((res) => {
console.log(res);
this.materialList = res.data[0].data
this.name = res.data[0].name
})
},
clearList() {
this.list = [];
}
},
};
</script>
<style scoped lang="scss">
.process-bom {
position: relative;
flex: 1;
padding: 12px 20px;
background: #fff;
border-radius: 8px;
}
:deep(.custom-tabs) {
.el-tabs__header {
margin-bottom: 8px;
display: inline-block;
transform: translateY(-12px);
}
.el-tabs__content {
overflow: visible;
}
.el-tabs__item {
padding-left: 0 !important;
padding-right: 0 !important;
line-height: 36px !important;
height: 36px;
}
}
</style>

View File

@ -0,0 +1,488 @@
<!--
filename: ProcessGraph.vue
author: liubin
date: 2023-10-20 15:00:58
description:
-->
<template>
<section class="process-graph">
<SearchBar :formConfigs="searchBarFormConfig" ref="search-bar" />
<!-- <div class="btns" style="text-align: right; position: absolute; top: 20px; right: 20px">
<el-button type="warning" @click="undo" plain v-if="allowUndo" :disabled="!allowUndo" icon="el-icon-back">
撤销
</el-button>
<el-button type="warning" @click="redo" plain v-if="allowRedo" :disabled="!allowRedo">
下一步
<i class="el-icon-right el-icon--right"></i>
</el-button>
<el-button class="btn-refresh" @click="handleUpdateLayout" icon="el-icon-refresh">
刷新布局</el-button>
<el-button type="primary" plain class="btn-create" icon="el-icon-plus" @click="handleAdd">
新建工序
</el-button>
<el-button class="btn-edit" :disabled="currentDet == null" @click="handleEdit">编辑</el-button>
</div> -->
<div class="process-graph__panel" ref="panel"></div>
<base-dialog :dialogTitle="title" :dialogVisible="open" width="35%" @close="cancel" @cancel="cancel"
@confirm="submitForm">
<DialogForm v-if="open" ref="form" v-model="form" :rows="rows" />
</base-dialog>
</section>
</template>
<script>
import { Graph } from '@antv/x6';
import ProcessNode, { createProcessNode, CACHE_NAME, getSectionFrom } from './ProcessNode';
import DialogForm from '@/components/DialogForm';
// import { IdToName } from '@/utils'
// if (process - node){
// }
Graph.registerNode('process-node', ProcessNode, true);
export default {
name: 'ProcessGraph',
components: { DialogForm },
props: {},
inject: ['getFlowId'],
data() {
return {
allowRedo: false,
allowUndo: false,
graph: null,
searchBarFormConfig: [{ label: '工序列表' }],
title: '',
open: false,
form: {
name: '', //
sectionId: '', // id
remark: '', //
},
rows: [
[
{
input: true,
label: '工序名称',
prop: 'name',
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
},
],
[
{
select: true,
label: '工段',
prop: 'sectionId',
url: '/base/core-workshop-section/listAll',
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
bind: {
filterable: true,
},
cache: CACHE_NAME
},
],
[
{
textarea: true,
label: '工序说明',
prop: 'remark',
},
],
],
updateUrl: '/extend/process-flow-det/update',
deleteUrl: '/extend/process-flow-det/delete',
addUrl: '/extend/process-flow-det/create',
// pageUrl: '/extend/process-flow-det/get',
infoUrl: '/extend/process-flow-view/getByFlowId',
layout: {
id: null,
flowId: null,
content: '',
createTime: null
},
currentDet: null,
currentNode: null
};
},
watch: {
'form.sectionId': {
handler(id) {
},
immediate: false,
},
currentDet: {
handler(val) {
this.$emit('det-selected', val)
},
deep: true,
immediate: true
}
},
mounted() {
console.log(this.$route.params.id)
this.loadLayout().then(json => {
this.initGraph(json)
})
},
// mounted () {
// },
destroyed() {
this.graph.dispose();
this.$nextTick(() => {
this.resetLayout();
this.graph = null;
})
},
computed: {},
methods: {
initGraph(json) {
const graph = new Graph({
container: this.$refs.panel,
grid: {
size: 10,
visible: true,
},
history: true,
selecting: {
className: 'my-select'
},
connecting: {
snap: true,
allowBlank: false,
allowLoop: false,
allowNode: false,
allowPort: true,
allowEdge: false,
},
panning: true,
// scroller: {
// enabled: true,
// pannable: true,
// cursor: '',
// width: 800,
// height: 200
// },
mousewheel: {
enabled: true,
modifiers: ['ctrl', 'meta']
}
});
graph.fromJSON(json)
this.graph = graph;
this.$nextTick(() => {
this.registerGraphEvents();
})
},
registerGraphEvents() {
const reset = () => {
const nodes = this.graph.getNodes();
const edges = this.graph.getEdges();
this.currentDet = null;
this.currentNode = null;
nodes.forEach(node => {
node.attr('container/stroke', '#ccc');
});
edges.forEach(edge => {
edge.attr('line/stroke', '#ccc')
})
}
this.graph.on('node:click', ({ e, x, y, node, view }) => {
reset();
node.attr('container/stroke', '#0b58ff');
const { detId, detName, detDesc, processId, sectionId, sectionName } = node.attrs;
this.currentDet = {}
this.$set(this.currentDet, 'detId', detId.text)
this.$set(this.currentDet, 'sectionId', sectionId.text)
this.$set(this.currentDet, 'detName', detName.text)
this.$set(this.currentDet, 'detDesc', detDesc.text)
this.$set(this.currentDet, 'flowId', processId.text)
this.$set(this.currentDet, 'sectionName', sectionName.text)
this.currentNode = node
});
this.graph.on('edge:click', ({ e, x, y, edge, view }) => {
// console.log('edge clicked!', edge)
reset();
edge.attr('line/stroke', '#0b58ff')
});
this.graph.on('blank:click', ({ e, x, y }) => {x
reset();
});
this.graph.on('node:mouseenter', ({ node }) => {
node.addTools({
name: 'button-remove',
args: {
x: '100%',
y: 0,
offset: { x: 0, y: 0 },
onClick: ({ e, cell, view }) => {
this.$confirm(
'确定删除这个工序吗?',
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}
).then(async () => {
const id = node.attrs.detId.text;
const status = await this.handleDelete(id);
if (status) {
view.cell.remove();
}
}).catch(err => {
return;
})
}
}
})
});
this.graph.on('node:mouseleave', ({ node }) => {
node.removeTools();
})
},
resetLayout() {
this.layout = {
id: null,
flowId: null,
content: '',
createTime: null
}
},
async loadLayout() {
const flowId = this.$route.params.id;
console.log(flowId)
if (!flowId) return { cells: [] }
const { code, data } = await this.info({ id: flowId });
if (code == 0) {
if (data) {
this.layout = data;
return JSON.parse(data?.content) || { cells: [] };
}
return { cells: [] };
}
this.resetLayout();
return Promise.reject(this.infoUrl + ' 接口出错!');
},
handleToJson() { },
handleLoadJson() { },
handleDumpJson() {
if (this.graph) {
console.log(JSON.stringify(this.graph.toJSON(), null, 2));
}
},
async handleUpdateLayout() {
this.layout.content = JSON.stringify(this.graph.toJSON());
let code, data;
console.table([this.layout, this.$route.params.id])
//
if (this.layout.id) {
({ code, data } = await this.http('/extend/process-flow-view/update', 'put', this.layout));
} else {
this.layout.flowId = this.$route.params.id;
({ code, data } = await this.http('/extend/process-flow-view/create', 'post', this.layout));
}
if (code == 0) {
this.$modal.msgSuccess('布局已刷新!')
}
},
reset() {
this.form = {
name: '', //
sectionId: '', // id
remark: '', //
};
this.resetForm('form');
},
/** 取消按钮 */
cancel() {
this.open = false;
this.reset();
},
handleAdd() {
this.reset();
this.open = true;
this.title = '添加工序';
},
handleEdit() {
this.form.name = this.currentDet.detName;
this.form.sectionId = this.currentDet.sectionId;
this.form.remark = this.currentDet.detDesc;
this.form.id = this.currentDet.detId;
this.title = '编辑工序';
this.$nextTick(() => {
this.open = true;
})
},
async handleDelete(id) {
const { code, data } = await this.delete({ id });
debugger;
if (code == 0) {
this.$modal.msgSuccess('成功删除一个工序!');
return true;
}
return false;
},
/** 提交按钮 */
submitForm() {
this.$refs['form'].validate((valid) => {
if (!valid) {
return;
}
//
if (this.form.id != null) {
this.updateProcess()
.then((form) => {
const { name, sectionId, remark } = form;
getSectionFrom(sectionId).then(sectionName => {
// node
this.currentNode.setAttrs({
detName: { text: name },
sectionId: { text: sectionId },
sectionName: { text: sectionName },
detDesc: { text: remark }
})
})
})
.catch(err => { });
return;
}
this.createProcess()
.then(({ id, name, sectionId, remark, flowId }) => {
if (!id) return null;
return createProcessNode({
flowId: flowId,
name, sectionId, remark,
id,
})
}).then(node => {
if (!node) {
this.$modal.msgError('创建节点失败');
return;
};
this.graph.addNode(node);
}).catch(err => {
return;
});
});
},
updateProcess() {
const flowId = this.getFlowId();
if (!flowId) {
this.$modal.msgError('工艺ID不能为空');
return Promise.reject('工艺ID不能为空');
}
return this.put({ flowId, ...this.form })
.then(({ code, data }) => {
if (code == 0) {
this.$modal.msgSuccess('修改成功');
} else {
this.$modal.msgError('修改失败');
}
const formCopy = { ...this.form }
this.open = false;
return formCopy;
});
},
createProcess() {
// const flowId = this.$route.params.id;
const flowId = this.getFlowId(); // it also works
if (!flowId) {
this.$modal.msgError('工艺ID不能为空');
return Promise.reject('工艺ID不能为空');
}
console.log('create process', this.form)
//
return this.post({ flowId, ...this.form }).then(
({ code, data }) => {
this.$modal.msgSuccess('新增成功');
this.open = false;
// this.getList();
return {
id: data, // id
...this.form, // this.form open->false this.form
flowId
};
}
).catch(err => {
this.$modal.msgError(err)
});
},
put(payload) {
return this.http(this.updateUrl, 'put', payload);
},
post(payload) {
return this.http(this.addUrl, 'post', payload);
},
recv(payload) {
return this.http(this.pageUrl, 'get', payload);
},
info(payload) {
return this.http(this.infoUrl, 'get', payload);
},
delete({ id }) {
return this.$axios({
url: this.deleteUrl + `?id=${id}`,
method: 'delete',
});
},
http(url, method, payload) {
return this.$axios({
url,
method,
params: method === 'get' ? payload : null,
data: method !== 'get' ? payload : null,
})
},
},
};
</script>
<style scoped lang="scss">
.process-graph {
padding: 12px 20px 20px;
background: #fff;
border-radius: 8px;
position: relative;
}
.process-graph__panel {
height: 300px;
}
</style>
<style>
.x6-widget-selection-selected {
border: 1px solid red;
}
.my-select {
border: 1px solid red;
}
</style>

View File

@ -0,0 +1,126 @@
<!--
filename: ProcessInfo.vue
author: liubin
date: 2023-10-20 15:00:58
description:
-->
<template>
<section class="process-info">
<SearchBar :formConfigs="searchBarFormConfig" ref="search-bar" />
<el-row :gutter="24">
<el-col :span="6">
<InfoItem label="工单名称" :value="form.name" />
</el-col>
<el-col :span="6">
<InfoItem label="工艺名称" :value="form.processFlowName" />
</el-col>
<el-col :span="6">
<InfoItem label="产品名称" :value="form.productName" />
</el-col>
<el-col :span="6">
<InfoItem label="产品规格" />
</el-col>
</el-row>
</section>
</template>
<script>
const InfoItem = {
name: 'InfoItem',
components: {},
props: ['label', 'value'],
data() {
return {};
},
computed: {},
methods: {},
render: function (h) {
return (
<div style="display: flex; align-items: center; font-size: 14px; line-height: 1.5">
<span style="width: 100px; text-align: left; font-weight: 700">{this.label}:</span>
<span style="width: 200px; text-align: left; text-overflow: ellipse; white-space: nowrap">
{this.value}
</span>
</div>
);
},
};
export default {
name: 'ProcessInfo',
components: { InfoItem },
props: {},
inject: ['getFlowId'],
data() {
return {
infoUrl: '/extend/process-flow/get',
searchBarFormConfig: [{ label: '工艺详情' }],
form: {
id: null,
name: null,
productName: null,
processFlowName: null,
// remark: null,
// enable: null,
// code: null
},
};
},
mounted() {
this.getInfo()
},
computed: {},
methods: {
// utils
// http(url, method, payload) {
// return this.$axios({
// url,
// method,
// params: method === 'get' ? payload : null,
// data: method !== 'get' ? payload : null,
// })
// },
// put(payload) {
// return this.http(this.updateUrl, 'put', payload);
// },
// post(payload) {
// return this.http(this.addUrl, 'post', payload);
// },
// recv(payload) {
// return this.http(this.pageUrl, 'get', payload);
// },
// info(payload) {
// return this.http(this.infoUrl, 'get', payload);
// },
async getInfo() {
this.form.name = this.$route.params.name
this.form.productName = this.$route.params.productName
this.form.processFlowName = this.$route.params.processFlowName
// this.form.name = this.$route.params.name
// const flowId = this.$route.params.id;
// console.log(flowId);
// if (!flowId) this.$router.go(-1);
// const { code, data } = await this.info({ id: flowId });
// // debugger;
// if (code == 0) {
// this.form = {
// ...data
// };
// } else {
// this.$modal.msgError('')
// }
}
},
};
</script>
<style scoped lang="scss">
.process-info {
padding: 12px 20px 20px;
background: #fff;
border-radius: 8px;
}
</style>

View File

@ -0,0 +1,170 @@
import { Node, ObjectExt, Shape } from '@antv/x6';
import { IdToName } from '@/utils'
import cache from '@/utils/cache'
import axios from '@/utils/request'
import { v4 } from 'uuid'
Shape.Edge.config({
attrs: {
line: {
stroke: '#ccc',
strokeWidth: 1,
targetMarker: {
name: 'block',
width: 1,
height: 1
},
},
}
})
export default class ProcessNode extends Node { }
ProcessNode.config({
width: 200,
height: 100,
markup: [
{
tagName: 'rect',
selector: 'container',
attrs: {
x: 0,
y: 0,
width: 200,
height: 100,
fill: 'transparent',
stroke: '#ccc'
},
},
{
tagName: 'rect',
attrs: {
x: 0,
y: 0,
width: 200,
height: 50,
fill: '#ffffff',
},
},
{
tagName: 'rect',
attrs: {
x: 0,
y: 50,
width: 200,
height: 50,
fill: '#f8f8f8',
},
},
{
tagName: 'text',
selector: 'detName',
attrs: {
x: 20,
y: 30,
},
},
{
tagName: 'text',
selector: 'sectionName',
attrs: {
x: 115,
y: 30,
},
},
{
tagName: 'text',
selector: 'detDesc',
attrs: {
x: 26,
y: 80,
fill: '#777',
fontSize: 14,
fill: '#1a90fc',
},
},
],
attrs: {
line: {
fill: 'red'
}
},
ports: {
groups: {
in: {
position: 'left',
attrs: {
circle: {
r: 2,
magnet: true,
stroke: '#0b58ff',
strokeWidth: 1,
fill: '#0b58ff'
}
}
},
out: {
position: 'right',
attrs: {
circle: {
r: 2,
magnet: true,
stroke: '#0b58ff',
strokeWidth: 1,
fill: '#0b58ff'
}
}
}
}
},
propHooks(metadata) {
const { detId, detName, detDesc, sectionName, processId, sectionId, ...others } = metadata;
// debugger;
if (detName) ObjectExt.setByPath(others, 'attrs/detName/text', detName);
if (detDesc) ObjectExt.setByPath(others, 'attrs/detDesc/text', detDesc);
if (sectionName) ObjectExt.setByPath(others, 'attrs/sectionName/text', sectionName);
if (detId) ObjectExt.setByPath(others, 'attrs/detId/text', detId);
if (processId) ObjectExt.setByPath(others, 'attrs/processId/text', processId);
if (sectionId) ObjectExt.setByPath(others, 'attrs/sectionId/text', sectionId);
return others;
}
});
export const CACHE_NAME = 'ProcessDetail::section';
export async function getSectionFrom(sectionId) {
const sectionList = await cache.getList(
CACHE_NAME,
async () => {
const { code, data } = await axios(
'/base/core-production-line/listAll'
);
if (code == 0) {
return data;
}
}
);
return IdToName(sectionId, sectionList);
}
export async function createProcessNode({ flowId, id, name, sectionId, remark }) {
const sectionName = await getSectionFrom(sectionId);
return {
shape: 'process-node',
x: 0,
y: 0,
detName: name, // 工序名称
sectionName, // 工段
sectionId,
detDesc: remark, // 工序说明
processId: flowId, // 工艺ID
detId: id, // 工序ID
tools: [],
ports: [
{ id: v4(), group: 'in' },
{ id: v4(), group: 'out' },
]
};
}
export async function createEdge(src, dest) { }

View File

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

View File

@ -0,0 +1,63 @@
<!--
* @Author: zhp
* @Date: 2023-11-10 09:18:48
* @LastEditTime: 2023-11-10 09:23:24
* @LastEditors: zhp
* @Description:
-->
<template>
<span>
{{ injectData.minValueSet + '-' + injectData.maxValueSet + "/" + injectData / defaultValueSet }}
</span>
</template>
<script>
export default {
props: {
injectData: {
type: Object,
default: () => ({})
}
},
data() {
return {
// state: false
}
},
// computed: {
// readonly() {
// return !!this.injectData.readonly
// }
// },
// mounted() {
// this.mapToState()
// },
methods: {
// mapToState() {
// if (this.injectData.prop === 'enabled') {
// this.state = this.injectData.enabled === 1 ? true : false
// }
// },
// changeHandler() {
// // let params = {}
// let payload = {}
// // params.name = 'state'
// payload.id = this.injectData.id
// payload.enabled = this.state ? '1' : '0'
// payload.code = this.injectData.code
// payload.name = this.injectData.name
// payload.equipmentId = this.injectData.equipmentId
// payload.remark = this.injectData.remark
// // params.payload = payload
// updateProcessEquMaterialBom(payload).then((res) => {
// if (res.code === 0) {
// this.$modal.msgSuccess("");
// }
// })
// // this.$emit('emitData', params)
// }
}
}
</script>

View File

@ -0,0 +1,63 @@
<!--
filename: index.vue
author: liubin
date: 2023-10-18 12:25:46
description:
-->
<template>
<div class="app-container process-flow-view">
<ProcessInfo />
<ProcessDetail style="margin-top: 16px" @det-selected="handleDetSelected" />
<ProcessBomList style="margin-top: 16px" :current-det="currentDet" />
</div>
</template>
<script>
import ProcessInfo from './components/ProcessInfo.vue';
import ProcessBomList from './components/ProcessBomList.vue';
import ProcessDetail from './components/ProcessDetail.vue';
export default {
name: 'ProcessFlowView',
components: { ProcessInfo, ProcessDetail, ProcessBomList },
props: {},
data() {
return {
flowId: null,
currentDet: null
};
},
provide() {
const that = this;
return {
getFlowId() {
return that.flowId;
},
};
},
mounted() {
console.log('activated...', this.$route.params);
this.flowId = this.$route.params.id;
},
computed: {},
methods: {
handleDetSelected(det) {
if (det != null) {
this.currentDet = { ...det }
}
else this.currentDet = null;
}
},
};
</script>
<style scoped lang="scss">
.process-flow-view {
padding: 8px;
flex: 1;
background: #f2f4f9;
display: flex;
flex-direction: column;
}
</style>

View File

@ -16,10 +16,10 @@
</el-date-picker>
</el-form-item>
<el-form-item>
<span class="separateStyle"></span>
<span class="separateStyle" v-if="this.$auth.hasPermi('base:group-team-scheduling:set')"></span>
</el-form-item>
<el-form-item>
<el-button type="primary" size="small" :disabled="showSetting || settingBtnDis" @click="settingMsg">设置</el-button>
<el-button type="primary" size="small" v-if="this.$auth.hasPermi('base:group-team-scheduling:set')" :disabled="showSetting || settingBtnDis" @click="settingMsg">设置</el-button>
</el-form-item>
<el-form-item>
<el-button type="primary" size="small" v-show="showSetting && autoScheduling" @click="schedulingBtn">自动排班</el-button>
@ -285,21 +285,22 @@ export default {
switch (val) {
case '1':
this.$router.push({
// path: '/core/monitoring/production-line-data',
name: 'ProductionLineData',
params: { startTime: this.chooseObj.startTime, endTime: this.chooseObj.endTime }
path: '/core/enhance/product-line-24h?startTime='+this.chooseObj.startTime+'&endTime='+this.chooseObj.endTime,
// name: 'ProductionLineData',
// params: { startTime: this.chooseObj.startTime, endTime: this.chooseObj.endTime }
})
break;
case '2': //
this.$router.push({
name: 'EnergyReportSearch',
params: { startTime: this.chooseObj.startTime, endTime: this.chooseObj.endTime }
path: '/energy/monitoring/energy-report-search?startTime='+this.chooseObj.startTime+'&endTime='+this.chooseObj.endTime
// name: 'EnergyReportSearch',
// params: { startTime: this.chooseObj.startTime, endTime: this.chooseObj.endTime }
})
break;
default:
this.$router.push({
// path: '/quality/monitoring/quality-statistics',
name: 'QualityStatistics',
path: '/quality/monitoring/quality-statistics',
// name: 'QualityStatistics',
params: { startTime: this.chooseObj.startTime, endTime: this.chooseObj.endTime }
})
}

View File

@ -49,12 +49,6 @@ const tableProps = [
label: '上班次数'
}
]
const tableBtn = [
{
type: 'detail',
btnName: '详情'
}
]
export default {
name: 'GroupTeamView',
data() {
@ -82,7 +76,14 @@ export default {
},
workOrderList: [],
workOrderName: '',
tableBtn,
tableBtn: [
this.$auth.hasPermi('base:group-team-view:detail')
? {
type: 'detail',
btnName: '详情'
}
: undefined
].filter((v) => v),
tableProps,
tableH: this.tableHeight(220),
list: [],

View File

@ -72,12 +72,6 @@ const tableProps = [
showOverflowtooltip: true
}
]
const tableBtn = [
{
type: 'viewDetail',
btnName: '查看生产情况'
}
]
export default {
name: 'GroupTeamScheduling',
data() {
@ -98,13 +92,14 @@ export default {
{
type: 'datePicker',
label: '上班日期',
dateType: 'date',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd',
rangeSeparator: '-',
// valueFormat: "timestamp",
param: 'startDay',
param: 'tiemStr',
defaultSelect: '',
width: 200
width: 250
},
{
type: 'button',
@ -119,10 +114,17 @@ export default {
pageSize: 20,
classesId: '',
teamName: '',
startDay: ''
startDay: []
},
tableProps,
tableBtn,
tableBtn: [
this.$auth.hasPermi('base:team-production:detail')
? {
type: 'viewDetail',
btnName: '查看生产情况'
}
: undefined
].filter((v) => v),
list: [],
tableH: this.tableHeight(260),
total: 0,
@ -142,7 +144,8 @@ export default {
this.queryParams.pageNo = 1;
this.queryParams.classesId = val.classesId
this.queryParams.teamName = val.teamName
this.queryParams.startDay = val.startDay
this.queryParams.startDay[0] = val.tiemStr ? val.tiemStr[0] + ' 00:00:00' : ''
this.queryParams.startDay[1] = val.tiemStr ? val.tiemStr[1] + ' 23:59:59' : ''
this.getList()
},
getList() {

View File

@ -25,23 +25,18 @@
<el-row>
<el-col :span='12'>
<el-form-item label="产品名称" prop="planProductId">
<el-select v-model="form.planProductId" placeholder="请选择" :disabled="isBind" style="width: 100%;" @change="selectProduct">
<el-select v-model="form.planProductId" placeholder="请选择" disabled style="width: 100%;">
<el-option
v-for="item in productList"
:key="item.id"
:label="item.name"
:label="item.name+' | '+item.specifications"
:value="item.id">
<span style="float: left">{{ item.name }}</span>
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.specifications }}</span>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span='12'>
<el-form-item label="产品规格" prop="productSpec">
<el-input v-model="form.productSpec" disabled></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span='12'>
<el-form-item label="计划开始时间">
<el-date-picker
@ -54,6 +49,8 @@
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span='12'>
<el-form-item label="计划完成时间">
<el-date-picker
@ -66,23 +63,21 @@
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span='12'>
<el-form-item label="计划投入数量" prop="planAssignQuantity">
<el-input-number v-model="form.planAssignQuantity" :min="0" :max="9999999999999" :disabled="isBind" style="width: 100%;"></el-input-number>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span='12'>
<el-form-item label="计划生产数量" prop="planQuantity">
<el-input-number v-model="form.planQuantity" :min="0" :max="9999999999999" :disabled="isBind" style="width: 100%;"></el-input-number>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span='12'>
<el-form-item label="关联工艺" prop="processFlowId">
<el-select v-model="form.processFlowId" placeholder="请选择" :disabled="isBind" style="width: 100%;">
<el-select v-model="form.processFlowId" placeholder="请选择" disabled style="width: 100%;">
<el-option
v-for="item in processFlowList"
:key="item.id"
@ -92,16 +87,16 @@
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span='12'>
<el-form-item label="物料计算方式" prop="materialMethod">
<el-radio-group v-model="form.materialMethod" :disabled="isBind">
<el-radio-group v-model="form.materialMethod" disabled>
<el-radio :label="1">产品基础</el-radio>
<el-radio :label="2">工艺扩展</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span='12'>
<el-form-item label="优先级" prop="priority">
<el-select v-model="form.priority" placeholder="请选择" style="width: 100%;" :disabled="isBind">
@ -114,6 +109,8 @@
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span='12'>
<el-form-item label="工单类型" prop="type">
<el-select v-model="form.type" placeholder="请选择" style="width: 100%;" :disabled="isBind">
@ -126,8 +123,6 @@
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span='12'>
<el-form-item label="关联产线" prop="productLineId">
<el-select v-model="form.productLineId" placeholder="请选择" multiple style="width: 100%;" :disabled="isBind">
@ -140,6 +135,8 @@
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span='12'>
<el-form-item label="负责人" prop="workers">
<el-input v-model="form.workers" :disabled="isBind"></el-input>
@ -170,7 +167,6 @@ export default {
name: '',
code: '',
planProductId: '',
productSpec: '',
planStartTime: '',
planFinishTime: '',
planAssignQuantity: 0,
@ -205,14 +201,17 @@ export default {
}
},
methods: {
init(id, param) {
this.form.orderId = id
init(data, param) {
this.form.orderId = data.id
this.getList()
if (param === 'add') {
this.isBind = false
getWorkOrderCode().then(res => {
this.form.code = res.data || ''
})
this.form.planProductId = data.planProductId
this.form.processFlowId = data.processFlowId
this.form.materialMethod = data.materialMethod
}else{//
this.isBind = true
}
@ -237,18 +236,6 @@ export default {
this.workOrderList = res.data || []
})
},
//
selectProduct(val) {
if (val) {
this.productList.map(item => {
if (val === item.id) {
this.form.productSpec = item.specifications
}
})
} else {
this.form.productSpec = ''
}
},
addWorkOrderSubmit() {
this.$refs['addWorkOrder'].validate((valid) => {
if (valid) {
@ -298,8 +285,6 @@ export default {
if (res.code === 0) {
this.form.code = res.data.code
this.form.planProductId = res.data.planProductId
this.selectProduct(this.form.planProductId)
this.form.productSpec = res.data.productSpec
this.planStartTime = res.data.planStartTime ? moment.unix(res.data.planStartTime).format('YYYY-MM-DD HH:mm:ss') : null
this.planFinishTime = res.data.planFinishTime ? moment.unix(res.data.planFinishTime).format('YYYY-MM-DD HH:mm:ss') : null
this.form.planAssignQuantity = res.data.planAssignQuantity

View File

@ -8,7 +8,7 @@
</el-col>
<el-col :span='12'>
<el-form-item label="订单号" prop="code">
<el-input v-model="form.code" disabled></el-input>
<el-input v-model="form.code"></el-input>
</el-form-item>
</el-col>
</el-row>
@ -20,12 +20,14 @@
</el-col>
<el-col :span='12'>
<el-form-item label="产品名称" prop="planProductId">
<el-select v-model="form.planProductId" placeholder="请选择" style="width: 100%;" @change="selectProduct">
<el-select v-model="form.planProductId" placeholder="请选择" style="width: 100%;">
<el-option
v-for="item in productList"
:key="item.id"
:label="item.name"
:label="item.name+' | '+item.specifications"
:value="item.id">
<span style="float: left">{{ item.name }}</span>
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.specifications }}</span>
</el-option>
</el-select>
</el-form-item>
@ -37,13 +39,6 @@
<el-input-number v-model="form.price" :min="0" :max="9999999999999" :precision='2' style="width: 100%;"></el-input-number>
</el-form-item>
</el-col>
<el-col :span='12'>
<el-form-item label="产品规格" prop="productSpec">
<el-input v-model="form.productSpec" disabled></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span='12'>
<el-form-item label="客户" prop="customerId">
<el-select v-model="form.customerId" placeholder="请选择" style="width: 100%;">
@ -56,6 +51,8 @@
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span='12'>
<el-form-item label="优先级" prop="priority">
<el-select v-model="form.priority" placeholder="请选择" style="width: 100%;">
@ -68,8 +65,6 @@
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span='12'>
<el-form-item label="包装规格" prop="packSpec">
<el-select v-model="form.packSpec" placeholder="请选择" style="width: 100%;">
@ -82,13 +77,13 @@
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span='12'>
<el-form-item label="负责人" prop="workers">
<el-input v-model="form.workers"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span='12'>
<el-form-item label="关联工艺" prop="processFlowId">
<el-select v-model="form.processFlowId" placeholder="请选择" style="width: 100%;">
@ -101,6 +96,8 @@
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span='12'>
<el-form-item label="物料计算方式" prop="materialMethod">
<el-radio-group v-model="form.materialMethod">
@ -109,35 +106,33 @@
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span='12'>
<el-form-item label="订单计划开始时间">
<el-form-item label="订单计划开始时间" prop="planStartTime">
<el-date-picker
v-model="planStartTime"
type="date"
format='yyyy-MM-dd'
value-format="yyyy-MM-dd"
style="width: 100%;"
placeholder="选择日期">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span='12'>
<el-form-item label="订单计划完成时间">
<el-date-picker
v-model="planFinishTime"
type="date"
format='yyyy-MM-dd'
value-format="yyyy-MM-dd"
v-model="form.planStartTime"
type="datetime"
style="width: 100%;"
value-format="timestamp"
@change="timeChange"
placeholder="选择日期">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span='24'>
<el-col :span='12'>
<el-form-item label="订单计划完成时间" prop="planFinishTime">
<el-date-picker
v-model="form.planFinishTime"
type="datetime"
style="width: 100%;"
value-format="timestamp"
@change="timeChange"
placeholder="选择日期">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span='12'>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark"></el-input>
</el-form-item>
@ -168,7 +163,6 @@ export default {
planQuantity: '',
planProductId: '',
price: '',
productSpec: '',
customerId: '',
priority: '',
packSpec: '',
@ -180,8 +174,6 @@ export default {
planStartTime: '',
planFinishTime: ''
},
planStartTime: '',
planFinishTime: '',
rules: {
name: [{ required: true, message: "订单名称不能为空", trigger: "blur" }],
planQuantity: [{ required: true, message: "计划加工数量不能为空", trigger: "blur" }],
@ -205,16 +197,15 @@ export default {
this.form.code = res.data.code
this.form.planQuantity = res.data.planQuantity
this.form.planProductId = res.data.planProductId
this.selectProduct(this.form.planProductId)
this.form.price = res.data.price
this.form.customerId = res.data.customerId
this.form.priority = res.data.priority ? res.data.priority + '' : ''
this.planStartTime = res.data.planStartTime ? moment(res.data.planStartTime).format('YYYY-MM-DD') : null
this.form.planStartTime = res.data.planStartTime ? res.data.planStartTime : null
this.form.packSpec = res.data.packSpec ? res.data.packSpec+'' : ''
this.form.workers = res.data.workers
this.form.processFlowId = res.data.processFlowId
this.form.materialMethod = res.data.materialMethod
this.planFinishTime = res.data.planFinishTime ? moment(res.data.planFinishTime).format('YYYY-MM-DD') : null
this.form.planFinishTime = res.data.planFinishTime ? res.data.planFinishTime : null
this.form.remark = res.data.remark
this.form.description = res.data.description
}
@ -242,24 +233,23 @@ export default {
this.processFlowList = res.data || []
})
},
//
selectProduct(val) {
if (val) {
this.productList.map(item => {
if (val === item.id) {
this.form.productSpec = item.specifications
timeChange() {
if (this.form.planStartTime && this.form.planFinishTime) {
if (this.form.planStartTime > this.form.planFinishTime) {
this.$modal.msgError('计划开始时间不能大于结束时间')
}
})
} else {
this.form.productSpec = ''
}
},
submitForm() {
this.$refs['orderAddForm'].validate((valid) => {
if (valid) {
this.form.planStartTime = this.planStartTime ? new Date(this.planStartTime).valueOf() : ''
this.form.planFinishTime = this.planFinishTime ? new Date(this.planFinishTime).valueOf() : ''
console.log(this.form)
if (this.form.planStartTime && this.form.planFinishTime) {
if (this.form.planStartTime > this.form.planFinishTime) {
this.$modal.msgError('计划开始时间不能大于结束时间')
return false
}
}
// console.log(this.form)
if (this.isEdit) {
//
orderUpdate({ ...this.form }).then((res) => {
@ -288,10 +278,6 @@ export default {
this.form.materialMethod = 1
this.form.price = 0.00
this.form.planQuantity = 0
this.planFinishTime = ''
this.planStartTime = ''
this.form.planFinishTime = ''
this.form.planStartTime = ''
this.isEdit = false
}
}

View File

@ -17,7 +17,7 @@
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="250"
:width="320"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick"
@ -56,7 +56,7 @@
</template>
<script>
import { parseTime } from '@/utils/ruoyi'
import { getOrderPage, orderDelete, customerList } from '@/api/base/orderManage'
import { getOrderPage, orderDelete, customerList, orderFinish } from '@/api/base/orderManage'
import OrderAdd from './components/orderAdd'
import AddWorkOrder from './components/addWorkOrder'
import { publicFormatter } from '@/utils/dict'
@ -115,7 +115,8 @@ const tableProps = [
},
{
prop: 'unit',
label: '单位'
label: '单位',
filter: publicFormatter('unit_dict')
},
{
prop: 'price',
@ -165,10 +166,10 @@ export default {
color: 'primary'
},
{
type: 'separate'
type: this.$auth.hasPermi('base:order-manage:create') ? 'separate' : '',
},
{
type: 'button',
type: this.$auth.hasPermi('base:order-manage:create') ? 'button' : '',
btnName: '新增',
name: 'add',
color: 'success',
@ -188,34 +189,100 @@ export default {
list: [],
tableH: this.tableHeight(260),
tableBtn: [
this.$auth.hasPermi('base:group-team:update')
this.$auth.hasPermi('base:order-manage:addWorkOrder')
? {
type: 'add',
btnName: '新增工单'
btnName: '新增工单',
showParam: {
type: '&',
data: [
{
type: 'equal',
name: 'status',
value: 1
}
]
}
}
: undefined,
this.$auth.hasPermi('base:group-team:update')
this.$auth.hasPermi('base:order-manage:bindWorkOrder')
? {
type: 'bind',
btnName: '绑定工单'
btnName: '绑定工单',
showParam: {
type: '&',
data: [
{
type: 'equal',
name: 'status',
value: 1
}
]
}
}
: undefined,
this.$auth.hasPermi('base:group-team:update')
this.$auth.hasPermi('base:order-manage:bindWorkOrder')
? {
type: 'complete',
btnName: '完成工单',
showParam: {
type: '&',
data: [
{
type: 'equal',
name: 'status',
value: 2
}
]
}
}
: undefined,
this.$auth.hasPermi('base:order-manage:detail')
? {
type: 'detail',
btnName: '详情'
}
: undefined,
this.$auth.hasPermi('base:group-team:update')
this.$auth.hasPermi('base:order-manage:edit')
? {
type: 'edit',
btnName: '编辑'
btnName: '编辑',
showParam: {
type: '&',
data: [
{
type: 'equal',
name: 'triggerOrigin',
value: 1
},
{
type: 'equal',
name: 'status',
value: 1
}
]
}
}
: undefined,
this.$auth.hasPermi('base:group-team:delete')
this.$auth.hasPermi('base:order-manage:delete')
? {
type: 'delete',
btnName: '删除'
btnName: '删除',
showParam: {
type: '&',
data: [
{
type: 'equal',
name: 'triggerOrigin',
value: 1
},
{
type: 'equal',
name: 'status',
value: 1
}
]
}
}
: undefined
].filter((v) => v),
@ -292,13 +359,13 @@ export default {
this.handleDelete(val.data)
break
case 'detail':
this.$router.push({ name: 'OrderDetailData', params: { orderId: val.data.id }})
this.$router.push({path: '/order/base/order-manage/order-detail-data?orderId='+ val.data.id})
break
case 'add':
this.workIssueTitle = '新增工单'
this.addWorkOrdervisible = true
this.$nextTick(() => {
this.$refs.addWorkOrder.init(val.data.id, 'add')
this.$refs.addWorkOrder.init(val.data, 'add')
})
break
case 'bind':
@ -308,6 +375,9 @@ export default {
this.$refs.addWorkOrder.init(val.data.id, 'bind')
})
break
case 'complete':
this.handleComplete(val.data)
break
default:
}
},
@ -320,6 +390,15 @@ export default {
this.$modal.msgSuccess("操作成功");
}).catch(() => {});
},
//
handleComplete(val) {
this.$modal.confirm('是否确认完成订单"' + val.name + '"?').then(function() {
return orderFinish({ id: val.id })
}).then(() => {
this.getList();
this.$modal.msgSuccess("操作成功");
}).catch(() => {});
},
//
handleCancel() {
this.$refs.orderAdd.formClear()

View File

@ -3,86 +3,94 @@
<div class="box1">
<div class="boxTitle">
<span class="blueTitle"></span>
<span>订单编码: 432784632747238</span>
<span>订单编码: {{orderMsg.code}}</span>
</div>
<div style="padding-left: 14px;">
<el-row>
<el-col :span='4'>
<el-col :span='3'>
<div class="blodTip">订单名</div>
<div class="lightTip">{{orderMsg.name}}</div>
</el-col>
<el-col :span='4'>
<el-col :span='3'>
<div class="blodTip">产品信息</div>
<div class="lightTip">{{orderMsg.productName}}</div>
</el-col>
<el-col :span='4'>
<el-col :span='3'>
<div class="blodTip">产品规格</div>
<div class="lightTip">{{orderMsg.specifications}}</div>
</el-col>
<el-col :span='4'>
<el-col :span='3'>
<div class="blodTip">客户</div>
<div class="lightTip">{{orderMsg.customerName}}</div>
</el-col>
<el-col :span='4'>
<el-col :span='3'>
<div class="blodTip">包装规格</div>
<div class="lightTip">{{ getDictDataLabel(DICT_TYPE.PACK_SPEC, orderMsg.packSpec)}}</div>
</el-col>
<el-col :span='4'>
<el-col :span='3'>
<div class="blodTip">物料计算方式</div>
<div class="lightTip">{{orderMsg.materialMethod ? (orderMsg.materialMethod === 1 ? '产品基础' : '工艺扩展') : ''}}</div>
</el-col>
</el-row>
<el-row>
<el-col :span='4'>
<el-col :span='3'>
<div class="blodTip">创建时间</div>
<div class="lightTip">{{ parseTime(orderMsg.triggerTime) }}</div>
<div class="lightTip">{{ parseTime(orderMsg.createTime) }}</div>
</el-col>
<el-col :span='4'>
<el-col :span='3'>
<div class="blodTip">计划开始时间</div>
<div class="lightTip">{{ parseTime(orderMsg.planStartTime) }}</div>
</el-col>
<el-col :span='4'>
</el-row>
<el-row>
<el-col :span='3'>
<div class="blodTip">计划完成时间</div>
<div class="lightTip">{{ parseTime(orderMsg.planFinishTime) }}</div>
</el-col>
<el-col :span='4'>
<el-col :span='3'>
<div class="blodTip">计划加工数量</div>
<div class="lightTip">{{orderMsg.planQuantity}}</div>
</el-col>
<el-col :span='4'>
<el-col :span='3'>
<div class="blodTip">加工平方数(平方米)</div>
<div class="lightTip">{{orderMsg.planArea}}</div>
</el-col>
<el-col :span='4'>
<el-col :span='3'>
<div class="blodTip">预计用时()</div>
<div class="lightTip">{{ orderMsg.expectTime }}</div>
</el-col>
</el-row>
<el-row>
<el-col :span='4'>
<el-col :span='3'>
<div class="blodTip">状态</div>
<div class="lightTip">{{getDictDataLabel(DICT_TYPE.ORDER_STATUS, orderMsg.status)}}</div>
</el-col>
<el-col :span='4'>
<el-col :span='3'>
<div class="blodTip">实际开始时间</div>
<div class="lightTip">{{ parseTime(orderMsg.startProduceTime) }}</div>
</el-col>
<el-col :span='4'>
<el-col :span='3'>
<div class="blodTip">实际完成时间</div>
<div class="lightTip">{{ parseTime(orderMsg.finishProduceTime) }}</div>
</el-col>
<el-col :span='4'>
<el-col :span='3'>
<div class="blodTip">实际生产数量</div>
<div class="lightTip">{{orderMsg.actualQuantity }}</div>
</el-col>
<el-col :span='4'>
</el-row>
<el-row>
<el-col :span='3'>
<div class="blodTip">完成比%</div>
<div class="lightTip">{{orderMsg.completeProp}}</div>
</el-col>
<el-col :span='4'>
<el-col :span='3'>
<div class="blodTip">废片数量</div>
<div class="lightTip">{{orderMsg.nokQuantity}}</div>
</el-col>
<el-col :span='3'>
<div class="blodTip">负责人</div>
<div class="lightTip">{{orderMsg.workers}}</div>
</el-col>
<el-col :span='3'>
<div class="blodTip">关联工艺</div>
<div class="lightTip">{{processFlowName}}</div>
</el-col>
</el-row>
</div>
</div>
@ -118,7 +126,8 @@
</template>
<script>
import { parseTime } from '@/utils/ruoyi'
import { publicFormatter } from '@/utils/dict';
import { publicFormatter } from '@/utils/dict'
import { getProcessFlowList } from '@/api/base/orderManage'
const tableProps1 = [
{
prop: 'issueTime',
@ -172,7 +181,7 @@ const tableProps1 = [
{
prop: 'productLineNames',
label: '关联产线',
filter: (val) => val.join(','),
filter: (val) => val ? val.join(',') : '',
showOverflowtooltip: true
},
{
@ -215,14 +224,15 @@ export default {
pageNo: 1,
pageSize: 500
},
orderMsg: {}
orderMsg: {},
processFlowName: ''
}
},
mounted() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(510) / 2
})
this.orderId = this.$route.params.orderId
this.orderId = location.href.split('?')[1].split('=')[1]
this.getMsg()
},
watch: {
@ -231,7 +241,7 @@ export default {
methods: {
initData(to) {
if (to.name === 'OrderDetailData') {
this.orderId = this.$route.params.orderId
this.orderId = location.href.split('?')[1].split('=')[1]
this.getMsg()
}
},
@ -256,6 +266,17 @@ export default {
this.list2 = []
}
})
//
getProcessFlowList().then(res => {
let arr = res.data || []
if (arr.length > 0) {
arr.map(item => {
if (item.id === this.orderMsg.processFlowId) {
this.processFlowName = item.name
}
})
}
})
})
}
}
@ -278,12 +299,14 @@ export default {
padding: 16px 16px 0 16px;
.blodTip {
height: 16px;
font-size: 14px;
font-weight: 600;
color: rgba(0,0,0,0.85);
margin-bottom: 8px;
}
.lightTip {
height: 16px;
font-size: 14px;
font-weight: 400;
color: rgba(102,102,102,0.75);
margin-bottom: 12px;

View File

@ -144,7 +144,7 @@ export default {
color: 'primary'
}
],
activeName: 'barChart',
activeName: 'dataList',
//
queryParams: {
pageNo: 1,
@ -157,19 +157,19 @@ export default {
tableH: this.tableHeight(270),
total: 0,
tableBtn: [
this.$auth.hasPermi('base:group-team:update')
this.$auth.hasPermi('base:order-completion-monitoring:orderDet')
? {
type: 'orderDetail',
btnName: '工单详情'
}
: undefined,
this.$auth.hasPermi('base:group-team:update')
this.$auth.hasPermi('base:order-completion-monitoring:qualityDet')
? {
type: 'qualityDetail',
btnName: '质量详情'
}
: undefined,
this.$auth.hasPermi('base:group-team:update')
this.$auth.hasPermi('base:order-completion-monitoring:sendOut')
? {
type: 'sendOutDetail',
btnName: '发货详情'
@ -194,16 +194,14 @@ export default {
getPage() {
orderMonitor({...this.queryParams}).then(res => {
this.list = res.data || []
this.getPieChart()
// this.getPieChart()
})
},
//
getPieChart() {
var chartDom = document.getElementById('orderPieBar');
var myChart = echarts.init(chartDom);
var option;
option = {
var option = {
color:['#288AFF','#7164FF','#fff','#63BDFF','#8EF0AB','#FFCE6A'],
series: [
{
@ -311,13 +309,12 @@ export default {
show: false
},
data: [
{ value: 1000, name: '5' },
{ value: 800, name: '5' },
{ value: 1048, name: 'xxx' }
]
}
]
}
option && myChart.setOption(option)
},
//
@ -331,7 +328,21 @@ export default {
}
this.getPage()
},
handleClick() {}
handleClick(val) {
console.log(val)
switch (val.type) {
case 'orderDetail':
break
case 'qualityDetail':
break
default:
this.$router.push({
path: '/delivery/delivery-log?orderId='+encodeURI(val.data.name)
})
}
}
}
}
</script>

View File

@ -6,54 +6,27 @@
-->
<template>
<el-form
ref="form"
:model="dataForm"
label-width="120px"
v-loading="formLoading">
<el-form ref="form" :model="dataForm" label-width="120px" v-loading="formLoading">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item
label="产线"
prop="productionId"
<el-form-item label="产线" prop="productionLineId"
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-select
v-model="dataForm.productionId"
placeholder="请选择产线"
filterable
<el-select v-model="dataForm.productionLineId" placeholder="请选择产线" filterable
@change="handleProductlineChange">
<el-option
v-for="opt in productionLineList"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
<el-option v-for="opt in productionLineList" :key="opt.value" :label="opt.label" :value="opt.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="工段"
prop="sectionId"
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-select
v-model="dataForm.sectionId"
placeholder="请选择工段"
filterable
@change="$emit('update', dataForm)">
<el-option
v-for="opt in workshopSectionList"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
<el-form-item label="工段" prop="sectionId" :rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-select v-model="dataForm.sectionId" placeholder="请选择工段" filterable @change="$emit('update', dataForm)">
<el-option v-for="opt in workshopSectionList" :key="opt.value" :label="opt.label" :value="opt.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="按钮盒识别码"
prop="buttonId"
:rules="[
<el-form-item label="按钮盒识别码" prop="buttonId" :rules="[
{ required: true, message: '不能为空', trigger: 'blur' },
{
type: 'number',
@ -62,10 +35,7 @@
transform: (val) => Number.isInteger(Number(val)) && Number(val),
},
]">
<el-input
v-model="dataForm.buttonId"
@change="$emit('update', dataForm)"
placeholder="请输入整数" />
<el-input v-model="dataForm.buttonId" @change="$emit('update', dataForm)" placeholder="请输入整数" />
</el-form-item>
<!--
<el-form-item
@ -87,18 +57,12 @@
<el-col :span="12">
<el-form-item label="按钮盒模式" prop="model">
<el-input
v-model="dataForm.model"
@change="$emit('update', dataForm)"
placeholder="请输入按钮盒模式" />
<el-input v-model="dataForm.model" @change="$emit('update', dataForm)" placeholder="请输入按钮盒模式" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="按钮值"
prop="keyValue"
:rules="[
<el-form-item label="按钮值" prop="keyValue" :rules="[
{ required: true, message: '不能为空', trigger: 'blur' },
{
type: 'number',
@ -111,22 +75,14 @@
Number(val),
},
]">
<el-input
v-model="dataForm.keyValue"
type="number"
min="0"
max="100"
@change="$emit('update', dataForm)"
<el-input v-model="dataForm.keyValue" type="number" min="0" max="100" @change="$emit('update', dataForm)"
placeholder="请输入按钮盒模式" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="检测内容" prop="inspectionDetContent">
<el-input
type="textarea"
v-model="dataForm.inspectionDetContent"
placeholder="请输入检测内容"
<el-input type="textarea" v-model="dataForm.inspectionDetContent" placeholder="请输入检测内容"
@change="$emit('update', dataForm)"></el-input>
</el-form-item>
</el-col>
@ -186,7 +142,7 @@ export default {
async getProductionLineList() {
this.formLoading = true;
const res = await this.$axios({
url: '/base/production-line/listAll',
url: '/base/core-production-line/listAll',
method: 'get',
});
if (res.code == 0) {
@ -201,7 +157,7 @@ export default {
async getWorksectionList(id) {
this.formLoading = true;
const res = await this.$axios({
url: '/base/workshop-section/listByParentId',
url: '/base/core-workshop-section/listByParentId',
method: 'get',
params: {
id,

View File

@ -176,7 +176,7 @@ export default {
filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
},
{
prop: 'productionName',
prop: 'productionLineName',
label: '产线',
},
{
@ -219,7 +219,7 @@ export default {
id: null,
buttonId: null,
inspectionDetContent: null,
productionId: null,
productionLineId: null,
sectionId: null,
model: null,
keyValue: null,

View File

@ -0,0 +1,92 @@
<!--
* @Author: zhp
* @Date: 2023-11-06 15:15:30
* @LastEditTime: 2023-11-06 16:00:24
* @LastEditors: zhp
* @Description:
-->
<template>
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="auto">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="报废原因编码" prop="code">
<el-input v-model="dataForm.code" placeholder="请输入报废类型编码" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="报废原因" prop="content">
<el-input v-model="dataForm.content" placeholder="请输入报废类型" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="报废类型" prop="description">
<el-select v-model="dataForm.typeId" placeholder="请选择报废类型">
<el-option v-for="dict in typeList" :key="dict.id" :label="dict.name" :value="dict.id" />
</el-select>
</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 '../../../core/mixins/basic-add';
import { createQualityScrapDet, updateQualityScrapDet, getQualityScrapDet, getCode } from "@/api/base/qualityScrapDet";
import { getList,} from "@/api/base/qualityScrapType";
// import { getMaterialList } from "@/api/base/material";
export default {
mixins: [basicAdd],
data() {
return {
urlOptions: {
isGetCode: true,
codeURL: getCode,
createURL: createQualityScrapDet,
updateURL: updateQualityScrapDet,
infoURL: getQualityScrapDet,
},
typeList:[],
dataForm: {
id: undefined,
code: undefined,
content: undefined,
typeId:null,
// description: undefined,
remark: undefined,
},
// materialList: [],
dataRule: {
// materialId: [{ required: true, message: "", trigger: "blur" }],
code: [{ required: true, message: "报废原因编码不能为空", trigger: "blur" }],
content: [{ required: true, message: "报废原因不能为空", trigger: "blur" }],
}
};
},
mounted() {
this.getDict()
console.log('我看看', this.dataForm)
},
methods: {
async getDict() {
//
const res = await getList();
this.typeList = res.data;
},
// setMaterialCode() {
// const chooseM = this.materialList.filter(item => {
// return item.id === this.dataForm.materialId
// })
// this.dataForm.materialCode = chooseM[0].code
// }
},
};
</script>

View File

@ -0,0 +1,169 @@
<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="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="30%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
import basicPage from '../../../core/mixins/basic-page';
import { parseTime } from '../../../core/mixins/code-filter';
import {
getQualityScrapDetPage,
deleteQualityScrapDet
} from '@/api/base/qualityScrapDet';
const tableProps = [
{
prop: 'createTime',
label: '添加时间',
filter: parseTime
},
{
prop: 'content',
label: '报废原因'
},
{
prop: 'code',
label: '报废原因编码'
},
{
prop: 'typeName',
label: '报废类型'
},
{
prop: 'remark',
label: '备注'
},
];
export default {
mixins: [basicPage],
data() {
return {
urlOptions: {
getDataListURL: getQualityScrapDetPage,
deleteURL: deleteQualityScrapDet,
// exportURL: exportFactoryExcel,
},
tableProps,
tableBtn: [
this.$auth.hasPermi(`base:quality-inspection-det:update`)
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
this.$auth.hasPermi(`base:quality-inspection-det:delete`)
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v)=>v),
tableData: [],
formConfig: [
{
type: 'input',
label: '批次名',
placeholder: '批次名',
param: 'name',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: this.$auth.hasPermi('base:quality-scrap-det:create') ? 'button' : '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true
},
],
};
},
components: {
AddOrUpdate,
},
created() {},
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;
});
},
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.name = val.name ? val.name : undefined;
this.getDataList();
break;
case 'reset':
this.$refs.searchBarForm.resetForm();
this.listQuery = {
pageSize: 10,
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,72 @@
<!--
* @Author: zhp
* @Date: 2023-11-07 19:28:13
* @LastEditTime: 2023-11-07 19:28:13
* @LastEditors: zhp
* @Description:
-->
<!--
* @Author: zwq
* @Date: 2023-08-01 15:27:31
* @LastEditors: zwq
* @LastEditTime: 2023-08-01 16:25:54
* @Description:
-->
<template>
<div :class="[className, { 'p-0': noPadding }]">
<slot />
</div>
</template>
<script>
export default {
props: {
size: {
// : xl lg md sm
type: String,
default: 'de',
validator: function (val) {
return ['xl', 'lg', 'de', 'md', 'sm'].indexOf(val) !== -1;
},
},
noPadding: {
type: Boolean,
default: false,
},
},
computed: {
className: function () {
return `${this.size}-title`;
},
},
};
</script>
<style lang="scss" scoped>
$pxls: (xl, 28px) (lg, 24px) (de, 20px) (md, 18px) (sm, 16px);
$mgr: 8px;
@each $size, $height in $pxls {
.#{$size}-title {
font-size: 18px;
line-height: $height;
color: #000;
font-weight: 500;
font-family: '微软雅黑', 'Microsoft YaHei', Arial, Helvetica, sans-serif;
&::before {
content: '';
display: inline-block;
vertical-align: top;
width: 4px;
height: $height + 2px;
border-radius: 1px;
margin-right: $mgr;
background-color: #0b58ff;
}
}
}
.p-0 {
padding: 0;
}
</style>

View File

@ -0,0 +1,209 @@
<!--
* @Author: zhp
* @Date: 2023-11-06 15:15:30
* @LastEditTime: 2023-11-07 18:56:20
* @LastEditors: zhp
* @Description:
-->
<template>
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="auto">
<el-row :gutter="24">
<el-col :span="8">
<el-form-item label="工单号" prop="workOrderId">
<el-select v-model="dataForm.workOrderId" placeholder="请选择工单号">
<el-option v-for="dict in workOrderList" :key="dict.id" :label="dict.name" :value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="班组" prop="teamId">
<el-select v-model="dataForm.teamId" placeholder="请选择班组">
<el-option v-for="dict in teamList" :key="dict.id" :label="dict.name" :value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="数量" prop="sum">
<el-input v-model="dataForm.sum" placeholder="请输入数量" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="产线" prop="lineId">
<el-select v-model="dataForm.lineId" placeholder="请选择产线">
<el-option v-for="dict in lineList" :key="dict.id" :label="dict.name" :value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="报废原因" prop="detId">
<el-select v-model="dataForm.detId" placeholder="请选择报废原因">
<el-option v-for="dict in detList" :key="dict.id" :label="dict.name" :value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="报废时间" prop="logTime">
<el-date-picker v-model="dataForm.logTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择日期">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="来源" prop="source">
<el-select v-model="dataForm.source" placeholder="请选择来源">
<el-option v-for="dict in sourceList" :key="dict.id" :label="dict.name" :value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="描述" prop="description">
<el-input v-model="dataForm.description" placeholder="请输入描述" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="备注" prop="remark">
<el-input v-model="dataForm.remark" placeholder="备注" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import basicAdd from '../../../core/mixins/basic-add';
import {
createQualityScrapLog, updateQualityScrapLog, getQualityScrapLog, getWorkOrderList,
getTeamList, getDetList,getLineList } from "@/api/base/qualityScrapLog";
import { getList,} from "@/api/base/qualityScrapType";
// import { getMaterialList } from "@/api/base/material";
import moment from 'moment';
export default {
mixins: [basicAdd],
data() {
return {
urlOptions: {
isGetCode: false,
// codeURL: getCode,
createURL: createQualityScrapLog,
updateURL: updateQualityScrapLog,
infoURL: getQualityScrapLog,
},
lineList:[],
typeList: [],
workOrderList: [],
detList:[],
teamList: [],
sourceList: [
{
id: 1,
name: '手动',
},
{
id: 2,
name: '自动',
}
],
dataForm: {
id: undefined,
logTime: undefined,
source:1,
detId: undefined,
workOrderId: null,
teamId: undefined,
num: undefined,
lineId:undefined,
description:undefined,
// description: undefined,
remark: undefined,
},
// materialList: [],
dataRule: {
// materialId: [{ required: true, message: "", trigger: "blur" }],
workOrderId: [{ required: true, message: "工单号不能为空", trigger: "change" }],
num: [{ required: true, message: "数量不能为空", trigger: "blur" }],
detId: [{ required: true, message: "报废原因不能为空", trigger: "change" }],
logTime: [{ required: true, message: "报废时间不能为空", trigger: "change" }],
}
};
},
mounted() {
this.getDict()
console.log('我看看', this.dataForm)
this.getCurrentTime()
},
methods: {
getCurrentTime() {
// new Date().Format("yyyy-MM-dd HH:mm:ss")
this.dataForm.logTime = new Date()
// this.dataForm.logTime = year + "-" + month + "-" + day;
console.log(this.dataForm.logTime);
},
async getDict() {
//
const res = await getList()
this.typeList = res.data
getWorkOrderList().then((res) => {
console.log(res);
// console.log(response);
this.workOrderList = res.data.map((item) => {
return {
name: item.name,
id: item.id
}
})
// console.log(this.formConfig[0].selectOptions);
// this.listQuery.total = response.data.total;
})
getLineList().then((res) => {
console.log(res);
// console.log(response);
this.lineList = res.data.map((item) => {
return {
name: item.name,
id: item.id
}
})
// console.log(this.formConfig[0].selectOptions);
// this.listQuery.total = response.data.total;
})
getDetList().then((res) => {
console.log(res);
// console.log(response);
this.workOrderList = res.data.map((item) => {
return {
name: item.name,
id: item.id
}
})
// console.log(this.formConfig[0].selectOptions);
// this.listQuery.total = response.data.total;
})
getTeamList().then((res) => {
console.log(res);
// console.log(response);
this.teamList = res.data.map((item) => {
return {
name: item.name,
id: item.id
}
})
// console.log(this.formConfig[0].selectOptions);
// this.listQuery.total = response.data.total;
})
},
// setMaterialCode() {
// const chooseM = this.materialList.filter(item => {
// return item.id === this.dataForm.materialId
// })
// this.dataForm.materialCode = chooseM[0].code
// }
},
};
</script>

View File

@ -0,0 +1,222 @@
<!--
* @Author: zhp
* @Date: 2023-11-06 15:15:30
* @LastEditTime: 2023-11-07 19:38:13
* @LastEditors: zhp
* @Description:
-->
<template>
<el-dialog :visible.sync="dialogVisible" width="50%" :before-close="handleClose">
<small-title slot="title" :no-padding="true">
{{ '详情' }}
</small-title>
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()"
label-width="auto">
<el-row :gutter="24">
<el-col :span="8">
<el-form-item label="工单号" prop="workOrderId">
<el-select v-model="dataForm.workOrderId" placeholder="请选择工单号" disabled>
<el-option v-for="dict in workOrderList" :key="dict.id" :label="dict.name" :value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="班组" prop="teamId">
<el-select v-model="dataForm.teamId" placeholder="请选择班组" disabled>
<el-option v-for="dict in teamList" :key="dict.id" :label="dict.name" :value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="数量" prop="sum">
<el-input v-model="dataForm.sum" placeholder="请输入数量" disabled />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="产线" prop="lineId">
<el-select v-model="dataForm.lineId" placeholder="请选择产线" disabled>
<el-option v-for="dict in lineList" :key="dict.id" :label="dict.name" :value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="报废原因" prop="detId">
<el-select v-model="dataForm.detId" placeholder="请选择报废原因" disabled>
<el-option v-for="dict in detList" :key="dict.id" :label="dict.name" :value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="报废时间" prop="logTime">
<el-date-picker v-model="dataForm.logTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" disabled
placeholder="选择日期">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="来源" prop="source">
<el-select v-model="dataForm.source" placeholder="请选择来源" disabled>
<el-option v-for="dict in sourceList" :key="dict.id" :label="dict.name" :value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="描述" prop="description">
<el-input v-model="dataForm.description" placeholder="请输入描述" disabled />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="备注" prop="remark">
<el-input v-model="dataForm.remark" placeholder="备注" disabled />
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-dialog>
</template>
<script>
import basicAdd from '../../../core/mixins/basic-add';
import {
createQualityScrapLog, updateQualityScrapLog, getQualityScrapLog, getWorkOrderList,
getTeamList, getDetList,getLineList } from "@/api/base/qualityScrapLog";
import { getList,} from "@/api/base/qualityScrapType";
import SmallTitle from './SmallTitle';
export default {
components: {
SmallTitle,
},
mixins: [basicAdd],
data() {
return {
urlOptions: {
isGetCode: false,
// codeURL: getCode,
createURL: createQualityScrapLog,
updateURL: updateQualityScrapLog,
infoURL: getQualityScrapLog,
},
lineList:[],
typeList: [],
workOrderList: [],
detList:[],
teamList: [],
sourceList: [
{
id: 1,
name: '手动',
},
{
id: 2,
name: '自动',
}
],
dialogVisible:false,
dataForm: {
id: undefined,
logTime: undefined,
source:1,
detId: undefined,
workOrderId: null,
teamId: undefined,
num: undefined,
lineId:undefined,
description:undefined,
// description: undefined,
remark: undefined,
},
// materialList: [],
dataRule: {
// materialId: [{ required: true, message: "", trigger: "blur" }],
workOrderId: [{ required: true, message: "工单号不能为空", trigger: "change" }],
num: [{ required: true, message: "数量不能为空", trigger: "blur" }],
detId: [{ required: true, message: "报废原因不能为空", trigger: "change" }],
logTime: [{ required: true, message: "报废时间不能为空", trigger: "change" }],
}
};
},
mounted() {
// this.getDict()
console.log('我看看', this.dataForm)
this.getCurrentTime()
},
methods: {
init() {
this.dialogVisible = true
},
getCurrentTime() {
// new Date().Format("yyyy-MM-dd HH:mm:ss")
this.dataForm.logTime = new Date()
// this.dataForm.logTime = year + "-" + month + "-" + day;
console.log(this.dataForm.logTime);
},
// async getDict() {
// //
// const res = await getList()
// this.typeList = res.data
// getWorkOrderList().then((res) => {
// console.log(res);
// // console.log(response);
// this.workOrderList = res.data.map((item) => {
// return {
// name: item.name,
// id: item.id
// }
// })
// // console.log(this.formConfig[0].selectOptions);
// // this.listQuery.total = response.data.total;
// })
// getLineList().then((res) => {
// console.log(res);
// // console.log(response);
// this.lineList = res.data.map((item) => {
// return {
// name: item.name,
// id: item.id
// }
// })
// // console.log(this.formConfig[0].selectOptions);
// // this.listQuery.total = response.data.total;
// })
// getDetList().then((res) => {
// console.log(res);
// // console.log(response);
// this.workOrderList = res.data.map((item) => {
// return {
// name: item.name,
// id: item.id
// }
// })
// // console.log(this.formConfig[0].selectOptions);
// // this.listQuery.total = response.data.total;
// })
// getTeamList().then((res) => {
// console.log(res);
// // console.log(response);
// this.teamList = res.data.map((item) => {
// return {
// name: item.name,
// id: item.id
// }
// })
// // console.log(this.formConfig[0].selectOptions);
// // this.listQuery.total = response.data.total;
// })
// },
// setMaterialCode() {
// const chooseM = this.materialList.filter(item => {
// return item.id === this.dataForm.materialId
// })
// this.dataForm.materialCode = chooseM[0].code
// }
},
};
</script>

View File

@ -0,0 +1,213 @@
<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="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" @refreshDataList="successSubmit"></add-or-update>
</base-dialog>
<detail-or-update v-if="detailOrUpdateVisible" ref="detailOrUpdate" @refreshDataList="successSubmit" />
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
import DetailOrUpdate from './detail-or-updata';
import basicPage from '../../../core/mixins/basic-page';
import { parseTime } from '../../../core/mixins/code-filter';
import {
getQualityScrapLogPage,
deleteQualityScrapLog,
getWorkOrderList,
getTeamList
} from '@/api/base/qualityScrapLog';
const tableProps = [
{
prop: 'createTime',
label: '添加时间',
filter: parseTime
},
{
prop: 'workOrderName',
label: '工单'
},
{
prop: 'teamId',
label: '班组'
},
{
prop: 'detContent',
label: '报废原因'
},
{
prop: 'logTime',
label: '报废时间',
filter: parseTime
},
{
prop: 'num',
label: '数量'
},
];
export default {
mixins: [basicPage],
data() {
return {
urlOptions: {
getDataListURL: getQualityScrapLogPage,
deleteURL: deleteQualityScrapLog,
// exportURL: exportFactoryExcel,
},
tableProps,
tableBtn: [
this.$auth.hasPermi(`base:quality-scrap-log:update`)
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
this.$auth.hasPermi(`base:quality-scrap-log:detail`)
? {
type: 'detail',
btnName: '详情',
}
: undefined,
this.$auth.hasPermi(`base:quality-scrap-log:delete`)
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v)=>v),
tableData: [],
detailOrUpdateVisible:false,
formConfig: [
{
type: 'select',
label: '工单',
selectOptions: [],
labelField: 'name',
valueField: 'id',
param: 'workOrderId',
},
{
type: 'select',
label: '班组',
selectOptions: [],
labelField: 'name',
valueField: 'id',
param: 'teamId',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: this.$auth.hasPermi('base:quality-scrap-det:create') ? 'button' : '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true
},
],
};
},
components: {
AddOrUpdate,
DetailOrUpdate
},
created() {
this.getDict()
},
methods: {
otherMethods(val) {
if (val.type === 'detail') {
this.detailOrUpdateVisible = true;
// this.addOrEditTitle = "";
this.$nextTick(() => {
this.$refs.detailOrUpdate.init(val.data.id, true);
});
}
},
//
getDict() {
getWorkOrderList().then((res) => {
console.log(res);
// console.log(response);
this.formConfig[0].selectOptions = res.data.map((item) => {
return {
name: item.name,
id: item.id
}
})
// console.log(this.formConfig[0].selectOptions);
// this.listQuery.total = response.data.total;
})
getTeamList().then((res) => {
console.log(res);
// console.log(response);
this.formConfig[1].selectOptions = res.data.map((item) => {
return {
name: item.name,
id: item.id
}
})
// console.log(this.formConfig[0].selectOptions);
// this.listQuery.total = response.data.total;
})
},
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;
});
},
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.workOrderId = val.workOrderId ? val.workOrderId : undefined;
this.listQuery.teamId = val.teamId ? val.teamId : undefined;
this.getDataList();
break;
case 'reset':
this.$refs.searchBarForm.resetForm();
this.listQuery = {
pageSize: 10,
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,86 @@
<!--
* @Author: zhp
* @Date: 2023-11-06 15:15:30
* @LastEditTime: 2023-11-06 15:36:31
* @LastEditors: zhp
* @Description:
-->
<template>
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="auto">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="报废类型编码" prop="code">
<el-input v-model="dataForm.code" placeholder="请输入报废类型编码" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="报废类型" prop="name">
<el-input v-model="dataForm.name" placeholder="请输入报废类型" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="描述类型" prop="description">
<el-input v-model="dataForm.description" clearable placeholder="描述类型" />
</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 '../../../core/mixins/basic-add';
import { createQualityScrapType, updateQualityScrapType, getQualityScrapType, getCode } from "@/api/base/qualityScrapType";
// import { getMaterialList } from "@/api/base/material";
export default {
mixins: [basicAdd],
data() {
return {
urlOptions: {
isGetCode: true,
codeURL: getCode,
createURL: createQualityScrapType,
updateURL: updateQualityScrapType,
infoURL: getQualityScrapType,
},
dataForm: {
id: undefined,
code: undefined,
name: undefined,
description: undefined,
remark: undefined,
},
// materialList: [],
dataRule: {
// materialId: [{ required: true, message: "", trigger: "blur" }],
code: [{ required: true, message: "报废类型编码不能为空", trigger: "blur" }],
name: [{ required: true, message: "报废类型不能为空", trigger: "blur" }],
}
};
},
mounted() {
// this.getDict()
console.log('我看看', this.dataForm)
},
methods: {
// async getDict() {
// //
// const res = await getMaterialList();
// this.materialList = res.data;
// },
// setMaterialCode() {
// const chooseM = this.materialList.filter(item => {
// return item.id === this.dataForm.materialId
// })
// this.dataForm.materialCode = chooseM[0].code
// }
},
};
</script>

View File

@ -0,0 +1,169 @@
<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="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="30%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
import basicPage from '../../../core/mixins/basic-page';
import { parseTime } from '../../../core/mixins/code-filter';
import {
getQualityScrapTypePage,
deleteQualityScrapType
} from '@/api/base/qualityScrapType';
const tableProps = [
{
prop: 'createTime',
label: '添加时间',
filter: parseTime
},
{
prop: 'name',
label: '报废类型'
},
{
prop: 'code',
label: '报废类型编码'
},
{
prop: 'description',
label: '描述信息'
},
{
prop: 'remark',
label: '备注'
},
];
export default {
mixins: [basicPage],
data() {
return {
urlOptions: {
getDataListURL: getQualityScrapTypePage,
deleteURL: deleteQualityScrapType,
// exportURL: exportFactoryExcel,
},
tableProps,
tableBtn: [
this.$auth.hasPermi(`base:quality-scrap-type:update`)
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
this.$auth.hasPermi(`base:quality-scrap-type:delete`)
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v)=>v),
tableData: [],
formConfig: [
{
type: 'input',
label: '批次名',
placeholder: '批次名',
param: 'name',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: this.$auth.hasPermi('base:quality-scrap-type:create') ? 'button' : '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true
},
],
};
},
components: {
AddOrUpdate,
},
created() {},
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;
});
},
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.name = val.name ? val.name : undefined;
this.getDataList();
break;
case 'reset':
this.$refs.searchBarForm.resetForm();
this.listQuery = {
pageSize: 10,
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,270 @@
<!--
filename: dialogForm.vue
author: liubin
date: 2023-09-11 15:55:13
description: DialogForm for qualityInspectionRecord only
-->
<template>
<el-form
ref="form"
:model="innerDataForm"
label-width="100px"
v-loading="formLoading">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item
label="检测内容"
prop="inspectionDetId"
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-select
v-model="innerDataForm.inspectionDetId"
placeholder="请选择检测内容"
filterable
clearable
@change="handleInspectionDetChange">
<el-option
v-for="opt in inspectionDetList"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="来源"
prop="source"
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-select
v-model="innerDataForm.source"
placeholder="请选择来源"
filterable
clearable
@change="$emit('update', innerDataForm)">
<el-option
v-for="opt in [
{ label: '手动', value: 1 },
{ label: '自动', value: 2 },
]"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item
label="产线"
prop="productionLineId"
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-select
v-model="innerDataForm.productionLineId"
placeholder="请选择产线"
filterable
clearable
@change="handleProductlineChange">
<el-option
v-for="opt in productionLineList"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="工段"
prop="sectionId"
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-select
v-model="innerDataForm.sectionId"
placeholder="请选择工段"
clearable
filterable
@change="$emit('update', innerDataForm)">
<el-option
v-for="opt in sectionList"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="检测人员" prop="checkPerson">
<el-input
v-model="innerDataForm.checkPerson"
clearable
@change="$emit('update', innerDataForm)"
placeholder="请输入检测人员" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="检测时间"
prop="checkTime"
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-date-picker
v-model="innerDataForm.checkTime"
type="datetime"
placeholder="请选择检测时间"
value-format="timestamp"
@change="$emit('update', innerDataForm)"></el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col>
<el-form-item label="描述" prop="explainText">
<el-input
v-model="innerDataForm.explainText"
placeholder="请输入描述信息"
@change="$emit('update', innerDataForm)"
type="textarea"></el-input>
</el-form-item>
</el-col>
<el-col>
<el-form-item label="备注" prop="remark">
<el-input
v-model="innerDataForm.remark"
@change="$emit('update', innerDataForm)"
placeholder="请输入备注"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
export default {
name: 'DialogForm',
model: {
prop: 'dataForm',
event: 'update',
},
emits: ['update'],
components: {},
props: {
dataForm: {
type: Object,
default: () => ({}),
},
},
data() {
return {
formLoading: true,
inspectionDetList: [],
productionLineList: [],
sectionList: [],
innerDataForm: {},
cacheInspectionDetList: null,
};
},
mounted() {
Promise.all([this.getProductLineList(), this.getInspectionDetList()]).then(
() => {
this.formLoading = false;
}
);
},
watch: {
// 'innerDataForm.productionLineId': {
// handler: async function (plId) {
// if (plId) await this.getWorksectionList(plId);
// },
// immediate: true,
// },
dataForm: {
handler: function (dataForm) {
this.innerDataForm = Object.assign({}, dataForm);
if (dataForm.productionLineId)
this.getWorksectionList(dataForm.productionLineId);
},
immediate: true,
},
},
methods: {
/** 模拟透传 ref */
validate(cb) {
return this.$refs.form.validate(cb);
},
resetFields(args) {
return this.$refs.form.resetFields(args);
},
handleInspectionDetChange(value) {
const { id, content } = this.cacheInspectionDetList.find(
(item) => item.id == value
);
this.innerDataForm.inspectionDetId = id;
this.innerDataForm.inspectionDetContent = content;
this.$emit('update', this.innerDataForm);
},
async handleProductlineChange(id) {
// await this.getWorksectionList(id);
this.innerDataForm.sectionId = null;
this.$emit('update', this.innerDataForm);
},
// getCode
async getCode(url) {
const response = await this.$axios(url);
return response.data;
},
// 线
async getProductLineList() {
const response = await this.$axios('/base/core-production-line/listAll');
this.productionLineList = response.data.map((item) => ({
label: item.name,
value: item.id,
}));
},
//
async getInspectionDetList() {
const response = await this.$axios(
'/base/quality-inspection-det/listAll'
);
this.cacheInspectionDetList = response.data;
this.inspectionDetList = response.data.map((item) => ({
label: item.content,
value: item.id,
}));
},
//
async getWorksectionList(plId) {
const response = await this.$axios(
'/base/workshop-section/listByParentId',
{
params: {
id: plId,
},
}
);
this.sectionList = response.data.map((item) => ({
label: item.name,
value: item.id,
}));
},
},
};
</script>
<style scoped lang="scss">
.el-date-editor,
.el-select {
width: 100%;
}
</style>

View File

@ -0,0 +1,460 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<SearchBar :formConfigs="searchBarFormConfig" ref="search-bar" @headBtnClick="handleSearchBarBtnClick" />
<!-- 列表 -->
<el-row>
<el-col class="custom-tabs">
<el-tabs v-model="activeName" :stretch="true" @tab-click="handleTabClick">
<el-tab-pane :label="'\u2002表格数据\u2002'" name="table">
<!-- 列表 -->
<base-table class="base-table__margin" :table-props="productProps" :page="1" :limit="10" :table-data="list">
</base-table>
</el-tab-pane>
<el-tab-pane :label="'\u3000图形数据\u3000'" name="chart" style="overflow: inherit">
<!-- <base-table class="base-table__margin" :table-props="valueTableProps" :page="1" :limit="10"
:table-data="valueList" @emitFun="handleEmitFun"></base-table> -->
</el-tab-pane>
</el-tabs>
</el-col>
</el-row>
<!-- 分页组件 -->
<!-- <pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
@pagination="getList" /> -->
<!-- 对话框(添加 / 修改) -->
<!-- <base-dialog
:dialogTitle="title"
:dialogVisible="open"
width="50%"
@close="cancel"
@cancel="cancel"
@confirm="submitForm">
<DialogForm v-if="open" ref="form" v-model="form" />
</base-dialog> -->
</div>
</template>
<script>
import {
getInspectionData,
getProductList,
getWorkOrderList
} from '@/api/monitoring/statisticalData';
// import Editor from '@/components/Editor';
import moment from 'moment';
// import DialogForm from './dialogForm.vue';
// import basicPageMixin from '@/mixins/lb/basicPageMixin';
export default {
name: 'statisticalData',
// components: {
// DialogForm,
// },
// mixins: [basicPageMixin],
data() {
return {
list: [],
dynamicProps: [],
activeName: 'table',
searchBarFormConfig: [
// {
// type: 'select',
// label: '',
// placeholder: '',
// param: 'workOrderId',
// selectOptions: [],
// },
// {
// type: 'select',
// label: '',
// placeholder: '',
// param: 'productionId',
// selectOptions: [],
// },
// {
// type: 'input',
// label: '',
// placeholder: '',
// param: 'inspectionDetContent',
// },
{
type: 'datePicker',
label: '时间段',
dateType: 'daterange', // datetimerange
// format: 'yyyy-MM-dd HH:mm:ss',
format: 'yyyy-MM-dd',
valueFormat: 'timestamp',
rangeSeparator: '-',
startPlaceholder: '开始日期',
endPlaceholder: '结束日期',
defaultTime: ['00:00:00', '23:59:59'],
param: 'checkTime',
// width: 350,
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
// {
// type: this.$auth.hasPermi(
// 'base:quality-inspection-record:create'
// )
// ? 'button'
// : '',
// btnName: '',
// name: 'add',
// plain: true,
// color: 'success',
// },
],
// tableBtn: [
// this.$auth.hasPermi('base:quality-inspection-record:update')
// ? {
// type: 'edit',
// btnName: '',
// }
// : undefined,
// this.$auth.hasPermi('base:quality-inspection-record: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'),
// },
// {
// // width: 128,
// prop: 'inspectionDetContent',
// label: '',
// },
// {
// // width: 128,
// prop: 'lineName',
// label: '线',
// },
// {
// // width: 128,
// prop: 'checkPerson',
// label: '',
// },
// {
// // width: 160,
// prop: 'checkTime',
// label: '',
// filter: (val) =>
// val != null ? moment(val).format('yyyy-MM-DD HH:mm:ss') : '-',
// },
// {
// width: 90,
// prop: 'source',
// label: '',
// filter: (val) => ['', '', ''][val],
// },
// ],
// keys, queryParams pageNo, pageSize key
// searchBarKeys: ['inspectionDetContent', 'checkTime', 'productionLineId'],
// form: {
// id: undefined,
// inspectionDetId: undefined,
// inspectionDetContent: undefined,
// productionLineId: undefined,
// sectionId: undefined,
// checkPerson: undefined,
// checkTime: undefined,
// source: undefined,
// explainText: undefined,
// remark: undefined,
// },
//
queryParams: {
workOrderId: undefined,
productId: undefined,
startTime: undefined,
endTime: undefined,
// productionLineId: null,
},
};
},
created() {
// this.getProductLineList();
},
computed: {
productProps() {
return [
{
// width: 160,
prop: 'inspectionContent',
label: '检测内容',
},
...this.dynamicProps,
{
// width: 128,
prop: 'sumInput',
label: '检测类型总数',
},
{
// width: 128,
prop: 'scrapRatio',
label: '比例(%)',
// subcomponent: {
// name: 'TextOnly',
// props: {
// injectData: {
// type: Object,
// default: () => ({}),
// },
// },
// data() {
// return {
// text: '',
// };
// },
// methods: {
// handleEmit(payload) {
// console.log('handleEmit', payload);
// },
// },
// render(h) {
// return h('el-button', { props: { type: 'text' } }, this.text);
// },
// },
},
];
},
},
mounted() {
if (this.$route.params.startTime && this.$route.params.endTime) {
this.searchBarFormConfig[0].defaultSelect = [
this.$route.params.startTime,
this.$route.params.endTime,
];
this.queryParams.param = {};
this.$set(
this.queryParams.param,
'startTime',
this.$route.params.startTime
);
this.$set(this.queryParams.param, 'endTime', this.$route.params.endTime);
} else {
this.searchBarFormConfig[0].defaultSelect = [];
}
this.getList()
},
methods: {
/** 获取搜索栏的产线列表 */
// async getDict() {
// const res = await getProductList()
// const result = await getWorkOrderList()
// console.log(res);
// this.searchBarFormConfig[1].selectOptions = res.data.map((item) => {
// return {
// name: item.name,
// id:item.id
// }
// })
// this.searchBarFormConfig[0].selectOptions = result.data.map((item) => {
// return {
// name: item.name,
// id: item.id
// }
// })
// },
// getProductLineList() {
// this.$axios('/base/production-line/listAll').then((response) => {
// this.searchBarFormConfig[0].selectOptions = response.data.map(
// (item) => {
// return {
// name: item.name,
// id: item.id,
// };
// }
// );
// });
// },
getList() {
this.getDataList()
// this.getDict()
},
/** 查询列表 */
async getDataList() {
this.loading = true;
//
const res = await getInspectionData(this.queryParams)
console.log(res);
this.dynamicProps = this.filterNameData(res.data[0].upPart)
console.log(this.dynamicProps)
this.list = this.filterData(res.data[0].upPart.data)
console.log(this.list);
},
filterNameData(upData) {
console.log(upData);
// upData.forEach((ele) => {
const ndSet = new Set();
upData.nameData.forEach((nd) => {
ndSet.add(nd.name);
});
return Array.from(ndSet.values())
.sort()
.map((name) => ({
prop: name,
label: name,
}));
// })
},
filterData(data) {
return data.map((item) => {
const { data: innerData } = item;
const keyValuePairs = {};
innerData.map((d) => {
keyValuePairs[d.dynamicName] = d.dynamicValue;
});
return {
inspectionContent: item.inspectionContent,
...keyValuePairs,
sumInput: item.sumInput,
scrapRatio: item.scrapRatio,
};
});
},
/** 取消按钮 */
handleSearchBarBtnClick(val) {
if (val.btnName === 'search') {
this.queryParams.workOrderId = val.workOrderId ? val.workOrderId : undefined
this.queryParams.productId = val.productId ? val.productId : undefined
this.queryParams.startTime = val.checkTime ? val.checkTime[0] : undefined
this.queryParams.endTime = val.checkTime ? val.checkTime[1] : undefined
this.getList()
}
console.log(val);
}
/** 搜索按钮操作 */
// 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;
// getQualityInspectionRecord(id).then((response) => {
// /** */
// const info = {}
// Object.keys(this.form).forEach(key => {
// info[key] = response.data[key]
// });
// this.form = info;
// this.open = true;
// this.title = '';
// });
// },
// /** */
// submitForm() {
// this.$refs['form'].validate((valid) => {
// if (!valid) {
// return;
// }
// //
// if (this.form.id != null) {
// updateQualityInspectionRecord(this.form).then((response) => {
// this.$modal.msgSuccess('');
// this.open = false;
// this.getList();
// });
// return;
// }
// //
// createQualityInspectionRecord(this.form).then((response) => {
// this.$modal.msgSuccess('');
// this.open = false;
// this.getList();
// });
// });
// },
// /** */
// handleDelete(row) {
// const id = row.id;
// this.$modal
// .confirm('"' + row.inspectionDetContent + '"?')
// .then(function () {
// return deleteQualityInspectionRecord(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 exportQualityInspectionRecordExcel(params);
// })
// .then((response) => {
// this.$download.excel(response, '.xls');
// this.exportLoading = false;
// })
// .catch(() => {});
// },
},
};
</script>
<style scoped lang="scss">
:deep(.custom-tabs) {
.el-tabs__header {
margin-bottom: 8px;
display: inline-block;
transform: translateY(-12px);
}
.el-tabs__content {
overflow: visible;
}
.el-tabs__item {
padding-left: 0 !important;
padding-right: 0 !important;
line-height: 36px !important;
height: 36px;
}
}
</style>

View File

@ -0,0 +1,279 @@
<!--
filename: pieChart.vue
author: liubin
date: 2023-09-06 15:02:49
description: 饼图
-->
<template>
<div class="chart-grid-item" style="overflow: inherit">
<div
class="pie-chart"
ref="pieChart"
style="overflow: inherit;"
:data-eqname="value.equipmentName || 'Default'"></div>
<div class="data-view">
<div class="data-view__item">
<!-- <div class="data-view__item__value">111</div> -->
<div class="data-view__item__value">{{ textData.workTime }}</div>
<div class="data-view__item__title blue">工作时长</div>
</div>
<div class="data-view__item">
<!-- <div class="data-view__item__value">22</div> -->
<div class="data-view__item__value">{{ textData.stopTime }}</div>
<div class="data-view__item__title green">停机时长</div>
</div>
<div class="data-view__item">
<!-- <div class="data-view__item__value">10</div> -->
<div class="data-view__item__value">{{ textData.downTime }}</div>
<div class="data-view__item__title purple">故障时长</div>
</div>
<div class="data-view__item">
<!-- <div class="data-view__item__value">100%</div> -->
<div class="data-view__item__value">{{ textData.peEfficiency }}</div>
<div class="data-view__item__title yellow">速度开动率</div>
</div>
</div>
</div>
</template>
<script>
import * as echarts from 'echarts';
export default {
name: 'pieChart',
components: {},
props: ['value'],
data() {
return {
chart: null,
textData: {
workTime: '',
downTime: '',
stopTime: '',
peEfficiency: '',
},
config: {
title: {
text: '产线1', //<=========
top: '35%',
left: '49%',
textAlign: 'center',
textStyle: {
fontSize: 18,
},
subtext: '设备', //<=========
subtextStyle: {
fontSize: 14,
},
},
color: ['#3da8fd', '#8ef0ab', '#6b5cfd', '#FFC72A', 'transparent'],
grid: {
top: 0,
left: 0,
right: 0,
bottom: 0,
},
tooltip: {
trigger: 'item',
},
legend: {
show: false,
top: '0%',
left: 'center',
textStyle: {
fontSize: 10,
},
itemWidth: 10,
itemHeight: 10,
},
series: [
//
{
//
name: '',
type: 'pie',
radius: ['75%', '90%'],
center: ['50%', '48%'],
label: {
show: false,
},
data: [
//<=========
{ name: '工作时长', value: 1048 },
{ name: '停机时长', value: 735 },
{ name: '故障时长', value: 580 },
],
},
{
//
name: '',
type: 'pie',
center: ['50%', '48%'],
radius: ['60%', '75%'],
itemStyle: {
borderRadius: 10,
},
label: {
show: false,
},
data: [
//<=========
{ name: '总', value: 3000 },
{ name: '', value: 1400 },
],
},
// {
// name: this.value.equipmentName || 'Default',
// type: 'pie',
// radius: ['40%', '75%'],
// avoidLabelOverlap: false,
// label: {
// show: false,
// position: 'center',
// },
// data: ['workTime', 'stopTime', 'downTime'].map((v, index) => ({
// name: ['', '', ''][index],
// value: this.value[v],
// })),
// // data: [
// // { value: 1048, name: 'Search Engine' },
// // { value: 735, name: 'Direct' },
// // { value: 580, name: 'Email' },
// // { value: 484, name: 'Union Ads' },
// // { value: 300, name: 'Video Ads' },
// // ],
// },
],
},
};
},
mounted() {
console.log('value', this.value);
if (!this.chart) {
this.chart = echarts.init(this.$refs.pieChart);
this.$nextTick(() => {
this.chart.setOption(this.config);
});
}
},
beforeDestroy() {
if (this.chart) this.chart.dispose();
},
watch: {
value: {
handler(val) {
this.updateConfig(val);
if (this.chart) this.chart.setOption(this.config);
},
deep: true,
immediate: true,
},
},
methods: {
updateConfig(item) {
const {
lineName, // 线
equipmentName, //
downTime, // (h)
stopTime, // (h)
workTime, // (h)
peEfficiency, //
timeEfficiency, //
//===============//
sectionName,
workRate,
stopRate,
downRate,
realProcSpeed,
designProcSpeed,
oee,
teep,
downCount,
mtbf,
mttr,
} = item;
this.config.title.text = lineName;
this.config.title.subtext = equipmentName;
this.config.series[0].data = [
{ name: '工作时长', value: workTime },
{ name: '停机时长', value: stopTime },
{ name: '故障时长', value: downTime },
];
this.config.series[1].data = [
{ name: '速度开动率', value: peEfficiency },
{ name: '', value: Math.ceil(peEfficiency) - peEfficiency },
];
//
this.textData = {
workTime: +workTime.toFixed(2),
stopTime: +stopTime.toFixed(2),
downTime: +downTime.toFixed(2),
peEfficiency: +peEfficiency.toFixed(2),
};
},
},
};
</script>
<style scoped lang="scss">
.chart-grid-item {
padding: 12px;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
}
.pie-chart {
height: 1px;
width: 100%;
flex: 1;
padding: 12px;
position: relative;
}
.data-view {
display: flex;
justify-content: center;
}
.data-view__item {
display: flex;
flex-direction: column;
text-align: center;
align-items: center;
user-select: none;
padding: 0 6px;
}
.data-view__item:not(:last-child) {
border-right: 1px solid #f1f1f1;
}
.data-view__item__value {
font-size: 16px;
line-height: 24px;
}
.data-view__item__title {
font-size: 8px;
line-height: 14px;
}
.blue {
color: #3da8fd;
}
.green {
color: #8ef0ab;
}
.purple {
color: #6b5cfd;
}
.yellow {
color: #ffc72a;
}
</style>

View File

@ -0,0 +1,714 @@
<!--
filename: index.vue
author: liubin
date: 2023-08-30 14:02:49
description: 设备加工数量
-->
<template>
<div style="flex: 1; display: flex; background: #f2f4f9">
<div class="app-container" style="
margin-right: 12px;
border-radius: 8px;
background: #fff;
padding: 0;
">
<div class="factory-list__selector" style="margin: 12px" title="点击切换工厂" @mouseenter="factoryListOpen = true"
@mouseleave="factoryListOpen = false">
{{ currentFactory?.label || '点我选择工厂' }}
<div class="factory-list__wrapper" :class="{ open: factoryListOpen }">
<ul class="factory-list" v-if="sidebarContent.length" @click.prevent="factoryChangeHandler">
<li v-for="fc in sidebarContent" :key="fc.id" :data-value="fc.id" class="factory-list__item"
:class="{ 'is-current': fc.id == currentFactory?.id }">
<span>
{{ fc.label }}
</span>
<svg-icon v-if="fc.id == currentFactory?.id" icon-class="Confirm" style="height: 14px; width: 14px" />
</li>
</ul>
<div v-else style="color: #0008; width: 128px; text-align: center">
- -
</div>
</div>
</div>
<!-- side bar -->
<div class="side-bar__left" style="width: 240px; height: 100%">
<el-tree class="custom-tree-class" :data="currentFactory?.children" :props="treeProps" :empty-text="''"
icon-class="custom-icon-class" @node-click="handleSidebarItemClick">
<!-- <div class="custom-tree-node" slot-scope="{ node, data }">
<span class="icon"></span>
<span>{{ node.label }}</span>
</div> -->
</el-tree>
</div>
</div>
<div class="app-container equipment-process-amount" style="flex: 1; border-radius: 8px; background: #fff">
<!-- main area -->
<div class="main-content" style="display: flex; flex-direction: column">
<SearchBar :formConfigs="searchBarFormConfig" ref="search-bar" @headBtnClick="handleSearchBarBtnClick"
@select-changed="handleSearchBarChanged" />
<el-row>
<el-col class="custom-tabs">
<div v-if="tableList.length" class="tables">
<div class="custom-table" v-for="table in tableList" :key="table.key">
<!-- {{ JSON.stringify(spanMethod) }} -->
<base-table :key="table.key + '__basetable'" :table-props="table.tableProps"
:table-data="table.dataManager?.dataList ?? []" :span-method="spanMethod"
@emitFun="(val) => handleEmitFun(table, val)"></base-table>
<pagination :key="table.key + '__pagination'" v-show="table.total > 0" :total="table.total"
:page.sync="table.pageNo" :limit.sync="table.pageSize" :page-size="table.pageSize"
:page-sizes="[1, 3, 5, 10, 20]" @pagination="
({ page, limit, current }) =>
getListFor(table, { page, limit, current })
" />
</div>
</div>
<div v-else class="no-data-bg">
</div>
</el-col>
</el-row>
<!-- <transition appear name="vvv" mode="out-in"></transition> -->
</div>
</div>
</div>
</template>
<script>
// import Graph from './graph.vue';
import {
getWorkOrderList,
getTreeData
} from '@/api/quality/deviceParameters';
export default {
name: 'EquipmentProcessAmount',
// components: { Graph },
props: {},
data() {
const now = new Date();
const [y, m, d] = [now.getFullYear(), now.getMonth(), now.getDate()];
const today = new Date(y, m, d, 0, 0, 0, 0).getTime();
const aWeekAgo = today - 3600 * 1000 * 24 * 7;
return {
renderKey: Math.random(),
factoryListOpen: false,
currentFactory: null,
factoryList: [
{ name: '1', value: 1 },
{ name: '2', value: 2 },
{ name: '3', value: 3 },
{ name: '4', value: 4 },
{ name: '5', value: 5 },
{ name: '6', value: 6 },
],
sidebarContent: [
// {
// id: 'fc1',
// name: '',
// lines: [
// {
// name: '线1',
// id: 'pl1',
// sections: [
// {
// name: '1',
// id: 'pl1ws1',
// equipments: [
// {
// name: '1',
// id: 'pl1ws1--eq1',
// },
// {
// name: '2',
// id: 'pl1ws1--eq2',
// },
// {
// name: '3',
// id: 'pl1ws1--eq3',
// },
// ],
// },
// {
// name: '2',
// id: 'pl1ws2',
// equipments: [
// {
// name: '1',
// id: 'pl2ws1--eq1',
// },
// {
// name: '2',
// id: 'pl2ws1--eq2',
// },
// {
// name: '3',
// id: 'pl2ws1--eq3',
// },
// ],
// },
// {
// name: '3',
// id: 'pl1ws3',
// equipments: [
// {
// name: '1',
// id: 'pl3ws1--eq1',
// },
// {
// name: '2',
// id: 'pl3ws1--eq2',
// },
// {
// name: '3',
// id: 'pl3ws1--eq3',
// },
// ],
// },
// ],
// },
// {
// name: '线2',
// id: 'pl2',
// sections: [
// {
// name: '1',
// id: 'pl2ws1',
// },
// {
// name: '2',
// id: 'pl2ws2',
// },
// {
// name: '3',
// id: 'pl2ws3',
// },
// ],
// },
// ],
// },
],
tableList: [],
queryParams: {
id: null,
time: [new Date(aWeekAgo), new Date(today)],
},
activeName: 'table',
searchBarFormConfig: [
{
type: 'select',
label: '工单',
selectOptions: [],
labelField: 'name',
valueField: 'id',
param: 'workOrderId',
onchange: true,
},
{
type: 'datePicker',
label: '时间段',
dateType: 'daterange', // datetimerange
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始日期',
endPlaceholder: '结束日期',
defaultTime: ['00:00:00', '23:59:59'],
param: 'timeVal',
width: 350,
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
// {
// type: 'separate',
// },
// {
// type: 'button',
// btnName: '',
// name: 'table',
// plain: true,
// color: 'success',
// },
// {
// type: 'button',
// btnName: '',
// name: 'graph',
// plain: true,
// color: 'warning',
// },
// {
// type: this.$auth.hasPermi('base:equipment-group:export') ? 'button' : '',
// btnName: '',
// name: 'export',
// color: 'warning',
// },
],
tableProps: [
{ prop: 'lineName', label: '产线' },
{ prop: 'sectionName', label: '工段' },
// { prop: 'externalCode', label: '' },
{ prop: 'equipmentId', label: '设备编码' },
{ prop: 'equipmentName', label: '设备名称' },
{ prop: 'totalQuantity', label: '加工数量' },
],
mode: 'table', // table | graph
queryParams: {
// pageNo: 1,
// pageSize: 999,
recordTime: [],
equipmentId: null,
lineId: null,
sectionId: null,
productId: null,
},
list: [],
treeProps: {
children: 'children',
label: 'label',
},
};
},
// mounted() {
// },
computed: {
// id() {
// return this.$route.params.equipmentId;
// },
// code() {
// return this.$route.params.equipmentCode;
// },
// name() {
// return this.$route.params.equipmentName;
// },
},
mounted() {
this.getDict()
// if (this.id) this.$set(this.queryParams, 'id', this.id);
// if (this.code)
// this.$set(this.searchBarFormConfig[0], 'defaultSelect', this.code);
// if (this.name)
// this.$set(this.searchBarFormConfig[1], 'defaultSelect', this.name);
// this.handleResponse();
},
methods: {
handleSearchBarChanged({ param, value }) {
if (!value) {
this.formConfig[0].selectOptions = [];
return;
}
switch (param) {
case 'workOrderId':
this.getTree(value)
break;
}
},
getDict() {
//
// getCustomerList().then((response) => {
// console.log(response);
// this.customerList = response.data
// // this.listQuery.total = response.data.total;
// })
// getModelList().then((response) => {
// console.log(response);
// this.modelList = response.data
// // this.listQuery.total = response.data.total;
// })
getWorkOrderList().then((res) => {
console.log(res);
// console.log(response);
this.searchBarFormConfig[0].selectOptions = res.data.map((item) => {
return {
name: item.name,
id: item.id
}
})
// console.log(this.formConfig[0].selectOptions);
// this.listQuery.total = response.data.total;
})
},
buildProps(table) {
console.log('building props', table);
// otherList props
const { otherList } = table;
const props = [
{
// type: 'index',
width: 48,
prop: 'index',
label: '序号',
},
{
width: 160,
prop: 'time',
label: '时间',
},
{
width: 200,
prop: 'plcCode',
label: 'PLC编码',
},
];
const firstLineData = {
index: '参考值: [最小]-[最大][/标准]',
time: null, //
plcCode: null, //
};
otherList.forEach((item) => {
props.push({
label: item.name,
prop: item.name,
width: 128,
});
firstLineData[item.name] = `${item.minValue ?? ''}-${item.maxValue ?? ''
}${item.defaultValue != null ? '/' + item.defaultValue : ''}`;
});
return { props, firstLineData };
},
handleResponse(response) {
const { code, data } = response;
if (code == 0) {
//
data.forEach((table, index) => {
console.log('handle index:', index, table);
const { props: tableProps, firstLineData } = this.buildProps(table);
this.$set(this.tableList, index, {
key: 'base-table__key__' + index,
tableProps,
list: [firstLineData],
dataManager: null,
pageNo: 1,
pageSize: 5,
total: 0,
});
//
const { data } = table;
if (data) {
data.forEach((row, idx) => {
const listItem = {
index: idx + 1,
time: moment(+row.time).format('YYYY-MM-DD HH:mm:ss'),
plcCode: row.plcCode,
};
row.data.forEach((column) => {
listItem[column.dynamicName] = column.dynamicValue;
});
this.tableList[index].list.push(listItem);
this.tableList[index].total++;
});
//
const { pageNo, pageSize, list } = this.tableList[index];
this.tableList[index].dataManager = new LocalDataManager(
list,
pageNo,
pageSize
);
}
});
}
},
spanMethod({ row, column, rowIndex, columnIndex }) {
if (rowIndex == 0 && columnIndex == 0) {
return [1, 3];
} else if (rowIndex == 0 && (columnIndex == 1 || columnIndex == 2)) {
return [0, 0];
}
return [1, 1];
},
/** 查询 */
async handleQuery() {
this.handleResponse(
await this.$axios({
url: '/monitoring/equipment-monitor/runLog',
method: 'get',
params: this.queryParams,
})
);
},
async handleSearchBarBtnClick({ btnName, timeVal }) {
if (timeVal && timeVal.length > 0) {
this.queryParams.time = timeVal;
} else {
this.queryParams.time = [];
}
await this.handleQuery();
},
handleEmitFun(table, val) {
console.log('table val', table, val);
},
/** 为某个 table 获取 list 数据 */
getListFor(table, { page, limit, current }) {
console.log('get list for', table, { page, limit, current });
table.dataManager.pageNo = page ?? current;
table.dataManager.pageSize = limit;
},
/** build side bar tree */
buildTree(data) {
data.forEach((factory) => {
this.$set(factory, 'label', factory.name);
this.$set(factory, 'type', '工厂');
delete factory.name;
// factory.children = factory.lines;
// delete factory.lines;
factory.children?.forEach((line) => {
this.$set(line, 'label', line.name);
this.$set(line, 'type', '产线');
delete line.name;
// line.children = line.sections;
// delete line.sections;
line.children?.forEach((ws) => {
this.$set(ws, 'label', ws.name);
this.$set(ws, 'type', '工段');
delete ws.name;
// ws.children = ws.equipments;
// delete ws.equipments;
ws.children?.forEach((eq) => {
this.$set(eq, 'label', eq.name);
this.$set(eq, 'type', '设备');
delete eq.name;
});
});
});
});
},
async getTree(id) {
getTreeData({id:id}).then((res) => {
console.log(res.data);
this.sidebarContent = res.data;
this.buildTree(res.data);
console.log('tree', this.sidebarContent);
// console.log(this.formConfig[0].selectOptions);
// this.listQuery.total = response.data.total;
})
// const { data } = await this.$axios('/base/core-factory/getTreeByWorkOrder');
// console.log(data)
},
handleTabClick(tab, event) {
if (tab.name == 'graph') this.renderKey = Math.random();
},
factoryChangeHandler(event) {
this.factoryListOpen = false;
const fcId = event.target.dataset.value;
this.handleSidebarItemClick({ id: fcId, type: '工厂' });
this.currentFactory = this.sidebarContent.find((item) => item.id == fcId);
},
handleSidebarItemClick({ label, id, type }) {
this.equipmentId = id
console.log('label clicked!', label, id, type);
switch (type) {
case '设备':
this.queryParams.equipmentId = id;
break;
case '工段':
this.queryParams.equipmentId = null;
this.queryParams.sectionId = id;
break;
case '产线':
this.queryParams.equipmentId = null;
this.queryParams.sectionId = null;
this.queryParams.lineId = id;
break;
case '工厂':
this.queryParams.equipmentId = null;
this.queryParams.sectionId = null;
this.queryParams.lineId = null;
break;
}
},
handleEmitFun() { },
},
};
</script>
<style scoped>
.side-bar__left>>>.is-current {
padding: 0;
color: #111;
/* background: #f2f4f7; */
background: #e3efff !important;
}
.vvv-enter,
.vvv-leave-to {
/* transform: translateY(24px) scaleY(0); */
transform: translateY(24px);
opacity: 0;
}
.vvv-enter-active,
.vvv-leave-active {
transition: all 0.3s ease-out;
}
.vvv-enter-to,
.vvv-leave {
/* transform: translateY(0) scaleY(1); */
transform: translateY(0);
}
.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;
}
.factory-list__selector {
position: relative;
height: 36px;
font-size: 16px;
line-height: 36px;
padding-left: 28px;
background: url(../../../../assets/images/factory-icon.png) 0 / 10% no-repeat;
}
.factory-list__selector:hover {
cursor: pointer;
color: #0008;
}
.factory-list__selector::after {
/* content: ''; */
position: absolute;
top: 16px;
right: 12px;
display: inline-block;
width: 8px;
height: 8px;
/* background: #5c5c5c; */
border-color: #000;
border-width: 4px;
border-style: solid;
border-top-color: transparent;
border-right-color: transparent;
border-bottom-color: transparent;
}
.factory-list__selector:hover::after {
/* cursor: pointer; */
border-left-color: #0008;
}
.factory-list__wrapper {
visibility: hidden;
position: absolute;
background: #fff;
box-shadow: 0 0 32px 10px #0002;
border-radius: 8px;
top: 36px;
left: 90px;
/* max-width: 128px; */
height: auto;
width: auto;
white-space: nowrap;
overflow: hidden;
/* transition: all 0.3s ease-out; */
z-index: 1000;
}
.factory-list__wrapper.open {
visibility: visible;
}
ul,
li {
margin: 0;
padding: 0;
list-style: none;
}
.factory-list {
color: #0008;
max-height: 240px;
overflow-y: auto;
}
.factory-list__item {
font-size: 16px;
line-height: 1;
padding: 8px 16px 8px 16px;
min-width: 128px;
position: relative;
display: flex;
align-items: center;
justify-content: space-between;
}
.factory-list__item:hover,
.factory-list__item.is-current {
background: #e3efff;
color: #0b58ff;
}
/* .factory-list__item.is-current::after {
content: '√';
position: absolute;
top: 8px;
right: 16px;
font-weight: bold;
} */
.custom-tree-class>>>.el-tree-node__content {
width: 100%;
height: auto !important;
padding: 8px 12px !important;
}
.custom-tree-class>>>.el-tree-node__content:hover {
background: #e3efff;
}
.custom-tree-class>>>.el-tree-node__children .el-tree-node__content {
padding: 8px 18px !important;
}
.custom-tree-class>>>.el-tree-node__children .el-tree-node__children .el-tree-node__content {
padding: 8px 24px !important;
}
</style>
<style>
.custom-icon-class {
margin-right: 8px;
width: 20px;
height: 20px;
background: url('../../../../assets/images/Qian.png') center center / contain no-repeat;
}
.custom-icon-class.el-tree-node__expand-icon.expanded {
transform: unset;
}
.el-tree-node__children .custom-icon-class {
background: url('../../../../assets/images/tree-icon-2.png') 100% / contain no-repeat;
}
.el-tree-node__children .el-tree-node__children .custom-icon-class {
background: unset;
}
</style>

View File

@ -0,0 +1,36 @@
export default class LocalDataManager {
constructor(dataList, pageNo, pageSize) {
this._dataListStore = dataList;
this._pageNo = pageNo;
this._pageSize = pageSize;
}
set pageNo(pageNo) {
console.log('set pageNo', pageNo);
this._pageNo = pageNo;
}
set pageSize(pageSize) {
console.log('set pageSize', pageSize);
this._pageSize = pageSize;
}
get dataList() {
const firstLine = this._dataListStore[0];
const realDataList = this._dataListStore.slice(1);
return [
firstLine,
...realDataList.slice((this._pageNo - 1) * this._pageSize, this._pageNo * this._pageSize)
]
}
get total() {
return this._dataListStore.length;
}
deleteData(id) {
const idx = this._dataListStore.findIndex(item => item.id == id);
this._dataListStore.splice(idx, 1);
// send http request
}
}

View File

@ -0,0 +1,279 @@
<!--
filename: pieChart.vue
author: liubin
date: 2023-09-06 15:02:49
description: 饼图
-->
<template>
<div class="chart-grid-item" style="overflow: inherit">
<div
class="pie-chart"
ref="pieChart"
style="overflow: inherit;"
:data-eqname="value.equipmentName || 'Default'"></div>
<div class="data-view">
<div class="data-view__item">
<!-- <div class="data-view__item__value">111</div> -->
<div class="data-view__item__value">{{ textData.workTime }}</div>
<div class="data-view__item__title blue">工作时长</div>
</div>
<div class="data-view__item">
<!-- <div class="data-view__item__value">22</div> -->
<div class="data-view__item__value">{{ textData.stopTime }}</div>
<div class="data-view__item__title green">停机时长</div>
</div>
<div class="data-view__item">
<!-- <div class="data-view__item__value">10</div> -->
<div class="data-view__item__value">{{ textData.downTime }}</div>
<div class="data-view__item__title purple">故障时长</div>
</div>
<div class="data-view__item">
<!-- <div class="data-view__item__value">100%</div> -->
<div class="data-view__item__value">{{ textData.peEfficiency }}</div>
<div class="data-view__item__title yellow">速度开动率</div>
</div>
</div>
</div>
</template>
<script>
import * as echarts from 'echarts';
export default {
name: 'pieChart',
components: {},
props: ['value'],
data() {
return {
chart: null,
textData: {
workTime: '',
downTime: '',
stopTime: '',
peEfficiency: '',
},
config: {
title: {
text: '产线1', //<=========
top: '35%',
left: '49%',
textAlign: 'center',
textStyle: {
fontSize: 18,
},
subtext: '设备', //<=========
subtextStyle: {
fontSize: 14,
},
},
color: ['#3da8fd', '#8ef0ab', '#6b5cfd', '#FFC72A', 'transparent'],
grid: {
top: 0,
left: 0,
right: 0,
bottom: 0,
},
tooltip: {
trigger: 'item',
},
legend: {
show: false,
top: '0%',
left: 'center',
textStyle: {
fontSize: 10,
},
itemWidth: 10,
itemHeight: 10,
},
series: [
//
{
//
name: '',
type: 'pie',
radius: ['75%', '90%'],
center: ['50%', '48%'],
label: {
show: false,
},
data: [
//<=========
{ name: '工作时长', value: 1048 },
{ name: '停机时长', value: 735 },
{ name: '故障时长', value: 580 },
],
},
{
//
name: '',
type: 'pie',
center: ['50%', '48%'],
radius: ['60%', '75%'],
itemStyle: {
borderRadius: 10,
},
label: {
show: false,
},
data: [
//<=========
{ name: '总', value: 3000 },
{ name: '', value: 1400 },
],
},
// {
// name: this.value.equipmentName || 'Default',
// type: 'pie',
// radius: ['40%', '75%'],
// avoidLabelOverlap: false,
// label: {
// show: false,
// position: 'center',
// },
// data: ['workTime', 'stopTime', 'downTime'].map((v, index) => ({
// name: ['', '', ''][index],
// value: this.value[v],
// })),
// // data: [
// // { value: 1048, name: 'Search Engine' },
// // { value: 735, name: 'Direct' },
// // { value: 580, name: 'Email' },
// // { value: 484, name: 'Union Ads' },
// // { value: 300, name: 'Video Ads' },
// // ],
// },
],
},
};
},
mounted() {
console.log('value', this.value);
if (!this.chart) {
this.chart = echarts.init(this.$refs.pieChart);
this.$nextTick(() => {
this.chart.setOption(this.config);
});
}
},
beforeDestroy() {
if (this.chart) this.chart.dispose();
},
watch: {
value: {
handler(val) {
this.updateConfig(val);
if (this.chart) this.chart.setOption(this.config);
},
deep: true,
immediate: true,
},
},
methods: {
updateConfig(item) {
const {
lineName, // 线
equipmentName, //
downTime, // (h)
stopTime, // (h)
workTime, // (h)
peEfficiency, //
timeEfficiency, //
//===============//
sectionName,
workRate,
stopRate,
downRate,
realProcSpeed,
designProcSpeed,
oee,
teep,
downCount,
mtbf,
mttr,
} = item;
this.config.title.text = lineName;
this.config.title.subtext = equipmentName;
this.config.series[0].data = [
{ name: '工作时长', value: workTime },
{ name: '停机时长', value: stopTime },
{ name: '故障时长', value: downTime },
];
this.config.series[1].data = [
{ name: '速度开动率', value: peEfficiency },
{ name: '', value: Math.ceil(peEfficiency) - peEfficiency },
];
//
this.textData = {
workTime: +workTime.toFixed(2),
stopTime: +stopTime.toFixed(2),
downTime: +downTime.toFixed(2),
peEfficiency: +peEfficiency.toFixed(2),
};
},
},
};
</script>
<style scoped lang="scss">
.chart-grid-item {
padding: 12px;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
}
.pie-chart {
height: 1px;
width: 100%;
flex: 1;
padding: 12px;
position: relative;
}
.data-view {
display: flex;
justify-content: center;
}
.data-view__item {
display: flex;
flex-direction: column;
text-align: center;
align-items: center;
user-select: none;
padding: 0 6px;
}
.data-view__item:not(:last-child) {
border-right: 1px solid #f1f1f1;
}
.data-view__item__value {
font-size: 16px;
line-height: 24px;
}
.data-view__item__title {
font-size: 8px;
line-height: 14px;
}
.blue {
color: #3da8fd;
}
.green {
color: #8ef0ab;
}
.purple {
color: #6b5cfd;
}
.yellow {
color: #ffc72a;
}
</style>

View File

@ -0,0 +1,576 @@
<!--
filename: index.vue
author: liubin
date: 2023-09-04 09:34:52
description: 设备效率分析
-->
<template>
<div class="app-container allow-overflow">
<!-- 搜索工作栏 -->
<SearchBar
:formConfigs="searchBarFormConfig"
ref="search-bar"
@headBtnClick="handleSearchBarBtnClick" />
<el-row>
<el-col class="custom-tabs">
<el-tabs
v-model="activeName"
:stretch="true"
@tab-click="handleTabClick">
<el-tab-pane :label="'\u2002数据列表\u2002'" name="table">
<!-- 列表 -->
<base-table
class="base-table__margin"
:table-props="tableProps"
:page="1"
:limit="10"
:table-data="list"
@emitFun="handleEmitFun"></base-table>
</el-tab-pane>
<el-tab-pane
:label="'\u3000可视化\u3000'"
name="graph"
style="overflow: inherit">
<div
v-if="activeName == 'graph'"
class="graph"
style="
overflow: inherit;
display: flex;
flex-direction: column;
position: relative;
">
<div class="blue-title">各设备加工数量</div>
<div class="legend">
<div class="legend-item">
<span class="icon blue"></span>
<span class="text">工作时长</span>
</div>
<div class="legend-item">
<span class="icon green"></span>
<span class="text">停机时长</span>
</div>
<div class="legend-item">
<span class="icon purple"></span>
<span class="text">故障时长</span>
</div>
<div class="legend-item">
<span class="icon yellow"></span>
<span class="text">速度开动率</span>
</div>
</div>
<div class="graph-grid">
<div class="bg-grid grid-line">
<div
class="grid-item"
v-for="item in list.length"
:key="item"></div>
</div>
<div class="bg-grid grid-charts">
<pie-chart
v-for="item in list"
:key="item.id"
:value="item" />
<!-- <pie-chart v-for="item in 5" :key="item" :value="item" /> -->
</div>
</div>
</div>
</el-tab-pane>
</el-tabs>
</el-col>
</el-row>
</div>
</template>
<script>
// import moment from 'moment';
import basicPageMixin from '@/mixins/lb/basicPageMixin';
import PieChart from './components/pieChart.vue';
export default {
name: 'EfficiencyAnalysis',
mixins: [basicPageMixin],
components: { PieChart },
props: {},
data() {
return {
activeName: 'table',
open: false,
visualizationOpen: false,
trendOpen: false,
// tableBtn: [
// this.$auth.hasPermi('base:equipment-group:update')
// ? {
// type: 'edit',
// btnName: '',
// }
// : undefined,
// this.$auth.hasPermi('base:equipment-group:delete')
// ? {
// type: 'delete',
// btnName: '',
// }
// : undefined,
// ].filter((v) => v),
tableProps: [
{ prop: 'factoryName', label: '工厂' },
{ prop: 'lineName', label: '产线' },
{ prop: 'sectionName', label: '工段' },
{ prop: 'equipmentName', label: '设备' },
{
label: '有效时间',
children: [
{
width: 128,
prop: 'workTime',
label: '工作时长[h]',
},
{
width: 128,
prop: 'workRate',
label: '百分比[%]',
filter: (val) => (val != null ? +val.toFixed(3) : '-'),
},
],
},
{
label: '关机时间',
children: [
{
width: 128,
prop: 'stopTime',
label: '停机时长[h]',
},
{ width: 128, prop: 'stopRate', label: '百分比[%]' },
],
},
{
label: '中断损失',
children: [
{
width: 128,
prop: 'downTime',
label: '故障时长[h]',
filter: (val) => (val != null ? +val.toFixed(3) : '-'),
},
{ width: 128, prop: 'downRate', label: '百分比[%]' },
{
width: 128,
prop: 'timeEfficiency',
label: '时间开动率',
filter: (val) => (val != null ? +val.toFixed(3) : '-'),
},
],
},
{
label: '速度损失',
children: [
{
width: 128,
prop: 'realProcSpeed',
label: '实际加工速度',
},
{
width: 128,
prop: 'designProcSpeed',
label: '理论加工速度',
},
{
width: 128,
prop: 'peEfficiency',
label: '速度开动率',
filter: (val) => (val != null ? +val.toFixed(3) : '-'),
},
],
},
{
prop: 'oee',
label: 'OEE',
filter: (val) => (val != null ? +val.toFixed(3) : '-'),
},
{
prop: 'teep',
label: 'TEEP',
filter: (val) => (val != null ? +val.toFixed(3) : '-'),
},
// {
// _action: 'view-trend',
// 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,
// // value: _this.injectData.id,
// value: _this.injectData,
// });
// },
// },
// },
// ''
// );
// },
// },
// },
],
searchBarFormConfig: [
{
type: 'select',
label: '工单',
placeholder: '请选择工单',
param: 'workOrderId',
selectOptions: [],
},
// {
// type: 'select',
// label: '线',
// placeholder: '线',
// param: 'lineId',
// selectOptions: [],
// },
//
// {
// type: 'select',
// label: '',
// param: 'dateFilterType',
// defaultSelect: 0,
// selectOptions: [
// { id: 0, name: '' },
// { id: 1, name: '' },
// ],
// index: 2,
// extraOptions: [
{
// parent: 'dateFilterType',
//
type: 'datePicker',
// label: '',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
defaultTime: ['00:00:00', '00:00:00'],
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'timerange',
},
// {
// parent: 'dateFilterType',
// //
// type: 'datePicker',
// // label: '',
// dateType: 'date',
// placeholder: '',
// format: 'yyyy-MM-dd',
// valueFormat: 'yyyy-MM-dd',
// param: 'timeday',
// },
// ],
// },
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
// {
// type: 'separate',
// },
// {
// type: 'button',
// btnName: '',
// name: 'visualization',
// plain: true,
// color: 'success',
// },
// {
// type: 'button',
// btnName: 'OEE',
// name: 'add',
// plain: true,
// color: 'success',
// },
// {
// type: 'button',
// btnName: 'TEEP',
// name: 'add',
// plain: true,
// color: 'warning',
// },
],
//
open: false,
//
queryParams: {
// lineId: null,
workOrderId: null,
recordTime: [],
},
//
form: {},
list: [],
};
},
created() {
this.getWorkOrder()
// this.getLine();
this.getList();
},
methods: {
/** 准备工厂数据 */
async getWorkOrder() {
console.log(1111);
const { code, data } = await this.$axios({
url: '/base/core-work-order/listbyfilter',
method: 'get',
});
if (code == 0) {
console.log('1111', data);
this.searchBarFormConfig[0].selectOptions = data.map((item) => {
return {
name: item.name,
id: item.id,
};
});
}
},
// /** 线 */
// async getLine() {
// const { code, data } = await this.$axios({
// url: '/base/production-line/listAll',
// method: 'get',
// });
// if (code == 0) {
// this.searchBarFormConfig[1].selectOptions = data.map((item) => {
// return {
// name: item.name,
// id: item.id,
// };
// });
// }
// },
/** 覆盖 handleEmitFun 的默认实现 */
handleEmitFun({ action, value }) {
switch (action) {
case 'view-trend':
const { id } = value;
this.open = true;
this.trendOpen = true;
break;
}
},
/** 查询列表 */
async getList() {
this.loading = true;
const { code, data } = await this.$axios({
url: '/analysis/equipment-analysis/efficiency',
method: 'get',
params: this.queryParams,
});
if (code == 0) {
this.list = data;
}
},
handleSearchBarBtnClick({ btnName, ...payload }) {
console.log('handleSearchBarBtnClick', btnName, payload);
if (btnName == 'visualization') {
//
this.visualizationOpen = true;
this.open = true;
}
if (btnName == 'search') {
this.queryParams.workOrderId = payload.workOrderId || null;
// this.queryParams.lineId = payload.lineId || null;
if (0 == payload.dateFilterType) {
this.queryParams.recordTime = payload.timerange;
} else if (1 == payload.dateFilterType) {
this.queryParams.recordTime = [
`${payload.timeday} 00:00:00`,
`${payload.timeday} 23:59:59`,
];
}
} else {
this.queryParams.recordTime = null;
}
this.getList();
},
cancel() {
this.open = false;
},
closed() {
this.visualizationOpen = false;
this.trendOpen = false;
},
submitForm() {},
handleTabClick() {},
},
};
</script>
<style scoped lang="scss">
.visualization {
display: grid;
grid-template-columns: repeat(3, minmax(240px, 1fr));
}
:deep(.custom-tabs) {
.el-tabs__header {
margin-bottom: 8px;
display: inline-block;
transform: translateY(-12px);
}
.el-tabs__content {
overflow: visible;
}
.el-tabs__item {
padding-left: 0 !important;
padding-right: 0 !important;
line-height: 36px !important;
height: 36px;
}
}
.blue-title {
position: relative;
padding: 4px 0;
padding-left: 12px;
font-size: 14px;
&::before {
content: '';
position: absolute;
left: 0;
top: 6px;
height: 16px;
width: 4px;
border-radius: 1px;
background: #0b58ff;
}
}
.graph-grid {
margin-top: 8px;
padding: 12px;
position: relative;
border-radius: 12px;
border: 1px solid #ccc;
// background: #0003;
overflow: inherit;
}
.bg-grid {
display: grid;
place-content: center;
grid-template-columns: repeat(4, minmax(280px, 1fr));
grid-auto-columns: 280px;
grid-auto-rows: 290px;
overflow: inherit;
position: relative;
}
.grid-line::after {
content: '';
position: absolute;
top: -1px;
left: -1px;
width: calc(100% + 2px);
height: calc(100% + 2px);
display: inline-block;
border: 8px solid #fff;
}
.grid-charts {
position: absolute;
width: calc(100% - 24px);
top: 12px;
left: 12px;
}
.grid-item {
border: 1px solid #ccc;
}
.grid-item:not(:first-child) {
border-left: 0;
border-top: 0;
}
.legend {
position: absolute;
top: 8px;
right: 12px;
display: flex;
}
.legend .legend-item {
display: flex;
align-items: center;
margin-left: 12px;
}
.legend .legend-item .icon {
width: 10px;
height: 10px;
border-radius: 1px;
margin-right: 4px;
margin-top: 1px;
}
.legend .legend-item .text {
color: #8c8c8c;
}
.blue {
background-color: #3da8fd;
}
.green {
background-color: #8ef0ab;
}
.purple {
background-color: #6b5cfd;
}
.yellow {
background-color: #ffc72a;
}
@media screen and (max-width: 1390px) {
.bg-grid {
grid-template-columns: repeat(3, minmax(280px, 1fr));
}
}
@media screen and (max-width: 1190px) {
.bg-grid {
grid-template-columns: repeat(2, minmax(280px, 1fr));
}
}
@media screen and (max-width: 640px) {
.bg-grid {
grid-template-columns: repeat(1, minmax(280px, 1fr));
}
}
</style>

View File

@ -0,0 +1,248 @@
<!--
* @Author: zwq
* @Date: 2023-08-01 14:55:51
* @LastEditors: zhp
* @LastEditTime: 2023-11-10 16:25:02
* @Description:
-->
<template>
<div class="app-container">
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
<base-table :table-props="tableProps" :page="listQuery.pageNo" :limit="listQuery.pageSize" :table-data="list">
<!-- <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="getList" />
<!-- <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" /> -->
</div>
</template>
<script>
// import AddOrUpdate from './add-or-updata';
// import unitDict from './unitDict';
// import basicPage from '../mixins/basic-page';
import { parseTime } from '../mixins/code-filter';
import {
getMaterialUseLogPage,
getWorkOrderList,
exportEnergyPlcExcel
} from '@/api/quality/materialTraceability';
const tableProps = [
{
prop: 'materialName',
label: '物料名称'
},
{
prop: 'materialCode',
label: '物料编码'
},
{
prop: 'dateName',
label: '物料批次'
},
{
prop: 'equipName',
label: '使用设备'
},
{
prop: 'num',
label: '使用数量'
},
{
prop: 'useTime',
label: '使用时间',
filter: parseTime
},
{
prop: 'userName',
label: '操作人'
},
{
prop: 'source',
label: '数据来源',
filter: (val) => val == 1 ? '内部' : '外部'
},
{
prop: 'remark',
label: '备注'
}
];
export default {
// mixins: [basicPage],
data() {
return {
// urlOptions: {
// getDataListURL: getMaterialUseLogPage,
// // deleteURL: deletePackingType,
// // exportURL: exportPackingExcel,
// },
tableProps,
tableBtn: [
this.$auth.hasPermi(`base:packaging-print-log:update`)
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
this.$auth.hasPermi(`base:packaging-print-log:delete`)
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v) => v),
list: [],
listQuery: {
pageSize: 10,
pageNo: 1,
total: 0,
workOrderId: undefined,
startTime: undefined,
endTime:undefined,
},
formConfig: [
{
type: 'select',
label: '工单',
selectOptions: [],
labelField: 'name',
valueField: 'id',
param: 'workOrderId'
},
{
type: 'datePicker',
label: '时间段',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: "yyyy-MM-dd",
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'timeVal',
defaultSelect: [],
width: 250
},
{
type: 'button',
btnName: '搜索',
name: 'search',
color: 'primary',
},
// {
// type: 'separate',
// },
// {
// type: 'button',
// btnName: '',
// name: 'reset',
// },
// {
// type: 'separate',
// },
// {
// type: this.$auth.hasPermi('base:packaging-print-log:create') ? 'button' : '',
// btnName: '',
// name: 'add',
// color: 'success',
// plain: true,
// },
// {
// type: 'separate',
// type: this.$auth.hasPermi('base:product:create') ? 'separate' : '',
// },
{
type: this.$auth.hasPermi('monitoring:materiel-date-from:export') ? 'button' : '',
btnName: '导出',
name: 'export',
color: 'warning',
},
],
};
},
components: {
// AddOrUpdate,
},
created() {
this.getList()
this.getDict()
},
methods: {
getList() {
getMaterialUseLogPage({ ...this.listQuery }).then(res => {
this.list = res.data || []
this.listQuery.total = res.data.total || 0
})
},
getDict() {
//
// getCustomerList().then((response) => {
// console.log(response);
// this.customerList = response.data
// // this.listQuery.total = response.data.total;
// })
// getModelList().then((response) => {
// console.log(response);
// this.modelList = response.data
// // this.listQuery.total = response.data.total;
// })
getWorkOrderList().then((response) => {
// console.log(response);
this.formConfig[0].selectOptions = response.data.map((item) => {
return {
name: item.name,
id: item.id
}
})
console.log(this.formConfig[0].selectOptions);
// this.listQuery.total = response.data.total;
})
},
handleExport() {
//
let params = { ...this.listQuery };
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal.confirm('是否确认导出所有数据项?').then(() => {
this.exportLoading = true;
return exportEnergyPlcExcel(params);
}).then(response => {
this.$download.excel(response, '物料信息追溯 ');
this.exportLoading = false;
}).catch(() => { });
},
buttonClick(val) {
console.log(val)
if (val.btnName === 'search') {
this.listQuery.workOrderId = val.workOrderId ? val.workOrderId :undefined
// this.queryParams.status = val.status
if (val.timeVal && val.timeVal.length != 0 ) {
this.listQuery.startTime = val.timeVal[0] + ' 00:00:00'
this.listQuery.endTime = val.timeVal[1] + ' 23:59:59'
} else {
this.listQuery.startTime = undefined
this.listQuery.endTime = undefined
}
this.getList()
} else {
this.handleExport()
// this.addOrEditTitle = ''
// this.centervisible = true
// this.$nextTick(() => {
// this.$refs.orderAdd.init()
// })
}
},
otherMethods(val) {
this.addOrUpdateVisible = true;
this.addOrEditTitle = '详情';
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data.id, true);
});
},
},
};
</script>

View File

@ -0,0 +1,100 @@
/*
* @Author: zwq
* @Date: 2022-08-24 11:19:43
* @LastEditors: zwq
* @LastEditTime: 2023-08-03 14:21:04
* @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,168 @@
/*
* @Author: zwq
* @Date: 2022-08-24 11:19:43
* @LastEditors: DY
* @LastEditTime: 2023-09-21 16:02:07
* @Description:
*/
export default {
data() {
/* eslint-disable */
return {
urlOptions: {
getDataListURL: '',
deleteURL: '',
statusUrl: '',
exportURL: ''
},
tableData: [],
listQuery: {
pageSize: 10,
pageNo: 1,
total: 1,
},
exportLoading: false,
dataListLoading: false,
addOrEditTitle: '',
addOrUpdateVisible: false,
}
},
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.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id);
});
},
cancel(id) {
this.$refs["popover-" + id].showPopper = false;
},
//改变状态
changeStatus(id) {
this.$http
.post(this.urlOptions.statusUrl, { id })
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg);
}
this.$refs["popover-" + id].showPopper = false;
this.$message({
message: this.$t("prompt.success"),
type: "success",
duration: 500,
onClose: () => {
this.getDataList();
},
});
})
.catch(() => { });
},
//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 if (val.type === "change") {
this.changeStatus(val.data.id)
} 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(() => { });
},
//search-bar点击
buttonClick(val) {
switch (val.btnName) {
case "search":
this.listQuery.xm1 = val.xm1;
this.listQuery.xm2 = val.xm2;
this.listQuery.pageNo = 1;
this.getDataList();
break;
case "add":
this.addOrEditTitle = '新增'
this.addOrUpdateVisible = true;
this.addOrUpdateHandle()
break;
default:
console.log(val)
}
},
handleCancel() {
this.$refs.addOrUpdate.formClear()
this.addOrUpdateVisible = false
this.addOrEditTitle = ''
},
handleConfirm() {
this.$refs.addOrUpdate.dataFormSubmit()
},
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,69 @@
/*
* @Date: 2020-12-29 16:49:28
* @LastEditors: DY
* @LastEditTime: 2023-09-12 11:13:34
* @FilePath: \basic-admin\src\filters\basicData\index.js
* @Description:
*/
const table = {
lineStatus: {
1: '生产中',
2: '停止',
3: '未知',
},
reportType: {
1: '日',
2: '周',
3: '月'
}
}
// 日期格式化
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()
}
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 default function (dictTable) {
return function (val) {
return table?.[dictTable]?.[val]
}
}

View File

@ -0,0 +1,270 @@
<!--
* @Author: zwq
* @Date: 2023-08-01 14:55:51
* @LastEditors: zhp
* @LastEditTime: 2023-11-10 16:32:28
* @Description:
-->
<template>
<div class="app-container">
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
<base-table :table-props="tableProps" :page="listQuery.pageNo" :limit="listQuery.pageSize" :table-data="list">
<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="getList" />
<!-- <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" /> -->
</div>
</template>
<script>
// import AddOrUpdate from './add-or-updata';
// import unitDict from './unitDict';
// import basicPage from '../mixins/basic-page';
import { parseTime } from '../mixins/code-filter';
import {
getProcessTraceabilityPage,
getWorkOrderList,
// exportEnergyPlcExcel
} from '@/api/quality/processTraceability';
import { publicFormatter } from '@/utils/dict';
const tableProps = [
{
prop: 'name',
label: '工单名称'
},
{
prop: 'code',
label: '工单编码'
},
{
prop: 'planProductName',
label: '产品名'
},
{
prop: 'status',
label: '状态',
filter:publicFormatter('work_order_status')
},
{
prop: 'startProduceTime',
label: '开始生产时间',
filter: parseTime
},
{
prop: 'finishProduceTime',
label: '结束生产时间',
filter: parseTime
},
{
prop: 'actualQuantity',
label: '生产数量'
},
{
prop: 'unit',
label: '单位',
filter: publicFormatter('unit_dict')
},
{
prop: 'processFlowName',
label: '工艺名称'
},
{
prop: 'yield',
label: '成品率'
}
];
export default {
// mixins: [basicPage],
data() {
return {
// urlOptions: {
// getDataListURL: getMaterialUseLogPage,
// // deleteURL: deletePackingType,
// // exportURL: exportPackingExcel,
// },
tableProps,
tableBtn: [
// this.$auth.hasPermi(`base:packaging-print-log:update`)
// ? {
// type: 'edit',
// btnName: '',
// }
// : undefined,
{
type: 'processDetail',
btnName: '查看工艺详情',
},
].filter((v) => v),
list: [],
listQuery: {
pageSize: 10,
pageNo: 1,
// total: 0,
// orderName: '',
// startTime: undefined,
// endTime:undefined,
},
formConfig: [
{
type: 'select',
label: '工单',
selectOptions: [],
labelField: 'name',
valueField: 'id',
param: 'orderName'
},
// {
// type: 'datePicker',
// label: '',
// dateType: 'daterange',
// format: 'yyyy-MM-dd',
// valueFormat: "yyyy-MM-dd",
// rangeSeparator: '-',
// startPlaceholder: '',
// endPlaceholder: '',
// param: 'timeVal',
// defaultSelect: [],
// width: 250
// },
{
type: 'button',
btnName: '搜索',
name: 'search',
color: 'primary',
},
// {
// type: 'separate',
// },
// {
// type: 'button',
// btnName: '',
// name: 'reset',
// },
// {
// type: 'separate',
// },
// {
// type: this.$auth.hasPermi('base:packaging-print-log:create') ? 'button' : '',
// btnName: '',
// name: 'add',
// color: 'success',
// plain: true,
// },
// {
// type: 'separate',
// type: this.$auth.hasPermi('base:product:create') ? 'separate' : '',
// },
// {
// type: this.$auth.hasPermi('monitoring:materiel-date-from:export') ? 'button' : '',
// btnName: '',
// name: 'export',
// color: 'warning',
// },
],
};
},
components: {
// AddOrUpdate,
},
created() {
this.getList()
this.getDict()
},
methods: {
getList() {
getProcessTraceabilityPage(this.listQuery).then(res => {
this.list = res.data.list || []
this.listQuery.total = res.data.total || 0
})
},
handleClick(val) {
if (val.type === "processDetail") {
console.log(val);
this.$router.push({
name: 'process-traceability-detail',
params: {
id: '1715180991838887938',
orderId: val.data.id,
name: val.data.name,
productName: val.data.planProductName,
processFlowName: val.data.processFlowName
// equipmentName,
},
});
// this.deleteHandle(val.data.id, val.data.name, val.data._pageIndex)
}
},
getDict() {
//
// getCustomerList().then((response) => {
// console.log(response);
// this.customerList = response.data
// // this.listQuery.total = response.data.total;
// })
// getModelList().then((response) => {
// console.log(response);
// this.modelList = response.data
// // this.listQuery.total = response.data.total;
// })
getWorkOrderList().then((response) => {
// console.log(response);
this.formConfig[0].selectOptions = response.data.map((item) => {
return {
name: item.name,
id: item.name
}
})
console.log(this.formConfig[0].selectOptions);
// this.listQuery.total = response.data.total;
})
},
// handleExport() {
// //
// let params = { ...this.listQuery };
// params.pageNo = undefined;
// params.pageSize = undefined;
// this.$modal.confirm('?').then(() => {
// this.exportLoading = true;
// return exportEnergyPlcExcel(params);
// }).then(response => {
// this.$download.excel(response, ' ');
// this.exportLoading = false;
// }).catch(() => { });
// },
buttonClick(val) {
console.log(val)
if (val.btnName === 'search') {
this.listQuery.orderName = val.orderName ? val.orderName :undefined
// this.queryParams.status = val.status
// if (val.timeVal && val.timeVal.length != 0 ) {
// this.listQuery.startTime = val.timeVal[0] + ' 00:00:00'
// this.listQuery.endTime = val.timeVal[1] + ' 23:59:59'
// } else {
// this.listQuery.startTime = undefined
// this.listQuery.endTime = undefined
// }
this.getList()
} else {
// this.handleExport()
// this.addOrEditTitle = ''
// this.centervisible = true
// this.$nextTick(() => {
// this.$refs.orderAdd.init()
// })
}
},
otherMethods(val) {
this.addOrUpdateVisible = true;
this.addOrEditTitle = '详情';
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data.id, true);
});
},
},
};
</script>

View File

@ -0,0 +1,302 @@
<!--
filename: ProcessBomList.vue
author: liubin
date: 2023-10-20 15:00:58
description:
-->
<template>
<section class="process-bom">
<SearchBar :formConfigs="searchBarFormConfig" ref="search-bar" @headBtnClick="handleSearchBarBtnClick" />
<!-- <small-title :no-padding="true">
设备名称: {{ name }}
</small-title> -->
<div class="btns" style="
text-align: right;
position: absolute;
top: 20px;
right: 20px;
display: flex;
">
<!-- <el-input icon="el-icon-search" placeholder="搜索" v-model="searchText" style="margin-left: 20px">
<i slot="prefix" class="el-input__icon el-icon-search"></i>
</el-input>
<el-button type="primary" plain :disabled="currentDet == null" class="btn-create" icon="el-icon-plus">
分配设备
</el-button> -->
</div>
<!-- 列表 -->
<el-row>
<div style="margin-bottom: 10px;font-size: 16px;">设备名称{{ name }}</div>
<el-col class="custom-tabs">
<el-tabs v-model="activeName" :stretch="true" @tab-click="handleTabClick">
<el-tab-pane :label="'\u2002物料追溯\u2002'" name="material">
<!-- 列表 -->
<base-table class="base-table__margin" :table-props="materialTableProps" :page="1" :limit="10"
:table-data="materialList" @emitFun="handleEmitFun"></base-table>
</el-tab-pane>
<el-tab-pane :label="'\u3000参数追溯\u3000'" name="value" style="overflow: inherit">
<base-table class="base-table__margin" :table-props="valueTableProps" :page="1" :limit="10"
:table-data="valueList" @emitFun="handleEmitFun"></base-table>
</el-tab-pane>
</el-tabs>
</el-col>
</el-row>
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList" />
</section>
</template>
<script>
// import SmallTitle from './SmallTitle';
import {
getDetMaterial,
getDetValue
} from '@/api/quality/processTraceabilityDetail';
import StatusBtn from './statusBtn.vue'
export default {
name: 'ProcessBom',
components: {
// SmallTitle
},
props: {
currentDet: {
type: Object,
default: null
}
},
data() {
return {
detId:undefined,
activeName: 'material',
searchBarFormConfig: [{ label: '设备参数及物料追溯' },
{
type: 'datePicker',
label: '时间段',
dateType: 'daterange', // datetimerange
// format: 'yyyy-MM-dd HH:mm:ss',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始日期',
endPlaceholder: '结束日期',
defaultTime: ['00:00:00', '23:59:59'],
param: 'timeVal',
// width: 350,
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},],
materialTableProps: [
// {
// prop: 'createTime',
// label: '',
// fixed: true,
// width: 180,
// filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
// },
{ prop: 'name', label: '物料名称' },
{ prop: 'planNum', label: '预计使用数量' },
{ prop: 'actualNum', label: '实际使用数量' },
],
name:null,
materialList: [],
valueTableProps: [
// {
// prop: 'createTime',
// label: '',
// fixed: true,
// width: 180,
// filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
// },
{ prop: 'name', label: '参数名' },
{
prop: 'name', label: '设定范围最小- 最大 / 标准',
subcomponent: StatusBtn
},
{
prop: 'code', label: '最小值',
children: [
{
prop: 'minValueSet',
label: '值'
},
{
prop: 'minValueAppearTime',
label: '出现时间'
}
]
},
{
prop: 'code', label: '最大值',
children: [
{
prop: 'maxValueSet',
label: '值'
},
{
prop: 'maxValueAppearTime',
label: '出现时间'
}
]
},
{
prop: 'averageValueAppear', label: '平均值',
},
],
valueList: [],
total: 0,
tableBtn: [],
queryParams: {
pageNo: 1,
pageSize: 10,
},
searchText: ''
};
},
// components: {
// SmallTitle,
// },
watch: {
currentDet: {
handler(val) {
if (val != null) {
this.getList(val);
this.detId = val.detId
console.log(val);
} else {
this.clearList();
}
},
immediate: true,
deep: true
}
},
methods: {
handleSearchBarBtnClick(val) {
console.log(val)
getDetMaterial({
pageNo: 1,
pageSize: 10,
orderId: this.$route.params.orderId,
flowDetId: [this.detId],
// orderId: this.$route.params.orderId,
},).then((res) => {
console.log(res);
})
// if (timeVal && timeVal.length > 0) {
// this.queryParams.time = timeVal;
// } else {
// this.queryParams.time = [];
// }
// await this.handleQuery();
},
handleEmitFun() { },
handleTableBtnClick() { },
put(payload) {
return this.http(this.updateUrl, 'put', payload);
},
post(payload) {
return this.http(this.addUrl, 'post', payload);
},
recv(payload) {
return this.http(this.pageUrl, 'get', payload);
},
info(payload) {
return this.http(this.infoUrl, 'get', payload);
},
http(url, method, payload) {
return this.$axios({
url,
method,
params: method === 'get' ? payload : null,
data: method !== 'get' ? payload : null,
})
},
// getList({ detId, detName, detDesc, flowId, sectionName } = {}) {
// console.log('get list')
// },
handleTabClick(val) {
// console.log(this.activeName);
if (this.activeName === 'material') {
getDetMaterial({
pageNo: 1,
pageSize: 10,
orderId: this.$route.params.orderId,
flowDetId: [this.detId],
// orderId: this.$route.params.orderId,
},).then((res) => {
this.materialList = res.data[0].data
this.name = res.data[0].name
})
} else {
getDetValue({
pageNo: 1,
pageSize: 10,
orderId: this.$route.params.orderId,
flowDetId: [this.detId],
// orderId: this.$route.params.orderId,
}).then((res) => {
this.valueList = res.data[0].data
this.name = res.data[0].name
})
}
},
getList(val) {
console.log(val);
getDetMaterial({
pageNo: 1,
pageSize: 10,
orderId: this.$route.params.orderId,
flowDetId: [this.detId],
}).then((res) => {
console.log(res);
this.materialList = res.data[0].data
this.name = res.data[0].name
})
},
clearList() {
this.list = [];
}
},
};
</script>
<style scoped lang="scss">
.process-bom {
position: relative;
flex: 1;
padding: 12px 20px;
background: #fff;
border-radius: 8px;
}
:deep(.custom-tabs) {
.el-tabs__header {
margin-bottom: 8px;
display: inline-block;
transform: translateY(-12px);
}
.el-tabs__content {
overflow: visible;
}
.el-tabs__item {
padding-left: 0 !important;
padding-right: 0 !important;
line-height: 36px !important;
height: 36px;
}
}
</style>

View File

@ -0,0 +1,488 @@
<!--
filename: ProcessGraph.vue
author: liubin
date: 2023-10-20 15:00:58
description:
-->
<template>
<section class="process-graph">
<SearchBar :formConfigs="searchBarFormConfig" ref="search-bar" />
<!-- <div class="btns" style="text-align: right; position: absolute; top: 20px; right: 20px">
<el-button type="warning" @click="undo" plain v-if="allowUndo" :disabled="!allowUndo" icon="el-icon-back">
撤销
</el-button>
<el-button type="warning" @click="redo" plain v-if="allowRedo" :disabled="!allowRedo">
下一步
<i class="el-icon-right el-icon--right"></i>
</el-button>
<el-button class="btn-refresh" @click="handleUpdateLayout" icon="el-icon-refresh">
刷新布局</el-button>
<el-button type="primary" plain class="btn-create" icon="el-icon-plus" @click="handleAdd">
新建工序
</el-button>
<el-button class="btn-edit" :disabled="currentDet == null" @click="handleEdit">编辑</el-button>
</div> -->
<div class="process-graph__panel" ref="panel"></div>
<base-dialog :dialogTitle="title" :dialogVisible="open" width="35%" @close="cancel" @cancel="cancel"
@confirm="submitForm">
<DialogForm v-if="open" ref="form" v-model="form" :rows="rows" />
</base-dialog>
</section>
</template>
<script>
import { Graph } from '@antv/x6';
import ProcessNode, { createProcessNode, CACHE_NAME, getSectionFrom } from './ProcessNode';
import DialogForm from '@/components/DialogForm';
// import { IdToName } from '@/utils'
// if (process - node){
// }
Graph.registerNode('process-node', ProcessNode, true);
export default {
name: 'ProcessGraph',
components: { DialogForm },
props: {},
inject: ['getFlowId'],
data() {
return {
allowRedo: false,
allowUndo: false,
graph: null,
searchBarFormConfig: [{ label: '工序列表' }],
title: '',
open: false,
form: {
name: '', //
sectionId: '', // id
remark: '', //
},
rows: [
[
{
input: true,
label: '工序名称',
prop: 'name',
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
},
],
[
{
select: true,
label: '工段',
prop: 'sectionId',
url: '/base/core-workshop-section/listAll',
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
bind: {
filterable: true,
},
cache: CACHE_NAME
},
],
[
{
textarea: true,
label: '工序说明',
prop: 'remark',
},
],
],
updateUrl: '/extend/process-flow-det/update',
deleteUrl: '/extend/process-flow-det/delete',
addUrl: '/extend/process-flow-det/create',
// pageUrl: '/extend/process-flow-det/get',
infoUrl: '/extend/process-flow-view/getByFlowId',
layout: {
id: null,
flowId: null,
content: '',
createTime: null
},
currentDet: null,
currentNode: null
};
},
watch: {
'form.sectionId': {
handler(id) {
},
immediate: false,
},
currentDet: {
handler(val) {
this.$emit('det-selected', val)
},
deep: true,
immediate: true
}
},
mounted() {
console.log(this.$route.params.id)
this.loadLayout().then(json => {
this.initGraph(json)
})
},
// mounted () {
// },
destroyed() {
this.graph.dispose();
this.$nextTick(() => {
this.resetLayout();
this.graph = null;
})
},
computed: {},
methods: {
initGraph(json) {
const graph = new Graph({
container: this.$refs.panel,
grid: {
size: 10,
visible: true,
},
history: true,
selecting: {
className: 'my-select'
},
connecting: {
snap: true,
allowBlank: false,
allowLoop: false,
allowNode: false,
allowPort: true,
allowEdge: false,
},
panning: true,
// scroller: {
// enabled: true,
// pannable: true,
// cursor: '',
// width: 800,
// height: 200
// },
mousewheel: {
enabled: true,
modifiers: ['ctrl', 'meta']
}
});
graph.fromJSON(json)
this.graph = graph;
this.$nextTick(() => {
this.registerGraphEvents();
})
},
registerGraphEvents() {
const reset = () => {
const nodes = this.graph.getNodes();
const edges = this.graph.getEdges();
this.currentDet = null;
this.currentNode = null;
nodes.forEach(node => {
node.attr('container/stroke', '#ccc');
});
edges.forEach(edge => {
edge.attr('line/stroke', '#ccc')
})
}
this.graph.on('node:click', ({ e, x, y, node, view }) => {
reset();
node.attr('container/stroke', '#0b58ff');
const { detId, detName, detDesc, processId, sectionId, sectionName } = node.attrs;
this.currentDet = {}
this.$set(this.currentDet, 'detId', detId.text)
this.$set(this.currentDet, 'sectionId', sectionId.text)
this.$set(this.currentDet, 'detName', detName.text)
this.$set(this.currentDet, 'detDesc', detDesc.text)
this.$set(this.currentDet, 'flowId', processId.text)
this.$set(this.currentDet, 'sectionName', sectionName.text)
this.currentNode = node
});
this.graph.on('edge:click', ({ e, x, y, edge, view }) => {
// console.log('edge clicked!', edge)
reset();
edge.attr('line/stroke', '#0b58ff')
});
this.graph.on('blank:click', ({ e, x, y }) => {x
reset();
});
this.graph.on('node:mouseenter', ({ node }) => {
node.addTools({
name: 'button-remove',
args: {
x: '100%',
y: 0,
offset: { x: 0, y: 0 },
onClick: ({ e, cell, view }) => {
this.$confirm(
'确定删除这个工序吗?',
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}
).then(async () => {
const id = node.attrs.detId.text;
const status = await this.handleDelete(id);
if (status) {
view.cell.remove();
}
}).catch(err => {
return;
})
}
}
})
});
this.graph.on('node:mouseleave', ({ node }) => {
node.removeTools();
})
},
resetLayout() {
this.layout = {
id: null,
flowId: null,
content: '',
createTime: null
}
},
async loadLayout() {
const flowId = this.$route.params.id;
console.log(flowId)
if (!flowId) return { cells: [] }
const { code, data } = await this.info({ id: flowId });
if (code == 0) {
if (data) {
this.layout = data;
return JSON.parse(data?.content) || { cells: [] };
}
return { cells: [] };
}
this.resetLayout();
return Promise.reject(this.infoUrl + ' 接口出错!');
},
handleToJson() { },
handleLoadJson() { },
handleDumpJson() {
if (this.graph) {
console.log(JSON.stringify(this.graph.toJSON(), null, 2));
}
},
async handleUpdateLayout() {
this.layout.content = JSON.stringify(this.graph.toJSON());
let code, data;
console.table([this.layout, this.$route.params.id])
//
if (this.layout.id) {
({ code, data } = await this.http('/extend/process-flow-view/update', 'put', this.layout));
} else {
this.layout.flowId = this.$route.params.id;
({ code, data } = await this.http('/extend/process-flow-view/create', 'post', this.layout));
}
if (code == 0) {
this.$modal.msgSuccess('布局已刷新!')
}
},
reset() {
this.form = {
name: '', //
sectionId: '', // id
remark: '', //
};
this.resetForm('form');
},
/** 取消按钮 */
cancel() {
this.open = false;
this.reset();
},
handleAdd() {
this.reset();
this.open = true;
this.title = '添加工序';
},
handleEdit() {
this.form.name = this.currentDet.detName;
this.form.sectionId = this.currentDet.sectionId;
this.form.remark = this.currentDet.detDesc;
this.form.id = this.currentDet.detId;
this.title = '编辑工序';
this.$nextTick(() => {
this.open = true;
})
},
async handleDelete(id) {
const { code, data } = await this.delete({ id });
debugger;
if (code == 0) {
this.$modal.msgSuccess('成功删除一个工序!');
return true;
}
return false;
},
/** 提交按钮 */
submitForm() {
this.$refs['form'].validate((valid) => {
if (!valid) {
return;
}
//
if (this.form.id != null) {
this.updateProcess()
.then((form) => {
const { name, sectionId, remark } = form;
getSectionFrom(sectionId).then(sectionName => {
// node
this.currentNode.setAttrs({
detName: { text: name },
sectionId: { text: sectionId },
sectionName: { text: sectionName },
detDesc: { text: remark }
})
})
})
.catch(err => { });
return;
}
this.createProcess()
.then(({ id, name, sectionId, remark, flowId }) => {
if (!id) return null;
return createProcessNode({
flowId: flowId,
name, sectionId, remark,
id,
})
}).then(node => {
if (!node) {
this.$modal.msgError('创建节点失败');
return;
};
this.graph.addNode(node);
}).catch(err => {
return;
});
});
},
updateProcess() {
const flowId = this.getFlowId();
if (!flowId) {
this.$modal.msgError('工艺ID不能为空');
return Promise.reject('工艺ID不能为空');
}
return this.put({ flowId, ...this.form })
.then(({ code, data }) => {
if (code == 0) {
this.$modal.msgSuccess('修改成功');
} else {
this.$modal.msgError('修改失败');
}
const formCopy = { ...this.form }
this.open = false;
return formCopy;
});
},
createProcess() {
// const flowId = this.$route.params.id;
const flowId = this.getFlowId(); // it also works
if (!flowId) {
this.$modal.msgError('工艺ID不能为空');
return Promise.reject('工艺ID不能为空');
}
console.log('create process', this.form)
//
return this.post({ flowId, ...this.form }).then(
({ code, data }) => {
this.$modal.msgSuccess('新增成功');
this.open = false;
// this.getList();
return {
id: data, // id
...this.form, // this.form open->false this.form
flowId
};
}
).catch(err => {
this.$modal.msgError(err)
});
},
put(payload) {
return this.http(this.updateUrl, 'put', payload);
},
post(payload) {
return this.http(this.addUrl, 'post', payload);
},
recv(payload) {
return this.http(this.pageUrl, 'get', payload);
},
info(payload) {
return this.http(this.infoUrl, 'get', payload);
},
delete({ id }) {
return this.$axios({
url: this.deleteUrl + `?id=${id}`,
method: 'delete',
});
},
http(url, method, payload) {
return this.$axios({
url,
method,
params: method === 'get' ? payload : null,
data: method !== 'get' ? payload : null,
})
},
},
};
</script>
<style scoped lang="scss">
.process-graph {
padding: 12px 20px 20px;
background: #fff;
border-radius: 8px;
position: relative;
}
.process-graph__panel {
height: 300px;
}
</style>
<style>
.x6-widget-selection-selected {
border: 1px solid red;
}
.my-select {
border: 1px solid red;
}
</style>

View File

@ -0,0 +1,126 @@
<!--
filename: ProcessInfo.vue
author: liubin
date: 2023-10-20 15:00:58
description:
-->
<template>
<section class="process-info">
<SearchBar :formConfigs="searchBarFormConfig" ref="search-bar" />
<el-row :gutter="24">
<el-col :span="6">
<InfoItem label="工单名称" :value="form.name" />
</el-col>
<el-col :span="6">
<InfoItem label="工艺名称" :value="form.processFlowName" />
</el-col>
<el-col :span="6">
<InfoItem label="产品名称" :value="form.productName" />
</el-col>
<el-col :span="6">
<InfoItem label="产品规格" />
</el-col>
</el-row>
</section>
</template>
<script>
const InfoItem = {
name: 'InfoItem',
components: {},
props: ['label', 'value'],
data() {
return {};
},
computed: {},
methods: {},
render: function (h) {
return (
<div style="display: flex; align-items: center; font-size: 14px; line-height: 1.5">
<span style="width: 100px; text-align: left; font-weight: 700">{this.label}:</span>
<span style="width: 200px; text-align: left; text-overflow: ellipse; white-space: nowrap">
{this.value}
</span>
</div>
);
},
};
export default {
name: 'ProcessInfo',
components: { InfoItem },
props: {},
inject: ['getFlowId'],
data() {
return {
infoUrl: '/extend/process-flow/get',
searchBarFormConfig: [{ label: '工艺详情' }],
form: {
id: null,
name: null,
productName: null,
processFlowName: null,
// remark: null,
// enable: null,
// code: null
},
};
},
mounted() {
this.getInfo()
},
computed: {},
methods: {
// utils
// http(url, method, payload) {
// return this.$axios({
// url,
// method,
// params: method === 'get' ? payload : null,
// data: method !== 'get' ? payload : null,
// })
// },
// put(payload) {
// return this.http(this.updateUrl, 'put', payload);
// },
// post(payload) {
// return this.http(this.addUrl, 'post', payload);
// },
// recv(payload) {
// return this.http(this.pageUrl, 'get', payload);
// },
// info(payload) {
// return this.http(this.infoUrl, 'get', payload);
// },
async getInfo() {
this.form.name = this.$route.params.name
this.form.productName = this.$route.params.productName
this.form.processFlowName = this.$route.params.processFlowName
// this.form.name = this.$route.params.name
// const flowId = this.$route.params.id;
// console.log(flowId);
// if (!flowId) this.$router.go(-1);
// const { code, data } = await this.info({ id: flowId });
// // debugger;
// if (code == 0) {
// this.form = {
// ...data
// };
// } else {
// this.$modal.msgError('')
// }
}
},
};
</script>
<style scoped lang="scss">
.process-info {
padding: 12px 20px 20px;
background: #fff;
border-radius: 8px;
}
</style>

View File

@ -0,0 +1,170 @@
import { Node, ObjectExt, Shape } from '@antv/x6';
import { IdToName } from '@/utils'
import cache from '@/utils/cache'
import axios from '@/utils/request'
import { v4 } from 'uuid'
Shape.Edge.config({
attrs: {
line: {
stroke: '#ccc',
strokeWidth: 1,
targetMarker: {
name: 'block',
width: 1,
height: 1
},
},
}
})
export default class ProcessNode extends Node { }
ProcessNode.config({
width: 200,
height: 100,
markup: [
{
tagName: 'rect',
selector: 'container',
attrs: {
x: 0,
y: 0,
width: 200,
height: 100,
fill: 'transparent',
stroke: '#ccc'
},
},
{
tagName: 'rect',
attrs: {
x: 0,
y: 0,
width: 200,
height: 50,
fill: '#ffffff',
},
},
{
tagName: 'rect',
attrs: {
x: 0,
y: 50,
width: 200,
height: 50,
fill: '#f8f8f8',
},
},
{
tagName: 'text',
selector: 'detName',
attrs: {
x: 20,
y: 30,
},
},
{
tagName: 'text',
selector: 'sectionName',
attrs: {
x: 115,
y: 30,
},
},
{
tagName: 'text',
selector: 'detDesc',
attrs: {
x: 26,
y: 80,
fill: '#777',
fontSize: 14,
fill: '#1a90fc',
},
},
],
attrs: {
line: {
fill: 'red'
}
},
ports: {
groups: {
in: {
position: 'left',
attrs: {
circle: {
r: 2,
magnet: true,
stroke: '#0b58ff',
strokeWidth: 1,
fill: '#0b58ff'
}
}
},
out: {
position: 'right',
attrs: {
circle: {
r: 2,
magnet: true,
stroke: '#0b58ff',
strokeWidth: 1,
fill: '#0b58ff'
}
}
}
}
},
propHooks(metadata) {
const { detId, detName, detDesc, sectionName, processId, sectionId, ...others } = metadata;
// debugger;
if (detName) ObjectExt.setByPath(others, 'attrs/detName/text', detName);
if (detDesc) ObjectExt.setByPath(others, 'attrs/detDesc/text', detDesc);
if (sectionName) ObjectExt.setByPath(others, 'attrs/sectionName/text', sectionName);
if (detId) ObjectExt.setByPath(others, 'attrs/detId/text', detId);
if (processId) ObjectExt.setByPath(others, 'attrs/processId/text', processId);
if (sectionId) ObjectExt.setByPath(others, 'attrs/sectionId/text', sectionId);
return others;
}
});
export const CACHE_NAME = 'ProcessDetail::section';
export async function getSectionFrom(sectionId) {
const sectionList = await cache.getList(
CACHE_NAME,
async () => {
const { code, data } = await axios(
'/base/core-production-line/listAll'
);
if (code == 0) {
return data;
}
}
);
return IdToName(sectionId, sectionList);
}
export async function createProcessNode({ flowId, id, name, sectionId, remark }) {
const sectionName = await getSectionFrom(sectionId);
return {
shape: 'process-node',
x: 0,
y: 0,
detName: name, // 工序名称
sectionName, // 工段
sectionId,
detDesc: remark, // 工序说明
processId: flowId, // 工艺ID
detId: id, // 工序ID
tools: [],
ports: [
{ id: v4(), group: 'in' },
{ id: v4(), group: 'out' },
]
};
}
export async function createEdge(src, dest) { }

View File

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

View File

@ -0,0 +1,63 @@
<!--
* @Author: zhp
* @Date: 2023-11-10 09:18:48
* @LastEditTime: 2023-11-10 09:23:24
* @LastEditors: zhp
* @Description:
-->
<template>
<span>
{{ injectData.minValueSet + '-' + injectData.maxValueSet + "/" + injectData / defaultValueSet }}
</span>
</template>
<script>
export default {
props: {
injectData: {
type: Object,
default: () => ({})
}
},
data() {
return {
// state: false
}
},
// computed: {
// readonly() {
// return !!this.injectData.readonly
// }
// },
// mounted() {
// this.mapToState()
// },
methods: {
// mapToState() {
// if (this.injectData.prop === 'enabled') {
// this.state = this.injectData.enabled === 1 ? true : false
// }
// },
// changeHandler() {
// // let params = {}
// let payload = {}
// // params.name = 'state'
// payload.id = this.injectData.id
// payload.enabled = this.state ? '1' : '0'
// payload.code = this.injectData.code
// payload.name = this.injectData.name
// payload.equipmentId = this.injectData.equipmentId
// payload.remark = this.injectData.remark
// // params.payload = payload
// updateProcessEquMaterialBom(payload).then((res) => {
// if (res.code === 0) {
// this.$modal.msgSuccess("");
// }
// })
// // this.$emit('emitData', params)
// }
}
}
</script>

View File

@ -0,0 +1,63 @@
<!--
filename: index.vue
author: liubin
date: 2023-10-18 12:25:46
description:
-->
<template>
<div class="app-container process-flow-view">
<ProcessInfo />
<ProcessDetail style="margin-top: 16px" @det-selected="handleDetSelected" />
<ProcessBomList style="margin-top: 16px" :current-det="currentDet" />
</div>
</template>
<script>
import ProcessInfo from './components/ProcessInfo.vue';
import ProcessBomList from './components/ProcessBomList.vue';
import ProcessDetail from './components/ProcessDetail.vue';
export default {
name: 'ProcessFlowView',
components: { ProcessInfo, ProcessDetail, ProcessBomList },
props: {},
data() {
return {
flowId: null,
currentDet: null
};
},
provide() {
const that = this;
return {
getFlowId() {
return that.flowId;
},
};
},
mounted() {
console.log('activated...', this.$route.params);
this.flowId = this.$route.params.id;
},
computed: {},
methods: {
handleDetSelected(det) {
if (det != null) {
this.currentDet = { ...det }
}
else this.currentDet = null;
}
},
};
</script>
<style scoped lang="scss">
.process-flow-view {
padding: 8px;
flex: 1;
background: #f2f4f9;
display: flex;
flex-direction: column;
}
</style>

View File

@ -224,7 +224,7 @@ export default {
// 线
async getProductLineList() {
const response = await this.$axios('/base/production-line/listAll');
const response = await this.$axios('/base/core-production-line/listAll');
this.productionLineList = response.data.map((item) => ({
label: item.name,
value: item.id,

View File

@ -186,7 +186,7 @@ export default {
},
{
type: this.$auth.hasPermi(
'monitoring:quality-inspection-record:create'
'base:quality-inspection-record:create'
)
? 'button'
: '',
@ -197,13 +197,13 @@ export default {
},
],
tableBtn: [
this.$auth.hasPermi('monitoring:quality-inspection-record:update')
this.$auth.hasPermi('base:quality-inspection-record:update')
? {
type: 'edit',
btnName: '修改',
}
: undefined,
this.$auth.hasPermi('monitoring:quality-inspection-record:delete')
this.$auth.hasPermi('base:quality-inspection-record:delete')
? {
type: 'delete',
btnName: '删除',
@ -219,7 +219,7 @@ export default {
filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
},
{
width: 128,
// width: 128,
prop: 'inspectionDetContent',
label: '检测内容',
},

View File

@ -68,7 +68,7 @@ export default {
methods: {
async getList() {
const response = await this.$axios({
url: '/monitoring/record-in-one-day/get',
url: '/analysis/record-in-one-day/get',
method: 'get',
});
const {

View File

@ -0,0 +1,243 @@
<!--
* @Author: zwq
* @Date: 2023-08-01 14:55:51
* @LastEditors: zhp
* @LastEditTime: 2023-11-10 16:26:45
* @Description:
-->
<template>
<div class="app-container">
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
<base-table :table-props="tableProps" :page="listQuery.pageNo" :limit="listQuery.pageSize" :table-data="list">
<!-- <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="getList" />
<!-- <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" /> -->
</div>
</template>
<script>
// import AddOrUpdate from './add-or-updata';
// import unitDict from './unitDict';
// import basicPage from '../mixins/basic-page';
import { publicFormatter } from '@/utils/dict';
import { parseTime } from '../mixins/code-filter';
import {
getRawMaterialPage,
getWorkOrderList,
// exportEnergyPlcExcel
} from '@/api/quality/rawMaterialTraceability';
const tableProps = [
{
prop: 'createTime',
label: '添加时间',
filter: parseTime
},
{
prop: 'material',
label: '原料名称',
filter: publicFormatter('material')
},
{
prop: 'origin',
label: '来源',
filter: (val)=>val == 1 ? '内部' : '外部'
},
{
prop: 'supplierId',
label: '供应商'
},
{
prop: 'batch',
label: '批次'
},
{
prop: 'num',
label: '数量'
},
{
prop: 'unit',
label: '单位',
filter: publicFormatter('unit_dict')
}
];
export default {
// mixins: [basicPage],
data() {
return {
// urlOptions: {
// getDataListURL: getMaterialUseLogPage,
// // deleteURL: deletePackingType,
// // exportURL: exportPackingExcel,
// },
tableProps,
tableBtn: [
this.$auth.hasPermi(`base:packaging-print-log:update`)
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
this.$auth.hasPermi(`base:packaging-print-log:delete`)
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v) => v),
list: [],
listQuery: {
pageSize: 10,
pageNo: 1,
total: 0,
workOrderId: undefined,
startTime: undefined,
endTime:undefined,
},
formConfig: [
{
type: 'select',
label: '工单',
selectOptions: [],
labelField: 'name',
valueField: 'id',
param: 'workOrderId'
},
// {
// type: 'datePicker',
// label: '',
// dateType: 'daterange',
// format: 'yyyy-MM-dd',
// valueFormat: "yyyy-MM-dd",
// rangeSeparator: '-',
// startPlaceholder: '',
// endPlaceholder: '',
// param: 'timeVal',
// defaultSelect: [],
// width: 250
// },
{
type: 'button',
btnName: '搜索',
name: 'search',
color: 'primary',
},
// {
// type: 'separate',
// },
// {
// type: 'button',
// btnName: '',
// name: 'reset',
// },
// {
// type: 'separate',
// },
// {
// type: this.$auth.hasPermi('base:packaging-print-log:create') ? 'button' : '',
// btnName: '',
// name: 'add',
// color: 'success',
// plain: true,
// },
// {
// type: 'separate',
// type: this.$auth.hasPermi('base:product:create') ? 'separate' : '',
// },
// {
// type: this.$auth.hasPermi('monitoring:materiel-date-from:export') ? 'button' : '',
// btnName: '',
// name: 'export',
// color: 'warning',
// },
],
};
},
components: {
// AddOrUpdate,
},
created() {
this.getList()
this.getDict()
},
methods: {
getList() {
getRawMaterialPage({ ...this.listQuery }).then(res => {
this.list = res.data.list || []
this.listQuery.total = res.data.total || 0
})
},
getDict() {
//
// getCustomerList().then((response) => {
// console.log(response);
// this.customerList = response.data
// // this.listQuery.total = response.data.total;
// })
// getModelList().then((response) => {
// console.log(response);
// this.modelList = response.data
// // this.listQuery.total = response.data.total;
// })
getWorkOrderList().then((response) => {
// console.log(response);
this.formConfig[0].selectOptions = response.data.map((item) => {
return {
name: item.name,
id: item.id
}
})
console.log(this.formConfig[0].selectOptions);
// this.listQuery.total = response.data.total;
})
},
// handleExport() {
// //
// let params = { ...this.listQuery };
// params.pageNo = undefined;
// params.pageSize = undefined;
// this.$modal.confirm('?').then(() => {
// this.exportLoading = true;
// return exportEnergyPlcExcel(params);
// }).then(response => {
// this.$download.excel(response, ' ');
// this.exportLoading = false;
// }).catch(() => { });
// },
buttonClick(val) {
console.log(val)
if (val.btnName === 'search') {
this.listQuery.workOrderId = val.workOrderId ? val.workOrderId :undefined
// this.queryParams.status = val.status
// if (val.timeVal && val.timeVal.length != 0 ) {
// this.listQuery.startTime = val.timeVal[0] + ' 00:00:00'
// this.listQuery.endTime = val.timeVal[1] + ' 23:59:59'
// } else {
// this.listQuery.startTime = undefined
// this.listQuery.endTime = undefined
// }
this.getList()
} else {
// this.handleExport()
// this.addOrEditTitle = ''
// this.centervisible = true
// this.$nextTick(() => {
// this.$refs.orderAdd.init()
// })
}
},
otherMethods(val) {
this.addOrUpdateVisible = true;
this.addOrEditTitle = '详情';
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data.id, true);
});
},
},
};
</script>

View File

@ -0,0 +1,270 @@
<!--
filename: dialogForm.vue
author: liubin
date: 2023-09-11 15:55:13
description: DialogForm for qualityInspectionRecord only
-->
<template>
<el-form
ref="form"
:model="innerDataForm"
label-width="100px"
v-loading="formLoading">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item
label="检测内容"
prop="inspectionDetId"
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-select
v-model="innerDataForm.inspectionDetId"
placeholder="请选择检测内容"
filterable
clearable
@change="handleInspectionDetChange">
<el-option
v-for="opt in inspectionDetList"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="来源"
prop="source"
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-select
v-model="innerDataForm.source"
placeholder="请选择来源"
filterable
clearable
@change="$emit('update', innerDataForm)">
<el-option
v-for="opt in [
{ label: '手动', value: 1 },
{ label: '自动', value: 2 },
]"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item
label="产线"
prop="productionLineId"
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-select
v-model="innerDataForm.productionLineId"
placeholder="请选择产线"
filterable
clearable
@change="handleProductlineChange">
<el-option
v-for="opt in productionLineList"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="工段"
prop="sectionId"
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-select
v-model="innerDataForm.sectionId"
placeholder="请选择工段"
clearable
filterable
@change="$emit('update', innerDataForm)">
<el-option
v-for="opt in sectionList"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="检测人员" prop="checkPerson">
<el-input
v-model="innerDataForm.checkPerson"
clearable
@change="$emit('update', innerDataForm)"
placeholder="请输入检测人员" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="检测时间"
prop="checkTime"
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-date-picker
v-model="innerDataForm.checkTime"
type="datetime"
placeholder="请选择检测时间"
value-format="timestamp"
@change="$emit('update', innerDataForm)"></el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col>
<el-form-item label="描述" prop="explainText">
<el-input
v-model="innerDataForm.explainText"
placeholder="请输入描述信息"
@change="$emit('update', innerDataForm)"
type="textarea"></el-input>
</el-form-item>
</el-col>
<el-col>
<el-form-item label="备注" prop="remark">
<el-input
v-model="innerDataForm.remark"
@change="$emit('update', innerDataForm)"
placeholder="请输入备注"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
export default {
name: 'DialogForm',
model: {
prop: 'dataForm',
event: 'update',
},
emits: ['update'],
components: {},
props: {
dataForm: {
type: Object,
default: () => ({}),
},
},
data() {
return {
formLoading: true,
inspectionDetList: [],
productionLineList: [],
sectionList: [],
innerDataForm: {},
cacheInspectionDetList: null,
};
},
mounted() {
Promise.all([this.getProductLineList(), this.getInspectionDetList()]).then(
() => {
this.formLoading = false;
}
);
},
watch: {
// 'innerDataForm.productionLineId': {
// handler: async function (plId) {
// if (plId) await this.getWorksectionList(plId);
// },
// immediate: true,
// },
dataForm: {
handler: function (dataForm) {
this.innerDataForm = Object.assign({}, dataForm);
if (dataForm.productionLineId)
this.getWorksectionList(dataForm.productionLineId);
},
immediate: true,
},
},
methods: {
/** 模拟透传 ref */
validate(cb) {
return this.$refs.form.validate(cb);
},
resetFields(args) {
return this.$refs.form.resetFields(args);
},
handleInspectionDetChange(value) {
const { id, content } = this.cacheInspectionDetList.find(
(item) => item.id == value
);
this.innerDataForm.inspectionDetId = id;
this.innerDataForm.inspectionDetContent = content;
this.$emit('update', this.innerDataForm);
},
async handleProductlineChange(id) {
// await this.getWorksectionList(id);
this.innerDataForm.sectionId = null;
this.$emit('update', this.innerDataForm);
},
// getCode
async getCode(url) {
const response = await this.$axios(url);
return response.data;
},
// 线
async getProductLineList() {
const response = await this.$axios('/base/core-production-line/listAll');
this.productionLineList = response.data.map((item) => ({
label: item.name,
value: item.id,
}));
},
//
async getInspectionDetList() {
const response = await this.$axios(
'/base/quality-inspection-det/listAll'
);
this.cacheInspectionDetList = response.data;
this.inspectionDetList = response.data.map((item) => ({
label: item.content,
value: item.id,
}));
},
//
async getWorksectionList(plId) {
const response = await this.$axios(
'/base/workshop-section/listByParentId',
{
params: {
id: plId,
},
}
);
this.sectionList = response.data.map((item) => ({
label: item.name,
value: item.id,
}));
},
},
};
</script>
<style scoped lang="scss">
.el-date-editor,
.el-select {
width: 100%;
}
</style>

View File

@ -0,0 +1,436 @@
<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">
<!-- <method-btn
v-if="tableBtn.length"
slot="handleBtn"
label="操作"
:width="120"
fixed="right"
: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="50%"
@close="cancel"
@cancel="cancel"
@confirm="submitForm">
<DialogForm v-if="open" ref="form" v-model="form" />
</base-dialog> -->
</div>
</template>
<script>
import {
getStatisticalDataPage,
getProductList,
getWorkOrderList
} from '@/api/monitoring/statisticalData';
// import Editor from '@/components/Editor';
import moment from 'moment';
// import DialogForm from './dialogForm.vue';
// import basicPageMixin from '@/mixins/lb/basicPageMixin';
export default {
name: 'statisticalData',
// components: {
// DialogForm,
// },
// mixins: [basicPageMixin],
data() {
return {
list: [],
dynamicProps:[],
searchBarFormConfig: [
{
type: 'select',
label: '工单号',
placeholder: '请选择工单号',
param: 'workOrderId',
selectOptions: [],
},
{
type: 'select',
label: '产品',
placeholder: '请选择产品',
param: 'productionId',
selectOptions: [],
},
// {
// type: 'input',
// label: '',
// placeholder: '',
// param: 'inspectionDetContent',
// },
{
type: 'datePicker',
label: '时间段',
dateType: 'daterange', // datetimerange
// format: 'yyyy-MM-dd HH:mm:ss',
format: 'yyyy-MM-dd',
valueFormat: 'timestamp',
rangeSeparator: '-',
startPlaceholder: '开始日期',
endPlaceholder: '结束日期',
defaultTime: ['00:00:00', '23:59:59'],
param: 'checkTime',
// width: 350,
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
// {
// type: this.$auth.hasPermi(
// 'base:quality-inspection-record:create'
// )
// ? 'button'
// : '',
// btnName: '',
// name: 'add',
// plain: true,
// color: 'success',
// },
],
// tableBtn: [
// this.$auth.hasPermi('base:quality-inspection-record:update')
// ? {
// type: 'edit',
// btnName: '',
// }
// : undefined,
// this.$auth.hasPermi('base:quality-inspection-record: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'),
// },
// {
// // width: 128,
// prop: 'inspectionDetContent',
// label: '',
// },
// {
// // width: 128,
// prop: 'lineName',
// label: '线',
// },
// {
// // width: 128,
// prop: 'checkPerson',
// label: '',
// },
// {
// // width: 160,
// prop: 'checkTime',
// label: '',
// filter: (val) =>
// val != null ? moment(val).format('yyyy-MM-DD HH:mm:ss') : '-',
// },
// {
// width: 90,
// prop: 'source',
// label: '',
// filter: (val) => ['', '', ''][val],
// },
// ],
// keys, queryParams pageNo, pageSize key
// searchBarKeys: ['inspectionDetContent', 'checkTime', 'productionLineId'],
// form: {
// id: undefined,
// inspectionDetId: undefined,
// inspectionDetContent: undefined,
// productionLineId: undefined,
// sectionId: undefined,
// checkPerson: undefined,
// checkTime: undefined,
// source: undefined,
// explainText: undefined,
// remark: undefined,
// },
//
queryParams: {
workOrderId: undefined,
productId: undefined,
startTime: undefined,
endTime: undefined,
// productionLineId: null,
},
};
},
created() {
// this.getProductLineList();
},
computed: {
tableProps() {
return [
{
// width: 160,
prop: 'inspectionContent',
label: '检测内容',
},
...this.dynamicProps,
{
// width: 128,
prop: 'sumInput',
label: '检测类型总数',
},
{
// width: 128,
prop: 'scrapRatio',
label: '比例(%)',
// subcomponent: {
// name: 'TextOnly',
// props: {
// injectData: {
// type: Object,
// default: () => ({}),
// },
// },
// data() {
// return {
// text: '',
// };
// },
// methods: {
// handleEmit(payload) {
// console.log('handleEmit', payload);
// },
// },
// render(h) {
// return h('el-button', { props: { type: 'text' } }, this.text);
// },
// },
},
];
},
},
mounted() {
if (this.$route.params.startTime && this.$route.params.endTime) {
this.searchBarFormConfig[0].defaultSelect = [
this.$route.params.startTime,
this.$route.params.endTime,
];
this.queryParams.param = {};
this.$set(
this.queryParams.param,
'startTime',
this.$route.params.startTime
);
this.$set(this.queryParams.param, 'endTime', this.$route.params.endTime);
} else {
this.searchBarFormConfig[0].defaultSelect = [];
}
this.getList()
},
methods: {
/** 获取搜索栏的产线列表 */
async getDict() {
const res = await getProductList()
const result = await getWorkOrderList()
console.log(res);
this.searchBarFormConfig[1].selectOptions = res.data.map((item) => {
return {
name: item.name,
id:item.id
}
})
this.searchBarFormConfig[0].selectOptions = result.data.map((item) => {
return {
name: item.name,
id: item.id
}
})
},
// getProductLineList() {
// this.$axios('/base/production-line/listAll').then((response) => {
// this.searchBarFormConfig[0].selectOptions = response.data.map(
// (item) => {
// return {
// name: item.name,
// id: item.id,
// };
// }
// );
// });
// },
getList() {
this.getDataList()
this.getDict()
},
/** 查询列表 */
async getDataList() {
this.loading = true;
//
const {
data: { data, otherList, otherMap, nameData },
} = await getStatisticalDataPage(this.queryParams)
this.dynamicProps = this.filterNameData(nameData)
this.list = this.filterData(data);
},
filterNameData(nameData) {
const ndSet = new Set();
nameData.forEach((nd) => {
ndSet.add(nd.name);
});
return Array.from(ndSet.values())
.sort()
.map((name) => ({
prop: name,
label: name,
}));
},
filterData(data) {
return data.map((item) => {
const { data: innerData } = item;
const keyValuePairs = {};
innerData.map((d) => {
keyValuePairs[d.dynamicName] = d.dynamicValue;
});
return {
inspectionContent: item.inspectionContent,
...keyValuePairs,
sumInput: item.sumInput,
scrapRatio: item.scrapRatio,
};
});
},
/** 取消按钮 */
handleSearchBarBtnClick(val) {
if (val.btnName === 'search') {
this.queryParams.workOrderId = val.workOrderId ? val.workOrderId : undefined
this.queryParams.productId = val.productId ? val.productId : undefined
this.queryParams.startTime = val.checkTime ? val.checkTime[0] : undefined
this.queryParams.endTime = val.checkTime ? val.checkTime[1] : undefined
this.getList()
}
console.log(val);
}
/** 搜索按钮操作 */
// 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;
// getQualityInspectionRecord(id).then((response) => {
// /** */
// const info = {}
// Object.keys(this.form).forEach(key => {
// info[key] = response.data[key]
// });
// this.form = info;
// this.open = true;
// this.title = '';
// });
// },
// /** */
// submitForm() {
// this.$refs['form'].validate((valid) => {
// if (!valid) {
// return;
// }
// //
// if (this.form.id != null) {
// updateQualityInspectionRecord(this.form).then((response) => {
// this.$modal.msgSuccess('');
// this.open = false;
// this.getList();
// });
// return;
// }
// //
// createQualityInspectionRecord(this.form).then((response) => {
// this.$modal.msgSuccess('');
// this.open = false;
// this.getList();
// });
// });
// },
// /** */
// handleDelete(row) {
// const id = row.id;
// this.$modal
// .confirm('"' + row.inspectionDetContent + '"?')
// .then(function () {
// return deleteQualityInspectionRecord(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 exportQualityInspectionRecordExcel(params);
// })
// .then((response) => {
// this.$download.excel(response, '.xls');
// this.exportLoading = false;
// })
// .catch(() => {});
// },
},
};
</script>

View File

@ -1,3 +1,10 @@
<!--
* @Author: zhp
* @Date: 2023-10-17 09:26:38
* @LastEditTime: 2023-10-30 14:53:34
* @LastEditors: zhp
* @Description:
-->
<template>
<div>
<doc-alert title="报表设计器" url="https://doc.iocoder.cn/report/" />