Commit fbdb0587 by pangchong

fix: 修复onBeforeOpen

parent 2a406ef7
...@@ -132,11 +132,9 @@ const ps = defineProps({ ...@@ -132,11 +132,9 @@ const ps = defineProps({
default: '#165dff' default: '#165dff'
}, },
//打开前判断 //打开前判断
beforeOpen: { onBeforeOpen: {
type: Function, type: Function,
default: () => { default: null
return true
}
} }
}) })
//获取下拉框样式 //获取下拉框样式
...@@ -172,11 +170,12 @@ const getPickerClass = computed(() => { ...@@ -172,11 +170,12 @@ const getPickerClass = computed(() => {
const show = ref(false) const show = ref(false)
//打开 //打开
const open = async () => { const open = async () => {
const flag = await ps.beforeOpen() if (ps.onBeforeOpen) {
if (flag) { const flag = await ps.onBeforeOpen()
if (!flag) return
}
searchKey.value = '' searchKey.value = ''
show.value = true show.value = true
}
} }
//设置下拉框打开的默认值 //设置下拉框打开的默认值
const defaultIndex = ref(0) const defaultIndex = ref(0)
......
...@@ -118,7 +118,7 @@ ...@@ -118,7 +118,7 @@
:options="relatedSeatSet" :options="relatedSeatSet"
clearable clearable
filter filter
:beforeOpen="beforeOpen" :onBeforeOpen="onBeforeOpen"
label-field="seatName" label-field="seatName"
value-field="id" value-field="id"
></global-picker> ></global-picker>
...@@ -133,7 +133,7 @@ import useBaseStore from 'mocp/store/base' ...@@ -133,7 +133,7 @@ import useBaseStore from 'mocp/store/base'
import { getParamsByType } from 'mocp/hooks/use-params/useParams' import { getParamsByType } from 'mocp/hooks/use-params/useParams'
import { useGetDictByValue } from 'mocp/hooks/use-dict/useDict' import { useGetDictByValue } from 'mocp/hooks/use-dict/useDict'
import { formData, formRef, relatedSeatSet, rules } from './constants/add.compositions' import { formData, formRef, relatedSeatSet, rules } from './constants/add.compositions'
import { beforeOpen, changeAc, handleSubmit } from './constants/add.functionals' import { onBeforeOpen, changeAc, handleSubmit } from './constants/add.functionals'
import useUserStore from 'mocp/store/user' import useUserStore from 'mocp/store/user'
const baseStore = useBaseStore() const baseStore = useBaseStore()
......
...@@ -13,7 +13,7 @@ export const changeAc = async () => { ...@@ -13,7 +13,7 @@ export const changeAc = async () => {
} }
} }
//选择相关席位 //选择相关席位
export const beforeOpen = async () => { export const onBeforeOpen = async () => {
if (!formData.machineNumber) { if (!formData.machineNumber) {
uni.$mocpMessage.error('请选择机号') uni.$mocpMessage.error('请选择机号')
return false return false
......
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
.txt { .txt {
color: $mocp-text-5;
font-size: 28rpx; font-size: 28rpx;
margin-left: 16rpx; margin-left: 16rpx;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment