فهرست منبع

修改商品信息

huangbin 4 سال پیش
والد
کامیت
74c76ff2d8

+ 1 - 1
public/config/app.config.json

@@ -1,3 +1,3 @@
 {
-    "apiUrl": "http://192.168.31.175:8080/cfg?key=test_175"
+    "apiUrl": "http://218.17.158.45:21001/cfg?key=test_175"
 }

+ 1 - 1
src/services/bus/account.ts

@@ -99,6 +99,6 @@ export function getCanUserMoney() {
 /**
  * 获取选中的资金账号(目前 写死第一个,后期账号切换的时候在进行修改)
  */
-export function getSelectedAccount(): LongType | null {
+export function getSelectedAccountId(): LongType | null {
     return getAccount_longType()
 }

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

@@ -1,7 +1,9 @@
-import {buildProtoReq50, parseProtoRsp50} from "@/services/socket/protobuf/buildReq";
 import APP from "@/services";
-import {Callback} from "@/utils/websocket";
-import {DeliveryGoodsApplyReq} from "@/services/proto/delivery/interface";
+import { getSelectedAccountId, getUserId } from '@/services/bus/account';
+import { getLongTypeLoginID } from '@/services/bus/login';
+import { DeliveryGoodsApplyReq } from "@/services/proto/delivery/interface";
+import { buildProtoReq50, parseProtoRsp50 } from "@/services/socket/protobuf/buildReq";
+import { Callback } from "@/utils/websocket";
 
 /**
  * 现货品种申请请求
@@ -11,15 +13,18 @@ export const addDeliveryGoodsApply = (param: DeliveryGoodsApplyReq): Promise<any
     return new Promise((resolve, reject) => {
         const req = {
             version: "3.2",
+            accountid: getSelectedAccountId(),
+            userid: getUserId(),
+            loginid: getLongTypeLoginID(),
         };
         const params = {
             protobufName: 'DeliveryGoodsApplyReq',
             funCodeName: 'DeliveryGoodsApplyReq',
             reqParams: Object.assign(req, param),
             msgHeadParams: {
-                AccountID: param.accountid,
-                MarketID: 18,
-                GoodsID: 0,
+                AccountID: getSelectedAccountId(),
+                MarketID: 18,   // 目前写死
+                GoodsID: 0, // 目前写死
             }
         };
         const package50 = buildProtoReq50(params);

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

@@ -1,14 +1,14 @@
 // 现货品种申请请求 0 29 124
 export interface DeliveryGoodsApplyReq {
-    accountid: string  // header 需要用到
-    userid: number // uint64 用户ID
-    loginid: number // uint64 登录ID
+    // accountid: string  // header 需要用到
+    // userid: number // uint64 用户ID
+    // loginid: number // uint64 登录ID
     deliverygoodscode?: string // string 交割商品代码(新增时有值)
     deliverygoodsname?: string // string 交割商品名称(新增时有值)
     deliverygoodsid?: number// uint64 交割商品id(修改时有值)
-    unitid: number // uint64 单位ID
+    unitid: number  // uint64 单位ID
     type: number// int32 类型 1 新增 2 修改
-    remark: number // string 备注
+    remark: string // string 备注
     gldwrstandards: GLDWRStandardEx[]; //        GLDWRStandardEx 现货商品型号数据
     glddgfactoryItems: GLDDGFactoryItemEx[] //   GLDDGFactoryItemEx 现货商品品牌数据
     wrsconvertdetails: WRSConvertDetailEx[] // WRSConvertDetailEx 现货商品折算配置明细数据
@@ -19,7 +19,7 @@ export interface DeliveryGoodsApplyReq {
 export interface GLDWRStandardEx {
     wrstandardid?: number // uint64 型号ID(修改时有值)
     wrstandardname: string // string 型号名称
-    unitid: number// uint64 单位ID
+    unitid: number // uint64 单位ID
     convertfactor: number// double 标仓系数(接口为3.1及以上版本时传)
 }
 

+ 6 - 7
src/services/request/serviceURL.ts

@@ -72,12 +72,11 @@ export const commonSearchUrl = (url: string): string => {
 
 export const setServiceURL = (config: URL): void => {
     console.log('URL', config);
-    serviceURL = config;
-
     // 外网环境(175),外包同事使用
-    // if (process.env.NODE_ENV === 'development') {
-    //     serviceURL.goCommonSearchUrl = 'http://218.17.158.45:21001/api';
-    //     serviceURL.quoteUrl = 'ws://218.17.158.45:21004';
-    //     serviceURL.tradeUrl = 'ws://218.17.158.45:21005';
-    // }
+    if (process.env.NODE_ENV === 'development') {
+        serviceURL.goCommonSearchUrl = 'http://218.17.158.45:21001/api';
+        serviceURL.quoteUrl = 'ws://218.17.158.45:21004';
+        serviceURL.tradeUrl = 'ws://218.17.158.45:21005';
+    }
+    serviceURL = config;
 };

+ 1 - 1
src/views/information/custom/compoments/add/index.vue

@@ -274,7 +274,7 @@ import { defineComponent, ref, reactive, toRaw, UnwrapRef } from 'vue';
 import { getCardType, initFormState, handleApply } from './setup';
 import { AllEnums } from '@/services/go/commonService/interface';
 import { FormState } from './interface';
-import { ValidateErrorEntity } from 'ant-design-vue/es/form/interface';
+import { RuleObject, ValidateErrorEntity } from 'ant-design-vue/es/form/interface';
 
 export default defineComponent({
     name: 'add-custom',

+ 379 - 230
src/views/information/goods/components/add/index.vue

@@ -14,56 +14,155 @@
                 :loading="loading"
                 @click="submit">完成</a-button>
     </template>
-    <a-form class="inlineForm">
+    <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="现货品种名称">
+            <a-form-item label="现货品种名称"
+                         name="deliverygoodsname">
               <a-input class="dialogInput"
-                      style="width: 200px"
-                      placeholder="请输入现货品种名称" />
+                       v-model:value="formState.deliverygoodsname"
+                       style="width: 200px"
+                       placeholder="请输入现货品种名称" />
             </a-form-item>
           </a-col>
           <a-col :span="12">
-            <a-form-item label="现货品种代码">
+            <a-form-item label="现货品种代码"
+                         name="deliverygoodscode">
               <a-input class="dialogInput"
-                      style="width: 200px"
-                      placeholder="请输入现货品种代码" />
+                       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="单位">
+            <a-form-item label="单位"
+                         name="unitid">
               <a-select class="inlineFormSelect"
                         style="width: 200px"
+                        v-model:value="formState.unitid"
                         placeholder="请选择单位">
-                <a-select-option value="1">
-                  客户一
-                </a-select-option>
-                <a-select-option value="2">
-                  客户二
+                <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="备注">
-            <a-input class="dialogInput"
-                     style="width: 562px"
-                     placeholder="请输入备注" />
-          </a-form-item>
-        </a-col>
-      </a-row>
+          <a-col :span="24">
+            <a-form-item label="备注"
+                         name="remark">
+              <a-input class="dialogInput"
+                       v-model:value="formState.remark"
+                       style="width: 562px"
+                       placeholder="请输入备注" />
+            </a-form-item>
+          </a-col>
+        </a-row>
       </fieldset>
       <fieldset class="formFieldSet">
         <legend>品类信息</legend>
-        <a-table  class="dialogTable" :columns="columns" :data-source="dataSource" :pagination="false">
+        <a-row :gutter="24">
+          <a-col :span="6">
+            <span>
+              <span class="red">*</span>
+              品类
+            </span>
+          </a-col>
+          <a-col :span="6">
+            <span>
+              <span class="red">*</span>
+              单位
+            </span>
+          </a-col>
+          <a-col :span="6">
+            <span>
+              <span class="red">*</span>
+              标仓系数
+            </span>
+          </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="['wrstandardname', index]"
+                           :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="['unitid', index]"
+                           :rules="rules.gldwrstandards.unitid">
+                <a-select class="inlineFormSelect"
+                          style="width: 200px"
+                          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="['convertfactor', index]"
+                           :rules="rules.gldwrstandards.convertfactor">
+                <a-input class="dialogInput"
+                         v-model:value="domain.convertfactor"
+                         placeholder="请输入标仓系数"></a-input>
+              </a-form-item>
+            </a-col>
+            <a-col :span="6">
+              <a-button class="plusBtn"
+                        v-if="index > 0">
+                <template #icon>
+                  <MinusOutlined />
+                </template>
+              </a-button>
+              <a-button class="minusBtn">
+                <template #icon>
+                  <PlusOutlined />
+                </template>
+              </a-button>
+            </a-col>
+          </template>
+        </a-row>
+        <!-- <a-form-item
+      v-for="(domain, index) in dynamicValidateForm.gldwrstandards"
+      :key="domain.index + 'domain'"
+      v-bind="index === 0 ? formItemLayout : {}"
+      :name="['domains', index, 'value']"
+      :rules="{
+        required: true,
+        message: 'domain can not be null',
+        trigger: 'change',
+      }"
+    >
+
+            </a-form-item> -->
+        <a-table class="dialogTable"
+                 :columns="columns"
+                 :data-source="dataSource"
+                 :pagination="false">
           <template #type>
-            <a-input class="dialogInput" placeholder="请输入品类"></a-input>
+            <a-input class="dialogInput"
+                     placeholder="请输入品类"></a-input>
           </template>
           <template #customType>
             <span>
@@ -72,13 +171,14 @@
             </span>
           </template>
           <template #unit>
-            <a-select class="dialogSelect" placeholder="请选择单位">
-                <a-select-option value="1">
-                    一口价
-                </a-select-option>
-                <a-select-option value="2">
-                    一口价2
-                </a-select-option>
+            <a-select class="dialogSelect"
+                      placeholder="请选择单位">
+              <a-select-option value="1">
+                一口价
+              </a-select-option>
+              <a-select-option value="2">
+                一口价2
+              </a-select-option>
             </a-select>
           </template>
           <template #customUnit>
@@ -88,7 +188,8 @@
             </span>
           </template>
           <template #coefficient>
-            <a-input class="dialogInput" placeholder="请输入标仓系数"></a-input>
+            <a-input class="dialogInput"
+                     placeholder="请输入标仓系数"></a-input>
           </template>
           <template #customCoefficient>
             <span>
@@ -112,9 +213,13 @@
       </fieldset>
       <fieldset class="formFieldSet">
         <legend>品牌信息</legend>
-        <a-table  class="dialogTable" :columns="columns1" :data-source="dataSource1" :pagination="false">
+        <a-table class="dialogTable"
+                 :columns="columns1"
+                 :data-source="dataSource1"
+                 :pagination="false">
           <template #type>
-            <a-input class="dialogInput" placeholder="请输入品牌"></a-input>
+            <a-input class="dialogInput"
+                     placeholder="请输入品牌"></a-input>
           </template>
           <template #customType>
             <span>
@@ -138,15 +243,19 @@
       </fieldset>
       <fieldset class="formFieldSet">
         <legend>套保品种信息</legend>
-        <a-table  class="dialogTable" :columns="columns" :data-source="dataSource" :pagination="false">
+        <a-table class="dialogTable"
+                 :columns="columns"
+                 :data-source="dataSource"
+                 :pagination="false">
           <template #type>
-             <a-select class="dialogSelect" placeholder="请选择套保品种">
-                <a-select-option value="1">
-                    一口价
-                </a-select-option>
-                <a-select-option value="2">
-                    一口价2
-                </a-select-option>
+            <a-select class="dialogSelect"
+                      placeholder="请选择套保品种">
+              <a-select-option value="1">
+                一口价
+              </a-select-option>
+              <a-select-option value="2">
+                一口价2
+              </a-select-option>
             </a-select>
           </template>
           <template #customType>
@@ -156,7 +265,7 @@
             </span>
           </template>
           <template #unit>
-           <span class="white">选择套保品种后自动填入</span>
+            <span class="white">选择套保品种后自动填入</span>
           </template>
           <template #customUnit>
             <span>
@@ -164,7 +273,8 @@
             </span>
           </template>
           <template #coefficient>
-            <a-input class="dialogInput" placeholder="请输入套保系数"></a-input>
+            <a-input class="dialogInput"
+                     placeholder="请输入套保系数"></a-input>
           </template>
           <template #customCoefficient>
             <span>
@@ -191,99 +301,114 @@
 </template>
 
 <script lang="ts">
-import { defineComponent, ref } from 'vue';
-import { closeModal, openModal } from '@/common/setup/modal/index';
+import { defineComponent, ref, reactive, toRaw, UnwrapRef } 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, initFormState } from './setup';
+import { DeliveryGoodsApplyReq } from '@/services/proto/delivery/interface';
+import { getGoodsUnitList } from '../../setup';
+import { RuleObject, ValidateErrorEntity } from 'ant-design-vue/es/form/interface';
+
+const validateUnit = async (rule: RuleObject, value: number) => {
+    if (value) {
+        return Promise.resolve();
+    } else {
+        return Promise.reject('请选择单位');
+    }
+};
 
 export default defineComponent({
     name: 'addSpotVariety',
     components: {
-      PlusOutlined,
-      MinusOutlined,
+        PlusOutlined,
+        MinusOutlined,
     },
     setup() {
+        // 控制关闭弹窗
         const { visible, cancel } = closeModal('spot_contract_btn_add');
-        const loading = ref<boolean>(false);
-        const maskClosableFlag = ref<boolean>(false);
+        // 下单方法
+        const { loading, addAction } = handleAdd();
+        // 单位列表
+        const unitList = getGoodsUnitList();
         const columns = [
-          {
-            dataIndex: 'type',
-            key: 'type',
-            slots: { title: 'customType', customRender: 'type' },
-            width: 200,
-            align: 'center'
-          },
-          {
-            dataIndex: 'unit',
-            key: 'unit',
-            slots: { title: 'customUnit', customRender: 'unit' },
-            width: 200,
-            align: 'center'
-          },
-          {
-            dataIndex: 'coefficient',
-            key: 'coefficient',
-            slots: { title: 'customCoefficient', customRender: 'coefficient' },
-            width: 200,
-            align: 'center'
-          },
-          {
-            title: '操作',
-            key: 'action',
-            slots: { customRender: 'action' },
-            align: 'center'
-          },
+            {
+                dataIndex: 'type',
+                key: 'type',
+                slots: { title: 'customType', customRender: 'type' },
+                width: 200,
+                align: 'center',
+            },
+            {
+                dataIndex: 'unit',
+                key: 'unit',
+                slots: { title: 'customUnit', customRender: 'unit' },
+                width: 200,
+                align: 'center',
+            },
+            {
+                dataIndex: 'coefficient',
+                key: 'coefficient',
+                slots: { title: 'customCoefficient', customRender: 'coefficient' },
+                width: 200,
+                align: 'center',
+            },
+            {
+                title: '操作',
+                key: 'action',
+                slots: { customRender: 'action' },
+                align: 'center',
+            },
         ];
 
         const dataSource = [
-          {
-            key: '1',
-            type: 'John Brown',
-            age: 32,
-            address: 'New York No. 1 Lake Park',
-            tags: ['nice', 'developer'],
-          },
-          {
-            key: '2',
-            name: 'Jim Green',
-            age: 42,
-            address: 'London No. 1 Lake Park',
-            tags: ['loser'],
-          },
+            {
+                key: '1',
+                type: 'John Brown',
+                age: 32,
+                address: 'New York No. 1 Lake Park',
+                tags: ['nice', 'developer'],
+            },
+            {
+                key: '2',
+                name: 'Jim Green',
+                age: 42,
+                address: 'London No. 1 Lake Park',
+                tags: ['loser'],
+            },
         ];
 
         const columns1 = [
-          {
-            dataIndex: 'type',
-            key: 'type',
-            slots: { title: 'customType', customRender: 'type' },
-            width: 598,
-            align: 'center'
-          },
-          {
-            title: '操作',
-            key: 'action',
-            slots: { customRender: 'action' },
-            align: 'center'
-          },
+            {
+                dataIndex: 'type',
+                key: 'type',
+                slots: { title: 'customType', customRender: 'type' },
+                width: 598,
+                align: 'center',
+            },
+            {
+                title: '操作',
+                key: 'action',
+                slots: { customRender: 'action' },
+                align: 'center',
+            },
         ];
 
         const dataSource1 = [
-          {
-            key: '1',
-            type: 'John Brown',
-            age: 32,
-            address: 'New York No. 1 Lake Park',
-            tags: ['nice', 'developer'],
-          },
-          {
-            key: '2',
-            name: 'Jim Green',
-            age: 42,
-            address: 'London No. 1 Lake Park',
-            tags: ['loser'],
-          },
+            {
+                key: '1',
+                type: 'John Brown',
+                age: 32,
+                address: 'New York No. 1 Lake Park',
+                tags: ['nice', 'developer'],
+            },
+            {
+                key: '2',
+                name: 'Jim Green',
+                age: 42,
+                address: 'London No. 1 Lake Park',
+                tags: ['loser'],
+            },
         ];
         function submit() {
             loading.value = true;
@@ -292,17 +417,39 @@ export default defineComponent({
                 cancel();
             }, 2000);
         }
+
+        // 表单
+        const formRef = ref();
+        const formState: UnwrapRef<DeliveryGoodsApplyReq> = reactive(initFormState());
+        const rules = {
+            deliverygoodsname: [{ required: true, message: '请输入现货品种名称', trigger: 'blur' }],
+            // unitid: [{ required: true, message: '请选择单位', 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' },
+            },
+            // nickname: [{ required: true, message: '请输入企业简称', trigger: 'blur' }],
+            // cardtype: [{ required: true, message: '请选择证件类型', trigger: 'change' }],
+        };
+
         initData(() => {});
         return {
             visible,
             cancel,
+            formRef,
+            formState,
+            rules,
+            unitList,
+
             submit,
             loading,
             dataSource,
             columns,
             dataSource1,
             columns1,
-            maskClosableFlag
+            maskClosableFlag: false,
         };
     },
 });
@@ -310,126 +457,128 @@ export default defineComponent({
 
 <style lang="less">
 .addSpotVariety {
-  width: 100%;
-  height: 100%;
-  // padding: 30px;
-  .formFieldSet {
-    border: 1px solid @m-grey19;
-    padding: 0 20px 20px;
-  }
-  .formFieldSet+.formFieldSet {
-    margin-top: 35px;
-  }
-  .ant-form {
-    legend {
-      width: auto;
-      margin-left: 20px;
-      font-size: 16px;
-      color: @m-white0;
-      border-bottom: 0;
-      padding: 0 10px;
+    width: 100%;
+    height: 100%;
+    // padding: 30px;
+    .formFieldSet {
+        border: 1px solid @m-grey19;
+        padding: 0 20px 20px;
     }
-  }
-  .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;
-          background: @m-blue0;
-          border: 0;
-          padding: 0;
-          text-align: center;
-          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;
-          margin-left: 10px;
-          cursor: pointer;
-      }
-  }
-  .red {
-    color: @m-red1;
-  }
-  .ant-btn.minusBtn,.ant-btn.plusBtn {
-    width: 26px;
-    height: 26px;
-    .inlineflex;
-    justify-content: center;
-    background: @m-blue0;
-    .rounded-corners(3px);
-    border: 0;
-    .anticon  {
-      font-size: 12px;
-      color: @m-white0;
-      align-self: center;
-      align-items: center;
+    .formFieldSet + .formFieldSet {
+        margin-top: 35px;
     }
-    &:hover,&:focus {
-      background: rgba(@m-blue0, .8);
-      .anticon {
-        color: rgba(@m-white0, .8);
-      }
+    .ant-form {
+        legend {
+            width: auto;
+            margin-left: 20px;
+            font-size: 16px;
+            color: @m-white0;
+            border-bottom: 0;
+            padding: 0 10px;
+        }
     }
-  }
-  .ant-btn.plusBtn{
-    margin-right: 10px;
-    background: transparent;
-    border: 1px solid #3A87F7;
-    .anticon {
-      color: @m-blue0;
+    .ant-form.inlineForm .ant-row.ant-form-item .ant-form-item-label {
+        width: 120px !important;
     }
-  }
-  .white {
-    color: @m-white0;
-  }
-  .dialogTable {
-    .ant-table {
-      .ant-table-content {
-        .ant-table-body {
-          table {
-            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;
+    .upload {
+        display: inline-flex;
+        .ant-btn.uploadBtn {
+            width: 60px;
+            height: 30px;
+            background: @m-blue0;
+            border: 0;
+            padding: 0;
+            text-align: center;
+            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;
+            margin-left: 10px;
+            cursor: pointer;
+        }
+    }
+    .red {
+        color: @m-red1;
+    }
+    .ant-btn.minusBtn,
+    .ant-btn.plusBtn {
+        width: 26px;
+        height: 26px;
+        .inlineflex;
+        justify-content: center;
+        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 {
+                .ant-table-body {
+                    table {
+                        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;
+                                    }
+                                }
+                            }
+                        }
                     }
-                  }
-                  .ant-select-arrow {
-                    color: @m-blue0;
-                  }
                 }
-              }
             }
-          }
         }
-      }
     }
-  }
 }
 </style>

+ 33 - 0
src/views/information/goods/components/add/interface.ts

@@ -0,0 +1,33 @@
+export interface GLDWRStandardEx {
+    wrstandardid?: number // uint64 型号ID(修改时有值)
+    wrstandardname: string // string 型号名称
+    unitid: number | undefined// uint64 单位ID
+    convertfactor: number// double 标仓系数(接口为3.1及以上版本时传)
+    callback: Function;
+}
+
+// 现货商品品牌数据 0 29 173
+export interface GLDDGFactoryItemEx {
+    dgfactoryitemid?: number // uint64 品牌ID(修改时有值)
+    dgfactoryitemvalue: string // string 品牌名称
+    callback: Function;
+}
+
+// 现货商品折算配置明细数据 0 29 127
+export interface WRSConvertDetailEx {
+    middlegoodsid: number // uint64 套保品种ID(接口为3.1及以下版本时传套保品种ID,否则传期货品种ID)
+    unitid: number // uint64 单位ID
+    convertratio: number // double 套保系数
+    callback: Function;
+}
+export interface FormState {
+    deliverygoodscode?: string // string 交割商品代码(新增时有值)
+    deliverygoodsname?: string // string 交割商品名称(新增时有值)
+    deliverygoodsid?: number// uint64 交割商品id(修改时有值)
+    unitid: number | undefined // uint64 单位ID (undefined 用于前端,传入服务时必须是number类型)
+    type: number// int32 类型 1 新增 2 修改
+    remark: string // string 备注
+    gldwrstandards: GLDWRStandardEx[]; //        GLDWRStandardEx 现货商品型号数据
+    glddgfactoryItems: GLDDGFactoryItemEx[] //   GLDDGFactoryItemEx 现货商品品牌数据
+    wrsconvertdetails: WRSConvertDetailEx[] // WRSConvertDetailEx 现货商品折算配置明细数据
+}

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

@@ -0,0 +1,34 @@
+import { addDeliveryGoodsApply } from '@/services/proto/delivery';
+import { DeliveryGoodsApplyReq } from '@/services/proto/delivery/interface';
+import { message } from 'ant-design-vue';
+import { ref } from 'vue';
+import { FormState } from './interface';
+
+export function handleAdd() {
+    const loading = ref<boolean>(false);
+    function addAction(param: DeliveryGoodsApplyReq) {
+        loading.value = true;
+        addDeliveryGoodsApply(param).then(() => {
+            message.success('新增现货品种成功!')
+        }).catch(err => {
+            message.error(err.message)
+        }).finally(() => loading.value = false)
+    }
+    return { loading, addAction }
+}
+
+export function initFormState(callback: Function): FormState {
+    return {
+        deliverygoodscode: '', // string 交割商品代码(新增时有值)
+        deliverygoodsname: '', // string 交割商品名称(新增时有值)
+        deliverygoodsid: 0,// uint64 交割商品id(修改时有值)
+        unitid: undefined, // uint64 单位ID
+        type: 1,// int32 类型 1 新增 2 修改
+        remark: '', // string 备注
+        gldwrstandards: [
+            { wrstandardname: '', unitid: undefined, convertfactor: 0, callback }
+        ], //        GLDWRStandardEx 现货商品型号数据
+        glddgfactoryItems: [], //   GLDDGFactoryItemEx 现货商品品牌数据
+        wrsconvertdetails: [], // WRSConvertDetailEx 现货商品折算配置明细数据
+    }
+}

+ 2 - 4
src/views/information/goods/components/leftMenu/index.vue

@@ -26,6 +26,7 @@
 <script lang="ts">
 import { defineComponent, ref, PropType, SetupContext } from 'vue';
 import { MenuList } from '@/services/go/ermcp/goodsInfo/interface';
+import { initMenu } from '../../setup';
 
 // 菜单栏
 const handleMenu = (context: SetupContext) => {
@@ -54,10 +55,7 @@ export default defineComponent({
     name: 'leftMenu',
     props: {
         menuList: {
-            default: [
-                { key: '1', title: '正常', children: [] },
-                { key: '2', title: '停用', children: [] },
-            ],
+            default: initMenu,
             type: Object as PropType<MenuList[]>,
         },
     },

+ 21 - 6
src/views/information/goods/setup.ts

@@ -36,6 +36,17 @@ export function initDG(): ErmcpDeliveryGoodsDetailEx {
 }
 
 /**
+ * 初始化 菜单数据
+ * @returns 
+ */
+export function initMenu(): MenuList[] {
+    return [
+        { key: '1', title: '正常', children: [] },
+        { key: '2', title: '停用', children: [] },
+    ]
+}
+
+/**
  * 获取现货品种数据
  * @returns 
  */
@@ -45,10 +56,7 @@ export function handleDG() {
     const deliveryGoodsList = ref<ErmcpDeliveryGoodsDetailEx[]>([])
     // 选中的具体某一天现货品种数据
     const selctedDeliveryGoods = reactive<ErmcpDeliveryGoodsDetailEx>(initDG())
-    const menuList = ref<MenuList[]>([
-        { key: '1', title: '正常', children: [] },
-        { key: '2', title: '停用', children: [] },
-    ]);
+    const menuList = ref<MenuList[]>(initMenu());
     // 获取现货品种数据
     function queryDG(param?: number) {
         loading.value = true;
@@ -74,7 +82,6 @@ export function handleDG() {
     }
     // 选择某条现货数据
     function chooseDG(key: string) {
-        debugger
         const obj = deliveryGoodsList.value.find(e => e.data.deliverygoodsid === Number(key))
         if (obj) {
             mergeObj(selctedDeliveryGoods, obj)
@@ -89,5 +96,13 @@ export function handleDG() {
  * @returns 
  */
 export function getGoodsUnit(unit: number) {
-    return getItemEnum('goodsunit').find(e => e.enumitemname === unit)?.enumdicname
+    return getGoodsUnitList().find(e => e.enumitemname === unit)?.enumdicname
+}
+
+/**
+ * 获取现货品种单位列表
+ * @returns 
+ */
+export function getGoodsUnitList() {
+    return getItemEnum('goodsunit')
 }