Merge pull request 'projects/mes-zjl' (#384) from projects/mes-zjl into projects/mes-test

Reviewed-on: #384
This commit is contained in:
朱菊兰 2024-07-26 15:06:26 +08:00
commit e4c6154eb6
25 changed files with 1282 additions and 1127 deletions

View File

@ -13,10 +13,10 @@ 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.4.173:48080'
# VUE_APP_BASE_API = 'http://192.168.0.33:48082'
# VUE_APP_BASE_API = 'http://192.168.1.164:48082'
# VUE_APP_BASE_API = 'http://192.168.2.173:48080'
# VUE_APP_BASE_API = 'http://192.168.1.49:48082'
VUE_APP_BASE_API = 'http://192.168.1.81:48082'
# VUE_APP_BASE_API = 'http://192.168.1.8:48082'
# VUE_APP_BASE_API = 'http://192.168.4.159:48080'
# VUE_APP_BASE_API = 'http://192.168.1.56:48082'

View File

@ -25,3 +25,13 @@ export function exportEqAnalysisExcel(query) {
responseType: 'blob'
})
}
// 导出设备状态追溯
export function exportEfficiencyExcel(query) {
return request({
url: '/analysis/equipment-analysis/export-efficiency',
method: 'get',
params: query,
responseType: 'blob'
})
}

View File

@ -38,3 +38,11 @@ export function getInspectionData(query) {
params: query,
})
}
export function getRecordInOneDay(query) {
return request({
url: '/analysis/record-in-one-day/get',
method: 'get',
params: query,
})
}

View File

