Ver código fonte

修改现货品种

huangbin 4 anos atrás
pai
commit
a402e187dd

+ 3 - 3
src/common/methods/mixin/index.ts

@@ -1,5 +1,5 @@
-import { onActivated, onUnmounted } from 'vue';
 import Bus from '@/utils/eventBus/index';
+import { onActivated, onUnmounted } from 'vue';
 
 let isLoadComplete = false;
 
@@ -8,13 +8,13 @@ export const initData = (callback: Function): void => {
     // 刷新整个页面时候,需要等数据加载数据
     const cb = () => {
         if (isLoadComplete) {
-            console.log('刷新页面...........');
+            // console.log('刷新页面...........');
             callback && callback();
         }
     };
     Bus.$on('loadComplete', cb);
     if (isLoadComplete) {
-        console.log('路由进入页面.......');
+        // console.log('路由进入页面.......');
         callback && callback();
     }
     onUnmounted(() => {

+ 4 - 4
src/services/bus/index.ts

@@ -1,4 +1,5 @@
 import APP from '@/services';
+import { isAllEnum } from '@/services/bus/allEnum';
 import { isLogin } from '@/services/bus/login';
 import { checkTokenLoop, handleTokenCheck } from '@/services/bus/token';
 import { getAllEnums, GetPCMenus, getServerTime, queryErrorInfos, QueryTableDefine } from '@/services/go/commonService/index';
@@ -47,10 +48,9 @@ export async function globalDataRefresh(): Promise<string> {
             await queryErrorInfos();
         }
         // 获取枚举
-        // if (!isAllEnum()) {
-        //     await getAllEnums();
-        // }
-        await getAllEnums();
+        if (!isAllEnum()) {
+            await getAllEnums();
+        }
         // await queryGoodsList();
         return Promise.resolve('ok');
     } catch (error) {

+ 5 - 4
src/services/go/ermcp/goodsInfo/index.ts

@@ -50,9 +50,10 @@ export function QueryGoodsbrand(): Promise<Ermcp3Brand[]> {
  * @param deliverygoodsid 现货商品id
  * @constructor
  */
-export function QueryDeliveryGoodsDetail(deliverygoodsid : number): Promise<ErmcpDeliveryGoodsDetailEx[]> {
+export function QueryDeliveryGoodsDetail(deliverygoodsid?: number): Promise<ErmcpDeliveryGoodsDetailEx[]> {
     const areauserid = APP.get('userAccount').memberuserid; // 所属机构id
-    return commonSearch_go('Ermcp3/QueryDeliveryGoodsDetail', { areauserid, deliverygoodsid }).catch((err) => {
+    const param = deliverygoodsid ? { areauserid, deliverygoodsid } : { areauserid }
+    return commonSearch_go('/Ermcp3/QueryDeliveryGoodsDetail', param).catch((err) => {
         throw new Error(`查询现货商品详情: ${err.message}`);
     });
 }
@@ -62,9 +63,9 @@ export function QueryDeliveryGoodsDetail(deliverygoodsid : number): Promise<Ermc
  * @param excludecfg 排除套保品中已关联的商品组 1-排除
  * @constructor
  */
-export function QueryGoodsfGroup(excludecfg: number): Promise<Ermcp3GoodsGroup[]>{
+export function QueryGoodsfGroup(excludecfg: number): Promise<Ermcp3GoodsGroup[]> {
     const areauserid = APP.get('userAccount').memberuserid; // 所属机构id
-    return commonSearch_go('Ermcp3/QueryDeliveryGoodsDetail', { areauserid, excludecfg }).catch((err) => {
+    return commonSearch_go('Ermcp3/QueryGoodsGroup', { areauserid, excludecfg }).catch((err) => {
         throw new Error(`查询期货商品组: ${err.message}`);
     });
 }

+ 3 - 3
src/services/go/index.ts

@@ -1,4 +1,4 @@
-import { request, goCommonSearchUrl } from '@/services/request/index';
+import { goCommonSearchUrl, request } from '@/services/request/index';
 import { Method } from 'axios';
 
 /**
@@ -29,11 +29,11 @@ export interface BaseResponse {
  * @param params 请求参数
  * @param method 请求方式
  */
-export function commonUpdate_go(url: string, params: Object, method: Method = 'post'): Promise<BaseResponse> {
+export function commonUpdate_go(url: string, data: Object, method: Method = 'post'): Promise<BaseResponse> {
     return request({
         method,
         url: goCommonSearchUrl(url),
-        params,
+        data,
     })
         .then((value) => {
             return {

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

@@ -27,6 +27,7 @@ import rightSpot from '@/views/information/goods/components/rightSpot/index.vue'
 import { openModal } from '@/common/setup/modal/index';
 import { initData } from '@/common/methods/index';
 import AddGoods from '@/views/information/goods/components/add/index.vue';
+import { handleDG } from './setup';
 
 export default defineComponent({
     name: 'spot-variety',
@@ -38,8 +39,10 @@ export default defineComponent({
     },
     setup() {
         const { openAction: addAction } = openModal('spot_contract_btn_add');
+        const { loading, deliveryGoodsList, queryDG } = handleDG();
         initData(() => {
             // 加载数据在这里
+            queryDG();
         });
         return { addAction };
     },

+ 24 - 0
src/views/information/goods/list/spot-variety/setup.ts

@@ -0,0 +1,24 @@
+import { QueryDeliveryGoodsDetail } from '@/services/go/ermcp/goodsInfo';
+import { ErmcpDeliveryGoodsDetailEx } from '@/services/go/ermcp/goodsInfo/interface';
+import { ref } from "vue";
+
+/**
+ * 获取现货品种数据
+ * @returns 
+ */
+export function handleDG() {
+    const loading = ref<boolean>(false);
+    const deliveryGoodsList = ref<ErmcpDeliveryGoodsDetailEx[]>([])
+    function queryDG(param?: number) {
+        debugger
+        loading.value = true;
+        QueryDeliveryGoodsDetail(param).then(res => {
+            deliveryGoodsList.value = res;
+            console.log('QueryDeliveryGoodsDetail', res);
+        }).catch(err => {
+            console.log('err', err);
+
+        }).finally(() => loading.value = false)
+    }
+    return { loading, deliveryGoodsList, queryDG }
+}

+ 0 - 0
src/views/information/goods/setup.ts