huangbin 4 سال پیش
والد
کامیت
549319540a

+ 3 - 9
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>
@@ -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 合同附件

+ 5 - 6
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>
@@ -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) => {

+ 9 - 3
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
@@ -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[]>([])