@ -1,218 +1,215 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick"
/>
<!-- 列表 -->
<base-table
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-props="tableProps"
:table-data="list"
:max-height="tableH"
>
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="80"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<pagination
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
:total="total"
@pagination="getList"
/>
<!-- 新增 -->
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="centervisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
>
<energy-plc-add ref="energyPlc" @successSubmit="successSubmit" />
</base-dialog>
</div>
<div class="app-container">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<!-- 列表 -->
<base-table
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-props="tableProps"
:table-data="list"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="80"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
:total="total"
@pagination="getList" />
<!-- 新增 -->
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="centervisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel">
<energy-plc-add ref="energyPlc" @successSubmit="successSubmit" />
</base-dialog>
</div>
</template>
<script>
import { getEnergyPlcPage, deleteEnergyPlc } from "@/api/base/energyPlc";
import { getEnergyPlcPage, deleteEnergyPlc } from '@/api/base/energyPlc';
// import { publicFormatter } from '@/utils/dict'
import EnergyPlcAdd from './components/energyPlcAdd.vue'
import EnergyPlcAdd from './components/energyPlcAdd.vue';
import tableHeightMixin from '@/mixins/tableHeightMixin';
const tableProps = [
{
prop: 'plcTableName',
label: '关联表名'
},
{
prop: 'code',
label: '关联表编码',
minWidth: 150,
showOverflowtooltip: true
},
{
prop: 'name',
label: '标识名'
},
{
prop: 'enName',
label: '英文标识名'
},
{
prop: 'collection',
label: '是否采集'
},
{
prop: 'description',
label: '描述',
showOverflowtooltip: true
}
]
{
prop: 'plcTableName',
label: '关联表名',
},
{
prop: 'code',
label: '关联表编码',
minWidth: 150,
showOverflowtooltip: true,
},
{
prop: 'name',
label: '标识名',
},
{
prop: 'enName',
label: '英文标识名',
},
{
prop: 'collection',
label: '是否采集',
},
{
prop: 'description',
label: '描述',
showOverflowtooltip: true,
},
];
export default {
name: "EnergyPlc",
components: { EnergyPlcAdd },
data() {
return {
formConfig: [
{
type: 'input',
label: '标识名',
placeholder: '标识名',
param: 'name'
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary'
},
{
type: 'separate'
},
{
type: this.$auth.hasPermi('base:energy-plc:create') ? 'button' : '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true
}
],
tableProps,
tableBtn: [
this.$auth.hasPermi('base:energy-plc:update')
? {
type: 'edit',
btnName: '编辑'
}
: undefined,
this.$auth.hasPermi('base:energy-plc:delete')
? {
type: 'delete',
btnName: '删除'
}
: undefined
].filter((v) => v),
tableH: this.tableHeight(260),
collectionList: [
{value: 0,label: '否'},
{value: 1,label: '是'}
],
//
total: 0,
//
list: [],
//
addOrEditTitle: "",
//
centervisible: false,
//
queryParams: {
pageNo: 1,
pageSize: 20,
name: null
}
};
},
created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260)
})
this.getList();
},
methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.queryParams.pageNo = 1;
this.queryParams.name = val.name
this.getList()
break
default:
this.addOrEditTitle = '新增'
this.centervisible = true
this.$nextTick(() => {
this.$refs.energyPlc.init()
})
}
},
/** 查询列表 */
getList() {
getEnergyPlcPage(this.queryParams).then(response => {
let arr = response.data.list || [];
arr&&arr.map(item => {
this.collectionList.map(i => {
if (item.collection === i.value) {
item.collection = i.label
}
})
})
this.list = arr
this.total = response.data.total;
});
},
handleClick(val) {
switch (val.type) {
case 'edit':
this.addOrEditTitle = '编辑'
this.$nextTick(() => {
this.$refs.energyPlc.init(val.data.id)
})
this.centervisible = true
break
default:
this.handleDelete(val.data)
}
},
handleCancel() {
this.$refs.energyPlc.formClear()
this.centervisible = false
this.addOrEditTitle = ''
},
handleConfirm() {
this.$refs.energyPlc.submitForm()
},
successSubmit() {
this.handleCancel()
this.getList()
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal.confirm('是否确认删除关联表名为"' + row.name + '"的数据项?').then(function() {
return deleteEnergyPlc(row.id);
}).then(() => {
this.queryParams.pageNo = 1;
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
}
name: 'EnergyPlc',
components: { EnergyPlcAdd },
mixins: [tableHeightMixin],
data() {
return {
formConfig: [
{
type: 'input',
label: '标识名',
placeholder: '标识名',
param: 'name',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: this.$auth.hasPermi('base:energy-plc:create') ? 'button' : '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true,
},
],
tableProps,
tableBtn: [
this.$auth.hasPermi('base:energy-plc:update')
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
this.$auth.hasPermi('base:energy-plc:delete')
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v) => v),
collectionList: [
{ value: 0, label: '否' },
{ value: 1, label: '是' },
],
//
total: 0,
//
list: [],
//
addOrEditTitle: '',
//
centervisible: false,
//
queryParams: {
pageNo: 1,
pageSize: 20,
name: null,
},
};
},
created() {
this.getList();
},
methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.queryParams.pageNo = 1;
this.queryParams.name = val.name;
this.getList();
break;
default:
this.addOrEditTitle = '新增';
this.centervisible = true;
this.$nextTick(() => {
this.$refs.energyPlc.init();
});
}
},
/** 查询列表 */
getList() {
getEnergyPlcPage(this.queryParams).then((response) => {
let arr = response.data.list || [];
arr &&
arr.map((item) => {
this.collectionList.map((i) => {
if (item.collection === i.value) {
item.collection = i.label;
}
});
});
this.list = arr;
this.total = response.data.total;
});
},
handleClick(val) {
switch (val.type) {
case 'edit':
this.addOrEditTitle = '编辑';
this.$nextTick(() => {
this.$refs.energyPlc.init(val.data.id);
});
this.centervisible = true;
break;
default:
this.handleDelete(val.data);
}
},
handleCancel() {
this.$refs.energyPlc.formClear();
this.centervisible = false;
this.addOrEditTitle = '';
},
handleConfirm() {
this.$refs.energyPlc.submitForm();
},
successSubmit() {
this.handleCancel();
this.getList();
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal
.delConfirm(row.name)
.then(function () {
return deleteEnergyPlc(row.id);
})
.then(() => {
this.queryParams.pageNo = 1;
this.getList();
this.$modal.msgSuccess('删除成功');
})
.catch(() => {});
},
},
};
</script>

View File

