This commit is contained in:
lb
2023-11-23 17:07:57 +08:00
parent e318aa4f59
commit 0225be1c94
18 changed files with 575 additions and 380 deletions

View File

@@ -1,10 +1,7 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<SearchBar
:formConfigs="searchBarFormConfig"
ref="search-bar"
@headBtnClick="handleSearchBarBtnClick" />
<SearchBarNew v-model="searchBarForm" />
<!-- 列表 -->
<base-table
@@ -13,13 +10,13 @@
:limit="queryParams.pageSize"
:table-data="list"
@emitFun="handleEmitFun">
<method-btn
<!-- <method-btn
v-if="tableBtn.length"
slot="handleBtn"
label="操作"
:width="120"
:method-list="tableBtn"
@clickBtn="handleTableBtnClick" />
@clickBtn="handleTableBtnClick" /> -->
</base-table>
<!-- 分页组件 -->
@@ -50,22 +47,23 @@
</template>
<script>
import moment from 'moment';
import basicPageMixin from '@/mixins/lb/basicPageMixin';
import { publicFormatter } from '@/utils/dict';
import { parseTime } from '@/utils/ruoyi'
// const timeFilter = (val) => moment(val).format('yyyy-MM-DD HH:mm:ss');
import { parseTime } from '@/utils/ruoyi';
import SearchBarNew from '../SearchBar.vue';
const btn = {
name: 'tableBtn',
props: ['injectData'],
components: {},
data() {
return {};
},
methods: {
handleClick() {
this.$emit('emitData', { action: this.injectData.label, value: this.injectData });
this.$emit('emitData', {
action: this.injectData.label,
value: this.injectData,
});
},
},
render: function (h) {
@@ -77,134 +75,62 @@ const btn = {
},
};
// monitoring/equipment-monitor/realtime-page
export default {
name: 'StatusAndParams',
mixins: [basicPageMixin],
components: { SearchBarNew },
data() {
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: [
{ prop: 'productionLine', label: '设备名称' },
{ prop: 'workshopSection', label: '设备编码' },
{ prop: 'equipment', label: '投入数' },
{ prop: 'productionLine', label: '产出数' },
{ prop: 'workshopSection', label: '是否运行' },
{ prop: 'equipment22', label: '状态' },
// { prop: 'alarmGrade', label: '报警级别', filter: publicFormatter(this.DICT_TYPE.EQU_ALARM_LEVEL) },
{ prop: 'productionLine', label: '是否故障' },
{ prop: 'workshopSection', label: '生产量记录时间', filter: parseTime },
{ prop: 'equipment1', label: '状态记录时间', filter: parseTime },
{ prop: 'equipmentName', label: '设备名称' },
{ prop: 'equipmentCode', label: '设备编码' },
{ prop: 'inQuantity', label: '投入数' },
{ prop: 'outQuantity', label: '产出数' },
{
prop: 'run',
label: '是否运行',
filter: (val) => (val != null ? (val ? '是' : '否') : ''),
},
{
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: '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',
// },
{ prop: 'opt2', label: '参数监控', name: '查看', subcomponent: btn },
],
searchBarForm: {
productionLineId: null,
equipmentId: null,
},
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNo: 1,
pageSize: 10,
lineId: null,
equipmentId: null,
productionLineId: null,
},
basePath: '/base/equipment-alarm-log',
list: []
list: [],
};
},
created() {
// this.getList();
},
methods: {
handleEmitFun(val) {
console.log('你好', val)
console.log('你好', val);
if (val.action === '状态可视化') {
// 状态可视化
} else {
@@ -215,16 +141,20 @@ export default {
getList() {
this.loading = true;
// 执行查询
this.recv(this.queryParams).then((response) => {
this.http(
'/monitoring/equipment-monitor/realtime-page',
'get',
this.queryParams
).then((response) => {
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
});
},
successSubmit() {
this.cancel()
this.getList()
},
this.cancel();
this.getList();
},
/** 取消按钮 */
cancel() {
this.open = false;
@@ -270,7 +200,7 @@ export default {
},
/** 提交按钮 */
submitForm() {
this.$refs.addOrUpdate.dataFormSubmit()
this.$refs.addOrUpdate.dataFormSubmit();
// this.$refs['form'].validate((valid) => {
// if (!valid) {
// return;
@@ -297,8 +227,8 @@ export default {
const id = row.id;
this.$modal
.confirm('是否确认删除记录"' + row.name + '"?')
.then(function () {
return this.delete({ id });
.then(() => {
return this.del({ id });
})
.then(() => {
this.getList();