Ver Fonte

交收登记

huangbin há 4 anos atrás
pai
commit
5721512b8f

+ 6 - 5
src/services/proto/contract/interface.ts

@@ -19,7 +19,7 @@ export interface ErmcpContractOperateApplyRsp {
 export interface ErmcpContractOperateApplyInfo {
     OperateApplyType: number // uint32 操作申请类型-1:点价2:结算3:款项4:发票
     RelatedID: number // uint64 现货合同ID(602+Unix秒时间戳(10位)+xxxxxx)
-    DetailJson : Uint8Array // bytes 明细JSON
+    DetailJson: Uint8Array // bytes 明细JSON
     AttachUrl?: Uint8Array // bytes 附件
 }
 
@@ -52,27 +52,28 @@ export interface ContractOperateApplyInfo {
 
 /*********************************** 这里有一堆用于登记的请求结构 ************************************/
 // 点价登记
-export interface SomePriceReq{
+export interface SomePriceReq {
     PricedPrice: number;
     PricedQty: number;
 }
 
 // 交收登记
-export interface SettlementReq{
+export interface SettlementReq {
     ReckonRealQty?: number  // 交收量
     ReckonOtherAmount?: number // 其它费用
     AddMargin?: number // 追加保证金
     DecMargin?: number // 减少保证金
     ReckonAdjustAmount?: number // 调整金额
+    Remark?: string
 }
 
 // 款项登记
-export interface FundsReq{
+export interface FundsReq {
     PayAmount: number
     DeductAmount: number
 }
 
 // 发票登记
-export interface InvoiceReq{
+export interface InvoiceReq {
     InvoiceAmount: number
 }

+ 6 - 20
src/views/business/purchase/components/settlement/index.vue

@@ -103,7 +103,7 @@
       <a-form class="inlineForm"
               ref="formRef"
               :model="formState"
-              :rules="formStateRules">
+              :rules="rules">
         <a-row :gutter="24">
           <a-col :span="12">
             <a-form-item label="点价价格"
@@ -160,16 +160,14 @@
 </template>
 
 <script lang="ts">
-import { defineComponent, PropType, reactive, ref, unref } from 'vue';
+import { defineComponent, PropType, ref, unref } from 'vue';
 import { closeModal } from '@/common/setup/modal/index';
 import { formatValue } from '@/common/methods';
 import { Ermcp3SellBuyContract } from '@/services/go/ermcp/purchase/interface';
 import { getPriceTypeName } from '@/views/business/purchase/setup';
-import { operationContractReq } from '@/services/proto/contract';
-import { message } from 'ant-design-vue';
-import { objectToUint8Array } from '@/utils/objHandle';
 import { settlementReq } from '@/views/business/purchase/components/setup';
 import { SettlementReq } from '@/services/proto/contract/interface';
+import { handleForm } from './setup';
 
 export default defineComponent({
     name: 'purchase_pending_settlement',
@@ -184,24 +182,12 @@ export default defineComponent({
         const { visible, cancel } = closeModal('purchase_pending_settlement');
         const loading = ref<boolean>(false);
 
-        const formRef = ref();
-        const formState = reactive({ PricedPrice: 0, PricedQty: 0 });
-        const numberIstrue = (rule: any, value: any) => {
-            if (!value) {
-                return Promise.reject(new Error('请输入正确的值'));
-            } else {
-                return Promise.resolve();
-            }
-        };
-        const formStateRules = {
-            PricedPrice: [{ required: true, validator: numberIstrue, trigger: 'blur', type: 'number' }],
-            PricedQty: [{ required: true, validator: numberIstrue, trigger: 'blur', type: 'number' }],
-        };
+        const { rules, formState, formRef, checkedObj } = handleForm();
+
         function submit() {
             const wrapEl = unref(formRef);
             wrapEl.validate().then(() => {
                 loading.value = true;
-
                 const params: SettlementReq = {
                     ReckonRealQty: 10, // 交收量
                     ReckonOtherAmount: 11, // 其它费用
@@ -227,7 +213,7 @@ export default defineComponent({
             formRef,
             formState,
             formatValue,
-            formStateRules,
+            rules,
             getPriceTypeName,
         };
     },

+ 28 - 14
src/views/business/purchase/components/settlement/setup.ts

@@ -1,20 +1,34 @@
+import { reactive, ref, UnwrapRef } from "vue";
 /**
  * 表单
  * @returns 
  */
 export function handleForm() {
-    // interface FormState {
-    //     ReckonRealQty: number | null
-    //     PricedQty: number | null
-    // }
-    // const formRef = ref();
-    // const formState: UnwrapRef<FormState> = reactive({
-    //     PricedPrice: null,
-    //     PricedQty: null,
-    // })
-    // const rules = {
-    //     PricedPrice: [{ required: true, message: '请输入点价价格', trigger: 'blur', type: 'number' }],
-    //     PricedQty: [{ required: true, message: '请输入点价数量', trigger: 'blur', type: 'number' }],
-    // }
-    // return { rules, formState, formRef }
+    interface FormState {
+        ReckonRealQty?: number | null // 交收量
+        ReckonOtherAmount?: number | null // 其它费用
+        AddMargin?: number | null // 追加保证金
+        ReckonAdjustAmount?: number | null // 调整金额
+        Remark: string
+    }
+    // 是否选中数据
+    const checkedObj = reactive({
+        ReckonRealQty: false,
+        ReckonOtherAmount: false,
+        AddMargin: false,
+        ReckonAdjustAmount: false,
+    })
+    const formRef = ref();
+    const formState: UnwrapRef<FormState> = reactive({
+        ReckonRealQty: null, // 交收量
+        ReckonOtherAmount: null, // 其它费用
+        AddMargin: null, // 追加保证金
+        ReckonAdjustAmount: null, // 调整金额
+        Remark: ''
+    })
+    const rules = {
+        PricedPrice: [{ required: true, message: '请输入点价价格', trigger: 'blur', type: 'number' }],
+        PricedQty: [{ required: true, message: '请输入点价数量', trigger: 'blur', type: 'number' }],
+    }
+    return { rules, formState, formRef, checkedObj }
 }