projects/mes-lb #121

Merged
g7hoo merged 2 commits from projects/mes-lb into projects/mes-test 2023-11-28 15:53:20 +08:00
12 changed files with 760 additions and 275 deletions

View File

@ -16,7 +16,7 @@ VUE_APP_TITLE = MES系统
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.4.173:48080'
# VUE_APP_BASE_API = 'http://192.168.2.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.49:48082'
# VUE_APP_BASE_API = 'http://192.168.1.8: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.4.159:48080'
# VUE_APP_BASE_API = 'http://192.168.1.56:48082' # VUE_APP_BASE_API = 'http://192.168.1.56:48082'

View File

@ -0,0 +1,270 @@
<template>
<div class="app-container">
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<div v-if="tableData.length">
<el-tabs
v-model="activeName"
@tab-click="handleTabClick"
style="height: 100%">
<el-tab-pane :label="'\u2002数据列表\u2002'" name="table">
<!-- @emitFun="handleEmitFun"> -->
<base-table
v-if="mode == 'table'"
:span-method="mergeColumnHandler"
:page="1"
:limit="999"
:table-props="tableProps"
:table-data="tableData" />
</el-tab-pane>
<el-tab-pane :label="'\u3000产线平衡分析图\u3000'" name="graph">
<div class="graph" style="height: 100%">
<!-- graph -->
<!-- <Graph
v-if="list.length"
:equipment-list="list"
:render="renderKey" /> -->
<BalanceChart ref="lineChart" />
<div v-if="list.length == 0" class="no-data-bg"></div>
</div>
</el-tab-pane>
</el-tabs>
<!-- <SearchBar :formConfigs="[{ label: '产线平衡分析图', type: 'title' }]" /> -->
</div>
<div v-else class="no-data-bg"></div>
</div>
</template>
<script>
import { getCT } from '@/api/core/analysis/index';
import { getCorePLList } from '@/api/base/coreProductionLine';
import BalanceChart from '../balanceChart';
export default {
components: {
BalanceChart,
},
// mixins: [basicPage],
data() {
return {
urlOptions: {
getDataListURL: getCT,
},
activeName: 'table',
tableProps: [],
tableData: [],
listQuery: {
// time: ''
endTime: undefined,
lineId: undefined,
startTime: undefined,
},
timeList: [],
spanArr: [],
xData: [],
yData: [],
optionArrUrl: [getCorePLList],
formConfig: [
{
type: 'select',
label: '产线',
selectOptions: [],
param: 'lineIds',
defaultSelect: '',
multiple: false,
filterable: true,
},
{
type: 'datePicker',
label: '时间',
dateType: 'datetimerange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
width: 350,
param: 'time',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
],
};
},
created() {
this.getArr();
},
methods: {
handleTabClick(tab, event) {
if (tab.name == 'graph') this.renderKey = Math.random();
},
getArr() {
const params = {
page: 1,
limit: 500,
};
this.optionArrUrl.forEach((item, index) => {
item(params).then((response) => {
this.formConfig[index].selectOptions = response.data;
});
});
},
setRowSpan(arr) {
let count = 0;
arr.forEach((item, index) => {
if (index === 0) {
this.spanArr.push(1);
} else {
if (item === arr[index - 1]) {
this.spanArr[count] += 1;
this.spanArr.push(0);
} else {
count = index;
this.spanArr.push(1);
}
}
});
},
/** 合并table列的规则 */
mergeColumnHandler({ row, column, rowIndex, columnIndex }) {
if (columnIndex == 0) {
if (this.spanArr[rowIndex]) {
return [
this.spanArr[rowIndex], // row span
1, // col span
];
} else {
return [0, 0];
}
}
},
getData() {
// this.listQuery.lineId = '1672847052717821953'
// this.listQuery.startTime = '1693497600000';
// this.listQuery.endTime = '1693843200000';
this.urlOptions.getDataListURL(this.listQuery).then((res) => {
console.log(res);
let arr = [
{
prop: 'sectionName',
label: '工段',
align: 'center',
},
{
prop: 'equName',
label: '设备',
align: 'center',
},
];
let sectionArr = [];
res.data.data.forEach((ele, index) => {
let tempData = [];
let eqData = [];
let plData = [];
ele.data.forEach((item, index) => {
item.children.forEach((params) => {
if (params.dynamicName === '设备CT') {
tempData[item.dynamicName + '_eq'] = params.dynamicValue;
eqData[index] = params.dynamicValue;
} else {
tempData[item.dynamicName + '_pl'] = params.dynamicValue;
plData[index] = params.dynamicValue;
}
});
});
const equipment = {
name: ele.equName,
eqData: eqData,
plData: plData,
};
tempData['equName'] = ele.equName;
tempData['sectionName'] = ele.sectionName;
this.tableData.push(tempData);
const { sectionName } = tempData;
sectionArr.push(sectionName);
this.yData.push(equipment);
console.log('看看equ', this.yData);
});
this.setRowSpan(sectionArr);
res.data.nameData.forEach((item) => {
this.timeList.push(item.name);
});
const timeArray = Array.from(new Set(this.timeList));
for (const times of timeArray) {
if (times !== '设备CT' && times !== '产线CT') {
const subprop = {
label: times,
align: 'center',
children: [
{ prop: times + '_eq', label: '设备CT', align: 'center' },
{ prop: times + '_pl', label: '产线CT', align: 'center' },
],
};
arr.push(subprop);
this.xData.push(times);
}
}
this.tableProps = arr;
console.log('表格横坐标', this.xData, this.yData);
this.$nextTick(() => {
this.$refs.lineChart.initChart(this.xData, this.yData);
});
// this.total = response.data.total;
// this.dataListLoading = false;
});
},
buttonClick(val) {
// console.log(val)
switch (val.btnName) {
case 'search':
// this.listQuery.pageNo = 1;
// this.listQuery.pageSize = 10;
this.listQuery.lineId = val.lineIds;
this.listQuery.startTime = val.time
? String(new Date(val.time[0]).getTime())
: undefined;
this.listQuery.endTime = val.time
? String(new Date(val.time[1]).getTime())
: undefined;
if (val.time && val.lineIds) {
this.tableData = [];
this.xData = [];
this.yData = [];
this.tableProps = [];
this.spanArr = [];
this.timeList = [];
this.getData();
} else {
this.$message({
message: '请选择产线和时间',
type: 'warning',
});
}
break;
case 'reset':
this.$refs.searchBarForm.resetForm();
this.listQuery = {
pageSize: 10,
pageNo: 1,
total: 1,
};
this.getDataList();
break;
default:
console.log(val);
}
},
},
};
</script>

View File

@ -1,137 +1,231 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" /> <search-bar
<div v-if="tableData.length"> :formConfigs="formConfig"
<base-table v-loading="dataListLoading" :span-method="mergeColumnHandler" :table-props="tableProps" :table-data="tableData" /> ref="searchBarForm"
<SearchBar :formConfigs="[{ label: '产线平衡分析图', type: 'title' }]" /> @headBtnClick="handleSearchBarBtnClick" />
<BalanceChart ref="lineChart" />
</div> <!-- <div v-if="tableData.length"> -->
<div v-else class="no-data-bg"></div> <el-tabs
<!-- <pagination v-model="activeName"
:limit.sync="listQuery.pageSize" @tab-click="handleTabClick"
:page.sync="listQuery.pageNo" style="height: 100%">
:total="listQuery.total" <el-tab-pane :label="'\u2002数据列表\u2002'" name="table">
@pagination="getDataList" /> --> <!-- @emitFun="handleEmitFun"> -->
</div> <base-table
v-if="activeName == 'table'"
:span-method="mergeColumnHandler"
:page="1"
:limit="999"
:table-props="tableProps"
:table-data="tableData" />
</el-tab-pane>
<el-tab-pane :label="'\u3000产线平衡分析图\u3000'" name="graph">
<div class="graph" style="height: 100%">
<!-- graph -->
<!-- <Graph
v-if="list.length"
:equipment-list="list"
:render="renderKey" /> -->
<!-- <BalanceChart ref="lineChart" /> -->
<div v-if="list.length == 0" class="no-data-bg"></div>
</div>
</el-tab-pane>
</el-tabs>
<!-- <SearchBar :formConfigs="[{ label: '产线平衡分析图', type: 'title' }]" /> -->
<!-- </div>
<div v-else class="no-data-bg"></div> -->
</div>
</template> </template>
<script> <script>
// import basicPage from '../../mixins/basic-page'; import BalanceChart from '../balanceChart';
import { parseTime } from '../../mixins/code-filter'; import basicPageMixin from '@/mixins/lb/basicPageMixin';
import { getCT } from '@/api/core/analysis/index';
import { getCorePLList } from '@/api/base/coreProductionLine';
import BalanceChart from '../balanceChart'
import { time } from 'echarts';
// import { getWorkshopSectionPage } from '@/api/core/base/workshopSection';
// const tableProps = [
// // {
// // prop: 'lineName',
// // label: '线',
// // align: 'center',
// // },
// // {
// // prop: 'sum',
// // label: '',
// // align: 'center',
// // },
// // {
// // prop: 'dynamicValue',
// // label: 'dynamicName',
// // align: 'center',
// // children:[
// // ]
// // }
// ];
export default { export default {
components: { components: {
BalanceChart BalanceChart,
}, },
// mixins: [basicPage], mixins: [basicPageMixin],
data() { data() {
return { return {
urlOptions: { activeName: 'table',
getDataListURL: getCT, tableProps: [
}, {
tableProps: [], prop: 'sectionName',
dataListLoading: false, label: '工段',
tableData: [], align: 'center',
listQuery: { },
// time: '' {
endTime: undefined, prop: 'equName',
lineId:undefined, label: '设备',
startTime:undefined align: 'center',
}, },
timeList: [], ],
spanArr: [], tableData: [],
xData: [], formConfig: [
yData: [], {
optionArrUrl: [getCorePLList], type: 'select',
formConfig: [ label: '产线',
{ selectOptions: [],
type: 'select', param: 'lineIds',
label: '产线', defaultSelect: '',
selectOptions: [], multiple: false,
param: 'lineIds', filterable: true,
defaultSelect: '', },
multiple: false, {
filterable: true, type: 'datePicker',
}, label: '时间',
{ dateType: 'monthrange',
type: 'datePicker', format: 'yyyy-MM',
label: '时间', valueFormat: 'yyyy-MM-ddTHH:mm:ss',
dateType: 'datetimerange', rangeSeparator: '-',
format: 'yyyy-MM-dd', startPlaceholder: '开始时间',
valueFormat: 'yyyy-MM-dd HH:mm:ss', endPlaceholder: '结束时间',
rangeSeparator: '-', width: 240,
startPlaceholder: '开始时间', param: 'timeArr',
endPlaceholder: '结束时间', },
width: 350, {
param: 'time', type: 'button',
}, btnName: '查询',
{ name: 'search',
type: 'button', color: 'primary',
btnName: '查询', },
name: 'search', ],
color: 'primary', queryParams: {
} lineId: null,
], startTime: null,
}; endTime: null,
}, },
created() { };
this.getArr(); },
},
methods: { mounted() {
getArr() { this.getLine();
const params = { },
page: 1,
limit: 500 methods: {
} handleTabClick(tab, event) {
this.optionArrUrl.forEach((item, index) => { if (tab.name == 'graph') this.renderKey = Math.random();
item(params).then((response) => { },
this.formConfig[index].selectOptions = response.data
}); /** 初始化 tableProps */
}); initTableProps() {
}, this.tableProps = [
setRowSpan(arr) { {
let count = 0 prop: 'sectionName',
arr.forEach((item, index) => { label: '工段',
if(index === 0) { align: 'center',
this.spanArr.push(1) },
} else { {
if (item === arr[index - 1]) { prop: 'equName',
this.spanArr[count] += 1 label: '设备',
this.spanArr.push(0) align: 'center',
} else { },
count = index ];
this.spanArr.push(1) },
}
} /** 获取产线 */
}) async getLine() {
}, this.formConfig[0].selectOptions = [];
/** 合并table列的规则 */ const { code, data } = await this.http(
'/base/core-production-line/listAll',
'get'
);
if (code == 0) {
this.formConfig[0].selectOptions = data;
}
},
/** 获取产线平衡数据 */
async getCT() {
const { code, data } = await this.http(
'/analysis/equipment-analysis/getCT',
'post',
this.queryParams
);
if (code == 0) {
return data;
}
return { data: [], nameData: [] };
},
/** 解析数据 */
async getList() {
const { data, nameData } = await this.getCT();
await this.buildProps(nameData);
await this.buildTableData(data);
const xxxx = this.tableData;
debugger;
},
buildProps(nameData) {
return new Promise((resolve, reject) => {
const dateArr = Array.from(
new Set(
nameData
.map((item) => (item.tree == 1 ? item.name : undefined))
.filter((v) => v)
)
);
//
dateArr.sort().forEach((date) => {
this.tableProps.push({
label: date,
align: 'center',
children: [
{
prop: date + '_eq_ct',
label: '设备CT',
align: 'center',
},
{
prop: date + '_eq_tt',
label: '设备TT',
align: 'center',
},
{
prop: date + '_pl_ct',
label: '产线CT',
align: 'center',
},
{
prop: date + '_pl_tt',
label: '产线TT',
align: 'center',
},
],
});
});
resolve();
});
},
async buildTableData(data) {
/** 处理 工段 分组 */
const sectionList = data.map(item => {})
},
setRowSpan(arr) {
let count = 0;
arr.forEach((item, index) => {
if (index === 0) {
this.spanArr.push(1);
} else {
if (item === arr[index - 1]) {
this.spanArr[count] += 1;
this.spanArr.push(0);
} else {
count = index;
this.spanArr.push(1);
}
}
});
},
/** 合并table列的规则 */
mergeColumnHandler({ row, column, rowIndex, columnIndex }) { mergeColumnHandler({ row, column, rowIndex, columnIndex }) {
if (columnIndex == 0) { if (columnIndex == 0) {
if (this.spanArr[rowIndex]) { if (this.spanArr[rowIndex]) {
@ -144,119 +238,142 @@ export default {
} }
} }
}, },
getData() {
// this.listQuery.lineId = '1672847052717821953'
// this.listQuery.startTime = '1693497600000';
// this.listQuery.endTime = '1693843200000';
this.urlOptions.getDataListURL(this.listQuery).then(res => {
console.log(res)
let arr = [
{
prop: 'sectionName',
label: '工段',
align: 'center',
},
{
prop: 'equName',
label: '设备',
align: 'center',
}
]
let sectionArr= []
res.data.data.forEach((ele, index) => {
let tempData = []
let eqData = []
let plData = []
ele.data.forEach((item, index) => {
item.children.forEach(params => {
if (params.dynamicName === '设备CT') {
tempData[item.dynamicName + '_eq'] = params.dynamicValue
eqData[index] = params.dynamicValue
} else {
tempData[item.dynamicName + '_pl'] = params.dynamicValue
plData[index] = params.dynamicValue
}
})
})
const equipment = {
name: ele.equName,
eqData: eqData,
plData: plData
}
tempData['equName'] = ele.equName
tempData['sectionName'] = ele.sectionName
this.tableData.push(tempData)
const { sectionName } = tempData
sectionArr.push(sectionName)
this.yData.push(equipment)
console.log('看看equ', this.yData)
})
this.setRowSpan(sectionArr)
res.data.nameData.forEach(item => {
this.timeList.push(item.name)
})
const timeArray = Array.from(new Set(this.timeList))
for (const times of timeArray) {
if (times !== '设备CT' && times !== '产线CT') {
const subprop = {
label: times,
align: 'center',
children: [
{ prop: times + '_eq', label: '设备CT', align: 'center' },
{ prop: times + '_pl', label: '产线CT', align: 'center' }
]
}
arr.push(subprop)
this.xData.push(times)
}
}
this.tableProps = arr
console.log('表格横坐标', this.xData, this.yData) getData() {
this.$nextTick(() => { // this.listQuery.lineId = '1672847052717821953'
this.$refs.lineChart.initChart(this.xData, this.yData) // this.listQuery.startTime = '1693497600000';
}) // this.listQuery.endTime = '1693843200000';
// this.total = response.data.total; this.urlOptions.getDataListURL(this.listQuery).then((res) => {
// this.dataListLoading = false; console.log(res);
}); let arr = [
}, {
buttonClick(val) { prop: 'sectionName',
// console.log(val) label: '工段',
switch (val.btnName) { align: 'center',
case 'search': },
// this.listQuery.pageNo = 1; {
// this.listQuery.pageSize = 10; prop: 'equName',
this.listQuery.lineId = val.lineIds label: '设备',
this.listQuery.startTime = val.time ? String(new Date(val.time[0]).getTime()) : undefined; align: 'center',
this.listQuery.endTime = val.time ? String(new Date(val.time[1]).getTime()) : undefined; },
if (val.time && val.lineIds) { ];
this.tableData = [] let sectionArr = [];
this.xData = [] res.data.data.forEach((ele, index) => {
this.yData = [] let tempData = [];
this.tableProps = [] let eqData = [];
this.spanArr = [] let plData = [];
this.timeList = [] ele.data.forEach((item, index) => {
this.getData() item.children.forEach((params) => {
} else { if (params.dynamicName === '设备CT') {
this.$message({ tempData[item.dynamicName + '_eq'] = params.dynamicValue;
message: '请选择产线和时间', eqData[index] = params.dynamicValue;
type: 'warning' } else {
}); tempData[item.dynamicName + '_pl'] = params.dynamicValue;
} plData[index] = params.dynamicValue;
break; }
case 'reset': });
this.$refs.searchBarForm.resetForm(); });
this.listQuery = { const equipment = {
pageSize: 10, name: ele.equName,
pageNo: 1, eqData: eqData,
total: 1, plData: plData,
}; };
this.getDataList(); tempData['equName'] = ele.equName;
break; tempData['sectionName'] = ele.sectionName;
default: this.tableData.push(tempData);
console.log(val); const { sectionName } = tempData;
} sectionArr.push(sectionName);
}, this.yData.push(equipment);
}, console.log('看看equ', this.yData);
});
this.setRowSpan(sectionArr);
res.data.nameData.forEach((item) => {
this.timeList.push(item.name);
});
const timeArray = Array.from(new Set(this.timeList));
for (const times of timeArray) {
if (times !== '设备CT' && times !== '产线CT') {
const subprop = {
label: times,
align: 'center',
children: [
{ prop: times + '_eq', label: '设备CT', align: 'center' },
{ prop: times + '_pl', label: '产线CT', align: 'center' },
],
};
arr.push(subprop);
this.xData.push(times);
}
}
this.tableProps = arr;
console.log('表格横坐标', this.xData, this.yData);
this.$nextTick(() => {
this.$refs.lineChart.initChart(this.xData, this.yData);
});
// this.total = response.data.total;
// this.dataListLoading = false;
});
},
handleSearchBarBtnClick(btn) {
switch (btn.btnName) {
case 'search':
this.queryParams.lineId = btn.lineIds || null;
this.queryParams.startTime = btn.timeArr ? btn.timeArr[0] : null;
this.queryParams.endTime = btn.timeArr ? btn.timeArr[1] : null;
if (!btn.lineIds || !btn.timeArr.length) {
this.$message({
message: '请选择产线和时间',
type: 'warning',
});
}
this.getList();
break;
}
},
buttonClick(val) {
// console.log(val)
switch (val.btnName) {
case 'search':
// this.listQuery.pageNo = 1;
// this.listQuery.pageSize = 10;
this.listQuery.lineId = val.lineIds;
this.listQuery.startTime = val.time
? String(new Date(val.time[0]).getTime())
: undefined;
this.listQuery.endTime = val.time
? String(new Date(val.time[1]).getTime())
: undefined;
if (val.time && val.lineIds) {
this.tableData = [];
this.xData = [];
this.yData = [];
this.tableProps = [];
this.spanArr = [];
this.timeList = [];
this.getData();
} else {
this.$message({
message: '请选择产线和时间',
type: 'warning',
});
}
break;
case 'reset':
this.$refs.searchBarForm.resetForm();
this.listQuery = {
pageSize: 10,
pageNo: 1,
total: 1,
};
this.getDataList();
break;
default:
console.log(val);
}
},
},
}; };
</script> </script>

