huangbin 4 年 前
コミット
74c708c45a

+ 5 - 4
src/views/business/plan/components/add/index.vue

@@ -148,14 +148,16 @@ 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';
-import { changeStatus, getMiddleGoodsD, handleForm, handleTrader } from '../setup';
+import { getMiddleGoodsD, handleForm, handleTrader } from '../setup';
 import { ValidateErrorEntity } from 'ant-design-vue/lib/form/interface';
 import { FormState } from '@/views/information/spot-contract/components/interface';
 import { ErmcpHedgePlanReq } from '@/services/proto/hedgeplan/interface';
 import { getLongTypeLoginID } from '@/services/bus/login';
 import { LongType } from '@/services/socket/login/interface';
 import APP from '@/services';
+import { hedgePlanReq } from '@/services/proto/hedgeplan';
 import { getAreaUserId } from '@/services/bus/user';
+import { requestResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
 
 export default defineComponent({
     name: 'add-custom',
@@ -197,11 +199,10 @@ export default defineComponent({
                         Remark: param.Remark,
                         Tradeuserid: param.Tradeuserid, // 交易用户id
                     };
-                    changeStatus(reqParam, OperateType, loading).then(() => {
+                    requestResultLoadingAndInfo(hedgePlanReq, reqParam, loading, OperateType === 1 ? ['保存草稿成功', '保存草稿失败:'] : ['提交申请成功', '提交申请失败:']).then(() => {
+                        context.emit('refresh');
                         cancel();
-                        context.emit('refresh', true);
                     });
-                    console.log('param', param);
                 })
                 .catch((error: ValidateErrorEntity<FormState>) => {
                     console.log('error', error);

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

@@ -19,9 +19,9 @@
                 :loading="loading"
                 @click="refuse">审核拒绝</a-button>
     </template>
-     <a-form class="inlineForm"
-              :form="form"
-              @submit="handleSearch">
+    <a-form class="inlineForm"
+            :form="form"
+            @submit="handleSearch">
       <fieldset class="formFieldSet">
         <legend>基本信息</legend>
         <a-row :gutter="24">
@@ -60,30 +60,30 @@
             </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>
+
+      </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>
@@ -94,11 +94,11 @@ import { closeModal } from '@/common/setup/modal/index';
 import { Modal } from 'ant-design-vue';
 import { ErmcpHedgePlanReq } from '@/services/proto/hedgeplan/interface';
 import Long from 'long';
-import { changeStatus } from '@/views/business/plan/components/setup';
 import { Ermcp3HedgePlan } from '@/services/go/ermcp/plan/interface';
 import { getPlanContractType } from '@/views/business/plan/setup';
 import { formatValue } from '@/common/methods';
-
+import { requestResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
+import { hedgePlanReq } from '@/services/proto/hedgeplan';
 export default defineComponent({
     name: 'plan_audit_audit',
     components: {},
@@ -122,16 +122,13 @@ export default defineComponent({
                         HedgePlanID: Long.fromString(props.selectedRow.hedgeplanid),
                         OperateType: 4,
                         Remark: '通过',
-                        Currencyid: props.selectedRow.currencyid,  // 结算币种id
+                        Currencyid: props.selectedRow.currencyid, // 结算币种id
                         Tradeuserid: props.selectedRow.tradeuserid, // 交易用户id
-
                     };
-                    changeStatus(params, 4, loading)
-                        .then((res) => {
-                            cancel();
-                            context.emit('refresh');
-                        })
-                        .catch((err) => {});
+                    requestResultLoadingAndInfo(hedgePlanReq, params, loading, ['审核通过', '审核失败:']).then(() => {
+                        context.emit('refresh');
+                        cancel();
+                    });
                 },
                 onCancel() {
                     console.log('Cancel');
@@ -149,12 +146,10 @@ export default defineComponent({
                         HedgePlanID: Long.fromString(props.selectedRow.hedgeplanid),
                         OperateType: 5,
                     };
-                    changeStatus(params, 5, loading)
-                        .then((res) => {
-                            cancel();
-                            context.emit('refresh');
-                        })
-                        .catch((err) => {});
+                    requestResultLoadingAndInfo(hedgePlanReq, params, loading, ['审核拒绝通过', '审核拒绝失败:']).then(() => {
+                        context.emit('refresh');
+                        cancel();
+                    });
                 },
                 onCancel() {
                     console.log('Cancel');

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

@@ -13,83 +13,84 @@
                 @click="submit">完成</a-button>
     </template>
     <a-form class="inlineForm"
-                  :form="form"
-                  @submit="handleSearch">
+            :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>
+        <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>
+        <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-form>
   </a-modal>
 </template>
 
 <script lang="ts">
-import {defineComponent, PropType, ref} from 'vue';
+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 {changeStatus} from "@/views/business/plan/components/setup";
-import {ErmcpHedgePlanReq, HedgePlanOperateReq} from "@/services/proto/hedgeplan/interface";
-import * as Long from "long";
+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 { ErmcpHedgePlanReq } from '@/services/proto/hedgeplan/interface';
+import * as Long from 'long';
+import { requestResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
+import { hedgePlanReq } from '@/services/proto/hedgeplan';
 
 export default defineComponent({
     name: 'plan_uncommitted_delete',
@@ -112,15 +113,11 @@ export default defineComponent({
                     const params: ErmcpHedgePlanReq = {
                         HedgePlanID: Long.fromString(props.selectedRow.hedgeplanid),
                         OperateType: 3,
-                    }
-                    changeStatus(params, 3, loading)
-                        .then(res => {
-                            cancel()
-                            context.emit('refresh')
-                        })
-                        .catch(err => {
-
-                        })
+                    };
+                    requestResultLoadingAndInfo(hedgePlanReq, params, loading, ['删除成功', '删除失败:']).then(() => {
+                        context.emit('refresh');
+                        cancel();
+                    });
                 },
                 onCancel() {
                     console.log('Cancel');

+ 5 - 4
src/views/business/plan/components/modify/index.vue

@@ -145,7 +145,7 @@ 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';
-import { changeStatus, getMiddleGoodsD, handleForm, handleTrader } from '../setup';
+import { getMiddleGoodsD, handleForm, handleTrader } from '../setup';
 import { ValidateErrorEntity } from 'ant-design-vue/lib/form/interface';
 import { FormState } from '@/views/information/spot-contract/components/interface';
 import { ErmcpHedgePlanReq } from '@/services/proto/hedgeplan/interface';
@@ -155,6 +155,8 @@ import APP from '@/services';
 import { mergeTwoObj } from '@/utils/objHandle';
 import { Ermcp3HedgePlan } from '@/services/go/ermcp/plan/interface';
 import { getAreaUserId } from '@/services/bus/user';
+import { requestResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
+import { hedgePlanReq } from '@/services/proto/hedgeplan';
 
 export default defineComponent({
     name: 'plan_uncommitted_modify',
@@ -210,11 +212,10 @@ export default defineComponent({
                         Remark: param.Remark,
                         Tradeuserid: param.Tradeuserid, // 交易用户id
                     };
-                    changeStatus(reqParam, OperateType, loading).then(() => {
+                    requestResultLoadingAndInfo(hedgePlanReq, reqParam, loading, ['修改计划成功', '修改计划失败:']).then(() => {
+                        context.emit('refresh');
                         cancel();
-                        context.emit('refresh', true);
                     });
-                    console.log('param', param);
                 })
                 .catch((error: ValidateErrorEntity<FormState>) => {
                     console.log('error', error);

+ 3 - 15
src/views/business/plan/components/setup.ts

@@ -4,9 +4,9 @@ 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 { hedgePlanReq, oldHedgePlanReq } from "@/services/proto/hedgeplan";
-import { ErmcpHedgePlanReq, HedgePlanOperateReq } from "@/services/proto/hedgeplan/interface";
-import { deletePlanSign, hedgePlanSign } from "@/views/business/plan/setup";
+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";
@@ -14,18 +14,6 @@ import { FormState } from "./interface";
 
 
 /**
- * 操作类型-1:保存草稿2:提交申请3:删除4审核通过5审核拒绝
- * @param id HedgePlanID
- * @param type
- */
-export function changeStatus(req: ErmcpHedgePlanReq, type: number, loading: Ref<boolean>): Promise<string> {
-    loading.value = true;
-    const sign = getRequestResultInfo(hedgePlanSign, type)  // 接口请求后的返回提示 这里统一进行管理
-    const result = hedgePlanReq(req)
-    return commonResultInfo(result, sign, loading)
-}
-
-/**
  * 撤销套保计划
  * @param req 撤销套保计划请求
  * @param loading

+ 94 - 91
src/views/information/warehouse-info/compoments/disable/index.vue

@@ -1,86 +1,89 @@
 <template>
-    <!-- 停用仓库信息-->
-    <a-modal class="commonModal warehouse-disable"
-             title="停用仓库信息"
-             v-model:visible="visible"
-             centered
-             :maskClosable="maskClosableFlag"
-             @cancel="cancel"
-             width="890px">
-        <template #footer>
-            <a-button key="cancel"
-                      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">
-            <a-row :gutter="24">
-                <a-col :span="12">
-                    <a-form-item label="仓库类型">
-                        <span class="white">{{ getWareHouseTypeName(selectedRow.warehousetype) }}</span>
-                    </a-form-item>
-                </a-col>
-                <a-col :span="12">
-                    <a-form-item label="仓库名称">
-                        <span class="white">{{ formatValue(selectedRow.warehousename) }}</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.warehousecode) }}</span>
-                    </a-form-item>
-                </a-col>
-                <a-col :span="12">
-                    <a-form-item label="联系人">
-                        <span class="white">{{ formatValue(selectedRow.contactname) }}</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.contactnum) }}</span>
-                    </a-form-item>
-                </a-col>
-                <a-col :span="12">
-                    <a-form-item label="状态">
-                        <span class="white">{{ gerWareHouseStatusName(selectedRow.warehousestatus) }}</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.address) }}</span>
-                    </a-form-item>
-                </a-col>
-                <a-col :span="12">
-                    <a-form-item label="详细地址">
-                        <span class="white">{{ formatValue(selectedRow.address) }}</span>
-                    </a-form-item>
-                </a-col>
-            </a-row>
-        </a-form>
-    </a-modal>
+  <!-- 停用仓库信息-->
+  <a-modal class="commonModal warehouse-disable"
+           title="停用仓库信息"
+           v-model:visible="visible"
+           centered
+           :maskClosable="maskClosableFlag"
+           @cancel="cancel"
+           width="890px">
+    <template #footer>
+      <a-button key="cancel"
+                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">
+      <a-row :gutter="24">
+        <a-col :span="12">
+          <a-form-item label="仓库类型">
+            <span class="white">{{ getWareHouseTypeName(selectedRow.warehousetype) }}</span>
+          </a-form-item>
+        </a-col>
+        <a-col :span="12">
+          <a-form-item label="仓库名称">
+            <span class="white">{{ formatValue(selectedRow.warehousename) }}</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.warehousecode) }}</span>
+          </a-form-item>
+        </a-col>
+        <a-col :span="12">
+          <a-form-item label="联系人">
+            <span class="white">{{ formatValue(selectedRow.contactname) }}</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.contactnum) }}</span>
+          </a-form-item>
+        </a-col>
+        <a-col :span="12">
+          <a-form-item label="状态">
+            <span class="white">{{ gerWareHouseStatusName(selectedRow.warehousestatus) }}</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.address) }}</span>
+          </a-form-item>
+        </a-col>
+        <a-col :span="12">
+          <a-form-item label="详细地址">
+            <span class="white">{{ formatValue(selectedRow.address) }}</span>
+          </a-form-item>
+        </a-col>
+      </a-row>
+    </a-form>
+  </a-modal>
 </template>
 
 <script lang="ts">
-import {defineComponent, PropType, ref} from 'vue';
-import {closeModal} from '@/common/setup/modal/index';
-import {stopOrResumeWarehouse, wareType} from "@/views/information/warehouse-info/compoments/setup";
-import {ErmcpWareHouseInfo} from "@/services/go/ermcp/warehouse-info/interface";
-import {message, Modal} from "ant-design-vue";
-import {gerWareHouseStatusName, getWareHouseTypeName} from "@/views/information/warehouse-info/setup";
-import {formatValue} from "@/common/methods";
+import { defineComponent, PropType, ref } from 'vue';
+import { closeModal } from '@/common/setup/modal/index';
+import { ErmcpWareHouseInfo } from '@/services/go/ermcp/warehouse-info/interface';
+import { Modal } from 'ant-design-vue';
+import { gerWareHouseStatusName, getWareHouseTypeName } from '@/views/information/warehouse-info/setup';
+import { formatValue } from '@/common/methods';
+import { requestResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
+import { getSelectedAccountId } from '@/services/bus/account';
+import { WarehouseStateChangeReq } from '@/services/proto/warehouse/interface';
+import { warehouseStateChangeReq } from '@/services/proto/warehouse';
 
 export default defineComponent({
     name: 'warehouse_info_btn_disable',
@@ -92,9 +95,9 @@ export default defineComponent({
         },
     },
     setup(props, context) {
-        const {visible, cancel} = closeModal('warehouse_info_btn_disable');
+        const { visible, cancel } = closeModal('warehouse_info_btn_disable');
         const maskClosableFlag = ref<boolean>(false);
-        const {loading, changeStatus} = stopOrResumeWarehouse(wareType.stop);
+        const loading = ref<boolean>(false);
 
         function submit() {
             loading.value = true;
@@ -104,16 +107,16 @@ export default defineComponent({
                 cancelText: '取消',
                 onOk() {
                     console.log('OK');
-                    changeStatus(props.selectedRow.autoid)
-                        .then(res => {
-
-                            message.success(res)
-                            context.emit('refresh')
-                            cancel()
-                        })
-                        .catch(err => {
-                            message.error(err)
-                        })
+                    const accountid = getSelectedAccountId()?.toNumber();
+                    const req: WarehouseStateChangeReq = {
+                        accountid: accountid === undefined ? 0 : accountid,
+                        warehouseid: props.selectedRow.autoid,
+                        warehousestatus: 2,
+                    };
+                    requestResultLoadingAndInfo(warehouseStateChangeReq, req, loading, ['停用仓库成功', '停用仓库失败:']).then(() => {
+                        context.emit('refresh');
+                        cancel();
+                    });
                 },
                 onCancel() {
                     console.log('Cancel');

+ 94 - 91
src/views/information/warehouse-info/compoments/recover/index.vue

@@ -1,86 +1,89 @@
 <template>
-    <!-- 恢复仓库信息-->
-    <a-modal class="commonModal modify-custom"
-             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">
-            <a-row :gutter="24">
-                <a-col :span="12">
-                    <a-form-item label="仓库类型">
-                        <span class="white">{{ getWareHouseTypeName(selectedRow.warehousetype) }}</span>
-                    </a-form-item>
-                </a-col>
-                <a-col :span="12">
-                    <a-form-item label="仓库名称">
-                        <span class="white">{{ formatValue(selectedRow.warehousename) }}</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.warehousecode) }}</span>
-                    </a-form-item>
-                </a-col>
-                <a-col :span="12">
-                    <a-form-item label="联系人">
-                        <span class="white">{{ formatValue(selectedRow.contactname) }}</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.contactnum) }}</span>
-                    </a-form-item>
-                </a-col>
-                <a-col :span="12">
-                    <a-form-item label="状态">
-                        <span class="white">{{ gerWareHouseStatusName(selectedRow.warehousestatus) }}</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.address) }}</span>
-                    </a-form-item>
-                </a-col>
-                <a-col :span="12">
-                    <a-form-item label="详细地址">
-                        <span class="white">{{ formatValue(selectedRow.address) }}</span>
-                    </a-form-item>
-                </a-col>
-            </a-row>
-        </a-form>
-    </a-modal>
+  <!-- 恢复仓库信息-->
+  <a-modal class="commonModal modify-custom"
+           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">
+      <a-row :gutter="24">
+        <a-col :span="12">
+          <a-form-item label="仓库类型">
+            <span class="white">{{ getWareHouseTypeName(selectedRow.warehousetype) }}</span>
+          </a-form-item>
+        </a-col>
+        <a-col :span="12">
+          <a-form-item label="仓库名称">
+            <span class="white">{{ formatValue(selectedRow.warehousename) }}</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.warehousecode) }}</span>
+          </a-form-item>
+        </a-col>
+        <a-col :span="12">
+          <a-form-item label="联系人">
+            <span class="white">{{ formatValue(selectedRow.contactname) }}</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.contactnum) }}</span>
+          </a-form-item>
+        </a-col>
+        <a-col :span="12">
+          <a-form-item label="状态">
+            <span class="white">{{ gerWareHouseStatusName(selectedRow.warehousestatus) }}</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.address) }}</span>
+          </a-form-item>
+        </a-col>
+        <a-col :span="12">
+          <a-form-item label="详细地址">
+            <span class="white">{{ formatValue(selectedRow.address) }}</span>
+          </a-form-item>
+        </a-col>
+      </a-row>
+    </a-form>
+  </a-modal>
 </template>
 
 <script lang="ts">
-import {defineComponent, PropType, ref} from 'vue';
-import {closeModal} from '@/common/setup/modal/index';
-import {ErmcpWareHouseInfo} from "@/services/go/ermcp/warehouse-info/interface";
-import {stopOrResumeWarehouse, wareType} from "@/views/information/warehouse-info/compoments/setup";
-import {message, Modal} from "ant-design-vue";
-import {gerWareHouseStatusName, getWareHouseTypeName} from "@/views/information/warehouse-info/setup";
-import {formatValue} from "@/common/methods";
+import { defineComponent, PropType, ref } from 'vue';
+import { closeModal } from '@/common/setup/modal/index';
+import { ErmcpWareHouseInfo } from '@/services/go/ermcp/warehouse-info/interface';
+import { Modal } from 'ant-design-vue';
+import { gerWareHouseStatusName, getWareHouseTypeName } from '@/views/information/warehouse-info/setup';
+import { formatValue } from '@/common/methods';
+import { getSelectedAccountId } from '@/services/bus/account';
+import { WarehouseStateChangeReq } from '@/services/proto/warehouse/interface';
+import { requestResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
+import { warehouseStateChangeReq } from '@/services/proto/warehouse';
 
 export default defineComponent({
     name: 'warehouse_info_btn_recover',
@@ -92,8 +95,8 @@ export default defineComponent({
         },
     },
     setup(props, context) {
-        const {visible, cancel} = closeModal('warehouse_info_btn_recover');
-        const {loading, changeStatus} = stopOrResumeWarehouse(wareType.normal);
+        const { visible, cancel } = closeModal('warehouse_info_btn_recover');
+        const loading = ref<boolean>(false);
         const maskClosableFlag = ref<boolean>(false);
 
         function submit() {
@@ -103,16 +106,16 @@ export default defineComponent({
                 okText: '确认恢复',
                 cancelText: '取消',
                 onOk() {
-                    console.log('OK');
-                    changeStatus(props.selectedRow.autoid)
-                        .then(res => {
-                            message.success(res)
-                            context.emit('refresh')
-                            cancel()
-                        })
-                        .catch(err => {
-                            message.error(err)
-                        })
+                    const accountid = getSelectedAccountId()?.toNumber();
+                    const req: WarehouseStateChangeReq = {
+                        accountid: accountid === undefined ? 0 : accountid,
+                        warehouseid: props.selectedRow.autoid,
+                        warehousestatus: 1,
+                    };
+                    requestResultLoadingAndInfo(warehouseStateChangeReq, req, loading, ['恢复仓库成功', '恢复仓库失败:']).then(() => {
+                        context.emit('refresh');
+                        cancel();
+                    });
                 },
                 onCancel() {
                     console.log('Cancel');

+ 2 - 56
src/views/information/warehouse-info/compoments/setup.ts

@@ -1,66 +1,12 @@
 import { commonResultInfo, getRequestResultInfo } from "@/common/methods/request";
 import { validateCommon } from "@/common/setup/validate";
-import { getSelectedAccountId } from "@/services/bus/account";
-import { addWarehouseApply, warehouseStateChangeReq } from "@/services/proto/warehouse";
-import { WarehouseApplyReq, WarehouseStateChangeReq } from "@/services/proto/warehouse/interface";
+import { addWarehouseApply } from "@/services/proto/warehouse";
+import { WarehouseApplyReq } from "@/services/proto/warehouse/interface";
 import { message } from "ant-design-vue";
 import { RuleObject } from "ant-design-vue/lib/form/interface";
 import { reactive, Ref, ref } from "vue";
 import { warehouseApplyRequestResultMsg } from "../setup";
 
-export const enum wareType {
-    normal = 1, // 正常
-    stop = 2, // 停用
-}
-
-/**
- * 更变仓库信息状态
- * @param type normal: 将停用恢复成正常  stop: 将正常设置为停用
- */
-export function stopOrResumeWarehouse(type: wareType) {
-    const loading = ref<boolean>(false);
-    let warehousestatus = 1;
-    switch (type) {
-        case wareType.normal:
-            warehousestatus = 1  // 恢复
-            break;
-        case wareType.stop:
-            warehousestatus = 2  // 停用
-            break;
-    }
-    /**
-     * 提交切换状态请求
-     * @param warehouseid 操作的仓库id
-     */
-    function changeStatus(warehouseid: number): Promise<string> {
-        const accountid = getSelectedAccountId()?.toNumber()
-        const req: WarehouseStateChangeReq = {
-            accountid: accountid === undefined ? 0 : accountid,
-            warehouseid: warehouseid,
-            warehousestatus: warehousestatus
-        }
-        return warehouseStateChangeReq(req)
-            .then(res => {
-                if (warehousestatus === 1) {
-                    return Promise.resolve("恢复成功")
-                } else {
-                    return Promise.resolve("停用成功")
-                }
-            })
-            .catch(err => {
-                if (warehousestatus === 1) {
-                    return Promise.reject("恢复失败:" + err)
-                } else {
-                    return Promise.reject("停用失败:" + err)
-                }
-            })
-            .finally(() => {
-                loading.value = false
-            })
-    }
-    return { loading, changeStatus }
-}
-
 export interface FormState {
     type: number // int32 类型 1 新增 2 修改
     warehouseid?: number // uint64 仓库ID