update 设备全参数查询

This commit is contained in:
lb
2023-09-11 15:24:11 +08:00
parent 4e05b3e3d6
commit f2f3a9e850
2 changed files with 98 additions and 65 deletions

View File

@@ -12,31 +12,7 @@
ref="search-bar"
@headBtnClick="handleSearchBarBtnClick" />
<!-- <base-table
:table-props="[
{ type: 'index', label: '序号' },
{ prop: 'name', label: '设备名称', align: 'center' },
{ prop: 'code', label: '设备代码', align: 'center' },
{ prop: 'time', label: '时间', align: 'center' },
]"
:table-data="[
{ index: 1, name: '1', code: 'c1', time: '2021-08-31 09:14:19' },
{ index: 2, name: '2', code: 'c2', time: '2021-08-31 09:14:19' },
{ index: 3, name: '3', code: 'c3', time: '2021-08-31 09:14:19' },
{ index: 4, name: '4', code: 'c4', time: '2021-08-31 09:14:19' },
{ index: 5, name: '5', code: 'c5', time: '2021-08-31 09:14:19' },
]"
:span-method="
({ rowIndex, columnIndex }) => {
if (rowIndex == 1 && columnIndex == 0) {
return [1, 3];
}
return [1, 1];
}
"
@emitFun="(val) => handleEmitFun(table, val)"></base-table> -->
<div class="tables">
<div v-if="tableList.length" class="tables">
<div class="custom-table" v-for="table in tableList" :key="table.key">
<!-- {{ JSON.stringify(spanMethod) }} -->
<base-table
@@ -58,16 +34,14 @@
getListFor(table, { page, limit, current })
" />
</div>
<!-- v-show="table.dataManager?.total > 0"
:total="table.dataManager?.total || 0" -->
<!-- @size-change="($event) => handleSizeChange(table, $event)" -->
</div>
<div v-else style="margin-top: 20px; color: #c7c7c7; text-align: center;">暂无数据</div>
</div>
</template>
<script>
import LocalDataManager from './utils/local-data-manager';
import response from './response';
// import response from './response';
import moment from 'moment';
export default {
@@ -123,14 +97,14 @@ export default {
time: [new Date(aWeekAgo), new Date(today)],
},
tableList: [
{
key: 'base-table__key__1',
tableProps: [],
list: [],
pageNo: 1,
pageSize: 3,
total: 0,
},
// {
// key: 'base-table__key__1',
// tableProps: [],
// list: [],
// pageNo: 1,
// pageSize: 3,
// total: 0,
// },
],
};
},
@@ -152,7 +126,7 @@ export default {
if (this.name)
this.$set(this.searchBarFormConfig[1], 'defaultSelect', this.name);
this.handleResponse();
// this.handleResponse();
},
methods: {
buildProps(table) {
@@ -199,11 +173,9 @@ export default {
return { props, firstLineData };
},
handleResponse() {
handleResponse(response) {
const { code, data } = response;
if (code == 0) {
console.log('response', code, data);
// 处理一个表格
data.forEach((table, index) => {
console.log('handle index:', index, table);
@@ -220,26 +192,28 @@ export default {
// 处理某一表格的各个行
const { data } = table;
data.forEach((row, idx) => {
const listItem = {
index: idx + 1,
time: moment(+row.time).format('YYYY-MM-DD HH:mm:ss'),
plcCode: row.plcCode,
};
row.data.forEach((column) => {
listItem[column.dynamicName] = column.dynamicValue;
if (data) {
data.forEach((row, idx) => {
const listItem = {
index: idx + 1,
time: moment(+row.time).format('YYYY-MM-DD HH:mm:ss'),
plcCode: row.plcCode,
};
row.data.forEach((column) => {
listItem[column.dynamicName] = column.dynamicValue;
});
this.tableList[index].list.push(listItem);
this.tableList[index].total++;
});
this.tableList[index].list.push(listItem);
this.tableList[index].total++;
});
// 处理分页
const { pageNo, pageSize, list } = this.tableList[index];
this.tableList[index].dataManager = new LocalDataManager(
list,
pageNo,
pageSize
);
// 处理分页
const { pageNo, pageSize, list } = this.tableList[index];
this.tableList[index].dataManager = new LocalDataManager(
list,
pageNo,
pageSize
);
}
});
}
},
@@ -255,12 +229,13 @@ export default {
/** 查询 */
async handleQuery() {
const { data } = this.$axios({
url: '/monitoring/equipment-monitor/runLog',
method: 'get',
params: this.queryParams,
});
console.log('data', data);
this.handleResponse(
await this.$axios({
url: '/monitoring/equipment-monitor/runLog',
method: 'get',
params: this.queryParams,
})
);
},
async handleSearchBarBtnClick({ btnName, timeVal }) {