@ -307,7 +307,7 @@ export default {
handleDelete(row) {
const id = row.id;
this.$modal
.confirm('是否确认删除"' + row.sectionName + '"?')
.delConfirm(row.buttonId)
.then(function () {
return deleteQualityInspectionBoxBtn(id);
})

View File

@ -288,7 +288,7 @@ export default {
handleDelete(row) {
const id = row.id;
this.$modal
.confirm('是否确认删除检测信息"' + row.content + '"?')
.delConfirm(row.content)
.then(function () {
return deleteQualityInspectionDet(id);
})

View File

@ -273,7 +273,7 @@ export default {
handleDelete(row) {
const id = row.id;
this.$modal
.confirm('是否确认删除该质量检测类型?')
.delConfirm(row.name)
.then(function () {
return deleteQualityInspectionType(id);
})

View File

@ -0,0 +1,159 @@
/*
* @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.content)
} else if (val.type === "change") {
this.changeStatus(val.data.id)
} else {
this.otherMethods(val)
}
},
// 删除
deleteHandle(id,name) {
this.$modal
.delConfirm(name)
.then(() => {
this.urlOptions.deleteURL(id).then(({ data }) => {
this.getDataList();
this.$modal.msgSuccess('删除成功');
});
})
.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

@ -40,7 +40,7 @@
<script>
import AddOrUpdate from './add-or-updata';
import basicPage from '../../../core/mixins/basic-page';
import basicPage from './basic-page';
import { parseTime } from '../../../core/mixins/code-filter';
import {
getQualityScrapDetPage,

View File

@ -0,0 +1,159 @@
/*
* @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)
} else if (val.type === "change") {
this.changeStatus(val.data.id)
} else {
this.otherMethods(val)
}
},
// 删除
deleteHandle(id,name) {
this.$modal
.delConfirm(name)
.then(() => {
this.urlOptions.deleteURL(id).then(({ data }) => {
this.getDataList();
this.$modal.msgSuccess('删除成功');
});
})
.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

@ -40,7 +40,7 @@
<script>
import AddOrUpdate from './add-or-updata';
import basicPage from '../../../core/mixins/basic-page';
import basicPage from './basic-page';
import { parseTime } from '../../../core/mixins/code-filter';
import {
getQualityScrapTypePage,

View File

@ -0,0 +1,128 @@
<template>
<div
:id="'currentDataChart' + chartN"
style="width: 100%; height: 300px"></div>
</template>
<script>
import * as echarts from 'echarts';
import resize from '@/utils/chartMixins/resize';
export default {
name: 'BaseChart',
mixins: [resize],
data() {
return {
chartDom: '',
chart: '',
};
},
props: {
chartData: {
type: Array,
required: true,
default: () => {
return [];
},
},
lineName: {
type: Array,
required: true,
default: () => {
return [];
},
},
chartN: {
type: Number,
required: true,
default: () => {
return 0;
},
},
},
watch: {
chartData: function () {
this.getChart();
},
},
mounted() {
this.getChart();
},
methods: {
getChart() {
if (
this.chart !== null &&
this.chart !== '' &&
this.chart !== undefined
) {
this.chart.dispose(); // Dom
}
this.chartDom = document.getElementById('currentDataChart' + this.chartN);
this.chart = echarts.init(this.chartDom);
if (this.chartData.length === 0) {
return false;
}
console.log('chartData:', this.chartData);
console.log('lineName:', this.lineName);
let xData = this.chartData.map((item) => {
return item.inspectionContent;
});
console.log('xData:', xData);
let series = [];
this.lineName.map((item) => {
let obj = {
data: [],
type: 'bar',
stack: 'a',
barWidth: 20,
name: item.prop,
};
this.chartData.forEach((ele) => {
obj.data.push(ele[item.prop]);
});
series.push(obj);
});
console.log('series:', series);
var option = {
color: [
'#288AFF',
'#73DE93',
'#FFCE6A',
'#63BDFF',
'#7164FF',
'#FF6860',
'#FF9747',
'#B0EB42',
'#D680FF',
'#0043D2',
],
legend: {
itemWidth: 10,
itemHeight: 10,
textStyle: {
color: '#8c8c8c',
},
right: 0,
},
tooltip: {
trigger: 'axis',
},
grid: {
left: 20,
right: 0,
bottom: '3%',
containLabel: true,
},
xAxis: {
type: 'category',
data: xData,
},
yAxis: {
type: 'value',
},
series: series,
};
option && this.chart.setOption(option);
},
},
};
</script>

View File

@ -0,0 +1,232 @@
<template>
<div>
<base-table
:table-props="tableProps"
:page="1"
:limit="1000"
:table-data="list" />
<div class="orderBox" v-for="(item, index) in downList" :key="index">
<div class="title">
<span>工单{{ item.workOrderName }}</span>
<span>产品名称{{ item.productionName }}</span>
<span>规格{{ item.productionSize }}</span>
</div>
<div class="custom-tabs">
<el-tabs v-model="item.activeName" :stretch="true">
<el-tab-pane :label="'\u2002表格\u2002'" name="table"></el-tab-pane>
<el-tab-pane
:label="'\u3000图表\u3000'"
name="chart"
style="overflow: inherit"></el-tab-pane>
</el-tabs>
<!-- 列表 -->
<base-table
v-if="item.activeName === 'table'"
:table-props="item.tableProps"
:page="1"
:limit="1000"
:table-data="item.list"
:height="300" />
<baseChart
v-else
:chartN="index"
:chartData="item.list"
:lineName="item.downProps" />
</div>
</div>
</div>
</template>
<script>
import BaseChart from './baseChart.vue';
import { getInspectionData } from '@/api/monitoring/statisticalData';
export default {
name: 'CurrentTest',
components: { BaseChart },
computed: {
tableProps() {
return [
{
prop: 'workOrderName',
label: '工单名称',
showOverflowtooltip: true,
},
...this.dynamicProps,
{
prop: 'sumInput',
label: '上片总数',
},
{
prop: 'sumOutput',
label: '下片总数',
},
];
},
},
data() {
return {
dynamicProps: [],
list: [],
downList: [],
};
},
mounted() {
this.getList();
},
methods: {
/** 查询列表 */
async getList() {
const res = await getInspectionData();
// const res = {
// data: [],
// };
if (res.data && res.data.length > 0) {
this.dynamicProps = this.filterNameData(res.data[0].upPart.nameData);
this.list = this.filterData(res.data[0].upPart.data);
//
res.data.forEach((item) => {
let downProps = this.filterNameData(item.downPart[0].nameData);
console.log('downProps:', downProps);
let obj = this.downPartData(item.downPart[0].data, downProps);
obj.tableProps = [
{
prop: 'inspectionContent',
label: '检测内容',
showOverflowtooltip: true,
},
{
prop: 'sumInput',
label: '原片总数',
showOverflowtooltip: true,
},
...downProps,
{
prop: 'sumScrap',
label: '未通过检测总数',
},
{
prop: 'scrapRatio',
label: '报废比例',
},
];
this.downList.push(obj);
});
console.log(this.downList);
} else {
this.list = [];
this.dynamicProps = [];
}
},
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 = {};
console.log('innerData:', innerData);
this.dynamicProps.map((item) => {
keyValuePairs[item.prop] = '-';
});
innerData.forEach((d) => {
keyValuePairs[d.dynamicName] = d.dynamicValue;
});
return {
inspectionContent: item.inspectionContent,
workOrderName: item.workOrderName,
...keyValuePairs,
sumInput: item.sumInput,
sumOutput: item.sumOutput,
};
});
},
downPartData(data, downProps) {
let obj = {
workOrderName: '',
productionName: '',
productionSize: '',
activeName: 'table',
tableProps: [],
downProps: downProps,
list: [],
};
obj.workOrderName = data[0].workOrderName;
obj.productionName = data[0].productionName;
obj.productionSize = data[0].productionSize;
obj.list = data.map((item) => {
const { data: innerData } = item;
const keyValuePairs = {};
downProps.map((item) => {
keyValuePairs[item.prop] = '-';
});
innerData.map((d) => {
keyValuePairs[d.dynamicName] = d.dynamicValue;
});
return {
inspectionContent: item.inspectionContent,
sumInput: item.sumInput,
...keyValuePairs,
sumScrap: item.sumScrap,
scrapRatio: item.scrapRatio,
};
});
return obj;
},
},
};
</script>
<style scoped lang="scss">
.orderBox {
padding-top: 16px;
}
.title {
position: relative;
padding: 4px 0;
padding-left: 12px;
font-size: 14px;
color: #606266;
font-weight: 700;
margin-bottom: 12px;
&::before {
content: '';
position: absolute;
left: 0;
top: 6px;
height: 16px;
width: 4px;
border-radius: 1px;
background: #0b58ff;
}
span {
display: inline-block;
width: 300px;
}
}
: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

@ -1,270 +0,0 @@
<!--
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,86 @@
<template>
<base-table
:table-props="tableProps"
:table-data="list"
:max-height="tableH" />
</template>
<script>
import tableHeightMixin from '@/mixins/tableHeightMixin';
import { getRecordInOneDay } from '@/api/monitoring/statisticalData';
import moment from 'moment';
export default {
name: 'HourData',
mixins: [tableHeightMixin],
computed: {
tableProps() {
return [
{
prop: 'inspectionDetContent',
label: '检测内容',
},
...this.nameData,
];
},
},
data() {
return {
heightNum: 200,
nameData: [],
list: [],
};
},
mounted() {
this.getList();
},
methods: {
async getList() {
const res = await getRecordInOneDay();
if (res.data) {
this.nameData = this.filterNameData(res.data.nameData);
this.list = this.filterData(res.data.data);
} else {
this.nameData = [];
this.list = [];
}
},
filterNameData(nameData) {
let arr = [];
nameData.forEach((ele) => {
if (ele.tree === 1) {
arr.push({
prop: ele.id,
label: moment(ele.name).format('yyyy-MM-DD HH:mm:ss'),
});
}
});
nameData.forEach((ele) => {
arr.forEach((inner) => {
if (ele.parentId === inner.prop) {
inner.children = [
{
prop: ele.parentId + ele.name,
label: ele.name,
},
];
}
});
});
return arr;
},
filterData(data) {
let list = [];
data.forEach((ele) => {
let obj = {};
obj.inspectionDetContent = ele.inspectionDetContent;
ele.data.forEach((inner) => {
inner.children.forEach((item) => {
obj[item.parentId + item.dynamicName] = item.dynamicValue;
});
});
list.push(obj);
});
return list;
},
},
};
</script>

View File

@ -1,622 +1,88 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<!-- 列表 -->
<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">
<!-- 列表 -->
<div class="blue-title">产品名{{ productDetail.name }} 产品规格{{ productDetail.specifications }}</div>
<base-table class="base-table__margin" :table-props="productProps" :page="1" :limit="10" :table-data="list">
</base-table>
<div v-for="(item,index) in downProps" :key="index">
<div class="blue-title">工单名称:{{ list[index].workOrderName }}</div>
<base-table class="base-table__margin" :table-props="item" :page="1" :limit="10"
:table-data="downList[index]">
</base-table>
</div>
</el-tab-pane>
<el-tab-pane :label="'\u3000图形数据\u3000'" name="chart" style="overflow: inherit">
<SearchBar :formConfigs="searchBarFormConfig" ref="search-bar" @headBtnClick="handleSearchBarBtnClick" />
<div id="main" style="height: 500px;width: 1000px;"></div>
</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>
<div class="currentDataContainer">
<div class="topBox">
<el-menu
:default-active="activeName"
mode="horizontal"
@select="handleSelect">
<el-menu-item index="currentTest">当前检测数据</el-menu-item>
<el-menu-item index="24hour">24小时检测数据</el-menu-item>
</el-menu>
</div>
<div class="bottomBox">
<!-- 当前检测数据 -->
<div v-if="activeName === 'currentTest'">
<CurrentTest />
</div>
<!-- 24小时检测数据 -->
<div v-if="activeName === '24hour'">
<HourData />
</div>
</div>
</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 * as echarts from 'echarts';
// import basicPageMixin from '@/mixins/lb/basicPageMixin';
import CurrentTest from './currentTest.vue';
import HourData from './hourData.vue';
export default {
name: 'statisticalData',
// components: {
// DialogForm,
// },
// mixins: [basicPageMixin],
name: 'currentData',
data() {
return {
list: [],
dynamicProps: [],
downProps: [],
downList: [],
productDetail: {
name: null,
specifications:null,
},
activeName: 'table',
searchBarFormConfig: [
{
type: 'label',
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,
},
return {
activeName: 'currentTest',
};
},
created() {
// this.getProductLineList();
},
computed: {
productProps() {
return [
{
// width: 160,
prop: 'workOrderName',
label: '工单名称',
},
...this.dynamicProps,
{
// width: 128,
prop: 'sumInput',
label: '上片总数',
},
{
// width: 128,
prop: 'sumOutput',
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: {
handleTabClick() {
if (this.activeName === 'chart') {
var chartDom = document.getElementById('main');
var myChart = echarts.init(chartDom);
var option;
let arrXAxis = []
this.list.forEach((ele) => {
arrXAxis.push(ele.workOrderName)
})
this.downList.forEach((ele) => {
ele.forEach((item) => {
if (ele.length !==0 && item.productionline) {
arrXAxis.push('产线' + item.productionline)
}
})
})
let arrYAxis = []
this.list.forEach((ele) => {
// console.log(ele);
arrYAxis.push(ele.sumInput)
})
this.downList.forEach((ele) => {
ele.forEach((item) => {
console.log(item);
// if (ele.length !== 0 && item.productionline) {
arrYAxis.push(item.sumInput)
// }
})
})
// console.log(arrXAxis);
option = {
xAxis: {
type: 'category',
data: arrXAxis
},
yAxis: {
type: 'value'
},
series: [
{
data: arrYAxis,
type: 'bar',
showBackground: true,
barWidth: '20',
label: {
show: true,
position: 'top'
},
backgroundStyle: {
color: 'rgba(180, 180, 180, 0.2)'
}
}
]
};
option && myChart.setOption(option);
}
},
/** 获取搜索栏的产线列表 */
// 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;
//
this.downProps= []
const res = await getInspectionData(this.queryParams)
console.log(res);
this.productDetail.name = res.data[0].productName
this.productDetail.specifications = res.data[0].specifications
// this.productName = res.data[0].productName
this.dynamicProps = this.filterNameData(res.data[0].upPart.nameData)
console.log(this.dynamicProps)
this.list = this.filterData(res.data[0].upPart.data)
console.log(this.list)
res.data[0].downPart.forEach((ele) => {
// console.log(ele.data);
let arr = this.downFilterNameData(ele.nameData)
if (arr.length !== 0) {
let propArr = [{
// width: 160,
prop: 'inspectionContent',
label: '检测内容',
},
...arr,
{
// width: 128,
prop: 'sumInput',
label: '原片总数',
},
{
// width: 128,
prop: 'sumScrap',
label: '未通过检测总数',
},
{
// width: 128,
prop: 'scrapRatio',
label: '报废比例',
}]
this.downProps.push(propArr)
}
// this.downProps = []
})
res.data[0].downPart.forEach((ele) => {
// console.log(ele.data);
let arr =this.downFilterData(ele.data)
if (arr.length !== 0) {
this.downList.push(arr)
}
// this.downProps = []
})
// console.log(this.downList);
},
downFilterNameData(nameData) {
const ndSet = new Set();
nameData.forEach((nd) => {
ndSet.add(nd.name);
});
return Array.from(ndSet.values())
.sort()
.map((name) => ({
prop: name,
label: name,
}));
// })
},
downFilterData(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,
sumScrap: item.sumScrap
};
});
},
filterNameData(nameData) {
// console.log(upData);
// upData.forEach((ele) => {
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,
workOrderName: item.workOrderName,
...keyValuePairs,
sumInput: item.sumInput,
sumOutput: item.sumOutput,
};
});
},
/** 取消按钮 */
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(() => {});
// },
},
components: {
CurrentTest,
HourData,
},
methods: {
handleSelect(name) {
this.activeName = name;
},
},
};
</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;
}
}
.blue-title {
position: relative;
padding: 4px 0;
padding-left: 12px;
font-size: 14px;
color: #606266;
font-weight: 700;
margin-bottom: 12px;
&::before {
content: '';
position: absolute;
left: 0;
top: 6px;
height: 16px;
width: 4px;
border-radius: 1px;
background: #0b58ff;
}
.currentDataContainer {
width: 100%;
min-height: calc(100vh - 120px - 8px);
background: rgba(242, 244, 249, 1);
.topBox {
.el-menu {
background-color: #f2f4f9;
margin-bottom: 8px;
}
.el-menu.el-menu--horizontal {
border-bottom: none;
width: 100%;
.el-menu-item {
height: 48px;
line-height: 48px;
width: calc((100% / 2) - 4px);
border-radius: 8px;
background-color: #fff;
font-size: 16px;
font-weight: 500;
color: rgba(22, 22, 22, 0.65);
text-align: center;
}
:first-child {
margin-right: 8px;
}
.el-menu-item.is-active {
border-width: 4px;
color: #161616;
}
}
.el-tabs__active-bar {
display: none;
}
}
.bottomBox {
min-height: calc(100vh - 184px);
background: #fff;
padding: 16px;
border-radius: 8px;
}
}
</style>

View File

@ -231,7 +231,7 @@ export default {
searchBarFormConfig: [
{
type: 'select',
label: '工单',
label: '工单名称',
selectOptions: [],
labelField: 'name',
valueField: 'id',

View File

@ -78,6 +78,7 @@
import basicPageMixin from '@/mixins/lb/basicPageMixin';
import PieChart from './components/pieChart.vue';
import tableHeightMixin from '@/mixins/tableHeightMixin';
import { exportEfficiencyExcel } from '@/api/equipment/analysis/statistics.js';
export default {
name: 'EfficiencyAnalysis',
@ -200,6 +201,8 @@ export default {
param: 'workOrderId',
selectOptions: [],
filterable: true,
clearable: false,
defaultSelect: '',
},
{
// parent: 'dateFilterType',
@ -244,7 +247,6 @@ export default {
},
created() {
this.getWorkOrder();
this.getList();
},
methods: {
/** 准备工厂数据 */
@ -260,7 +262,16 @@ export default {
id: item.id,
};
});
this.searchBarFormConfig[0].defaultSelect =
this.searchBarFormConfig[0].selectOptions[0].id;
this.queryParams.workOrderId =
this.searchBarFormConfig[0].selectOptions[0].id;
} else {
this.searchBarFormConfig[0].selectOptions = [];
this.searchBarFormConfig[0].defaultSelect = '';
this.queryParams.workOrderId = '';
}
this.getList();
},
/** 查询列表 */
async getList() {
@ -274,16 +285,20 @@ export default {
this.list = data;
}
},
exportExcel() {
this.loading = true;
exportEfficiencyExcel({ ...this.queryParams }).then((res) => {
this.$download.excel(res, '设备状态追溯.xls');
this.loading = false;
});
},
handleSearchBarBtnClick({ btnName, ...payload }) {
console.log(btnName);
console.log(payload);
this.queryParams.workOrderId = payload.workOrderId || null;
this.queryParams.recordTime = payload.recordTime || undefined;
if (btnName == 'search') {
this.queryParams.workOrderId = payload.workOrderId || null;
this.queryParams.recordTime = payload.recordTime || undefined;
this.getList();
} else {
this.queryParams.recordTime = null;
this.exportExcel();
console.log('导出');
}
},

View File

@ -13,7 +13,7 @@
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
:total="total"
@pagination="getList" />
</div>
</template>
@ -101,19 +101,20 @@ export default {
listQuery: {
pageSize: 10,
pageNo: 1,
total: 0,
workOrderId: undefined,
startTime: undefined,
endTime: undefined,
},
total: 0,
formConfig: [
{
type: 'select',
label: '工单名称',
selectOptions: [],
labelField: 'name',
valueField: 'id',
param: 'workOrderId',
defaultSelect: '',
filterable: true,
clearable: false,
},
{
type: 'datePicker',
@ -153,14 +154,13 @@ export default {
// AddOrUpdate,
},
created() {
this.getList();
this.getDict();
},
methods: {
getList() {
getMaterialUseLogPage({ ...this.listQuery }).then((res) => {
this.list = res.data || [];
this.listQuery.total = res.data.total || 0;
this.total = res.data.total || 0;
});
},
getDict() {
@ -172,6 +172,11 @@ export default {
};
});
console.log(this.formConfig[0].selectOptions);
this.formConfig[0].defaultSelect =
this.formConfig[0].selectOptions[0].id || '';
this.listQuery.workOrderId =
this.formConfig[0].selectOptions[0].id || '';
this.getList();
});
},
handleExport() {
@ -179,12 +184,8 @@ export default {
let params = { ...this.listQuery };
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal
.confirm('是否确认导出所有数据项?')
.then(() => {
this.exportLoading = true;
return exportEnergyPlcExcel(params);
})
this.exportLoading = true;
exportEnergyPlcExcel(params)
.then((response) => {
this.$download.excel(response, '物料信息追溯 ');
this.exportLoading = false;

View File

@ -101,6 +101,9 @@ export default {
labelField: 'name',
valueField: 'id',
param: 'workOrderId',
clearable: false,
filterable: true,
defaultSelect: '',
},
{
type: 'button',
@ -112,7 +115,6 @@ export default {
};
},
created() {
this.getList();
this.getDict();
},
methods: {
@ -130,7 +132,11 @@ export default {
id: item.id,
};
});
console.log(this.formConfig[0].selectOptions);
this.formConfig[0].defaultSelect =
this.formConfig[0].selectOptions[0].id || '';
this.listQuery.workOrderId =
this.formConfig[0].selectOptions[0].id || '';
this.getList();
});
},
buttonClick(val) {

View File

@ -120,7 +120,7 @@ export default {
this.$auth.hasPermi('base:quality-inspection-record:update')
? {
type: 'edit',
btnName: '修改',
btnName: '编辑',
}
: undefined,
this.$auth.hasPermi('base:quality-inspection-record:delete')
@ -322,7 +322,7 @@ export default {
handleDelete(row) {
const id = row.id;
this.$modal
.confirm('是否确认删除"' + row.inspectionDetContent + '"?')
.delConfirm(row.inspectionDetContent)
.then(function () {
return deleteQualityInspectionRecord(id);
})

View File

@ -7,10 +7,10 @@
label-width="auto">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="工单" prop="workOrderId">
<el-form-item label="工单名称" prop="workOrderId">
<el-select
v-model="dataForm.workOrderId"
placeholder="请选择工单"
placeholder="请选择工单名称"
style="width: 100%"
:disabled="showDetail">
<el-option
@ -80,7 +80,7 @@
v-model="dataForm.logTime"
type="datetime"
label-format="yyyy-MM-dd HH:mm:ss"
value-format="yyyy-MM-dd HH:mm:ss"
value-format="timestamp"
style="width: 100%"
placeholder="选择日期"
:disabled="showDetail"></el-date-picker>

View File

@ -0,0 +1,159 @@
/*
* @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.detContent)
} else if (val.type === "change") {
this.changeStatus(val.data.id)
} else {
this.otherMethods(val)
}
},
// 删除
deleteHandle(id, detContent) {
this.$modal
.delConfirm(detContent)
.then(() => {
this.urlOptions.deleteURL(id).then(({ data }) => {
this.getDataList();
this.$modal.msgSuccess('删除成功');
});
})
.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

@ -54,7 +54,7 @@
<script>
import AddOrUpdate from './add-or-updata';
import basicPage from '../../core/mixins/basic-page';
import basicPage from './basic-page';
import { parseTime } from '../../core/mixins/code-filter';
import {
getQualityScrapLogPage,
@ -157,7 +157,7 @@ export default {
type: 'separate',
},
{
type: this.$auth.hasPermi('base:quality-scrap-det:create')
type: this.$auth.hasPermi('base:quality-scrap-log:create')
? 'button'
: '',
btnName: '新增',

View File

@ -410,7 +410,6 @@ export default {
handleDelete(row) {
this.$modal
.delConfirm(row.name)
.closeConfirm()
.then(function () {
return delDept(row.id);
})