Handy_Cao 1 rok temu
rodzic
commit
0f18491e7a

+ 56 - 30
src/packages/pc/views/report/broker/index.vue

@@ -2,21 +2,20 @@
 <template>
     <app-view>
         <template #header>
-            <el-form ref="formRef" class="el-form--filter" :model="queryParams" :rules="formRules"
-            :show-message="false">
+            <el-form ref="formRef" class="el-form--filter" :model="queryParams" :rules="formRules" :show-message="false">
             <el-form-item label="报表类型" prop="cycletype">
-                    <el-select v-model="queryParams.cycletype" @change="onTypeChange">
+                    <el-select v-model="queryParams.cycletype">
                         <el-option v-for="item in getReportTypeList()" :key="item.value" :label="item.label"
                             :value="item.value" />
                     </el-select>
                 </el-form-item>
                 <el-form-item label="开始日期" prop="reckondate">
                     <el-date-picker :type="dateType" v-model="queryParams.reckondate" :format="dateFormat"
-                    :value-format="dateFormat" placeholder="请选择日期"/>
+                    :value-format="dateFormat" placeholder="请选择日期" @change="onReckonDateChange" />
                 </el-form-item>
                 <el-form-item label="结束日期" prop="reckondateend">
                     <el-date-picker :type="dateType" v-model="queryParams.reckondateend" :format="dateFormat"
-                    :value-format="dateFormat" placeholder="请选择日期"/>
+                    :value-format="dateFormat" placeholder="请选择日期" @change="onReckonEndDateChange"/>
                 </el-form-item>
                 <el-form-item label="开始季度" prop="quarter" v-if="queryParams.cycletype === ReportType.Quarter">
                     <el-select v-model="queryParams.quarter">
@@ -38,6 +37,7 @@
                 </el-form-item>
                 <el-form-item>
                     <el-button type="primary" @click="onSearch">查询</el-button>
+                    <el-button type="primary" @click="onSearch(false)">重置</el-button>
                 </el-form-item>
             </el-form>
             <div class="report-account__info" v-if="selectedAccount">
@@ -62,7 +62,7 @@
 </template>
 
 <script lang="ts" setup>
-import { shallowRef, reactive, ref, computed } from 'vue'
+import { shallowRef, ref, computed } from 'vue'
 import { ElMessage, FormInstance, FormRules } from 'element-plus'
 import { useRequest } from '@/hooks/request'
 import { orgReportQuery } from '@/services/api/report'
@@ -80,11 +80,10 @@ const formRef = shallowRef<FormInstance>()
 const isson = ref(true)
 const selectedAccount = shallowRef<Model.TAAccountChildrenSelectRsp>()
 
