mirror of
https://gitee.com/log4j/pig-ui.git
synced 2024-12-23 05:40:20 +08:00
🐛 Fixing a bug. 系统管理 国际化管理幂等性问题
This commit is contained in:
parent
bdc815a39d
commit
44eefc68f9
@ -1,4 +1,5 @@
|
||||
import request from '/@/utils/request';
|
||||
import { getObjDetails } from '/@/api/admin/param';
|
||||
|
||||
export function fetchList(query?: Object) {
|
||||
return request({
|
||||
@ -18,11 +19,19 @@ export function addObj(obj?: Object) {
|
||||
|
||||
export function getObj(id?: string) {
|
||||
return request({
|
||||
url: '/admin/i18n/' + id,
|
||||
url: '/admin/i18n/details/' + id,
|
||||
method: 'get',
|
||||
});
|
||||
}
|
||||
|
||||
export function getObjDetails(obj?: object) {
|
||||
return request({
|
||||
url: '/admin/i18n/details/',
|
||||
method: 'get',
|
||||
params: obj,
|
||||
});
|
||||
}
|
||||
|
||||
export function delObj(ids?: object) {
|
||||
return request({
|
||||
url: '/admin/i18n',
|
||||
@ -50,5 +59,50 @@ export function refreshCache() {
|
||||
return request({
|
||||
url: '/admin/i18n/sync',
|
||||
method: 'put',
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
export function validateName(rule: any, value: any, callback: any, isEdit: boolean) {
|
||||
if (isEdit) {
|
||||
return callback();
|
||||
}
|
||||
|
||||
getObjDetails({ name: value }).then((response) => {
|
||||
const result = response.data;
|
||||
if (result !== null) {
|
||||
callback(new Error('国际化编码已经存在'));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export function validateZhCn(rule: any, value: any, callback: any, isEdit: boolean) {
|
||||
if (isEdit) {
|
||||
return callback();
|
||||
}
|
||||
|
||||
getObjDetails({ zhCn: value }).then((response) => {
|
||||
const result = response.data;
|
||||
if (result !== null) {
|
||||
callback(new Error('国际化中文已经存在'));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export function validateEn(rule: any, value: any, callback: any, isEdit: boolean) {
|
||||
if (isEdit) {
|
||||
return callback();
|
||||
}
|
||||
|
||||
getObjDetails({ en: value }).then((response) => {
|
||||
const result = response.data;
|
||||
if (result !== null) {
|
||||
callback(new Error('国际化英文已经存在'));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1,131 +1,149 @@
|
||||
<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-row :gutter="20">
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item :label="t('i18n.name')" prop="name">
|
||||
<el-input :placeholder="t('i18n.inputKeyTip')" v-model="form.name"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item :label="t('i18n.zhCn')" prop="zhCn">
|
||||
<el-input :placeholder="t('i18n.inputZhCnTip')" v-model="form.zhCn"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item :label="t('i18n.en')" prop="en">
|
||||
<el-input :placeholder="t('i18n.inputEnTip')" v-model="form.en"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<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-row :gutter="20">
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item :label="t('i18n.name')" prop="name">
|
||||
<el-input :placeholder="t('i18n.inputKeyTip')" v-model="form.name" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item :label="t('i18n.zhCn')" prop="zhCn">
|
||||
<el-input :placeholder="t('i18n.inputZhCnTip')" v-model="form.zhCn" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item :label="t('i18n.en')" prop="en">
|
||||
<el-input :placeholder="t('i18n.inputEnTip')" v-model="form.en" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<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>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="SysI18nDialog" setup>
|
||||
// 定义子组件向父组件传值/事件
|
||||
import {useMessage} from '/@/hooks/message';
|
||||
import {addObj, getObj, putObj} from '/@/api/admin/i18n';
|
||||
import {useI18n} from 'vue-i18n';
|
||||
import {rule} from '/@/utils/validate';
|
||||
// 定义子组件向父组件传值/事件
|
||||
import { useMessage } from '/@/hooks/message';
|
||||
import { addObj, getObj, putObj, validateName, validateZhCn, validateEn } from '/@/api/admin/i18n';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { rule } from '/@/utils/validate';
|
||||
import { validateTenantCode } from '/@/api/admin/tenant';
|
||||
|
||||
const emit = defineEmits(['refresh']);
|
||||
const emit = defineEmits(['refresh']);
|
||||
|
||||
const {t} = useI18n();
|
||||
const { t } = useI18n();
|
||||
|
||||
// 定义变量内容
|
||||
const dataFormRef = ref();
|
||||
const visible = ref(false);
|
||||
// 定义字典
|
||||
// 定义变量内容
|
||||
const dataFormRef = ref();
|
||||
const visible = ref(false);
|
||||
// 定义字典
|
||||
|
||||
// 提交表单数据
|
||||
const form = reactive({
|
||||
id: '',
|
||||
name: '',
|
||||
zhCn: '',
|
||||
en: '',
|
||||
});
|
||||
// 提交表单数据
|
||||
const form = reactive({
|
||||
id: '',
|
||||
name: '',
|
||||
zhCn: '',
|
||||
en: '',
|
||||
});
|
||||
|
||||
// 定义校验规则
|
||||
const dataRules = ref({
|
||||
name: [
|
||||
{required: true, message: 'name不能为空', trigger: 'blur'},
|
||||
{validator: rule.noChinese, trigger: 'blur'},
|
||||
],
|
||||
zhCn: [
|
||||
{required: true, message: '中文不能为空', trigger: 'blur'},
|
||||
],
|
||||
en: [
|
||||
{required: true, message: '英文不能为空', trigger: 'blur'},
|
||||
{validator: rule.letter, trigger: 'blur'},
|
||||
],
|
||||
});
|
||||
// 定义校验规则
|
||||
const dataRules = ref({
|
||||
name: [
|
||||
{ required: true, message: 'name不能为空', trigger: 'blur' },
|
||||
{ validator: rule.noChinese, trigger: 'blur' },
|
||||
{
|
||||
validator: (rule: any, value: any, callback: any) => {
|
||||
validateName(rule, value, callback, form.id !== '');
|
||||
},
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
zhCn: [
|
||||
{ required: true, message: '中文不能为空', trigger: 'blur' },
|
||||
{
|
||||
validator: (rule: any, value: any, callback: any) => {
|
||||
validateZhCn(rule, value, callback, form.id !== '');
|
||||
},
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
en: [
|
||||
{ required: true, message: '英文不能为空', trigger: 'blur' },
|
||||
{ validator: rule.letter, trigger: 'blur' },
|
||||
{
|
||||
validator: (rule: any, value: any, callback: any) => {
|
||||
validateEn(rule, value, callback, form.id !== '');
|
||||
},
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = (id: string) => {
|
||||
visible.value = true;
|
||||
form.id = '';
|
||||
// 打开弹窗
|
||||
const openDialog = (id: string) => {
|
||||
visible.value = true;
|
||||
form.id = '';
|
||||
|
||||
// 重置表单数据
|
||||
if (dataFormRef.value) {
|
||||
dataFormRef.value.resetFields();
|
||||
}
|
||||
// 重置表单数据
|
||||
if (dataFormRef.value) {
|
||||
dataFormRef.value.resetFields();
|
||||
}
|
||||
|
||||
// 获取sysI18n信息
|
||||
if (id) {
|
||||
form.id = id;
|
||||
getsysI18nData(id);
|
||||
}
|
||||
};
|
||||
// 获取sysI18n信息
|
||||
if (id) {
|
||||
form.id = id;
|
||||
getsysI18nData(id);
|
||||
}
|
||||
};
|
||||
|
||||
// 提交
|
||||
const onSubmit = () => {
|
||||
dataFormRef.value.validate((valid: boolean) => {
|
||||
if (!valid) {
|
||||
return false;
|
||||
}
|
||||
// 更新
|
||||
if (form.id) {
|
||||
putObj(form)
|
||||
.then(() => {
|
||||
useMessage().success(t('common.editSuccessText'));
|
||||
visible.value = false; // 关闭弹窗
|
||||
emit('refresh');
|
||||
})
|
||||
.catch((err: any) => {
|
||||
useMessage().error(err.msg);
|
||||
});
|
||||
} else {
|
||||
addObj(form)
|
||||
.then(() => {
|
||||
useMessage().success(t('common.addSuccessText'));
|
||||
visible.value = false; // 关闭弹窗
|
||||
emit('refresh');
|
||||
})
|
||||
.catch((err: any) => {
|
||||
useMessage().error(err.msg);
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
// 提交
|
||||
const onSubmit = () => {
|
||||
dataFormRef.value.validate((valid: boolean) => {
|
||||
if (!valid) {
|
||||
return false;
|
||||
}
|
||||
// 更新
|
||||
if (form.id) {
|
||||
putObj(form)
|
||||
.then(() => {
|
||||
useMessage().success(t('common.editSuccessText'));
|
||||
visible.value = false; // 关闭弹窗
|
||||
emit('refresh');
|
||||
})
|
||||
.catch((err: any) => {
|
||||
useMessage().error(err.msg);
|
||||
});
|
||||
} else {
|
||||
addObj(form)
|
||||
.then(() => {
|
||||
useMessage().success(t('common.addSuccessText'));
|
||||
visible.value = false; // 关闭弹窗
|
||||
emit('refresh');
|
||||
})
|
||||
.catch((err: any) => {
|
||||
useMessage().error(err.msg);
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 初始化表单数据
|
||||
const getsysI18nData = (id: string) => {
|
||||
// 获取数据
|
||||
getObj(id).then((res: any) => {
|
||||
Object.assign(form, res.data);
|
||||
});
|
||||
};
|
||||
// 初始化表单数据
|
||||
const getsysI18nData = (id: string) => {
|
||||
// 获取数据
|
||||
getObj(id).then((res: any) => {
|
||||
Object.assign(form, res.data);
|
||||
});
|
||||
};
|
||||
|
||||
// 暴露变量
|
||||
defineExpose({
|
||||
openDialog,
|
||||
});
|
||||
// 暴露变量
|
||||
defineExpose({
|
||||
openDialog,
|
||||
});
|
||||
</script>
|
||||
|
@ -1,174 +1,165 @@
|
||||
<template>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<el-row class="mb8" v-show="showSearch">
|
||||
<el-form :inline="true" :model="state.queryForm" @keyup.enter="getDataList" ref="queryRef">
|
||||
<el-form-item :label="$t('i18n.name')" prop="name">
|
||||
<el-input :placeholder="t('i18n.inputKeyTip')" style="max-width: 180px"
|
||||
v-model="state.queryForm.name"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('i18n.zhCn')" prop="zh-cn">
|
||||
<el-input :placeholder="t('i18n.inputZhCnTip')" style="max-width: 180px"
|
||||
v-model="state.queryForm.zhCn"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('i18n.en')" prop="en">
|
||||
<el-input :placeholder="t('i18n.inputEnTip')" style="max-width: 180px"
|
||||
v-model="state.queryForm.en"/>
|
||||
</el-form-item>
|
||||
<el-form-item class="ml2">
|
||||
<el-button @click="getDataList" formDialogRef icon="search" type="primary">
|
||||
{{ $t('common.queryBtn') }}
|
||||
</el-button>
|
||||
<el-button @click="resetQuery" formDialogRef icon="Refresh">{{ $t('common.resetBtn') }}
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button @click="formDialogRef.openDialog()" class="ml10" formDialogRef icon="folder-add"
|
||||
type="primary" v-auth="'admin_i18n_add'">
|
||||
{{ $t('common.addBtn') }}
|
||||
</el-button>
|
||||
<el-button @click="exportExcel" class="ml10" formDialogRef icon="Download" type="primary"
|
||||
v-auth="'admin_i18n_export'">
|
||||
{{ $t('common.exportBtn') }}
|
||||
</el-button>
|
||||
<el-button
|
||||
:disabled="multiple"
|
||||
@click="handleDelete(selectObjs)"
|
||||
class="ml10"
|
||||
formDialogRef
|
||||
icon="Delete"
|
||||
type="primary"
|
||||
v-auth="'admin_i18n_del'"
|
||||
>
|
||||
{{ $t('common.delBtn') }}
|
||||
</el-button>
|
||||
<el-button @click="handleRefreshCache()" class="ml10" icon="refresh-left" type="primary">
|
||||
{{ $t('common.refreshCacheBtn') }}
|
||||
</el-button>
|
||||
<right-toolbar
|
||||
@queryTable="getDataList"
|
||||
class="ml10"
|
||||
style="float: right; margin-right: 20px"
|
||||
v-model:showSearch="showSearch"
|
||||
></right-toolbar>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-table
|
||||
:data="state.dataList"
|
||||
@selection-change="handleSelectionChange"
|
||||
@sort-change="sortChangeHandle"
|
||||
border
|
||||
style="width: 100%"
|
||||
v-loading="state.loading"
|
||||
>
|
||||
<el-table-column align="center" type="selection" width="60"/>
|
||||
<el-table-column :label="t('file.index')" type="index" width="80"/>
|
||||
<el-table-column :label="t('i18n.name')" prop="name" show-overflow-tooltip/>
|
||||
<el-table-column :label="t('i18n.zhCn')" prop="zhCn" show-overflow-tooltip/>
|
||||
<el-table-column :label="t('i18n.en')" prop="en" show-overflow-tooltip/>
|
||||
<el-table-column :label="t('i18n.createBy')" prop="createBy" show-overflow-tooltip/>
|
||||
<el-table-column :label="t('i18n.createTime')" prop="createTime" show-overflow-tooltip/>
|
||||
<el-table-column :label="$t('common.action')" width="150">
|
||||
<template #default="scope">
|
||||
<el-button @click="formDialogRef.openDialog(scope.row.id)" text type="primary"
|
||||
v-auth="'admin_i18n_edit'"
|
||||
>{{ $t('common.editBtn') }}
|
||||
</el-button>
|
||||
<el-button @click="handleDelete([scope.row.id])" text type="primary" v-auth="'admin_i18n_del'">
|
||||
{{ $t('common.delBtn') }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination @current-change="currentChangeHandle" @size-change="sizeChangeHandle"
|
||||
v-bind="state.pagination"/>
|
||||
</div>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<el-row class="mb8" v-show="showSearch">
|
||||
<el-form :inline="true" :model="state.queryForm" @keyup.enter="getDataList" ref="queryRef">
|
||||
<el-form-item :label="$t('i18n.name')" prop="name">
|
||||
<el-input :placeholder="t('i18n.inputKeyTip')" style="max-width: 180px" v-model="state.queryForm.name" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('i18n.zhCn')" prop="zhCn">
|
||||
<el-input :placeholder="t('i18n.inputZhCnTip')" style="max-width: 180px" v-model="state.queryForm.zhCn" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('i18n.en')" prop="en">
|
||||
<el-input :placeholder="t('i18n.inputEnTip')" style="max-width: 180px" v-model="state.queryForm.en" />
|
||||
</el-form-item>
|
||||
<el-form-item class="ml2">
|
||||
<el-button @click="getDataList" formDialogRef icon="search" type="primary">
|
||||
{{ $t('common.queryBtn') }}
|
||||
</el-button>
|
||||
<el-button @click="resetQuery" icon="Refresh">{{ $t('common.resetBtn') }} </el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button @click="formDialogRef.openDialog()" class="ml10" formDialogRef icon="folder-add" type="primary" v-auth="'admin_i18n_add'">
|
||||
{{ $t('common.addBtn') }}
|
||||
</el-button>
|
||||
<el-button @click="exportExcel" class="ml10" formDialogRef icon="Download" type="primary" v-auth="'admin_i18n_export'">
|
||||
{{ $t('common.exportBtn') }}
|
||||
</el-button>
|
||||
<el-button
|
||||
:disabled="multiple"
|
||||
@click="handleDelete(selectObjs)"
|
||||
class="ml10"
|
||||
formDialogRef
|
||||
icon="Delete"
|
||||
type="primary"
|
||||
v-auth="'admin_i18n_del'"
|
||||
>
|
||||
{{ $t('common.delBtn') }}
|
||||
</el-button>
|
||||
<el-button @click="handleRefreshCache()" class="ml10" icon="refresh-left" type="primary">
|
||||
{{ $t('common.refreshCacheBtn') }}
|
||||
</el-button>
|
||||
<right-toolbar
|
||||
@queryTable="getDataList"
|
||||
class="ml10"
|
||||
style="float: right; margin-right: 20px"
|
||||
v-model:showSearch="showSearch"
|
||||
></right-toolbar>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-table
|
||||
:data="state.dataList"
|
||||
@selection-change="handleSelectionChange"
|
||||
@sort-change="sortChangeHandle"
|
||||
border
|
||||
style="width: 100%"
|
||||
v-loading="state.loading"
|
||||
>
|
||||
<el-table-column align="center" type="selection" width="60" />
|
||||
<el-table-column :label="t('file.index')" type="index" width="80" />
|
||||
<el-table-column :label="t('i18n.name')" prop="name" show-overflow-tooltip />
|
||||
<el-table-column :label="t('i18n.zhCn')" prop="zhCn" show-overflow-tooltip />
|
||||
<el-table-column :label="t('i18n.en')" prop="en" show-overflow-tooltip />
|
||||
<el-table-column :label="t('i18n.createBy')" prop="createBy" show-overflow-tooltip />
|
||||
<el-table-column :label="t('i18n.createTime')" prop="createTime" show-overflow-tooltip />
|
||||
<el-table-column :label="$t('common.action')" width="150">
|
||||
<template #default="scope">
|
||||
<el-button @click="formDialogRef.openDialog(scope.row.id)" text type="primary" v-auth="'admin_i18n_edit'"
|
||||
>{{ $t('common.editBtn') }}
|
||||
</el-button>
|
||||
<el-button @click="handleDelete([scope.row.id])" text type="primary" v-auth="'admin_i18n_del'">
|
||||
{{ $t('common.delBtn') }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination @current-change="currentChangeHandle" @size-change="sizeChangeHandle" v-bind="state.pagination" />
|
||||
</div>
|
||||
|
||||
<!-- 编辑、新增 -->
|
||||
<form-dialog @refresh="getDataList()" ref="formDialogRef"/>
|
||||
</div>
|
||||
<!-- 编辑、新增 -->
|
||||
<form-dialog @refresh="getDataList()" ref="formDialogRef" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="systemSysI18n" setup>
|
||||
import {BasicTableProps, useTable} from '/@/hooks/table';
|
||||
import {delObj, fetchList,refreshCache} from '/@/api/admin/i18n';
|
||||
import {useMessage, useMessageBox} from '/@/hooks/message';
|
||||
import {useI18n} from 'vue-i18n';
|
||||
import { BasicTableProps, useTable } from '/@/hooks/table';
|
||||
import { delObj, fetchList, refreshCache } from '/@/api/admin/i18n';
|
||||
import { useMessage, useMessageBox } from '/@/hooks/message';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
const { t } = useI18n();
|
||||
// 定义查询字典
|
||||
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
const {t} = useI18n();
|
||||
// 定义查询字典
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref();
|
||||
// 搜索变量
|
||||
const queryRef = ref();
|
||||
const showSearch = ref(true);
|
||||
// 多选变量
|
||||
const selectObjs = ref([]) as any;
|
||||
const multiple = ref(true);
|
||||
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref();
|
||||
// 搜索变量
|
||||
const queryRef = ref();
|
||||
const showSearch = ref(true);
|
||||
// 多选变量
|
||||
const selectObjs = ref([]) as any;
|
||||
const multiple = ref(true);
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {
|
||||
name: '',
|
||||
zhCn: '',
|
||||
en: '',
|
||||
},
|
||||
pageList: fetchList,
|
||||
descs: ['create_time'],
|
||||
});
|
||||
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {
|
||||
name: '',
|
||||
zhCn: '',
|
||||
en: '',
|
||||
},
|
||||
pageList: fetchList,
|
||||
descs: ['create_time'],
|
||||
});
|
||||
// table hook
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile } = useTable(state);
|
||||
|
||||
// table hook
|
||||
const {getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile} = useTable(state);
|
||||
// 清空搜索条件
|
||||
const resetQuery = () => {
|
||||
// 清空搜索条件
|
||||
queryRef.value.resetFields();
|
||||
// 清空排序规则
|
||||
state.queryForm!.descs = [];
|
||||
state.queryForm!.ascs = [];
|
||||
// 清空多选
|
||||
selectObjs.value = [];
|
||||
getDataList();
|
||||
};
|
||||
const handleRefreshCache = () => {
|
||||
refreshCache().then(() => {
|
||||
useMessage().success('同步成功');
|
||||
});
|
||||
};
|
||||
|
||||
// 清空搜索条件
|
||||
const resetQuery = () => {
|
||||
// 清空搜索条件
|
||||
queryRef.value.resetFields();
|
||||
// 清空排序规则
|
||||
state.queryForm!.descs = [];
|
||||
state.queryForm!.ascs = [];
|
||||
// 清空多选
|
||||
selectObjs.value = [];
|
||||
getDataList();
|
||||
};
|
||||
const handleRefreshCache = () => {
|
||||
refreshCache().then(() => {
|
||||
useMessage().success('同步成功');
|
||||
});
|
||||
};
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile('/admin/i18n/export', state.queryForm, 'i18n.xlsx');
|
||||
};
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile('/admin/i18n/export', state.queryForm, 'i18n.xlsx');
|
||||
};
|
||||
// 多选事件
|
||||
const handleSelectionChange = (objs: any) => {
|
||||
objs.forEach((val: any) => {
|
||||
selectObjs.value.push(val.id);
|
||||
});
|
||||
multiple.value = !objs.length;
|
||||
};
|
||||
|
||||
// 多选事件
|
||||
const handleSelectionChange = (objs: any) => {
|
||||
objs.forEach((val: any) => {
|
||||
selectObjs.value.push(val.id);
|
||||
});
|
||||
multiple.value = !objs.length;
|
||||
};
|
||||
|
||||
// 删除操作
|
||||
const handleDelete = (ids: string[]) => {
|
||||
useMessageBox()
|
||||
.confirm(t('common.delConfirmText'))
|
||||
.then(() => {
|
||||
delObj(ids)
|
||||
.then(() => {
|
||||
getDataList();
|
||||
useMessage().success(t('common.delSuccessText'));
|
||||
})
|
||||
.catch((err: any) => {
|
||||
useMessage().error(err.msg);
|
||||
});
|
||||
});
|
||||
};
|
||||
// 删除操作
|
||||
const handleDelete = (ids: string[]) => {
|
||||
useMessageBox()
|
||||
.confirm(t('common.delConfirmText'))
|
||||
.then(() => {
|
||||
delObj(ids)
|
||||
.then(() => {
|
||||
getDataList();
|
||||
useMessage().success(t('common.delSuccessText'));
|
||||
})
|
||||
.catch((err: any) => {
|
||||
useMessage().error(err.msg);
|
||||
});
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
@ -103,7 +103,7 @@ const dataRules = reactive({
|
||||
],
|
||||
publicKey: [
|
||||
{ required: true, message: '参数键不能为空', trigger: 'blur' },
|
||||
{ validator: rule.validatorLowercase, trigger: 'blur' },
|
||||
{ validator: rule.validatorCapital, trigger: 'blur' },
|
||||
{
|
||||
validator: (rule: any, value: any, callback: any) => {
|
||||
validateParamsCode(rule, value, callback, form.publicId !== '');
|
||||
|
Loading…
Reference in New Issue
Block a user