Compare commits

..

No commits in common. "39d06cd902ff861ebd11e7dad669d2bfa766c901" and "265024d9892dda3cbc694fc56445360cd605206c" have entirely different histories.

18 changed files with 380 additions and 575 deletions

View File

@ -33,7 +33,6 @@ export default {
addUrl: '', addUrl: '',
pageUrl: '', pageUrl: '',
infoUrl: '', infoUrl: '',
deleteUrl: '',
basePath: '', basePath: '',
form: {} form: {}
}; };
@ -61,7 +60,7 @@ export default {
return this.$axios({ return this.$axios({
url, url,
method, method,
params: (method === 'get' || method === 'delete') ? payload : null, params: method === 'get' ? payload : null,
data: method !== 'get' ? payload : null, data: method !== 'get' ? payload : null,
}) })
}, },
@ -78,7 +77,6 @@ export default {
return this.http(this.infoUrl == '' ? this.infoPath : this.infoUrl, 'get', payload); return this.http(this.infoUrl == '' ? this.infoPath : this.infoUrl, 'get', payload);
}, },
del(payload) { del(payload) {
debugger;
return this.http(this.deleteUrl == '' ? this.deletePath : this.deleteUrl, 'delete', payload); return this.http(this.deleteUrl == '' ? this.deletePath : this.deleteUrl, 'delete', payload);
}, },

View File