View File

@ -54,13 +54,15 @@ export default {
alarmContent: null, alarmContent: null,
alarmValue: null, alarmValue: null,
// , alarmValue // , alarmValue
alarmCode: null,
equipmentCode: null
}, },
orderFormRows: [ orderFormRows: [
[ [
{ {
input: true, input: true,
label: '设备编码', label: '设备编码',
prop: 'equipment', prop: 'equipmentCode',
}, },
{ {
datetime: true, datetime: true,
@ -70,7 +72,7 @@ export default {
{ {
input: true, input: true,
label: '报警编号', label: '报警编号',
prop: 'alarmValue', prop: 'alarmCode',
}, },
{ {
input: true, input: true,

View File

@ -304,7 +304,7 @@ export default {
filter: publicFormatter('unit_dict'), filter: publicFormatter('unit_dict'),
}, },
{ {
prop: 'equipment_param_type', prop: 'equipmentParamType',
label: '设备参数类型', label: '设备参数类型',
filter: (val) => filter: (val) =>
val != null val != null
@ -312,7 +312,7 @@ export default {
: '-', : '-',
}, },
{ {
prop: 'production_param_type', prop: 'productionParamType',
label: '生产参数类型', label: '生产参数类型',
filter: (val) => filter: (val) =>
val != null val != null

View File

@ -61,7 +61,7 @@
关联表名 关联表名
</div> </div>
<div class="value" style="font-size: 14px"> <div class="value" style="font-size: 14px">
{{ form.plcTableName }} {{ form.plcName }}
</div> </div>
</el-col> </el-col>
</el-row> </el-row>
@ -73,9 +73,17 @@
class="title" class="title"
label="设备名" label="设备名"
style="font-size: 16px; margin: 8px 0"> style="font-size: 16px; margin: 8px 0">
<el-input <el-select
v-model="form.equipmentName" v-model="form.equipmentId"
placeholder="请输入设备名"></el-input> filterable
clearable
placeholder="请选择设备">
<el-option
v-for="eq in eqList"
:key="eq.id"
:label="eq.name"
:value="eq.id"></el-option>
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
@ -83,9 +91,17 @@
class="title" class="title"
label="设备关联表名" label="设备关联表名"
style="font-size: 16px; margin: 8px 0"> style="font-size: 16px; margin: 8px 0">
<el-input <el-select
v-model="form.plcTableName" v-model="form.plcId"
placeholder="请输入关联表名"></el-input> filterable
clearable
placeholder="请选择关联表">
<el-option
v-for="plc in plcList"
:key="plc.id"
:label="plc.name"
:value="plc.id"></el-option>
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-form> </el-form>
@ -202,6 +218,8 @@ export default {
total: 0, total: 0,
form: {}, form: {},
list: [], list: [],
eqList: [],
plcList: [],
attrTitle: '', attrTitle: '',
attrForm: { attrForm: {
id: null, id: null,
@ -257,7 +275,7 @@ export default {
{ {
select: true, select: true,
label: '设备参数类型', label: '设备参数类型',
prop: 'equipment_param_type', prop: 'equipmentParamType',
options: [ options: [
{ label: '一般参数', value: 1 }, { label: '一般参数', value: 1 },
{ label: '工艺参数', value: 2 }, { label: '工艺参数', value: 2 },
@ -274,7 +292,7 @@ export default {
{ {
select: true, select: true,
label: '生产参数类型', label: '生产参数类型',
prop: 'production_param_type', prop: 'productionParamType',
options: [ options: [
// { label: '', value: 1 }, // { label: '', value: 1 },
// { label: '', value: 2 }, // { label: '', value: 2 },
@ -380,6 +398,17 @@ export default {
mounted() { mounted() {
this.shouldRefreshPageView = false; this.shouldRefreshPageView = false;
this.mode = this.defaultMode || 'detail'; this.mode = this.defaultMode || 'detail';
if (this.mode != 'detail') {
this.$axios('/base/core-equipment/listAll').then(({ code, data }) => {
this.eqList = data;
});
this.$axios({
url: '/base/equipment-plc/page',
}).then(({ code, data }) => {
this.plcList = data.list;
});
}
for (const section of this.sections) { for (const section of this.sections) {
// //
if ('url' in section) { if ('url' in section) {
@ -479,6 +508,8 @@ export default {
defaultValue: '', defaultValue: '',
description: '', description: '',
remark: '', remark: '',
equipmentParamType: '',
productionParamType: '',
alarmContent: '', alarmContent: '',
}; };
this.attrTitle = '添加参数绑定信息'; this.attrTitle = '添加参数绑定信息';

View File

@ -17,6 +17,8 @@
<el-select <el-select
size="small" size="small"
placeholder="请选择产线" placeholder="请选择产线"
clearable
filterable
@change="getEquipmentByLineId" @change="getEquipmentByLineId"
v-model="form.productionLineId"> v-model="form.productionLineId">
<el-option <el-option
@ -30,6 +32,8 @@
<el-select <el-select
size="small" size="small"
placeholder="请选择设备" placeholder="请选择设备"
clearable
filterable
v-model="form.equipmentId"> v-model="form.equipmentId">
<el-option <el-option
v-for="item in listEq" v-for="item in listEq"

View File

@ -279,7 +279,7 @@ export default {
.then(async () => { .then(async () => {
const { code } = await this.http( const { code } = await this.http(
'/extend/process-flow/copy', '/extend/process-flow/copy',
'post', 'get',
{ {
id, id,
} }
@ -333,10 +333,11 @@ export default {
async getList() { async getList() {
this.loading = true; this.loading = true;
const { code, data } = await this.recv(this.queryParams); // const { code, data } = await this.recv(this.queryParams);
const { code, data } = await this.http('/extend/process-flow/listAll', 'get');
if (code == 0) { if (code == 0) {
this.list = data.list; this.list = data;
this.total = data.total; // this.total = data.total;
this.loading = false; this.loading = false;
return; return;
} }

View File

@ -28,7 +28,7 @@ export default {
// }, // },
props: { props: {
currentSelect: { currentSelect: {
type: String, type: String | Number,
default: null, default: null,
}, },
list: { list: {
@ -59,8 +59,16 @@ export default {
}, },
currentSelect: { currentSelect: {
handler(val) { handler(val) {
// val: string
this.selected = val; this.selected = val;
this.randomKey = Math.random(); this.randomKey = Math.random();
//
if (val) {
this.list__inner.forEach((item) => {
if (item.id == val) item.disabled = false;
else item.disabled = true;
});
}
}, },
immediate: true, immediate: true,
}, },

View File

@ -77,6 +77,17 @@
:bom-list="bomList" :bom-list="bomList"
:value="selectedBoms" :value="selectedBoms"
@update="selectedBoms = $event" /> @update="selectedBoms = $event" />
<el-row slot="footer">
<el-button size="small" @click="cancel">取消</el-button>
<el-button
type="primary"
size="small"
@click="submitForm"
:loading="btnLoading">
确定
</el-button>
</el-row>
</base-dialog> </base-dialog>
</section> </section>
</template> </template>
@ -95,6 +106,7 @@ export default {
}, },
data() { data() {
return { return {
btnLoading: false,
open: false, open: false,
eqList: [], eqList: [],
bomList: [], bomList: [],
@ -170,6 +182,7 @@ export default {
}); });
}, },
submitForm() { submitForm() {
this.btnLoading = true;
// //
this.$refs.bomSelector.commit(); this.$refs.bomSelector.commit();
// //
@ -187,11 +200,14 @@ export default {
if (code == 0) { if (code == 0) {
this.$message.success('操作成功'); this.$message.success('操作成功');
this.getList(this.currentDet); this.getList(this.currentDet);
this.btnLoading = false;
this.cancel(); this.cancel();
} else { } else {
this.btnLoading = false;
this.$message.error('操作失败'); this.$message.error('操作失败');
} }
} else { } else {
this.btnLoading = false;
this.$message.info('请选择设备'); this.$message.info('请选择设备');
} }
}); });

View File

@ -62,6 +62,16 @@
@cancel="cancel" @cancel="cancel"
@confirm="submitForm"> @confirm="submitForm">
<DialogForm v-if="open" ref="form" v-model="form" :rows="rows" /> <DialogForm v-if="open" ref="form" v-model="form" :rows="rows" />
<el-row slot="footer">
<el-button size="small" @click="cancel">取消</el-button>
<el-button
type="primary"
size="small"
@click="submitForm"
:loading="btnLoading">
确定
</el-button>
</el-row>
</base-dialog> </base-dialog>
</section> </section>
</template> </template>
@ -102,7 +112,9 @@ export default {
input: true, input: true,
label: '工序名称', label: '工序名称',
prop: 'name', prop: 'name',
rules: [{ required: true, message: '工序名称不能为空', trigger: 'blur' }], rules: [
{ required: true, message: '工序名称不能为空', trigger: 'blur' },
],
}, },
], ],
[ [
@ -111,7 +123,9 @@ export default {
label: '工段', label: '工段',
prop: 'sectionId', prop: 'sectionId',
url: '/base/core-workshop-section/listAll', url: '/base/core-workshop-section/listAll',
rules: [{ required: true, message: '工段不能为空', trigger: 'blur' }], rules: [
{ required: true, message: '工段不能为空', trigger: 'blur' },
],
bind: { bind: {
filterable: true, filterable: true,
}, },
@ -139,6 +153,7 @@ export default {
}, },
currentDet: null, currentDet: null,
currentNode: null, currentNode: null,
btnLoading: false
}; };
}, },
watch: { watch: {
@ -221,7 +236,7 @@ export default {
node.attr('container/stroke', '#0b58ff'); node.attr('container/stroke', '#0b58ff');
const { detId, detName, detDesc, processId, sectionId, sectionName } = const { detId, detName, detDesc, processId, sectionId, sectionName } =
node.attrs; node.attrs;
console.log('node clicked!', node) console.log('node clicked!', node);
this.currentDet = {}; this.currentDet = {};
this.$set(this.currentDet, 'detId', detId?.text); this.$set(this.currentDet, 'detId', detId?.text);
this.$set(this.currentDet, 'sectionId', sectionId?.text); this.$set(this.currentDet, 'sectionId', sectionId?.text);
@ -354,6 +369,7 @@ export default {
}, },
handleEdit() { handleEdit() {
console.log('edit: ', this.currentDet);
this.form.name = this.currentDet.detName; this.form.name = this.currentDet.detName;
this.form.sectionId = this.currentDet.sectionId; this.form.sectionId = this.currentDet.sectionId;
this.form.remark = this.currentDet.detDesc; this.form.remark = this.currentDet.detDesc;
@ -379,6 +395,7 @@ export default {
if (!valid) { if (!valid) {
return; return;
} }
this.btnLoading = true;
// //
if (this.form.id != null) { if (this.form.id != null) {
this.updateProcess() this.updateProcess()
@ -392,9 +409,20 @@ export default {
sectionName: { text: sectionName }, sectionName: { text: sectionName },
detDesc: { text: remark }, detDesc: { text: remark },
}); });
// currentDet
this.currentDet = {
...this.currentDet,
detName: name,
sectionId: sectionId,
sectionName: sectionName,
detDesc: remark,
};
this.btnLoading = false;
}); });
}) })
.catch((err) => {}); .catch((err) => {
this.btnLoading = false;
});
return; return;
} }
@ -412,11 +440,14 @@ export default {
.then((node) => { .then((node) => {
if (!node) { if (!node) {
this.$modal.msgError('创建节点失败'); this.$modal.msgError('创建节点失败');
this.btnLoading = false;
return; return;
} }
this.btnLoading = false;
this.graph.addNode(node); this.graph.addNode(node);
}) })
.catch((err) => { .catch((err) => {
this.btnLoading = false;
return; return;
}); });
}); });

View File

@ -21,12 +21,12 @@
</el-col> </el-col>
</el-row> </el-row>
<el-row :gutter="20" style="margin-top: 12px;"> <el-row :gutter="20" style="margin-top: 12px">
<el-col :span="6"> <el-col :span="6">
<!-- <InfoItem label="创建人" value="xxse" /> --> <!-- <InfoItem label="创建人" value="xxse" /> -->
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<InfoItem label="创建时间" :value="form.createTime" /> <InfoItem label="创建时间" :value="form.createTime" :time-format="true" />
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<!-- <InfoItem label="更新人" value="xxse" /> --> <!-- <InfoItem label="更新人" value="xxse" /> -->
@ -39,11 +39,12 @@
</template> </template>
<script> <script>
import moment from 'moment';
const InfoItem = { const InfoItem = {
name: 'InfoItem', name: 'InfoItem',
components: {}, components: {},
props: ['label', 'value'], props: ['label', 'value', 'timeFormat'],
data() { data() {
return {}; return {};
}, },
@ -52,9 +53,13 @@ const InfoItem = {
render: function (h) { render: function (h) {
return ( return (
<div style="display: flex; align-items: center; font-size: 14px; line-height: 1.5"> <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: 100px; text-align: left; font-weight: 700">
{this.label}:
</span>
<span style="width: 200px; text-align: left; text-overflow: ellipse; white-space: nowrap"> <span style="width: 200px; text-align: left; text-overflow: ellipse; white-space: nowrap">
{this.value} {this.timeFormat
? moment(this.value).format('YYYY-MM-DD HH:mm:ss')
: this.value}
</span> </span>
</div> </div>
); );
@ -77,12 +82,12 @@ export default {
createTime: null, createTime: null,
remark: null, remark: null,
enable: null, enable: null,
code: null code: null,
}, },
}; };
}, },
activated() { activated() {
this.getInfo() this.getInfo();
}, },
computed: {}, computed: {},
methods: { methods: {
@ -93,7 +98,7 @@ export default {
method, method,
params: method === 'get' ? payload : null, params: method === 'get' ? payload : null,
data: method !== 'get' ? payload : null, data: method !== 'get' ? payload : null,
}) });
}, },
put(payload) { put(payload) {
return this.http(this.updateUrl, 'put', payload); return this.http(this.updateUrl, 'put', payload);
@ -114,12 +119,12 @@ export default {
// debugger; // debugger;
if (code == 0) { if (code == 0) {
this.form = { this.form = {
...data ...data,
}; };
} else { } else {
this.$modal.msgError('工艺信息获取失败') this.$modal.msgError('工艺信息获取失败');
} }
} },
}, },
}; };
</script> </script>