Browse Source

Merge remote-tracking branch 'origin/master'

yu.jie 4 năm trước cách đây
mục cha
commit
870cdf2f84

+ 8 - 14
src/views/information/spot-contract/components/add/index.vue

@@ -72,8 +72,8 @@
                           v-model:value="formState.BuyUserID"
                           placeholder="请选择客户">
                   <!-- 客户资料列表 正常 -->
-                  <a-select-option :value="i"
-                                   v-for="(item, i) in customList"
+                  <a-select-option :value="item.userid"
+                                   v-for="item in customList"
                                    :key="item.userid">
                     {{item.customername}}
                   </a-select-option>
@@ -267,11 +267,11 @@
             <a-col :span="12">
               <a-form-item label="升贴水"
                            name="PriceMove">
-                <a-input class="dialogInput suffixGrey"
-                         v-model:value="formState.PriceMove"
-                         placeholder="请输入升贴水"
-                         :suffix="`${payCurrencyUnit}/${numberUnit}`"
-                         style="width: 200px" />
+                <a-input-number class="dialogInput suffixGrey"
+                                v-model:value="formState.PriceMove"
+                                placeholder="请输入升贴水"
+                                :suffix="`${payCurrencyUnit}/${numberUnit}`"
+                                style="width: 200px" />
               </a-form-item>
             </a-col>
             <a-col :span="12">
@@ -423,10 +423,6 @@ import { Ermcp3ContractRsp } from '@/services/go/ermcp/spot-contract/interface';
 import { handleAccountManager } from '../setup';
 import { Moment } from 'moment';
 import { handleFormRule, handleContract, handleDeliveryGoods, handleAmout, handlePrice, handleDate, handleFromState } from '../setup';
