Commit 54737ae4 by 胡悦

feat(表单): 添加即时发布时清空发布时间的功能

为新闻和投资者相关表单添加处理函数,当选择即时发布时自动清空发布时间字段
1 parent 0afdfee1
...@@ -58,6 +58,12 @@ const getRiskRef = (el: any, id: number) => { ...@@ -58,6 +58,12 @@ const getRiskRef = (el: any, id: number) => {
riskRefList.value[id] = el; riskRefList.value[id] = el;
} }
}; };
// 发布时间改变
const handleChange = (val: string) => {
if (val == '1') {
form.systemPublishTime = ''
}
}
/** 提交表单 */ /** 提交表单 */
const handleSubmit = async () => { const handleSubmit = async () => {
await nextTick(); await nextTick();
...@@ -424,7 +430,7 @@ const onBeforeRemove = (fileItem: FileItem, modelName: string) => { ...@@ -424,7 +430,7 @@ const onBeforeRemove = (fileItem: FileItem, modelName: string) => {
label="发布时间" label="发布时间"
:rules="[{ required: true, message: '发布时间必填' }]" :rules="[{ required: true, message: '发布时间必填' }]"
> >
<a-radio-group v-model="form.sendType"> <a-radio-group v-model="form.sendType" @change="handleChange">
<a-radio value="1">即时发布</a-radio> <a-radio value="1">即时发布</a-radio>
<a-radio value="2">定时发布</a-radio> <a-radio value="2">定时发布</a-radio>
</a-radio-group> </a-radio-group>
......
...@@ -39,7 +39,12 @@ const formRef = ref(); ...@@ -39,7 +39,12 @@ const formRef = ref();
onBeforeMount(() => { onBeforeMount(() => {
if (query.value.id) findById(); if (query.value.id) findById();
}); });
// 发布时间改变
const handleRadioChange = (val: string) => {
if (val == '1') {
form.value.publishTime = ''
}
}
/** 获取详情 */ /** 获取详情 */
const findById = async () => { const findById = async () => {
const id = query.value.id; const id = query.value.id;
...@@ -271,7 +276,7 @@ onBeforeUnmount(() => { ...@@ -271,7 +276,7 @@ onBeforeUnmount(() => {
label="发布时间" label="发布时间"
:rules="[{ required: true, message: '发布时间必填' }]" :rules="[{ required: true, message: '发布时间必填' }]"
> >
<a-radio-group v-model="form.publishType"> <a-radio-group v-model="form.publishType" @change="handleRadioChange">
<a-radio value="1">即时发布</a-radio> <a-radio value="1">即时发布</a-radio>
<a-radio value="2">定时发布</a-radio> <a-radio value="2">定时发布</a-radio>
</a-radio-group> </a-radio-group>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!