huangbin 4 年之前
父節點
當前提交
fd59151991

+ 37 - 50
src/views/report/inventory-report/components/filterTable/index.vue

@@ -2,9 +2,31 @@
   <!-- 过滤客户资料表格 -->
   <Filter @update="update"
           :showUser="false">
-    <!-- <FilterOption :selectList="selectList"
-                  :inputList="[]"
-                  :fixedBtnList="fixedBtnList" /> -->
+    <a-select label-in-value
+              class="conditionSelect ml10"
+              style="width: 120px"
+              v-model:value="selectedDG"
+              @change="DGChange"
+              placeholder="全部现货品种">
+      <a-select-option v-for="item in DGList"
+                       :key="item.data.deliverygoodsname">
+        {{item.data.deliverygoodsname}}
+      </a-select-option>
+    </a-select>
+    <a-select label-in-value
+              class="conditionSelect ml10"
+              style="width: 120px"
+              v-model:value="selectedGM"
+              @change="GBOrGMChange"
+              placeholder="全部品类">
+      <a-select-option v-for="item in gmlist"
+                       :key="item.wrstandardname">
+        {{item.wrstandardname}}
+      </a-select-option>
+    </a-select>
+    <a-button class="selectBtn">查询</a-button>
+    <a-button class="selectBtn"
+              @click="reset">重置</a-button>
   </Filter>
 </template>
 
@@ -18,6 +40,7 @@ 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 { handleDG } from '@/views/report/setup';
 
 export default defineComponent({
     name: 'inventory-filter-table',
@@ -26,54 +49,18 @@ export default defineComponent({
         function update(value: TypeAndTime) {
             context.emit('update', value);
         }
-        const select: SelectList[] = [
-            {
-                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;
-            });
-        }
-        // 获取套保品种
-        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);
-        //     });
-        // });
+        const { DGList, gblist, gmlist, selectedDG, selectedGB, selectedGM, DGChange, GBOrGMChange, reset } = handleDG(context);
         return {
-            selectList,
-            inputList,
-            fixedBtnList,
+            DGList,
+            gblist,
+            gmlist,
+            DGChange,
+            GBOrGMChange,
+            reset,
+            selectedDG,
+            selectedGB,
+            selectedGM,
+            update,
         };
     },
 });

