生产监控

This commit is contained in:
helloDy 2023-09-15 14:37:30 +08:00
parent f1bbdf82e5
commit 8cf2f9f7e9
11 changed files with 550 additions and 184 deletions

View File

@ -1,7 +1,7 @@
### ###
# @Author: Do not edit # @Author: Do not edit
# @Date: 2023-08-29 09:40:39 # @Date: 2023-08-29 09:40:39
# @LastEditTime: 2023-09-11 15:55:29 # @LastEditTime: 2023-09-12 08:47:57
# @LastEditors: DY # @LastEditors: DY
# @Description: # @Description:
### ###
@ -12,10 +12,10 @@ ENV = 'development'
VUE_APP_TITLE = 芋道管理系统 VUE_APP_TITLE = 芋道管理系统
# 芋道管理系统/开发环境 # 芋道管理系统/开发环境
VUE_APP_BASE_API = 'http://192.168.1.49:48080' # VUE_APP_BASE_API = 'http://192.168.1.49:48080'
# VUE_APP_BASE_API = 'http://192.168.1.8:48080' # VUE_APP_BASE_API = 'http://192.168.1.8:48080'
# VUE_APP_BASE_API = 'http://192.168.0.33:48080' # VUE_APP_BASE_API = 'http://192.168.0.33:48080'
# VUE_APP_BASE_API = 'http://192.168.1.188:48080' VUE_APP_BASE_API = 'http://192.168.1.188:48080'
# 路由懒加载 # 路由懒加载
VUE_CLI_BABEL_TRANSPILE_MODULES = true VUE_CLI_BABEL_TRANSPILE_MODULES = true

View File

@ -55,8 +55,10 @@
"file-saver": "^2.0.5", "file-saver": "^2.0.5",
"fuse.js": "6.6.2", "fuse.js": "6.6.2",
"highlight.js": "9.18.5", "highlight.js": "9.18.5",
"html2canvas": "^1.4.1",
"js-beautify": "1.13.0", "js-beautify": "1.13.0",
"jsencrypt": "3.3.1", "jsencrypt": "3.3.1",
"jspdf": "^2.5.1",
"min-dash": "3.5.2", "min-dash": "3.5.2",
"mockjs": "^1.1.0", "mockjs": "^1.1.0",
"moment": "^2.29.4", "moment": "^2.29.4",

View File

@ -0,0 +1,25 @@
/*
* @Author: Do not edit
* @Date: 2023-09-12 09:44:53
* @LastEditTime: 2023-09-13 16:11:41
* @LastEditors: DY
* @Description:
*/
import request from '@/utils/request'
// 获得工厂分页
export function getPdlAutoReport(data) {
return request({
url: '/monitoring/production-monitor/getPdlAutoReport',
method: 'post',
data: data
})
}
// 获得所有工厂产线列表
export function getPdList() {
return request({
url: '/base/production-line/listAll',
method: 'get'
})
}

View File

@ -0,0 +1,25 @@
/*
* @Author: Do not edit
* @Date: 2023-09-12 09:44:53
* @LastEditTime: 2023-09-14 10:25:46
* @LastEditors: DY
* @Description:
*/
import request from '@/utils/request'
// 获得产线统计数据查询
export function getPdlDataSearch(data) {
return request({
url: '/monitoring/production-monitor/getPdlDataSearch',
method: 'post',
data: data
})
}
// 获得所有工厂产线列表
export function getPdList() {
return request({
url: '/base/production-line/listAll',
method: 'get'
})
}

View File

@ -0,0 +1,17 @@
/*
* @Author: Do not edit
* @Date: 2023-09-12 09:44:53
* @LastEditTime: 2023-09-15 14:12:26
* @LastEditors: DY
* @Description:
*/
import request from '@/utils/request'
// 获得近24小时产线生产数据
export function getPdlDataOneDay(data) {
return request({
url: '/monitoring/production-monitor/getPdlDataOneDay',
method: 'post',
data: data
})
}

View File

