test #47

Merged
gtz217 merged 273 commits from test into master 2023-10-17 08:53:54 +08:00
Showing only changes of commit fd0c14ff1c - Show all commits

View File

@ -34,8 +34,8 @@
<div class="table" v-if="mode == 'table'"> <div class="table" v-if="mode == 'table'">
<base-table <base-table
:table-props="tableProps" :table-props="tableProps"
:page="queryParams.pageNo" :page="1"
:limit="queryParams.pageSize" :limit="999"
:table-data="list" :table-data="list"
@emitFun="handleEmitFun"> @emitFun="handleEmitFun">
<!-- <method-btn <!-- <method-btn
@ -63,49 +63,91 @@ export default {
data() { data() {
return { return {
sidebarContent: [ sidebarContent: [
{ // {
id: 'fc1', // id: 'fc1',
name: '工厂', // name: '',
lines: [ // lines: [
{ // {
name: '产线1', // name: '线1',
id: 'pl1', // id: 'pl1',
sections: [ // sections: [
{ // {
name: '工段1', // name: '1',
id: 'pl1ws1', // id: 'pl1ws1',
}, // equipments: [
{ // {
name: '工段2', // name: '1',
id: 'pl1ws2', // id: 'pl1ws1--eq1',
}, // },
{ // {
name: '工段3', // name: '2',
id: 'pl1ws3', // id: 'pl1ws1--eq2',
}, // },
], // {
}, // name: '3',
// id: 'pl1ws1--eq3',
// },
// ],
// },
// {
// name: '2',
// id: 'pl1ws2',
// equipments: [
// {
// name: '1',
// id: 'pl2ws1--eq1',
// },
// {
// name: '2',
// id: 'pl2ws1--eq2',
// },
// {
// name: '3',
// id: 'pl2ws1--eq3',
// },
// ],
// },
// {
// name: '3',
// id: 'pl1ws3',
// equipments: [
// {
// name: '1',
// id: 'pl3ws1--eq1',
// },
// {
// name: '2',
// id: 'pl3ws1--eq2',
// },
// {
// name: '3',
// id: 'pl3ws1--eq3',
// },
// ],
// },
// ],
// },
{ // {
name: '产线2', // name: '线2',
id: 'pl2', // id: 'pl2',
sections: [ // sections: [
{ // {
name: '工段1', // name: '1',
id: 'pl2ws1', // id: 'pl2ws1',
}, // },
{ // {
name: '工段2', // name: '2',
id: 'pl2ws2', // id: 'pl2ws2',
}, // },
{ // {
name: '工段3', // name: '3',
id: 'pl2ws3', // id: 'pl2ws3',
}, // },
], // ],
}, // },
], // ],
}, // },
], ],
searchBarFormConfig: [ searchBarFormConfig: [
{ {
@ -127,6 +169,29 @@ export default {
name: 'search', name: 'search',
color: 'primary', color: 'primary',
}, },
{
type: 'separate',
},
{
type: 'button',
btnName: '表格',
name: 'table',
plain: true,
color: 'success',
},
{
type: 'button',
btnName: '图表',
name: 'graph',
plain: true,
color: 'warning',
},
// {
// type: this.$auth.hasPermi('base:equipment-group:export') ? 'button' : '',
// btnName: '',
// name: 'export',
// color: 'warning',
// },
], ],
tableProps: [ tableProps: [
{ prop: 'lineName', label: '产线', align: 'center' }, { prop: 'lineName', label: '产线', align: 'center' },
@ -137,8 +202,8 @@ export default {
], ],
mode: 'table', // table | graph mode: 'table', // table | graph
queryParams: { queryParams: {
pageNo: 1, // pageNo: 1,
pageSize: 999, // pageSize: 999,
recordTime: [], recordTime: [],
equipmentId: null, equipmentId: null,
lineId: null, lineId: null,
@ -153,53 +218,103 @@ export default {
}; };
}, },
mounted() { mounted() {
this.getList(); this.getTree();
}, },
methods: { methods: {
/** build side bar tree */ /** build side bar tree */
buildTree(data) { buildTree(data) {
data.forEach((factory) => { data.forEach((factory) => {
this.$set(factory, 'label', factory.name); this.$set(factory, 'label', factory.name);
this.$set(factory, 'type', '工厂');
delete factory.name; delete factory.name;
factory.children = factory.lines; factory.children = factory.lines;
delete factory.lines; delete factory.lines;
factory.children.forEach((line) => { factory.children?.forEach((line) => {
this.$set(line, 'label', line.name); this.$set(line, 'label', line.name);
this.$set(line, 'type', '产线');
delete line.name; delete line.name;
line.children = line.sections; line.children = line.sections;
delete line.sections; delete line.sections;
line.children.forEach((ws) => { line.children?.forEach((ws) => {
this.$set(ws, 'label', ws.name); this.$set(ws, 'label', ws.name);
this.$set(ws, 'type', '工段');
delete ws.name; delete ws.name;
ws.children = ws.equipments;
delete ws.equipments;
ws.children?.forEach((eq) => {
this.$set(eq, 'label', eq.name);
this.$set(eq, 'type', '设备');
delete eq.name;
});
}); });
}); });
}); });
}, },
async getList() { async getTree() {
this.buildTree(this.sidebarContent); const { data } = await this.$axios('/base/factory/getTree');
console.log('sidebar final', this.sidebarContent); this.sidebarContent = data;
this.buildTree(data);
}, },
handleSidebarItemClick({ label, id, type }) {
console.log('lable clicked!', label, id, type);
handleSidebarItemClick({ label, id }) { switch (type) {
console.log('lable clicked!', label, id); case '设备':
this.queryParams.equipmentId = id;
break;
case '工段':
this.queryParams.equipmentId = null;
this.queryParams.sectionId = id;
break;
case '产线':
this.queryParams.equipmentId = null;
this.queryParams.sectionId = null;
this.queryParams.lineId = id;
break;
case '工厂':
this.queryParams.equipmentId = null;
this.queryParams.sectionId = null;
this.queryParams.lineId = null;
break;
}
}, },
handleEmitFun() {}, handleEmitFun() {},
handleSearchBarBtnClick(btn) { handleSearchBarBtnClick(btn) {
console.log('btn', btn); switch (btn.btnName) {
this.queryParams.recordTime = btn.timeVal; case 'table':
this.handleQuery(); this.mode = 'table';
break;
case 'graph':
this.mode = 'graph';
break;
case 'search':
if (btn.timeVal != null && btn.timeVal.length > 0)
this.queryParams.recordTime = btn.timeVal;
else this.queryParams.recordTime = null;
this.handleQuery();
break;
}
}, },
handleQuery() { async handleQuery() {
console.log(this.queryParams) console.log('queryParams', this.queryParams);
} const { data } = await this.$axios({
url: '/monitoring/equipment-monitor/quantity-det-list',
method: 'get',
params: this.queryParams,
});
this.list = data;
},
}, },
}; };
</script> </script>
<style scoped lang="scss"></style> <style scoped>
.side-bar__left >>> .is-current {
color: #111;
background: #f2f4f7;
}
</style>