-const queryParams = reactive<Model.OrgReportQueryReq>({
+const queryParams = ref<Partial<Model.OrgReportQueryReq>>({
     orgztypes: userStore.userInfo.orgztypes,
     cycletype: 0,
-    reckondate: '',
-    reckondateend: ''
+    type: isson.value ? 1 : 0
 })
 
 const { componentMap, componentId, record, openComponent, closeComponent, getFilteredButtons } = useOperation<Model.OrgReportQueryRsp>({
@@ -92,13 +91,12 @@ const { componentMap, componentId, record, openComponent, closeComponent, getFil
 })
 
 const { dataList, total, pageSize, pageIndex, loading, run } = useRequest(orgReportQuery, {
+    manual: true,
     params: {
-        cycletype: 0,
-        reckondate: '',
-        reckondateend: '',
         pageNum: 1,
         pageSize: 20,
-        orgztypes: userStore.userInfo.orgztypes
+        orgztypes: userStore.userInfo.orgztypes,
+        type: isson.value ? 1 : 0
     },
     onError: (err) => {
         ElMessage.error(err)
@@ -107,7 +105,7 @@ const { dataList, total, pageSize, pageIndex, loading, run } = useRequest(orgRep
 
 // 日期类型
 const dateType = computed(() => {
-    switch (queryParams.cycletype) {
+    switch (queryParams.value.cycletype) {
         case ReportType.Week:
             return 'week'
         case ReportType.Month:
@@ -120,10 +118,9 @@ const dateType = computed(() => {
     }
 })
 
-
 // 日期格式
 const dateFormat = computed(() => {
-    switch (queryParams.cycletype) {
+    switch (queryParams.value.cycletype) {
         case ReportType.Month:
             return 'YYYY-MM'
         case ReportType.Quarter:
@@ -134,19 +131,36 @@ const dateFormat = computed(() => {
     }
 })
 
-const onTypeChange = (value: ReportType) => {
-    const dateValue = queryParams.reckondate
-    if (dateValue) {
-        switch (value) {
+const onReckonDateChange = () => {
+    const reckondate = queryParams.value.reckondate
+    if (reckondate) {
+        switch (queryParams.value.cycletype) {
             case ReportType.Month:
-            queryParams.reckondate = formatDate(dateValue, 'YYYY-MM')
+            queryParams.value.reckondate = formatDate(reckondate, 'YYYY-MM')
                 break
             case ReportType.Quarter:
             case ReportType.Year:
-            queryParams.reckondate = formatDate(dateValue, 'YYYY')
+            queryParams.value.reckondate = formatDate(reckondate, 'YYYY')
                 break
             default:
-            queryParams.reckondate = formatDate(dateValue, 'YYYY-MM-DD')
+            queryParams.value.reckondate = formatDate(reckondate, 'YYYY-MM-DD')
+        }
+    }   
+}
+
+const onReckonEndDateChange = () => {
+    const reckondateend = queryParams.value.reckondateend
+    if (reckondateend) {
+        switch (queryParams.value.cycletype) {
+            case ReportType.Month:
+            queryParams.value.reckondateend = formatDate(reckondateend, 'YYYY-MM')
+                break
+            case ReportType.Quarter:
+            case ReportType.Year:
+            queryParams.value.reckondateend = formatDate(reckondateend, 'YYYY')
+                break
+            default:
+            queryParams.value.reckondateend = formatDate(reckondateend, 'YYYY-MM-DD')
         }
     }
 }
@@ -179,7 +193,22 @@ const onAccountChange = (item?: Model.TAAccountChildrenSelectRsp) => {
 }
 
 const onSearch = (clear = false) => {
-    processRequiredParams((qs) => run(qs), clear)
+    if (!clear) {
+        queryParams.value = {
+            cycletype: 0,
+            reckondate: '',
+            reckondateend: '',
+            type: isson.value ? 1 : 0,
+            orgztypes: userStore.userInfo.orgztypes
+        }
+    } else {
+        queryParams.value.type = isson.value ? 1 : 0
+        formRef.value?.validate((valid) => {
+            if (valid) {
+                run(queryParams.value)
+            }
+        })
+    }
 }
 
 const openComponentOnClick = (code: string) => {
@@ -188,12 +217,9 @@ const openComponentOnClick = (code: string) => {
 
 // 处理请求参数
 const processRequiredParams = (callback: (params: Model.OrgReportQueryReq) => void, clear = false) => {
-    queryParams.type = isson.value ? 1 : 0
-    formRef.value?.validate((valid) => {
-        if (valid) {
-            callback(queryParams)
-        }
-    })
+    queryParams.value.type = isson.value ? 1 : 0
+    queryParams.value.orgztypes = userStore.userInfo.orgztypes
+    onSearch(!clear)
 }
 
 </script>

+ 50 - 23
src/packages/pc/views/report/investor/index.vue

@@ -2,21 +2,20 @@
 <template>
     <app-view>
         <template #header>
-            <el-form ref="formRef" class="el-form--filter" :model="queryParams" :rules="formRules"
-                :show-message="false">
+            <el-form ref="formRef" class="el-form--filter" :model="queryParams" :rules="formRules" :show-message="false">
                 <el-form-item label="报表类型" prop="cycletype">
-                    <el-select v-model="queryParams.cycletype" @change="onTypeChange">
+                    <el-select v-model="queryParams.cycletype">
                         <el-option v-for="item in getReportTypeList()" :key="item.value" :label="item.label"
                             :value="item.value" />
                     </el-select>
                 </el-form-item>
                 <el-form-item label="开始日期" prop="reckondate">
                     <el-date-picker :type="dateType" v-model="queryParams.reckondate" :format="dateFormat"
-                    :value-format="dateFormat" placeholder="请选择日期"/>
+                    :value-format="dateFormat" placeholder="请选择日期" @change="onReckonDateChange" />
                 </el-form-item>
                 <el-form-item label="结束日期" prop="reckondateend">
                     <el-date-picker :type="dateType" v-model="queryParams.reckondateend" :format="dateFormat"
-                    :value-format="dateFormat" placeholder="请选择日期"/>
+                    :value-format="dateFormat" placeholder="请选择日期" @change="onReckonEndDateChange" />
                 </el-form-item>
                 <el-form-item label="开始季度" prop="quarter" v-if="queryParams.cycletype === ReportType.Quarter">
                     <el-select v-model="queryParams.quarter">
@@ -41,6 +40,7 @@
                 </el-form-item>
                 <el-form-item>
                     <el-button type="primary" @click="onSearch">查询</el-button>
+                    <el-button type="primary" @click="onSearch(false)">重置</el-button>
                 </el-form-item>
             </el-form>
             <div class="report-account__info" v-if="selectedAccount">
@@ -65,7 +65,7 @@
 </template>
 
 <script lang="ts" setup>
-import { shallowRef, reactive, computed } from 'vue'
+import { shallowRef, ref, computed } from 'vue'
 import { ElMessage, FormInstance, FormRules } from 'element-plus'
 import { useRequest } from '@/hooks/request'
 import { investorReportQuery } from '@/services/api/report'
@@ -82,7 +82,7 @@ const formRef = shallowRef<FormInstance>()
 const userStore = useUserStore()
 const selectedAccount = shallowRef<Model.TAAccountChildrenSelectRsp>()
 
-const queryParams = reactive<Model.InvestorReportReq>({
+const queryParams = ref<Partial<Model.InvestorReportReq>>({
     orgztypes: userStore.userInfo.orgztypes,
     cycletype: 0
 })
@@ -92,6 +92,7 @@ const { componentMap, componentId, record, openComponent, closeComponent, getFil
 })
 
 const { dataList, total, pageSize, pageIndex, loading, run } = useRequest(investorReportQuery, {
+    manual: true,
     params: {
         cycletype: 0,
         pageNum: 1,
@@ -105,7 +106,7 @@ const { dataList, total, pageSize, pageIndex, loading, run } = useRequest(invest
 
 // 日期类型
 const dateType = computed(() => {
-    switch (queryParams.cycletype) {
+    switch (queryParams.value.cycletype) {
         case ReportType.Week:
             return 'week'
         case ReportType.Month:
@@ -118,10 +119,9 @@ const dateType = computed(() => {
     }
 })
 
-
 // 日期格式
 const dateFormat = computed(() => {
-    switch (queryParams.cycletype) {
+    switch (queryParams.value.cycletype) {
         case ReportType.Month:
             return 'YYYY-MM'
         case ReportType.Quarter:
@@ -132,19 +132,36 @@ const dateFormat = computed(() => {
     }
 })
 
-const onTypeChange = (value: ReportType) => {
-    const dateValue = queryParams.reckondate
-    if (dateValue) {
-        switch (value) {
+const onReckonDateChange = () => {
+    const reckondate = queryParams.value.reckondate
+    if (reckondate) {
+        switch (queryParams.value.cycletype) {
             case ReportType.Month:
-            queryParams.reckondate = formatDate(dateValue, 'YYYY-MM')
+            queryParams.value.reckondate = formatDate(reckondate, 'YYYY-MM')
                 break
             case ReportType.Quarter:
             case ReportType.Year:
-            queryParams.reckondate = formatDate(dateValue, 'YYYY')
+            queryParams.value.reckondate = formatDate(reckondate, 'YYYY')
                 break
             default:
-            queryParams.reckondate = formatDate(dateValue, 'YYYY-MM-DD')
+            queryParams.value.reckondate = formatDate(reckondate, 'YYYY-MM-DD')
+        }
+    }   
+}
+
+const onReckonEndDateChange = () => {
+    const reckondateend = queryParams.value.reckondateend
+    if (reckondateend) {
+        switch (queryParams.value.cycletype) {
+            case ReportType.Month:
+            queryParams.value.reckondateend = formatDate(reckondateend, 'YYYY-MM')
+                break
+            case ReportType.Quarter:
+            case ReportType.Year:
+            queryParams.value.reckondateend = formatDate(reckondateend, 'YYYY')
+                break
+            default:
+            queryParams.value.reckondateend = formatDate(reckondateend, 'YYYY-MM-DD')
         }
     }
 }
@@ -184,7 +201,20 @@ const onAccountChange = (item?: Model.TAAccountChildrenSelectRsp) => {
 }
 
 const onSearch = (clear = false) => {
-    processRequiredParams((qs) => run(qs), clear)
+    if (!clear) {
+        queryParams.value = {
+            cycletype: 0,
+            reckondate: '',
+            reckondateend: '',
+            orgztypes: userStore.userInfo.orgztypes
+        }
+    } else {
+        formRef.value?.validate((valid) => {
+            if (valid) {
+                run(queryParams.value)
+            }
+        })
+    }
 }
 
 const openComponentOnClick = (code: string) => {
@@ -193,11 +223,8 @@ const openComponentOnClick = (code: string) => {
 
 // 处理请求参数
 const processRequiredParams = (callback: (params: Model.InvestorReportReq) => void, clear = false) => {
-    formRef.value?.validate((valid) => {
-        if (valid) {
-            callback(queryParams)
-        }
-    })
+    queryParams.value.orgztypes = userStore.userInfo.orgztypes
+    onSearch(!clear)
 }
 
 </script>

+ 33 - 18
src/packages/pc/views/report/profitshare/index.vue

@@ -4,14 +4,14 @@
         <template #header>
             <el-form ref="formRef" class="el-form--filter" :model="queryParams" :rules="formRules" :show-message="false">
                 <el-form-item label="报表类型" prop="cycletype">
-                    <el-select v-model="queryParams.cycletype" @change="onTypeChange">
+                    <el-select v-model="queryParams.cycletype">
                         <el-option v-for="item in getReportTypeList()" :key="item.value" :label="item.label"
                             :value="item.value" />
                     </el-select>
                 </el-form-item>
                 <el-form-item label="日期" prop="cycletime">
                     <el-date-picker :type="dateType" v-model="queryParams.cycletime" :format="dateFormat"
-                    :value-format="dateFormat" placeholder="请选择日期"/>
+                    :value-format="dateFormat" placeholder="请选择日期"  @change="onTypeChange" />
                 </el-form-item>
                 <el-form-item label="季度" prop="quarter" v-if="queryParams.cycletype === ReportType.Quarter">
                     <el-select v-model="queryParams.quarter">
@@ -24,6 +24,7 @@
                 </el-form-item>
                 <el-form-item>
                     <el-button type="primary" @click="onSearch">查询</el-button>
+                    <el-button type="primary" @click="onSearch(false)">重置</el-button>
                 </el-form-item>
             </el-form>
         </template>
@@ -43,7 +44,7 @@
 </template>
 
 <script lang="ts" setup>
-import { shallowRef, reactive, computed, ref } from 'vue'
+import { shallowRef, computed, ref } from 'vue'
 import { ElMessage, FormInstance, FormRules } from 'element-plus'
 import { useRequest } from '@/hooks/request'
 import { formatDate } from '@/filters'
@@ -59,10 +60,11 @@ const formRef = shallowRef<FormInstance>()
 const userStore = useUserStore()
 const isson = ref(true)
 
-const queryParams = reactive<Model.ShareAmountQueryReq>({
+const queryParams = ref<Partial<Model.ShareAmountQueryReq>>({
     orgztypes: userStore.userInfo.orgztypes,
     cycletype: 0,
-    cycletime: ''
+    cycletime: '',
+    isson: isson.value ? 1 : 0
 })
 
 const { componentMap, componentId, record, openComponent, closeComponent, getFilteredButtons } = useOperation<Model.ShareAmountQueryRsp>({
@@ -70,9 +72,11 @@ const { componentMap, componentId, record, openComponent, closeComponent, getFil
 })
 
 const { dataList, total, pageSize, pageIndex, loading, run } = useRequest(shareAmountQuery, {
+    manual: true,
     params: {
         pageNum: 1,
         pageSize: 20,
+        isson: isson.value ? 1 : 0,
         orgztypes: userStore.userInfo.orgztypes
     },
     onError: (err) => {
@@ -82,7 +86,7 @@ const { dataList, total, pageSize, pageIndex, loading, run } = useRequest(shareA
 
 // 日期类型
 const dateType = computed(() => {
-    switch (queryParams.cycletype) {
+    switch (queryParams.value.cycletype) {
         case ReportType.Week:
             return 'week'
         case ReportType.Month:
@@ -98,7 +102,7 @@ const dateType = computed(() => {
 
 // 日期格式
 const dateFormat = computed(() => {
-    switch (queryParams.cycletype) {
+    switch (queryParams.value.cycletype) {
         case ReportType.Month:
             return 'YYYY-MM'
         case ReportType.Quarter:
@@ -110,18 +114,18 @@ const dateFormat = computed(() => {
 })
 
 const onTypeChange = (value: ReportType) => {
-    const dateValue = queryParams.cycletime
+    const dateValue = queryParams.value.cycletime
     if (dateValue) {
         switch (value) {
             case ReportType.Month:
-            queryParams.cycletime = formatDate(dateValue, 'YYYY-MM')
+            queryParams.value.cycletime = formatDate(dateValue, 'YYYY-MM')
                 break
             case ReportType.Quarter:
             case ReportType.Year:
-            queryParams.cycletime = formatDate(dateValue, 'YYYY')
+            queryParams.value.cycletime = formatDate(dateValue, 'YYYY')
                 break
             default:
-            queryParams.cycletime = formatDate(dateValue, 'YYYY-MM-DD')
+            queryParams.value.cycletime = formatDate(dateValue, 'YYYY-MM-DD')
         }
     }
 }
@@ -142,7 +146,21 @@ const formRules: FormRules = {
 }
 
 const onSearch = (clear = false) => {
-    processRequiredParams((qs) => run(qs), clear)
+    if (!clear) {
+        queryParams.value = {
+            cycletype: 0,
+            cycletime: '',
+            isson: isson.value ? 1 : 0,
+            orgztypes: userStore.userInfo.orgztypes
+        }
+    } else {
+        queryParams.value.isson = isson.value ? 1 : 0
+        formRef.value?.validate((valid) => {
+            if (valid) {
+                run(queryParams.value)
+            }
+        })
+    }
 }
 
 const openComponentOnClick = (code: string) => {
@@ -151,12 +169,9 @@ const openComponentOnClick = (code: string) => {
 
 // 处理请求参数
 const processRequiredParams = (callback: (params: Model.ShareAmountQueryReq) => void, clear = false) => {
-    queryParams.isson = isson.value ? 1 : 0
-    formRef.value?.validate((valid) => {
-        if (valid) {
-            callback(queryParams)
-        }
-    })
+    queryParams.value.type = isson.value ? 1 : 0
+    queryParams.value.orgztypes = userStore.userInfo.orgztypes
+    onSearch(!clear)
 }
 
 </script>

+ 26 - 24
src/packages/pc/views/report/trade/index.vue

@@ -2,16 +2,16 @@
 <template>
     <app-view>
         <template #header>
-            <el-form ref="formRef" class="el-form--filter" :model="queryParams" :rules="formRules">
+            <el-form ref="formRef" class="el-form--filter" :model="queryParams" :rules="formRules" :show-message="false" >
                 <el-form-item label="报表类型" prop="cycletype">
-                    <el-select v-model="queryParams.cycletype" @change="onTypeChange">
+                    <el-select v-model="queryParams.cycletype" >
                         <el-option v-for="item in getReportTypeList()" :key="item.value" :label="item.label"
                             :value="item.value" />
                     </el-select>
                 </el-form-item>
                 <el-form-item label="日期" prop="cycletime">
                     <el-date-picker :type="dateType" v-model="queryParams.cycletime" :format="dateFormat"
-                    :value-format="dateFormat" placeholder="请选择日期"/>
+                    :value-format="dateFormat" placeholder="请选择日期" @change="onTypeChange"/>
                 </el-form-item>
                 <el-form-item label="季度" prop="quarter" v-if="queryParams.cycletype === ReportType.Quarter">
                     <el-select v-model="queryParams.quarter">
@@ -24,7 +24,7 @@
                 </el-form-item>
                 <el-form-item>
                     <el-button type="primary" @click="onSearch">查询</el-button>
-                    <el-button type="danger" @click="onSearch(false)"> 重置</el-button>
+                    <el-button type="danger" @click="onSearch(false)">重置</el-button>
                 </el-form-item>
             </el-form>
             <div class="report-account__info" v-if="selectedAccount">
@@ -49,7 +49,7 @@
 </template>
 
 <script lang="ts" setup>
-import { shallowRef, reactive, computed } from 'vue'
+import { shallowRef, ref, computed } from 'vue'
 import { ElMessage, FormInstance, FormRules } from 'element-plus'
 import { useRequest } from '@/hooks/request'
 import { queryTrade } from '@/services/api/report'
@@ -61,7 +61,7 @@ import AppPagination from '@pc/components/base/pagination/index.vue'
 import AppOperation from '@pc/components/base/operation/index.vue'
 import AppSelectAccount from '@pc/components/modules/select-account/index.vue'
 
-const queryParams = reactive<Model.TradeReq>({
+const queryParams = ref<Partial<Model.TradeReq>>({
     cycletype: 0,
     cycletime: ''
 })
@@ -73,6 +73,7 @@ const { componentMap, componentId, record, openComponent, closeComponent, getFil
 })
 
 const { dataList, total, pageSize, pageIndex, loading, run } = useRequest(queryTrade, {
+    manual: true,
     params: {
         pageNum: 1,
         pageSize: 20,
@@ -86,7 +87,7 @@ const { dataList, total, pageSize, pageIndex, loading, run } = useRequest(queryT
 
 // 日期类型
 const dateType = computed(() => {
-    switch (queryParams.cycletype) {
+    switch (queryParams.value.cycletype) {
         case ReportType.Week:
             return 'week'
         case ReportType.Month:
@@ -102,7 +103,7 @@ const dateType = computed(() => {
 
 // 日期格式
 const dateFormat = computed(() => {
-    switch (queryParams.cycletype) {
+    switch (queryParams.value.cycletype) {
         case ReportType.Month:
             return 'YYYY-MM'
         case ReportType.Quarter:
@@ -114,18 +115,18 @@ const dateFormat = computed(() => {
 })
 
 const onTypeChange = (value: ReportType) => {
-    const dateValue = queryParams.cycletime
+    const dateValue = queryParams.value.cycletime
     if (dateValue) {
         switch (value) {
             case ReportType.Month:
-            queryParams.cycletime = formatDate(dateValue, 'YYYY-MM')
+            queryParams.value.cycletime = formatDate(dateValue, 'YYYY-MM')
                 break
             case ReportType.Quarter:
             case ReportType.Year:
-            queryParams.cycletime = formatDate(dateValue, 'YYYY')
+            queryParams.value.cycletime = formatDate(dateValue, 'YYYY')
                 break
             default:
-            queryParams.cycletime = formatDate(dateValue, 'YYYY-MM-DD')
+            queryParams.value.cycletime = formatDate(dateValue, 'YYYY-MM-DD')
         }
     }
 }
@@ -151,7 +152,18 @@ const formRules: FormRules = {
 }
 
 const onSearch = (clear = false) => {
-    processRequiredParams((qs) => run(qs), clear)
+    if (!clear) {
+        queryParams.value = {
+            cycletype: 0,
+            cycletime: '',
+        }
+    } else {
+        formRef.value?.validate((valid) => {
+            if (valid) {
+                run(queryParams.value)
+            }
+        })
+    }
 }
 
 const openComponentOnClick = (code: string) => {
@@ -160,17 +172,7 @@ const openComponentOnClick = (code: string) => {
 
 // 处理请求参数
 const processRequiredParams = (callback: (params: Model.TradeReq) => void, clear = false) => {
-    
-    if (!clear) {
-        queryParams.cycletime = ''
-        queryParams.cycletype = 0
-        return
-    }
-    formRef.value?.validate((valid) => {
-        if (valid) {
-            callback(queryParams)
-        }
-    })
+    onSearch(!clear)
 }
 
 </script>