|
|
@@ -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>
|