Pārlūkot izejas kodu

修改库存查询

huangbin 4 gadi atpakaļ
vecāks
revīzija
7afcd94d57

+ 15 - 3
src/common/setup/filter/index.ts

@@ -1,10 +1,22 @@
-import { ref, SetupContext } from 'vue';
+import { isRef, Ref, ref, SetupContext } from 'vue';
 import * as type from './interface';
 import { InputList, SelectList } from './interface';
 
 
-export function handleFilter(select: SelectList[], input: InputList[], context: SetupContext) {
-    const selected = select.map(e => {
+export function handleFilter(select: SelectList[] | Ref<SelectList[]>, input: InputList[], context: SetupContext) {
+    const selected = isRef(select) ? select.value.map(e => {
+        const fn = e.change;
+        if (fn) {
+            e.change = (id: number) => {
+                fn(id);
+                search()
+            }
+        } else {
+            e.change = search
+        }
+
+        return e
+    }) : select.map(e => {
         e.change = search
         return e
     })

+ 43 - 22
src/views/search/inventory/components/filterTable/index.vue

@@ -10,54 +10,75 @@
 
 <script lang="ts">
 import FilterOption from '@/common/components/filter/index.vue';
-import { defineComponent } from 'vue';
+import { defineComponent, ref } from 'vue';
 import { handleFilter, InputList, SelectList } from '@/common/setup/filter';
+import { initData } from '@/common/methods';
+import APP from '@/services';
+import { Ermcp3Brand, Ermcp3Wrstandard, ErmcpDeliveryGoodsDetailEx } from '@/services/go/ermcp/goodsInfo/interface';
+import { getWarehouseTypeEnumList } from '@/common/constants/enumsList';
+
 export default defineComponent({
     name: 'filter-spot-contract-table',
     components: { FilterOption },
     setup(props, context) {
-        const select: SelectList[] = [
+        const select = ref<SelectList[]>([
             {
                 value: undefined,
                 key: 'deliverygoodsid',
                 placeholder: '全部现货品种',
-                list: [
-                    { value: 1, lable: '采购' },
-                    { value: -1, lable: '销售' },
-                ],
+                list: [],
+                change: DGChange,
             },
             {
                 value: undefined,
                 key: 'wrstandardid',
                 placeholder: '全部品类',
-                list: [
-                    { value: 1, lable: '一口价' },
-                    { value: 2, lable: '点价' },
-                    { value: 3, lable: '暂定价' },
-                ],
+                list: [],
             },
             {
                 value: undefined,
                 key: 'spotgoodsbrandid',
                 placeholder: '全部品牌',
-                list: [
-                    { value: 1, lable: '一口价' },
-                    { value: 2, lable: '点价' },
-                    { value: 3, lable: '暂定价' },
-                ],
+                list: [],
             },
             {
                 value: undefined,
                 key: 'warehouseinfoid',
                 placeholder: '全部仓库',
-                list: [
-                    { value: 1, lable: '一口价' },
-                    { value: 2, lable: '点价' },
-                    { value: 3, lable: '暂定价' },
-                ],
+                list: [],
             },
-        ];
+        ]);
         const input: InputList[] = [];
+        initData(() => {
+            // 现货品种列表
+            select.value[0].list = APP.get('DeliveryGoodsList')
+                .filter((e: ErmcpDeliveryGoodsDetailEx) => {
+                    return e.data.isvalid === 1;
+                })
+                .map((el: ErmcpDeliveryGoodsDetailEx) => {
+                    const { deliverygoodsid, deliverygoodsname } = el.data;
+                    return { value: deliverygoodsid, lable: deliverygoodsname };
+                });
+        });
+        function DGChange(value: any) {
+            select.value[1].value = undefined;
+            select.value[2].value = undefined;
+            const temp = APP.get('DeliveryGoodsList').find((el: ErmcpDeliveryGoodsDetailEx) => el.data.deliverygoodsid === value.key);
+            if (temp) {
+                select.value[1].list = temp.gmlist.map((e: Ermcp3Wrstandard) => {
+                    const { wrstandardid, wrstandardname } = e;
+                    return { value: wrstandardid, lable: wrstandardname };
+                });
+                select.value[2].list = temp.gblist.map((e: Ermcp3Brand) => {
+                    const { brandid, brandname } = e;
+                    return { value: brandid, lable: brandname };
+                });
+            }
+        }
+        select.value[3].list = getWarehouseTypeEnumList().map((e) => {
+            const { enumitemname, enumdicname } = e;
+            return { value: enumitemname, lable: enumdicname };
+        });
         return {
             ...handleFilter(select, input, context),
         };

+ 1 - 1
src/views/search/inventory/list/inventory_applyrecord/index.vue

@@ -67,7 +67,7 @@ export default defineComponent({
         // 表格事件
         const { expandedRowKeys, selectedRow, Rowclick } = getTableEvent<Ermcp3AreaStockApply>({});
         // 表格操作按钮列表
-        const { commonBtn, forDataBtn } = getBtnList('inventory_current', false);
+        const { commonBtn, forDataBtn } = getBtnList('inventory_applyrecord', false);
         // 表格列表数据
         const { loading, tableList, queryTable } = queryTableList();