|
@@ -2,6 +2,8 @@
|
|
|
<app-view class="g-form">
|
|
<app-view class="g-form">
|
|
|
<Form ref="formRef" class="g-form__container" @submit="formSubmit">
|
|
<Form ref="formRef" class="g-form__container" @submit="formSubmit">
|
|
|
<CellGroup inset>
|
|
<CellGroup inset>
|
|
|
|
|
+ <Field name="PerformanceTemplateID" label="履约模板" placeholder="请选择" v-model="formData.PerformanceTemplateID" :rules="formRules.PerformanceTemplateID"
|
|
|
|
|
+ @click="showPerformancePlan = true" is-link readonly />
|
|
|
<Field name="DeliveryGoodsID" label="品类" :rules="formRules.DeliveryGoodsID" is-link>
|
|
<Field name="DeliveryGoodsID" label="品类" :rules="formRules.DeliveryGoodsID" is-link>
|
|
|
<template #input>
|
|
<template #input>
|
|
|
<app-select v-model="formData.DeliveryGoodsID" :options="ftDeliveryGoodsList"
|
|
<app-select v-model="formData.DeliveryGoodsID" :options="ftDeliveryGoodsList"
|
|
@@ -52,11 +54,13 @@
|
|
|
<Button type="danger" @click="formRef?.submit" square block>提交</Button>
|
|
<Button type="danger" @click="formRef?.submit" square block>提交</Button>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
+ <component :is="PerformanceTmp" v-model:show="showPerformancePlan" @change="onPerformanceTmpChange" />
|
|
|
</app-view>
|
|
</app-view>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
|
-import { shallowRef, computed } from 'vue'
|
|
|
|
|
|
|
+import { shallowRef, computed, defineAsyncComponent } from 'vue'
|
|
|
|
|
+import { onBeforeRouteLeave } from 'vue-router'
|
|
|
import { CellGroup, Button, Field, Form, FormInstance, Stepper, FieldRule, showSuccessToast, showFailToast } from 'vant'
|
|
import { CellGroup, Button, Field, Form, FormInstance, Stepper, FieldRule, showSuccessToast, showFailToast } from 'vant'
|
|
|
import { fullloading } from '@/utils/vant'
|
|
import { fullloading } from '@/utils/vant'
|
|
|
import { BuyOrSell } from '@/constants/order'
|
|
import { BuyOrSell } from '@/constants/order'
|
|
@@ -67,10 +71,14 @@ import { useHdWROrder } from '@/business/trade'
|
|
|
import { useAccountStore } from '@/stores'
|
|
import { useAccountStore } from '@/stores'
|
|
|
import AppSelect from '../../../../../components/base/select/index.vue'
|
|
import AppSelect from '../../../../../components/base/select/index.vue'
|
|
|
|
|
|
|
|
|
|
+const PerformanceTmp = defineAsyncComponent(() => import('../preformance/index.vue'))
|
|
|
|
|
+
|
|
|
const { routerBack } = useNavigation()
|
|
const { routerBack } = useNavigation()
|
|
|
const { formData, listingSubmit, amount } = useHdWROrder()
|
|
const { formData, listingSubmit, amount } = useHdWROrder()
|
|
|
const accountStore = useAccountStore()
|
|
const accountStore = useAccountStore()
|
|
|
const formRef = shallowRef<FormInstance>()
|
|
const formRef = shallowRef<FormInstance>()
|
|
|
|
|
+const showPerformancePlan = shallowRef(false)
|
|
|
|
|
+const performance = shallowRef<Partial<Model.PerformancePlanRsp>>({}) //选中的履约模板
|
|
|
|
|
|
|
|
const { dataList: ftDeliveryGoodsList } = useRequest(queryFtDeliveryGoods)
|
|
const { dataList: ftDeliveryGoodsList } = useRequest(queryFtDeliveryGoods)
|
|
|
const { dataList: wrStandardFactoryItems, run: getWrStandardFactoryItems } = useRequest(queryWrStandardFactoryItem, { manual: true })
|
|
const { dataList: wrStandardFactoryItems, run: getWrStandardFactoryItems } = useRequest(queryWrStandardFactoryItem, { manual: true })
|
|
@@ -84,6 +92,12 @@ const warehouseList = computed(() => {
|
|
|
|
|
|
|
|
// 表单验证规则
|
|
// 表单验证规则
|
|
|
const formRules: { [key in keyof Proto.HdWROrderReq]?: FieldRule[] } = {
|
|
const formRules: { [key in keyof Proto.HdWROrderReq]?: FieldRule[] } = {
|
|
|
|
|
+ PerformanceTemplateID: [{
|
|
|
|
|
+ message: '请选择履约模板',
|
|
|
|
|
+ validator: () => {
|
|
|
|
|
+ return !!formData.PerformanceTemplateID
|
|
|
|
|
+ }
|
|
|
|
|
+ }],
|
|
|
DeliveryGoodsID: [{
|
|
DeliveryGoodsID: [{
|
|
|
message: '请选择品类',
|
|
message: '请选择品类',
|
|
|
validator: () => {
|
|
validator: () => {
|
|
@@ -116,6 +130,16 @@ const formRules: { [key in keyof Proto.HdWROrderReq]?: FieldRule[] } = {
|
|
|
}],
|
|
}],
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// 选择履约模板
|
|
|
|
|
+const onPerformanceTmpChange = (item: Model.PermancePlanTmpRsp) => {
|
|
|
|
|
+ performance.value = item
|
|
|
|
|
+ formData.PerformanceTemplateID = item.autoid
|
|
|
|
|
+ if (formData.PerformanceTemplateID) {
|
|
|
|
|
+ formRef.value?.validate('PerformanceTemplateID')
|
|
|
|
|
+ }
|
|
|
|
|
+ showPerformancePlan.value = false
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
// 选择品类时触发
|
|
// 选择品类时触发
|
|
|
const onDeliveryGoodsChange = (deliverygoodsid: number) => {
|
|
const onDeliveryGoodsChange = (deliverygoodsid: number) => {
|
|
|
const item = ftDeliveryGoodsList.value.find((e) => e.deliverygoodsid === deliverygoodsid)
|
|
const item = ftDeliveryGoodsList.value.find((e) => e.deliverygoodsid === deliverygoodsid)
|
|
@@ -156,4 +180,14 @@ const formSubmit = () => {
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+// 离开页面前关闭组件
|
|
|
|
|
+onBeforeRouteLeave((to, from, next) => {
|
|
|
|
|
+ if (showPerformancePlan.value) {
|
|
|
|
|
+ showPerformancePlan.value = false
|
|
|
|
|
+ next(false)
|
|
|
|
|
+ } else {
|
|
|
|
|
+ next()
|
|
|
|
|
+ }
|
|
|
|
|
+})
|
|
|
</script>
|
|
</script>
|