yudao-dev/src/views/monitoring/equipmentProcessAmount/index.vue

206 lines
4.3 KiB
Vue
Raw Normal View History

2023-08-30 14:11:24 +08:00
<!--
filename: index.vue
author: liubin
date: 2023-08-30 14:02:49
description: 设备加工数量
-->
<template>
2023-08-30 15:36:16 +08:00
<div style="flex: 1; display: flex; background: #f2f4f9">
<div
class="app-container"
style="margin-right: 12px; border-radius: 8px; background: #fff">
<!-- side bar -->
<div
class="side-bar__left"
style="width: 240px; padding: 12px; height: 100%">
<el-tree
:data="sidebarContent"
:props="treeProps"
@node-click="handleSidebarItemClick" />
</div>
</div>
<div
class="app-container equipment-process-amount"
style="flex: 1; border-radius: 8px; background: #fff">
<!-- main area -->
<div class="main-content">
<SearchBar
:formConfigs="searchBarFormConfig"
ref="search-bar"
@headBtnClick="handleSearchBarBtnClick" />
2023-08-30 14:11:24 +08:00
2023-08-30 15:36:16 +08:00
<!-- tabs -->
<div class="table" v-if="mode == 'table'">
<base-table
:table-props="tableProps"
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-data="list"
@emitFun="handleEmitFun">
<!-- <method-btn
2023-08-30 14:11:24 +08:00
v-if="tableBtn.length"
slot="handleBtn"
label="操作"
:method-list="tableBtn"
@clickBtn="handleTableBtnClick" /> -->
2023-08-30 15:36:16 +08:00
</base-table>
</div>
2023-08-30 14:11:24 +08:00
2023-08-30 15:36:16 +08:00
<div class="graph" v-else>
<!-- graph -->
</div>
2023-08-30 14:11:24 +08:00
</div>
</div>
</div>
</template>
<script>
export default {
name: 'EquipmentProcessAmount',
components: {},
props: {},
data() {
return {
sidebarContent: [
{
2023-08-30 15:36:16 +08:00
id: 'fc1',
name: '工厂',
lines: [
2023-08-30 14:11:24 +08:00
{
2023-08-30 15:36:16 +08:00
name: '产线1',
id: 'pl1',
sections: [
2023-08-30 14:11:24 +08:00
{
2023-08-30 15:36:16 +08:00
name: '工段1',
id: 'pl1ws1',
2023-08-30 14:11:24 +08:00
},
{
2023-08-30 15:36:16 +08:00
name: '工段2',
id: 'pl1ws2',
2023-08-30 14:11:24 +08:00
},
{
2023-08-30 15:36:16 +08:00
name: '工段3',
id: 'pl1ws3',
2023-08-30 14:11:24 +08:00
},
],
},
2023-08-30 15:36:16 +08:00
2023-08-30 14:11:24 +08:00
{
2023-08-30 15:36:16 +08:00
name: '产线2',
id: 'pl2',
sections: [
2023-08-30 14:11:24 +08:00
{
2023-08-30 15:36:16 +08:00
name: '工段1',
id: 'pl2ws1',
2023-08-30 14:11:24 +08:00
},
{
2023-08-30 15:36:16 +08:00
name: '工段2',
id: 'pl2ws2',
2023-08-30 14:11:24 +08:00
},
{
2023-08-30 15:36:16 +08:00
name: '工段3',
id: 'pl2ws3',
2023-08-30 14:11:24 +08:00
},
],
},
],
},
],
searchBarFormConfig: [
{
2023-08-30 15:36:16 +08:00
type: 'datePicker',
label: '时间段',
dateType: 'daterange', // datetimerange
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始日期',
endPlaceholder: '结束日期',
defaultTime: ['00:00:00', '23:59:59'],
param: 'timeVal',
width: 350,
2023-08-30 14:11:24 +08:00
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
],
tableProps: [
2023-08-30 15:36:16 +08:00
{ prop: 'lineName', label: '产线', align: 'center' },
{ prop: 'sectionName', label: '工段', align: 'center' },
{ prop: 'externalCode', label: '设备编码', align: 'center' },
{ prop: 'equipmentName', label: '设备名称', align: 'center' },
{ prop: 'totalQuantity', label: '加工数量', align: 'center' },
2023-08-30 14:11:24 +08:00
],
mode: 'table', // table | graph
queryParams: {
pageNo: 1,
pageSize: 999,
2023-08-30 15:36:16 +08:00
recordTime: [],
equipmentId: null,
lineId: null,
sectionId: null,
productId: null,
2023-08-30 14:11:24 +08:00
},
list: [],
2023-08-30 15:36:16 +08:00
treeProps: {
children: 'children',
label: 'label',
},
2023-08-30 14:11:24 +08:00
};
},
2023-08-30 15:36:16 +08:00
mounted() {
this.getList();
},
2023-08-30 14:11:24 +08:00
methods: {
2023-08-30 15:36:16 +08:00
/** build side bar tree */
buildTree(data) {
data.forEach((factory) => {
this.$set(factory, 'label', factory.name);
delete factory.name;
factory.children = factory.lines;
delete factory.lines;
factory.children.forEach((line) => {
this.$set(line, 'label', line.name);
delete line.name;
line.children = line.sections;
delete line.sections;
line.children.forEach((ws) => {
this.$set(ws, 'label', ws.name);
delete ws.name;
});
});
});
},
async getList() {
this.buildTree(this.sidebarContent);
console.log('sidebar final', this.sidebarContent);
},
handleSidebarItemClick({ label, id }) {
console.log('lable clicked!', label, id);
},
2023-08-30 14:11:24 +08:00
handleEmitFun() {},
2023-08-30 15:36:16 +08:00
handleSearchBarBtnClick(btn) {
console.log('btn', btn);
this.queryParams.recordTime = btn.timeVal;
this.handleQuery();
},
handleQuery() {
console.log(this.queryParams)
}
2023-08-30 14:11:24 +08:00
},
};
</script>
<style scoped lang="scss"></style>