test #47
@ -1,4 +0,0 @@
|
|||||||
/**
|
|
||||||
* 用于调整服务器返回的动态数据
|
|
||||||
*/
|
|
||||||
export default function handleDynamicData() {}
|
|
@ -3,7 +3,7 @@
|
|||||||
* @param {*} nameData
|
* @param {*} nameData
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export default function handleNameData(nameData) {
|
export function handleNameData(nameData) {
|
||||||
const props = step1(nameData.filter((item) => item.tree == 1));
|
const props = step1(nameData.filter((item) => item.tree == 1));
|
||||||
step2(
|
step2(
|
||||||
props,
|
props,
|
||||||
@ -42,3 +42,22 @@ function step2(firstTierProps, tree2) {
|
|||||||
function notRepeat(propArray, name) {
|
function notRepeat(propArray, name) {
|
||||||
return propArray.every((item) => item.label !== name);
|
return propArray.every((item) => item.label !== name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用于调整服务器返回的动态数据
|
||||||
|
* @param {*} dynamicData
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function handleDynamicData(dynamicData) {
|
||||||
|
return dynamicData.map((dd) => {
|
||||||
|
const initData = {
|
||||||
|
inspectionContent: dd.inspectionDetContent,
|
||||||
|
};
|
||||||
|
dd.data.forEach((column) => {
|
||||||
|
column.children.forEach((ch) => {
|
||||||
|
initData[`${column.dynamicName}-${ch.dynamicName}`] = ch.dynamicValue;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return initData;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
@ -11,7 +11,10 @@
|
|||||||
:formConfigs="[{ label: '近24小时检测记录', type: 'title' }]"
|
:formConfigs="[{ label: '近24小时检测记录', type: 'title' }]"
|
||||||
ref="search-bar" />
|
ref="search-bar" />
|
||||||
<!-- <pre><code v-html="jsondemo"></code></pre> -->
|
<!-- <pre><code v-html="jsondemo"></code></pre> -->
|
||||||
|
|
||||||
|
<el-skeleton v-if="initing" :rows="6" animated />
|
||||||
<base-table
|
<base-table
|
||||||
|
v-else
|
||||||
:table-props="tableProps"
|
:table-props="tableProps"
|
||||||
:page="queryParams.pageNo"
|
:page="queryParams.pageNo"
|
||||||
:limit="queryParams.pageSize"
|
:limit="queryParams.pageSize"
|
||||||
@ -22,8 +25,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import response from './response.json';
|
import response from './response.json';
|
||||||
import handleNameData from '@/utils/dynamicProps';
|
import { handleNameData, handleDynamicData } from '@/utils/dynamicProps';
|
||||||
import handleDynamicData from '@/utils/dynamicData';
|
|
||||||
// import hljs from 'highlight.js/lib/highlight';
|
// import hljs from 'highlight.js/lib/highlight';
|
||||||
// import json from 'highlight.js/lib/languages/json';
|
// import json from 'highlight.js/lib/languages/json';
|
||||||
// import 'highlight.js/styles/github-gist.css';
|
// import 'highlight.js/styles/github-gist.css';
|
||||||
@ -36,24 +38,21 @@ export default {
|
|||||||
props: {},
|
props: {},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
initing: false,
|
||||||
queryParams: {
|
queryParams: {
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
},
|
},
|
||||||
// jsondemo: '',
|
// jsondemo: '',
|
||||||
list: [
|
list: [
|
||||||
{
|
// {
|
||||||
inspectionContent: '检测内容1',
|
// inspectionContent: '检测内容1',
|
||||||
'2023-03-18T00:00:00-产线1': '产线1-asdf',
|
// '2023-03-18T00:00:00-产线1': '产线1-asdf',
|
||||||
'2023-03-18T01:00:00-产线2': '产线2-kldf',
|
// '2023-03-18T01:00:00-产线2': '产线2-kldf',
|
||||||
'2023-03-18T02:00:00-产线1': '产线1-vasdkj',
|
// '2023-03-18T02:00:00-产线1': '产线1-vasdkj',
|
||||||
},
|
// },
|
||||||
],
|
],
|
||||||
tableProps: [
|
tableProps: [
|
||||||
{
|
|
||||||
type: 'index',
|
|
||||||
label: '序号'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
prop: 'inspectionContent',
|
prop: 'inspectionContent',
|
||||||
label: '检测内容',
|
label: '检测内容',
|
||||||
@ -86,11 +85,16 @@ export default {
|
|||||||
data: { data: dyanmicData, nameData },
|
data: { data: dyanmicData, nameData },
|
||||||
} = response;
|
} = response;
|
||||||
|
|
||||||
|
this.initing = true;
|
||||||
const dynamicProps = handleNameData(nameData);
|
const dynamicProps = handleNameData(nameData);
|
||||||
this.tableProps.push(...dynamicProps)
|
this.tableProps.push(...dynamicProps);
|
||||||
const [dataList, length] = handleDynamicData(dyanmicData);
|
const dataList = handleDynamicData(dyanmicData);
|
||||||
this.list = dataList;
|
this.list = dataList;
|
||||||
this.queryParams.pageSize = length;
|
this.queryParams.pageSize = dataList.length;
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
this.initing = false;
|
||||||
|
}, 1000);
|
||||||
},
|
},
|
||||||
|
|
||||||
handleEmitFun(payload) {
|
handleEmitFun(payload) {
|
||||||
|
Loading…
Reference in New Issue
Block a user