浏览代码

商品信息代码整理

yu.jie 4 年之前
父节点
当前提交
2a0d8e9210

+ 3 - 5
src/services/proto/delivery/index.ts

@@ -15,11 +15,9 @@ import {ErmcpHedgePlanReq} from "@/services/proto/hedgeplan/interface";
  * @param param DeliveryGoodsApplyReq
  */
 export const addDeliveryGoodsApply = (param: DeliveryGoodsApplyReq): Promise<any> => {
-    const req = {
-        version: "3.2",
-        userid: getUserId(),
-    };
-    Object.assign(req, param)
+    param.version = '3.2'
+    param.userid = getUserId()
+    param.loginid = Number(getLongTypeLoginID())
     return protoMiddleware<DeliveryGoodsApplyReq>(param, 'DeliveryGoodsApplyReq', 'DeliveryGoodsApplyRsp', 2)
 }
 

+ 3 - 0
src/services/proto/delivery/interface.ts

@@ -10,6 +10,9 @@ export interface DeliveryGoodsApplyReq {
     glddgfactoryItems: GLDDGFactoryItemEx[] //   GLDDGFactoryItemEx 现货商品品牌数据
     wrsconvertdetails: WRSConvertDetailEx[] // WRSConvertDetailEx 现货商品折算配置明细数据
 
+    userid?: number;
+    version?: string; // string 接口版本号(目前支持2.0 3.1 3.2)
+    loginid?: number; // uint64 登录ID
 }
 
 // 现货商品型号数据 0 29 172

+ 38 - 4
src/views/information/goods/components/add/index.vue

@@ -280,12 +280,16 @@ import { defineComponent, ref, toRaw, watchEffect } from 'vue';
 import { closeModal } from '@/common/setup/modal/index';
 import { initData } from '@/common/methods/index';
 import { PlusOutlined, MinusOutlined } from '@ant-design/icons-vue';
-import { handleAdd, handleFromState, handleGoodsGroup } from './setup';
+import { handleFromState, handleGoodsGroup } from './setup';
 import { RuleObject, ValidateErrorEntity } from 'ant-design-vue/es/form/interface';
 import { FormState, WRSConvertDetailEx } from './interface';
 import { validateCommon } from '@/common/setup/validate';
 import { getGoodsUnitEnumList } from '@/common/constants/enumsList';
 import { getGoodsUnitEnumItemName } from '@/common/constants/enumsName';
