projects/mes-test #133

Merged
gtz217 merged 281 commits from projects/mes-test into projects/mes 2023-11-30 09:11:34 +08:00
3 changed files with 101 additions and 31 deletions
Showing only changes of commit a8fa98cb91 - Show all commits

View File

@ -105,7 +105,12 @@ export default {
} }
this.listEq.splice(0); this.listEq.splice(0);
}, },
handleSearch() {}, handleSearch() {
this.$emit('action', {
action: 'search',
payload: this.form,
});
},
}, },
}; };
</script> </script>

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<SearchBarNew v-model="searchBarForm" /> <SearchBarNew v-model="searchBarForm" @action="handleSearchBarActions" />
<!-- 列表 --> <!-- 列表 -->
<base-table <base-table
@ -128,13 +128,31 @@ export default {
list: [], list: [],
}; };
}, },
mounted() {
this.getList();
},
methods: { methods: {
handleEmitFun(val) { /**
console.log('你好', val); * 处理表格按钮点击事件
if (val.action === '状态可视化') { * @param {string} action 按钮名称
* @param {object} value 按钮数据(行数据) { equipmentId, equipmentCode, equipmentName, inQuantity, outQuantity, run, status, error, quantityRecordTime, statusRecordTime}
*/
handleEmitFun({ action, value: row } = {}) {
if (action === '状态可视化') {
// //
} else { } else if (action === '参数监控') {
// //
// equipmentId recordTime workOrderId id
this.$router.push({
// path: '/equipment/monitor/full-params',
name: 'EquipmentFullParams',
params: {
equipmentId: row.equipmentId,
equipmentCode: row.equipmentCode,
equipmentName: row.equipmentName,
},
});
} else {
} }
}, },
/** 查询列表 */ /** 查询列表 */
@ -172,9 +190,25 @@ export default {
// }; // };
// this.resetForm('form'); // this.resetForm('form');
// }, // },
handleSearchBarActions({ action, payload }) {
switch (action) {
case 'search':
this.handleQuery();
break;
case 'reset':
this.resetQuery();
break;
default:
break;
}
},
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNo = 1; this.queryParams = {
...this.queryParams,
...this.searchBarForm,
pageNo: 1,
};
this.getList(); this.getList();
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */

View File

@ -35,12 +35,12 @@
" /> " />
</div> </div>
</div> </div>
<div v-else class="no-data-bg"> <div v-else class="no-data-bg"></div>
</div>
</div> </div>
</template> </template>
<script> <script>
import { Message } from 'element-ui';
import LocalDataManager from './utils/local-data-manager'; import LocalDataManager from './utils/local-data-manager';
// import response from './response'; // import response from './response';
import moment from 'moment'; import moment from 'moment';
@ -55,7 +55,6 @@ export default {
const today = new Date(y, m, d, 0, 0, 0, 0).getTime(); const today = new Date(y, m, d, 0, 0, 0, 0).getTime();
const aWeekAgo = today - 3600 * 1000 * 24 * 7; const aWeekAgo = today - 3600 * 1000 * 24 * 7;
return { return {
tableList: [],
searchBarFormConfig: [ searchBarFormConfig: [
{ {
type: 'input', type: 'input',
@ -109,35 +108,67 @@ export default {
], ],
}; };
}, },
computed: { beforeRouteEnter(to, from, next) {
id() { if (Object.keys(to.params).length > 0) {
return this.$route.params.equipmentId; next((vm) => {
}, vm.$set(vm.queryParams, 'id', to.params.equipmentId);
code() { vm.$set(
return this.$route.params.equipmentCode; vm.searchBarFormConfig[0],
}, 'defaultSelect',
name() { to.params.equipmentCode
return this.$route.params.equipmentName; );
}, vm.$set(
}, vm.searchBarFormConfig[1],
mounted() { 'defaultSelect',
if (this.id) this.$set(this.queryParams, 'id', this.id); to.params.equipmentName
if (this.code) );
this.$set(this.searchBarFormConfig[0], 'defaultSelect', this.code); vm.handleQuery();
if (this.name) });
this.$set(this.searchBarFormConfig[1], 'defaultSelect', this.name); } else {
// let timeleft = 3;
// this.handleResponse(); // const message = Message({
// type: 'warning',
// duration: 0,
// message: `, , ${timeleft} s`,
// });
// const timer = setInterval(() => {
// if (timeleft > 0) {
// timeleft--;
// message.$data.message = `, , ${timeleft} s`
// return;
// }
// message.close();
// clearInterval(timer);
// timer = null;
// }, 1000);
// next({ name: 'EquipmentStatusAndParams' });
next((vm) => {
vm.$message({
type: 'error',
message: `请先选择设备`,
});
});
}
},
beforeRouteLeave(to, from, next) {
// clean job
this.$set(this.queryParams, 'id', null);
this.$set(this.searchBarFormConfig[0], 'defaultSelect', null);
this.$set(this.searchBarFormConfig[1], 'defaultSelect', null);
this.tableList = [];
next();
}, },
methods: { methods: {
buildProps(table) { buildProps(table) {
console.log('building props', table);
// otherList props // otherList props
const { otherList } = table; const { otherList } = table;
const props = [ const props = [
{ {
// type: 'index', // type: 'index',
width: 48, width: 56,
prop: 'index', prop: 'index',
label: '序号', label: '序号',
}, },
@ -147,7 +178,7 @@ export default {
label: '时间', label: '时间',
}, },
{ {
width: 200, width: 240,
prop: 'plcCode', prop: 'plcCode',
label: 'PLC编码', label: 'PLC编码',
}, },