+ 3 - 2
src/views/report/inventory-report/list/category/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)' }"
@@ -69,7 +70,7 @@ export default defineComponent({
         const param: ComposeTableDetailParam = {
             queryFn: queryTableAction, // 查询表格数据
             tableName: 'table_pcweb_warehouse_category_report', // 表头key
-            tableFilterKey: [], // 表格过滤字段
+            tableFilterKey: ['deliverygoodsname', 'wrstandardname'], // 表格过滤字段
             menuType: EnumRouterName.inventory_report_inventory_category, // 当前tab页对应的code
         };
 

+ 3 - 2
src/views/report/inventory-report/list/warehouse/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)' }"
@@ -68,7 +69,7 @@ export default defineComponent({
         const param: ComposeTableDetailParam = {
             queryFn: queryTableAction, // 查询表格数据
             tableName: 'table_pcweb_warehouse_report', // 表头key
-            tableFilterKey: [], // 表格过滤字段
+            tableFilterKey: ['deliverygoodsname', 'wrstandardname'], // 表格过滤字段
             menuType: EnumRouterName.inventory_report_warehouse, // 当前tab页对应的code
         };
         const {

+ 52 - 4
src/views/report/setup.ts

@@ -1,6 +1,9 @@
+import { initData } from '@/common/methods'
 import { SelectOption } from '@/common/setup/filter/interface'
+import APP from '@/services'
 import { getUsrId } from '@/services/bus/user'
 import { QueryMiddleGoodsDetail } from '@/services/go/ermcp/goodsInfo'
+import { Ermcp3Brand, Ermcp3Wrstandard, ErmcpDeliveryGoodsDetailEx } from '@/services/go/ermcp/goodsInfo/interface'
 import moment, { Moment } from "moment"
 import { ref, SetupContext } from "vue"
 import { reportCycleType, reportCyleTimeType } from "./enum"
@@ -82,14 +85,11 @@ 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;
@@ -102,3 +102,51 @@ export function handlMiddleGoods() {
     }
     return { middleGoods, getTBList }
 }
+
+export function handleDG(context: SetupContext) {
+    // 现货品种
+    const DGList = ref<ErmcpDeliveryGoodsDetailEx[]>([])
+    const selectedDG = ref<Value | undefined>(undefined);
+    // 品牌
+    const gblist = ref<Ermcp3Brand[]>([])
+    const selectedGB = ref<Value | undefined>(undefined);
+    // 品类列表
+    const gmlist = ref<Ermcp3Wrstandard[]>([])
+    const selectedGM = ref<Value | undefined>(undefined);
+    function getDG() {
+        DGList.value = APP.get('DeliveryGoodsList').filter((e: ErmcpDeliveryGoodsDetailEx) => e.data.isvalid === 1)
+    }
+    initData(() => {
+        getDG()
+    })
+
+    function DGChange(value: any) {
+        const temp = DGList.value.find((e: ErmcpDeliveryGoodsDetailEx) => e.data.deliverygoodsname === value.key)
+        console.log('tem', temp)
+        if (temp) {
+            gblist.value = temp.gblist
+            gmlist.value = temp.gmlist
+        }
+        filterAction()
+    }
+    function GBOrGMChange() {
+        filterAction()
+    }
+    function filterAction() {
+        console.log(selectedDG.value)
+        const deliverygoodsname = selectedDG.value ? [selectedDG.value.key] : ['']
+        const brandname = selectedGB.value ? [selectedGB.value.key] : ['']
+        const wrstandardname = selectedGM.value ? [selectedGM.value.key] : ['']
+        const result = { deliverygoodsname, brandname, wrstandardname }
+        context.emit('filter', result)
+    }
+    function reset() {
+        selectedDG.value = undefined
+        selectedGB.value = undefined
+        selectedGM.value = undefined
+        filterAction()
+    }
+    return { DGList, gblist, gmlist, selectedDG, selectedGB, selectedGM, DGChange, reset, GBOrGMChange }
+}
+
+// 获取品种数据

+ 48 - 56
src/views/report/spot-report/components/filterTable/index.vue

@@ -1,9 +1,42 @@
 <template>
   <!-- 过滤客户资料表格 -->
   <Filter @update="update">
-    <!-- <FilterOption :selectList="selectList"
-                    :inputList="[]"
-                    :fixedBtnList="fixedBtnList" /> -->
+    <a-select label-in-value
+              class="conditionSelect ml10"
+              style="width: 120px"
+              v-model:value="selectedDG"
+              @change="DGChange"
+              placeholder="全部现货品种">
+      <a-select-option v-for="item in DGList"
+                       :key="item.data.deliverygoodsname">
+        {{item.data.deliverygoodsname}}
+      </a-select-option>
+    </a-select>
+    <a-select label-in-value
+              class="conditionSelect ml10"
+              style="width: 120px"
+              v-model:value="selectedGM"
+              @change="GBOrGMChange"
+              placeholder="全部品类">
+      <a-select-option v-for="item in gmlist"
+                       :key="item.wrstandardname">
+        {{item.wrstandardname}}
+      </a-select-option>
+    </a-select>
+    <a-select label-in-value
+              class="conditionSelect ml10"
+              style="width: 120px"
+              v-model:value="selectedGB"
+              @change="GBOrGMChange"
+              placeholder="全部品牌">
+      <a-select-option v-for="item in gblist"
+                       :key="item.brandname">
+        {{item.brandname}}
+      </a-select-option>
+    </a-select>
+    <a-button class="selectBtn">查询</a-button>
+    <a-button class="selectBtn"
+              @click="reset">重置</a-button>
   </Filter>
 </template>
 
@@ -17,6 +50,7 @@ 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 { handleDG } from '@/views/report/setup';
 
 export default defineComponent({
     name: 'exposure-filter-table',
@@ -25,60 +59,18 @@ export default defineComponent({
         function update(value: TypeAndTime) {
             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;
-            });
-        }
-        // 获取套保品种
-        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);
-        //     });
-        // });
+        const { DGList, gblist, gmlist, selectedDG, selectedGB, selectedGM, DGChange, GBOrGMChange, reset } = handleDG(context);
         return {
-            selectList,
-            inputList,
-            fixedBtnList,
+            DGList,
+            gblist,
+            gmlist,
+            DGChange,
+            GBOrGMChange,
+            reset,
+            selectedDG,
+            selectedGB,
+            selectedGM,
+            update,
         };
     },
 });

+ 15 - 14
src/views/report/spot-report/list/spot_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)' }"
@@ -53,18 +54,18 @@
                rowKey="key"
                :data-source="detailTableList"
                :scroll="{ x: '100%', y: 'calc(100vh - 163px)' }">
-          <template #curaverageprice="{ record }">
-              <span>{{ record.curaverageprice.toFixed(2) }}</span>
-          </template>
-          <template #curspotprice="{ record }">
-              <span>{{ record.curspotprice.toFixed(2) }}</span>
-          </template>
-          <template #curmarketvalue="{ record }">
-              <span>{{ record.curmarketvalue.toFixed(2) }}</span>
-          </template>
-          <template #floatpl="{ record }">
-              <span>{{ record.floatpl.toFixed(2) }}</span>
-          </template>
+        <template #curaverageprice="{ record }">
+          <span>{{ record.curaverageprice.toFixed(2) }}</span>
+        </template>
+        <template #curspotprice="{ record }">
+          <span>{{ record.curspotprice.toFixed(2) }}</span>
+        </template>
+        <template #curmarketvalue="{ record }">
+          <span>{{ record.curmarketvalue.toFixed(2) }}</span>
+        </template>
+        <template #floatpl="{ record }">
+          <span>{{ record.floatpl.toFixed(2) }}</span>
+        </template>
       </a-table>
     </Description>
   </div>
@@ -109,7 +110,7 @@ export default defineComponent({
         const param: ComposeTableDetailParam = {
             queryFn: queryTableAction, // 查询表格数据
             tableName: 'table_pcweb_spot_report', // 表头key
-            tableFilterKey: [], // 表格过滤字段
+            tableFilterKey: ['deliverygoodsname', 'wrstandardname', 'brandname'], // 表格过滤字段
             menuType: EnumRouterName.spot_report_spot, // 当前tab页对应的code
         };
         const {