@ -0,0 +1,33 @@
/*
* @Author: Do not edit
* @Date: 2023-09-12 09:44:53
* @LastEditTime: 2023-09-14 14:01:12
* @LastEditors: DY
* @Description:
*/
import request from '@/utils/request'
// 获得工段自动统计数据查询
export function getSectionAutoReport(data) {
return request({
url: '/monitoring/production-monitor/getSectionAutoReport',
method: 'post',
data: data
})
}
// 获得所有工厂产线列表
export function getPdList() {
return request({
url: '/base/production-line/listAll',
method: 'get'
})
}
// 获得所有产线工段列表
export function getWorkshopSectionList() {
return request({
url: '/base/workshop-section/listAll',
method: 'get'
})
}

View File

@ -1,8 +1,8 @@
/* /*
* @Date: 2020-12-29 16:49:28 * @Date: 2020-12-29 16:49:28
* @LastEditors: zwq * @LastEditors: DY
* @LastEditTime: 2023-08-01 11:10:04 * @LastEditTime: 2023-09-12 11:13:34
* @FilePath: \basic-admin\src\filters\basicData\index.js * @FilePath: \basic-admin\src\filters\basicData\index.js
* @Description: * @Description:
*/ */
@ -13,6 +13,11 @@ const table = {
2: '停止', 2: '停止',
3: '未知', 3: '未知',
}, },
reportType: {
1: '日',
2: '周',
3: '月'
}
} }
// 日期格式化 // 日期格式化

View File

