|
|
@@ -157,42 +157,13 @@
|
|
|
type="primary"
|
|
|
text="立即预约"
|
|
|
native-type="submit"
|
|
|
+ :loading="submitting"
|
|
|
/>
|
|
|
</van-action-bar>
|
|
|
</van-form>
|
|
|
</div>
|
|
|
|
|
|
- <!-- <van-dialog v-model:show="noticeShow" :title="noticeInfo.noticeTitle" show-cancel-button>
|
|
|
- <div class="ck-editor" v-html="noticeInfo.noticeContent"></div>
|
|
|
- </van-dialog> -->
|
|
|
-
|
|
|
- <van-popup
|
|
|
- v-model:show="state.needToKnowShow"
|
|
|
- round
|
|
|
- :closeable="true"
|
|
|
- position="bottom"
|
|
|
- :style="{ height: '90vh' }"
|
|
|
- >
|
|
|
- <div class="need-to-know">
|
|
|
- <h4 class="mt8 mb8">申请须知</h4>
|
|
|
- <div
|
|
|
- class="ck-editor"
|
|
|
- v-html="noticeInfo.noticeContent"
|
|
|
- ></div>
|
|
|
- <footer>
|
|
|
- <van-button
|
|
|
- class="w100"
|
|
|
- type="primary"
|
|
|
- round
|
|
|
- :disabled="confirmDisabled"
|
|
|
- :loading="confirmDisabled"
|
|
|
- @click="confirmAppoint"
|
|
|
- >
|
|
|
- 我知道了
|
|
|
- </van-button>
|
|
|
- </footer>
|
|
|
- </div>
|
|
|
- </van-popup>
|
|
|
+ <!-- 申请须知弹窗已移动到跳转页面 -->
|
|
|
</template>
|
|
|
|
|
|
<script name="home" lang="ts" setup>
|
|
|
@@ -221,11 +192,9 @@
|
|
|
const userTypeList = ref(<RowDicDataType[]>[])
|
|
|
const platformApi = usePlatformApi()
|
|
|
const platformList = ref()
|
|
|
- const confirmDisabled = ref(false)
|
|
|
+ // confirmDisabled变量已移除,申请须知已移动到跳转页面
|
|
|
const state = reactive({
|
|
|
safePromise: false,
|
|
|
- safeRead: false,
|
|
|
- isRead: false,
|
|
|
form: {
|
|
|
id: 0,
|
|
|
deptId: null,
|
|
|
@@ -253,17 +222,11 @@
|
|
|
isMolecularChecked: '20',
|
|
|
molecularTime: null,
|
|
|
platOtherNeed: '',
|
|
|
- },
|
|
|
- needToKnowShow: false,
|
|
|
- })
|
|
|
- const noticeShow = ref(false)
|
|
|
- const noticeInfo = reactive({
|
|
|
- noticeTitle: '',
|
|
|
- noticeContent: '',
|
|
|
+ }
|
|
|
})
|
|
|
- const createEntryPayload = ref({})
|
|
|
-
|
|
|
const selectPlatform = ref('') // 10: 细胞 20: 分子
|
|
|
+ const debounceTimer = ref(0) // 防抖计时器
|
|
|
+ const submitting = ref<boolean>(false) // 提交状态,用于控制按钮加载状态
|
|
|
|
|
|
watch(selectPlatform, (newVal) => {
|
|
|
if (newVal === '10' || newVal === '20') {
|
|
|
@@ -274,22 +237,7 @@
|
|
|
}
|
|
|
})
|
|
|
|
|
|
- const confirmAppoint = async () => {
|
|
|
- confirmDisabled.value = true
|
|
|
- const [err]: ToResponse = await to(platformAppointApi.create(createEntryPayload.value))
|
|
|
- confirmDisabled.value = false
|
|
|
- if (err) {
|
|
|
- state.needToKnowShow = false
|
|
|
- return
|
|
|
- }
|
|
|
- state.needToKnowShow = false
|
|
|
- showNotify({
|
|
|
- type: 'success',
|
|
|
- message: '入室申请创建成功',
|
|
|
- })
|
|
|
-
|
|
|
- router.push('/entry')
|
|
|
- }
|
|
|
+ // confirmAppoint方法已移除,申请须知已移动到跳转页面
|
|
|
|
|
|
const getDicts = async () => {
|
|
|
await Promise.all([
|
|
|
@@ -367,65 +315,82 @@
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
- const onRead = () => {
|
|
|
- noticeShow.value = true
|
|
|
- noticeInfo.noticeTitle = '预约须知'
|
|
|
- const arr = state.form.platformList.map((item: any) => {
|
|
|
- return item.isChecked ? item.platformDesc : ''
|
|
|
- })
|
|
|
- if (arr.length) {
|
|
|
- noticeInfo.noticeContent = arr.join('\n')
|
|
|
- state.isRead = true
|
|
|
- }
|
|
|
- }
|
|
|
+ // onRead方法已移除,申请须知已移动到跳转页面
|
|
|
const onSubmit = async (type: string) => {
|
|
|
- onRead()
|
|
|
- if (!state.safePromise) {
|
|
|
- showNotify({
|
|
|
- type: 'warning',
|
|
|
- message: '请阅读并勾选安全承诺!',
|
|
|
- })
|
|
|
- return
|
|
|
+ // 设置提交状态为加载中
|
|
|
+ submitting.value = true
|
|
|
+
|
|
|
+ // 防抖处理:如果已有计时器,清除并重新设置
|
|
|
+ if (debounceTimer.value) {
|
|
|
+ clearTimeout(debounceTimer.value)
|
|
|
}
|
|
|
- const [errValid] = await to(formRef.value.validate())
|
|
|
- if (errValid) return
|
|
|
- const params = JSON.parse(JSON.stringify(state.form))
|
|
|
- params.isTemporary = type
|
|
|
- const arr = params.platformList.filter((item: any) => item.isChecked)
|
|
|
- params.platformList = arr.map((item: any) => {
|
|
|
- return {
|
|
|
- ...item,
|
|
|
- isChecked: '10',
|
|
|
+
|
|
|
+ // 设置新的防抖计时器,500ms后执行
|
|
|
+ debounceTimer.value = setTimeout(async () => {
|
|
|
+ if (!state.safePromise) {
|
|
|
+ showNotify({
|
|
|
+ type: 'warning',
|
|
|
+ message: '请阅读并勾选安全承诺!',
|
|
|
+ })
|
|
|
+ debounceTimer.value = 0
|
|
|
+ submitting.value = false // 重置提交状态
|
|
|
+ return
|
|
|
}
|
|
|
- })
|
|
|
- if (!params.platformList.length) {
|
|
|
- showNotify({
|
|
|
- type: 'warning',
|
|
|
- message: '请选择平台',
|
|
|
+ const [errValid] = await to(formRef.value.validate())
|
|
|
+ if (errValid) {
|
|
|
+ debounceTimer.value = 0
|
|
|
+ submitting.value = false // 重置提交状态
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const params = JSON.parse(JSON.stringify(state.form))
|
|
|
+ params.isTemporary = type
|
|
|
+ const arr = params.platformList.filter((item: any) => item.isChecked)
|
|
|
+ params.platformList = arr.map((item: any) => {
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ isChecked: '10',
|
|
|
+ }
|
|
|
})
|
|
|
- return
|
|
|
- }
|
|
|
- for (const item of params.platformList) {
|
|
|
- if (!item.platformTime) {
|
|
|
+ if (!params.platformList.length) {
|
|
|
showNotify({
|
|
|
type: 'warning',
|
|
|
- message: '请选择平台预约时间',
|
|
|
+ message: '请选择平台',
|
|
|
})
|
|
|
+ debounceTimer.value = 0
|
|
|
+ submitting.value = false // 重置提交状态
|
|
|
return
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
- createEntryPayload.value = params
|
|
|
-
|
|
|
- state.needToKnowShow = true
|
|
|
+ for (const item of params.platformList) {
|
|
|
+ if (!item.platformTime) {
|
|
|
+ showNotify({
|
|
|
+ type: 'warning',
|
|
|
+ message: '请选择平台预约时间',
|
|
|
+ })
|
|
|
+ debounceTimer.value = 0
|
|
|
+ submitting.value = false // 重置提交状态
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- // const [err]: ToResponse = await to(platformAppointApi.create(params))
|
|
|
- // if (err) return
|
|
|
- // showNotify({
|
|
|
- // type: 'success',
|
|
|
- // message: '入室申请创建成功'
|
|
|
- // })
|
|
|
- // router.push('/entry')
|
|
|
+ // 直接提交申请,不再显示申请须知(已在跳转页面显示)
|
|
|
+ const [err]: ToResponse = await to(platformAppointApi.create(params))
|
|
|
+ if (err) {
|
|
|
+ debounceTimer.value = 0
|
|
|
+ submitting.value = false // 重置提交状态
|
|
|
+ return
|
|
|
+ }
|
|
|
+ showNotify({
|
|
|
+ type: 'success',
|
|
|
+ message: '入室申请创建成功'
|
|
|
+ })
|
|
|
+
|
|
|
+ // 接口成功后继续保持加载状态2秒,提供更好的用户体验
|
|
|
+ setTimeout(() => {
|
|
|
+ debounceTimer.value = 0
|
|
|
+ router.push('/entry')
|
|
|
+ submitting.value = false // 2秒后重置提交状态
|
|
|
+ }, 2000)
|
|
|
+ }, 500)
|
|
|
}
|
|
|
onMounted(async () => {
|
|
|
await getDicts()
|
|
|
@@ -462,26 +427,5 @@
|
|
|
color: #333;
|
|
|
}
|
|
|
}
|
|
|
- .ck-editor {
|
|
|
- height: calc(100vh - 100px);
|
|
|
- overflow-y: auto;
|
|
|
- padding: 0 10px;
|
|
|
- }
|
|
|
- .need-to-know {
|
|
|
- height: calc(100% - 20px);
|
|
|
- overflow: hidden;
|
|
|
- display: flex;
|
|
|
- flex-direction: column;
|
|
|
- padding: 10px 20px;
|
|
|
- white-space: pre-wrap;
|
|
|
- p {
|
|
|
- flex: 1;
|
|
|
- overflow-y: auto;
|
|
|
- }
|
|
|
- footer {
|
|
|
- flex: 0 0 45px;
|
|
|
- margin-top: 4px;
|
|
|
- border-top: 1px solid #f7f8fa;
|
|
|
- }
|
|
|
- }
|
|
|
-</style>
|
|
|
+ /* 申请须知相关样式已移除,申请须知已移动到跳转页面 */
|
|
|
+</style>
|