Forráskód Böngészése

添加交易用户过滤

huangbin 4 éve
szülő
commit
1ebb513cd1

+ 6 - 2
src/common/setup/user/index.ts

@@ -13,9 +13,13 @@ import { Ref, ref } from "vue";
  */
 export function handlerManagerList(loading: Ref<boolean>, type: 1 | 2 | 3, isFilter = false) {
     const tableList = ref<ErmcpLoginUserEx[]>([]);
-    function queryTable() {
+    function queryTable(): Promise<ErmcpLoginUserEx[]> {
         return queryResultLoadingAndInfo(QueryAccMgrLoginUser, loading, type)
-            .then(res => tableList.value = isFilter ? res.filter((e: ErmcpLoginUserEx) => e.accountstatus === 4) : res)
+            .then(res => {
+                const result = isFilter ? res.filter((e: ErmcpLoginUserEx) => e.accountstatus === 4) : res
+                tableList.value = result
+                return result
+            })
     }
     /**
      * 根据code 查找业务员、跟单员对应的名字

+ 12 - 4
src/services/go/ermcp/report/index.ts

@@ -13,7 +13,9 @@ import {
  * @param req.querytype  查询类型 1-日报表 2-周期报表 3-日报表(指定时间段[开始交易日,结束交易日]) 4-日报表明细
  */
 export function qryAreaExpourseReport(req: AreaExpourseReportReq): Promise<Ermcp3ExpourseReport[]> {
-    req.userid = getUserId()
+    if (!req.userid) {
+        req.userid = getUserId()
+    }
     return commonSearch_go('/Ermcp3/QryAreaExpourseReport', req).catch((err) => {
         throw new Error(`查询敞口报表: ${err.message}`);
     });
@@ -23,7 +25,9 @@ export function qryAreaExpourseReport(req: AreaExpourseReportReq): Promise<Ermcp
  *  查询现货报表 /Ermcp3/QryAreaSpotplReport
  */
 export function qryAreaSpotplReport(req: AreaSpotplReportReq): Promise<Ermcp3AreaSpotPLReport[]> {
-    req.userid = getUserId()
+    if (!req.userid) {
+        req.userid = getUserId()
+    }
     return commonSearch_go('/Ermcp3/QryAreaSpotplReport', req).catch((err) => {
         throw new Error(`查询现货报表: ${err.message}`);
     });
@@ -34,7 +38,9 @@ export function qryAreaSpotplReport(req: AreaSpotplReportReq): Promise<Ermcp3Are
  * @param req
  */
 export function qryAreaStockReport(req: AreaStockReportReq): Promise<Ermcp3AreaStockReport[]> {
-    req.userid = getUserId()
+    if (!req.userid) {
+        req.userid = getUserId()
+    }
     return commonSearch_go('/Ermcp3/QryAreaStockReport', req).catch((err) => {
         throw new Error(`查询库存报表: ${err.message}`);
     });
@@ -45,7 +51,9 @@ export function qryAreaStockReport(req: AreaStockReportReq): Promise<Ermcp3AreaS
  * @param req
  */
 export function qryFinanceReport(req: FinanceReportReq): Promise<Ermcp3FinanceReport[]> {
-    req.userid = getUserId()
+    if (!req.userid) {
+        req.userid = getUserId()
+    }
     return commonSearch_go('/Ermcp3/QryFinanceReport', req).catch((err) => {
         throw new Error(`查询财务报表: ${err.message}`);
     });

+ 38 - 3
src/views/report/components/filter/index.vue

@@ -1,5 +1,5 @@
 <template>
-  <!-- 过滤客户资料表格 -->
+  <!-- 报表通用过滤 -->
   <div class="filterTable">
     <div class="filter-custom-table">
       <a-select label-in-value
@@ -22,6 +22,17 @@
                        @change="timeChange"
                        :format="dateFormat" />
       </a-space>
+      <a-select label-in-value
+                class="conditionSelect"
+                style="width: 120px"
+                v-model:value="selectedUser"
+                @change="userChange"
+                placeholder="请选择报表类型">
+        <a-select-option v-for="item in userList"
+                         :key="item.value">
+          {{item.lable}}
+        </a-select-option>
+      </a-select>
       <slot></slot>
     </div>
   </div>
@@ -29,22 +40,46 @@
 
 <script lang="ts">
 import FilterOption from '@/common/components/filter/index.vue';
-import { defineComponent } from 'vue';
+import { initData } from '@/common/methods';
+import { SelectOption } from '@/common/setup/filter/interface';
+import { handlerManagerList } from '@/common/setup/user';
+import { getUserId } from '@/services/bus/account';
+import { getUserName } from '@/services/bus/user';
+import { defineComponent, ref } from 'vue';
 import { handleReprotType } from '../../setup';
 
 export default defineComponent({
     name: 'report-common-filter-table',
     components: { FilterOption },
     setup(props, context) {
-        const { selectedReportType, reportType, reportTypeChange, isMonth, timeChange, dateFormat, time } = handleReprotType(context);
+        const { selectedReportType, reportType, reportTypeChange, isMonth, timeChange, dateFormat, time, selectedUser, userChange } = handleReprotType(context);
+        const loading = ref<boolean>(false);
+        // 交易用户
+        const userList = ref<SelectOption[]>([]);
+        const { queryTable } = handlerManagerList(loading, 2);
+        initData(() => {
+            queryTable().then((res) => {
+                userList.value.length = 0;
+                userList.value.push({ value: getUserId(), lable: getUserName() });
+                res.forEach((e) => {
+                    e.userlist.forEach((el) => {
+                        // userList.value.push({ value: el.loginid, lable: `${el.loginname}-${el.logincode}` });
+                        userList.value.push({ value: el.loginid, lable: el.loginname });
+                    });
+                });
+            });
+        });
         return {
             reportType,
             selectedReportType,
             dateFormat,
             timeChange,
             reportTypeChange,
+            selectedUser,
+            userChange,
             isMonth,
             time,
+            userList,
         };
     },
 });

+ 1 - 0
src/views/report/interface.ts

@@ -8,4 +8,5 @@ export interface Value {
 export interface TypeAndTime {
     cycletype: number//      周期类型 - 0:日 1:月 2:季 3:年 4:周 5:全报表【原值】
     cycletime: string//      周期时间 日(YYYYMMDD) 月(YYYYMM) 季(YYYYQ) 年(YYYY) 周(YYYYMMDD周内任意一天) 全(0)【原值】
+    userid?: number// 
 }

+ 9 - 2
src/views/report/setup.ts

@@ -1,4 +1,5 @@
 import { queryResultLoadingAndInfo } from '@/common/methods/request/resultInfo'
+import { getUsrId } from '@/services/bus/user'
 import { FinanceReportReq } from "@/services/go/ermcp/report/interface"
 import moment, { Moment } from "moment"
 import { ref, SetupContext } from "vue"
@@ -12,6 +13,8 @@ export function handleReprotType(context: SetupContext) {
     const dateFormat = ref<reportCyleTimeType>(reportCyleTimeType.day)
     // 时间
     const time = ref<Moment>(getInitTime());
+    // 交易用户
+    const selectedUser = ref<Value>({ key: getUsrId() })
     // 周期类型与时间类型 一对一的关系
     const timeMap = new Map([
         [reportCycleType.day, reportCyleTimeType.day],
@@ -45,6 +48,10 @@ export function handleReprotType(context: SetupContext) {
     function timeChange() {
         update()
     }
+    // 交易用户变更
+    function userChange() {
+        update()
+    }
     // 根据周期类型 格式化时间
     function formateTime() {
         return moment(time.value).format(getFomateType())
@@ -55,10 +62,10 @@ export function handleReprotType(context: SetupContext) {
     }
     // 通知上层更新数据
     function update() {
-        const param = { cycletype: selectedReportType.value.key, cycletime: formateTime() }
+        const param = { cycletype: selectedReportType.value.key, cycletime: formateTime(), userid: selectedUser.value.key }
         context.emit('update', param)
     }
-    return { selectedReportType, reportType, isMonth, reportTypeChange, dateFormat, time, timeChange, }
+    return { selectedReportType, reportType, isMonth, reportTypeChange, dateFormat, time, timeChange, selectedUser, userChange }
 }
 
 export function handleInitTypeAndTime() {