Ver código fonte

撤销套保计划

huangbin 4 anos atrás
pai
commit
99bb6e43d6

+ 101 - 104
src/views/business/plan/components/cancel/index.vue

@@ -1,101 +1,102 @@
 <template>
-    <!-- 计划撤销-->
-    <a-modal class="commonModal custom-detail"
-             title="计划撤销"
-             v-model:visible="visible"
-             centered
-             :maskClosable="maskClosableFlag"
-             @cancel="cancel"
-             width="890px">
-        <template #footer>
-            <a-button key="submit"
-                      class="cancelBtn"
-                      @click="cancel">取消
-            </a-button>
-            <a-button key="submit"
-                      type="primary"
-                      :loading="loading"
-                      @click="submit">确认撤销
-            </a-button>
-        </template>
-        <a-form class="inlineForm"
-                    :form="form"
-                    @submit="handleSearch">
-        <fieldset class="formFieldSet">
-            <legend>基本信息</legend>
-                <a-row :gutter="24">
-                    <a-col :span="12">
-                        <a-form-item label="计划类型">
-                            <span class="white">{{ getPlanContractType(selectedRow.contracttype) }}</span>
-                        </a-form-item>
-                    </a-col>
-                    <a-col :span="12">
-                        <a-form-item label="计划名称">
-                            <span class="white">{{ formatValue(selectedRow.hedgeplanno) }}</span>
-                        </a-form-item>
-                    </a-col>
-                </a-row>
-                <a-row :gutter="24">
-                    <a-col :span="12">
-                        <a-form-item label="现货品种">
-                            <span class="white">{{ formatValue(selectedRow.deliverygoodsname) }}</span>
-                        </a-form-item>
-                    </a-col>
-                    <a-col :span="12">
-                        <a-form-item label="标仓系数">
-                            <span class="white">{{ formatValue(selectedRow.convertfactor) }}</span>
-                        </a-form-item>
-                    </a-col>
-                </a-row>
-                <a-row :gutter="24">
-                    <a-col :span="12">
-                        <a-form-item label="计划量">
-                            <span class="white">{{ formatValue(selectedRow.planqty) }}</span>
-                        </a-form-item>
-                    </a-col>
-                    <a-col :span="12">
-                        <a-form-item label="备注">
-                            <span class="white">{{ formatValue(selectedRow.remark) }}</span>
-                        </a-form-item>
-                    </a-col>
-                </a-row>
-        </fieldset>
-        <fieldset class="formFieldSet">
-            <legend>其它信息</legend>
-            <a-row :gutter="24">
-                <a-col :span="12">
-                    <a-form-item label="交易用户">
-                        <span class="white">{{ formatValue(selectedRow.tradeusername) }}</span>
-                    </a-form-item>
-                </a-col>
-                <a-col :span="12">
-                    <a-form-item label="结算币种">
-                        <span class="white">{{ formatValue(selectedRow.currencyname) }}</span>
-                    </a-form-item>
-                </a-col>
-            </a-row>
-            <a-row :gutter="24">
-                <a-col :span="12">
-                    <a-form-item label="备注">
-                        <span class="white">{{ formatValue(selectedRow.remark) }}</span>
-                    </a-form-item>
-                </a-col>
-            </a-row>
-        </fieldset>
-        </a-form>
-    </a-modal>
+  <!-- 计划撤销-->
+  <a-modal class="commonModal custom-detail"
+           title="计划撤销"
+           v-model:visible="visible"
+           centered
+           :maskClosable="maskClosableFlag"
+           @cancel="cancel"
+           width="890px">
+    <template #footer>
+      <a-button key="submit"
+                class="cancelBtn"
+                @click="cancel">取消
+      </a-button>
+      <a-button key="submit"
+                type="primary"
+                :loading="loading"
+                @click="submit">确认撤销
+      </a-button>
+    </template>
+    <a-form class="inlineForm"
+            :form="form"
+            @submit="handleSearch">
+      <fieldset class="formFieldSet">
+        <legend>基本信息</legend>
+        <a-row :gutter="24">
+          <a-col :span="12">
+            <a-form-item label="计划类型">
+              <span class="white">{{ getPlanContractType(selectedRow.contracttype) }}</span>
+            </a-form-item>
+          </a-col>
+          <a-col :span="12">
+            <a-form-item label="计划名称">
+              <span class="white">{{ formatValue(selectedRow.hedgeplanno) }}</span>
+            </a-form-item>
+          </a-col>
+        </a-row>
+        <a-row :gutter="24">
+          <a-col :span="12">
+            <a-form-item label="现货品种">
+              <span class="white">{{ formatValue(selectedRow.deliverygoodsname) }}</span>
+            </a-form-item>
+          </a-col>
+          <a-col :span="12">
+            <a-form-item label="标仓系数">
+              <span class="white">{{ formatValue(selectedRow.convertfactor) }}</span>
+            </a-form-item>
+          </a-col>
+        </a-row>
+        <a-row :gutter="24">
+          <a-col :span="12">
+            <a-form-item label="计划量">
+              <span class="white">{{ formatValue(selectedRow.planqty) }}</span>
+            </a-form-item>
+          </a-col>
+          <a-col :span="12">
+            <a-form-item label="备注">
+              <span class="white">{{ formatValue(selectedRow.remark) }}</span>
+            </a-form-item>
+          </a-col>
+        </a-row>
+      </fieldset>
+      <fieldset class="formFieldSet">
+        <legend>其它信息</legend>
+        <a-row :gutter="24">
+          <a-col :span="12">
+            <a-form-item label="交易用户">
+              <span class="white">{{ formatValue(selectedRow.tradeusername) }}</span>
+            </a-form-item>
+          </a-col>
+          <a-col :span="12">
+            <a-form-item label="结算币种">
+              <span class="white">{{ formatValue(selectedRow.currencyname) }}</span>
+            </a-form-item>
+          </a-col>
+        </a-row>
+        <a-row :gutter="24">
+          <a-col :span="12">
+            <a-form-item label="备注">
+              <span class="white">{{ formatValue(selectedRow.remark) }}</span>
+            </a-form-item>
+          </a-col>
+        </a-row>
+      </fieldset>
+    </a-form>
+  </a-modal>
 </template>
 
 <script lang="ts">
