|
|
@@ -0,0 +1,180 @@
|
|
|
+<!-- 报表查询-机构分润报表 -->
|
|
|
+<template>
|
|
|
+ <app-view>
|
|
|
+ <template #header>
|
|
|
+ <app-filter :option="filterOption">
|
|
|
+ <!-- 日期 -->
|
|
|
+ <template #tradedate="{ item }">
|
|
|
+ <el-form-item :label="item.label" prop="tradedate">
|
|
|
+ <el-date-picker :type="dateType" v-model="item.value" :format="dateFormat"
|
|
|
+ :value-format="dateFormat" :placeholder="t('common.pleasechoice')" />
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ <!-- 季度 -->
|
|
|
+ <template #quarter="{ item }">
|
|
|
+ <el-form-item :label="item.label" prop="quarter"
|
|
|
+ v-if="queryParams.cycletype === ReportType.Quarter">
|
|
|
+ <el-select v-model="item.value">
|
|
|
+ <el-option v-for="option in getQuarterList()" :key="option.value" :label="option.label"
|
|
|
+ :value="option.value" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <template v-else>
|
|
|
+ {{ (item.value = undefined) }}
|
|
|
+ </template>
|
|
|
+ </template>
|
|
|
+ <!-- 是否包含子机构 -->
|
|
|
+ <template #isson="{ item }">
|
|
|
+ <el-form-item :label="item.label" prop="isson">
|
|
|
+ <el-switch v-model="item.value" active-value="1" inactive-value="0" />
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ </app-filter>
|
|
|
+ </template>
|
|
|
+ <app-table :data="dataList" :columns="tableColumns" :loading="loading" :highlight-current-row="false"
|
|
|
+ :span-method="objectSpanMethod" :summary-method="getSummaries" show-summary>
|
|
|
+ <template #headerLeft>
|
|
|
+ <app-operation :data-list="getActionButtons(['query_internal_profitshare_export'])"
|
|
|
+ @click="(code: string) => openComponent(code)" />
|
|
|
+ </template>
|
|
|
+ <!-- 商品/市场 -->
|
|
|
+ <template #goodsname="{ row }">
|
|
|
+ <el-link type="primary" @click="openComponent('Details', row)">{{ row.goodsname }}</el-link>
|
|
|
+ </template>
|
|
|
+ </app-table>
|
|
|
+ <component :is="componentMap.get(componentId)" v-bind="{ record, queryParams }" @closed="closeComponent"
|
|
|
+ v-if="componentId" />
|
|
|
+ </app-view>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script lang="ts" setup>
|
|
|
+import { computed, ref, defineAsyncComponent } from 'vue'
|
|
|
+import { ElMessage } from 'element-plus'
|
|
|
+import { useEnum } from '@/hooks/enum'
|
|
|
+import { useDataFilter } from '@/hooks/datatable-v2'
|
|
|
+import { useRequest } from '@/hooks/request'
|
|
|
+import { formatDate } from '@/filters'
|
|
|
+import { shareAmountQuery } from '@/services/api/report'
|
|
|
+import { useOperation } from '@/hooks/operation'
|
|
|
+import { i18n } from '@/stores'
|
|
|
+import { getReportTypeList, ReportType, getQuarterList } from '@/constants/report'
|
|
|
+import { useComposeTable } from '@pc/components/base/table'
|
|
|
+import AppTable from '@pc/components/base/table/index.vue'
|
|
|
+import AppOperation from '@pc/components/base/operation/index.vue'
|
|
|
+import AppFilter from '@pc/components/base/table-filter-v2/index.vue'
|
|
|
+
|
|
|
+const roleTypeEnum = useEnum('roleType') // 角色
|
|
|
+const divideFeekindEnum = useEnum('divide_feekind') // 费用类型
|
|
|
+
|
|
|
+const { global: { t } } = i18n
|
|
|
+
|
|
|
+const { getSummaries } = useComposeTable<Model.ShareAmountQueryRsp>({
|
|
|
+ rowKey: 'areaaccountid',
|
|
|
+ sumText: '汇总',
|
|
|
+ summaryFields: [{ fieldName: 'totalcount', decimals: 0 }, 'totalfee', 'divideamount']
|
|
|
+})
|
|
|
+
|
|
|
+const { componentMap, componentId, record, openComponent, closeComponent, getActionButtons } = useOperation<Model.ShareAmountQueryRsp>()
|
|
|
+
|
|
|
+// 机构分润单据明细
|
|
|
+componentMap.set('Details', defineAsyncComponent(() => import('./components/details/index.vue')))
|
|
|
+
|
|
|
+const { dataList, loading, run } = useRequest(shareAmountQuery, {
|
|
|
+ manual: true,
|
|
|
+ onError: (err) => {
|
|
|
+ ElMessage.error(err)
|
|
|
+ }
|
|
|
+})
|
|
|
+
|
|
|
+// 计算行合并值
|
|
|
+const objectSpanMethod = (data: { rowIndex: number; columnIndex: number; }) => {
|
|
|
+ if (data.columnIndex < 2) {
|
|
|
+ if (data.rowIndex === 0) {
|
|
|
+ return {
|
|
|
+ rowspan: dataList.value.length,
|
|
|
+ colspan: 1,
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return {
|
|
|
+ rowspan: 0,
|
|
|
+ colspan: 0,
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const { queryParams, filterOption, getQueryParams, resetFilters } = useDataFilter<Model.ShareAmountQueryReq>({
|
|
|
+ filters: [
|
|
|
+ {
|
|
|
+ field: 'cycletype',
|
|
|
+ label: t('report.profitshare.cycletype'),
|
|
|
+ value: 0,
|
|
|
+ options: () => getReportTypeList(),
|
|
|
+ onChange: () => resetFilters('tradedate', 'quarter')
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'tradedate',
|
|
|
+ label: t('report.profitshare.tradedate'),
|
|
|
+ required: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'quarter',
|
|
|
+ label: t('report.profitshare.quarter'),
|
|
|
+ required: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'isson',
|
|
|
+ label: t('report.profitshare.isson'),
|
|
|
+ value: 0
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ buttons: [
|
|
|
+ { label: t('operation.search'), className: 'el-button--primary', onClick: () => onSearch() },
|
|
|
+ { label: t('operation.reset'), className: 'el-button--primary', validateEvent: false, onClick: () => resetFilters() }
|
|
|
+ ]
|
|
|
+})
|
|
|
+
|
|
|
+// 日期类型
|
|
|
+const dateType = computed(() => {
|
|
|
+ switch (queryParams.value.cycletype) {
|
|
|
+ case ReportType.Week:
|
|
|
+ return 'week'
|
|
|
+ case ReportType.Month:
|
|
|
+ return 'month'
|
|
|
+ case ReportType.Quarter:
|
|
|
+ case ReportType.Year:
|
|
|
+ return 'year'
|
|
|
+ default:
|
|
|
+ return 'date'
|
|
|
+ }
|
|
|
+})
|
|
|
+
|
|
|
+// 日期格式
|
|
|
+const dateFormat = computed(() => {
|
|
|
+ switch (queryParams.value.cycletype) {
|
|
|
+ case ReportType.Month:
|
|
|
+ return 'YYYYMM'
|
|
|
+ case ReportType.Quarter:
|
|
|
+ case ReportType.Year:
|
|
|
+ return 'YYYY'
|
|
|
+ default:
|
|
|
+ return 'YYYYMMDD'
|
|
|
+ }
|
|
|
+})
|
|
|
+
|
|
|
+const tableColumns = ref<Model.TableColumn[]>([
|
|
|
+ { field: 'areatype', label: 'report.profitshare.areatype', formatValue: (val) => roleTypeEnum.getEnumTypeName(val) },
|
|
|
+ { field: 'areaaccountid', label: 'report.profitshare.areaaccountid' },
|
|
|
+ { field: 'goodsname', label: 'report.profitshare.goodsname' },
|
|
|
+ { field: 'tradefeetype', label: 'report.profitshare.searchtype', formatValue: (val) => divideFeekindEnum.getEnumTypeName(val) },
|
|
|
+ { field: 'totalcount', label: 'report.profitshare.totalcount' },
|
|
|
+ { field: 'totalfee', label: 'report.profitshare.totalfee' },
|
|
|
+ { field: 'divideamount', label: 'report.profitshare.divideamount' }
|
|
|
+])
|
|
|
+
|
|
|
+const onSearch = () => {
|
|
|
+ const qs = getQueryParams()
|
|
|
+ qs.tradedate = formatDate(qs.tradedate, dateFormat.value) // 处理日期格式
|
|
|
+ run(qs)
|
|
|
+}
|
|
|
+</script>
|