+import {requestResultLoadingAndInfo} from "@/common/methods/request/resultInfo";
+import {QueryModifyUserInfo} from "@/services/go/ermcp/customInfo";
+import {DeliveryGoodsApplyReq} from "@/services/proto/delivery/interface";
+import {addDeliveryGoodsApply} from "@/services/proto/delivery";
 
 /**
  * 检验单位
@@ -311,7 +315,7 @@ export default defineComponent({
         // 控制关闭弹窗
         const { visible, cancel } = closeModal('goods_info_spot_normal_add');
         // 下单方法
-        const { loading, addAction } = handleAdd();
+        const loading = ref<boolean>(false);
         // 单位列表
         const unitList = getGoodsUnitEnumList();
         function submit() {
@@ -319,9 +323,39 @@ export default defineComponent({
                 .validate()
                 .then(() => {
                     const param = toRaw(formState);
-                    addAction(param).then(() => {
+                    const unitid = param.unitid === undefined ? 0 : param.unitid
+                    const reqParam: DeliveryGoodsApplyReq = {
+                        deliverygoodscode: param.deliverygoodscode,
+                        deliverygoodsname: param.deliverygoodsname,
+                        unitid: unitid,
+                        type: 1,
+                        remark: param.remark,
+                        gldwrstandards: param.gldwrstandards.map(value => {
+                            const gldunitid = value.unitid === undefined ? 0 : value.unitid
+                            const convertfactors: any = value.convertfactor === null ? 0 : value.convertfactor
+                            return {
+                                wrstandardid: value.wrstandardid,
+                                wrstandardname: value.wrstandardname,
+                                unitid: gldunitid,
+                                convertfactor: (convertfactors as string) ? Number(convertfactors) : convertfactors
+                            }
+                        }),
+                        glddgfactoryItems: param.glddgfactoryItems,
+                        wrsconvertdetails: param.wrsconvertdetails.map(value => {
+                            const middlegoodsid = value.middlegoodsid === undefined ? 0 : value.middlegoodsid
+                            const convertratio: any = value.convertratio === null ? 0 : value.convertratio
+                            const wrsunitid = value.unitid === null ? 0 : value.unitid
+                            return {
+                                middlegoodsid: middlegoodsid,
+                                convertratio: (convertratio as string) ? Number(convertratio) : convertratio,
+                                unitid: wrsunitid
+                            }
+                        })
+                    }
+                    debugger
+                    requestResultLoadingAndInfo(addDeliveryGoodsApply, reqParam, loading, ['新增现货品种成功', '新增现货品种失败:']).then(() => {
                         cancel();
-                        context.emit('refresh', true);
+                        context.emit('refresh');
                     });
                     console.log('param', param);
                 })

+ 0 - 47
src/views/information/goods/components/add/setup.ts

@@ -1,55 +1,8 @@
 import { QueryGoodsfGroup } from '@/services/go/ermcp/goodsInfo';
 import { Ermcp3GoodsGroup } from '@/services/go/ermcp/goodsInfo/interface';
-import { addDeliveryGoodsApply } from '@/services/proto/delivery';
-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";
-
-/**
- * 处理新增
- * @returns 
- */
-export function handleAdd() {
-    const loading = ref<boolean>(false);
-    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,
-            remark: param.remark,
-            gldwrstandards: param.gldwrstandards.map(value => {
-                const gldunitid = value.unitid === undefined ? 0 : value.unitid
-                const convertfactors: any = value.convertfactor === null ? 0 : value.convertfactor
-                return {
-                    wrstandardid: value.wrstandardid,
-                    wrstandardname: value.wrstandardname,
-                    unitid: gldunitid,
-                    convertfactor: (convertfactors as string) ? Number(convertfactors) : convertfactors
-                }
-            }),
-            glddgfactoryItems: param.glddgfactoryItems,
-            wrsconvertdetails: param.wrsconvertdetails.map(value => {
-                const middlegoodsid = value.middlegoodsid === undefined ? 0 : value.middlegoodsid
-                const convertratio: any = value.convertratio === null ? 0 : value.convertratio
-                const wrsunitid = value.unitid === null ? 0 : value.unitid
-                return {
-                    middlegoodsid: middlegoodsid,
-                    convertratio: (convertratio as string) ? Number(convertratio) : convertratio,
-                    unitid: wrsunitid
-                }
-            })
-        }
-        loading.value = true;
-        loading.value = true;
-        return addDeliveryGoods(reqParam, loading)
-    }
-    return { loading, addAction }
-}
 
 /**
  * 处理表单数据

+ 9 - 5
src/views/information/goods/components/disable/index.vue

@@ -147,11 +147,13 @@
 import { defineComponent, PropType, ref } from 'vue';
 import { closeModal } from '@/common/setup/modal/index';
 import { formatValue } from '@/common/methods';
-import { getStatusName } from '@/common/constants/enumsName';
+import {getStatusName, getValidName} from '@/common/constants/enumsName';
 import { Modal } from 'ant-design-vue';
-import { stopDeliveryGoods } from '@/views/information/goods/components/setup';
+import {reqDeliveryGoodsBuilder} from '@/views/information/goods/components/setup';
 import { ErmcpDeliveryGoodsDetailEx } from '@/services/go/ermcp/goodsInfo/interface';
-import {getValidName} from "@/views/information/goods/setup";
+import {requestResultLoadingAndInfo} from "@/common/methods/request/resultInfo";
+import {addDeliveryGoodsApply, deliveryGoodsCancel} from "@/services/proto/delivery";
+import {DeliveryGoodsCancelReq} from "@/services/proto/delivery/interface";
 
 export default defineComponent({
     name: 'custom-disable',
@@ -162,7 +164,7 @@ export default defineComponent({
             default: {},
         },
     },
-    setup(props) {
+    setup(props, context) {
         const { visible, cancel } = closeModal('goods_info_spot_normal_disable');
         const maskClosableFlag = ref<boolean>(false);
         const loading = ref<boolean>(false);
@@ -172,8 +174,10 @@ export default defineComponent({
                 okText: '确认停用',
                 cancelText: '取消',
                 onOk() {
-                    stopDeliveryGoods(props.selectedRow.data.deliverygoodsid.toString(), loading).then((res) => {
+                    let reqParam: DeliveryGoodsCancelReq = reqDeliveryGoodsBuilder(props.selectedRow.data.deliverygoodsid.toString(), 0)
+                    requestResultLoadingAndInfo(deliveryGoodsCancel, reqParam, loading, ['停用现货品种成功', '停用现货品种失败:']).then(() => {
                         cancel();
+                        context.emit('refresh');
                     });
                 },
                 onCancel() {

+ 6 - 12
src/views/information/goods/components/hedgingModify/index.vue

@@ -70,9 +70,10 @@ 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 {deliveryGoodsCancel, ermsMiddelGoodsEdit} from '@/services/proto/delivery';
 import { message } from 'ant-design-vue';
 import { ErmsMiddelGoodsEditReq } from '@/services/proto/delivery/interface';
+import {requestResultLoadingAndInfo} from "@/common/methods/request/resultInfo";
 
 export default defineComponent({
     name: 'modify-custom',
@@ -94,7 +95,6 @@ export default defineComponent({
             formRef.value
                 .validate()
                 .then(() => {
-                    loading.value = true;
                     const { middlegoodsid, goodsunitid, relatedgoodsid, evaluateratio, qtydecimalplace, relatedgoodstype, goodsgroupid, remark } = props.selctedMG.mg;
                     const param: ErmsMiddelGoodsEditReq = {
                         middlegoodsid, // uint64 套保品种ID
@@ -109,16 +109,10 @@ export default defineComponent({
                         goodsgroupid, // uint64 关联期货品种ID
                         remark, // string 备注
                     };
-                    ermsMiddelGoodsEdit(param)
-                        .then(() => {
-                            message.success('修改成功!');
-                            cancel();
-                            context.emit('refresh', true);
-                        })
-                        .catch((err) => {
-                            message.error(err);
-                        })
-                        .finally(() => (loading.value = false));
+                    requestResultLoadingAndInfo(ermsMiddelGoodsEdit, param, loading, ['修改成功', '修改失败:']).then(() => {
+                        cancel();
+                        context.emit('refresh');
+                    });
                 })
                 .catch((error: any) => {
                     console.log('error', error);

+ 341 - 270
src/views/information/goods/components/modify/index.vue

@@ -1,293 +1,298 @@
 <template>
-  <!-- 修改现货品种 -->
-  <a-modal class="commonModal addSpotVariety"
-           title="修改现货品种"
-           v-if="visible"
-           v-model:visible="visible"
-           centered
-           :maskClosable="maskClosableFlag"
-           @cancel="cancel"
-           width="890px">
-    <template #footer>
-      <a-button key="submit"
-                type="primary"
-                :loading="loading"
-                @click="submit">完成</a-button>
-    </template>
-    <a-form class="inlineForm"
-            ref="formRef"
-            :model="formState"
-            :rules="rules">
-      <fieldset class="formFieldSet">
-        <legend>基本信息</legend>
-        <a-row :gutter="24">
-          <a-col :span="12">
-            <a-form-item label="现货品种名称"
-                         name="deliverygoodsname">
-              <a-input class="dialogInput"
-                       v-model:value="formState.deliverygoodsname"
-                       style="width: 200px"
-                       placeholder="请输入现货品种名称" />
-            </a-form-item>
-          </a-col>
-          <a-col :span="12">
-            <a-form-item label="现货品种代码"
-                         name="deliverygoodscode">
-              <a-input class="dialogInput"
-                       style="width: 200px"
-                       v-model:value="formState.deliverygoodscode"
-                       placeholder="请输入现货品种代码" />
-            </a-form-item>
-          </a-col>
-        </a-row>
-        <a-row :gutter="24">
-          <a-col :span="24">
-            <a-form-item label="单位"
-                         name="unitid">
-              <a-select class="inlineFormSelect"
-                        style="width: 200px"
-                        v-model:value="formState.unitid"
-                        placeholder="请选择单位">
-                <a-select-option v-for="item in unitList"
-                                 :value="item.enumitemname"
-                                 :key="item.autoid">
-                  {{item.enumdicname}}
-                </a-select-option>
-              </a-select>
-            </a-form-item>
-          </a-col>
-        </a-row>
-        <a-row :gutter="24">
-          <a-col :span="24">
-            <a-form-item label="备注"
-                         name="remark">
-              <a-input class="dialogInput"
-                       v-model:value="formState.remark"
-                       style="width: 588px"
-                       placeholder="请输入备注" />
-            </a-form-item>
-          </a-col>
-        </a-row>
-      </fieldset>
-      <fieldset class="formFieldSet">
-        <legend>品类信息</legend>
-        <a-row :gutter="24"
-               class="dialogRowTitle">
-          <a-col :span="6">
+    <!-- 修改现货品种 -->
+    <a-modal class="commonModal addSpotVariety"
+             title="修改现货品种"
+             v-if="visible"
+             v-model:visible="visible"
+             centered
+             :maskClosable="maskClosableFlag"
+             @cancel="cancel"
+             width="890px">
+        <template #footer>
+            <a-button key="submit"
+                      type="primary"
+                      :loading="loading"
+                      @click="submit">完成
+            </a-button>
+        </template>
+        <a-form class="inlineForm"
+                ref="formRef"
+                :model="formState"
+                :rules="rules">
+            <fieldset class="formFieldSet">
+                <legend>基本信息</legend>
+                <a-row :gutter="24">
+                    <a-col :span="12">
+                        <a-form-item label="现货品种名称"
+                                     name="deliverygoodsname">
+                            <a-input class="dialogInput"
+                                     v-model:value="formState.deliverygoodsname"
+                                     style="width: 200px"
+                                     placeholder="请输入现货品种名称"/>
+                        </a-form-item>
+                    </a-col>
+                    <a-col :span="12">
+                        <a-form-item label="现货品种代码"
+                                     name="deliverygoodscode">
+                            <a-input class="dialogInput"
+                                     style="width: 200px"
+                                     v-model:value="formState.deliverygoodscode"
+                                     placeholder="请输入现货品种代码"/>
+                        </a-form-item>
+                    </a-col>
+                </a-row>
+                <a-row :gutter="24">
+                    <a-col :span="24">
+                        <a-form-item label="单位"
+                                     name="unitid">
+                            <a-select class="inlineFormSelect"
+                                      style="width: 200px"
+                                      v-model:value="formState.unitid"
+                                      placeholder="请选择单位">
+                                <a-select-option v-for="item in unitList"
+                                                 :value="item.enumitemname"
+                                                 :key="item.autoid">
+                                    {{ item.enumdicname }}
+                                </a-select-option>
+                            </a-select>
+                        </a-form-item>
+                    </a-col>
+                </a-row>
+                <a-row :gutter="24">
+                    <a-col :span="24">
+                        <a-form-item label="备注"
+                                     name="remark">
+                            <a-input class="dialogInput"
+                                     v-model:value="formState.remark"
+                                     style="width: 588px"
+                                     placeholder="请输入备注"/>
+                        </a-form-item>
+                    </a-col>
+                </a-row>
+            </fieldset>
+            <fieldset class="formFieldSet">
+                <legend>品类信息</legend>
+                <a-row :gutter="24"
+                       class="dialogRowTitle">
+                    <a-col :span="6">
             <span>
               <span class="red">*</span>
               品类
             </span>
-          </a-col>
-          <a-col :span="6">
+                    </a-col>
+                    <a-col :span="6">
             <span>
               <span class="red">*</span>
               单位
             </span>
-          </a-col>
-          <a-col :span="6">
+                    </a-col>
+                    <a-col :span="6">
             <span>
               <span class="red">*</span>
               标仓系数
             </span>
-          </a-col>
-          <a-col :span="6">
+                    </a-col>
+                    <a-col :span="6">
             <span>
               操作
             </span>
-          </a-col>
-          <template v-for="(domain, index) in formState.gldwrstandards"
-                    :key="domain.index + 'domain'">
-            <a-col :span="6">
-              <a-form-item :name="['gldwrstandards',index, 'wrstandardname', ]"
-                           :rules="rules.gldwrstandards.wrstandardname">
-                <a-input class="dialogInput"
-                         v-model:value="domain.wrstandardname"
-                         placeholder="请输入品类"></a-input>
-              </a-form-item>
-            </a-col>
-            <a-col :span="6">
-              <a-form-item :name="['gldwrstandards',index,'unitid' ]"
-                           :rules="rules.gldwrstandards.unitid">
-                <a-select class="inlineFormSelect"
-                          v-model:value="domain.unitid"
-                          placeholder="请选择单位">
-                  <a-select-option v-for="item in unitList"
-                                   :value="item.enumitemname"
-                                   :key="item.autoid">
-                    {{item.enumdicname}}
-                  </a-select-option>
-                </a-select>
-              </a-form-item>
-            </a-col>
-            <a-col :span="6">
-              <a-form-item :name="['gldwrstandards',index,'convertfactor']"
-                           :rules="rules.gldwrstandards.convertfactor">
-                <a-input-number class="dialogInput"
-                                style="width: 200px"
-                                v-model:value="domain.convertfactor"
-                                placeholder="请输入标仓系数"></a-input-number>
-              </a-form-item>
-            </a-col>
-            <a-col :span="6"
-                   class="tc">
-              <a-button class="plusBtn"
-                        @click="deleteOne('gldwrstandards', index)"
-                        v-if="index > 0">
-                <template #icon>
-                  <MinusOutlined />
-                </template>
-              </a-button>
-              <a-button class="minusBtn"
-                        @click="addOne('gldwrstandards')">
-                <template #icon>
-                  <PlusOutlined />
-                </template>
-              </a-button>
-            </a-col>
-          </template>
-        </a-row>
-      </fieldset>
-      <fieldset class="formFieldSet">
-        <legend>品牌信息</legend>
-        <a-row :gutter="24"
-               class="dialogRowTitle dialogRowTitle2">
-          <a-col :span="12">
+                    </a-col>
+                    <template v-for="(domain, index) in formState.gldwrstandards"
+                              :key="domain.index + 'domain'">
+                        <a-col :span="6">
+                            <a-form-item :name="['gldwrstandards',index, 'wrstandardname', ]"
+                                         :rules="rules.gldwrstandards.wrstandardname">
+                                <a-input class="dialogInput"
+                                         v-model:value="domain.wrstandardname"
+                                         placeholder="请输入品类"></a-input>
+                            </a-form-item>
+                        </a-col>
+                        <a-col :span="6">
+                            <a-form-item :name="['gldwrstandards',index,'unitid' ]"
+                                         :rules="rules.gldwrstandards.unitid">
+                                <a-select class="inlineFormSelect"
+                                          v-model:value="domain.unitid"
+                                          placeholder="请选择单位">
+                                    <a-select-option v-for="item in unitList"
+                                                     :value="item.enumitemname"
+                                                     :key="item.autoid">
+                                        {{ item.enumdicname }}
+                                    </a-select-option>
+                                </a-select>
+                            </a-form-item>
+                        </a-col>
+                        <a-col :span="6">
+                            <a-form-item :name="['gldwrstandards',index,'convertfactor']"
+                                         :rules="rules.gldwrstandards.convertfactor">
+                                <a-input-number class="dialogInput"
+                                                style="width: 200px"
+                                                v-model:value="domain.convertfactor"
+                                                placeholder="请输入标仓系数"></a-input-number>
+                            </a-form-item>
+                        </a-col>
+                        <a-col :span="6"
+                               class="tc">
+                            <a-button class="plusBtn"
+                                      @click="deleteOne('gldwrstandards', index)"
+                                      v-if="index > 0">
+                                <template #icon>
+                                    <MinusOutlined/>
+                                </template>
+                            </a-button>
+                            <a-button class="minusBtn"
+                                      @click="addOne('gldwrstandards')">
+                                <template #icon>
+                                    <PlusOutlined/>
+                                </template>
+                            </a-button>
+                        </a-col>
+                    </template>
+                </a-row>
+            </fieldset>
+            <fieldset class="formFieldSet">
+                <legend>品牌信息</legend>
+                <a-row :gutter="24"
+                       class="dialogRowTitle dialogRowTitle2">
+                    <a-col :span="12">
             <span>
               <span class="red">*</span>
               品牌
             </span>
-          </a-col>
-          <a-col :span="12">
+                    </a-col>
+                    <a-col :span="12">
             <span>
               操作
             </span>
-          </a-col>
-          <template v-for="(domain, index) in formState.glddgfactoryItems"
-                    :key="domain.index + 'domain'">
-            <a-col :span="12">
-              <a-form-item :name="['glddgfactoryItems',index,'dgfactoryitemvalue']"
-                           :rules="rules.glddgfactoryItems.dgfactoryitemvalue">
-                <a-input class="dialogInput"
-                         v-model:value="domain.dgfactoryitemvalue"
-                         placeholder="请输入品牌"></a-input>
-              </a-form-item>
-            </a-col>
-            <a-col :span="12">
-              <a-button class="plusBtn"
-                        @click="deleteOne('glddgfactoryItems', index)"
-                        v-if="index > 0">
-                <template #icon>
-                  <MinusOutlined />
-                </template>
-              </a-button>
-              <a-button class="minusBtn"
-                        @click="addOne('glddgfactoryItems')">
-                <template #icon>
-                  <PlusOutlined />
-                </template>
-              </a-button>
-            </a-col>
-          </template>
-        </a-row>
-      </fieldset>
-      <fieldset class="formFieldSet">
-        <legend>套保品种信息</legend>
-        <a-row :gutter="24"
-               class="dialogRowTitle">
-          <a-col :span="6">
+                    </a-col>
+                    <template v-for="(domain, index) in formState.glddgfactoryItems"
+                              :key="domain.index + 'domain'">
+                        <a-col :span="12">
+                            <a-form-item :name="['glddgfactoryItems',index,'dgfactoryitemvalue']"
+                                         :rules="rules.glddgfactoryItems.dgfactoryitemvalue">
+                                <a-input class="dialogInput"
+                                         v-model:value="domain.dgfactoryitemvalue"
+                                         placeholder="请输入品牌"></a-input>
+                            </a-form-item>
+                        </a-col>
+                        <a-col :span="12">
+                            <a-button class="plusBtn"
+                                      @click="deleteOne('glddgfactoryItems', index)"
+                                      v-if="index > 0">
+                                <template #icon>
+                                    <MinusOutlined/>
+                                </template>
+                            </a-button>
+                            <a-button class="minusBtn"
+                                      @click="addOne('glddgfactoryItems')">
+                                <template #icon>
+                                    <PlusOutlined/>
+                                </template>
+                            </a-button>
+                        </a-col>
+                    </template>
+                </a-row>
+            </fieldset>
+            <fieldset class="formFieldSet">
+                <legend>套保品种信息</legend>
+                <a-row :gutter="24"
+                       class="dialogRowTitle">
+                    <a-col :span="6">
             <span>
               <span class="red">*</span>
               套保品种
             </span>
-          </a-col>
-          <a-col :span="6">
+                    </a-col>
+                    <a-col :span="6">
             <span>
               <span class="red">*</span>
               单位
             </span>
-          </a-col>
-          <a-col :span="6">
+                    </a-col>
+                    <a-col :span="6">
             <span>
               <span class="red">*</span>
               套保系数
             </span>
-          </a-col>
-          <a-col :span="6">
+                    </a-col>
+                    <a-col :span="6">
             <span>
               操作
             </span>
-          </a-col>
-          <template v-for="(domain, index) in formState.wrsconvertdetails"
-                    :key="domain.index + 'domain'">
-            <a-col :span="6">
-              <a-form-item :name="['wrsconvertdetails',index,'middlegoodsid']"
-                           :rules="rules.wrsconvertdetails.middlegoodsid">
-                <a-select class="inlineFormSelect"
-                          @change="middleChange(domain.middlegoodsid, domain)"
-                          v-model:value="domain.middlegoodsid"
-                          placeholder="请选择套保品种">
-                  <a-select-option v-for="item in goodsGroup"
-                                   :value="item.goodsgroupid"
-                                   :key="item.goodsgroupid">
-                    {{item.goodsgroupname}}
-                  </a-select-option>
-                </a-select>
-              </a-form-item>
-            </a-col>
-            <a-col :span="6">
-              <a-form-item :name="['wrsconvertdetails', index, 'unitidName']">
-                <a-input class="dialogInput"
-                         readonly
-                         v-model:value="domain.unitidName"
-                         placeholder="选择套保品种后自动填入"></a-input>
-              </a-form-item>
-            </a-col>
-            <a-col :span="6">
-              <a-form-item :name="['wrsconvertdetails', index, 'convertratio']"
-                           :rules="rules.wrsconvertdetails.convertratio">
-                <a-input-number class="dialogInput"
-                                style="width: 200px"
-                                v-model:value="domain.convertratio"
-                                placeholder="请输入套保系数"></a-input-number>
-              </a-form-item>
-            </a-col>
-            <a-col :span="6"
-                   class="tc">
-              <a-button class="plusBtn"
-                        @click="deleteOne('wrsconvertdetails', index)"
-                        v-if="index > 0">
-                <template #icon>
-                  <MinusOutlined />
-                </template>
-              </a-button>
-              <a-button class="minusBtn"
-                        @click="addOne('wrsconvertdetails')">
-                <template #icon>
-                  <PlusOutlined />
-                </template>
-              </a-button>
-            </a-col>
-          </template>
-        </a-row>
-      </fieldset>
-    </a-form>
-  </a-modal>
+                    </a-col>
+                    <template v-for="(domain, index) in formState.wrsconvertdetails"
+                              :key="domain.index + 'domain'">
+                        <a-col :span="6">
+                            <a-form-item :name="['wrsconvertdetails',index,'middlegoodsid']"
+                                         :rules="rules.wrsconvertdetails.middlegoodsid">
+                                <a-select class="inlineFormSelect"
+                                          @change="middleChange(domain.middlegoodsid, domain)"
+                                          v-model:value="domain.middlegoodsid"
+                                          placeholder="请选择套保品种">
+                                    <a-select-option v-for="item in goodsGroup"
+                                                     :value="item.goodsgroupid"
+                                                     :key="item.goodsgroupid">
+                                        {{ item.goodsgroupname }}
+                                    </a-select-option>
+                                </a-select>
+                            </a-form-item>
+                        </a-col>
+                        <a-col :span="6">
+                            <a-form-item :name="['wrsconvertdetails', index, 'unitidName']">
+                                <a-input class="dialogInput"
+                                         readonly
+                                         v-model:value="domain.unitidName"
+                                         placeholder="选择套保品种后自动填入"></a-input>
+                            </a-form-item>
+                        </a-col>
+                        <a-col :span="6">
+                            <a-form-item :name="['wrsconvertdetails', index, 'convertratio']"
+                                         :rules="rules.wrsconvertdetails.convertratio">
+                                <a-input-number class="dialogInput"
+                                                style="width: 200px"
+                                                v-model:value="domain.convertratio"
+                                                placeholder="请输入套保系数"></a-input-number>
+                            </a-form-item>
+                        </a-col>
+                        <a-col :span="6"
+                               class="tc">
+                            <a-button class="plusBtn"
+                                      @click="deleteOne('wrsconvertdetails', index)"
+                                      v-if="index > 0">
+                                <template #icon>
+                                    <MinusOutlined/>
+                                </template>
+                            </a-button>
+                            <a-button class="minusBtn"
+                                      @click="addOne('wrsconvertdetails')">
+                                <template #icon>
+                                    <PlusOutlined/>
+                                </template>
+                            </a-button>
+                        </a-col>
+                    </template>
+                </a-row>
+            </fieldset>
+        </a-form>
+    </a-modal>
 </template>
 
 <script lang="ts">
-import { defineComponent, PropType, ref, toRaw, watchEffect } from 'vue';
-import { closeModal } from '@/common/setup/modal/index';
-import { initData } from '@/common/methods/index';
-import { PlusOutlined, MinusOutlined } from '@ant-design/icons-vue';
-import { handleAdd, handleFromState, handleGoodsGroup } from './setup';
-import { RuleObject, ValidateErrorEntity } from 'ant-design-vue/es/form/interface';
-import { FormState, WRSConvertDetailEx } from './interface';
-import { validateCommon } from '@/common/setup/validate';
-import { initDG } from '../../list/spot-variety/setup';
-import { ErmcpDeliveryGoodsDetailEx, ErmcpDeliveryGoods } from '@/services/go/ermcp/goodsInfo/interface';
-import { mergeTwoObj } from '@/utils/objHandle';
-import { getGoodsUnitEnumList } from '@/common/constants/enumsList';
+import {defineComponent, PropType, ref, toRaw, watchEffect} from 'vue';
+import {closeModal} from '@/common/setup/modal/index';
+import {initData} from '@/common/methods/index';
+import {PlusOutlined, MinusOutlined} from '@ant-design/icons-vue';
+import {handleFromState, handleGoodsGroup} from './setup';
+import {RuleObject, ValidateErrorEntity} from 'ant-design-vue/es/form/interface';
+import {FormState, WRSConvertDetailEx} from './interface';
+import {validateCommon} from '@/common/setup/validate';
+import {initDG} from '../../list/spot-variety/setup';
+import {ErmcpDeliveryGoodsDetailEx, ErmcpDeliveryGoods} from '@/services/go/ermcp/goodsInfo/interface';
+import {mergeTwoObj} from '@/utils/objHandle';
+import {getGoodsUnitEnumList} from '@/common/constants/enumsList';
+import {requestResultLoadingAndInfo} from "@/common/methods/request/resultInfo";
+import {addDeliveryGoodsApply, ermsMiddelGoodsEdit} from "@/services/proto/delivery";
+import {DeliveryGoodsApplyReq} from "@/services/proto/delivery/interface";
+
 interface Obj {
     [props: string]: any;
 }
@@ -320,48 +325,81 @@ export default defineComponent({
     },
     setup(props, context) {
         // 控制关闭弹窗
-        const { visible, cancel } = closeModal('goods_info_spot_normal_modify');
+        const {visible, cancel} = closeModal('goods_info_spot_normal_modify');
         // 下单方法
-        const { loading, addAction } = handleAdd();
+        const loading = ref<boolean>(false);
 
         // 单位列表
         const unitList = getGoodsUnitEnumList();
 
         // 表单
         const formRef = ref();
-        const { formState, addOne, deleteOne } = handleFromState();
+        const {formState, addOne, deleteOne} = handleFromState();
         const rules = {
-            deliverygoodsname: [{ required: true, message: '请输入现货品种名称', trigger: 'blur' }],
+            deliverygoodsname: [{required: true, message: '请输入现货品种名称', trigger: 'blur'}],
             // unitid: [{ required: true, message: '请选择单位', trigger: 'change' }],
-            unitid: [{ required: true, validator: validateUnit, trigger: 'change' }],
+            unitid: [{required: true, validator: validateUnit, trigger: 'change'}],
             gldwrstandards: {
-                unitid: { required: true, validator: validateUnit, trigger: 'change' },
-                wrstandardname: { required: true, message: '请输入品类', trigger: 'blur' },
-                convertfactor: { required: true, message: '请输入标仓系数', trigger: 'blur' },
+                unitid: {required: true, validator: validateUnit, trigger: 'change'},
+                wrstandardname: {required: true, message: '请输入品类', trigger: 'blur'},
+                convertfactor: {required: true, message: '请输入标仓系数', trigger: 'blur'},
             },
             glddgfactoryItems: {
-                dgfactoryitemvalue: { required: true, message: '请输入品牌', trigger: 'blur' },
+                dgfactoryitemvalue: {required: true, message: '请输入品牌', trigger: 'blur'},
             },
             wrsconvertdetails: {
-                middlegoodsid: { required: true, validator: valideteWR, trigger: 'change' },
-                convertratio: { required: true, message: '请输入套保系数', trigger: 'blur' },
+                middlegoodsid: {required: true, validator: valideteWR, trigger: 'change'},
+                convertratio: {required: true, message: '请输入套保系数', trigger: 'blur'},
             },
         };
+
         function submit() {
             formRef.value
                 .validate()
                 .then(() => {
                     const param = toRaw(formState);
-                    addAction(param).then(() => {
+                    const unitid = param.unitid === undefined ? 0 : param.unitid
+                    const reqParam: DeliveryGoodsApplyReq = {
+                        deliverygoodsid: param.deliverygoodsid,
+                        unitid: unitid,
+                        deliverygoodsname: param.deliverygoodsname,
+                        deliverygoodscode: param.deliverygoodscode,
+                        type: 2,
+                        remark: param.remark,
+                        gldwrstandards: param.gldwrstandards.map(value => {
+                            const gldunitid = value.unitid === undefined ? 0 : value.unitid
+                            const convertfactors: any = value.convertfactor === null ? 0 : value.convertfactor
+                            return {
+                                wrstandardid: value.wrstandardid,
+                                wrstandardname: value.wrstandardname,
+                                unitid: gldunitid,
+                                convertfactor: (convertfactors as string) ? Number(convertfactors) : convertfactors
+                            }
+                        }),
+                        glddgfactoryItems: param.glddgfactoryItems,
+                        wrsconvertdetails: param.wrsconvertdetails.map(value => {
+                            const middlegoodsid = value.middlegoodsid === undefined ? 0 : value.middlegoodsid
+                            const convertratio: any = value.convertratio === null ? 0 : value.convertratio
+                            const wrsunitid = value.unitid === null ? 0 : value.unitid
+                            return {
+                                middlegoodsid: middlegoodsid,
+                                convertratio: convertratio ? Number(convertratio) : convertratio,
+                                unitid: wrsunitid
+                            }
+                        })
+                    }
+                    requestResultLoadingAndInfo(addDeliveryGoodsApply, reqParam, loading, ['修改现货品种成功', '修改现货品种失败:']).then(() => {
                         cancel();
-                        context.emit('refresh', true);
+                        context.emit('refresh');
                     });
                 })
                 .catch((error: ValidateErrorEntity<FormState>) => {
                     console.log('error', error);
                 });
         }
-        const { goodsGroup, getGoodsGroup } = handleGoodsGroup();
+
+        const {goodsGroup, getGoodsGroup} = handleGoodsGroup();
+
         /**
          * 切换套保品种时候,获取对应的单位
          */