-import {defineComponent, PropType, ref} from 'vue';
-import {closeModal} from '@/common/setup/modal/index';
-import {Ermcp3HedgePlan} from "@/services/go/ermcp/plan/interface";
-import {formatValue} from "@/common/methods";
-import {getPlanContractType} from "@/views/business/plan/setup";
-import {Modal} from "ant-design-vue";
-import {cancelPlan} from "@/views/business/plan/components/setup";
-import {HedgePlanOperateReq} from "@/services/proto/hedgeplan/interface";
-import * as Long from "long";
+import { defineComponent, PropType, ref } from 'vue';
+import { closeModal } from '@/common/setup/modal/index';
+import { Ermcp3HedgePlan } from '@/services/go/ermcp/plan/interface';
+import { formatValue } from '@/common/methods';
+import { getPlanContractType } from '@/views/business/plan/setup';
+import { Modal } from 'ant-design-vue';
+import { HedgePlanOperateReq } from '@/services/proto/hedgeplan/interface';
+import * as Long from 'long';
+import { requestResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
+import { oldHedgePlanReq } from '@/services/proto/hedgeplan';
 
 export default defineComponent({
     name: 'plan_audit_cancel',
@@ -107,7 +108,7 @@ export default defineComponent({
         },
     },
     setup(props, context) {
-        const {visible, cancel} = closeModal('plan_audit_cancel');
+        const { visible, cancel } = closeModal('plan_audit_cancel');
         const maskClosableFlag = ref<boolean>(false);
         const loading = ref<boolean>(false);
 
@@ -120,15 +121,11 @@ export default defineComponent({
                     const params: HedgePlanOperateReq = {
                         HedgePlanID: Long.fromString(props.selectedRow.hedgeplanid),
                         OperateType: 5,
-                    }
-                    cancelPlan(params,  loading)
-                        .then(res => {
-                            cancel()
-                            context.emit('refresh')
-                        })
-                        .catch(err =>{
-                            
-                        })
+                    };
+                    requestResultLoadingAndInfo(oldHedgePlanReq, params, loading, ['撤销成功', '撤销失败:']).then(() => {
+                        context.emit('refresh');
+                        cancel();
+                    });
                 },
                 onCancel() {
                     console.log('Cancel');

+ 1 - 17
src/views/business/plan/components/setup.ts

@@ -1,31 +1,15 @@
-import { commonResultInfo, getRequestResultInfo } from "@/common/methods/request";
 import { validateCommon } from "@/common/setup/validate";
 import APP from '@/services';
 import { QueryAccMgrLoginUser } from "@/services/go/ermcp/account";
 import { ErmcpLoginUserEx } from "@/services/go/ermcp/account/interface";
 import { Ermcp3Wrstandard, ErmcpDeliveryGoodsDetailEx } from "@/services/go/ermcp/goodsInfo/interface";
-import { oldHedgePlanReq } from "@/services/proto/hedgeplan";
-import { HedgePlanOperateReq } from "@/services/proto/hedgeplan/interface";
-import { deletePlanSign } from "@/views/business/plan/setup";
 import { message } from "ant-design-vue";
 import { RuleObject } from "ant-design-vue/lib/form/interface";
-import { reactive, ref, Ref, UnwrapRef } from "vue";
+import { reactive, ref, UnwrapRef } from "vue";
 import { FormState } from "./interface";
 
 
 /**
- * 撤销套保计划
- * @param req 撤销套保计划请求
- * @param loading
- */
-export function cancelPlan(req: HedgePlanOperateReq, loading: Ref<boolean>): Promise<string> {
-    loading.value = true;
-    const sign = getRequestResultInfo(deletePlanSign, 5)  // 接口请求后的返回提示 这里统一进行管理
-    const result = oldHedgePlanReq(req)
-    return commonResultInfo(result, sign, loading)
-}
-
-/**
  * 表单
  */
 export function handleForm() {