Explorar el Código

reactor:甄别重新发起修改为班长办理对象不必选;

zhangchong hace 4 meses
padre
commit
c152757595

+ 101 - 53
src/views/statistics/order/detailAreaTime.vue

@@ -1,43 +1,30 @@
 <template>
 	<div class="statistics-order-detail-area-time-container layout-padding">
-    <div class="layout-padding-auto layout-padding-view pd20">
+		<div class="layout-padding-auto layout-padding-view pd20">
 			<div class="table-search-content">
-        <el-form :model="state.queryParams" ref="ruleFormRef" @submit.native.prevent inline>
+				<el-form :model="state.queryParams" ref="ruleFormRef" @submit.native.prevent inline>
 					<el-form-item prop="crTime">
-						<statistical-time v-model="state.queryParams.crTime" @change="handleQuery" ref="statisticalTimeRef" :disabled="state.loading"/>
+						<statistical-time v-model="state.queryParams.crTime" @change="handleQuery" ref="statisticalTimeRef" :disabled="state.loading" />
 					</el-form-item>
-          <el-form-item label="来电主体" prop="IdentityType">
-            <el-select v-model="state.queryParams.IdentityType" placeholder="请选择来电主体" @change="handleQuery">
-              <el-option :value="0" label="全部" />
-              <el-option :value="1" label="市民" />
-              <el-option :value="2" label="企业" />
-            </el-select>
-          </el-form-item>
-          <el-form-item>
-            <el-button type="primary" @click="handleQuery" :loading="state.loading"> <SvgIcon name="ele-Search" class="mr5" />查询 </el-button>
-            <el-button @click="resetQuery(ruleFormRef)" class="default-button" :loading="state.loading">
-              <SvgIcon name="ele-Refresh" class="mr5" />重置
-            </el-button>
-            <el-button type="primary" @click="onDetail" :loading="state.loading"> <SvgIcon name="ele-PieChart" class="mr5" />图表 </el-button>
-          </el-form-item>
-        </el-form>
-      </div>
-			<ProTable
-				ref="proTableRef"
-				:columns="columns"
-				:data="state.tableData"
-				@updateTable="queryList"
-				:loading="state.loading"
-				border
-				:pagination="false"
-				:toolButton="['refresh', 'setting', 'exportAll']"
-				:key="Math.random()"
-				:exportMethod="orderAreaTimeExport"
-				:exportParams="requestParams"
-				show-summary
-				isSpecialExport
-			>
-			</ProTable>
+					<el-form-item label="来电主体" prop="IdentityType">
+						<el-select v-model="state.queryParams.IdentityType" placeholder="请选择来电主体" @change="handleQuery">
+							<el-option :value="0" label="全部" />
+							<el-option :value="1" label="市民" />
+							<el-option :value="2" label="企业" />
+						</el-select>
+					</el-form-item>
+					<el-form-item>
+						<el-button type="primary" @click="handleQuery" :loading="state.loading"> <SvgIcon name="ele-Search" class="mr5" />查询 </el-button>
+						<el-button @click="resetQuery(ruleFormRef)" class="default-button" :loading="state.loading">
+							<SvgIcon name="ele-Refresh" class="mr5" />重置
+						</el-button>
+						<el-button type="primary" @click="onDetail" :loading="state.loading"> <SvgIcon name="ele-PieChart" class="mr5" />图表 </el-button>
+					</el-form-item>
+				</el-form>
+			</div>
+			<div style="overflow: hidden; width: 100%; height: 100%; flex: 1">
+				<vxe-grid v-bind="gridOptions"> </vxe-grid>
+			</div>
 		</div>
 	</div>
 </template>
@@ -48,10 +35,9 @@ import { orderAreaTime, orderAreaTimeExport } from '@/api/statistics/order';
 import { defaultDate } from '@/utils/constants';
 import { useRouter } from 'vue-router';
 import Other from '@/utils/other';
+import XEUtils from 'xe-utils';
 
 const StatisticalTime = defineAsyncComponent(() => import('@/components/StatisticalTime/index.vue')); // 日期类型选择组件