@@ -372,27 +410,33 @@ export default defineComponent({
                 value.unitid = obj.goodunitid;
             }
         }
+
         watchEffect(() => {
             if (props.selctedDeliveryGoods.data.deliverygoodsname) {
-                const { data, gblist, gmlist, mgList } = props.selctedDeliveryGoods;
+                const {data, gblist, gmlist, mgList} = props.selctedDeliveryGoods;
                 mergeTwoObj(formState, props.selctedDeliveryGoods);
                 mergeTwoObj(formState, data);
                 // 单位
                 formState.unitid = data.agreeunit;
                 // 品类
                 formState.gldwrstandards = gmlist.map((e) => {
-                    const { wrstandardid, wrstandardname, convertfactor, unitid } = e;
-                    return { wrstandardid, wrstandardname, convertfactor: convertfactor.toString(), unitid };
+                    const {wrstandardid, wrstandardname, convertfactor, unitid} = e;
+                    return {wrstandardid, wrstandardname, convertfactor: convertfactor.toString(), unitid};
                 });
                 // 品牌
                 formState.glddgfactoryItems = gblist.map((e) => {
-                    const { brandid, brandname } = e;
-                    return { dgfactoryitemid: brandid, dgfactoryitemvalue: brandname };
+                    const {brandid, brandname} = e;
+                    return {dgfactoryitemid: brandid, dgfactoryitemvalue: brandname};
                 });
                 // 套保信息
                 formState.wrsconvertdetails = mgList.map((e) => {
-                    const { goodsgroupid, goodsunitid, enumdicname } = e.mg;
-                    return { middlegoodsid: goodsgroupid, unitid: goodsunitid, unitidName: enumdicname, convertratio: e.convertratio.toString() };
+                    const {goodsgroupid, goodsunitid, enumdicname} = e.mg;
+                    return {
+                        middlegoodsid: goodsgroupid,
+                        unitid: goodsunitid,
+                        unitidName: enumdicname,
+                        convertratio: e.convertratio.toString()
+                    };
                 });
             }
         });
