fix: 解决表单回显必填验证无法通过的问题

This commit is contained in:
JiangQiming 2023-02-22 10:20:08 +08:00
parent 383b4a897e
commit 3bb6a8f519
3 changed files with 7 additions and 11 deletions

View File

@ -353,7 +353,8 @@ const saveProductVis = ref(false);
const getDetail = async () => {
const res = await DeviceApi.detail(route.query.id as string);
// console.log('res: ', res);
formData.value = res.result;
// formData.value = res.result;
Object.assign(formData.value, res.result);
formData.value.channel = res.result.provider;
};
@ -366,8 +367,7 @@ onMounted(() => {
*/
const btnLoading = ref<boolean>(false);
const handleSubmit = () => {
const form = useForm(formData.value, formRules.value);
form.validate()
validate()
.then(async () => {
btnLoading.value = true;
let res;

View File

@ -427,8 +427,8 @@ const clearValid = () => {
const getDetail = async () => {
if (route.params.id === ':id') return;
const res = await configApi.detail(route.params.id as string);
// console.log('res: ', res);
formData.value = res.result;
// formData.value = res.result;
Object.assign(formData.value, res.result);
// console.log('formData.value: ', formData.value);
};
getDetail();
@ -438,8 +438,6 @@ getDetail();
*/
const btnLoading = ref<boolean>(false);
const handleSubmit = () => {
// const form = useForm(formData.value, formRules.value);
// form.
validate()
.then(async () => {
// console.log('formData.value: ', formData.value);

View File

@ -635,8 +635,8 @@ const clearValid = () => {
*/
const getDetail = async () => {
const res = await templateApi.detail(route.params.id as string);
// console.log('res: ', res);
formData.value = res.result;
// formData.value = res.result;
Object.assign(formData.value, res.result);
// console.log('formData.value: ', formData.value);
};
// getDetail();
@ -705,8 +705,6 @@ const handleSubmit = () => {
if (formData.value.template.messageType === 'link')
delete formData.value.template.markdown;
// console.log('formData.value: ', formData.value);
// const form = useForm(formData.value, formRules.value);
// form.
validate()
.then(async () => {
formData.value.template.ttsCode =