Browse Source

commit 现货品种以及详情

xkwg 4 năm trước cách đây
mục cha
commit
d5f9fd8503

+ 1 - 6
src/services/proto/delivery/index.ts

@@ -89,15 +89,10 @@ export const ermsMiddelGoodsEdit = (param: ErmsMiddelGoodsEditReq): Promise<any>
 export const deliveryGoodsCancel = (param: DeliveryGoodsCancelReq): Promise<any> => {
 
     return new Promise((resolve, reject) => {
-        const req = {
-            version: "3.2",
-            userid: getUserId(),
-            loginid: getLongTypeLoginID(),
-        };
         const params = {
             protobufName: 'DeliveryGoodsCancelReq',
             funCodeName: 'DeliveryGoodsCancelReq',
-            reqParams: Object.assign(req, param),
+            reqParams: param,
             msgHeadParams: {
                 AccountID: getSelectedAccountId() === null ? 0 : getSelectedAccountId(),
                 MarketID: 18,   // 目前写死

+ 4 - 5
src/views/information/goods/components/add/setup.ts

@@ -5,6 +5,7 @@ import { DeliveryGoodsApplyReq } from '@/services/proto/delivery/interface';
 import { message } from 'ant-design-vue';
 import { reactive, ref, UnwrapRef } from 'vue';
 import { FormState } from './interface';
+import {addDeliveryGoods} from "@/views/information/goods/components/setup";
 
 /**
  * 处理新增
@@ -12,7 +13,7 @@ import { FormState } from './interface';
  */
 export function handleAdd() {
     const loading = ref<boolean>(false);
-    function addAction(param: FormState): Promise<void> {
+    function addAction(param: FormState): Promise<string> {
         const unitid = param.unitid === undefined ? 0 : param.unitid
         const reqParam: DeliveryGoodsApplyReq = {
             deliverygoodscode: param.deliverygoodscode,
@@ -44,10 +45,8 @@ export function handleAdd() {
             })
         }
         loading.value = true;
-        return addDeliveryGoodsApply(reqParam).then(() => {
-            message.success('新增现货品种成功!')
-            Promise.resolve()
-        }).catch(err => message.error(err.message)).finally(() => loading.value = false)
+        loading.value = true;
+        return addDeliveryGoods(reqParam, loading)
     }
     return { loading, addAction }
 }

+ 5 - 10
src/views/information/goods/components/modify/setup.ts

@@ -5,21 +5,19 @@ import { DeliveryGoodsApplyReq } from '@/services/proto/delivery/interface';
 import { message } from 'ant-design-vue';
 import { reactive, ref, UnwrapRef } from 'vue';
 import { FormState } from './interface';
+import {addDeliveryGoods, modifyDeliveryGoods} from "@/views/information/goods/components/setup";
 
 /**
- * 处理新增
- * @returns 
+ * 处理修改
  */
 export function handleAdd() {
     const loading = ref<boolean>(false);
-    function addAction(param: FormState): Promise<void> {
+    function addAction(param: FormState): Promise<string> {
         const unitid = param.unitid === undefined ? 0 : param.unitid
         const reqParam: DeliveryGoodsApplyReq = {
-            deliverygoodscode: param.deliverygoodscode,
-            deliverygoodsname: param.deliverygoodsname,
             deliverygoodsid: param.deliverygoodsid,
             unitid: unitid,
-            type: 1,
+            type: 2,
             remark: param.remark,
             gldwrstandards: param.gldwrstandards.map(value => {
                 const gldunitid = value.unitid === undefined ? 0 : value.unitid
@@ -44,10 +42,7 @@ export function handleAdd() {
             })
         }
         loading.value = true;
-        return addDeliveryGoodsApply(reqParam).then(() => {
-            message.success('新增现货品种成功!')
-            Promise.resolve()
-        }).catch(err => message.error(err.message)).finally(() => loading.value = false)
+        return modifyDeliveryGoods(reqParam, loading)
     }
     return { loading, addAction }
 }

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

@@ -114,7 +114,7 @@
     </div>
     <Modify :selctedDeliveryGoods="selctedDeliveryGoods" />
     <Disable :selectedRow="selctedDeliveryGoods" />
-    <SpotDetail />
+    <SpotDetail  :selectedRow="selctedDeliveryGoods" />
   </div>
 </template>
 

+ 25 - 3
src/views/information/goods/components/setup.ts

@@ -1,8 +1,8 @@
-import {DeliveryGoodsSign} from "@/views/information/goods/setup";
+import {DeliveryGoodsSign, DeliveryTypeSign} from "@/views/information/goods/setup";
 import {commonResultInfo, getRequestResultInfo} from "@/common/methods/request";
 import {hedgePlanReq} from "@/services/proto/hedgeplan";
-import {deliveryGoodsCancel} from "@/services/proto/delivery";
-import {DeliveryGoodsCancelReq} from "@/services/proto/delivery/interface";
+import {addDeliveryGoodsApply, deliveryGoodsCancel} from "@/services/proto/delivery";
+import {DeliveryGoodsApplyReq, DeliveryGoodsCancelReq} from "@/services/proto/delivery/interface";
 import {Ref} from "vue";
 
 /**
@@ -27,6 +27,28 @@ export function resumeDeliveryGoods(wrstandardid: string, loading: Ref<boolean>)
     return commonResultInfo(result, sign, loading)
 }
 
+/**
+ * 现货品种新增
+ * @param reqParam
+ * @param loading
+ */
+export function addDeliveryGoods(reqParam: DeliveryGoodsApplyReq, loading: Ref<boolean>) :Promise<string>{
+    const sign = getRequestResultInfo(DeliveryTypeSign, 1)  // 接口请求后的返回提示 这里统一进行管理
+    const result = addDeliveryGoodsApply(reqParam)
+    return commonResultInfo(result, sign, loading)
+}
+
+/**
+ * 现货品种修改
+ * @param reqParam
+ * @param loading
+ */
+export function modifyDeliveryGoods(reqParam: DeliveryGoodsApplyReq, loading: Ref<boolean>) :Promise<string>{
+    const sign = getRequestResultInfo(DeliveryTypeSign, 2)  // 接口请求后的返回提示 这里统一进行管理
+    const result = addDeliveryGoodsApply(reqParam)
+    return commonResultInfo(result, sign, loading)
+}
+
 
 /**
  * 这里组装请求

+ 15 - 10
src/views/information/goods/components/spotDetail/index.vue

@@ -24,13 +24,13 @@
           <a-col :span="12">
             <a-form-item label="现货品种名称"
                          name="deliverygoodsname">
-              <span class="white">铜板</span>
+              <span class="white">{{ formatValue(selectedRow.data.deliverygoodsname) }}</span>
             </a-form-item>
           </a-col>
           <a-col :span="12">
             <a-form-item label="现货品种代码"
                          name="deliverygoodscode">
-              <span class="white">CU</span>
+              <span class="white">{{ formatValue(selectedRow.data.deliverygoodsname) }}</span>
             </a-form-item>
           </a-col>
         </a-row>
@@ -38,13 +38,13 @@
           <a-col :span="12">
             <a-form-item label="单位"
                          name="unitid">
-              <span class="white"></span>
+              <span class="white">{{ formatValue(selectedRow.data.enumdicname) }}</span>
             </a-form-item>
           </a-col>
           <a-col :span="12">
             <a-form-item label="状态"
                          name="unitid">
-              <span class="green">正常</span>
+              <span class="green">{{ getValidName(selectedRow.data.isvalid) }}</span>
             </a-form-item>
           </a-col>
         </a-row>
@@ -52,7 +52,7 @@
           <a-col :span="24">
             <a-form-item label="备注"
                          name="remark">
-              <span class="white">铜板的采购价按上海有色网AMMA00铜2021-2-8号均价计价</span>
+              <span class="white">{{ formatValue(selectedRow.data.remark) }}</span>
             </a-form-item>
           </a-col>
         </a-row>
@@ -157,17 +157,20 @@
 </template>
 
 <script lang="ts">
-import { defineComponent, ref } from 'vue';
+import {defineComponent, PropType, ref} from 'vue';
 import { closeModal } from '@/common/setup/modal/index';
-import { initData } from '@/common/methods/index';
+import {formatValue, initData} from '@/common/methods/index';
+import {ErmcpDeliveryGoodsDetailEx} from "@/services/go/ermcp/goodsInfo/interface";
+import {getValidName} from "@/views/information/goods/setup";
 
 export default defineComponent({
     name: 'modify-custom',
     components: {},
     props: {
-        // selectedRow: {
-        //   type:
-        // }
+        selectedRow: {
+            type: Object as PropType<ErmcpDeliveryGoodsDetailEx>,
+            default: {},
+        },
     },
     setup() {
         const { visible, cancel } = closeModal('detail');
@@ -184,6 +187,8 @@ export default defineComponent({
             submit,
             loading,
             maskClosableFlag: false,
+            formatValue,
+            getValidName,
         };
     },
 });

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

@@ -26,6 +26,22 @@ export function getInitMenuData(code: 'goods_info_spot' | 'goods_info_hedge'): M
     return { menuList, menuMap }
 }
 
+/**
+ * 获取现货品种状态
+ * @param type :未激活 1:正常
+ */
+export function getValidName(type: number){
+    let result = "--";
+    switch (type) {
+        case 0:
+            result = "未激活";
+            break
+        case 1:
+            result = "正常";
+            break
+    }
+    return result
+}
 
 
 /************** 接口请求相关提示 ****************/
@@ -35,3 +51,8 @@ export const DeliveryGoodsSign = new Map<number, ResultInfo>([
     [0, ['停用现货品种成功', '停用现货品种失败:']],
     [1, ['恢复现货品种成功', '恢复现货品种失败:']],
 ])
+
+export const DeliveryTypeSign = new Map<number, ResultInfo>([
+    [1, ['新增现货品种成功', '新增现货品种失败:']],
+    [2, ['修改现货品种成功', '修改现货品种失败:']],
+])