-import {requestResultLoadingAndInfo} from "@/common/methods/request/resultInfo";
-import {addDeliveryGoodsApply} from "@/services/proto/delivery";
-import {orderContract} from "@/services/proto/spotcontract";
-import {GldErmcpSpotContractOperateReq} from "@/services/proto/spotcontract/interface";
 
 export default defineComponent({
     name: 'add-spot-contract',
@@ -447,7 +443,7 @@ export default defineComponent({
         const { formState, businessType } = handleFromState();
         const { rules } = handleFormRule(formState);
         // 合同类型
-        const { contractType, isSell, contractChange, customList, queryCustomList } = handleContract();
+        const { contractType, isSell, contractChange, customList, queryCustomList } = handleContract(formState);
 
         //  处理现货商品
         const { deliveryGoodsList, gblist, gmlist, numberUnit, WrStandardChange, getDeliveryGoods, deliveryGoodsChange } = handleDeliveryGoods(formState);
@@ -463,8 +459,6 @@ export default defineComponent({
         const goodsList = ref<Goods[]>([]);
 
         function submit(OperateType: 1 | 2) {
-            console.log('toRaw(formState);', toRaw(formState));
-
             formRef.value
                 .validate()
                 .then(() => {

+ 1 - 1
src/views/information/spot-contract/components/interface.ts

@@ -3,7 +3,7 @@ export interface FormState {
     ContractNo: string // string 现货合同编号
     ContractType: number// int32 现货合同类型-1:采购-1:销售
     // UserID: number // uint64 机构ID
-    BuyUserID: number // uint64 采购方ID
+    BuyUserID: number | undefined// uint64 采购方ID
     SellUserID: number | undefined// uint64 客户ID
     // SignDate: string // string 签订日期
     ContractAttachment: Uint8Array // bytes 合同附件

+ 10 - 11
src/views/information/spot-contract/components/modify/index.vue

@@ -69,8 +69,8 @@
                           v-model:value="formState.BuyUserID"
                           placeholder="请选择客户">
                   <!-- 客户资料列表 正常 -->
-                  <a-select-option :value="i"
-                                   v-for="(item, i) in customList"
+                  <a-select-option :value="item.userid"
+                                   v-for="item in customList"
                                    :key="item.userid">
                     {{item.customername}}
                   </a-select-option>
@@ -97,8 +97,8 @@
                           style="width: 200px"
                           placeholder="请选择客户">
                   <!-- 客户资料列表 正常 -->
-                  <a-select-option :value="i"
-                                   v-for="(item, i) in customList"
+                  <a-select-option :value="item.userid"
+                                   v-for="item in customList"
                                    :key="item.userid">
                     {{item.customername}}
                   </a-select-option>
@@ -264,11 +264,11 @@
             <a-col :span="12">
               <a-form-item label="升贴水"
                            name="PriceMove">
-                <a-input class="dialogInput suffixGrey"
-                         v-model:value="formState.PriceMove"
-                         placeholder="请输入升贴水"
-                         :suffix="`${payCurrencyUnit}/${numberUnit}`"
-                         style="width: 200px" />
+                <a-input-number class="dialogInput suffixGrey"
+                                v-model:value="formState.PriceMove"
+                                placeholder="请输入升贴水"
+                                :suffix="`${payCurrencyUnit}/${numberUnit}`"
+                                style="width: 200px" />
               </a-form-item>
             </a-col>
             <a-col :span="12">
@@ -443,7 +443,7 @@ export default defineComponent({
 
         const { rules } = handleFormRule(formState);
         // 合同类型
-        const { contractType, isSell, contractChange, customList, queryCustomList } = handleContract();
+        const { contractType, isSell, contractChange, customList, queryCustomList } = handleContract(formState);
 
         //  处理现货商品
         const { deliveryGoodsList, gblist, gmlist, numberUnit, WrStandardChange, getDeliveryGoods, deliveryGoodsChange } = handleDeliveryGoods(formState);
@@ -495,7 +495,6 @@ export default defineComponent({
                         const EndDate = fn(pDate[1]);
                         Object.assign(param, { StartDate, EndDate });
                     }
-                    console.log('values', formState);
 
                     sendReq(param, loading, 2)
                         .then((res) => {

+ 2 - 2
src/views/information/spot-contract/components/modify/setup.ts

@@ -33,8 +33,8 @@ export function addContractReq() {
             SpotGoodsDesc: form.SpotGoodsDesc, //                商品规格
             PriceType: form.PriceType,//                         定价类型
             CurrencyID: form.CurrencyID as number,//             结算币种
-            Qty: Number(form.Qty as number), //                     数量
-            Price: Number(form.Price as number), //                 价格
+            Qty: Number(form.Qty), //                     数量
+            Price: Number(form.Price), //                 价格
             TradeDate: moment().format("YYYYMMDD"),//             交易日
             SignDate: moment().format("YYYY-MM-DD HH:mm:ss"), //  签订日期
             // 以上必填

+ 10 - 4
src/views/information/spot-contract/components/setup.ts

@@ -141,7 +141,7 @@ export function handleFromState() {
         ContractNo: '', // 现货合同编号
         ContractType: 1, // int32 现货合同类型-1:采购-1:销售
         BizType: 1, // uint32 业务类型 - 1:套保 2:套利
-        BuyUserID: 0, // uint64 采购方ID
+        BuyUserID: undefined, // uint64 采购方ID
         SellUserID: undefined,// uint64 客户ID
         ContractAttachment: new Uint8Array(),// bytes 合同附件
         DeliveryGoodsID: undefined, // 现货品种ID
@@ -247,7 +247,7 @@ export function handleFormRule(formState: UnwrapRef<FormState>) {
         CurrencyID: [{ required: true, validator: v_Currency, trigger: 'blur' }],
         Qty: [{ required: true, message: '请输入数量', trigger: 'blur' }],
         Price: [{ required: true, message: '请输入价格', trigger: 'blur' }],
-        PriceMove: [{ required: true, message: '请输入升贴水', trigger: 'blur' }],
+        PriceMove: [{ required: true, message: '请输入升贴水', trigger: 'blur', type: 'number' }],
     };
     return { rules }
 }
@@ -255,7 +255,7 @@ export function handleFormRule(formState: UnwrapRef<FormState>) {
 /**
  * 合同类型
  */
-export function handleContract() {
+export function handleContract(formState: UnwrapRef<FormState>) {
     // 合同类型
     const contractType = [
         { key: 1, value: '采购' },
@@ -266,7 +266,13 @@ export function handleContract() {
      * 合同类型变更
      */
     function contractChange(value: number) {
-        isSell.value = value === 1 ? false : true;
+        if (value === 1) {
+            isSell.value = false
+            formState.SellUserID = undefined;
+        } else {
+            isSell.value = true
+            formState.BuyUserID = undefined
+        }
     }
 
     const customList = ref<QueryCustomInfoType[]>([])