@ -6,150 +6,131 @@
* @Description: * @Description:
--> -->
<template> <template>
<div class="balace-chart"> <div>
<div style="margin: 20px"> <div style="margin: 20px">
<el-button <el-button v-for="(item, index) in buttonList" :key="index" :class="[item.actived ? 'activeButton': 'normalButton']" @click="changeChart(index)">{{ item.name }}</el-button>
v-for="(item, index) in buttonList" </div>
:key="index" <div id="chart" ref="chartDiv" :class="className" :style="{height:height,width:width}" />
:class="[item.actived ? 'activeButton' : '']" </div>
@click="changeChart(index)">
{{ item.name }}
</el-button>
</div>
<div
id="chart"
ref="chartDiv"
:class="className"
:style="{ height: height, width: width }" />
</div>
</template> </template>
<script> <script>
import * as echarts from 'echarts'; import * as echarts from 'echarts'
require('echarts/theme/macarons'); // echarts theme require('echarts/theme/macarons') // echarts theme
// import resize from './mixins/resize' // import resize from './mixins/resize'
export default { export default {
// mixins: [resize], // mixins: [resize],
props: { props: {
className: { className: {
type: String, type: String,
default: 'chart', default: 'chart'
}, },
width: { width: {
type: String, type: String,
default: '100%', default: '100%'
}, },
height: { height: {
type: String, type: String,
default: '350px', default: '350px'
}, },
// autoResize: { // autoResize: {
// type: Boolean, // type: Boolean,
// default: true // default: true
// } // }
}, },
data() { data() {
return { return {
chart: null, chart: null,
dataArray: [], dataArray: [],
xDatas: [], xDatas: [],
buttonList: [], buttonList: []
}; }
}, },
mounted() { mounted() {
// this.initChart() // this.initChart()
this.$nextTick(() => { },
this.changeChart(0); methods: {
}); changeChart(index) {
}, this.setOptions(this.xDatas, this.dataArray[index])
methods: { this.buttonList.forEach((item, s) => {
changeChart(index) { if (index === s) {
this.setOptions(this.xDatas, this.dataArray[index]); // item.actived = true
this.buttonList.forEach((item, s) => { this.$nextTick(() =>{
if (index === s) { // item.actived = true
// item.actived = true this.$set(item, 'actived', true)
this.$nextTick(() => { })
// item.actived = true } else {
this.$set(item, 'actived', true); // item.actived = false
}); this.$nextTick(() =>{
} else { // item.actived = false
// item.actived = false this.$set(item, 'actived', false)
this.$nextTick(() => { })
// item.actived = false // this.$set(item, 'actived', false)
this.$set(item, 'actived', false); }
}); })
// this.$set(item, 'actived', false) console.log('看一下数22222据', this.dataArray)
} },
}); initChart(xData, yData, lineName) {
console.log('看一下数22222据', this.dataArray); this.dataArray = yData
}, this.buttonList = this.dataArray.map((item, index) => {
initChart(xData, yData, lineName) { return {
this.dataArray = yData; 'name': item.name,
this.buttonList = this.dataArray.map((item, index) => { 'actived': index === 0 ? true : false
return { }
name: item.name, })
actived: index === 0 ? true : false, console.log('看一下数据', this.dataArray)
}; this.xDatas = xData
}); this.chart = echarts.init(this.$refs.chartDiv, 'macarons')
console.log('看一下数据', this.dataArray); // this.chart = echarts.init(document.getElementById('chart'), 'macarons')
this.xDatas = xData; // this.setOptions(xData, yData[0], lineName)
this.chart = echarts.init(this.$refs.chartDiv, 'macarons'); },
// this.chart = echarts.init(document.getElementById('chart'), 'macarons') setOptions(xData, dataList, lineName) {
// this.setOptions(xData, yData[0], lineName) // let seriesData = []
}, // lineName.forEach((item,index) => {
setOptions(xData, dataList, lineName) { // seriesData.push({
// let seriesData = [] // name: item,
// lineName.forEach((item,index) => { // data: yData[index],
// seriesData.push({ // type: 'line',
// name: item, // })
// data: yData[index], // })
// type: 'line', this.chart.setOption({
// }) xAxis: {
// }) type: 'category',
this.chart.setOption({ data: xData
xAxis: { },
type: 'category', tooltip: {
data: xData, trigger: 'axis'
}, },
tooltip: { legend: {
trigger: 'axis', data:lineName
}, },
legend: { yAxis: {
data: lineName, type: 'value'
}, },
yAxis: { series: [
type: 'value', {
}, name: '设备CT',
series: [ data: dataList.eqData,
{ type: 'line',
name: '设备CT', },
data: dataList.eqData, {
type: 'line', name: '产线CT',
}, data: dataList.plData,
{ type: 'line',
name: '产线CT', }
data: dataList.plData, ]
type: 'line', })
}, }
], }
}); }
},
},
};
</script> </script>
<style scoped> <style scoped>
.balace-chart >>> .el-button { .activeButton {
background: #e3e3e3; background-color: rgb(93,159,255);
color: #333; }
transition: all 0.3s; .normalButton {
border: none; background-color: none;
&.activeButton,
&:hover {
background: #0b58ff;
color: #fff;
}
} }
</style> </style>

View File

@ -28,96 +28,59 @@
<script> <script>
import basicPage from '../../../core/mixins/basic-page'; import basicPage from '../../../core/mixins/basic-page';
import moment from 'moment'; import { parseTime } from '../../../core/mixins/code-filter';
import { import {
getEqAnalysis, getEqAnalysis,
exportEqAnalysisExcel, exportEqAnalysisExcel
} from '@/api/equipment/analysis/statistics'; } from '@/api/equipment/analysis/statistics';
const tableProps = [ const tableProps = [
{ {
prop: 'recordTime', prop: 'recordTime',
label: '时间段', label: '时间段',
filter: (val) => { filter: parseTime
if (val && val.length > 0) {
return (
moment(val[0]).format('YYYY-MM-DD HH:mm:ss') +
' ~ ' +
moment(val[1]).format('YYYY-MM-DD HH:mm:ss')
);
}
return '-';
},
}, },
{ {
prop: 'lineName', prop: 'lineName',
label: '产线', label: '产线'
}, },
{ {
prop: 'sectionName', prop: 'sectionName',
label: '工段', label: '工段'
}, },
{ {
prop: 'equipmentName', prop: 'equipmentName',
label: '设备名称', label: '设备名称'
}, },
{ {
prop: 'equipmentType', prop: 'equipmentType',
label: '设备类型', label: '设备类型'
}, },
{ {
prop: 'workTime', prop: 'workTime',
label: '工作时间累积(h)', label: '工作时间累积(h)'
}, },
{ {
prop: 'repairCount', prop: 'repairCount',
label: '维修次数', label: '维修次数'
}, },
{ {
prop: 'maintainCount', prop: 'maintainCount',
label: '保养次数', label: '保养次数'
}, }
]; ];
export default { export default {
mixins: [basicPage], mixins: [basicPage],
data() { data() {
const today = new Date();
const todayStart = new Date(
today.getFullYear(),
today.getMonth(),
today.getDate(),
0,
0,
0
);
const todayEnd = new Date(
today.getFullYear(),
today.getMonth(),
today.getDate(),
23,
59,
59
);
return { return {
urlOptions: { urlOptions: {
getDataListURL: getEqAnalysis, getDataListURL: getEqAnalysis,
exportURL: exportEqAnalysisExcel, exportURL: exportEqAnalysisExcel,
}, },
tableProps, tableProps,
tableBtn: [].filter((v) => v), tableBtn: [].filter((v)=>v),
tableData: [], tableData: [],
listQuery: {
pageSize: 10,
pageNo: 1,
total: 1,
recordTime: [
moment(todayStart).format('YYYY-MM-DD HH:mm:ss'),
moment(todayEnd).format('YYYY-MM-DD HH:mm:ss'),
],
},
formConfig: [ formConfig: [
{ {
type: 'input', type: 'input',
@ -138,10 +101,7 @@ export default {
endPlaceholder: '结束日期', endPlaceholder: '结束日期',
defaultTime: ['00:00:00', '23:59:59'], defaultTime: ['00:00:00', '23:59:59'],
param: 'recordTime', param: 'recordTime',
defaultSelect: [ defaultSelect: [],
moment(todayStart).format('YYYY-MM-DD HH:mm:ss'),
moment(todayEnd).format('YYYY-MM-DD HH:mm:ss'),
],
}, },
{ {
type: 'button', type: 'button',
@ -153,38 +113,33 @@ export default {
type: 'separate', type: 'separate',
}, },
{ {
type: this.$auth.hasPermi('equipment:analysis-statistics:export') type: this.$auth.hasPermi('equipment:analysis-statistics:export') ? 'button' : '',
? 'button'
: '',
btnName: '导出', btnName: '导出',
name: 'export', name: 'export',
color: 'warning', color: 'warning',
plain: true, plain: true
}, },
], ],
}; };
}, },
created() {}, created() {},
mounted() {},
methods: { methods: {
// //
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;
this.listQuery.total = response.data.total; this.listQuery.total = response.data.total;
this.dataListLoading = false; this.dataListLoading = false;
}); });
}, },
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.equipmentName = val.name ? val.name : undefined; this.listQuery.equipmentName = val.name ? val.name : undefined;
this.listQuery.recordTime = val.recordTime this.listQuery.recordTime = val.recordTime ? val.recordTime : undefined;
? val.recordTime
: undefined;
this.getDataList(); this.getDataList();
break; break;
case 'reset': case 'reset':
@ -203,24 +158,20 @@ export default {
console.log(val); console.log(val);
} }
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
// //
let params = { ...this.listQuery }; let params = { ...this.listQuery };
params.pageNo = undefined; params.pageNo = undefined;
params.pageSize = undefined; params.pageSize = undefined;
this.$modal this.$modal.confirm('是否确认导出所有数据项?').then(() => {
.confirm('是否确认导出所有数据项?') this.exportLoading = true;
.then(() => { return this.urlOptions.exportURL(params);
this.exportLoading = true; }).then(response => {
return this.urlOptions.exportURL(params); this.$download.excel(response, '设备统计分析.xls');
}) this.exportLoading = false;
.then((response) => { }).catch(() => { });
this.$download.excel(response, '设备统计分析.xls'); }
this.exportLoading = false;
})
.catch(() => {});
},
}, },
}; };
</script> </script>

