|
|
@@ -14,6 +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 />
|
|
|
<Field name="OrderQty" :rules="formRules.OrderQty" label="挂牌数量">
|
|
|
<template #input>
|
|
|
<Stepper v-model="formData.OrderQty" theme="round" button-size="22"
|
|
|
@@ -33,17 +35,23 @@
|
|
|
<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>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
-import { shallowRef, PropType, onMounted } from 'vue'
|
|
|
+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 props = defineProps({
|
|
|
selectedRow: {
|
|
|
type: Object as PropType<Model.HoldLBRsp>,
|
|
|
@@ -58,6 +66,12 @@ const refresh = shallowRef(false) // 是否刷新父组件数据
|
|
|
|
|
|
// 表单验证规则
|
|
|
const formRules: { [key in keyof Proto.HdWROrderReq]?: FieldRule[] } = {
|
|
|
+ PerformanceTemplateID: [{
|
|
|
+ message: '请选择履约模板',
|
|
|
+ validator: () => {
|
|
|
+ return !!formData.PerformanceTemplateID
|
|
|
+ }
|
|
|
+ }],
|
|
|
FixedPrice: [{
|
|
|
message: '请输入价格',
|
|
|
validator: () => {
|
|
|
@@ -78,6 +92,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 onSubmit = () => {
|
|
|
const { wrstandardid, subnum, deliverygoodsid, ladingbillid = '0', wrfactortypeid = '0' } = props.selectedRow ?? {}
|
|
|
formData.WRStandardID = wrstandardid
|
|
|
@@ -110,4 +134,14 @@ onMounted(() => {
|
|
|
defineExpose({
|
|
|
closed,
|
|
|
})
|
|
|
+
|
|
|
+// 离开页面前关闭组件
|
|
|
+onBeforeRouteLeave((to, from, next) => {
|
|
|
+ if (showPerformancePlan.value) {
|
|
|
+ showPerformancePlan.value = false
|
|
|
+ next(false)
|
|
|
+ } else {
|
|
|
+ next()
|
|
|
+ }
|
|
|
+})
|
|
|
</script>
|