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

+ 2 - 2
src/services/go/ermcp/goodsInfo/index.ts

@@ -127,9 +127,9 @@ export function GetErmcpGoods(lastUpdateTime?: string): Promise<string> {
  * @param middlegoodsid 套保品种id
  * @constructor
  */
-export function QueryMiddleGoodsChange(middlegoodsid: number): Promise<ErmcpMiddleGoodsChangeLog[]>{
+export function QueryMiddleGoodsChange(middlegoodsid: number): Promise<ErmcpMiddleGoodsChangeLog[]> {
     const userid = getUserId(); // 用户id
-    return commonSearch_go('/Ermcp/QueryMiddleGoodsChangeLog', {userid, middlegoodsid}).catch((err) => {
+    return commonSearch_go('/Ermcp/QueryMiddleGoodsChangeLog', { userid, middlegoodsid }).catch((err) => {
         throw new Error(`查询套保品种详情(套保品种/商品详情): ${err.message}`);
     });
 }

+ 10 - 6
src/views/information/goods/components/rightSpot/index.vue

@@ -7,7 +7,7 @@
                aria-hidden="true">
             <use xlink:href="#icon-shuzhuangtu"></use>
           </svg>
-          {{selctedDeliveryGoods.data.deliverygoodsname}}({{getGoodsUnitEnumItemName(selctedDeliveryGoods.data.agreeunit)}})
+          {{selctedDeliveryGoods.data.deliverygoodsname}}({{selctedDeliveryGoods.data.enumdicname}})
         </span>
         <span class="green ml10">{{selctedDeliveryGoods.data.dgstatus ? '正常' : '停用'}}</span>
       </div>
@@ -112,9 +112,11 @@
         </a-collapse-panel>
       </a-collapse>
     </div>
-    <Modify :selctedDeliveryGoods="selctedDeliveryGoods" />
-    <Disable :selectedRow="selctedDeliveryGoods" />
-    <SpotDetail  :selectedRow="selctedDeliveryGoods" />
+    <Modify :selctedDeliveryGoods="selctedDeliveryGoods"
+            @refresh="refresh" />
+    <Disable :selectedRow="selctedDeliveryGoods"
+             @refresh="refresh" />
+    <SpotDetail :selectedRow="selctedDeliveryGoods" />
   </div>
 </template>
 
@@ -129,7 +131,6 @@ import Disable from '../disable/index.vue';
 import { getThirdMenuData, handleBtnList } from '@/common/setup/table/button';
 import { BtnList } from '@/common/export/table';
 import SpotDetail from '../spotDetail/index.vue';
-import { getGoodsUnitEnumItemName } from '@/common/constants/enumsName';
 
 export default defineComponent({
     name: 'rightSpot',
@@ -158,8 +159,11 @@ export default defineComponent({
         }
 
         const { forDataBtn } = handleBtnList(list, 'goods_info_spot_normal', true);
+        function refresh() {
+            context.emit('refresh');
+        }
         initData(() => {});
-        return { getGoodsUnitEnumItemName, forDataBtn };
+        return { forDataBtn, refresh };
     },
 });
 </script>

+ 4 - 3
src/views/information/goods/list/spot-variety/index.vue

@@ -15,11 +15,12 @@
       </div>
       <div class="rightCont">
         <rightSpot :selctedDeliveryGoods="selctedDeliveryGoods"
+                   @refresh="updateDG"
                    :isNormal="isNormal"></rightSpot>
       </div>
     </div>
     <!-- 新增商品 -->
-    <AddGoods @refresh="queryDG" />
+    <AddGoods @refresh="updateDG" />
 
   </div>
 </template>
@@ -45,13 +46,13 @@ export default defineComponent({
     setup() {
         // 控制弹窗
         const { openAction: addAction } = openModal('goods_info_spot_normal_add');
-        const { loading, selctedDeliveryGoods, chooseDG, isNormal, menuList, queryDG } = handleDG();
+        const { loading, selctedDeliveryGoods, chooseDG, isNormal, menuList, queryDG, updateDG } = handleDG();
 
         initData(() => {
             // 加载数据在这里
             queryDG();
         });
-        return { addAction, loading, selctedDeliveryGoods, chooseDG, isNormal, menuList };
+        return { addAction, loading, selctedDeliveryGoods, chooseDG, isNormal, menuList, updateDG };
     },
 });
 </script>

+ 19 - 3
src/views/information/goods/list/spot-variety/setup.ts

@@ -1,4 +1,5 @@
 import APP from '@/services';
+import { QueryDeliveryGoodsDetail } from '@/services/go/ermcp/goodsInfo';
 import { ErmcpDeliveryGoodsDetailEx, MenuList } from '@/services/go/ermcp/goodsInfo/interface';
 import { mergeObj } from '@/utils/objHandle';
 import { reactive, Ref, ref } from 'vue';
@@ -53,8 +54,12 @@ export function handleDG() {
     // 选中的具体某一天现货品种数据
     const selctedDeliveryGoods = reactive<ErmcpDeliveryGoodsDetailEx>(initDG())
     const isNormal = ref<boolean>(true) // true => 正常; false => 停用
-    // 获取现货品种数据
-    function queryDG() {
+    function classfiyDG() {
+        menuList.value.forEach(el => {
+            if (el.children) {
+                el.children.length = 0
+            }
+        });
         const res = APP.get('DeliveryGoodsList') as ErmcpDeliveryGoodsDetailEx[]
         deliveryGoodsList.value = res;
         res.forEach(e => {
@@ -75,6 +80,9 @@ export function handleDG() {
                 }
             }
         })
+    }
+    function queryDG() {
+        classfiyDG()
         // 获取默认第一条数据
         if (menuList.value[0].children?.length) {
             chooseDG({ key: menuList.value[0].children[0].key, is: true })
@@ -95,6 +103,14 @@ export function handleDG() {
             console.log('selctedDeliveryGoods', selctedDeliveryGoods);
         }
     }
-    return { loading, deliveryGoodsList, menuList, queryDG, isNormal, selctedDeliveryGoods, chooseDG }
+    /**
+     * 更新数据
+     */
+    function updateDG() {
+        QueryDeliveryGoodsDetail().then(() => {
+            classfiyDG()
+        })
+    }
+    return { loading, deliveryGoodsList, menuList, queryDG, updateDG, isNormal, selctedDeliveryGoods, chooseDG }
 }