View File

@ -237,7 +237,6 @@ export default {
label: '工厂', label: '工厂',
placeholder: '请选择工厂', placeholder: '请选择工厂',
param: 'factoryId', param: 'factoryId',
filterable: true,
selectOptions: [], selectOptions: [],
}, },
{ {
@ -245,7 +244,6 @@ export default {
label: '产线', label: '产线',
placeholder: '请选择产线', placeholder: '请选择产线',
param: 'lineId', param: 'lineId',
filterable: true,
selectOptions: [], selectOptions: [],
}, },
// //

View File

@ -310,7 +310,7 @@ export default {
this.$modal this.$modal
.confirm('是否确认删除记录"' + row.name + '"?') .confirm('是否确认删除记录"' + row.name + '"?')
.then(function () { .then(function () {
return this.del({ id }); return this.delete({ id });
}) })
.then(() => { .then(() => {
this.getList(); this.getList();

View File

@ -198,23 +198,26 @@ export default {
prop: 'createTime', prop: 'createTime',
label: '添加时间', label: '添加时间',
fixed: true, fixed: true,
width: 180,
filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'), filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
}, },
{ prop: 'code', label: '报警编码' }, { width: 240, prop: 'code', label: '报警编码' },
{ {
width: 100,
prop: 'type', prop: 'type',
label: '报警类型', label: '报警类型',
filter: (val) => filter: (val) =>
val != null ? ['-', '字符型', '布尔型', '-'][val] : '-', val != null ? ['-', '字符型', '布尔型', '-'][val] : '-',
}, },
{ {
width: 90,
prop: 'grade', prop: 'grade',
label: '报警级别', label: '报警级别',
filter: publicFormatter(this.DICT_TYPE.EQU_ALARM_LEVEL), filter: publicFormatter(this.DICT_TYPE.EQU_ALARM_LEVEL),
}, },
{ prop: 'alarmCode', label: '设备报警编码' }, { width: 180, prop: 'alarmCode', label: '设备报警编码' },
{ prop: 'plcParamName', label: '参数列名' }, { width: 128, prop: 'plcParamName', label: '参数列名' },
{ prop: 'alarmContent', label: '报警内容' }, { width: 128, prop: 'alarmContent', label: '报警内容' },
], ],
alarmForm: { alarmForm: {
id: undefined, id: undefined,

View File

@ -52,7 +52,7 @@
import moment from 'moment'; import moment from 'moment';
import basicPageMixin from '@/mixins/lb/basicPageMixin'; import basicPageMixin from '@/mixins/lb/basicPageMixin';
import { publicFormatter } from '@/utils/dict'; import { publicFormatter } from '@/utils/dict';
import { deleteCheck } from '@/api/equipment/base/inspection/settings'; import { deleteCheck } from "@/api/equipment/base/inspection/settings";
const timeFilter = (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'); const timeFilter = (val) => moment(val).format('yyyy-MM-DD HH:mm:ss');
@ -128,21 +128,15 @@ export default {
label: '巡检内容编号', label: '巡检内容编号',
prop: 'code', prop: 'code',
url: '/base/equipment-check/getCode', url: '/base/equipment-check/getCode',
rules: [ rules: [{ required: true, message: '巡检内容编号不能为空', trigger: 'blur' }],
{
required: true,
message: '巡检内容编号不能为空',
trigger: 'blur',
},
],
}, },
],
[
{ {
input: true, input: true,
label: '巡检项目', label: '巡检项目',
prop: 'program', prop: 'program',
rules: [ rules: [{ required: true, message: '巡检项目不能为空', trigger: 'blur' }],
{ required: true, message: '巡检项目不能为空', trigger: 'blur' },
],
}, },
], ],
[ [
@ -150,10 +144,10 @@ export default {
input: true, input: true,
label: '巡检内容', label: '巡检内容',
prop: 'content', prop: 'content',
rules: [ rules: [{ required: true, message: '巡检内容不能为空', trigger: 'blur' }],
{ required: true, message: '巡检内容不能为空', trigger: 'blur' },
],
}, },
],
[
{ {
input: true, input: true,
label: '备注', label: '备注',
@ -174,7 +168,7 @@ export default {
code: '', code: '',
program: '', program: '',
id: undefined, id: undefined,
content: '', content: ''
}, },
basePath: '/base/equipment-check', basePath: '/base/equipment-check',
mode: null, mode: null,
@ -277,10 +271,10 @@ export default {
handleDelete(row) { handleDelete(row) {
const id = row.id; const id = row.id;
this.$modal this.$modal
.confirm('是否确认删除巡检项目?') .confirm('是否确认删除巡检项目名称为"' + row.program + '"的数据项?')
.then(function () { .then(function () {
// return this.del({ id }); // return this.delete({ id });
return deleteCheck(id); return deleteCheck(id)
}) })
.then(() => { .then(() => {
this.getList(); this.getList();

View File

@ -105,7 +105,6 @@ export default {
label: '设备', label: '设备',
placeholder: '请选择设备', placeholder: '请选择设备',
param: 'equipmentId', param: 'equipmentId',
filterable: true
}, },
// //
{ {

View File

@ -54,6 +54,7 @@
</template> </template>
<script> <script>
import moment from 'moment';
import basicPageMixin from '@/mixins/lb/basicPageMixin'; import basicPageMixin from '@/mixins/lb/basicPageMixin';
import addOrUpdata from './add-or-updata.vue'; import addOrUpdata from './add-or-updata.vue';
// import { publicFormatter } from '@/utils/dict'; // import { publicFormatter } from '@/utils/dict';
@ -100,9 +101,9 @@ export default {
{ prop: 'lineName', label: '产线' }, { prop: 'lineName', label: '产线' },
{ prop: 'sectionName', label: '工段' }, { prop: 'sectionName', label: '工段' },
{ prop: 'equipmentName', label: '设备' }, { prop: 'equipmentName', label: '设备' },
{ prop: 'equipmentCode', label: '设备编码' },
{ prop: 'responsible', label: '负责人' }, { prop: 'responsible', label: '负责人' },
{ prop: 'checkNumber', label: '巡检条数' }, // TODO: { prop: 'equipmentCode', label: '描述' },
{ prop: 'checkNumber', label: '巡检条数' } // TODO:
], ],
searchBarFormConfig: [ searchBarFormConfig: [
{ {
@ -150,18 +151,14 @@ export default {
input: true, input: true,
label: '配置名称', label: '配置名称',
prop: 'name', prop: 'name',
rules: [ rules: [{ required: true, message: '配置名称不能为空', trigger: 'blur' }],
{ required: true, message: '配置名称不能为空', trigger: 'blur' },
],
}, },
{ {
input: true, input: true,
label: '配置编码', label: '配置编码',
prop: 'code', prop: 'code',
url: '/base/equipment-check-config/getCode', url: '/base/equipment-check-config/getCode',
rules: [ rules: [{ required: true, message: '配置编码不能为空', trigger: 'blur' }],
{ required: true, message: '配置编码不能为空', trigger: 'blur' },
],
}, },
], ],
[ [
@ -170,9 +167,7 @@ export default {
label: '设备名称', label: '设备名称',
prop: 'equipmentId', prop: 'equipmentId',
url: '/base/core-equipment/listAll', url: '/base/core-equipment/listAll',
rules: [ rules: [{ required: true, message: '设备名称不能为空', trigger: 'blur' }],
{ required: true, message: '设备名称不能为空', trigger: 'blur' },
],
}, },
{ {
input: true, input: true,
@ -293,9 +288,9 @@ export default {
handleDelete(row) { handleDelete(row) {
const id = row.id; const id = row.id;
this.$modal this.$modal
.confirm('是否确认删除该巡检记录?') .confirm('是否确认删除记录"' + row.name + '"?')
.then(() => { .then(function () {
return this.del({ id }); return this.delete({ id });
}) })
.then(() => { .then(() => {
this.getList(); this.getList();
@ -322,14 +317,14 @@ export default {
}, },
handleDetail({ id }) { handleDetail({ id }) {
this.addOrUpdateVisible = true; this.addOrUpdateVisible = true;
this.addOrEditTitle = '详情'; this.addOrEditTitle = "详情";
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.addOrUpdate.init(id, true); this.$refs.addOrUpdate.init(id, true);
}); });
}, },
handleAddDetail({ id }) { handleAddDetail({ id }) {
this.addOrUpdateVisible = true; this.addOrUpdateVisible = true;
this.addOrEditTitle = '添加巡检'; this.addOrEditTitle = "添加巡检";
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.addOrUpdate.init(id); this.$refs.addOrUpdate.init(id);
}); });

View File

@ -106,37 +106,37 @@ export default {
param: 'equipmentName', param: 'equipmentName',
}, },
// //
// { {
// type: 'datePicker', type: 'datePicker',
// label: '', label: '时间段',
// dateType: 'daterange', // datetimerange dateType: 'daterange', // datetimerange
// format: 'yyyy-MM-dd', format: 'yyyy-MM-dd',
// valueFormat: 'yyyy-MM-dd HH:mm:ss', valueFormat: 'yyyy-MM-dd HH:mm:ss',
// // valueFormat: 'timestamp', // valueFormat: 'timestamp',
// rangeSeparator: '-', rangeSeparator: '-',
// startPlaceholder: '', startPlaceholder: '开始日期',
// endPlaceholder: '', endPlaceholder: '结束日期',
// defaultTime: ['00:00:00', '23:59:59'], defaultTime: ['00:00:00', '23:59:59'],
// param: 'createTime', param: 'createTime',
// // defaultSelect: [ // defaultSelect: [
// // new Date(y, m, d) // new Date(y, m, d)
// // .toLocaleString() // .toLocaleString()
// // .split('/') // .split('/')
// // .map((item, index) => { // .map((item, index) => {
// // if (index == 1 || index == 2) return item.padStart(2, '0'); // if (index == 1 || index == 2) return item.padStart(2, '0');
// // return item; // return item;
// // }) // })
// // .join('-'), // .join('-'),
// // new Date(y, m, d, 23, 59, 59) // new Date(y, m, d, 23, 59, 59)
// // .toLocaleString() // .toLocaleString()
// // .split('/') // .split('/')
// // .map((item, index) => { // .map((item, index) => {
// // if (index == 1 || index == 2) return item.padStart(2, '0'); // if (index == 1 || index == 2) return item.padStart(2, '0');
// // return item; // return item;
// // }) // })
// // .join('-'), // .join('-'),
// // ], // ],
// }, },
{ {
type: 'button', type: 'button',
btnName: '查询', btnName: '查询',

View File

@ -121,14 +121,14 @@ export default {
}, },
{ {
type: 'select', type: 'select',
label: '计划名称', label: '保养计划',
placeholder: '请选择计划名称', placeholder: '请选择保养计划',
param: 'maintainPlanId', param: 'maintainPlanId',
}, },
// //
{ {
type: 'datePicker', type: 'datePicker',
label: '保养开始时间', label: '时间',
dateType: 'daterange', // datetimerange dateType: 'daterange', // datetimerange
format: 'yyyy-MM-dd', format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss', valueFormat: 'yyyy-MM-dd HH:mm:ss',

View File

@ -129,7 +129,6 @@ export default {
label: '设备', label: '设备',
placeholder: '请选择设备', placeholder: '请选择设备',
param: 'equipmentId', param: 'equipmentId',
filterable: true,
}, },
{ {
type: 'select', type: 'select',

View File

@ -52,7 +52,7 @@
import moment from 'moment'; import moment from 'moment';
import basicPageMixin from '@/mixins/lb/basicPageMixin'; import basicPageMixin from '@/mixins/lb/basicPageMixin';
import { publicFormatter } from '@/utils/dict'; import { publicFormatter } from '@/utils/dict';
import { deleteSparePart } from '@/api/equipment/base/spare-parts/list'; import { deleteSparePart } from '@/api/equipment/base/spare-parts/list'
const timeFilter = (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'); const timeFilter = (val) => moment(val).format('yyyy-MM-DD HH:mm:ss');
@ -95,7 +95,7 @@ export default {
searchBarFormConfig: [ searchBarFormConfig: [
{ {
type: 'input', type: 'input',
label: '备件名称', label: '关键字',
placeholder: '请输入备件名称', placeholder: '请输入备件名称',
param: 'name', param: 'name',
}, },
@ -132,33 +132,20 @@ export default {
input: true, input: true,
label: '备件名称', label: '备件名称',
prop: 'name', prop: 'name',
rules: [ rules: [{ required: true, message: '备件名称不能为空', trigger: 'blur' }],
{ required: true, message: '备件名称不能为空', trigger: 'blur' },
],
}, },
{
input: true,
label: '备件编码',
prop: 'code',
url: '/base/equipment-spare-part/getCode',
rules: [
{ required: true, message: '备件编码不能为空', trigger: 'blur' },
],
},
],
[
{ {
input: true, input: true,
label: '备件型号', label: '备件型号',
prop: 'model', prop: 'model',
}, },
],
[
{ {
input: true, input: true,
label: '规格', label: '规格',
prop: 'specifications', prop: 'specifications',
}, },
],
[
{ {
select: true, select: true,
label: '供应商', label: '供应商',
@ -168,10 +155,10 @@ export default {
filterable: true, filterable: true,
clearable: true, clearable: true,
}, },
rules: [ rules: [{ required: true, message: '供应商不能为空', trigger: 'blur' }],
{ required: true, message: '供应商不能为空', trigger: 'blur' },
],
}, },
],
[
{ {
select: true, select: true,
label: '物料类型', label: '物料类型',
@ -182,12 +169,8 @@ export default {
filterable: true, filterable: true,
clearable: true, clearable: true,
}, },
rules: [ rules: [{ required: true, message: '物料类型不能为空', trigger: 'blur' }],
{ required: true, message: '物料类型不能为空', trigger: 'blur' },
],
}, },
],
[
{ {
input: true, input: true,
label: '使用寿命', label: '使用寿命',
@ -201,14 +184,14 @@ export default {
}, },
], ],
}, },
],
[
{ {
select: true, select: true,
label: '单位', label: '单位',
prop: 'unit', // prop: 'unit', //
options: this.getDictDatas(this.DICT_TYPE.UNIT_DICT), options: this.getDictDatas(this.DICT_TYPE.UNIT_DICT),
}, },
],
[
{ {
input: true, input: true,
label: '备注', label: '备注',

View File

@ -72,10 +72,10 @@ const remainBox = {
}, },
computed: { computed: {
value() { value() {
const temp = this.injectData[this.injectData.prop] || null; const temp = this.injectData[this.injectData.prop] || null
if (temp) { if (temp) {
console.log('12', temp); console.log('12', temp)
return temp === 'Green' ? 'green' : 'red'; return temp === 'Green' ? 'green' : 'red'
} }
return this.injectData[this.injectData.prop] || null; return this.injectData[this.injectData.prop] || null;
}, },
@ -83,7 +83,7 @@ const remainBox = {
if (this.value) { if (this.value) {
// const v = +this.value; // const v = +this.value;
// return v < 0 ? 'red' : v >= 0 && v < 2 ? 'yellow' : 'green'; // return v < 0 ? 'red' : v >= 0 && v < 2 ? 'yellow' : 'green';
return this.value; return this.value
} }
return 'unset'; return 'unset';
}, },
@ -95,7 +95,8 @@ const remainBox = {
this.color this.color
// this.color == 'Green' ? 'green' : this.color == 'Red' ? 'red' : 'yellow' // this.color == 'Green' ? 'green' : this.color == 'Red' ? 'red' : 'yellow'
}; position:absolute; inset: 0; padding: 0 10px; display: flex; align-items: center; color: ${ }; position:absolute; inset: 0; padding: 0 10px; display: flex; align-items: center; color: ${
this.color == 'red' || this.color == 'green' ? '#fff' : 'unset' 'unset'
// this.color == 'red' ? '#fff' : 'unset'
}`}> }`}>
{this.injectData[this.injectData.prop] || ''} {this.injectData[this.injectData.prop] || ''}
</div> </div>
@ -111,10 +112,7 @@ const btn = {
}, },
methods: { methods: {
handleClick() { handleClick() {
this.$emit('emitData', { this.$emit('emitData', { action: this.injectData.name, value: this.injectData });
action: this.injectData.name,
value: this.injectData,
});
}, },
}, },
render: function (h) { render: function (h) {
@ -126,6 +124,8 @@ const btn = {
}, },
}; };
export default { export default {
name: 'EquipmentSparePartsMonitor', name: 'EquipmentSparePartsMonitor',
components: { addSparts }, components: { addSparts },
@ -162,12 +162,7 @@ export default {
{ prop: 'responsible', label: '负责人' }, { prop: 'responsible', label: '负责人' },
{ prop: 'color', label: '是否超期', subcomponent: remainBox }, { prop: 'color', label: '是否超期', subcomponent: remainBox },
{ prop: 'opt1', label: '备件更换', name: '操作', subcomponent: btn }, { prop: 'opt1', label: '备件更换', name: '操作', subcomponent: btn },
{ { prop: 'opt2', label: '更换记录', name: '更新记录', subcomponent: btn }, // TODO:
prop: 'opt2',
label: '更换记录',
name: '更新记录',
subcomponent: btn,
}, // TODO:
// { prop: 'remark', label: '' }, // { prop: 'remark', label: '' },
], ],
searchBarFormConfig: [ searchBarFormConfig: [
@ -176,14 +171,12 @@ export default {
label: '产线', label: '产线',
placeholder: '请选择产线', placeholder: '请选择产线',
param: 'lineId', param: 'lineId',
filterable: true,
}, },
{ {
type: 'select', type: 'select',
label: '设备', label: '设备',
placeholder: '请选择设备', placeholder: '请选择设备',
param: 'equipmentId', param: 'equipmentId',
filterable: true,
}, },
{ {
type: 'button', type: 'button',
@ -218,9 +211,7 @@ export default {
input: true, input: true,
label: '配置名称', label: '配置名称',
prop: 'name', prop: 'name',
rules: [ rules: [{ required: true, message: '配置名称不能为空', trigger: 'blur' }],
{ required: true, message: '配置名称不能为空', trigger: 'blur' },
],
}, },
], ],
[ [
@ -233,9 +224,7 @@ export default {
filterable: true, filterable: true,
clearable: true, clearable: true,
}, },
rules: [ rules: [{ required: true, message: '设备名称不能为空', trigger: 'blur' }],
{ required: true, message: '设备名称不能为空', trigger: 'blur' },
],
}, },
], ],
[ [
@ -292,29 +281,29 @@ export default {
} }
}, },
eqOperation({ id }) { eqOperation({ id }) {
this.addOrUpdateVisible = true; this.addOrUpdateVisible = true
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.addOrUpdate.init(id); this.$refs.addOrUpdate.init(id);
}); });
}, },
updateLog({ id }) { updateLog({ id }) {
this.addOrUpdateVisible = true; this.addOrUpdateVisible = true
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.addOrUpdate.init(id, true); this.$refs.addOrUpdate.init(id, true);
}); });
}, },
initSearchBar() { initSearchBar() {
// 线 // 线
getCorePLList().then((res) => { getCorePLList().then(res => {
this.$set( this.$set(
this.searchBarFormConfig[0], this.searchBarFormConfig[0],
'selectOptions', 'selectOptions',
res.data.map((item) => ({ res.data.map((item) => ({
name: item.name, name: item.name,
id: item.id, id: item.id
})) }))
); );
}); })
this.http('/base/core-equipment/listAll', 'get').then(({ data }) => { this.http('/base/core-equipment/listAll', 'get').then(({ data }) => {
this.$set( this.$set(
this.searchBarFormConfig[1], this.searchBarFormConfig[1],
@ -330,11 +319,7 @@ export default {
getList() { getList() {
this.loading = true; this.loading = true;
// //
this.http( this.http('/base/equipment-spare-part-config/monitor', 'get', this.queryParams).then((response) => {
'/base/equipment-spare-part-config/monitor',
'get',
this.queryParams
).then((response) => {
this.list = response.data.list; this.list = response.data.list;
this.total = response.data.total; this.total = response.data.total;
this.loading = false; this.loading = false;
@ -353,7 +338,7 @@ export default {
name: null, name: null,
equipmentId: null, equipmentId: null,
description: null, description: null,
responsible: null, responsible: null
}; };
this.resetForm('form'); this.resetForm('form');
}, },
@ -412,7 +397,7 @@ export default {
this.$modal this.$modal
.confirm('是否确认删除记录"' + row.name + '"?') .confirm('是否确认删除记录"' + row.name + '"?')
.then(function () { .then(function () {
return this.del({ id }); return this.delete({ id });
}) })
.then(() => { .then(() => {
this.getList(); this.getList();

View File

@ -1,138 +0,0 @@
<!--
filename: SearchBar.vue
author: liubin
date: 2023-11-23 14:01:17
description:
-->
<template>
<div class="search-bar">
<div class="vertical-blue-line"></div>
<el-form
:inline="true"
ref="search-bar__form"
:model="form"
class="search-bar__form">
<el-form-item :label="'产线'" prop="productionLineId">
<el-select
size="small"
placeholder="请选择产线"
@change="getEquipmentByLineId"
v-model="form.productionLineId">
<el-option
v-for="item in listLine"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item :label="'设备'" prop="equipmentId">
<el-select
size="small"
placeholder="请选择设备"
v-model="form.equipmentId">
<el-option
v-for="item in listEq"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
</el-form>
<el-button type="primary" @click="handleSearch" size="small">
查询
</el-button>
</div>
</template>
<script>
export default {
name: 'SearchBar',
model: {
prop: 'value',
event: 'change',
},
props: {
value: {
type: Object,
default: () => {},
},
},
data() {
return {
listLine: [],
listEq: [],
};
},
computed: {
form: {
set(val) {
this.emit(val);
},
get() {
return this.value;
},
},
},
mounted() {
this.getLine();
},
methods: {
emit(newValue) {
debugger;
this.$emit('update', { ...this.form, ...newValue });
},
async getLine() {
const { data, code } = await this.$axios({
url: '/base/core-production-line/listAll',
});
if (code == 0) {
this.listLine = data;
return;
}
this.listLine.splice(0);
},
async getEquipmentByLineId(id) {
const { data, code } = await this.$axios({
url: '/base/core-equipment/listByLine',
params: {
id,
},
});
if (code == 0) {
this.listEq = data;
return;
}
this.listEq.splice(0);
},
handleSearch() {},
},
};
</script>
<style scoped lang="scss">
.search-bar {
padding: 12px 0;
font-size: 16px;
position: relative;
display: flex;
align-items: center;
gap: 12px;
:deep(.el-form-item) {
margin-bottom: 0 !important;
margin-right: 0;
&:not(:last-child) {
margin-right: 18px;
}
}
}
.vertical-blue-line {
width: 4px;
height: 18px;
background: #0b58ff;
border-radius: 2px;
}
</style>

View File

@ -1,7 +1,10 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<SearchBarNew v-model="searchBarForm" /> <SearchBar
:formConfigs="searchBarFormConfig"
ref="search-bar"
@headBtnClick="handleSearchBarBtnClick" />
<!-- 列表 --> <!-- 列表 -->
<base-table <base-table
@ -10,13 +13,13 @@
:limit="queryParams.pageSize" :limit="queryParams.pageSize"
:table-data="list" :table-data="list"
@emitFun="handleEmitFun"> @emitFun="handleEmitFun">
<!-- <method-btn <method-btn
v-if="tableBtn.length" v-if="tableBtn.length"
slot="handleBtn" slot="handleBtn"
label="操作" label="操作"
:width="120" :width="120"
:method-list="tableBtn" :method-list="tableBtn"
@clickBtn="handleTableBtnClick" /> --> @clickBtn="handleTableBtnClick" />
</base-table> </base-table>
<!-- 分页组件 --> <!-- 分页组件 -->
@ -47,23 +50,22 @@
</template> </template>
<script> <script>
import moment from 'moment';
import basicPageMixin from '@/mixins/lb/basicPageMixin'; import basicPageMixin from '@/mixins/lb/basicPageMixin';
import { parseTime } from '@/utils/ruoyi'; import { publicFormatter } from '@/utils/dict';
import SearchBarNew from '../SearchBar.vue'; import { parseTime } from '@/utils/ruoyi'
// const timeFilter = (val) => moment(val).format('yyyy-MM-DD HH:mm:ss');
const btn = { const btn = {
name: 'tableBtn', name: 'tableBtn',
props: ['injectData'], props: ['injectData'],
components: {},
data() { data() {
return {}; return {};
}, },
methods: { methods: {
handleClick() { handleClick() {
this.$emit('emitData', { this.$emit('emitData', { action: this.injectData.label, value: this.injectData });
action: this.injectData.label,
value: this.injectData,
});
}, },
}, },
render: function (h) { render: function (h) {
@ -75,62 +77,134 @@ const btn = {
}, },
}; };
// monitoring/equipment-monitor/realtime-page
export default { export default {
name: 'StatusAndParams', name: 'StatusAndParams',
mixins: [basicPageMixin], mixins: [basicPageMixin],
components: { SearchBarNew },
data() { data() {
return { return {
searchBarKeys: ['equipmentName', 'recordTime'],
tableBtn: [
// this.$auth.hasPermi('equipment:spare-parts-config:update')
// ? {
// type: 'detail',
// btnName: '',
// }
// : undefined,
// this.$auth.hasPermi('equipment:spare-parts-config:update')
// ? {
// type: 'edit',
// btnName: '',
// }
// : undefined,
// this.$auth.hasPermi('equipment:spare-parts-config:delete')
// ? {
// type: 'delete',
// btnName: '',
// }
// : undefined,
].filter((v) => v),
tableProps: [ tableProps: [
{ prop: 'equipmentName', label: '设备名称' }, { prop: 'productionLine', label: '设备名称' },
{ prop: 'equipmentCode', label: '设备编码' }, { prop: 'workshopSection', label: '设备编码' },
{ prop: 'inQuantity', label: '投入数' }, { prop: 'equipment', label: '投入数' },
{ prop: 'outQuantity', label: '产出数' }, { prop: 'productionLine', label: '产出数' },
{ { prop: 'workshopSection', label: '是否运行' },
prop: 'run', { prop: 'equipment22', label: '状态' },
label: '是否运行', // { prop: 'alarmGrade', label: '', filter: publicFormatter(this.DICT_TYPE.EQU_ALARM_LEVEL) },
filter: (val) => (val != null ? (val ? '是' : '否') : ''), { prop: 'productionLine', label: '是否故障' },
}, { prop: 'workshopSection', label: '生产量记录时间', filter: parseTime },
{ { prop: 'equipment1', label: '状态记录时间', filter: parseTime },
prop: 'status',
label: '状态',
filter: (val) =>
val != null ? ['正常', '计划停机', '故障'][val] : '',
},
{
prop: 'error',
label: '是否故障',
filter: (val) => (val != null ? (val ? '是' : '否') : ''),
},
{
prop: 'quantityRecordTime',
label: '生产量记录时间',
filter: parseTime,
},
{ prop: 'statusRecordTime', label: '状态记录时间', filter: parseTime },
{ prop: 'opt1', label: '状态可视化', name: '查看', subcomponent: btn }, { prop: 'opt1', label: '状态可视化', name: '查看', subcomponent: btn },
{ prop: 'opt2', label: '参数监控', name: '查看', subcomponent: btn }, { prop: 'opt2', label: '参数监控', name: '查看', subcomponent: btn } // TODO:
// { prop: 'remark', label: '' },
],
searchBarFormConfig: [
{
type: 'input',
label: '设备名',
placeholder: '请输入设备名称',
param: 'equipmentName',
},
//
{
type: 'datePicker',
label: '时间段',
dateType: 'daterange', // datetimerange
// format: 'yyyy-MM-dd HH:mm:ss',
format: 'yyyy-MM-dd',
// valueFormat: 'timestamp',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始日期',
endPlaceholder: '结束日期',
defaultTime: ['00:00:00', '23:59:59'],
param: 'recordTime',
// defaultSelect: [
// new Date(y, m, d)
// .toLocaleString()
// .split('/')
// .map((item, index) => {
// if (index == 1 || index == 2) return item.padStart(2, '0');
// return item;
// })
// .join('-'),
// new Date(y, m, d, 23, 59, 59)
// .toLocaleString()
// .split('/')
// .map((item, index) => {
// if (index == 1 || index == 2) return item.padStart(2, '0');
// return item;
// })
// .join('-'),
// ],
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
// {
// type: 'separate',
// },
// {
// type: this.$auth.hasPermi('equipment:spare-parts-config:create')
// ? 'button'
// : '',
// btnName: '',
// name: 'add',
// plain: true,
// color: 'success',
// },
// {
// type: this.$auth.hasPermi('equipment:spare-parts-config:export')
// ? 'button'
// : '',
// btnName: '',
// name: 'export',
// color: 'warning',
// },
], ],
searchBarForm: {
productionLineId: null,
equipmentId: null,
},
// //
open: false, open: false,
// //
queryParams: { queryParams: {
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
lineId: null,
equipmentId: null, equipmentId: null,
productionLineId: null,
}, },
list: [], basePath: '/base/equipment-alarm-log',
list: []
}; };
}, },
created() {
// this.getList();
},
methods: { methods: {
handleEmitFun(val) { handleEmitFun(val) {
console.log('你好', val); console.log('你好', val)
if (val.action === '状态可视化') { if (val.action === '状态可视化') {
// //
} else { } else {
@ -141,20 +215,16 @@ export default {
getList() { getList() {
this.loading = true; this.loading = true;
// //
this.http( this.recv(this.queryParams).then((response) => {
'/monitoring/equipment-monitor/realtime-page',
'get',
this.queryParams
).then((response) => {
this.list = response.data.list; this.list = response.data.list;
this.total = response.data.total; this.total = response.data.total;
this.loading = false; this.loading = false;
}); });
}, },
successSubmit() { successSubmit() {
this.cancel(); this.cancel()
this.getList(); this.getList()
}, },
/** 取消按钮 */ /** 取消按钮 */
cancel() { cancel() {
this.open = false; this.open = false;
@ -200,7 +270,7 @@ export default {
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
this.$refs.addOrUpdate.dataFormSubmit(); this.$refs.addOrUpdate.dataFormSubmit()
// this.$refs['form'].validate((valid) => { // this.$refs['form'].validate((valid) => {
// if (!valid) { // if (!valid) {
// return; // return;
@ -227,8 +297,8 @@ export default {
const id = row.id; const id = row.id;
this.$modal this.$modal
.confirm('是否确认删除记录"' + row.name + '"?') .confirm('是否确认删除记录"' + row.name + '"?')
.then(() => { .then(function () {
return this.del({ id }); return this.delete({ id });
}) })
.then(() => { .then(() => {
this.getList(); this.getList();

View File

@ -61,8 +61,6 @@
v-if="open" v-if="open"
style="width: 100%" style="width: 100%"
v-model="queryParams.equipmentId" v-model="queryParams.equipmentId"
filterable
clearable
placeholder="请选择一个设备"> placeholder="请选择一个设备">
<el-option <el-option
v-for="eq in eqList" v-for="eq in eqList"

View File

@ -94,19 +94,12 @@
<script> <script>
import Gantt from './chart'; import Gantt from './chart';
import moment from 'moment';
export default { export default {
name: 'SGStatus', name: 'SGStatus',
components: {}, components: {},
props: {}, props: {},
data() { data() {
const today = new Date();
const todayStart = new Date(
today.getFullYear(),
today.getMonth(),
today.getDate()
);
return { return {
chart: null, chart: null,
searchBarFormConfig: [ searchBarFormConfig: [
@ -136,7 +129,6 @@ export default {
placeholder: '选择日期', placeholder: '选择日期',
param: 'recordTime', param: 'recordTime',
required: true, required: true,
defaultSelect: moment(todayStart).format('YYYY-MM-DD HH:mm:ss'),
}, },
{ {
type: 'button', type: 'button',
@ -377,10 +369,7 @@ export default {
const { code, data } = await this.$axios({ const { code, data } = await this.$axios({
url: '/monitoring/equipment-monitor/status-series', url: '/monitoring/equipment-monitor/status-series',
method: 'get', method: 'get',
params: { params: this.queryParams,
recordTime: this.queryParams.recordTime,
equipmentId: this.queryParams.equipmentId,
},
}); });
if (code == 0) { if (code == 0) {
const newEqlist = this.objectToArray(data); const newEqlist = this.objectToArray(data);