فهرست منبع

计划: 未提交

huangbin 4 سال پیش
والد
کامیت
874f089c1e

+ 17 - 14
src/common/methods/request/resultInfo.ts

@@ -40,8 +40,8 @@ export function commonResultInfo(fn: Promise<any>, sign: ResultInfo, loading: Re
  * 控制 请求接口 打开与关闭loading
  * @param fn 请求接口 函数
  * @param param 请求接口 参数
- * @param loading 
- * @returns 
+ * @param loading
+ * @returns
  */
 export async function controlLoading(fn: Function, loading: Ref<boolean>, param?: any,): Promise<any> {
     console.log('请求接口参数: ', param);
@@ -59,7 +59,7 @@ export async function controlLoading(fn: Function, loading: Ref<boolean>, param?
  * 控制服务请求成功和失败的弹窗提示
  * @param fn 请求接口 函数
  * @param msgInfo [成功结果, 失败结果]
- * @returns 
+ * @returns
  */
 export function controlResultInfo(fn: Promise<any>, msgInfo: [string, string] = ['成功', '失败']) {
     const [sucInfo, errInfo] = msgInfo
@@ -76,8 +76,8 @@ export function controlResultInfo(fn: Promise<any>, msgInfo: [string, string] =
 
 /**
  * 用户查询数据,成功返回数据,失败提示
- * @param fn 
- * @returns 
+ * @param fn
+ * @returns
  */
 export function controlResultErrInfo(fn: Promise<any>) {
     return fn.then(res => {
@@ -102,22 +102,25 @@ export function controlResultErrInfo(fn: Promise<any>) {
 
 /**
  * 处理服务请求时候的loading和 成功和失败提示
- * @param fn 
- * @param param 
- * @param loading 
- * @param messageInfo 
- * @returns 
+ * @param fn
+ * @param param
+ * @param loading
+ * @param messageInfo
+ * @returns
  */
 export function requestResultLoadingAndInfo(fn: Function, param: any, loading: Ref<boolean>, messageInfo: [string, string] = ['成功', '失败']) {
+    const cacheFn = () => controlResultInfo(controlLoading(fn, loading, param), messageInfo)
+    // 防抖
+    // return debounce(cacheFn, 2000)
     return controlResultInfo(controlLoading(fn, loading, param), messageInfo)
 }
 
 /**
  * 查询数据 loading 成功和失败提示
- * @param fn 
- * @param loading 
- * @param param 
- * @returns 
+ * @param fn
+ * @param loading
+ * @param param
+ * @returns
  */
 export function queryResultLoadingAndInfo(fn: Function, loading: Ref<boolean>, param?: any) {
     return controlResultErrInfo(controlLoading(fn, loading, param))

+ 15 - 5
src/common/setup/form/validateAction.ts

@@ -1,11 +1,11 @@
 import { ValidateErrorEntity } from "ant-design-vue/lib/form/interface";
 import { Ref, toRaw, UnwrapRef } from "vue";
-
+let timer: number | null = null
 /**
  * 表单验证
- * @param formRef 
- * @param formState 
- * @returns 
+ * @param formRef
+ * @param formState
+ * @returns
  */
 export function validateAction<T>(formRef: Ref<any>, formState: UnwrapRef<T>): Promise<T> {
     return formRef.value
@@ -13,7 +13,17 @@ export function validateAction<T>(formRef: Ref<any>, formState: UnwrapRef<T>): P
         .then(() => {
             const param = toRaw(formState);
             console.log('请求参数:', param);
-            return param
+            if (timer) {
+                // 节流 2秒
+                const now = new Date().getTime()
+                if (now - timer > 2 * 1000) {
+                    timer = new Date().getTime()
+                    return param
+                }
+            } else {
+                timer = new Date().getTime()
+                return param
+            }
         })
         .catch((error: ValidateErrorEntity<T>) => {
             console.error('表单验证错误:', error);

+ 3 - 3
src/utils/timer/timerUtil.ts

@@ -10,9 +10,9 @@ export interface IntervalTimerNames {
 export interface TimeoutTimerNames {
     logoutTimer: string; //登出1s延时器
     loadMylieList: string; //发布闲置之后延时请求接口数据 不然马上新增数据马上请求是请求不到的
-    debounce: string | null; // 防抖
-    debounceInput: string | null; // 输入框防抖
-    debounceOnSearch: string | null; // 搜索框防抖
+    debounce: string; // 防抖
+    debounceInput: string; // 输入框防抖
+    debounceOnSearch: string; // 搜索框防抖
     overtimeOut: string; // 超时,如果太久没有操作界面,则退出登录
 }
 

+ 8 - 10
src/views/business/plan/components/add/index.vue

@@ -91,11 +91,10 @@
           <a-form-item label="计划量"
                        class="relative"
                        name="PlanQty">
-            <a-input class="dialogInput"
-                     style="width: 200px"
-                     v-model:value="formState.PlanQty"
-                     :suffix="numberUnit"
-                     placeholder="请输入计划量" />
+            <a-input-number class="dialogInput"
+                            style="width: 200px"
+                            v-model:value="formState.PlanQty"
+                            placeholder="请输入计划量"></a-input-number>
           </a-form-item>
         </a-col>
         <a-col :span="12">
@@ -145,7 +144,6 @@
 
 <script lang="ts">
 import { defineComponent, ref } from 'vue';
-import { closeModal } from '@/common/setup/modal/index';
 import { formatTime, initData } from '@/common/methods/index';
 import { getPayCurrencyTypeEnumList, getSpotContractTypeEnumList } from '@/common/constants/enumsList';
 import { AllEnums } from '@/services/go/commonService/interface';
@@ -159,12 +157,13 @@ import { requestResultLoadingAndInfo } from '@/common/methods/request/resultInfo
 import { validateAction } from '@/common/setup/form';
 import { FormState } from '../interface';
 import { handlerManagerList } from '@/common/setup/user';
+import { _closeModal } from '@/common/setup/modal/modal';
 
 export default defineComponent({
     name: 'add-custom',
-    components: {},
+    emits: ['cancel'],
     setup(props, context) {
-        const { visible, cancel } = closeModal('plan_btn_add');
+        const { visible, cancel } = _closeModal(context);
         const loading = ref<boolean>(false);
         const planTye = ref<AllEnums[]>(getSpotContractTypeEnumList());
         // 表单
@@ -198,8 +197,7 @@ export default defineComponent({
                     Tradeuserid: param.Tradeuserid, // 交易用户id
                 };
                 requestResultLoadingAndInfo(hedgePlanReq, reqParam, loading, OperateType === 1 ? ['保存草稿成功', '保存草稿失败:'] : ['提交申请成功', '提交申请失败:']).then(() => {
-                    context.emit('refresh');
-                    cancel();
+                    cancel(true);
                 });
             });
         }

+ 38 - 38
src/views/business/plan/components/delete/index.vue

@@ -7,10 +7,10 @@
            @cancel="cancel"
            width="890px">
     <template #footer>
-        <a-button key="submit"
-                  type="primary"
-                  :loading="loading"
-                  @click="submit">删除</a-button>
+      <a-button key="submit"
+                type="primary"
+                :loading="loading"
+                @click="submit">删除</a-button>
       <a-button key="cancel"
                 type="primary"
                 :loading="loading"
@@ -57,32 +57,33 @@
             </a-form-item>
           </a-col>
         </a-row>
-          <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(getPlanStatusName(selectedRow.hedgeplanstatus)) }}</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>
+        <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(getPlanStatusName(selectedRow.hedgeplanstatus)) }}</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>
       <fieldset class="formFieldSet">
         <legend>审核信息</legend>
@@ -94,7 +95,7 @@
           </a-col>
           <a-col :span="12">
             <a-form-item label="审核人">
-                <span class="white">{{ formatValue(selectedRow.auditname) }}</span>
+              <span class="white">{{ formatValue(selectedRow.auditname) }}</span>
             </a-form-item>
           </a-col>
         </a-row>
@@ -112,20 +113,20 @@
 
 <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, getPlanStatusName} from '@/views/business/plan/setup';
+import { getPlanContractType, getPlanStatusName } from '@/views/business/plan/setup';
 import { Modal } from 'ant-design-vue';
 import { ErmcpHedgePlanReq } from '@/services/proto/hedgeplan/interface';
 import * as Long from 'long';
 import { requestResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
 import { hedgePlanReq } from '@/services/proto/hedgeplan';
-import {getPayCurrencyTypeEnumList} from "@/common/constants/enumsList";
+import { getPayCurrencyTypeEnumList } from '@/common/constants/enumsList';
+import { _closeModal } from '@/common/setup/modal/modal';
 
 export default defineComponent({
     name: 'plan_uncommitted_delete',
-    components: {},
+    emits: ['cancel'],
     props: {
         selectedRow: {
             type: Object as PropType<Ermcp3HedgePlan>,
@@ -133,7 +134,7 @@ export default defineComponent({
         },
     },
     setup(props, context) {
-        const { visible, cancel } = closeModal('plan_uncommitted_delete');
+        const { visible, cancel } = _closeModal(context);
         const loading = ref<boolean>(false);
         function submit() {
             Modal.confirm({
@@ -146,8 +147,7 @@ export default defineComponent({
                         OperateType: 3,
                     };
                     requestResultLoadingAndInfo(hedgePlanReq, params, loading, ['删除成功', '删除失败:']).then(() => {
-                        context.emit('refresh');
-                        cancel();
+                        cancel(true);
                     });
                 },
                 onCancel() {},

+ 116 - 116
src/views/business/plan/components/detail/index.vue

@@ -1,123 +1,124 @@
 <template>
-    <!-- 套保计划详情-->
-    <a-modal class="commonModal custom-detail"
-             title="套保计划详情"
-             v-model:visible="visible"
-             centered
-             @cancel="cancel"
-             width="890px">
-        <template #footer>
-            <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.wrstandardname) }}</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.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.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(getPlanStatusName(selectedRow.hedgeplanstatus)) }}</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>
-            <fieldset class="formFieldSet">
-                <legend>审核信息</legend>
-                <a-row :gutter="24">
-                    <a-col :span="12">
-                        <a-form-item label="审核时间">
-                            <span class="white">{{ formatValue(selectedRow.audittime) }}</span>
-                        </a-form-item>
-                    </a-col>
-                    <a-col :span="12">
-                        <a-form-item label="审核人">
-                            <span class="white">{{ formatValue(selectedRow.auditname) }}</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.auditremark) }}</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
+           @cancel="cancel"
+           width="890px">
+    <template #footer>
+      <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.wrstandardname) }}</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.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.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(getPlanStatusName(selectedRow.hedgeplanstatus)) }}</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>
+      <fieldset class="formFieldSet">
+        <legend>审核信息</legend>
+        <a-row :gutter="24">
+          <a-col :span="12">
+            <a-form-item label="审核时间">
+              <span class="white">{{ formatValue(selectedRow.audittime) }}</span>
+            </a-form-item>
+          </a-col>
+          <a-col :span="12">
+            <a-form-item label="审核人">
+              <span class="white">{{ formatValue(selectedRow.auditname) }}</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.auditremark) }}</span>
+            </a-form-item>
+          </a-col>
+        </a-row>
+      </fieldset>
+    </a-form>
+  </a-modal>
 </template>
 
 <script lang="ts">
-import {defineComponent, PropType, reactive, ref, watchEffect} from 'vue';
-import {closeModal} from '@/common/setup/modal/index';
-import {Ermcp3HedgePlan} from '@/services/go/ermcp/plan/interface';
-import {formatValue} from '@/common/methods';
-import {getPlanContractType, getPlanStatusName} from '@/views/business/plan/setup';
-import {getPayCurrencyTypeEnumList} from "@/common/constants/enumsList";
+import { defineComponent, PropType } from 'vue';
+import { Ermcp3HedgePlan } from '@/services/go/ermcp/plan/interface';
+import { formatValue } from '@/common/methods';
+import { getPlanContractType, getPlanStatusName } from '@/views/business/plan/setup';
+import { getPayCurrencyTypeEnumList } from '@/common/constants/enumsList';
+import { _closeModal } from '@/common/setup/modal/modal';
 
 export default defineComponent({
     name: 'plan-detail',
-    components: {},
+    emits: ['cancel'],
     props: {
         selectedRow: {
             type: Object as PropType<Ermcp3HedgePlan>,
@@ -125,11 +126,10 @@ export default defineComponent({
         },
     },
     setup(props, context) {
-        const {visible, cancel} = closeModal('detail');
+        const { visible, cancel } = _closeModal(context);
 
         function submit() {
-            context.emit('refresh')
-            cancel()
+            cancel();
         }
 
         return {

+ 1 - 1
src/views/business/plan/components/interface.ts

@@ -6,7 +6,7 @@ export interface FormState {
     DeliveryGoodsID: number | undefined// uint64 现货品种ID
     // ProductType?: number // int32 产品类型-1:标准仓单2:等标3:非标
     // SpotGoodsDesc?: string // string 商品型号
-    PlanQty: string, // double 计划数量
+    PlanQty: number | null, // double 计划数量
     ConvertFactor: number | undefined // double 标仓系数
     // PlanTime?: string // string 计划时间
     // TradeDate?: string // string 交易日(yyyyMMdd)

+ 25 - 29
src/views/business/plan/components/modify/index.vue

@@ -12,10 +12,10 @@
                 type="primary"
                 :loading="loading"
                 @click="submit(2)">完成</a-button>
-        <a-button key="cancel"
-                  type="primary"
-                  :loading="loading"
-                  @click="cancel">取消</a-button>
+      <a-button key="cancel"
+                type="primary"
+                :loading="loading"
+                @click="cancel">取消</a-button>
     </template>
     <a-form class="inlineForm"
             ref="formRef"
@@ -92,10 +92,10 @@
           <a-form-item label="计划量"
                        class="relative"
                        name="PlanQty">
-            <a-input class="dialogInput"
-                     style="width: 200px"
-                     v-model:value="formState.PlanQty"
-                     placeholder="请输入计划量" />
+            <a-input-number class="dialogInput"
+                            style="width: 200px"
+                            v-model:value="formState.PlanQty"
+                            placeholder="请输入计划量"></a-input-number>
           </a-form-item>
         </a-col>
         <a-col :span="12">
@@ -144,9 +144,8 @@
 </template>
 
 <script lang="ts">
-import { defineComponent, PropType, ref, watchEffect } from 'vue';
-import { closeModal } from '@/common/setup/modal/index';
-import { formatTime, initData } from '@/common/methods/index';
+import { defineComponent, PropType, ref } from 'vue';
+import { formatTime } from '@/common/methods/index';
 import { getPayCurrencyTypeEnumList, getSpotContractTypeEnumList } from '@/common/constants/enumsList';
 import { AllEnums } from '@/services/go/commonService/interface';
 import { getMiddleGoodsD, handleForm } from '../setup';
@@ -161,10 +160,11 @@ import { requestResultLoadingAndInfo } from '@/common/methods/request/resultInfo
 import { hedgePlanReq } from '@/services/proto/hedgeplan';
 import { validateAction } from '@/common/setup/form';
 import { handlerManagerList } from '@/common/setup/user';
+import { _closeModal } from '@/common/setup/modal/modal';
 
 export default defineComponent({
     name: 'plan_uncommitted_modify',
-    components: {},
+    emits: ['cancel'],
     props: {
         selectedRow: {
             type: Object as PropType<Ermcp3HedgePlan>,
@@ -172,7 +172,7 @@ export default defineComponent({
         },
     },
     setup(props, context) {
-        const { visible, cancel } = closeModal('plan_uncommitted_modify');
+        const { visible, cancel } = _closeModal(context);
         const loading = ref<boolean>(false);
         const planTye = ref<AllEnums[]>(getSpotContractTypeEnumList());
         // 表单
@@ -184,21 +184,18 @@ export default defineComponent({
         // 币种
         const priceTyep = getPayCurrencyTypeEnumList();
 
-        watchEffect(() => {
-            if (visible.value) {
-              getDG();
-              queryTable();
-                mergeTwoObj(formState, props.selectedRow);
-                const { deliverygoodsid, planqty, wrstandardid } = props.selectedRow;
-                deliverygoodsid && chooseMG(deliverygoodsid);
-                formState.PlanQty = String(planqty);
+        getDG();
+        queryTable();
+        mergeTwoObj(formState, props.selectedRow);
+        const { deliverygoodsid, planqty, wrstandardid } = props.selectedRow;
+        deliverygoodsid && chooseMG(deliverygoodsid);
+        formState.PlanQty = planqty;
+
+        if (wrstandardid) {
+            formState.WRStandardID = wrstandardid;
+            chooseWR(wrstandardid);
+        }
 
-                if (wrstandardid) {
-                    formState.WRStandardID = wrstandardid;
-                    chooseWR(wrstandardid);
-                }
-            }
-        });
         function submit(OperateType: 1 | 2) {
             validateAction<FormState>(formRef, formState).then((param) => {
                 const loginId = getLongTypeLoginID() as LongType;
@@ -221,8 +218,7 @@ export default defineComponent({
                     Tradeuserid: param.Tradeuserid, // 交易用户id
                 };
                 requestResultLoadingAndInfo(hedgePlanReq, reqParam, loading, ['修改计划成功', '修改计划失败:']).then(() => {
-                    context.emit('refresh');
-                    cancel();
+                    cancel(true);
                 });
             });
         }

+ 6 - 6
src/views/business/plan/components/recommit/index.vue

@@ -168,7 +168,7 @@ export default defineComponent({
     },
     setup(props, context) {
         const { visible, cancel } = closeModal('plan_uncommitted_recommit');
-                const loading = ref<boolean>(false);
+        const loading = ref<boolean>(false);
         const planTye = ref<AllEnums[]>(getSpotContractTypeEnumList());
         // 表单
         const { formRef, formState, rules } = handleForm();
@@ -178,14 +178,14 @@ export default defineComponent({
         const { tableList, queryTable } = handlerManagerList(loading, 2);
         // 币种
         const priceTyep = getPayCurrencyTypeEnumList();
-                watchEffect(() => {
+        watchEffect(() => {
             if (visible.value) {
-              getDG();
-            queryTable();
+                getDG();
+                queryTable();
                 mergeTwoObj(formState, props.selectedRow);
                 const { deliverygoodsid, planqty, wrstandardid } = props.selectedRow;
                 deliverygoodsid && chooseMG(deliverygoodsid);
-                formState.PlanQty = String(planqty);
+                formState.PlanQty = planqty;
 
                 if (wrstandardid) {
                     formState.WRStandardID = wrstandardid;
@@ -221,7 +221,7 @@ export default defineComponent({
             });
         }
         return {
-                        visible,
+            visible,
             cancel,
             submit,
             loading,

+ 5 - 5
src/views/business/plan/components/setup.ts

@@ -1,10 +1,10 @@
+import { getGoodsUnitEnumItemName } from "@/common/constants/enumsName";
 import { validateCommon } from "@/common/setup/validate";
 import APP from '@/services';
 import { Ermcp3Wrstandard, ErmcpDeliveryGoodsDetailEx } from "@/services/go/ermcp/goodsInfo/interface";
 import { RuleObject } from "ant-design-vue/lib/form/interface";
 import { reactive, ref, UnwrapRef } from "vue";
 import { FormState } from "./interface";
-import {getGoodsUnitEnumItemName} from "@/common/constants/enumsName";
 
 
 /**
@@ -16,7 +16,7 @@ export function handleForm() {
         HedgePlanNo: '',// string 套保计划名称
         ContractType: undefined,// int32 计划类型-1:采购-1:销售
         DeliveryGoodsID: undefined,// uint64 现货品种ID
-        PlanQty: '', // double 计划数量
+        PlanQty: null, // double 计划数量
         ConvertFactor: undefined, // double 标仓系数
         Remark: '', // string 计划备注
         OperateType: 2, // int32 操作类型-1:保存草稿2:提交申请
@@ -35,7 +35,7 @@ export function handleForm() {
         return validateCommon(value, '请选择结算币种');
     };
     const rules = {
-        PlanQty: [{ required: true, message: '请输入计划数量', trigger: 'blur' }],
+        PlanQty: [{ required: true, message: '请输入计划数量', trigger: 'blur', type: 'number', min: 1 }],
         ContractType: [{ required: true, validator: v_ContractType, trigger: 'change' }],
         DeliveryGoodsID: [{ required: true, validator: v_DeliveryGoodsID, trigger: 'change' }],
         Currencyid: [{ required: true, validator: v_Currencyid, trigger: 'change' }],
@@ -69,9 +69,9 @@ export function getMiddleGoodsD(formState: UnwrapRef<FormState>) {
     function chooseWR(id: number | undefined) {
         if (id) {
             const temp = gmlist.value.find(e => e.wrstandardid === id) as Ermcp3Wrstandard
-            if(temp.enumdicname !== null && temp.enumdicname !== ''){  // 如果有单位
+            if (temp.enumdicname !== null && temp.enumdicname !== '') {  // 如果有单位
                 numberUnit.value = temp.enumdicname
-            }else{
+            } else {
                 numberUnit.value = getGoodsUnitEnumItemName(temp.unitid)  // 没有则去枚举找
             }
             if (temp) {

+ 63 - 67
src/views/business/plan/list/uncommitted/index.vue

@@ -3,101 +3,97 @@
   <div class="plan-uncommitted"
        :loading="loading">
     <Filter @search="updateColumn">
-      <BtnList :btnList="commonBtn" />
+      <BtnList :btnList="firstBtn"
+               @click="openComponent" />
     </Filter>
-    <contextMenu :contextMenuList="forDataBtn">
-      <a-table :columns="columns"
-               class="topTable"
-               :pagination="false"
-               :expandedRowKeys="expandedRowKeys"
-               :customRow="Rowclick"
-               rowKey="key"
-               :data-source="tableList">
-        <!-- 额外的展开行 -->
-        <template #expandedRowRender="{ record }">
-          <BtnList :btnList="handleBtnList(record.hedgeplanstatus)" />
-        </template>
-        <template #contracttype="{ text }">
-          <a>{{ getPlanContractType(text) }}</a>
-        </template>
-        <template #hedgeplanstatus="{ text }">
-          <a>{{ getPlanStatusName(text) }}</a>
-        </template>
-      </a-table>
+    <a-table :columns="columns"
+             class="srcollYTable"
+             :scroll="{ x: '100%', y: 'calc(100vh - 163px)' }"
+             :pagination="false"
+             :loading="loading"
+             :expandedRowKeys="expandedRowKeys"
+             :customRow="Rowclick"
+             rowKey="key"
+             :data-source="tableList">
+      <!-- 额外的展开行 -->
+      <template #expandedRowRender="{ record }">
+        <BtnList :btnList="handleBtnList(secondBtn, record)"
+                 :record="record"
+                 @click="openComponent" />
+      </template>
+      <template #contracttype="{ text }">
+        <a>{{ getPlanContractType(text) }}</a>
+      </template>
+      <template #hedgeplanstatus="{ text }">
+        <a>{{ getPlanStatusName(text) }}</a>
+      </template>
+    </a-table>
+    <!-- 右键 -->
+    <contextMenu :contextMenu="contextMenu"
+                 @cancel="closeContext"
+                 :list="secondBtn">
     </contextMenu>
-    <!-- 详情 -->
-    <Detail :selectedRow="selectedRow"
-            @refresh="queryTable" />
-    <!-- 新增 -->
-    <Add :selectedRow="selectedRow"
-         @refresh="queryTable" />
-    <!-- 修改 -->
-    <Modfiy :selectedRow="selectedRow"
-            @refresh="queryTable" />
-    <Recommit :selectedRow="selectedRow"
-              @refresh="queryTable" />
-    <!-- 删除-->
-    <Delete :selectedRow="selectedRow"
-            @refresh="queryTable" />
+    <component :is="componentId"
+               v-if="componentId"
+               :selectedRow="selectedRow"
+               @cancel="closeComponent"></component>
   </div>
 </template>
 
 <script lang="ts">
-import { defineComponent, initData, getTableColumns, getTableEvent, getBtnList, contextMenu, BtnList } from '@/common/export/table';
-import { queryTableList, Ermcp3HedgePlan } from '../index';
-import { Add, Delete, Detail, Filter, Modfiy, Recommit } from '../../components';
+import { queryTableList, BtnList, contextMenu, defineAsyncComponent, defineComponent, ModalEnum, handleComposeTable, ComposeTableParam } from '@/common/export/commonTable';
+
+import { Filter } from '../../components';
 import { getPlanContractType, getPlanStatusName } from '@/views/business/plan/setup';
+import { BtnList as BtnListType } from '@/common/components/btnList/interface';
+import { Ermcp3HedgePlan } from '@/services/go/ermcp/plan/interface';
+import { QueryHedgePlan } from '@/services/go/ermcp/plan';
+
+const Detail = defineAsyncComponent(() => import('../../components/detail/index.vue'));
+const Add = defineAsyncComponent(() => import('../../components/add/index.vue'));
+const Delete = defineAsyncComponent(() => import('../../components/delete/index.vue'));
+const Modfiy = defineAsyncComponent(() => import('../../components/modify/index.vue'));
 
 export default defineComponent({
     name: 'plan-uncommitted',
     components: {
         contextMenu,
         BtnList,
-        Add,
-        Modfiy,
         Filter,
-        Detail,
-        Delete,
-        Recommit,
+        [ModalEnum.detail]: Detail,
+        [ModalEnum.plan_btn_add]: Add,
+        [ModalEnum.plan_uncommitted_delete]: Delete,
+        [ModalEnum.plan_uncommitted_modify]: Modfiy,
     },
     setup() {
-        // 表头数据
-        const { columns, registerColumn, updateColumn } = getTableColumns();
-        // 表格事件
-        const { expandedRowKeys, selectedRow, Rowclick } = getTableEvent<Ermcp3HedgePlan>({});
-        // 表格操作按钮列表
-        const { commonBtn, forDataBtn } = getBtnList('plan_uncommitted', true);
         // 表格列表数据
-        const { loading, tableList, queryTable } = queryTableList('0,4,6');
+        const { loading, tableList, queryTable } = queryTableList<Ermcp3HedgePlan>();
+        // 获取列表数据
+        const queryTableAction = () => queryTable(QueryHedgePlan, '0,4,6');
+        // 表格通用逻辑
+        const param: ComposeTableParam = {
+            queryFn: queryTableAction,
+            menuType: 'plan_uncommitted',
+            tableName: 'table_pcweb_hedging_plan',
+            tableFilterKey: ['contracttype', 'hedgeplanno', 'deliverygoodsname'],
+            isDetail: true,
+        };
 
-        function handleBtnList(type: number) {
-            if (type === 4) {
+        function handleBtnList(btnList: BtnListType[], item: Ermcp3HedgePlan) {
+            if (item.hedgeplanstatus === 4) {
                 // 审核拒绝
-                return forDataBtn.value.filter((e) => e.lable !== '修改');
+                return btnList.filter((e) => e.lable !== '修改');
             } else {
-                return forDataBtn.value.filter((e) => e.lable !== '重新提交');
+                return btnList.filter((e) => e.lable !== '重新提交');
             }
         }
 
-        initData(() => {
-            // 获取列表数据
-            queryTable();
-            // 注册表头信息 过滤
-            registerColumn('table_pcweb_hedging_plan', ['contracttype', 'hedgeplanno', 'deliverygoodsname']);
-        });
         return {
-            columns,
-            expandedRowKeys,
-            selectedRow,
-            Rowclick,
-            commonBtn,
-            forDataBtn,
+            ...handleComposeTable<Ermcp3HedgePlan>(param),
             loading,
             tableList,
-            updateColumn,
             getPlanStatusName,
             getPlanContractType,
-            queryTable,
             handleBtnList,
         };
     },