123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- <template>
- <div class="snapshot-statistics-point-list-container layout-padding">
- <div class="layout-padding-auto layout-padding-view pd20">
- <vxe-grid v-bind="gridOptions" v-on="gridEvents" ref="gridRef">
- <template #form>
- <el-form :model="state.queryParams" ref="ruleFormRef" @submit.native.prevent inline :disabled="state.loading">
- <el-form-item prop="crTime">
- <statistical-time v-model="state.queryParams.crTime" @change="handleQuery" ref="statisticalTimeRef" :disabled="state.loading" />
- </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-form-item>
- </el-form>
- </template>
- </vxe-grid>
- </div>
- </div>
- </template>
- <script setup lang="tsx" name="snapshotStatisticsPointList">
- import { defineAsyncComponent, onMounted, reactive, ref, computed } from 'vue';
- import { ElMessage, FormInstance } from 'element-plus';
- import Other from '@/utils/other';
- import { getSSPStatisticsIntegralArea, getSSPStatisticsIntegralAreaExport } from '@/api/snapshot/statistics';
- import { defaultDate } from '@/utils/constants';
- // 引入组件
- const StatisticalTime = defineAsyncComponent(() => import('@/components/StatisticalTime/index.vue')); // 日期类型选择组件
- // 定义变量内容
- const state = reactive<any>({
- queryParams: {
- // 查询条件
- SortField: null,
- SortRule: null,
- crTime: defaultDate,
- StartTime: null,
- EndTime: null,
- },
- tableData: [], //表单
- loading: false, // 加载
- });
- const requestParams = ref<EmptyObjectType>({});
- const gridOptions = reactive<any>({
- loading: false,
- border: true,
- showOverflow: true,
- columnConfig: {
- resizable: true,
- },
- scrollY: {
- enabled: true,
- gt: 100,
- },
- toolbarConfig: {
- zoom: true,
- custom: true,
- refresh: {
- queryMethod: () => {
- handleQuery();
- },
- },
- tools: [{ toolRender: { name: 'exportCurrent' } }, { toolRender: { name: 'exportAll' } }],
- },
- params: {
- exportMethod: getSSPStatisticsIntegralAreaExport,
- exportParams: requestParams,
- },
- customConfig: {
- storage: true,
- },
- id: 'snapshotStatisticsPointList',
- rowConfig: { isHover: true, height: 30, isCurrent: true, useKey: true },
- height: 'auto',
- columns: [
- { field: 'phoneNumber', title: '区域' },
- { field: 'totalPoints', title: '历史总积分' },
- { field: 'outPoints', title: '已兑换积分' },
- ],
- data: [],
- sortConfig: {
- remote: true,
- },
- });
- const gridEvents = {
- sortChange(val: any) {
- state.queryParams.SortField = val.order ? val.field : null;
- // 0 升序 1 降序
- state.queryParams.SortRule = val.order ? (val.order == 'desc' ? 1 : 0) : null;
- handleQuery();
- },
- };
- // 手动查询,将页码设置为1
- const handleQuery = () => {
- state.queryParams.PageIndex = 1;
- queryList();
- };
- // 改变页码
- const queryList = () => {
- return new Promise((resolve, reject) => {
- 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'); // 删除无用的参数
- state.loading = true;
- gridOptions.loading = true;
- getSSPStatisticsIntegralArea(requestParams.value)
- .then((response: any) => {
- gridOptions.data = response?.result ?? [];
- state.loading = false;
- gridOptions.loading = false;
- resolve(response);
- })
- .catch(() => {
- state.loading = false;
- gridOptions.loading = false;
- reject();
- });
- });
- };
- /** 重置按钮操作 */
- const ruleFormRef = ref<FormInstance>();
- const resetQuery = (formEl: FormInstance | undefined) => {
- if (!formEl) return;
- formEl.resetFields();
- queryList();
- };
- onMounted(() => {
- queryList();
- });
- </script>
|