ref: v-loading 调整避免重复提交

This commit is contained in:
lbw 2023-04-10 23:49:58 +08:00
parent 711d3af949
commit dd7ea74da8
35 changed files with 249 additions and 215 deletions

2
.env
View File

@ -1,5 +1,5 @@
# 是否是微服务架构(重要)
VITE_IS_MICRO= false
VITE_IS_MICRO= true
# 前端访问前缀
VITE_PUBLIC_PATH = /

View File

@ -1,6 +1,6 @@
<template>
<el-dialog :close-on-click-modal="false" :title="form.id ? $t('common.editBtn') : $t('common.addBtn')" draggable v-model="visible">
<el-form :model="form" :rules="dataRules" formDialogRef label-width="120px" ref="dataFormRef">
<el-form :model="form" :rules="dataRules" formDialogRef label-width="120px" ref="dataFormRef" v-loading="loading">
<el-row :gutter="20">
<el-col :span="12" class="mb20">
<el-form-item :label="t('client.clientId')" prop="clientId">
@ -104,8 +104,8 @@
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="visible = false" formDialogRef>{{ $t('common.cancelButtonText') }}</el-button>
<el-button @click="onSubmit" formDialogRef type="primary">{{ $t('common.confirmButtonText') }}</el-button>
<el-button @click="visible = false">{{ $t('common.cancelButtonText') }}</el-button>
<el-button @click="onSubmit" type="primary" :disabled="loading">{{ $t('common.confirmButtonText') }}</el-button>
</span>
</template>
</el-dialog>
@ -126,6 +126,8 @@ const { t } = useI18n();
//
const dataFormRef = ref();
const visible = ref(false);
const loading = ref(false);
//
const { grant_types, common_status, captcha_flag_types, enc_flag_types } = useDict(
'grant_types',
@ -214,12 +216,15 @@ const onSubmit = async () => {
if (!valid) return false;
try {
loading.value = true;
form.id ? await putObj(form) : await addObj(form);
useMessage().success(t(form.id ? 'common.editSuccessText' : 'common.addSuccessText'));
visible.value = false;
emit('refresh');
} catch (err: any) {
useMessage().error(err.msg);
} finally {
loading.value = false;
}
};

View File

@ -19,30 +19,14 @@
</el-row>
<el-row>
<div class="mb8" style="width: 100%">
<el-button
v-aut="'sys_client_add'"
@click="formDialogRef.openDialog()"
class="ml10"
icon="folder-add"
type="primary"
v-auth="'sys_client_add'"
>
<el-button v-auth="'sys_client_add'" @click="formDialogRef.openDialog()" class="ml10" icon="folder-add" type="primary">
{{ $t('common.addBtn') }}
</el-button>
<el-button v-aut="'sys_client_del'" plain @click="handleRefreshCache()" class="ml10" icon="refresh-left" type="primary">
<el-button v-auth="'sys_client_del'" plain @click="handleRefreshCache()" class="ml10" icon="refresh-left" type="primary">
{{ $t('common.refreshCacheBtn') }}
</el-button>
<el-button
v-aut="'sys_client_del'"
plain
:disabled="multiple"
@click="handleDelete(selectObjs)"
class="ml10"
icon="Delete"
type="primary"
v-auth="'sys_client_del'"
>
<el-button plain :disabled="multiple" @click="handleDelete(selectObjs)" class="ml10" icon="Delete" type="primary" v-auth="'sys_client_del'">
{{ $t('common.delBtn') }}
</el-button>

View File

@ -1,7 +1,7 @@
<template>
<div class="system-dept-dialog-container">
<el-dialog :title="dataForm.deptId ? $t('common.editBtn') : $t('common.addBtn')" v-model="visible" width="769px">
<el-form ref="deptDialogFormRef" :model="dataForm" label-width="90px" :rules="dataRules">
<el-form ref="deptDialogFormRef" :model="dataForm" label-width="90px" :rules="dataRules" v-loading="loading">
<el-row :gutter="20">
<el-col :span="12" class="mb20">
<el-form-item :label="$t('sysdept.parentId')" prop="parentId">
@ -32,7 +32,7 @@
<template #footer>
<span class="dialog-footer">
<el-button @click="visible = false">{{ $t('common.cancelButtonText') }}</el-button>
<el-button type="primary" @click="onSubmit">{{ $t('common.confirmButtonText') }}</el-button>
<el-button type="primary" @click="onSubmit" :disabled="loading">{{ $t('common.confirmButtonText') }}</el-button>
</span>
</template>
</el-dialog>
@ -57,6 +57,7 @@ const dataForm = reactive({
});
const parentData = ref<any[]>([]);
const visible = ref(false);
const loading = ref(false);
const dataRules = ref({
parentId: [{ required: true, message: '上级部门不能为空', trigger: 'blur' }],
@ -93,12 +94,15 @@ const onSubmit = async () => {
if (!valid) return false;
try {
loading.value = true;
dataForm.deptId ? await putObj(dataForm) : await addObj(dataForm);
useMessage().success(t(dataForm.deptId ? 'common.editSuccessText' : 'common.addSuccessText'));
visible.value = false;
emit('refresh');
} catch (err: any) {
useMessage().error(err.msg);
} finally {
loading.value = false;
}
};

View File

@ -1,7 +1,7 @@
<template>
<div class="system-dic-dialog-container">
<el-dialog v-model="visible" :title="dataForm.id ? $t('common.editBtn') : $t('common.addBtn')" width="60%">
<el-form ref="dicDialogFormRef" :model="dataForm" label-width="90px" :rules="dataRules">
<el-form ref="dicDialogFormRef" :model="dataForm" label-width="90px" :rules="dataRules" v-loading="loading">
<el-row :gutter="35">
<el-col :span="12" class="mb20" v-if="dataForm.id">
<el-form-item :label="$t('dictItem.dictType')" prop="dictType">
@ -38,7 +38,7 @@
<template #footer>
<span class="dialog-footer">
<el-button @click="visible = false">{{ $t('common.cancelButtonText') }}</el-button>
<el-button type="primary" @click="onSubmit">{{ $t('common.confirmButtonText') }}</el-button>
<el-button type="primary" @click="onSubmit" :disabled="loading">{{ $t('common.confirmButtonText') }}</el-button>
</span>
</template>
</el-dialog>
@ -58,6 +58,7 @@ const { t } = useI18n();
const dicDialogFormRef = ref();
const visible = ref(false);
const loading = ref(false);
const dataForm = reactive({
id: '',
@ -110,12 +111,15 @@ const onSubmit = async () => {
if (!valid) return false;
try {
loading.value = true;
dataForm.id ? await putItemObj(dataForm) : await addItemObj(dataForm);
useMessage().success(t(dataForm.id ? 'common.editSuccessText' : 'common.addSuccessText'));
visible.value = false;
emit('refresh');
} catch (err: any) {
useMessage().error(err.msg);
} finally {
loading.value = false;
}
};

View File

@ -1,7 +1,7 @@
<template>
<div class="system-dic-dialog-container">
<el-dialog :title="dataForm.id ? $t('common.editBtn') : $t('common.addBtn')" v-model="visible" width="60%">
<el-form :model="dataForm" :rules="dataRules" label-width="100px" ref="dicDialogFormRef">
<el-form :model="dataForm" :rules="dataRules" label-width="100px" ref="dicDialogFormRef" v-loading="loading">
<el-row :gutter="35">
<el-col :span="12" class="mb20">
<el-form-item :label="$t('sysdict.dictType')" prop="dictType">
@ -32,7 +32,7 @@
<template #footer>
<span class="dialog-footer">
<el-button @click="visible = false">{{ $t('common.cancelButtonText') }}</el-button>
<el-button @click="onSubmit" type="primary">{{ $t('common.confirmButtonText') }}</el-button>
<el-button @click="onSubmit" type="primary" :disabled="loading">{{ $t('common.confirmButtonText') }}</el-button>
</span>
</template>
</el-dialog>
@ -54,6 +54,7 @@ const { t } = useI18n();
const dicDialogFormRef = ref();
const visible = ref(false);
const loading = ref(false);
const dataForm = reactive({
id: '',
@ -99,12 +100,15 @@ const onSubmit = async () => {
if (!valid) return false;
try {
loading.value = true;
const result = dataForm.id ? await putObj(dataForm) : await addObj(dataForm);
useMessage().success(t(dataForm.id ? 'common.editSuccessText' : 'common.addSuccessText'));
visible.value = false;
emit('refresh', result.data);
} catch (err: any) {
useMessage().error(err.msg);
} finally {
loading.value = false;
}
};

View File

@ -1,6 +1,6 @@
<template>
<el-dialog :close-on-click-modal="false" :title="form.id ? $t('common.editBtn') : $t('common.addBtn')" draggable v-model="visible">
<el-form :model="form" :rules="dataRules" formDialogRef label-width="90px" ref="dataFormRef">
<el-form :model="form" :rules="dataRules" formDialogRef label-width="90px" ref="dataFormRef" v-loading="loading">
<el-row :gutter="20">
<el-col :span="12" class="mb20">
<el-form-item :label="t('i18n.name')" prop="name">
@ -22,7 +22,7 @@
<template #footer>
<span class="dialog-footer">
<el-button @click="visible = false">{{ $t('common.cancelButtonText') }}</el-button>
<el-button @click="onSubmit" type="primary">{{ $t('common.confirmButtonText') }}</el-button>
<el-button @click="onSubmit" type="primary" :disabled="loading">{{ $t('common.confirmButtonText') }}</el-button>
</span>
</template>
</el-dialog>
@ -41,6 +41,7 @@ const { t } = useI18n();
//
const dataFormRef = ref();
const visible = ref(false);
const loading = ref(false);
//
const form = reactive({
@ -105,12 +106,15 @@ const onSubmit = async () => {
if (!valid) return false;
try {
loading.value = true;
form.id ? await putObj(form) : await addObj(form);
useMessage().success(t(form.id ? 'common.editSuccessText' : 'common.addSuccessText'));
visible.value = false;
emit('refresh');
} catch (err: any) {
useMessage().error(err.msg);
} finally {
loading.value = false;
}
};

View File

@ -79,7 +79,7 @@
<template #footer>
<span class="dialog-footer">
<el-button @click="visible = false">{{ $t('common.cancelButtonText') }}</el-button>
<el-button type="primary" @click="onSubmit">{{ $t('common.confirmButtonText') }}</el-button>
<el-button type="primary" @click="onSubmit" :disabled="loading">{{ $t('common.confirmButtonText') }}</el-button>
</span>
</template>
</el-dialog>
@ -150,12 +150,8 @@ const openDialog = (type: string, row?: any) => {
//
const getMenuDetail = (id: string) => {
info(id)
.then((res) => {
info(id).then((res) => {
Object.assign(state.ruleForm, res.data);
})
.finally(() => {
loading.value = false;
});
};
@ -181,12 +177,15 @@ const onSubmit = async () => {
if (!valid) return false;
try {
loading.value = true;
state.ruleForm.menuId ? await putObj(state.ruleForm) : await addObj(state.ruleForm);
useMessage().success(t(state.ruleForm.menuId ? 'common.editSuccessText' : 'common.addSuccessText'));
visible.value = false;
emit('refresh');
} catch (err: any) {
useMessage().error(err.msg);
} finally {
loading.value = false;
}
};

View File

@ -1,6 +1,6 @@
<template>
<el-dialog :close-on-click-modal="false" :title="form.publicId ? $t('common.editBtn') : $t('common.addBtn')" draggable v-model="visible">
<el-form :model="form" :rules="dataRules" formDialogRef label-width="90px" ref="dataFormRef">
<el-form :model="form" :rules="dataRules" formDialogRef label-width="90px" ref="dataFormRef" v-loading="loading">
<el-row :gutter="20">
<el-col :span="12" class="mb20">
<el-form-item :label="t('param.publicName')" prop="publicName">
@ -53,8 +53,8 @@
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="visible = false" formDialogRef>{{ $t('common.cancelButtonText') }}</el-button>
<el-button @click="onSubmit" formDialogRef type="primary">{{ $t('common.confirmButtonText') }}</el-button>
<el-button @click="visible = false">{{ $t('common.cancelButtonText') }}</el-button>
<el-button @click="onSubmit" type="primary" :disabled="loading">{{ $t('common.confirmButtonText') }}</el-button>
</span>
</template>
</el-dialog>
@ -75,6 +75,8 @@ const { t } = useI18n();
//
const dataFormRef = ref();
const visible = ref(false);
const loading = ref(false);
//
const { dict_type, status_type, param_type } = useDict('dict_type', 'status_type', 'param_type');
@ -140,12 +142,15 @@ const onSubmit = async () => {
if (!valid) return false;
try {
loading.value = true;
form.publicId ? await putObj(form) : await addObj(form);
useMessage().success(t(form.publicId ? 'common.editSuccessText' : 'common.addSuccessText'));
visible.value = false;
emit('refresh');
} catch (err: any) {
useMessage().error(err.msg);
} finally {
loading.value = false;
}
};

View File

@ -1,6 +1,6 @@
<template>
<el-dialog :title="form.postId ? $t('common.editBtn') : $t('common.addBtn')" v-model="visible" :close-on-click-modal="false" draggable>
<el-form ref="dataFormRef" :model="form" :rules="dataRules" label-width="90px">
<el-form ref="dataFormRef" :model="form" :rules="dataRules" label-width="90px" v-loading="loading">
<el-row :gutter="20">
<el-col :span="12" class="mb20">
<el-form-item :label="t('post.postCode')" prop="postCode">
@ -27,7 +27,7 @@
<template #footer>
<span class="dialog-footer">
<el-button @click="visible = false">{{ $t('common.cancelButtonText') }}</el-button>
<el-button type="primary" @click="onSubmit">{{ $t('common.confirmButtonText') }}</el-button>
<el-button type="primary" @click="onSubmit" :disabled="loading">{{ $t('common.confirmButtonText') }}</el-button>
</span>
</template>
</el-dialog>
@ -46,6 +46,7 @@ const { t } = useI18n();
//
const dataFormRef = ref();
const visible = ref(false);
const loading = ref(false);
//
const form = reactive({
@ -108,12 +109,15 @@ const onSubmit = async () => {
if (!valid) return false;
try {
loading.value = true;
form.postId ? await putObj(form) : await addObj(form);
useMessage().success(t(form.postId ? 'common.editSuccessText' : 'common.addSuccessText'));
visible.value = false;
emit('refresh');
} catch (err: any) {
useMessage().error(err.msg);
} finally {
loading.value = false;
}
};

View File

@ -1,6 +1,6 @@
<template>
<el-dialog :close-on-click-modal="false" :title="form.roleId ? $t('common.editBtn') : $t('common.addBtn')" draggable v-model="visible">
<el-form :model="form" :rules="dataRules" label-width="90px" ref="dataFormRef">
<el-form :model="form" :rules="dataRules" label-width="90px" ref="dataFormRef" v-loading="loading">
<el-row :gutter="35">
<el-col :span="12" class="mb20">
<el-form-item :label="$t('sysrole.roleName')" prop="roleName">
@ -54,7 +54,7 @@
<template #footer>
<span class="dialog-footer">
<el-button @click="visible = false">{{ $t('common.cancelButtonText') }}</el-button>
<el-button @click="onSubmit" type="primary">{{ $t('common.confirmButtonText') }}</el-button>
<el-button @click="onSubmit" type="primary" :disabled="loading">{{ $t('common.confirmButtonText') }}</el-button>
</span>
</template>
</el-dialog>
@ -76,6 +76,7 @@ const { t } = useI18n();
const dataFormRef = ref();
const deptTreeRef = ref();
const visible = ref(false);
const loading = ref(false);
//
const form = reactive({
@ -179,12 +180,15 @@ const onSubmit = async () => {
if (!valid) return false;
try {
loading.value = true;
form.roleId ? await putObj(form) : await addObj(form);
useMessage().success(t(form.roleId ? 'common.editSuccessText' : 'common.addSuccessText'));
visible.value = false;
emit('refresh');
} catch (err: any) {
useMessage().error(err.msg);
} finally {
loading.value = false;
}
};

View File

@ -1,6 +1,6 @@
<template>
<el-dialog :close-on-click-modal="false" :title="form.id ? $t('common.editBtn') : $t('common.addBtn')" draggable v-model="visible">
<el-form :model="form" :rules="dataRules" formDialogRef label-width="90px" ref="dataFormRef">
<el-form :model="form" :rules="dataRules" formDialogRef label-width="90px" ref="dataFormRef" v-loading="loading">
<el-row :gutter="20">
<el-col :span="12" class="mb20">
<el-form-item :label="t('social.type')" prop="type">
@ -40,8 +40,8 @@
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="visible = false" formDialogRef>{{ $t('common.cancelButtonText') }}</el-button>
<el-button @click="onSubmit" formDialogRef type="primary">{{ $t('common.confirmButtonText') }}</el-button>
<el-button @click="visible = false">{{ $t('common.cancelButtonText') }}</el-button>
<el-button @click="onSubmit" type="primary" :disabled="loading">{{ $t('common.confirmButtonText') }}</el-button>
</span>
</template>
</el-dialog>
@ -62,6 +62,8 @@ const { t } = useI18n();
//
const dataFormRef = ref();
const visible = ref(false);
const loading = ref(false);
//
const { social_type } = useDict('social_type');
@ -115,6 +117,7 @@ const onSubmit = async () => {
form.appId = form.appId?.includes('******') ? undefined : form.appId;
try {
loading.value = true;
if (form.id) {
await putObj(form);
useMessage().success(t('common.editSuccessText'));
@ -126,6 +129,8 @@ const onSubmit = async () => {
emit('refresh');
} catch (err: any) {
useMessage().error(err.msg);
} finally {
loading.value = false;
}
};

View File

@ -1,6 +1,6 @@
<template>
<el-dialog :title="form.id ? $t('common.editBtn') : $t('common.addBtn')" v-model="visible" :close-on-click-modal="false" draggable>
<el-form ref="dataFormRef" :model="form" :rules="dataRules" label-width="90px">
<el-form ref="dataFormRef" :model="form" :rules="dataRules" label-width="90px" v-loading="loading">
<el-row :gutter="20">
<el-col :span="12" class="mb20">
<el-form-item :label="t('tenant.name')" prop="name">
@ -47,7 +47,7 @@
<template #footer>
<span class="dialog-footer">
<el-button @click="visible = false">{{ $t('common.cancelButtonText') }}</el-button>
<el-button type="primary" @click="onSubmit">{{ $t('common.confirmButtonText') }}</el-button>
<el-button type="primary" @click="onSubmit" :disabled="loading">{{ $t('common.confirmButtonText') }}</el-button>
</span>
</template>
</el-dialog>
@ -68,6 +68,7 @@ const { t } = useI18n();
//
const dataFormRef = ref();
const visible = ref(false);
const loading = ref(false);
//
const { status_type } = useDict('status_type');
@ -140,12 +141,15 @@ const onSubmit = async () => {
if (!valid) return false;
try {
loading.value = true;
form.id ? await putObj(form) : await addObj(form);
useMessage().success(t(form.id ? 'common.editSuccessText' : 'common.addSuccessText'));
visible.value = false;
emit('refresh');
} catch (err: any) {
useMessage().error(err.msg);
} finally {
loading.value = false;
}
};

View File

@ -1,6 +1,6 @@
<template>
<el-dialog :title="form.id ? $t('common.editBtn') : $t('common.addBtn')" v-model="visible" :close-on-click-modal="false" draggable>
<el-form ref="dataFormRef" :model="form" :rules="dataRules" label-width="90px">
<el-form ref="dataFormRef" :model="form" :rules="dataRules" label-width="90px" v-loading="loading">
<el-row :gutter="20">
<el-col :span="12" class="mb20">
<el-form-item :label="t('tenant.name')" prop="name">
@ -53,6 +53,7 @@ const emit = defineEmits(['refresh']);
const dataFormRef = ref();
const visible = ref(false);
const loading = ref(false);
const menuTreeRef = ref();
const form = reactive({
@ -108,13 +109,12 @@ const openDialog = (id: string) => {
getMenuData();
};
const loading = ref(false);
const onSubmit = async () => {
const valid = await dataFormRef.value.validate().catch(() => {});
if (!valid) return false;
try {
loading.value = true;
//
form.menuIds = [...menuTreeRef.value.getCheckedKeys(), ...menuTreeRef.value.getHalfCheckedKeys()].join(',');
form.id ? await putObj(form) : await addObj(form);
@ -123,6 +123,8 @@ const onSubmit = async () => {
emit('refresh');
} catch (err: any) {
useMessage().error(err.msg);
} finally {
loading.value = false;
}
};

View File

@ -74,7 +74,7 @@
<template #footer>
<span class="dialog-footer">
<el-button @click="visible = false">{{ $t('common.cancelButtonText') }}</el-button>
<el-button @click="onSubmit" type="primary">{{ $t('common.confirmButtonText') }}</el-button>
<el-button @click="onSubmit" type="primary" :disabled="loading">{{ $t('common.confirmButtonText') }}</el-button>
</span>
</template>
</el-dialog>
@ -224,29 +224,29 @@ const onSubmit = async () => {
}
};
//
const getUserData = (id: string) => {
//
/**
* 从服务器获取用户数据
*
* @async
* @param {string} id - 用户 ID
* @return {Promise} - 包含用户数据的 Promise 对象
*/
const getUserData = async (id) => {
try {
loading.value = true;
return getObj(id)
.then((res) => {
Object.assign(dataForm, res.data);
if (res.data.roleList) {
dataForm.role = [];
res.data.roleList.map((item: any) => {
dataForm.role.push(item.roleId);
});
const { data } = await getObj(id);
Object.assign(dataForm, data);
if (data.roleList) {
dataForm.role = data.roleList.map(item => item.roleId);
}
if (res.data.postList) {
dataForm.post = [];
res.data.postList.map((item: any) => {
dataForm.post.push(item.postId);
});
if (data.postList) {
dataForm.post = data.postList.map(item => item.postId);
}
})
.finally(() => {
} catch (err:any) {
useMessage().error(err.msg);
} finally {
loading.value = false;
});
}
};
//

View File

@ -58,7 +58,7 @@
<template #footer>
<span class="dialog-footer">
<el-button @click="visible = false">{{ $t('common.cancelButtonText') }}</el-button>
<el-button @click="onSubmit" type="primary">{{ $t('common.confirmButtonText') }}</el-button>
<el-button @click="onSubmit" type="primary" :disabled="loading">{{ $t('common.confirmButtonText') }}</el-button>
</span>
</template>
</el-dialog>
@ -125,6 +125,7 @@ const dataRules = reactive({
//
const openDialog = (type: string, row?: any) => {
console.log(type, row);
state.ruleForm.menuId = '';
visible.value = true;
@ -159,12 +160,8 @@ const getAllMenuData = () => {
};
const getMenuDetail = (id: string) => {
info(id)
.then((res) => {
info(id).then((res) => {
Object.assign(state.ruleForm, res.data);
})
.finally(() => {
loading.value = false;
});
};
@ -173,12 +170,15 @@ const onSubmit = async () => {
if (!valid) return false;
try {
loading.value = true;
state.ruleForm.menuId ? await update(state.ruleForm) : await addObj(state.ruleForm);
useMessage().success(t(state.ruleForm.menuId ? 'common.editSuccessText' : 'common.addSuccessText'));
visible.value = false;
emit('refresh');
} catch (err: any) {
useMessage().error(err.msg);
} finally {
loading.value = false;
}
};

View File

@ -24,8 +24,6 @@
</el-button>
<right-toolbar
v-model:showSearch="showSearch"
:export="'sys_role_export'"
@exportExcel="exportExcel"
class="ml10"
style="float: right; margin-right: 20px"
@queryTable="getDataList"
@ -62,10 +60,10 @@
<el-table-column :label="$t('appmenu.permission')" :show-overflow-tooltip="true" prop="permission"></el-table-column>
<el-table-column :label="$t('common.action')" show-overflow-tooltip width="250">
<template #default="scope">
<el-button icon="add" @click="menuDialogRef.openDialog('add', scope.row?.id)" text type="primary" v-auth="'sys_menu_add'">
<el-button icon="add" @click="menuDialogRef.openDialog('add', scope.row)" text type="primary" v-auth="'sys_menu_add'">
{{ $t('common.addBtn') }}
</el-button>
<el-button icon="edit-pen" @click="menuDialogRef.openDialog('edit', scope.row?.id)" text type="primary" v-auth="'sys_menu_edit'"
<el-button icon="edit-pen" @click="menuDialogRef.openDialog('edit', scope.row)" text type="primary" v-auth="'sys_menu_edit'"
>{{ $t('common.editBtn') }}
</el-button>
<el-button icon="delete" @click="handleDelete([scope.row.id])" text type="primary" v-auth="'sys_menu_del'"

View File

@ -1,6 +1,6 @@
<template>
<el-dialog :close-on-click-modal="false" :title="form.roleId ? $t('common.editBtn') : $t('common.addBtn')" draggable v-model="visible">
<el-form :model="form" :rules="dataRules" label-width="90px" ref="dataFormRef">
<el-form :model="form" :rules="dataRules" label-width="90px" ref="dataFormRef" v-loading="loading">
<el-row :gutter="35">
<el-col :span="12" class="mb20">
<el-form-item :label="$t('approle.roleName')" prop="roleName">
@ -27,7 +27,7 @@
<template #footer>
<span class="dialog-footer">
<el-button @click="visible = false">{{ $t('common.cancelButtonText') }}</el-button>
<el-button @click="onSubmit" type="primary">{{ $t('common.confirmButtonText') }}</el-button>
<el-button @click="onSubmit" type="primary" :disabled="loading">{{ $t('common.confirmButtonText') }}</el-button>
</span>
</template>
</el-dialog>
@ -47,6 +47,7 @@ const { t } = useI18n();
//
const dataFormRef = ref();
const visible = ref(false);
const loading = ref(false);
//
const form = reactive({
@ -115,12 +116,15 @@ const onSubmit = async () => {
if (!valid) return false;
try {
loading.value = true;
form.roleId ? await putObj(form) : await addObj(form);
useMessage().success(t(form.roleId ? 'common.editSuccessText' : 'common.addSuccessText'));
visible.value = false;
emit('refresh');
} catch (err: any) {
useMessage().error(err.msg);
} finally {
loading.value = false;
}
};

View File

@ -1,6 +1,6 @@
<template>
<el-dialog :close-on-click-modal="false" :title="form.id ? $t('common.editBtn') : $t('common.addBtn')" draggable v-model="visible">
<el-form :model="form" :rules="dataRules" formDialogRef label-width="90px" ref="dataFormRef">
<el-form :model="form" :rules="dataRules" formDialogRef label-width="90px" ref="dataFormRef" v-loading="loading">
<el-row :gutter="20">
<el-col :span="12" class="mb20">
<el-form-item :label="t('appsocial.type')" prop="type">
@ -42,8 +42,8 @@
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="visible = false" formDialogRef>{{ $t('common.cancelButtonText') }}</el-button>
<el-button @click="onSubmit" formDialogRef type="primary">{{ $t('common.confirmButtonText') }}</el-button>
<el-button @click="visible = false">{{ $t('common.cancelButtonText') }}</el-button>
<el-button @click="onSubmit" type="primary" :disabled="loading">{{ $t('common.confirmButtonText') }}</el-button>
</span>
</template>
</el-dialog>
@ -64,6 +64,8 @@ const { t } = useI18n();
//
const dataFormRef = ref();
const visible = ref(false);
const loading = ref(false);
//
const { app_social_type } = useDict('app_social_type');
@ -117,6 +119,7 @@ const onSubmit = async () => {
form.appId = form.appId?.includes('******') ? undefined : form.appId;
try {
loading.value = true;
if (form.id) {
await putObj(form);
useMessage().success(t('common.editSuccessText'));
@ -128,6 +131,8 @@ const onSubmit = async () => {
emit('refresh');
} catch (err: any) {
useMessage().error(err.msg);
} finally {
loading.value = false;
}
};

View File

@ -52,7 +52,7 @@
<template #footer>
<span class="dialog-footer">
<el-button @click="visible = false">{{ $t('common.cancelButtonText') }}</el-button>
<el-button type="primary" @click="onSubmit">{{ $t('common.confirmButtonText') }}</el-button>
<el-button type="primary" @click="onSubmit" :disabled="loading">{{ $t('common.confirmButtonText') }}</el-button>
</span>
</template>
</el-dialog>
@ -194,10 +194,8 @@ const getUserData = async (id: string) => {
try {
const { data } = await getObj(id);
Object.assign(dataForm, data);
dataForm.password = '******';
if (data.roleList) {
dataForm.role = data.roleList.map((item: any) => item.roleId);
}

View File

@ -1,6 +1,6 @@
<template>
<el-dialog v-model="visible" :close-on-click-modal="false" :title="form.jobId ? $t('common.editBtn') : $t('common.addBtn')" draggable>
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="120px">
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="120px" v-loading="loading">
<el-row :gutter="20">
<el-col :span="12" class="mb20">
<el-form-item :label="t('job.jobName')" prop="jobName">
@ -76,7 +76,7 @@
<template #footer>
<span class="dialog-footer">
<el-button formDialogRef @click="visible = false">{{ $t('common.cancelButtonText') }}</el-button>
<el-button formDialogRef type="primary" @click="onSubmit">{{ $t('common.confirmButtonText') }}</el-button>
<el-button formDialogRef type="primary" @click="onSubmit" :disabled="loading">{{ $t('common.confirmButtonText') }}</el-button>
</span>
</template>
</el-dialog>
@ -98,6 +98,8 @@ const { t } = useI18n();
const dataFormRef = ref();
const cronPopover = ref();
const visible = ref(false);
const loading = ref(false);
//
const { misfire_policy, job_type } = useDict('job_status', 'job_execute_status', 'misfire_policy', 'job_type');
@ -162,12 +164,15 @@ const onSubmit = async () => {
if (!valid) return false;
try {
loading.value = true;
form.jobId ? await putObj(form) : await addObj(form);
useMessage().success(t(form.jobId ? 'common.editSuccessText' : 'common.addSuccessText'));
visible.value = false;
emit('refresh');
} catch (err: any) {
useMessage().error(err.msg);
} finally {
loading.value = false;
}
};

View File

@ -26,8 +26,7 @@ onMounted(() => {
const init = () => {
const token = Session.getToken();
const tenantId = Session.getTenant();
let url = proxy.baseURL + `/jimu/jmreport/list?token=${tenantId}_${token}`;
src.value = other.adaptationUrl(url);
src.value = proxy.baseURL + `/jimu/jmreport/list?token=${tenantId}_${token}`;
};
</script>

View File

@ -24,8 +24,7 @@ onMounted(() => {
const init = () => {
const token = Session.getToken();
const tenantId = Session.getTenant();
let url = `/gv?token=${token}&TENANT-ID=${tenantId}`;
src.value = proxy.baseURL + other.adaptationUrl(url);
src.value = proxy.baseURL + `/gv?token=${token}&TENANT-ID=${tenantId}`;
};
</script>

View File

@ -1,6 +1,6 @@
<template>
<el-dialog :title="form.id ? $t('common.editBtn') : $t('common.addBtn')" v-model="visible" :close-on-click-modal="false" draggable>
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="90px">
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="90px" v-loading="loading">
<el-row :gutter="20">
<el-col :span="12" class="mb20">
<el-form-item :label="t('datasourceconf.dsType')" prop="dsType">
@ -60,8 +60,8 @@
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="visible = false" formDialogRef>{{ $t('common.cancelButtonText') }}</el-button>
<el-button type="primary" @click="onSubmit" formDialogRef>{{ $t('common.confirmButtonText') }}</el-button>
<el-button @click="visible = false">{{ $t('common.cancelButtonText') }}</el-button>
<el-button type="primary" @click="onSubmit" :disabled="loading">{{ $t('common.confirmButtonText') }}</el-button>
</span>
</template>
</el-dialog>
@ -80,6 +80,7 @@ const { t } = useI18n();
//
const dataFormRef = ref();
const visible = ref(false);
const loading = ref(false);
//
const { ds_config_type, ds_type } = useDict('ds_config_type', 'ds_type');
@ -160,12 +161,15 @@ const onSubmit = async () => {
form.password = form.password?.includes('******') ? undefined : form.password;
try {
loading.value = true;
form.id ? await putObj(form) : await addObj(form);
useMessage().success(t(form.id ? 'common.editSuccessText' : 'common.addSuccessText'));
visible.value = false;
emit('refresh');
} catch (err: any) {
useMessage().error(err.msg);
} finally {
loading.value = false;
}
};

View File

@ -1,6 +1,6 @@
<template>
<el-dialog :title="form.id ? $t('common.editBtn') : $t('common.addBtn')" v-model="visible" :close-on-click-modal="false" draggable>
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="90px">
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="90px" v-loading="loading">
<el-row :gutter="20">
<el-col :span="12" class="mb20">
<el-form-item :label="t('fieldtype.columnType')" prop="columnType">
@ -21,8 +21,8 @@
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="visible = false" formDialogRef>{{ $t('common.cancelButtonText') }}</el-button>
<el-button type="primary" @click="onSubmit" formDialogRef>{{ $t('common.confirmButtonText') }}</el-button>
<el-button @click="visible = false">{{ $t('common.cancelButtonText') }}</el-button>
<el-button type="primary" @click="onSubmit" :disabled="loading">{{ $t('common.confirmButtonText') }}</el-button>
</span>
</template>
</el-dialog>
@ -40,6 +40,7 @@ const { t } = useI18n();
//
const dataFormRef = ref();
const visible = ref(false);
const loading = ref(false);
//
const form = reactive({
@ -54,19 +55,13 @@ const form = reactive({
const dataRules = ref({
columnType: [
{ required: true, message: '字段类型不能为空', trigger: 'blur' },
{ validator: rule.letter, trigger: 'blur' },
{
validator: (rule: any, value: any, callback: any) => {
validateColumnType(rule, value, callback, form.id !== '');
},
},
],
attrType: [
{ required: true, message: '属性类型不能为空', trigger: 'blur' },
{ validator: rule.letter, trigger: 'blur' },
],
packageName: [{ required: true, message: '属性包名不能为空', trigger: 'blur' }],
createTime: [{ required: true, message: '创建时间不能为空', trigger: 'blur' }],
attrType: [{ required: true, message: '属性类型不能为空', trigger: 'blur' }],
});
//
@ -94,12 +89,15 @@ const onSubmit = async () => {
if (!valid) return false;
try {
loading.value = true;
form.id ? await putObj(form) : await addObj(form);
useMessage().success(t(form.id ? 'common.editSuccessText' : 'common.addSuccessText'));
visible.value = false;
emit('refresh');
} catch (err: any) {
useMessage().error(err.msg);
} finally {
loading.value = false;
}
};

View File

@ -1,6 +1,6 @@
<template>
<el-dialog v-model="visible" :title="form.id ? $t('common.editBtn') : $t('common.addBtn')">
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="90px">
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="90px" v-loading="loading">
<el-row :gutter="24">
<el-col :span="12" class="mb20">
<el-form-item :label="t('group.groupName')" prop="groupName">
@ -24,7 +24,7 @@
<template #footer>
<span class="dialog-footer">
<el-button @click="visible = false">{{ $t('common.cancelButtonText') }}</el-button>
<el-button type="primary" @click="onSubmit">{{ $t('common.confirmButtonText') }}</el-button>
<el-button type="primary" @click="onSubmit" :disabled="loading">{{ $t('common.confirmButtonText') }}</el-button>
</span>
</template>
</el-dialog>
@ -42,6 +42,7 @@ const { t } = useI18n();
//
const dataFormRef = ref();
const visible = ref(false);
const loading = ref(false);
const templateData = ref<any[]>([]);
//
@ -85,12 +86,15 @@ const onSubmit = async () => {
if (!valid) return false;
try {
loading.value = true;
form.id ? await putObj(form) : await addObj(form);
useMessage().success(t(form.id ? 'common.editSuccessText' : 'common.addSuccessText'));
visible.value = false;
emit('refresh');
} catch (err: any) {
useMessage().error(err.msg);
} finally {
loading.value = false;
}
};

View File

@ -1,6 +1,6 @@
<template>
<el-dialog :title="form.id ? $t('common.editBtn') : $t('common.addBtn')" v-model="visible">
<el-form :model="form" :rules="dataRules" formDialogRef label-width="90px" ref="dataFormRef">
<el-form :model="form" :rules="dataRules" formDialogRef label-width="90px" ref="dataFormRef" v-loading="loading">
<el-row :gutter="24">
<el-col :span="12" class="mb20">
<el-form-item :label="t('template.templateName')" prop="templateName">
@ -29,7 +29,7 @@
<template #footer>
<span class="dialog-footer">
<el-button @click="visible = false">{{ $t('common.cancelButtonText') }}</el-button>
<el-button @click="onSubmit" type="primary">{{ $t('common.confirmButtonText') }}</el-button>
<el-button @click="onSubmit" type="primary" :disabled="loading">{{ $t('common.confirmButtonText') }}</el-button>
</span>
</template>
</el-dialog>
@ -48,6 +48,8 @@ const { t } = useI18n();
//
const dataFormRef = ref();
const visible = ref(false);
const loading = ref(false);
//
//
@ -88,12 +90,15 @@ const onSubmit = async () => {
if (!valid) return false;
try {
loading.value = true;
form.id ? await putObj(form) : await addObj(form);
useMessage().success(t(form.id ? 'common.editSuccessText' : 'common.addSuccessText'));
visible.value = false;
emit('refresh');
} catch (err: any) {
useMessage().error(err.msg);
} finally {
loading.value = false;
}
};
//

View File

@ -44,7 +44,7 @@
<template #footer>
<span class="dialog-footer">
<el-button @click="visible = false">{{ $t('common.cancelButtonText') }}</el-button>
<el-button type="primary" @click="onSubmit">{{ $t('common.confirmButtonText') }}</el-button>
<el-button type="primary" @click="onSubmit" :disabled="loading">{{ $t('common.confirmButtonText') }}</el-button>
</span>
</template>
</el-dialog>
@ -125,12 +125,15 @@ const onSubmit = async () => {
if (!valid) return false;
try {
loading.value = true;
await (form.id ? putObj(form) : addObj(form));
useMessage().success(t(form.id ? 'common.editSuccessText' : 'common.addSuccessText'));
visible.value = false;
emit('refresh');
} catch (err: any) {
useMessage().error(err.msg);
} finally {
loading.value = false;
}
};

View File

@ -12,19 +12,20 @@
<template #footer>
<span class="dialog-footer">
<el-button @click="visible = false">{{ $t('common.cancelButtonText') }}</el-button>
<el-button type="primary" @click="onSubmit">{{ $t('common.confirmButtonText') }}</el-button>
<el-button type="primary" @click="onSubmit" :disabled="loading">{{ $t('common.confirmButtonText') }}</el-button>
</span>
</template>
</el-dialog>
</template>
<script lang="ts" name="WxAccountTagDialog" setup>
// /
const emit = defineEmits(['refresh']);
import { useMessage } from '/@/hooks/message';
import { addObj, putObj } from '/@/api/mp/wx-account-tag';
import { useI18n } from 'vue-i18n';
// /
const emit = defineEmits(['refresh']);
const { t } = useI18n();
//
@ -61,42 +62,28 @@ const openDialog = (row: any, appid: string) => {
};
//
const onSubmit = () => {
dataFormRef.value.validate((valid: boolean) => {
if (!valid) {
return false;
}
loading.value = true;
if (form.id) {
putObj(form)
.then(() => {
useMessage().success(t('common.editSuccessText'));
visible.value = false; //
emit('refresh');
})
.catch((err: any) => {
useMessage().error(err.msg);
})
.finally(() => {
loading.value = false;
});
} else {
addObj(form)
.then(() => {
useMessage().success(t('common.addSuccessText'));
visible.value = false; //
emit('refresh');
})
.catch((err: any) => {
useMessage().error(err.msg);
})
.finally(() => {
loading.value = false;
});
}
});
};
const onSubmit = async () => {
const valid = await dataFormRef.value.validate().catch(() => {});
if (!valid) return false;
loading.value = true;
try {
if (form.id) {
await putObj(form);
useMessage().success(t('common.editSuccessText'));
} else {
await addObj(form);
useMessage().success(t('common.addSuccessText'));
}
visible.value = false;
emit('refresh');
} catch (err: any) {
useMessage().error(err.msg);
} finally {
loading.value = false;
}
};
//
defineExpose({
openDialog,

View File

@ -1,6 +1,6 @@
<template>
<el-drawer v-model="visible" :title="form.id ? $t('common.editBtn') : $t('common.addBtn')" size="50%">
<el-form ref="dataFormRef" v-loading="loading" :model="form" :rules="dataRules" formDialogRef label-width="90px">
<el-form ref="dataFormRef" v-loading="loading" :model="form" :rules="dataRules" label-width="90px">
<el-row :gutter="24">
<el-col :span="12" class="mb20">
<el-form-item :label="t('account.name')" prop="name">
@ -48,7 +48,7 @@
<template #footer>
<span class="dialog-footer">
<el-button @click="visible = false">{{ $t('common.cancelButtonText') }}</el-button>
<el-button type="primary" @click="onSubmit">{{ $t('common.confirmButtonText') }}</el-button>
<el-button type="primary" @click="onSubmit" :disabled="loading">{{ $t('common.confirmButtonText') }}</el-button>
</span>
</template>
</el-drawer>
@ -69,7 +69,6 @@ const { t } = useI18n();
const dataFormRef = ref();
const visible = ref(false);
const loading = ref(false);
//
//
const form = reactive({
@ -115,47 +114,31 @@ const openDialog = (id: string) => {
};
//
const onSubmit = () => {
dataFormRef.value.validate((valid: boolean) => {
if (!valid) {
return false;
}
if (form.appsecret && form.appsecret.indexOf('*') >= 0) {
const onSubmit = async () => {
const valid = await dataFormRef.value.validate().catch(() => {});
if (!valid) return false;
const { id, ...rest } = form;
if (form.appsecret && form.appsecret.includes('*')) {
form.appsecret = undefined;
}
//
if (form.id) {
loading.value = true;
putObj(form)
.then(() => {
useMessage().success(t('common.editSuccessText'));
visible.value = false; //
emit('refresh');
})
.catch((err: any) => {
useMessage().error(err.msg);
})
.finally(() => {
loading.value = false;
});
} else {
loading.value = true;
addObj(form)
.then(() => {
useMessage().success(t('common.addSuccessText'));
visible.value = false; //
emit('refresh');
})
.catch((err: any) => {
useMessage().error(err.msg);
})
.finally(() => {
loading.value = false;
});
}
});
};
loading.value = true;
try {
if (id) {
await putObj(rest);
useMessage().success(t('common.editSuccessText'));
} else {
await addObj(rest);
useMessage().success(t('common.addSuccessText'));
}
visible.value = false;
emit('refresh');
} catch (err: any) {
useMessage().error(err.msg);
} finally {
loading.value = false;
}
};
//
const getwxAccountData = (id: string) => {
//

View File

@ -1,6 +1,6 @@
<template>
<el-dialog :close-on-click-modal="false" :title="form.leaveId ? $t('common.editBtn') : $t('common.addBtn')" draggable v-model="visible">
<el-form :model="form" :rules="dataRules" formDialogRef label-width="90px" ref="dataFormRef" v-loading="loading">
<el-form :model="form" :rules="dataRules" label-width="90px" ref="dataFormRef" v-loading="loading">
<el-row :gutter="24">
<el-col :span="24" class="mb20">
<el-form-item :label="t('leave.username')" prop="username">
@ -35,7 +35,7 @@
<template #footer>
<span class="dialog-footer">
<el-button @click="visible = false">{{ $t('common.cancelButtonText') }}</el-button>
<el-button @click="onSubmit" type="primary">{{ $t('common.confirmButtonText') }}</el-button>
<el-button @click="onSubmit" type="primary" :disabled="loading">{{ $t('common.confirmButtonText') }}</el-button>
</span>
</template>
</el-dialog>
@ -99,12 +99,15 @@ const onSubmit = async () => {
if (!valid) return false;
try {
loading.value = true;
form.leaveId ? await putObj(form) : await addObj(form);
useMessage().success(t(form.leaveId ? 'common.editSuccessText' : 'common.addSuccessText'));
visible.value = false;
emit('refresh');
} catch (err: any) {
useMessage().error(err.msg);
} finally {
loading.value = false;
}
};

View File

@ -22,7 +22,7 @@
<template #footer>
<span class="dialog-footer">
<el-button @click="visible = false">{{ $t('common.cancelButtonText') }}</el-button>
<el-button @click="onSubmit" type="primary">{{ $t('common.confirmButtonText') }}</el-button>
<el-button @click="onSubmit" type="primary" :disabled="loading">{{ $t('common.confirmButtonText') }}</el-button>
</span>
</template>
</el-dialog>
@ -91,12 +91,15 @@ const onSubmit = async () => {
if (!valid) return false;
try {
loading.value = true;
form.id ? await putObj(form) : await addObj(form);
useMessage().success(t(form.id ? 'common.editSuccessText' : 'common.addSuccessText'));
visible.value = false;
emit('refresh');
} catch (err: any) {
useMessage().error(err.msg);
} finally {
loading.value = false;
}
};

View File

@ -1,6 +1,6 @@
<template>
<el-dialog :close-on-click-modal="false" :title="form.id ? $t('common.editBtn') : $t('common.addBtn')" draggable v-model="visible">
<el-form :model="form" :rules="dataRules" formDialogRef label-width="90px" ref="dataFormRef" v-loading="loading">
<el-form :model="form" :rules="dataRules" label-width="90px" ref="dataFormRef" v-loading="loading">
<el-row :gutter="24">
<el-col :span="12" class="mb20">
<el-form-item :label="t('channel.appId')" prop="appId">
@ -64,7 +64,7 @@
<template #footer>
<span class="dialog-footer">
<el-button @click="visible = false">{{ $t('common.cancelButtonText') }}</el-button>
<el-button @click="onSubmit" type="primary">{{ $t('common.confirmButtonText') }}</el-button>
<el-button @click="onSubmit" type="primary" :disabled="loading">{{ $t('common.confirmButtonText') }}</el-button>
</span>
</template>
</el-dialog>
@ -86,7 +86,6 @@ const { status_type, channel_type } = useDict('status_type', 'channel_type');
const dataFormRef = ref();
const visible = ref(false);
const loading = ref(false);
//
//
const form = reactive({
@ -149,12 +148,15 @@ const onSubmit = async () => {
if (!valid) return false;
try {
loading.value = true;
form.id ? await putObj(form) : await addObj(form);
useMessage().success(t(form.id ? 'common.editSuccessText' : 'common.addSuccessText'));
visible.value = false;
emit('refresh');
} catch (err: any) {
useMessage().error(err.msg);
} finally {
loading.value = false;
}
};

View File

@ -1,6 +1,6 @@
<template>
<el-dialog :close-on-click-modal="false" :title="form.goodsOrderId ? $t('common.editBtn') : $t('common.addBtn')" draggable v-model="visible">
<el-form :model="form" :rules="dataRules" formDialogRef label-width="90px" ref="dataFormRef" v-loading="loading">
<el-form :model="form" :rules="dataRules" label-width="90px" ref="dataFormRef" v-loading="loading">
<el-row :gutter="24">
<el-col :span="12" class="mb20">
<el-form-item :label="t('order.goodsId')" prop="goodsId">
@ -44,7 +44,7 @@
<template #footer>
<span class="dialog-footer">
<el-button @click="visible = false">{{ $t('common.cancelButtonText') }}</el-button>
<el-button @click="onSubmit" type="primary">{{ $t('common.confirmButtonText') }}</el-button>
<el-button @click="onSubmit" type="primary" :disabled="loading">{{ $t('common.confirmButtonText') }}</el-button>
</span>
</template>
</el-dialog>
@ -123,12 +123,15 @@ const onSubmit = async () => {
if (!valid) return false;
try {
form.id ? await putObj(form) : await addObj(form);
useMessage().success(t(form.id ? 'common.editSuccessText' : 'common.addSuccessText'));
loading.value = true;
form.goodsOrderId ? await putObj(form) : await addObj(form);
useMessage().success(t(form.goodsOrderId ? 'common.editSuccessText' : 'common.addSuccessText'));
visible.value = false;
emit('refresh');
} catch (err: any) {
useMessage().error(err.msg);
} finally {
loading.value = false;
}
};

View File

@ -1,6 +1,6 @@
<template>
<el-dialog :close-on-click-modal="false" :title="form.orderId ? $t('common.editBtn') : $t('common.addBtn')" draggable v-model="visible">
<el-form :model="form" :rules="dataRules" formDialogRef label-width="90px" ref="dataFormRef" v-loading="loading">
<el-form :model="form" :rules="dataRules" label-width="90px" ref="dataFormRef" v-loading="loading">
<el-row :gutter="24">
<el-col :span="12" class="mb20">
<el-form-item :label="t('trade.orderId')" prop="orderId">
@ -68,7 +68,7 @@
<template #footer>
<span class="dialog-footer">
<el-button @click="visible = false">{{ $t('common.cancelButtonText') }}</el-button>
<el-button @click="onSubmit" type="primary">{{ $t('common.confirmButtonText') }}</el-button>
<el-button @click="onSubmit" type="primary" :disabled="loading">{{ $t('common.confirmButtonText') }}</el-button>
</span>
</template>
</el-dialog>
@ -160,12 +160,15 @@ const onSubmit = async () => {
if (!valid) return false;
try {
loading.value = true;
form.orderId ? await putObj(form) : await addObj(form);
useMessage().success(t(form.orderId ? 'common.editSuccessText' : 'common.addSuccessText'));
visible.value = false;
emit('refresh');
} catch (err: any) {
useMessage().error(err.msg);
} finally {
loading.value = false;
}
};