flat: 数据统计结构更改

This commit is contained in:
Apcallover
2024-04-07 16:01:18 +08:00
parent c5e1853831
commit 981b359684
3 changed files with 40 additions and 39 deletions

View File

@@ -20,9 +20,9 @@ import {confirmCount} from '@/api/report/report'
import CustomLoading from "@/components/Custom-Loading/index.vue"; import CustomLoading from "@/components/Custom-Loading/index.vue";
import { dateFormat } from "@/util/date"; import { dateFormat } from "@/util/date";
const columnEnum = { const columnEnum = {
'totalCount': '总数', 'data1': '总数',
'otherCount': '机构登记数', 'data2': '机构登记数',
'registerCount': '总库(其他)', 'data3': '总库(其他)',
} }
const pages = { total: 0, size: 10, currentPage: 1 } const pages = { total: 0, size: 10, currentPage: 1 }
const baseOptions = { const baseOptions = {
@@ -59,27 +59,28 @@ export default {
computed: { computed: {
options() { options() {
const tableHead = this.headColum.map((item, index) => ({ const tableHead = this.headColum.map((item, index) => ({
label: item.columnName, label: item.gname,
display:false, display:false,
children: Object.keys(columnEnum).map((key) => ({ children: Object.keys(columnEnum).map((key) => ({
label: columnEnum[key], label: columnEnum[key],
prop: `${index}_${item.id}_${key}`, prop: `${index}_${item.gid}_${key}`,
display:false, display:false,
width: 120, width: 100,
})) }))
})) }))
console.log('tableHead',tableHead) const headTitle = {
return {
...baseOptions,
height: 200,
width:200,
column: [{
label: '机构名称', label: '机构名称',
prop: 'name', prop: 'name',
search: true, search: true,
fixed: true, fixed: true,
}
if(this.infoPages.total !== 0) {headTitle.width = 200}
return {
...baseOptions,
height: 200,
width:200, width:200,
}, column: [
headTitle,
...tableHead, ...tableHead,
{ {
label: '日期', label: '日期',
@@ -127,13 +128,12 @@ export default {
} }
let resData = await confirmCount(params) let resData = await confirmCount(params)
if(resData.data.code === 200) { if(resData.data.code === 200) {
const { list, columnInfo } = resData.data.data const { current, size ,total, records } = resData.data.data
const { current, size ,total, records } = list
this.infoData = records.map((item) => ({ this.infoData = records.map((item) => ({
...item, ...item,
...this.decompose(item.list) ...this.decompose(item.list)
})) }))
console.log('infoData',this.infoData) const columnInfo = records.length ? records[0].list : []
this.headColum = columnInfo this.headColum = columnInfo
this.infoPages = { ...this.infoPages, currentPage: current, total, size} this.infoPages = { ...this.infoPages, currentPage: current, total, size}
this.visible = false; this.visible = false;
@@ -147,8 +147,8 @@ export default {
let obj = {} let obj = {}
for (let i = 0; i < list.length; i++) { for (let i = 0; i < list.length; i++) {
const item = list[i] const item = list[i]
Object.keys(item).forEach((vitem) => { Object.keys(item.dataVO).forEach((vitem) => {
obj[`${i}_${item.id}_${vitem}`] = item[vitem] obj[`${i}_${item.gid}_${vitem}`] = item.dataVO[vitem]
}) })
} }
return obj return obj

View File

@@ -20,9 +20,9 @@ import {potentialCount} from '@/api/report/report'
import CustomLoading from "@/components/Custom-Loading/index.vue"; import CustomLoading from "@/components/Custom-Loading/index.vue";
import { dateFormat } from "@/util/date"; import { dateFormat } from "@/util/date";
const columnEnum = { const columnEnum = {
'totalCount': '总数', 'data1': '总数',
'otherCount': '机构登记数', 'data2': '机构登记数',
'registerCount': '总库(其他)', 'data3': '总库(其他)',
} }
const pages = { total: 0, size: 10, currentPage: 1 } const pages = { total: 0, size: 10, currentPage: 1 }
const baseOptions = { const baseOptions = {
@@ -51,6 +51,7 @@ export default {
visible: false, visible: false,
search: {}, search: {},
headColum: [], headColum: [],
} }
}, },
created() { created() {
@@ -59,27 +60,28 @@ export default {
computed: { computed: {
options() { options() {
const tableHead = this.headColum.map((item, index) => ({ const tableHead = this.headColum.map((item, index) => ({
label: item.columnName, label: item.gname,
display:false, display:false,
children: Object.keys(columnEnum).map((key) => ({ children: Object.keys(columnEnum).map((key) => ({
label: columnEnum[key], label: columnEnum[key],
prop: `${index}_${item.id}_${key}`, prop: `${index}_${item.gid}_${key}`,
display:false, display:false,
width: 120, width: 100,
})) }))
})) }))
console.log('tableHead',tableHead) const headTitle = {
return {
...baseOptions,
height: 200,
width:200,
column: [{
label: '机构名称', label: '机构名称',
prop: 'name', prop: 'name',
search: true, search: true,
fixed: true, fixed: true,
}
if(this.infoPages.total !== 0) {headTitle.width = 200}
return {
...baseOptions,
height: 200,
width:200, width:200,
}, column: [
headTitle,
...tableHead, ...tableHead,
{ {
label: '日期', label: '日期',
@@ -127,13 +129,12 @@ export default {
} }
let resData = await potentialCount(params) let resData = await potentialCount(params)
if(resData.data.code === 200) { if(resData.data.code === 200) {
const { list, columnInfo } = resData.data.data const { current, size ,total, records } = resData.data.data
const { current, size ,total, records } = list
this.infoData = records.map((item) => ({ this.infoData = records.map((item) => ({
...item, ...item,
...this.decompose(item.list) ...this.decompose(item.list)
})) }))
console.log('infoData',this.infoData) const columnInfo = records.length ? records[0].list : []
this.headColum = columnInfo this.headColum = columnInfo
this.infoPages = { ...this.infoPages, currentPage: current, total, size} this.infoPages = { ...this.infoPages, currentPage: current, total, size}
this.visible = false; this.visible = false;
@@ -147,8 +148,8 @@ export default {
let obj = {} let obj = {}
for (let i = 0; i < list.length; i++) { for (let i = 0; i < list.length; i++) {
const item = list[i] const item = list[i]
Object.keys(item).forEach((vitem) => { Object.keys(item.dataVO).forEach((vitem) => {
obj[`${i}_${item.id}_${vitem}`] = item[vitem] obj[`${i}_${item.gid}_${vitem}`] = item.dataVO[vitem]
}) })
} }
return obj return obj

View File

@@ -23,7 +23,7 @@ module.exports = {
port: 1888, port: 1888,
proxy: { proxy: {
"/api": { "/api": {
target: 'http://192.168.1.106:8000', target: 'http://192.168.1.108:8000',
ws: true, ws: true,
changeOrigin: true, changeOrigin: true,
pathRewrite: { pathRewrite: {