update 设备全参数

这个提交包含在:
lb 2023-09-07 17:01:22 +08:00
父节点 c7b32ab34e
当前提交 6197b606f1
共有 2 个文件被更改,包括 143 次插入311 次删除

查看文件

@ -12,93 +12,56 @@
ref="search-bar" ref="search-bar"
@headBtnClick="handleSearchBarBtnClick" /> @headBtnClick="handleSearchBarBtnClick" />
<div class="tables"> <!-- <base-table
<div class="custom-table"> :table-props="[
<!-- <base-table { type: 'index', label: '序号' },
:key="1 + '__basetable'" { prop: 'name', label: '设备名称', align: 'center' },
:table-props="table1.tableProps" { prop: 'code', label: '设备代码', align: 'center' },
:page="table1.pageNo" { prop: 'time', label: '时间', align: 'center' },
:limit="table1.pageSize" ]"
:table-data="table1.data" :table-data="[
@emitFun="(val) => handleEmitFun(table1, val)"></base-table> { index: 1, name: '1', code: 'c1', time: '2021-08-31 09:14:19' },
<pagination { index: 2, name: '2', code: 'c2', time: '2021-08-31 09:14:19' },
v-show="table1.total > 0" { index: 3, name: '3', code: 'c3', time: '2021-08-31 09:14:19' },
:total="table1.total" { index: 4, name: '4', code: 'c4', time: '2021-08-31 09:14:19' },
:page.sync="table1.pageNo" { index: 5, name: '5', code: 'c5', time: '2021-08-31 09:14:19' },
:limit.sync="table1.pageSize" ]"
:page-size="table1.pageSize" :span-method="
:page-sizes="[1, 3, 5, 10, 20]" ({ rowIndex, columnIndex }) => {
@pagination="(val) => getListFor(table1, val)" /> --> if (rowIndex == 1 && columnIndex == 0) {
</div> return [1, 3];
<base-table }
:key="2 + '__basetable'" return [1, 1];
:table-props="table2.tableProps" }
:page="1" "
:limit="999" @emitFun="(val) => handleEmitFun(table, val)"></base-table> -->
:table-data="table2.data"
@emitFun="(val) => handleEmitFun(table2, val)"></base-table> <div class="tables-s">
<base-table <div class="custom-table" v-for="table in tableList" :key="table.key">
:key="3 + '__basetable'" <!-- {{ JSON.stringify(spanMethod) }} -->
:table-props="table3.tableProps"
:page="1"
:limit="999"
:table-data="table3.data"
@emitFun="(val) => handleEmitFun(table3, val)"></base-table>
<base-table
:key="4 + '__basetable'"
:table-props="table4.tableProps"
:page="1"
:limit="999"
:table-data="table4.data"
@emitFun="(val) => handleEmitFun(table4, val)"></base-table>
<base-table
:key="5 + '__basetable'"
:table-props="table5.tableProps"
:page="1"
:limit="999"
:table-data="table5.data"
@emitFun="(val) => handleEmitFun(table5, val)"></base-table>
<base-table
:key="6 + '__basetable'"
:table-props="table6.tableProps"
:page="1"
:limit="999"
:table-data="table6.data"
@emitFun="(val) => handleEmitFun(table6, val)"></base-table>
<base-table
:key="7 + '__basetable'"
:table-props="table7.tableProps"
:page="1"
:limit="999"
:table-data="table7.data"
@emitFun="(val) => handleEmitFun(table7, val)"></base-table>
</div>
<!-- <div class="tables">
<div class="table-wrapper" v-for="table in tableList" :key="table.key">
<div class="table-title">PLC 1</div>
<base-table <base-table
:key="table.key + '__basetable'" :key="table.key + '__basetable'"
:table-props="table.tableProps" :table-props="table.tableProps"
:page="1" :table-data="table.list"
:limit="999" :span-method="spanMethod"
:table-data="table.data" @emitFun="(val) => handleEmitFun(table, val)"></base-table>
@emitFun="(val) => handleEmitFun(table, val)">
</base-table>
<pagination <pagination
:key="table.key + '__pagination'"
v-show="table.total > 0" v-show="table.total > 0"
:total="table.total" :total="table.total"
:page.sync="table.queryParams.pageNo" :page.sync="table.pageNo"
:limit.sync="table.queryParams.pageSize" :limit.sync="table.pageSize"
:page-size="table.pageSize"
:page-sizes="[1, 3, 5, 10, 20]"
@pagination="(val) => getListFor(table, val)" /> @pagination="(val) => getListFor(table, val)" />
</div> </div>
</div> --> </div>
</div> </div>
</template> </template>
<script> <script>
import LocalDataManager from './utils/local-data-manager'; import LocalDataManager from './utils/local-data-manager';
import response from './response'; import response from './response';
export default { export default {
name: 'EquipmentFullParams', name: 'EquipmentFullParams',
@ -152,229 +115,16 @@ export default {
id: null, id: null,
time: [new Date(aWeekAgo), new Date(today)], time: [new Date(aWeekAgo), new Date(today)],
}, },
tableList: [
table1: { {
tableProps: [ key: 'base-table__key__1',
{ tableProps: [],
prop: 'time', list: [],
label: '时间', pageNo: 1,
}, pageSize: 3,
{ total: 0,
prop: 'plcCode', },
label: 'PLC编码', ],
},
{
prop: 'val1',
label: '数值1',
},
{
prop: 'bol1',
label: '布尔1',
},
{
prop: 'val2',
label: '数值2',
},
{
prop: 'bol2',
label: '布尔2',
},
{
prop: 'val3',
label: '数值3',
},
{
prop: 'bol3',
label: '布尔3',
},
{
prop: 'val4',
label: '数值4',
},
{
prop: 'bol4',
label: '布尔4',
},
],
data: table1LDM.dataList,
pageNo: table1LDM.pageNo,
pageSize: table1LDM.pageSize,
total: table1LDM.total,
},
table2: {
tableProps: [
{
prop: 'time',
label: '时间',
},
{
prop: 'plcCode',
label: 'PLC编码',
},
{
prop: 'val1',
label: '数值1',
},
{
prop: 'bol1',
label: '布尔1',
},
{
prop: 'val2',
label: '数值2',
},
{
prop: 'bol2',
label: '布尔2',
},
],
data: [],
},
table3: {
tableProps: [
{
prop: 'time',
label: '时间',
},
{
prop: 'plcCode',
label: 'PLC编码',
},
{
prop: 'val1',
label: '数值1',
},
{
prop: 'bol1',
label: '布尔1',
},
{
prop: 'val2',
label: '数值2',
},
{
prop: 'bol2',
label: '布尔2',
},
],
data: [],
},
table4: {
tableProps: [
{
prop: 'time',
label: '时间',
},
{
prop: 'plcCode',
label: 'PLC编码',
},
{
prop: 'val1',
label: '数值1',
},
{
prop: 'bol1',
label: '布尔1',
},
{
prop: 'val2',
label: '数值2',
},
{
prop: 'bol2',
label: '布尔2',
},
],
data: [],
},
table5: {
tableProps: [
{
prop: 'time',
label: '时间',
},
{
prop: 'plcCode',
label: 'PLC编码',
},
{
prop: 'val1',
label: '数值1',
},
{
prop: 'bol1',
label: '布尔1',
},
{
prop: 'val2',
label: '数值2',
},
{
prop: 'bol2',
label: '布尔2',
},
],
data: [],
},
table6: {
tableProps: [
{
prop: 'time',
label: '时间',
},
{
prop: 'plcCode',
label: 'PLC编码',
},
{
prop: 'val1',
label: '数值1',
},
{
prop: 'bol1',
label: '布尔1',
},
{
prop: 'val2',
label: '数值2',
},
{
prop: 'bol2',
label: '布尔2',
},
],
data: [],
},
table7: {
tableProps: [
{
prop: 'time',
label: '时间',
},
{
prop: 'plcCode',
label: 'PLC编码',
},
{
prop: 'val1',
label: '数值1',
},
{
prop: 'bol1',
label: '布尔1',
},
{
prop: 'val2',
label: '数值2',
},
{
prop: 'bol2',
label: '布尔2',
},
],
data: [],
},
}; };
}, },
computed: { computed: {
@ -394,14 +144,104 @@ export default {
this.$set(this.searchBarFormConfig[0], 'defaultSelect', this.code); this.$set(this.searchBarFormConfig[0], 'defaultSelect', this.code);
if (this.name) if (this.name)
this.$set(this.searchBarFormConfig[1], 'defaultSelect', this.name); this.$set(this.searchBarFormConfig[1], 'defaultSelect', this.name);
this.handleResponse();
}, },
methods: { methods: {
buildProps(table) {
console.log('building props', table);
// otherList props
const { otherList } = table;
const props = [
{
// type: 'index',
width: 48,
prop: 'index',
label: '序号',
align: 'center',
// children: [{ label: ' []-[][/]' }],
},
{
width: 128,
prop: 'time',
label: '时间',
align: 'center',
// children: [{ label: ' []-[][/]' }],
},
{
width: 128,
prop: 'plcCode',
label: 'PLC编码',
align: 'center',
// children: [{ label: ' []-[][/]' }],
},
];
const firstLineData = {
index: '参考值: [最小]-[最大][/标准]',
time: '参考值: [最小]-[最大][/标准]',
plcCode: '参考值: [最小]-[最大][/标准]',
};
otherList.forEach((item) => {
props.push({
label: item.name,
align: 'center',
// children: [
// {
// prop: item.name,
// align: 'center',
// label: `${item.minValue ?? ''}-${item.maxValue ?? ''}${
// item.defaultValue != null ? '/' + item.defaultValue : ''
// }`,
// },
// ],
});
firstLineData[item.name] = `${item.minValue ?? ''}-${
item.maxValue ?? ''
}${item.defaultValue != null ? '/' + item.defaultValue : ''}`;
});
console.log('new props:', props);
return { props, firstLineData };
},
handleResponse() {
const { code, data } = response;
if (code == 0) {
console.log('response', code, data);
data.forEach((table, index) => {
console.log('handle index:', index, table);
const { props: tableProps, firstLineData } = this.buildProps(table);
this.$set(this.tableList, index, {
key: 'base-table__key__' + index,
tableProps,
list: [firstLineData],
pageNo: 1,
pageSize: 5,
total: 0,
});
});
}
},
injectFirstLine(table) {
// table
},
getList(dataManager, pageNo, pageSize) { getList(dataManager, pageNo, pageSize) {
dataManager.setPageNo(pageNo); dataManager.setPageNo(pageNo);
dataManager.setPageSize(pageSize); dataManager.setPageSize(pageSize);
return { data: dataManager.dataList, total: dataManager.total }; return { data: dataManager.dataList, total: dataManager.total };
}, },
spanMethod({ row, column, rowIndex, columnIndex }) {
console.log('span method', row, column, rowIndex, columnIndex);
if (rowIndex == 1 && columnIndex == 0) {
console.log('herer..............');
return [1, 3];
}
console.log('therer..............');
return [1, 1];
},
/** 查询 */ /** 查询 */
async handleQuery() { async handleQuery() {
const { data } = this.$axios({ const { data } = this.$axios({
@ -425,16 +265,6 @@ export default {
console.log('table val', table, val); console.log('table val', table, val);
}, },
/** 构造 props */
buildProps() {
this.tableList.forEach((table) => {
this.buildTableProp(table);
});
},
/** 构造一个 tableProps - 根据动态结构 */
buildTableProp(table) {},
/** 为某个 table 获取 list 数据 */ /** 为某个 table 获取 list 数据 */
getListFor(table, val) { getListFor(table, val) {
console.log('get list for', table, val); console.log('get list for', table, val);

查看文件

@ -33,7 +33,8 @@ export default {
"plcParamName": "P1V2", "plcParamName": "P1V2",
"name": "P1V2", "name": "P1V2",
"minValue": 10, "minValue": 10,
"maxValue": 90 "maxValue": 90,
"defaultValue": 24
}, },
{ {
"id": "attr-3", "id": "attr-3",
@ -53,15 +54,16 @@ export default {
"id": "attr-5", "id": "attr-5",
"plcParamName": "P1V5", "plcParamName": "P1V5",
"name": "P1V5", "name": "P1V5",
"minValue": 10, "minValue": null,
"maxValue": 99 "maxValue": null
}, },
{ {
"id": "attr-6", "id": "attr-6",
"plcParamName": "P1V6", "plcParamName": "P1V6",
"name": "P1V6", "name": "P1V6",
"minValue": 10, "minValue": null,
"maxValue": 90 "maxValue": null,
"defaultValue": false
}, },
], ],
"nameData": [], "nameData": [],