-// 表格配置项
-const columns = ref<any[]>([]);
 // 定义变量内容
 const ruleFormRef = ref<RefType>(); // 表单ref
 const state = reactive<any>({
@@ -69,26 +55,76 @@ const handleQuery = () => {
 	// state.queryParams.PageIndex = 1;
 	queryList();
 };
+const requestParams = ref<EmptyObjectType>({});
+const gridOptions = reactive<any>({
+	loading: false,
+	border: true,
+	showOverflow: true,
+	printConfig: {},
+	columnConfig: {
+		resizable: true,
+	},
+	scrollY: {
+		enabled: false,
+	},
+	toolbarConfig: {
+		zoom: true,
+		custom: true,
+		refresh: {
+			queryMethod: () => {
+				queryList();
+			},
+		},
+		tools: [{ toolRender: { name: 'exportAll' } }],
+	},
+	customConfig: {
+		storage: true,
+	},
+	showFooter: true,
+	footerMethod: ({ columns, data }) => {
+		return [
+			columns.map((column: any, columnIndex: number) => {
+				if (columnIndex === 0) {
+					return '合计';
+				}
+				return XEUtils.sum(data, column.property);
+			}),
+		];
+	},
+	id: 'statisticsOrderDetailAreaTime',
+	rowConfig: { isHover: true, height: 30, isCurrent: true, useKey: true },
+	height: 'auto',
+	columns: [],
+	data: [],
+	params: {
+		exportMethod: orderAreaTimeExport,
+		exportParams: requestParams,
+		isSpecialExport: true,
+	},
+});
 /** 获取列表 */
-const requestParams = ref({});
 const queryList = async () => {
 	state.loading = true;
+	gridOptions.loading = true;
 	try {
 		requestParams.value = Other.deepClone(state.queryParams);
 		requestParams.value.StartTime = state.queryParams.crTime === null ? null : state.queryParams.crTime[0];
 		requestParams.value.EndTime = state.queryParams.crTime === null ? null : state.queryParams.crTime[1];
 		Reflect.deleteProperty(requestParams.value, 'crTime');
 		const { result } = await orderAreaTime(requestParams.value);
-		columns.value = result.titleData?.map((item: any) => {
+		let columns = result.titleData?.map((item: any) => {
 			return {
 				prop: item.key,
 				label: item.value,
+				field: item.key,
+				title: item.value,
 				align: 'center',
-				minWidth: 90,
+				sortable: true,
+				minWidth: 110,
 			};
 		});
 		// 计算横轴小计
-		state.tableData = result?.item.map((item: any) => {
+		const tableData = result?.item.map((item: any) => {
 			let subtotal = 0;
 			for (let i of result.titleData) {
 				subtotal += item[i.key];
@@ -98,21 +134,33 @@ const queryList = async () => {
 				subtotal,
 			};
 		});
-		columns.value.unshift({
-			prop: 'Hour',
-			label: '时间段',
-			align: 'center',
-			minWidth: 120,
-			fixed: 'left',
-		});
-		columns.value.push({
-			prop: 'subtotal',
-			label: '小计',
-			align: 'center',
-		});
+		columns.unshift(
+			{
+				prop: 'Hour',
+				label: '时间段',
+				field: 'Hour',
+				title: '时间段',
+				align: 'center',
+				minWidth: 120,
+				fixed: 'left',
+			},
+			{
+				prop: 'subtotal',
+				label: '小计',
+				align: 'center',
+				field: 'subtotal',
+				title: '小计',
+				minWidth: 120,
+				sortable: true,
+			}
+		);
+		gridOptions.data = tableData;
+		gridOptions.columns = columns;
 		state.loading = false;
+		gridOptions.loading = false;
 	} catch (e) {
 		state.loading = false;
+		gridOptions.loading = false;
 		console.log(e);
 	}
 };

+ 102 - 54
src/views/statistics/order/detailHotSpotTime.vue

@@ -1,43 +1,30 @@
 <template>
 	<div class="statistics-order-detail-hotspot-time-container layout-padding">
-    <div class="layout-padding-auto layout-padding-view pd20">
-      <div class="table-search-content">
-        <el-form :model="state.queryParams" ref="ruleFormRef" @submit.native.prevent inline>
+		<div class="layout-padding-auto layout-padding-view pd20">
+			<div class="table-search-content">
+				<el-form :model="state.queryParams" ref="ruleFormRef" @submit.native.prevent inline>
 					<el-form-item prop="crTime">
-						<statistical-time v-model="state.queryParams.crTime" @change="handleQuery" ref="statisticalTimeRef" :disabled="state.loading"/>
+						<statistical-time v-model="state.queryParams.crTime" @change="handleQuery" ref="statisticalTimeRef" :disabled="state.loading" />
 					</el-form-item>
-          <el-form-item label="来电主体" prop="IdentityType">
-            <el-select v-model="state.queryParams.IdentityType" placeholder="请选择来电主体" @change="handleQuery">
-              <el-option :value="0" label="全部" />
-              <el-option :value="1" label="市民" />
-              <el-option :value="2" label="企业" />
-            </el-select>
-          </el-form-item>
-          <el-form-item>
-            <el-button type="primary" @click="handleQuery" :loading="state.loading"> <SvgIcon name="ele-Search" class="mr5" />查询 </el-button>
-            <el-button @click="resetQuery(ruleFormRef)" class="default-button" :loading="state.loading">
-              <SvgIcon name="ele-Refresh" class="mr5" />重置
-            </el-button>
-            <el-button type="primary" @click="onDetail" :loading="state.loading"> <SvgIcon name="ele-PieChart" class="mr5" />图表 </el-button>
-          </el-form-item>
-        </el-form>
-      </div>
-			<ProTable
-				ref="proTableRef"
-				:columns="columns"
-				:data="state.tableData"
-				@updateTable="queryList"
-				:loading="state.loading"
-				border
-				:pagination="false"
-				:toolButton="['refresh', 'setting', 'exportAll']"
-				:key="Math.random()"
-				:exportMethod="orderHotTimeExport"
-				:exportParams="requestParams"
-				show-summary
-				isSpecialExport
-			>
-			</ProTable>
+					<el-form-item label="来电主体" prop="IdentityType">
+						<el-select v-model="state.queryParams.IdentityType" placeholder="请选择来电主体" @change="handleQuery">
+							<el-option :value="0" label="全部" />
+							<el-option :value="1" label="市民" />
+							<el-option :value="2" label="企业" />
+						</el-select>
+					</el-form-item>
+					<el-form-item>
+						<el-button type="primary" @click="handleQuery" :loading="state.loading"> <SvgIcon name="ele-Search" class="mr5" />查询 </el-button>
+						<el-button @click="resetQuery(ruleFormRef)" class="default-button" :loading="state.loading">
+							<SvgIcon name="ele-Refresh" class="mr5" />重置
+						</el-button>
+						<el-button type="primary" @click="onDetail" :loading="state.loading"> <SvgIcon name="ele-PieChart" class="mr5" />图表 </el-button>
+					</el-form-item>
+				</el-form>
+			</div>
+			<div style="overflow: hidden; width: 100%; height: 100%; flex: 1">
+				<vxe-grid v-bind="gridOptions"> </vxe-grid>
+			</div>
 		</div>
 	</div>
 </template>
@@ -48,10 +35,9 @@ import { orderHotTime, orderHotTimeExport } from '@/api/statistics/order';
 import { defaultDate } from '@/utils/constants';
 import { useRouter } from 'vue-router';
 import Other from '@/utils/other';
+import XEUtils from 'xe-utils';
 
 const StatisticalTime = defineAsyncComponent(() => import('@/components/StatisticalTime/index.vue')); // 日期类型选择组件
-// 表格配置项
-const columns = ref<any[]>([]);
 // 定义变量内容
 const ruleFormRef = ref<RefType>(); // 表单ref
 const state = reactive<any>({
@@ -69,26 +55,76 @@ const handleQuery = () => {
 	// state.queryParams.PageIndex = 1;
 	queryList();
 };
+const requestParams = ref<EmptyObjectType>({});
+const gridOptions = reactive<any>({
+	loading: false,
+	border: true,
+	showOverflow: true,
+	printConfig: {},
+	columnConfig: {
+		resizable: true,
+	},
+	scrollY: {
+		enabled: false,
+	},
+	toolbarConfig: {
+		zoom: true,
+		custom: true,
+		refresh: {
+			queryMethod: () => {
+				queryList();
+			},
+		},
+		tools: [{ toolRender: { name: 'exportAll' } }],
+	},
+	customConfig: {
+		storage: true,
+	},
+	showFooter: true,
+	footerMethod: ({ columns, data }) => {
+		return [
+			columns.map((column: any, columnIndex: number) => {
+				if (columnIndex === 0) {
+					return '合计';
+				}
+				return XEUtils.sum(data, column.property);
+			}),
+		];
+	},
+	id: 'statisticsOrderDetailHotspotTime',
+	rowConfig: { isHover: true, height: 30, isCurrent: true, useKey: true },
+	height: 'auto',
+	columns: [],
+	data: [],
+	params: {
+		exportMethod: orderHotTimeExport,
+		exportParams: requestParams,
+		isSpecialExport: true,
+	},
+});
 /** 获取列表 */
-const requestParams = ref({});
 const queryList = async () => {
 	state.loading = true;
+	gridOptions.loading = true;
 	try {
 		requestParams.value = Other.deepClone(state.queryParams);
 		requestParams.value.StartTime = state.queryParams.crTime === null ? null : state.queryParams.crTime[0];
 		requestParams.value.EndTime = state.queryParams.crTime === null ? null : state.queryParams.crTime[1];
 		Reflect.deleteProperty(requestParams.value, 'crTime');
 		const res = await orderHotTime(requestParams.value);
-		columns.value = res.result.titleData?.map((item: any) => {
+		let columns = res.result.titleData?.map((item: any) => {
 			return {
 				prop: item.key,
 				label: item.value,
+				field: item.key,
+				title: item.value,
 				align: 'center',
-				minWidth: 90,
+				sortable: true,
+				minWidth: 110,
 			};
 		});
 		// 计算横轴小计
-		state.tableData = res.result?.item.map((item: any) => {
+		const tableData = res.result?.item.map((item: any) => {
 			let subtotal = 0;
 			for (let i of res.result.titleData) {
 				subtotal += item[i.key];
@@ -98,21 +134,33 @@ const queryList = async () => {
 				subtotal,
 			};
 		});
-		columns.value.unshift({
-			prop: 'Hour',
-			label: '时间段',
-			align: 'center',
-			minWidth: 120,
-			fixed: 'left',
-		});
-		columns.value.push({
-			prop: 'subtotal',
-			label: '小计',
-			align: 'center',
-		});
+		columns.unshift(
+			{
+				prop: 'Hour',
+				label: '时间段',
+				field: 'Hour',
+				title: '时间段',
+				align: 'center',
+				minWidth: 120,
+				fixed: 'left',
+			},
+			{
+				prop: 'subtotal',
+				label: '小计',
+				align: 'center',
+				field: 'subtotal',
+				title: '小计',
+				minWidth: 120,
+				sortable: true,
+			}
+		);
+		gridOptions.data = tableData;
+		gridOptions.columns = columns;
+		gridOptions.loading = false;
 		state.loading = false;
 	} catch (e) {
 		state.loading = false;
+		gridOptions.loading = false;
 		console.log(e);
 	}
 };

+ 83 - 37
src/views/statistics/order/timeArea.vue

@@ -25,24 +25,9 @@
 					<v-chart class="chart" :option="option" :loading="state.loading" autoresize />
 				</el-col>
 				<el-col :xs="24" :sm="24" :md="24" :lg="8" :xl="8">
-					<ProTable
-						ref="proTableRef"
-						:columns="columns"
-						:data="state.tableData"
-						@updateTable="queryList"
-						:loading="state.loading"
-						:pagination="false"
-						border
-						:tool-button="false"
-						max-height="70vh"
-						:toolButton="['refresh', 'setting', 'exportAll']"
-						:key="Math.random()"
-						:exportMethod="orderAreaTimeExport"
-						:exportParams="requestParams"
-						show-summary
-						isSpecialExport
-					>
-					</ProTable>
+					<div style="height: 70vh">
+						<vxe-grid v-bind="gridOptions"> </vxe-grid>
+					</div>
 				</el-col>
 			</el-row>
 		</el-card>
@@ -55,10 +40,9 @@ import { defaultDate } from '@/utils/constants';
 import Other from '@/utils/other';
 import { orderAreaTime, orderAreaTimeExport } from '@/api/statistics/order';
 import { useRouter } from 'vue-router';
+import XEUtils from 'xe-utils';
 
 const StatisticalTime = defineAsyncComponent(() => import('@/components/StatisticalTime/index.vue')); // 日期类型选择组件
-// 表格配置项
-const columns = ref<any[]>([]);
 // 定义变量内容
 const ruleFormRef = ref<RefType>(); // 表单ref
 const state = reactive<any>({
@@ -69,7 +53,6 @@ const state = reactive<any>({
 		StartTime: null,
 		EndTime: null,
 	},
-	tableData: [], //表单
 	loading: false, // 加载
 	total: 0, // 总数
 	callForwardingSource: [],
@@ -79,26 +62,76 @@ const handleQuery = () => {
 	// state.queryParams.PageIndex = 1;
 	queryList();
 };
-/** 获取列表 */
 const requestParams = ref<EmptyObjectType>({});
+const gridOptions = reactive<any>({
+	loading: false,
+	border: true,
+	showOverflow: true,
+	printConfig: {},
+	columnConfig: {
+		resizable: true,
+	},
+	scrollY: {
+		enabled: false,
+	},
+	toolbarConfig: {
+		zoom: true,
+		custom: true,
+		refresh: {
+			queryMethod: () => {
+				queryList();
+			},
+		},
+		tools: [{ toolRender: { name: 'exportAll' } }],
+	},
+	customConfig: {
+		storage: true,
+	},
+	showFooter: true,
+	footerMethod: ({ columns, data }) => {
+		return [
+			columns.map((column: any, columnIndex: number) => {
+				if (columnIndex === 0) {
+					return '合计';
+				}
+				return XEUtils.sum(data, column.property);
+			}),
+		];
+	},
+	id: 'statisticsOrderTimeArea',
+	rowConfig: { isHover: true, height: 30, isCurrent: true, useKey: true },
+	height: 'auto',
+	columns: [],
+	data: [],
+	params: {
+		exportMethod: orderAreaTimeExport,
+		exportParams: requestParams,
+		isSpecialExport: true,
+	},
+});
+/** 获取列表 */
 const queryList = async () => {
 	state.loading = true;
+	gridOptions.loading = true;
 	try {
 		requestParams.value = Other.deepClone(state.queryParams);
 		requestParams.value.StartTime = state.queryParams.crTime === null ? null : state.queryParams.crTime[0];
 		requestParams.value.EndTime = state.queryParams.crTime === null ? null : state.queryParams.crTime[1];
 		Reflect.deleteProperty(requestParams.value, 'crTime');
 		const res = await orderAreaTime(requestParams.value);
-		columns.value = res.result.titleData?.map((item: any) => {
+		let columns = res.result.titleData?.map((item: any) => {
 			return {
 				prop: item.key,
 				label: item.value,
 				align: 'center',
-				minWidth: 90,
+				field: item.key,
+				title: item.value,
+				sortable: true,
+				minWidth: 110,
 			};
 		});
 		// 计算横轴小计
-		state.tableData = res.result?.item.map((item: any) => {
+		const tableData = res.result?.item.map((item: any) => {
 			let subtotal = 0;
 			for (let i of res.result.titleData) {
 				subtotal += item[i.key];
@@ -108,19 +141,30 @@ const queryList = async () => {
 				subtotal,
 			};
 		});
-		columns.value.unshift({
-			prop: 'Hour',
-			label: '时间段',
-			align: 'center',
-			minWidth: 120,
-			fixed: 'left',
-		});
-		columns.value.push({
-			prop: 'subtotal',
-			label: '小计',
-			align: 'center',
-		});
 
+		columns.unshift(
+			{
+				prop: 'Hour',
+				label: '时间段',
+				field: 'Hour',
+				title: '时间段',
+				align: 'center',
+				minWidth: 120,
+				fixed: 'left',
+			},
+			{
+				prop: 'subtotal',
+				label: '小计',
+				align: 'center',
+				field: 'subtotal',
+				title: '小计',
+				minWidth: 120,
+				sortable: true,
+			}
+		);
+
+		gridOptions.data = tableData;
+		gridOptions.columns = columns;
 		// 图标数据与组装
 		const legendData = res.result.titleData?.map((item: any) => {
 			return item.value;
@@ -142,8 +186,10 @@ const queryList = async () => {
 		}
 		setOption(legendData, xData, seriesData);
 		state.loading = false;
+		gridOptions.loading = false;
 	} catch (e) {
 		state.loading = false;
+		gridOptions.loading = false;
 		console.log(e);
 	}
 };

+ 84 - 39
src/views/statistics/order/timeHotspot.vue

@@ -3,7 +3,7 @@
 		<el-card shadow="never">
 			<el-form :model="state.queryParams" ref="ruleFormRef" @submit.native.prevent inline>
 				<el-form-item prop="crTime">
-					<statistical-time v-model="state.queryParams.crTime" @change="handleQuery" ref="statisticalTimeRef" :disabled="state.loading"/>
+					<statistical-time v-model="state.queryParams.crTime" @change="handleQuery" ref="statisticalTimeRef" :disabled="state.loading" />
 				</el-form-item>
 				<el-form-item label="来电主体" prop="IdentityType">
 					<el-select v-model="state.queryParams.IdentityType" placeholder="请选择来电主体" @change="handleQuery">
@@ -25,24 +25,9 @@
 					<v-chart class="chart" :option="option" :loading="state.loading" autoresize />
 				</el-col>
 				<el-col :xs="24" :sm="24" :md="24" :lg="8" :xl="8">
-					<ProTable
-						ref="proTableRef"
-						:columns="columns"
-						:data="state.tableData"
-						@updateTable="queryList"
-						:loading="state.loading"
-						:pagination="false"
-						border
-						:tool-button="false"
-						max-height="70vh"
-						:toolButton="['refresh', 'setting', 'exportAll']"
-						:key="Math.random()"
-						:exportMethod="orderHotTimeExport"
-						:exportParams="requestParams"
-						show-summary
-						isSpecialExport
-					>
-					</ProTable>
+					<div style="height: 70vh">
+						<vxe-grid v-bind="gridOptions"> </vxe-grid>
+					</div>
 				</el-col>
 			</el-row>
 		</el-card>
@@ -55,10 +40,9 @@ import { defaultDate } from '@/utils/constants';
 import Other from '@/utils/other';
 import { orderHotTime, orderHotTimeExport } from '@/api/statistics/order';
 import { useRouter } from 'vue-router';
+import XEUtils from 'xe-utils';
 
 const StatisticalTime = defineAsyncComponent(() => import('@/components/StatisticalTime/index.vue')); // 日期类型选择组件
-// 表格配置项
-const columns = ref<any[]>([]);
 // 定义变量内容
 const ruleFormRef = ref<RefType>(); // 表单ref
 const state = reactive<any>({
@@ -79,26 +63,76 @@ const handleQuery = () => {
 	// state.queryParams.PageIndex = 1;
 	queryList();
 };
-/** 获取列表 */
 const requestParams = ref<EmptyObjectType>({});
+const gridOptions = reactive<any>({
+	loading: false,
+	border: true,
+	showOverflow: true,
+	printConfig: {},
+	columnConfig: {
+		resizable: true,
+	},
+	scrollY: {
+		enabled: false,
+	},
+	toolbarConfig: {
+		zoom: true,
+		custom: true,
+		refresh: {
+			queryMethod: () => {
+				queryList();
+			},
+		},
+		tools: [{ toolRender: { name: 'exportAll' } }],
+	},
+	customConfig: {
+		storage: true,
+	},
+	showFooter: true,
+	footerMethod: ({ columns, data }) => {
+		return [
+			columns.map((column: any, columnIndex: number) => {
+				if (columnIndex === 0) {
+					return '合计';
+				}
+				return XEUtils.sum(data, column.property);
+			}),
+		];
+	},
+	id: 'statisticsOrderTimeHotspot',
+	rowConfig: { isHover: true, height: 30, isCurrent: true, useKey: true },
+	height: 'auto',
+	columns: [],
+	data: [],
+	params: {
+		exportMethod: orderHotTimeExport,
+		exportParams: requestParams,
+		isSpecialExport: true,
+	},
+});
+/** 获取列表 */
 const queryList = async () => {
 	state.loading = true;
+	gridOptions.loading = true;
 	try {
 		requestParams.value = Other.deepClone(state.queryParams);
 		requestParams.value.StartTime = state.queryParams.crTime === null ? null : state.queryParams.crTime[0];
 		requestParams.value.EndTime = state.queryParams.crTime === null ? null : state.queryParams.crTime[1];
 		Reflect.deleteProperty(requestParams.value, 'crTime');
 		const res = await orderHotTime(requestParams.value);
-		columns.value = res.result.titleData?.map((item: any) => {
+		let columns = res.result.titleData?.map((item: any) => {
 			return {
 				prop: item.key,
 				label: item.value,
+				field: item.key,
+				title: item.value,
 				align: 'center',
-				minWidth: 90,
+				sortable: true,
+				minWidth: 110,
 			};
 		});
 		// 计算横轴小计
-		state.tableData = res.result?.item.map((item: any) => {
+		const tableData = res.result?.item.map((item: any) => {
 			let subtotal = 0;
 			for (let i of res.result.titleData) {
 				subtotal += item[i.key];
@@ -108,19 +142,26 @@ const queryList = async () => {
 				subtotal,
 			};
 		});
-		columns.value.unshift({
-			prop: 'Hour',
-			label: '时间段',
-			align: 'center',
-			minWidth: 120,
-			fixed: 'left',
-		});
-		columns.value.push({
-			prop: 'subtotal',
-			label: '小计',
-			align: 'center',
-		});
-
+		columns.unshift(
+			{
+				prop: 'Hour',
+				label: '时间段',
+				field: 'Hour',
+				title: '时间段',
+				align: 'center',
+				minWidth: 120,
+				fixed: 'left',
+			},
+			{
+				prop: 'subtotal',
+				label: '小计',
+				align: 'center',
+				field: 'subtotal',
+				title: '小计',
+				minWidth: 120,
+				sortable: true,
+			}
+		);
 		// 图标数据与组装
 		const legendData = res.result.titleData?.map((item: any) => {
 			return item.value;
@@ -128,7 +169,9 @@ const queryList = async () => {
 		const xData = res.result.item?.map((item: any) => {
 			return item.Hour;
 		});
-		let seriesData:EmptyArrayType = [];
+		gridOptions.data = tableData;
+		gridOptions.columns = columns;
+		let seriesData: EmptyArrayType = [];
 		// 将数据转换成柱状图数据
 		for (let i of res.result.titleData) {
 			seriesData.push({
@@ -142,8 +185,10 @@ const queryList = async () => {
 		}
 		setOption(legendData, xData, seriesData);
 		state.loading = false;
+		gridOptions.loading = false;
 	} catch (e) {
 		state.loading = false;
+		gridOptions.loading = false;
 		console.log(e);
 	}
 };