|
|
@@ -14,8 +14,8 @@
|
|
|
<Cell title="可用量" :value="selectedRow.enableqty" />
|
|
|
</CellGroup>
|
|
|
<CellGroup title="挂牌信息" inset>
|
|
|
- <Field name="PerformanceTemplateID" label="履约模板" placeholder="请选择" v-model="formData.PerformanceTemplateID" :rules="formRules.PerformanceTemplateID"
|
|
|
- @click="showPerformancePlan = true" is-link readonly />
|
|
|
+ <Performance ref="performanceRef" name="PerformanceTemplateID"
|
|
|
+ v-model="formData.PerformanceTemplateID" />
|
|
|
<Field name="OrderQty" :rules="formRules.OrderQty" label="挂牌数量">
|
|
|
<template #input>
|
|
|
<Stepper v-model="formData.OrderQty" theme="round" button-size="22"
|
|
|
@@ -35,7 +35,6 @@
|
|
|
<Button block square type="danger" @click="formRef?.submit">卖出</Button>
|
|
|
</div>
|
|
|
</template>
|
|
|
- <component :is="PerformanceTmp" v-model:show="showPerformancePlan" @change="onPerformanceTmpChange" />
|
|
|
</app-view>
|
|
|
</app-modal>
|
|
|
</template>
|
|
|
@@ -45,12 +44,9 @@ import { shallowRef, PropType, onMounted, defineAsyncComponent } from 'vue'
|
|
|
import { CellGroup, Cell, Button, Stepper, Field, Form, FormInstance, FieldRule } from 'vant'
|
|
|
import { fullloading } from '@/utils/vant'
|
|
|
import { useHdWROrder } from '@/business/trade'
|
|
|
-import { onBeforeRouteLeave } from 'vue-router'
|
|
|
import AppModal from '@/components/base/modal/index.vue'
|
|
|
|
|
|
-const PerformanceTmp = defineAsyncComponent(() => import('../../../../../spot/add/components/preformance/index.vue'))
|
|
|
-const showPerformancePlan = shallowRef(false)
|
|
|
-const performance = shallowRef<Partial<Model.PerformancePlanRsp>>({}) //选中的履约模板
|
|
|
+const Performance = defineAsyncComponent(() => import('../../../../../../components/modules/performance/index.vue'))
|
|
|
|
|
|
const props = defineProps({
|
|
|
selectedRow: {
|
|
|
@@ -61,6 +57,7 @@ const props = defineProps({
|
|
|
|
|
|
const { formData, listingSubmit } = useHdWROrder()
|
|
|
const formRef = shallowRef<FormInstance>()
|
|
|
+const performanceRef = shallowRef()
|
|
|
const showModal = shallowRef(true)
|
|
|
const refresh = shallowRef(false) // 是否刷新父组件数据
|
|
|
|
|
|
@@ -92,16 +89,6 @@ 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 onSubmit = () => {
|
|
|
const { wrstandardid, subnum, deliverygoodsid, ladingbillid = '0', wrfactortypeid = '0' } = props.selectedRow ?? {}
|
|
|
formData.WRStandardID = wrstandardid
|
|
|
@@ -122,8 +109,10 @@ const onSubmit = () => {
|
|
|
|
|
|
// 关闭弹窗
|
|
|
const closed = (isRefresh = false) => {
|
|
|
- refresh.value = isRefresh
|
|
|
- showModal.value = false
|
|
|
+ if (performanceRef.value?.closed()) {
|
|
|
+ refresh.value = isRefresh
|
|
|
+ showModal.value = false
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
onMounted(() => {
|
|
|
@@ -134,14 +123,4 @@ onMounted(() => {
|
|
|
defineExpose({
|
|
|
closed,
|
|
|
})
|
|
|
-
|
|
|
-// 离开页面前关闭组件
|
|
|
-onBeforeRouteLeave((to, from, next) => {
|
|
|
- if (showPerformancePlan.value) {
|
|
|
- showPerformancePlan.value = false
|
|
|
- next(false)
|
|
|
- } else {
|
|
|
- next()
|
|
|
- }
|
|
|
-})
|
|
|
</script>
|