update 完成设备异常分析

This commit is contained in:
lb 2023-09-04 15:24:22 +08:00
parent ffedc7c256
commit 55e8de1136

View File

@ -65,57 +65,44 @@ export default {
: undefined, : undefined,
].filter((v) => v), ].filter((v) => v),
tableProps: [ tableProps: [
{ prop: 'lineName', label: '产线', align: 'center' },
{ prop: 'sectionName', label: '工段', align: 'center' },
{ prop: 'equipmentName', label: '设备', align: 'center' },
{ {
prop: 'createTime', width: 188,
label: '添加时间', prop: 'mtbf',
fixed: true, label: '平均故障间隔时间[MTBF](h)',
width: 180,
filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
},
{ prop: 'name', label: '设备分组名称', align: 'center' },
{ prop: 'code', label: '检测分组编码', align: 'center' },
{ prop: 'remark', label: '备注', align: 'center' },
{
_action: 'equipment-group-show-alert',
label: '报警',
align: 'center', align: 'center',
subcomponent: {
props: ['injectData'],
render: function (h) {
const _this = this;
return h(
'el-button',
{
props: { type: 'text', size: 'mini' },
on: {
click: function () {
console.log('inejctdata', _this.injectData);
_this.$emit('emitData', {
action: _this.injectData._action,
// value: _this.injectData.id,
value: _this.injectData,
});
},
},
},
'查看报警'
);
},
},
}, },
{
width: 180,
prop: 'mttr',
label: '平均维修时间[MTTR](h)',
align: 'center',
},
{ prop: 'workTime', label: '工作时长(h)', align: 'center' },
{ prop: 'downTime', label: '故障时长(h)', align: 'center' },
{ prop: 'downCount', label: '故障次数', align: 'center' },
], ],
searchBarFormConfig: [ searchBarFormConfig: [
{ {
type: 'input', type: 'select',
label: '分组名称', label: '请选择月份',
placeholder: '请输入设备分组名称', placeholder: '请选择月份',
param: 'name', param: 'month',
selectOptions: Array(12)
.fill(0)
.map((v, i) => ({
id: i + 1,
name: `${i + 1}`,
})),
}, },
{ {
type: 'input', __index: 'line',
label: '分组编码', type: 'select',
placeholder: '请输入设备分组编码', label: '产线',
param: 'codes', placeholder: '请选择产线',
param: 'lineId',
}, },
{ {
type: 'button', type: 'button',
@ -123,86 +110,78 @@ export default {
name: 'search', name: 'search',
color: 'primary', color: 'primary',
}, },
{
type: 'separate',
},
{
type: this.$auth.hasPermi('base:equipment-group:create')
? 'button'
: '',
btnName: '新增',
name: 'add',
plain: true,
color: 'success',
},
// {
// type: this.$auth.hasPermi('base:equipment-group:export') ? 'button' : '',
// btnName: '',
// name: 'export',
// color: 'warning',
// },
], ],
rows: [
[
{
input: true,
label: '分组名称',
prop: 'name',
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
// bind: {
// disabled: true, // some condition, like detail mode...
// }
},
],
[
{
input: true,
label: '分组编码',
prop: 'code',
url: '/base/equipment-group/getCode',
},
],
[
{
input: true,
label: '备注',
prop: 'remark',
// rules: [{ required: true, message: '', trigger: 'blur' }],
bind: {
placeholder: '请输入备注',
},
},
],
],
//
open: false,
// //
queryParams: { queryParams: {
pageNo: 1, lineId: null,
pageSize: 10, factoryId: null,
code: null, recordTime: null,
name: null,
}, },
//
form: {},
}; };
}, },
computed: {}, computed: {},
created() {
this.fillLineOptions();
},
methods: { methods: {
getList() { async fillLineOptions() {
const { data } = await this.$axios({
url: '/base/production-line/listAll',
method: 'get',
});
const cfg = this.searchBarFormConfig.find(
(item) => item.__index == 'line'
);
this.$set(
cfg,
'selectOptions',
data.map((item) => ({
id: item.id,
name: item.name,
}))
);
},
async getList() {
this.loading = true; this.loading = true;
// //
getEquipmentGroupPage(this.queryParams).then((response) => { const { data } = await this.$axios({
this.list = response.data.list; url: '/analysis/equipment-analysis/efficiency',
this.total = response.data.total; method: 'get',
this.loading = false; params: {
lineId: this.queryParams.lineId || null,
recordTime: this.queryParams.recordTime || null,
},
}); });
}, },
handleSearchBarBtnClick(btn) {
switch (btn.btnName) {
case 'search':
if (btn.month) {
this.queryParams.recordTime = [
moment()
.month(btn.month - 1)
.format('YYYY-MM')+'-01 00:00:00',
moment()
.month(btn.month)
.format('YYYY-MM')+'-01 00:00:00',
];
} else {
this.queryParams.recordTime = null;
}
this.queryParams.lineId = btn.lineId || null;
this.handleQuery();
break;
}
},
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNo = 1; // this.queryParams.pageNo = 1;
this.getList(); this.getList();
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.resetForm('queryForm'); this.resetForm('queryForm');