huangbin 4 年 前
コミット
bc2656715f

+ 2 - 2
src/views/order/spot_warran/components/spot_warrant_spot_details/components/listing/index.vue

@@ -149,7 +149,7 @@ import { v4 as uuidv4 } from 'uuid';
 import moment from 'moment';
 import { ModalEnum } from '@/common/constants/modalNameEnum';
 import { _closeModal } from '@/common/setup/modal/modal';
-import { handleGoods, handlePasswordForm } from './setup';
+import { handleGoods, handleForm } from './setup';
 import { validateAction } from '@/common/setup/form';
 import { ListingForm } from './interface';
 import { getMarketRunByTradeMode } from '@/services/bus/market';
@@ -173,7 +173,7 @@ export default defineComponent({
     setup(props, context) {
         const { visible, cancel } = _closeModal(context);
         console.log('selectedRow', props.selectedRow);
-        const { rules, formState, formRef } = handlePasswordForm(props.selectedRow);
+        const { rules, formState, formRef } = handleForm(props.selectedRow);
         const data = props.selectedRow;
         const loading = ref<boolean>(false);
         const { goodsGroup, goodsList, groupsChange, findGoodsCode } = handleGoods();

+ 1 - 1
src/views/order/spot_warran/components/spot_warrant_spot_details/components/listing/setup.ts

@@ -7,7 +7,7 @@ import { RuleObject } from 'ant-design-vue/lib/form/interface';
 import { reactive, ref, UnwrapRef } from "vue";
 import { ListingForm } from "./interface";
 
-export function handlePasswordForm(data: WrHoldLB) {
+export function handleForm(data: WrHoldLB) {
     const formRef = ref();
     const formState: UnwrapRef<ListingForm> = reactive({
         WRPriceType: 1,

+ 136 - 99
src/views/order/spot_warran/components/spot_warrant_spot_details/components/pick_up/index.vue

@@ -1,92 +1,120 @@
 <template>
-    <!-- 现货仓单 现货明细 提货 true -->
-    <Drawer :title="'提货'" :placement="'bottom'" :visible="visible" @cancel="cancel">
-        <!-- 挂牌 -->
-        <div class="listed">
-            <div class="condition">
-                <a-button class="conditionBtn">{{selectedRow.deliverygoodsname}}</a-button>
-                <a-button class="conditionBtn">{{selectedRow.wrtypename}}</a-button>
-                <a-button class="conditionBtn">{{selectedRow.warehousename}}</a-button>
-            </div>
-            <div class="formBar">
-                <a-form class="inlineForm dialogForm" :form="form" @submit="handleSearch">
-                    <a-row :gutter="24">
-                        <a-col :span="12">
-                            <a-form-item label="提货数量">
-                                <a-input class="commonInput" suffix="吨" style="width: 140px" />
-                            </a-form-item>
-                        </a-col>
-                        <a-col :span="12">
-                            <a-form-item label="提货人">
-                                <a-input class="commonInput" style="width: 140px" />
-                            </a-form-item>
-                        </a-col>
-                    </a-row>
-                    <a-row :gutter="24">
-                        <a-col :span="12" class="mt-20">
-                            <a-form-item>
-                                <a-progress class="formProgress" :percent="30" />
-                                <div class="unit">
-                                    <span>0</span>
-                                    <span>300吨</span>
-                                </div>
-                            </a-form-item>
-                        </a-col>
-                        <a-col :span="12">&nbsp;</a-col>
-                    </a-row>
-                    <a-row :gutter="24">
-                        <a-col :span="12">
-                            <a-form-item label="联系方式">
-                                <a-input class="commonInput" style="width: 140px" />
-                            </a-form-item>
-                        </a-col>
-                        <a-col :span="12">
-                            <a-form-item label="预约日期">
-                                <a-date-picker
-                                    class="commonDatePicker dialogDatePicker"
-                                    style="width: 140px"
-                                />
-                            </a-form-item>
-                        </a-col>
-                    </a-row>
-                    <a-row :gutter="24">
-                        <a-col :span="12">
-                            <a-form-item label="备注">
-                                <a-input class="commonInput" style="width: 140px" />
-                            </a-form-item>
-                        </a-col>
-                        <a-col :span="12">&nbsp;</a-col>
-                    </a-row>
-                    <a-row :gutter="24" type="flex" justify="center">
-                        <a-col :span="24">
-                            <a-form-item class="tc">
-                                <a-button class="listedBtn">提货</a-button>
-                                <a-button class="ml10 cancelBtn" @click="cancel">取消</a-button>
-                            </a-form-item>
-                        </a-col>
-                    </a-row>
-                </a-form>
-            </div>
-        </div>
-    </Drawer>
+  <!-- 现货仓单 现货明细 提货 true -->
+  <Drawer :title="'提货'"
+          :placement="'bottom'"
+          :visible="visible"
+          @cancel="cancel">
+    <!-- 挂牌 -->
+    <div class="listed">
+      <div class="condition">
+        <a-button class="conditionBtn">{{selectedRow.deliverygoodsname}}</a-button>
+        <a-button class="conditionBtn">{{selectedRow.wrtypename}}</a-button>
+        <a-button class="conditionBtn">{{selectedRow.warehousename}}</a-button>
+      </div>
+      <div class="formBar">
+        <a-form class="inlineForm dialogForm"
+                ref="formRef"
+                :model="formState"
+                :rules="rules">
+          <a-row :gutter="24">
+            <a-col :span="12">
+              <a-form-item label="提货数量"
+                           name="OutQty">
+                <a-input-number class="commonInput"
+                                v-model:value="formState.OutQty"
+                                :max="selectedRow.enableqty"
+                                :suffix="selectedRow.enumdicname"
+                                style="width: 140px" />
+              </a-form-item>
+            </a-col>
+            <a-col :span="12">
+              <a-form-item label="提货人"
+                           name="ContactName">
+                <a-input class="commonInput"
+                         v-model:value="formState.ContactName"
+                         style="width: 140px" />
+              </a-form-item>
+            </a-col>
+          </a-row>
+          <a-row :gutter="24">
+            <a-col :span="12"
+                   class="mt-20">
+              <a-form-item>
+                <a-progress class="formProgress"
+                            :percent="30" />
+                <div class="unit">
+                  <span>0</span>
+                  <span>{{selectedRow.enableqty}}{{selectedRow.enumdicname}}</span>
+                </div>
+              </a-form-item>
+            </a-col>
+            <a-col :span="12">&nbsp;</a-col>
+          </a-row>
+          <a-row :gutter="24">
+            <a-col :span="12">
+              <a-form-item label="联系方式"
+                           name="ContactNum">
+                <a-input class="commonInput"
+                         v-model:value="formState.ContactNum"
+                         style="width: 140px" />
+              </a-form-item>
+            </a-col>
+            <a-col :span="12">
+              <a-form-item label="预约日期"
+                           name="AppointmentDate">
+                <a-date-picker class="commonDatePicker dialogDatePicker"
+                               v-model:value="formState.AppointmentDate"
+                               style="width: 140px" />
+              </a-form-item>
+            </a-col>
+          </a-row>
+          <a-row :gutter="24">
+            <a-col :span="12">
+              <a-form-item label="备注"
+                           name="AppointmentRemark">
+                <a-input class="commonInput"
+                         v-model:value="formState.AppointmentRemark"
+                         style="width: 140px" />
+              </a-form-item>
+            </a-col>
+            <a-col :span="12">&nbsp;</a-col>
+          </a-row>
+          <a-row :gutter="24"
+                 type="flex"
+                 justify="center">
+            <a-col :span="24">
+              <a-form-item class="tc">
+                <a-button class="listedBtn"
+                          @click="submit">提货</a-button>
+                <a-button class="ml10 cancelBtn"
+                          @click="cancel">取消</a-button>
+              </a-form-item>
+            </a-col>
+          </a-row>
+        </a-form>
+      </div>
+    </div>
+  </Drawer>
 </template>
 
 <script lang="ts">
 import { defineComponent, PropType, ref } from 'vue';
-import { enumOrderComponents } from '@/common/constants/enumOrderComponents';
 import Drawer from '@/common/components/drawer/index.vue';
-import {QueryWrPositionReq, WrHoldLB, WrPosition, WrTradeDetail} from '@/services/go/wrtrade/interface';
-import {getSelectedAccountId, getUserId} from '@/services/bus/account';
+import { WrHoldLB } from '@/services/go/wrtrade/interface';
+import { getSelectedAccountId, getUserId } from '@/services/bus/account';
 import { requestResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
-import {hdWROrder, wROutApply} from '@/services/proto/warehousetrade';
+import { wROutApply } from '@/services/proto/warehousetrade';
 import { v4 as uuidv4 } from 'uuid';
 import moment from 'moment';
 import { ModalEnum } from '@/common/constants/modalNameEnum';
 import { _closeModal } from '@/common/setup/modal/modal';
-import {WROutInDetail} from "@/services/proto/warehousetrade/interface";
-import {getUUID} from "@/utils/qt/common";
-import {getLongTypeLoginID} from "@/services/bus/login";
-import * as Long from "long";
+import { WROutInDetail } from '@/services/proto/warehousetrade/interface';
+import { getUUID } from '@/utils/qt/common';
+import { getLongTypeLoginID } from '@/services/bus/login';
+import * as Long from 'long';
+import { handleForm } from './setup';
+import { validateAction } from '@/common/setup/form';
+import { FormParam } from './interface';
 
 export default defineComponent({
     name: ModalEnum.spot_warrant_spot_details_pick_up,
@@ -102,34 +130,43 @@ export default defineComponent({
         const data = props.selectedRow;
         const loading = ref<boolean>(false);
         const { visible, cancel } = _closeModal(context);
+        const { rules, formState, formRef } = handleForm();
         // console.log(param);
+        function submit() {
+            validateAction<FormParam>(formRef, formState).then((res) => {
+                const param = {
+                    ClientSerialID: getUUID(), // uint64 客户端唯一ID
+                    WRStandardID: props.selectedRow.wrstandardid, // uint64 仓单标准ID
+                    WarehouseID: props.selectedRow.warehouseid, // uint64 仓库ID
+                    UserID: getUserId(), // uint64 申请人ID
+                    AccountID: getSelectedAccountId()?.toString(), // uint64 申请人账户ID
+                    AppointmentDate: '20200730', // string 预约出库时间(格式:20200101)
+                    AppointmentModel: 3, // uint32 预约方式:1-物流,2-自送,3-自提
+                    ContactName: '111', // string 收货人提货人
+                    ContactNum: '131', // string 收货人提货人手机
+                    AppointmentRemark: '', // string 预约备注
+                    CreatorID: Number(getLongTypeLoginID()), // uint64 创建人ID
+                    WROutInDetails: {
+                        LadingBillID: props.selectedRow.ladingbillid, // string 提单ID
+                        SubNum: props.selectedRow.subnum, // uint64 提单子单号
+                        Qty: 1, // uint64 子提单总数量
+                        OutQty: 1, // uint64 预约数量
+                    } as WROutInDetail, // WROutInDetail 仓单出库提单明细数据
+                };
 
-       const param = {
-            ClientSerialID: getUUID(),  // uint64 客户端唯一ID
-            WRStandardID: props.selectedRow.wrstandardid, // uint64 仓单标准ID
-            WarehouseID: props.selectedRow.warehouseid, // uint64 仓库ID
-            UserID: getUserId(), // uint64 申请人ID
-            AccountID: getSelectedAccountId()?.toString(), // uint64 申请人账户ID
-            AppointmentDate: "20200730", // string 预约出库时间(格式:20200101)
-            AppointmentModel: 3, // uint32 预约方式:1-物流,2-自送,3-自提
-            ContactName: "111", // string 收货人提货人
-            ContactNum: "131", // string 收货人提货人手机
-            AppointmentRemark: "", // string 预约备注
-            CreatorID: Number(getLongTypeLoginID()), // uint64 创建人ID
-            WROutInDetails: {
-                LadingBillID: props.selectedRow.ladingbillid, // string 提单ID
-                SubNum: props.selectedRow.subnum, // uint64 提单子单号
-                Qty: 1, // uint64 子提单总数量
-                OutQty: 1, // uint64 预约数量
-            } as WROutInDetail// WROutInDetail 仓单出库提单明细数据
+                requestResultLoadingAndInfo(wROutApply, param, loading, ['提货成功', '提货失败:']).then(() => {
+                    cancel(true);
+                });
+            });
         }
 
-        requestResultLoadingAndInfo(wROutApply, param, loading, ['提货成功', '提货失败:']).then(() => {
-            // cancel(true);
-        });
         return {
             visible,
             cancel,
+            submit,
+            rules,
+            formState,
+            formRef,
         };
     },
 });

+ 7 - 0
src/views/order/spot_warran/components/spot_warrant_spot_details/components/pick_up/interface.ts

@@ -0,0 +1,7 @@
+export interface FormParam {
+    AppointmentDate: string,
+    ContactName: string,
+    ContactNum: string,
+    AppointmentRemark: string,
+    OutQty: number,
+}

+ 20 - 0
src/views/order/spot_warran/components/spot_warrant_spot_details/components/pick_up/setup.ts

@@ -0,0 +1,20 @@
+import { reactive, ref, UnwrapRef } from "vue";
+import { FormParam } from "./interface";
+
+export function handleForm() {
+    const formRef = ref();
+    const formState: UnwrapRef<FormParam> = reactive({
+        AppointmentDate: '',
+        ContactName: '',
+        ContactNum: '',
+        AppointmentRemark: '',
+        OutQty: 0,
+    })
+    const rules = {
+        AppointmentDate: [{ required: true, message: '请输入预约日期', trigger: 'change' }],
+        ContactName: [{ required: true, message: '请输入提货人', trigger: 'blur' }],
+        ContactNum: [{ required: true, message: '请输入联系方式', trigger: 'blur' }],
+        OutQty: [{ required: true, message: '请输入挂牌数量', trigger: 'blur', type: 'number', min: 1, }],
+    }
+    return { rules, formState, formRef }
+}