@@ -426,8 +470,10 @@ export default defineComponent({
     .ant-form.inlineForm .ant-row.ant-form-item .ant-form-item-label {
         width: 120px !important;
     }
+
     .upload {
         display: inline-flex;
+
         .ant-btn.uploadBtn {
             width: 60px;
             height: 30px;
@@ -438,11 +484,13 @@ export default defineComponent({
             font-size: 14px;
             color: @m-white0;
             .rounded-corners(3px);
+
             &:hover {
                 background: rgba(@m-blue0, 0);
                 color: rgba(@m-white0, 0.8);
             }
         }
+
         .look {
             color: @m-blue0;
             font-size: 14px;
@@ -450,9 +498,11 @@ export default defineComponent({
             cursor: pointer;
         }
     }
+
     .red {
         color: @m-red1;
     }
+
     .ant-btn.minusBtn,
     .ant-btn.plusBtn {
         width: 26px;
@@ -462,31 +512,38 @@ export default defineComponent({
         background: @m-blue0;
         .rounded-corners(3px);
         border: 0;
+
         .anticon {
             font-size: 12px;
             color: @m-white0;
             align-self: center;
             align-items: center;
         }
+
         &:hover,
         &:focus {
             background: rgba(@m-blue0, 0.8);
+
             .anticon {
                 color: rgba(@m-white0, 0.8);
             }
         }
     }
+
     .ant-btn.plusBtn {
         margin-right: 10px;
         background: transparent;
         border: 1px solid #3a87f7;
+
         .anticon {
             color: @m-blue0;
         }
     }
+
     .white {
         color: @m-white0;
     }
+
     .dialogTable {
         .ant-table {
             .ant-table-content {
@@ -495,26 +552,31 @@ export default defineComponent({
                         tr {
                             td {
                                 padding: 0;
+
                                 .ant-input.dialogInput {
                                     height: 34px;
                                     line-height: 34px;
                                     border: 0;
                                     border-radius: 0;
                                 }
+
                                 .dialogSelect.ant-select-single {
                                     float: left;
                                     margin-right: 0;
+
                                     .ant-select-selector {
                                         padding: 0 10px;
                                         height: 34px;
                                         background: @m-grey21;
                                         border: 0;
                                         border-radius: 0;
+
                                         .ant-select-selection-placeholder {
                                             color: @m-grey10;
                                             text-align: left;
                                         }
                                     }
+
                                     .ant-select-arrow {
                                         color: @m-blue0;
                                     }
@@ -526,12 +588,14 @@ export default defineComponent({
             }
         }
     }
+
     .ant-form.inlineForm {
         .ant-row.dialogRowTitle {
             .ant-col {
                 .ant-row.ant-form-item {
                     .ant-col.ant-form-item-control-wrapper {
                         width: 100%;
+
                         .ant-form-item-control {
                             .ant-form-item-children {
                                 .ant-input.dialogInput {
@@ -540,21 +604,26 @@ export default defineComponent({
                                     // margin-left: -1px;
                                     // width: calc(100% + 2px);
                                 }
+
                                 .ant-select.inlineFormSelect {
                                     margin-top: 1px;
+
                                     .ant-select-selector {
                                         text-align: left;
                                     }
                                 }
                             }
                         }
+
                         .ant-form-item-control.has-error {
                             text-align: left;
+
                             .ant-form-item-children {
                                 .ant-input.dialogInput {
                                     background: @m-grey21;
                                 }
                             }
+
                             .ant-form-explain {
                                 color: @m-red1;
                             }
@@ -562,10 +631,12 @@ export default defineComponent({
                     }
                 }
             }
+
             .ant-col.tc {
                 text-align: center;
             }
         }
+
         .ant-row.dialogRowTitle2 {
             .ant-col:nth-child(3),
             .ant-col:nth-child(4) {

+ 0 - 43
src/views/information/goods/components/modify/setup.ts

@@ -1,51 +1,8 @@
 import { QueryGoodsfGroup } from '@/services/go/ermcp/goodsInfo';
 import { Ermcp3GoodsGroup } from '@/services/go/ermcp/goodsInfo/interface';
-import { addDeliveryGoodsApply } from '@/services/proto/delivery';
-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";
-
-/**
- * 处理修改
- */
-export function handleAdd() {
-    const loading = ref<boolean>(false);
-    function addAction(param: FormState): Promise<string> {
-        const unitid = param.unitid === undefined ? 0 : param.unitid
-        const reqParam: DeliveryGoodsApplyReq = {
-            deliverygoodsid: param.deliverygoodsid,
-            unitid: unitid,
-            type: 2,
-            remark: param.remark,
-            gldwrstandards: param.gldwrstandards.map(value => {
-                const gldunitid = value.unitid === undefined ? 0 : value.unitid
-                const convertfactors: any = value.convertfactor === null ? 0 : value.convertfactor
-                return {
-                    wrstandardid: value.wrstandardid,
-                    wrstandardname: value.wrstandardname,
-                    unitid: gldunitid,
-                    convertfactor: (convertfactors as string) ? Number(convertfactors) : convertfactors
-                }
-            }),
-            glddgfactoryItems: param.glddgfactoryItems,
-            wrsconvertdetails: param.wrsconvertdetails.map(value => {
-                const middlegoodsid = value.middlegoodsid === undefined ? 0 : value.middlegoodsid
-                const convertratio: any = value.convertratio === null ? 0 : value.convertratio
-                const wrsunitid = value.unitid === null ? 0 : value.unitid
-                return {
-                    middlegoodsid: middlegoodsid,
-                    convertratio: convertratio ? Number(convertratio) : convertratio,
-                    unitid: wrsunitid
-                }
-            })
-        }
-        loading.value = true;
-        return modifyDeliveryGoods(reqParam, loading)
-    }
-    return { loading, addAction }
-}
 
 /**
  * 处理表单数据

+ 12 - 4
src/views/information/goods/components/recover/index.vue

@@ -115,11 +115,12 @@
 <script lang="ts">
 import {defineComponent, PropType, ref} from 'vue';
 import {closeModal} from '@/common/setup/modal/index';
-import {QueryCustomInfoType} from "@/services/go/ermcp/customInfo/interface";
+import {QueryCustomInfoType, UpdateUserAccountReq} from "@/services/go/ermcp/customInfo/interface";
 import {formatValue} from "@/common/methods";
 import { getStatusName } from '@/common/constants/enumsName';
-import {updateUserAccount} from "@/views/information/custom/compoments/setup";
 import {Modal} from "ant-design-vue";
+import {requestResultLoadingAndInfo} from "@/common/methods/request/resultInfo";
+import {UpdateUserAccountStatus} from "@/services/go/ermcp/customInfo";
 
 export default defineComponent({
     name: 'modify-custom',
@@ -130,7 +131,7 @@ export default defineComponent({
             default: {},
         },
     },
-    setup(props) {
+    setup(props, context) {
         const {visible, cancel} = closeModal('custom_info_btn_recover');
         const {loading, ModifyUserInfo} = updateUserAccount();
         // 恢复方法
@@ -140,7 +141,14 @@ export default defineComponent({
                 okText: '确认恢复',
                 cancelText: '取消',
                 onOk() {
-                    ModifyUserInfo(props.selectedRow.userid, 4, cancel);
+                    let reqParams: UpdateUserAccountReq = {
+                        userID: props.selectedRow.userid,
+                        accountStatus: 4
+                    }
+                    requestResultLoadingAndInfo(UpdateUserAccountStatus, reqParams, loading, ['恢复成功', '恢复失败:']).then(() => {
+                        cancel();
+                        context.emit('refresh');
+                    });
                 },
                 onCancel() {
                     console.log('Cancel');

+ 1 - 52
src/views/information/goods/components/setup.ts

@@ -1,55 +1,4 @@
-import {DeliveryGoodsSign, DeliveryTypeSign} from "@/views/information/goods/setup";
-import {commonResultInfo, getRequestResultInfo} from "@/common/methods/request";
-import {hedgePlanReq} from "@/services/proto/hedgeplan";
-import {addDeliveryGoodsApply, deliveryGoodsCancel} from "@/services/proto/delivery";
-import {DeliveryGoodsApplyReq, DeliveryGoodsCancelReq} from "@/services/proto/delivery/interface";
-import {Ref} from "vue";
-
-/**
- * 现货品种停用请求
- * @param req
- * @param loading
- */
-export function stopDeliveryGoods(wrstandardid: string, loading: Ref<boolean>) :Promise<string>{
-    const sign = getRequestResultInfo(DeliveryGoodsSign, 0)  // 接口请求后的返回提示 这里统一进行管理
-    const result = deliveryGoodsCancel(reqDeliveryGoodsBuilder(wrstandardid, 0))
-    return commonResultInfo(result, sign, loading)
-}
-
-/**
- * 现货品种恢复请求
- * @param req
- * @param loading
- */
-export function resumeDeliveryGoods(wrstandardid: string, loading: Ref<boolean>) :Promise<string>{
-    const sign = getRequestResultInfo(DeliveryGoodsSign, 1)  // 接口请求后的返回提示 这里统一进行管理
-    const result = deliveryGoodsCancel(reqDeliveryGoodsBuilder(wrstandardid, 1))
-    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)
-}
-
-
+import {DeliveryGoodsCancelReq} from "@/services/proto/delivery/interface";
 /**
  * 这里组装请求
  * @param wrstandardid

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

@@ -153,7 +153,7 @@ import { defineComponent, PropType, ref } from 'vue';
 import { closeModal } from '@/common/setup/modal/index';
 import { formatValue, initData } from '@/common/methods/index';
 import { ErmcpDeliveryGoodsDetailEx } from '@/services/go/ermcp/goodsInfo/interface';
-import { getValidName } from '@/views/information/goods/setup';
+import {getValidName} from "@/common/constants/enumsName";
 
 export default defineComponent({
     name: 'spot-detail',

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

@@ -26,24 +26,6 @@ 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
-}
-
-
 /************** 接口请求相关提示 ****************/
 
 // 停用提示