Explorar o código

修改套保品种

huangbin %!s(int64=4) %!d(string=hai) anos
pai
achega
e7a22441db

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

@@ -18,7 +18,7 @@ export const addDeliveryGoodsApply = (param: DeliveryGoodsApplyReq): Promise<any
         const req = {
             version: "3.2",
             userid: getUserId(),
-            loginid: getLongTypeLoginID() ,
+            loginid: getLongTypeLoginID(),
         };
         const params = {
             protobufName: 'DeliveryGoodsApplyReq',
@@ -53,11 +53,13 @@ export const ermsMiddelGoodsEdit = (param: ErmsMiddelGoodsEditReq): Promise<any>
     param.areauserid = APP.get('userInfo').MemberUserid // 机构用户id
 
     return new Promise((resolve, reject) => {
+        const userid = getUserId()
         const req = {
             version: "3.2",
-            userid: getUserId(),
-            loginid: getLongTypeLoginID() ,
+            userid,
+            loginid: getLongTypeLoginID(),
         };
+        param.modifierid = userid
         const params = {
             protobufName: 'ErmsMiddelGoodsEditReq',
             funCodeName: 'ErmsMiddelGoodsEditReq',
@@ -92,7 +94,7 @@ export const deliveryGoodsCancel = (param: DeliveryGoodsCancelReq): Promise<any>
         const req = {
             version: "3.2",
             userid: getUserId(),
-            loginid: getLongTypeLoginID() ,
+            loginid: getLongTypeLoginID(),
         };
         const params = {
             protobufName: 'DeliveryGoodsCancelReq',

+ 1 - 1
src/services/proto/delivery/interface.ts

@@ -40,7 +40,7 @@ export interface ErmsMiddelGoodsEditReq {
     relatedgoodsid: number; // uint64 关联交易商品ID
     evaluateratio: number; // double 估价系数
     qtydecimalplace: number; // int32 数量小数位
-    modifierid: number; // uint64 修改人
+    modifierid?: number; // uint64 修改人
     relatedgoodstype: number; // int32 关联商品类型 - 1:期货合约 2:现货品种
     needhedgeratio: number; // double 套保比率
     areauserid?: number; // uint64 机构用户ID

+ 51 - 8
src/views/information/goods/components/hedgingModify/index.vue

@@ -37,10 +37,13 @@
             </a-form-item>
           </a-col>
           <a-col :span="12">
-            <a-form-item label="修改后套保比例">
-              <!-- <a-input class="dialogInput"
-                       v-model:value="domain.wrstandardname"
-                       placeholder="请输入品类"></a-input> -->
+            <a-form-item label="修改后套保比例"
+                         name="needhedgeratio">
+              <a-input-number class="dialogInput"
+                              style="width: 200px"
+                              type="number"
+                              placeholder="请输入套保比例"
+                              v-model:value="formState.needhedgeratio" />
             </a-form-item>
           </a-col>
         </a-row>
@@ -60,12 +63,16 @@
 </template>
 
 <script lang="ts">
-import { defineComponent, PropType, ref } from 'vue';
+import { defineComponent, PropType, ref, toRaw } from 'vue';
 import { closeModal } from '@/common/setup/modal/index';
 import { initData } from '@/common/methods/index';
 import { initMG } from '../../list/hedging-variety/setup';
 import { Ermcp3MiddleGoodsDetail2 } from '@/services/go/ermcp/goodsInfo/interface';
 import { getGoodsUnitEnumItemName } from '@/common/constants/enumsName';
+import { handleForm } from './setup';
+import { ermsMiddelGoodsEdit } from '@/services/proto/delivery';
+import { message } from 'ant-design-vue';
+import { ErmsMiddelGoodsEditReq } from '@/services/proto/delivery/interface';
 
 export default defineComponent({
     name: 'modify-custom',
@@ -77,13 +84,46 @@ export default defineComponent({
         },
     },
 
-    setup(props) {
+    setup(props, context) {
         const { visible, cancel } = closeModal('goods_info_hedge_normal_modify');
-        console.log('selctedMG', props.selctedMG);
+
+        const { rules, formState, formRef } = handleForm();
 
         const loading = ref<boolean>(false);
         function submit() {
-            cancel();
+            formRef.value
+                .validate()
+                .then(() => {
+                    // const param = toRaw(formState);
+                    const { middlegoodsid, goodsunitid, relatedgoodsid, evaluateratio, qtydecimalplace, relatedgoodstype, goodsgroupid, remark } = props.selctedMG.mg;
+                    const param: ErmsMiddelGoodsEditReq = {
+                        middlegoodsid, // uint64 套保品种ID
+                        goodsunitid, // int32 单位ID
+                        relatedgoodsid, // uint64 关联交易商品ID
+                        evaluateratio, // double 估价系数
+                        qtydecimalplace, // int32 数量小数位
+                        // modifierid,// uint64 修改人
+                        relatedgoodstype, // int32 关联商品类型 - 1:期货合约 2:现货品种
+                        needhedgeratio: formState.needhedgeratio as number, // double 套保比率
+                        // areauserid?,// uint64 机构用户ID
+                        goodsgroupid, // uint64 关联期货品种ID
+                        remark, // string 备注
+                    };
+                    ermsMiddelGoodsEdit(param)
+                        .then(() => {
+                            cancel();
+                            context.emit('refresh', true);
+                        })
+                        .catch((err) => {
+                            console.log('err', err);
+
+                            message.error(err);
+                        });
+                    console.log('param', param);
+                })
+                .catch((error: any) => {
+                    console.log('error', error);
+                });
         }
         initData(() => {});
         return {
@@ -93,6 +133,9 @@ export default defineComponent({
             loading,
             maskClosableFlag: false,
             getGoodsUnitEnumItemName,
+            rules,
+            formState,
+            formRef,
         };
     },
 });

+ 24 - 0
src/views/information/goods/components/hedgingModify/setup.ts

@@ -0,0 +1,24 @@
+import { ermsMiddelGoodsEdit } from "@/services/proto/delivery";
+import { ErmsMiddelGoodsEditReq } from "@/services/proto/delivery/interface";
+import { reactive, ref, UnwrapRef } from "vue";
+/**
+ * 表单
+ * @returns 
+ */
+export function handleForm() {
+    interface FormState {
+        needhedgeratio: number | null
+    }
+    const formRef = ref();
+    const formState: UnwrapRef<FormState> = reactive({
+        needhedgeratio: null,
+    })
+    const rules = {
+        needhedgeratio: [{ required: true, message: '请输入套保比例', trigger: 'blur', type: 'number' }],
+    }
+    return { rules, formState, formRef }
+}
+
+export function modifyAction(param: ErmsMiddelGoodsEditReq) {
+    ermsMiddelGoodsEdit(param)
+}

+ 3 - 3
src/views/information/goods/components/rightHedging/index.vue

@@ -134,14 +134,14 @@
         </a-collapse-panel>
       </a-collapse>
     </div>
-    <HedgingDetail @selctedMG="selctedMG" />
-    <HedgingModify @selctedMG="selctedMG" />
+    <HedgingDetail :selctedMG="selctedMG" />
+    <HedgingModify :selctedMG="selctedMG" />
 
   </div>
 </template>
 
 <script lang="ts">
-import { defineComponent, PropType } from 'vue';
+import { defineComponent, PropType, reactive } from 'vue';
 import { initMG } from '@/views/information/goods/list/hedging-variety/setup';
 import { Ermcp3MiddleGoodsDetail2 } from '@/services/go/ermcp/goodsInfo/interface';
 import { initData } from '@/common/methods';