huangbin 4 yıl önce
ebeveyn
işleme
513081df12

+ 32 - 60
src/views/report/exposure-report/components/filterTable/index.vue

@@ -1,9 +1,20 @@
 <template>
   <!-- 过滤客户资料表格 -->
   <Filter @update="update">
-    <!-- <FilterOption :selectList="selectList"
-                    :inputList="[]"
-                    :fixedBtnList="fixedBtnList" /> -->
+    <a-select label-in-value
+              class="conditionSelect ml10"
+              style="width: 120px"
+              v-model:value="selectedMd"
+              @change="mdChange"
+              placeholder="全部套保品种">
+      <a-select-option v-for="item in middleGoods"
+                       :key="item.lable">
+        {{item.lable}}
+      </a-select-option>
+    </a-select>
+    <a-button class="selectBtn">查询</a-button>
+    <a-button class="selectBtn"
+              @click="reset">重置</a-button>
   </Filter>
 </template>
 
@@ -11,74 +22,35 @@
 import FilterOption from '@/common/components/filter/index.vue';
 import { defineComponent } from 'vue';
 import { ref } from 'vue';
-import { handleFilter, SelectList } from '@/common/setup/filter';
-import { handlerManagerList } from '@/common/setup/user';
-import { QueryMiddleGoodsDetail } from '@/services/go/ermcp/goodsInfo';
-import { SelectOption } from '@/common/setup/filter/interface';
 import Filter from '../../../components/filter/index.vue';
-import { TypeAndTime } from '@/views/report/interface';
+import { handlMiddleGoods } from '@/views/report/setup';
+import { initData } from '@/common/methods';
 
 export default defineComponent({
     name: 'exposure-filter-table',
     components: { FilterOption, Filter },
     setup(props, context) {
-        function update(value: TypeAndTime) {
+        const { middleGoods, getTBList } = handlMiddleGoods();
+        function update(value: any) {
             context.emit('update', value);
         }
-        const select: SelectList[] = [
-            {
-                value: undefined,
-                key: 'userId',
-                placeholder: '全部交易用户',
-                list: [],
-            },
-            {
-                value: undefined,
-                key: 'warehousetype',
-                placeholder: '全部套保品种',
-                list: [],
-            },
-        ];
-        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;
-            });
+        const selectedMd = ref(undefined);
+        function mdChange(id: any) {
+            context.emit('filter', { middlegoodsname: [id.key ? String(id.key) : ''] });
         }
-        // 获取套保品种
-        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;
-            });
+        function reset() {
+            selectedMd.value = undefined;
+            mdChange('');
         }
-        // initData(() => {
-        //     Promise.all([getUserList(), getTBList()]).then((res) => {
-        //         select[0].list = res[0]; // 交易用户
-        //         select[1].list = res[1]; // 套保品种
-        //         updateSelected(select);
-        //     });
-        // });
+        initData(() => {
+            getTBList();
+        });
         return {
-            selectList,
-            inputList,
-            fixedBtnList,
+            mdChange,
+            reset,
+            middleGoods,
+            update,
+            selectedMd,
         };
     },
 });

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

@@ -2,7 +2,8 @@
   <!-- 敞口报表 -->
   <div class="table-detail-container table-height"
        :loading="loading">
-    <Filter @update="search"></Filter>
+    <Filter @update="search"
+            @filter="updateColumn"></Filter>
     <a-table :columns="columns"
              class="topOrderTable"
              :scroll="{ x: '100%', y: 'calc(100vh - 163px)' }"
@@ -80,7 +81,7 @@ export default defineComponent({
         const param: ComposeTableDetailParam = {
             queryFn: queryTableAction, // 查询表格数据
             tableName: 'table_pcweb_exposure_report', // 表头key
-            tableFilterKey: [], // 表格过滤字段
+            tableFilterKey: ['middlegoodsname'], // 表格过滤字段
             menuType: EnumRouterName.exposure_report_exposure, // 当前tab页对应的code
         };
         const {

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

@@ -8,6 +8,7 @@ export interface Value {
 export interface TypeAndTime {
     cycletype: number//      周期类型 - 0:日 1:月 2:季 3:年 4:周 5:全报表【原值】
     cycletime: string//      周期时间 日(YYYYMMDD) 月(YYYYMM) 季(YYYYQ) 年(YYYY) 周(YYYYMMDD周内任意一天) 全(0)【原值】
-    userid?: number// 
+    userid?: number//
     sumfields?: string//              汇总维度(逗号隔开) 1-品种 2-品类 3-品牌 4-仓库
+    middlegoodsname?: string//
 }

+ 22 - 0
src/views/report/setup.ts

@@ -1,4 +1,6 @@
+import { SelectOption } from '@/common/setup/filter/interface'
 import { getUsrId } from '@/services/bus/user'
+import { QueryMiddleGoodsDetail } from '@/services/go/ermcp/goodsInfo'
 import moment, { Moment } from "moment"
 import { ref, SetupContext } from "vue"
 import { reportCycleType, reportCyleTimeType } from "./enum"
@@ -80,3 +82,23 @@ export function handleInitTypeAndTime() {
     return { getInitTime, getInitType }
 }
 
+
+export function handlMiddleGoods() {
+    const middleGoods = ref<SelectOption[]>([])
+    // 获取套保品种
+    function getTBList() {
+        return QueryMiddleGoodsDetail().then((res) => {
+            console.log('获取套保品种', res);
+
+            const result: SelectOption[] = [];
+            res.forEach((e) => {
+                const { isvalid, middlegoodsname, middlegoodsid } = e.mg;
+                if (isvalid) {
+                    result.push({ value: middlegoodsid, lable: middlegoodsname });
+                }
+            });
+            middleGoods.value = result
+        })
+    }
+    return { middleGoods, getTBList }
+}