@ -1,7 +1,7 @@
<!-- <!--
* @Author: Do not edit * @Author: Do not edit
* @Date: 2023-08-29 14:59:29 * @Date: 2023-08-29 14:59:29
* @LastEditTime: 2023-09-11 15:52:20 * @LastEditTime: 2023-09-15 11:19:34
* @LastEditors: DY * @LastEditors: DY
* @Description: * @Description:
--> -->
@ -32,100 +32,104 @@
:limit.sync="listQuery.pageSize" :limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo" :page.sync="listQuery.pageNo"
:total="listQuery.total" :total="listQuery.total"
@pagination="getDataList" /> @pagination="getDataList"
<!-- <div> />
<el-button @click="down()">1111</el-button> <!-- <div v-show="false" ref="pdf">
<el-table :data="tableData1" stripe style="width: 100%"> <base-table
<el-table-column prop="date" label="日期" width="180" /> v-loading="dataListLoading"
<el-table-column prop="name" label="姓名" /> :table-props="tableProps"
<el-table-column prop="address" label="地址" /> :page="listQuery.pageNo"
</el-table> :limit="listQuery.pageSize"
:table-data="selectedList"
/>
</div> --> </div> -->
<div ref="pdf" v-show="false">
<el-table :data="selectedList" stripe border="true" style="width: 100%">
<el-table-column prop="reportType" label="报表类型" />
<el-table-column prop="reportStartTime" label="统计开始时间" />
<el-table-column prop="reportEndTime" label="统计结束时间" />
<el-table-column prop="proLineName" label="产线名称" />
<el-table-column prop="inputNum" label="投入数量/片" />
<el-table-column prop="outputNum" label="产出数量/片" />
<el-table-column prop="outputArea" label="产出面积/㎡" />
<el-table-column prop="lossArea" label="损耗面积/㎡" />
<el-table-column prop="lossRatio" label="损耗比例%" />
</el-table>
</div>
<el-dialog
title="提示"
:visible.sync="dialogVisible"
width="30%"
:before-close="handleClose">
<el-button type="primary" @click="exportXlsx">xlsx</el-button>
<el-button type="success" @click="exportPdf">pdf</el-button>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary" @click="dialogVisible = false"> </el-button>
</span>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { parseTime } from '../../mixins/code-filter'; import { parseTime } from '../../mixins/code-filter';
import { import { getPdlAutoReport, getPdList } from '@/api/core/monitoring/auto'
getFactoryPage, import jsPDF from 'jspdf'
exportFactoryExcel, import html2canvas from 'html2canvas'
} from '@/api/core/base/factory'; // import codeFilter from '../../mixins/code-filter'
import * as XLSX from 'xlsx' import * as XLSX from 'xlsx'
import FileSaver from 'file-saver' import FileSaver from 'file-saver'
const tableData1 = [
{
date: '2016-05-03',
name: 'fom',
address: 'No'
},
{
date: '2016-05-02',
name: 'fom',
address: '189'
},
{
date: '2016-0225-03',
name: 'fom',
address: 'Ndddo'
},
{
date: '2016-04445-02',
name: 'fom',
address: '18edd9'
}
]
const tableProps = [ const tableProps = [
{ {
prop: 'code', prop: 'reportType',
label: '报表类型', label: '报表类型',
align: 'center', align: 'center'
}, },
{ {
prop: 'createTime', prop: 'reportStartTime',
label: '统计开始时间', label: '统计开始时间',
align: 'center', align: 'center',
filter: parseTime, filter: parseTime,
}, },
{ {
prop: 'createTime3', prop: 'reportEndTime',
label: '统计结束时间', label: '统计结束时间',
align: 'center', align: 'center',
filter: parseTime, filter: parseTime,
}, },
{ {
prop: 'name', prop: 'proLineName',
label: '产线名称', label: '产线名称',
align: 'center', align: 'center',
}, },
{ {
prop: 'address', prop: 'inputNum',
label: '投入数量/片', label: '投入数量/片',
align: 'center', align: 'center',
}, },
{ {
prop: 'remark44', prop: 'outputNum',
label: '产出数量/片', label: '产出数量/片',
align: 'center', align: 'center',
}, },
{ {
prop: 'remark23', prop: 'outputArea',
label: '产出面积/㎡', label: '产出面积/㎡',
align: 'center', align: 'center',
}, },
{ {
prop: 'remark145', prop: 'lossNum',
label: '损耗数量/片', label: '损耗数量/片',
align: 'center', align: 'center',
}, },
{ {
prop: 'remark22', prop: 'lossArea',
label: '损耗面积/㎡', label: '损耗面积/㎡',
align: 'center', align: 'center',
}, },
{ {
prop: 'remark1', prop: 'lossRatio',
label: '损耗比例%', label: '损耗比例%',
align: 'center', align: 'center',
} }
@ -135,16 +139,8 @@ export default {
data() { data() {
return { return {
urlOptions: { urlOptions: {
getDataListURL: getFactoryPage, getDataListURL: getPdlAutoReport
exportURL: exportFactoryExcel,
}, },
urlOptions: {
getDataListURL: '',
deleteURL: '',
statusUrl: '',
exportURL: ''
},
tableData1,
listQuery: { listQuery: {
pageSize: 10, pageSize: 10,
pageNo: 1, pageNo: 1,
@ -152,10 +148,12 @@ export default {
}, },
exportLoading: false, exportLoading: false,
dataListLoading: false, dataListLoading: false,
dialogVisible: false,
addOrEditTitle: '', addOrEditTitle: '',
addOrUpdateVisible: false, addOrUpdateVisible: false,
tableProps, tableProps,
tableBtn: [], tableBtn: [],
selectedList: [],
// tableBtn: [ // tableBtn: [
// this.$auth.hasPermi(`base:factory:update`) // this.$auth.hasPermi(`base:factory:update`)
// ? { // ? {
@ -181,8 +179,21 @@ export default {
{ {
type: 'select', type: 'select',
label: '报表类型', label: '报表类型',
selectOptions: [], selectOptions: [
param: 'name', {
id: 1,
name: '日'
},
{
id: 2,
name: '周'
},
{
id: 3,
name: '月'
}
],
param: 'reportType',
}, },
{ {
type: 'datePicker', type: 'datePicker',
@ -216,16 +227,63 @@ export default {
], ],
}; };
}, },
created() {}, created() {
this.getDataList()
this.getPdLineList()
},
methods: { methods: {
exportPdf() {
this.pdf()
this.dialogVisible = false
},
exportXlsx() {
this.down()
this.dialogVisible = false
},
imgDownload() {
let that = this
let img = this.$refs['pdf']
//
var w = parseInt(window.getComputedStyle(img).width)
//
var h = parseInt(window.getComputedStyle(img).height)
//
window.pageYOffset = 0
html2canvas(img).then(function(canvas) {
})
},
pdf() {
// console.log('[df]')
// const pdf = new jsPDF()
// const content = this.$refs.pdf.innerHTML
// console.log('', content)
// pdf.text(content, 15, 15)
// // pdf.text('Hello world!', 10, 10)
// pdf.save('test.pdf')
// console.log('', pdf)
const printWindow = window.open('', '_blank')
const temp = this.$refs.pdf.innerHTML
console.log(temp)
printWindow.document.body.innerHTML = temp
printWindow.focus()
// printWindow.document.writeln(this.$refs.pdf.innerHTML)
printWindow.document.close()
printWindow.print()
},
handleClose(done) {
this.$confirm('确认关闭?')
.then(_ => {
done();
})
.catch(_ => {});
},
down() { down() {
// //
const selectedData = this.tableData1.slice(0, 2)
console.log('你好', selectedData, this.tableData1)
// //
const exportData = [ const exportData = [
{date: '日期', name: '姓名', address: '地址'}, {reportType: '报表类型', reportStartTime: '统计开始时间', reportEndTime: '统计结束时间', proLineName: '产线名称', inputNum: '投入数量/片', outputNum: '产出数量/片', outputArea: '产出面积/㎡', lossNum: '损耗数量/片', lossArea: '损耗面积/㎡', lossRatio: '损耗比例%' },
...selectedData ...this.selectedList
] ]
//id dom //id dom
const worksheet = XLSX.utils.json_to_sheet(exportData, { skipHeader: true }) const worksheet = XLSX.utils.json_to_sheet(exportData, { skipHeader: true })
@ -233,7 +291,7 @@ export default {
XLSX.utils.book_append_sheet(workbook, worksheet, "Sheet1") XLSX.utils.book_append_sheet(workbook, worksheet, "Sheet1")
const workbookOutput = XLSX.write(workbook, { bookType: 'xlsx', type: 'array' }) const workbookOutput = XLSX.write(workbook, { bookType: 'xlsx', type: 'array' })
try { try {
FileSaver.saveAs(new Blob([workbookOutput], { type: 'application/octet-stream' }), 'hihi.xlsx') FileSaver.saveAs(new Blob([workbookOutput], { type: 'application/octet-stream' }), '产线统计自动报表.xlsx')
} catch (e) { } catch (e) {
console.log(e) console.log(e)
} }
@ -241,14 +299,22 @@ export default {
selectChange(val) { selectChange(val) {
console.log(val) console.log(val)
this.selectedList = val this.selectedList = val
console.log('勾选数据', this.selectedList)
},
getPdLineList() {
getPdList().then((res) => {
this.formConfig[0].selectOptions = res.data || []
})
}, },
buttonClick(val) { buttonClick(val) {
switch (val.btnName) { switch (val.btnName) {
case 'search': case 'search':
this.listQuery.pageNo = 1; this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10; this.listQuery.pageSize = 10;
this.listQuery.name = val.name; this.listQuery.lineId = val.line ? val.line : undefined;
this.listQuery.code = val.code; this.listQuery.reportType = val.reportType ? val.reportType : undefined;
this.listQuery.reportStartTime = [new Date(val.timeVal[0]).getTime()];
this.listQuery.reportEndTime = [new Date(val.timeVal[1]).getTime()];
this.getDataList(); this.getDataList();
break; break;
case 'export': case 'export':
@ -262,7 +328,10 @@ export default {
getDataList() { getDataList() {
this.dataListLoading = true; this.dataListLoading = true;
this.urlOptions.getDataListURL(this.listQuery).then(response => { this.urlOptions.getDataListURL(this.listQuery).then(response => {
this.tableData = response.data.list; this.tableData = response.data.list.map(item => {
item.reportType = item.reportType === 1 ? '日' : item.reportType === 2 ? '周' : '月'
return item
});
this.total = response.data.total; this.total = response.data.total;
this.dataListLoading = false; this.dataListLoading = false;
}); });
@ -279,17 +348,15 @@ export default {
this.getDataList(); this.getDataList();
}, },
handleExport() { handleExport() {
// if (this.selectedList.length === 0) {
let params = { ...this.queryParams }; this.selectedList = this.tableData
params.pageNo = undefined; }
params.pageSize = undefined; this.dialogVisible = true
this.$modal.confirm('是否确认导出所有数据项?').then(() => { // this.$modal.confirm('?').then(() => {
this.exportLoading = true; // this.exportLoading = true;
return this.urlOptions.exportURL(params); // // this.down()
}).then(response => { // this.pdf()
this.$download.excel(response, '工厂.xls'); // }).catch(() => { });
this.exportLoading = false;
}).catch(() => { });
} }
}, },
}; };

View File

@ -1,7 +1,7 @@
<!-- <!--
* @Author: Do not edit * @Author: Do not edit
* @Date: 2023-08-29 14:59:29 * @Date: 2023-08-29 14:59:29
* @LastEditTime: 2023-08-31 15:15:31 * @LastEditTime: 2023-09-14 10:51:20
* @LastEditors: DY * @LastEditors: DY
* @Description: * @Description:
--> -->
@ -37,46 +37,36 @@
</template> </template>
<script> <script>
import { import { getPdlDataSearch, getPdList } from '@/api/core/monitoring/data'
getFactoryPage,
exportFactoryExcel,
} from '@/api/core/base/factory';
const tableProps = [ const tableProps = [
{ {
prop: 'name', prop: 'proLineName',
label: '产线名称', label: '产线名称'
align: 'center',
}, },
{ {
prop: 'address', prop: 'inputNum',
label: '投入数量/片', label: '投入数量/片'
align: 'center',
}, },
{ {
prop: 'remark44', prop: 'outputNum',
label: '产出数量/片', label: '产出数量/片'
align: 'center',
}, },
{ {
prop: 'remark23', prop: 'outputArea',
label: '产出面积/㎡', label: '产出面积/㎡'
align: 'center',
}, },
{ {
prop: 'remark145', prop: 'lossNum',
label: '损耗数量/片', label: '损耗数量/片'
align: 'center',
}, },
{ {
prop: 'remark22', prop: 'lossArea',
label: '损耗面积/㎡', label: '损耗面积/㎡'
align: 'center',
}, },
{ {
prop: 'remark1', prop: 'lossRate',
label: '损耗比例%', label: '损耗比例%'
align: 'center',
} }
]; ];
@ -84,20 +74,14 @@ export default {
data() { data() {
return { return {
urlOptions: { urlOptions: {
getDataListURL: getFactoryPage, getDataListURL: getPdlDataSearch
exportURL: exportFactoryExcel,
},
urlOptions: {
getDataListURL: '',
deleteURL: '',
statusUrl: '',
exportURL: ''
}, },
tableData: [], tableData: [],
listQuery: { listQuery: {
pageSize: 10, pageSize: 10,
pageNo: 1, pageNo: 1,
total: 1, total: 1,
proLineId: undefined
}, },
exportLoading: false, exportLoading: false,
dataListLoading: false, dataListLoading: false,
@ -145,8 +129,16 @@ export default {
], ],
}; };
}, },
created() {}, created() {
this.getDataList()
this.getPdLineList()
},
methods: { methods: {
getPdLineList() {
getPdList().then((res) => {
this.formConfig[0].selectOptions = res.data || []
})
},
selectChange(val) { selectChange(val) {
console.log(val) console.log(val)
this.selectedList = val this.selectedList = val
@ -156,8 +148,9 @@ export default {
case 'search': case 'search':
this.listQuery.pageNo = 1; this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10; this.listQuery.pageSize = 10;
this.listQuery.name = val.name; this.listQuery.proLineId = val.line ? val.line : undefined;
this.listQuery.code = val.code; this.listQuery.startTime = val.timeVal ? new Date(val.timeVal[0]).getTime() : undefined;
this.listQuery.endTime = val.timeVal ? new Date(val.timeVal[1]).getTime() : undefined;
this.getDataList(); this.getDataList();
break; break;
case 'export': case 'export':
@ -171,7 +164,7 @@ export default {
getDataList() { getDataList() {
this.dataListLoading = true; this.dataListLoading = true;
this.urlOptions.getDataListURL(this.listQuery).then(response => { this.urlOptions.getDataListURL(this.listQuery).then(response => {
this.tableData = response.data.list; this.tableData = response.data;
this.total = response.data.total; this.total = response.data.total;
this.dataListLoading = false; this.dataListLoading = false;
}); });
@ -189,16 +182,16 @@ export default {
}, },
handleExport() { handleExport() {
// //
let params = { ...this.queryParams }; // let params = { ...this.queryParams };
params.pageNo = undefined; // params.pageNo = undefined;
params.pageSize = undefined; // params.pageSize = undefined;
this.$modal.confirm('是否确认导出所有数据项?').then(() => { // this.$modal.confirm('?').then(() => {
this.exportLoading = true; // this.exportLoading = true;
return this.urlOptions.exportURL(params); // return this.urlOptions.exportURL(params);
}).then(response => { // }).then(response => {
this.$download.excel(response, '工厂.xls'); // this.$download.excel(response, '.xls');
this.exportLoading = false; // this.exportLoading = false;
}).catch(() => { }); // }).catch(() => { });
} }
}, },
}; };

View File

@ -0,0 +1,189 @@
<!--
filename: index.vue
author: liubin
date: 2023-08-04 14:44:58
description: 设备24小时生产记录
-->
<template>
<div class="app-container">
<SearchBar
:formConfigs="[{ label: '设备近24小时产线生产数据', type: 'title' }]"
ref="search-bar" />
<el-skeleton v-if="initing" :rows="6" animated />
<base-table
v-else
:span-method="mergeColumnHandler"
:table-props="tableProps"
:table-data="list"
@emitFun="handleEmitFun"></base-table>
<!-- :page="queryParams.pageNo"
:limit="queryParams.pageSize" -->
</div>
</template>
<script>
import { getPdlDataOneDay } from '@/api/core/monitoring/data24'
export default {
name: 'productionLineData24',
components: {},
props: {},
data() {
return {
urlOptions: {
getDataListURL: getPdlDataOneDay
},
initing: false,
queryParams: {
pageNo: 1,
pageSize: 10,
},
list: [],
tableProps: [],
spanInfo: {},
};
},
computed: {},
mounted() {
this.getList();
},
methods: {
/** 构建tableProps - 依据第一个元素所提供的信息 */
buildProps(item) {
const {
data: [{ hourData }],
} = item;
const props = [
{ prop: 'productLine', label: '产线', align: 'center' },
{ prop: 'specification', label: '规格', align: 'center' },
{ prop: 'equipmentName', label: '设备', align: 'center' },
{ prop: 'totalQuantity', label: '生产总数', align: 'center' },
];
for (const key of Object.keys(hourData).sort()) {
const subprop = {
label: key,
align: 'center',
children: [
{ prop: key + '__in', label: '进数据', align: 'center' },
{ prop: key + '__out', label: '出数据', align: 'center' },
{ prop: key + '__nok', label: '报废数据', align: 'center' },
{
prop: key + '__ratio',
label: '报废率',
align: 'center',
filter: (val) => (val != null ? val + ' %' : '-'),
},
],
};
props.push(subprop);
}
this.tableProps = props;
console.log('打印tableProps', this.tableProps)
},
/** 把 list 里的数据转换成 tableProps 对应的格式 */
convertList(list) {
this.list.splice(0);
let rowIndex = 0;
for (const line of list) {
const { productLine, specification, data } = line;
// span
this.spanInfo[rowIndex] = data.length;
for (const equipment of data) {
const { equipmentName, totalQuantity } = equipment;
let row = {
productLine,
specification: specification.join('、'),
equipmentName,
totalQuantity,
};
rowIndex += 1;
for (const [key, hourData] of Object.entries(equipment.hourData)) {
const { inQuantity, outQuantity, nokQuantity, scrapRatio } =
hourData;
row[key + '__in'] = inQuantity;
row[key + '__out'] = outQuantity;
row[key + '__nok'] = nokQuantity;
row[key + '__ratio'] = scrapRatio;
}
this.list.push(row);
}
}
},
buildData(data) {
this.convertList(data);
},
/** 合并table列的规则 */
mergeColumnHandler({ row, column, rowIndex, columnIndex }) {
if (columnIndex == 0 || columnIndex == 1) {
if (this.spanInfo[rowIndex]) {
return [
this.spanInfo[rowIndex], // row span
1, // col span
];
} else {
return [0, 0];
}
}
},
async getList() {
this.urlOptions.getDataListURL().then(res => {
console.log('看看数据', res)
})
// const { data } = await this.$axios({
// url: '/monitoring/equipment-monitor/recent-24-hours',
// method: 'get',
// });
// // const data = this.res.data;
// // console.log('recent-24', data);
// this.initing = true;
// this.buildProps(data[0]);
// this.buildData(data);
// this.queryParams.pageSize = this.list.length;
// setTimeout(() => {
// this.initing = false;
// }, 1000);
},
handleEmitFun(payload) {
console.log('payload', payload);
},
},
};
</script>
<style scoped lang="scss">
::-webkit-scrollbar {
display: none;
}
pre {
margin: 10px;
background: #f6f8faf6;
border: 1px solid #e1e4e8;
padding: 12px;
border-radius: 12px;
position: fixed;
// top: 15vh;
top: 10vh;
left: 0;
max-height: 80vh;
overflow-y: auto;
z-index: 100000;
box-shadow: 0 0 32px 12px #0001;
}
code {
font-family: 'IntelOne Mono', 'Ubuntu', 'Courier New', Courier, monospace;
}
</style>

View File

@ -1,7 +1,7 @@
<!-- <!--
* @Author: Do not edit * @Author: Do not edit
* @Date: 2023-08-29 14:59:29 * @Date: 2023-08-29 14:59:29
* @LastEditTime: 2023-08-31 15:31:40 * @LastEditTime: 2023-09-15 13:51:55
* @LastEditors: DY * @LastEditors: DY
* @Description: * @Description:
--> -->
@ -9,6 +9,7 @@
<div class="app-container"> <div class="app-container">
<search-bar <search-bar
:formConfigs="formConfig" :formConfigs="formConfig"
:isFold="true"
ref="searchBarForm" ref="searchBarForm"
@headBtnClick="buttonClick" /> @headBtnClick="buttonClick" />
<base-table <base-table
@ -38,68 +39,54 @@
<script> <script>
import { parseTime } from '../../mixins/code-filter'; import { parseTime } from '../../mixins/code-filter';
import { import { getWorkshopSectionList, getPdList, getSectionAutoReport } from '@/api/core/monitoring/sectionStatistics'
getFactoryPage,
exportFactoryExcel,
} from '@/api/core/base/factory';
const tableProps = [ const tableProps = [
{ {
prop: 'code', prop: 'reportType',
label: '产线类型', label: '产线类型'
align: 'center',
}, },
{ {
prop: 'createTime', prop: 'reportStartTime',
label: '统计开始时间', label: '统计开始时间',
align: 'center',
filter: parseTime, filter: parseTime,
}, },
{ {
prop: 'createTime3', prop: 'reportEndTime',
label: '统计结束时间', label: '统计结束时间',
align: 'center',
filter: parseTime, filter: parseTime,
}, },
{ {
prop: 'name', prop: 'lineName',
label: '产线名称', label: '产线名称'
align: 'center',
}, },
{ {
prop: 'name1', prop: 'sectionName',
label: '工段名称', label: '工段名称'
align: 'center',
}, },
{ {
prop: 'address', prop: 'inputNum',
label: '投入数量/片', label: '投入数量/片'
align: 'center',
}, },
{ {
prop: 'remark44', prop: 'outputNum',
label: '产出数量/片', label: '产出数量/片'
align: 'center',
}, },
{ {
prop: 'remark23', prop: 'outputArea',
label: '产出面积/㎡', label: '产出面积/㎡'
align: 'center',
}, },
{ {
prop: 'remark145', prop: 'lossNum',
label: '损耗数量/片', label: '损耗数量/片'
align: 'center',
}, },
{ {
prop: 'remark22', prop: 'lossArea',
label: '损耗面积/㎡', label: '损耗面积/㎡'
align: 'center',
}, },
{ {
prop: 'remark1', prop: 'lossRatio',
label: '损耗比例%', label: '损耗比例%'
align: 'center',
} }
]; ];
@ -107,14 +94,7 @@ export default {
data() { data() {
return { return {
urlOptions: { urlOptions: {
getDataListURL: getFactoryPage, getDataListURL: getSectionAutoReport
exportURL: exportFactoryExcel,
},
urlOptions: {
getDataListURL: '',
deleteURL: '',
statusUrl: '',
exportURL: ''
}, },
tableData: [], tableData: [],
listQuery: { listQuery: {
@ -145,8 +125,21 @@ export default {
{ {
type: 'select', type: 'select',
label: '报表类型', label: '报表类型',
selectOptions: [], selectOptions: [
param: 'name', {
id: 1,
name: '日'
},
{
id: 2,
name: '周'
},
{
id: 3,
name: '月'
}
],
param: 'reportType',
}, },
{ {
type: 'datePicker', type: 'datePicker',
@ -158,8 +151,7 @@ export default {
startPlaceholder: '开始时间', startPlaceholder: '开始时间',
endPlaceholder: '结束时间', endPlaceholder: '结束时间',
param: 'timeVal', param: 'timeVal',
defaultSelect: [], defaultSelect: []
width: 350
}, },
{ {
type: 'button', type: 'button',
@ -180,8 +172,20 @@ export default {
], ],
}; };
}, },
created() {}, created() {
this.getDataList()
this.getPdLineList()
},
methods: { methods: {
getPdLineList() {
getPdList().then((res) => {
this.formConfig[0].selectOptions = res.data || []
})
// list
getWorkshopSectionList().then((res) => {
this.formConfig[1].selectOptions = res.data || []
})
},
selectChange(val) { selectChange(val) {
console.log(val) console.log(val)
this.selectedList = val this.selectedList = val
@ -191,8 +195,11 @@ export default {
case 'search': case 'search':
this.listQuery.pageNo = 1; this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10; this.listQuery.pageSize = 10;
this.listQuery.name = val.name; this.listQuery.lineId = val.line ? val.line : undefined;
this.listQuery.code = val.code; this.listQuery.sectionId = val.section ? val.section : undefined;
this.listQuery.reportType = val.reportType ? val.reportType : undefined;
this.listQuery.reportStartTime = [new Date(val.timeVal[0]).getTime()];
this.listQuery.reportEndTime = [new Date(val.timeVal[1]).getTime()];
this.getDataList(); this.getDataList();
break; break;
case 'export': case 'export':
@ -206,7 +213,10 @@ export default {
getDataList() { getDataList() {
this.dataListLoading = true; this.dataListLoading = true;
this.urlOptions.getDataListURL(this.listQuery).then(response => { this.urlOptions.getDataListURL(this.listQuery).then(response => {
this.tableData = response.data.list; this.tableData = response.data.list.map(item => {
item.reportType = item.reportType === 1 ? '日' : item.reportType === 2 ? '周' : '月'
return item
});
this.total = response.data.total; this.total = response.data.total;
this.dataListLoading = false; this.dataListLoading = false;
}); });