huangbin 4 년 전
부모
커밋
94cf6fe98c

+ 13 - 19
src/services/go/ermcp/spot-report/index.ts

@@ -2,18 +2,17 @@
 import { getUsrId } from '@/services/bus/user';
 import { commonSearch_go } from '@/services/go/index';
 import * as type from './interface';
-import { QuerySpotDayReportDetailReq, QuerySpotMonthReportDetailReq, QuerySpotMonthReportReq, QuerySpotPLReportReq } from './interface';
+import { QuerySpotDayReportDetailReq, QuerySpotMonthReportDetailReq, QuerySpotPLReportReq } from './interface';
 /**
  * 查询现货损益报表
  * @param queryInfo 查询条件
  * @returns 现货损益报表
  */
 export async function QuerySpotPLReport(queryInfo: QuerySpotPLReportReq): Promise<type.QuerySpotPLReportRsp[]> {
-    try {
-        return commonSearch_go('/Ermcp3/QryReportAreaSpotPL', queryInfo);
-    } catch (err) {
+    return commonSearch_go('/Ermcp3/QryReportAreaSpotPL', queryInfo).catch(err => {
         throw new Error(`查询现货损益报表: ${err.message}`);
-    }
+    });
+
 }
 
 /**
@@ -35,24 +34,21 @@ export async function QuerySpotDayReport(tradedate: string): Promise<type.QueryS
  * @returns 现货明细报表
  */
 export async function QuerySpotDayReportDetail(queryInfo: QuerySpotDayReportDetailReq): Promise<type.QuerySpotDayReportDetailRsp[]> {
-    try {
-        return commonSearch_go('/Ermcp3/QryReportDaySpotDetail', queryInfo);
-    } catch (err) {
+    return commonSearch_go('/Ermcp3/QryReportDaySpotDetail', queryInfo).catch(err => {
         throw new Error(`查询现货明细报表: ${err.message}`);
-    }
+    });
 }
 
 /**
  * 查询现货月报表
- * @param queryInfo 查询信息
+ * @param tradedate 交易日(格式:yyyyMMdd)
  * @returns 现货月报表数据
  */
-export async function QuerySpotMonthReport(queryInfo: QuerySpotMonthReportReq): Promise<type.QuerySpotMonthReportRsp[]> {
-    try {
-        return commonSearch_go('/Ermcp3/QryReportMonthSpot', { queryInfo });
-    } catch (err) {
+export async function QuerySpotMonthReport(tradedate: string): Promise<type.QuerySpotMonthReportRsp[]> {
+    const userid = getUsrId()
+    return commonSearch_go('/Ermcp3/QryReportMonthSpot', { tradedate, userid }).catch(err => {
         throw new Error(`查询现货月报表: ${err.message}`);
-    }
+    });
 }
 
 /**
@@ -61,9 +57,7 @@ export async function QuerySpotMonthReport(queryInfo: QuerySpotMonthReportReq):
  * @returns 现货月报表明细
  */
 export async function QuerySpotMonthReportDetail(queryInfo: QuerySpotMonthReportDetailReq): Promise<type.QuerySpotMonthReportDetailRsp[]> {
-    try {
-        return commonSearch_go('/Ermcp3/QryReportMonthSpotDetail', { queryInfo });
-    } catch (err) {
+    return commonSearch_go('/Ermcp3/QryReportMonthSpotDetail', { queryInfo }).catch(err => {
         throw new Error(`查询现货月报表明细: ${err.message}`);
-    }
+    });
 }

+ 1 - 1
src/views/report/exposure-report/list/exposure_report/index.vue

@@ -2,7 +2,7 @@
   <!-- 敞口报表 -->
   <div class="exposure_report"
        :loading="loading">
-    <Filter @search="search"></Filter>
+    <Filter @update="update"></Filter>
     <contextMenu :contextMenuList="forDataBtn">
       <a-table :columns="columns"
                class="topTable hiddenFirstCol"

+ 1 - 1
src/views/report/finance-report/list/finance_report_finance/index.vue

@@ -42,7 +42,7 @@ export default defineComponent({
             // 获取列表数据
             queryTable(moment().format('YYYYMMDD'), '1');
             // 注册表头信息 过滤
-            registerColumn('table_pcweb_finance_report', []);
+            registerColumn('table_pcweb_report_expose', []);
         });
         function update(value: { type: '1' | '2' | '3'; date: string }) {
             queryTable(value.date, value.type);

+ 95 - 18
src/views/report/spot-report/components/filterTable/index.vue

@@ -1,39 +1,115 @@
 <template>
   <!-- 过滤客户资料表格 -->
   <div class="filterTable">
-    <FilterOption :selectList="selectList"
-                  :inputList="inputList"
-                  :fixedBtnList="fixedBtnList" />
-    <slot></slot>
+    <div class="filter-custom-table">
+      <a-select label-in-value
+                class="conditionSelect"
+                style="width: 120px"
+                v-model:value="selectedReportType"
+                @change="update"
+                placeholder="请选择报表类型">
+        <a-select-option v-for="item in reportType"
+                         :key="item.value">
+          {{item.lable}}
+        </a-select-option>
+      </a-select>
+      <a-space direction="vertical">
+        <a-date-picker v-model:value="date"
+                       @change="update"
+                       :format="dateFormat" />
+      </a-space>
+      <!-- <FilterOption :selectList="selectList"
+                    :inputList="[]"
+                    :fixedBtnList="fixedBtnList" /> -->
+    </div>
   </div>
 </template>
 
 <script lang="ts">
 import FilterOption from '@/common/components/filter/index.vue';
 import { defineComponent } from 'vue';
-import { handleFilter, InputList, SelectList } from '@/common/setup/filter';
+import { handleReprotType } from '../../../setup';
+import { ref } from 'vue';
+import { Moment } from 'moment';
+import moment from 'moment';
+import { handleFilter, SelectList } from '@/common/setup/filter';
+import { initData } from '@/common/methods';
+import { handlerManagerList } from '@/common/setup/user';
+import { QueryMiddleGoodsDetail } from '@/services/go/ermcp/goodsInfo';
+import { SelectOption } from '@/common/setup/filter/interface';
+
 export default defineComponent({
-    name: 'business-review-filter-table',
+    name: 'exposure-filter-table',
     components: { FilterOption },
     setup(props, context) {
+        const { selectedReportType, reportType } = handleReprotType();
+
+        const dateFormat = 'YYYYMMDD';
+        const date = ref<Moment>(moment(new Date(), 'YYYYMMDD'));
+
+        function update() {
+            const obj = { type: selectedReportType.value.key, date: moment(date.value).format(dateFormat) };
+            context.emit('update', obj);
+        }
         const select: SelectList[] = [
             {
                 value: undefined,
-                key: 'contracttype',
-                placeholder: '全部合同类型',
-                list: [
-                    { value: 1, lable: '采购' },
-                    { value: -1, lable: '销售' },
-                ],
+                key: 'userId',
+                placeholder: '全部交易用户',
+                list: [],
+            },
+            {
+                value: undefined,
+                key: 'warehousetype',
+                placeholder: '全部套保品种',
+                list: [],
             },
         ];
-        const input: InputList[] = [
-            { value: '', placeholder: '模糊搜索对手方', key: 'buyusernameOrsellusername' },
-            { value: '', placeholder: '模糊搜索合同编号', key: 'contractno' },
-            { value: '', placeholder: '模糊搜索现货品种', key: 'deliverygoodsname' },
-        ];
+        const loading = ref<boolean>(false);
+        // 交易用户
+        const { tableList: userList, queryTable } = handlerManagerList(loading, 2);
+        const { selectList, inputList, fixedBtnList, updateSelected } = handleFilter(select, [], context);
+        // 获取交易用户
+        function getUserList() {
+            return queryTable().then(() => {
+                const result: SelectOption[] = [];
+                userList.value.forEach((e) => {
+                    e.userlist.forEach((el) => {
+                        result.push({ value: el.loginid, lable: `${el.loginname}-${el.logincode}` });
+                    });
+                });
+                return result;
+            });
+        }
+        // 获取套保品种
+        function getTBList() {
+            return QueryMiddleGoodsDetail().then((res) => {
+                const result: SelectOption[] = [];
+                res.forEach((e) => {
+                    const { isvalid, middlegoodsname, middlegoodsid } = e.mg;
+                    if (isvalid) {
+                        result.push({ value: middlegoodsid, lable: middlegoodsname });
+                    }
+                });
+                return result;
+            });
+        }
+        // initData(() => {
+        //     Promise.all([getUserList(), getTBList()]).then((res) => {
+        //         select[0].list = res[0]; // 交易用户
+        //         select[1].list = res[1]; // 套保品种
+        //         updateSelected(select);
+        //     });
+        // });
         return {
-            ...handleFilter(select, input, context),
+            reportType,
+            selectedReportType,
+            selectList,
+            inputList,
+            fixedBtnList,
+            date,
+            dateFormat,
+            update,
         };
     },
 });
@@ -41,3 +117,4 @@ export default defineComponent({
 
 <style lang="less">
 </style>;
+

+ 43 - 9
src/views/report/spot-report/list/spot_report/index.vue

@@ -2,20 +2,16 @@
   <!-- 现货报表 -->
   <div class="spot-report"
        :loading="loading">
-    <Filter @search="search"></Filter>
+    <Filter @update="update"></Filter>
     <contextMenu :contextMenuList="forDataBtn">
-      <!-- <a-table :columns="columns"
+      <a-table :columns="columns"
                class="topTable hiddenFirstCol"
                :pagination="false"
                :expandedRowKeys="expandedRowKeys"
                :customRow="Rowclick"
                rowKey="key"
-               :data-source="tableList"> -->
-      <!-- 额外的展开行 -->
-      <!-- <template #expandedRowRender="{ record }">
-                    <BtnList :btnList="record.btnList"/>
-                </template> -->
-      <!-- </a-table> -->
+               :data-source="tableList">
+      </a-table>
     </contextMenu>
   </div>
 </template>
@@ -23,6 +19,8 @@
 <script lang="ts">
 import Filter from '../../components/filterTable/index.vue';
 import { defineComponent, initData, getTableColumns, getTableEvent, getBtnList, contextMenu, BtnList } from '@/common/export/table';
+import { queryTableList } from './setup';
+import moment from 'moment';
 
 export default defineComponent({
     name: 'spot-report',
@@ -32,7 +30,43 @@ export default defineComponent({
         BtnList,
     },
     setup() {
-        return {};
+        // 表头数据
+        const { columns, registerColumn, updateColumn, filteredInfo } = getTableColumns();
+        // 表格事件
+        const { expandedRowKeys, selectedRow, Rowclick, btnClick } = getTableEvent<any>({});
+        // // 表格操作按钮列表
+        // const { commonBtn, forDataBtn } = getBtnList('warehouse_info_normal', true);
+        // 表格列表数据
+        const { loading, tableList, queryTable } = queryTableList();
+        initData(() => {
+            // 获取列表数据
+            queryTable(moment().format('YYYYMMDD'), '1');
+            // 注册表头信息 过滤
+            registerColumn('table_pcweb_report_spot', []);
+        });
+        function update(value: { type: '1' | '2' | '3'; date: string }) {
+            queryTable(value.date, value.type);
+        }
+        // 查询
+        function search(value: any) {
+            filteredInfo.value = value;
+            // 更新表信息
+            updateColumn();
+        }
+
+        return {
+            columns,
+            filteredInfo,
+            expandedRowKeys,
+            selectedRow,
+            Rowclick,
+            loading,
+            tableList,
+            search,
+            queryTable,
+            btnClick,
+            update,
+        };
     },
 });
 </script>

+ 42 - 0
src/views/report/spot-report/list/spot_report/setup.ts

@@ -0,0 +1,42 @@
+import { queryResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
+import { QueryFinanceDayReportRsp } from '@/services/go/ermcp/finance-report/interface';
+import { QuerySpotDayReport, QuerySpotMonthReport } from '@/services/go/ermcp/spot-report';
+import { QuerySpotDayReportRsp } from '@/services/go/ermcp/spot-report/interface';
+import { ref } from 'vue';
+
+
+/**
+ * 获取表格列表数据
+ * @param type 
+ * @returns 
+ */
+export function queryTableList() {
+    // 加载状态
+    const loading = ref<boolean>(false);
+    // 表格数据
+    const tableList = ref<QuerySpotDayReportRsp[]>([]);
+
+    function queryTable(tradedate: string, type: '1' | '2' | '3') {
+        let fn: any = QuerySpotDayReport
+        switch (type) {
+            case '1':
+                fn = QuerySpotDayReport
+                break;
+            case '2':
+                fn = QuerySpotDayReport
+                break;
+            case '3':
+                fn = QuerySpotMonthReport
+                break;
+        }
+        queryResultLoadingAndInfo(fn, loading, tradedate).then(res => {
+            const result = res?.map((e: QueryFinanceDayReportRsp, i: number) => {
+                return { ...e, key: String(i) };
+            });
+            tableList.value = result ? result : []
+        })
+    }
+    return { loading, tableList, queryTable }
+}
+
+