mirror of
https://gitee.com/log4j/pig-ui.git
synced 2025-01-03 23:42:23 +08:00
feat: 一堆功能优化
This commit is contained in:
parent
d058f62588
commit
ba619366c4
@ -34,10 +34,10 @@ export const rule = {
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 校验 请输入中文、英文、数字包括下划线
|
||||
* 校验 请输入大写英文、下划线
|
||||
* 名称校验
|
||||
*/
|
||||
validatorKey(rule: any, value: any, callback: any) {
|
||||
validatorCapital(rule: any, value: any, callback: any) {
|
||||
const acount = /^[A-Z_]+$/;
|
||||
if (value && !acount.test(value)) {
|
||||
callback(new Error('请输入大写英文、下划线'));
|
||||
@ -46,6 +46,19 @@ export const rule = {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 校验 请输入小写英文、下划线
|
||||
* 名称校验
|
||||
*/
|
||||
validatorLowercase(rule: any, value: any, callback: any) {
|
||||
const acount = /^[a-z_]+$/;
|
||||
if (value && !acount.test(value)) {
|
||||
callback(new Error('请输入小写英文、下划线'));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 校验首尾空白字符的正则表达式
|
||||
*
|
||||
|
@ -20,39 +20,27 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item :label="t('client.authorizedGrantTypes')" prop="authorizedGrantTypes">
|
||||
<el-checkbox-group v-model="form.authorizedGrantTypes">
|
||||
<el-checkbox :key="index" :label="item.value" v-for="(item, index) in grant_types">{{ item.label }} </el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item :label="t('client.webServerRedirectUri')" prop="webServerRedirectUri">
|
||||
<el-input :placeholder="t('client.inputWebServerRedirectUriTip')" v-model="form.webServerRedirectUri" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item :label="t('client.authorities')" prop="authorities">
|
||||
<el-input :placeholder="t('client.inputAuthoritiesTip')" v-model="form.authorities" />
|
||||
<el-select v-model="form.authorizedGrantTypes" multiple collapse-tags collapse-tags-tooltip>
|
||||
<el-option :key="index" :label="item.label" v-for="(item, index) in grant_types" :value="item.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item :label="t('client.accessTokenValidity')" prop="accessTokenValidity">
|
||||
<el-input :placeholder="t('client.inputAccessTokenValidityTip')" v-model="form.accessTokenValidity" />
|
||||
<el-input-number :placeholder="t('client.inputAccessTokenValidityTip')" v-model="form.accessTokenValidity" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item :label="t('client.refreshTokenValidity')" prop="refreshTokenValidity">
|
||||
<el-input :placeholder="t('client.inputRefreshTokenValidityTip')" v-model="form.refreshTokenValidity" />
|
||||
<el-input-number :placeholder="t('client.inputRefreshTokenValidityTip')" v-model="form.refreshTokenValidity" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-col :span="12" class="mb20" v-if="form.authorizedGrantTypes.includes('authorization_code')">
|
||||
<el-form-item :label="t('client.autoapprove')" prop="autoapprove">
|
||||
<el-radio-group v-model="form.autoapprove">
|
||||
<el-radio :key="index" :label="item.value" border v-for="(item, index) in common_status">{{ item.label }} </el-radio>
|
||||
@ -60,9 +48,15 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item :label="t('client.additionalInformation')" prop="additionalInformation">
|
||||
<el-input :placeholder="t('client.inputAdditionalInformationTip')" type="textarea" v-model="form.additionalInformation" />
|
||||
<el-col :span="12" class="mb20" v-if="form.authorizedGrantTypes.includes('authorization_code')">
|
||||
<el-form-item :label="t('client.authorities')" prop="authorities">
|
||||
<el-input :placeholder="t('client.inputAuthoritiesTip')" v-model="form.authorities" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20" v-if="form.authorizedGrantTypes.includes('authorization_code')">
|
||||
<el-form-item :label="t('client.webServerRedirectUri')" prop="webServerRedirectUri">
|
||||
<el-input :placeholder="t('client.inputWebServerRedirectUriTip')" v-model="form.webServerRedirectUri" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@ -118,13 +112,13 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="SysOauthClientDetailsDialog" setup>
|
||||
// 定义子组件向父组件传值/事件
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
import { useMessage } from '/@/hooks/message';
|
||||
import { addObj, getObj, putObj } from '/@/api/admin/client';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { rule } from '/@/utils/validate';
|
||||
|
||||
// 定义子组件向父组件传值/事件
|
||||
const emit = defineEmits(['refresh']);
|
||||
|
||||
const { t } = useI18n();
|
||||
@ -145,36 +139,49 @@ const form = reactive({
|
||||
id: '',
|
||||
clientId: '',
|
||||
clientSecret: '',
|
||||
scope: '',
|
||||
authorizedGrantTypes: [],
|
||||
scope: 'server',
|
||||
authorizedGrantTypes: [] as string[],
|
||||
webServerRedirectUri: '',
|
||||
authorities: '',
|
||||
accessTokenValidity: '',
|
||||
refreshTokenValidity: '',
|
||||
additionalInformation: '',
|
||||
autoapprove: '',
|
||||
accessTokenValidity: 43200,
|
||||
refreshTokenValidity: 2592001,
|
||||
autoapprove: 'true',
|
||||
delFlag: '',
|
||||
createBy: '',
|
||||
updateBy: '',
|
||||
createTime: '',
|
||||
updateTime: '',
|
||||
tenantId: '',
|
||||
onlineQuantity: '1',
|
||||
captchaFlag: '1',
|
||||
encFlag: '1',
|
||||
});
|
||||
|
||||
const collapseActive = ref('1');
|
||||
|
||||
// 定义校验规则
|
||||
const dataRules = ref({
|
||||
clientId: [{ required: true, message: '编号不能为空', trigger: 'blur' }],
|
||||
clientSecret: [{ required: true, message: '密钥不能为空', trigger: 'blur' }],
|
||||
clientId: [
|
||||
{ required: true, message: '编号不能为空', trigger: 'blur' },
|
||||
{ validator: rule.validatorLowercase, trigger: 'blur' },
|
||||
],
|
||||
clientSecret: [
|
||||
{ required: true, message: '密钥不能为空', trigger: 'blur' },
|
||||
{ validator: rule.validatorLowercase, trigger: 'blur' },
|
||||
],
|
||||
scope: [{ required: true, message: '域不能为空', trigger: 'blur' }],
|
||||
authorizedGrantTypes: [{ required: true, message: '授权模式不能为空', trigger: 'blur' }],
|
||||
accessTokenValidity: [{ required: true, message: '令牌时效不能为空', trigger: 'blur' }],
|
||||
refreshTokenValidity: [{ required: true, message: '刷新时效不能为空', trigger: 'blur' }],
|
||||
accessTokenValidity: [
|
||||
{ required: true, message: '令牌时效不能为空', trigger: 'blur' },
|
||||
{ type: 'number', min: 3600, message: '令牌时效不能小于一小时', trigger: 'blur' },
|
||||
],
|
||||
refreshTokenValidity: [
|
||||
{ required: true, message: '刷新时效不能为空', trigger: 'blur' },
|
||||
{ type: 'number', min: 7200, message: '刷新时效不能小于两小时', trigger: 'blur' },
|
||||
],
|
||||
captchaFlag: [{ required: true, message: '是否开启验证码校验', trigger: 'blur' }],
|
||||
encFlag: [{ required: true, message: '是否开启密码加密传输', trigger: 'blur' }],
|
||||
onlineQuantity: [{ required: true, message: '是否允许同时在线', trigger: 'blur' }],
|
||||
authorities: [{ required: true, message: '权限不能为空', trigger: 'blur' }],
|
||||
autoapprove: [{ required: true, message: '自动放行不能为空', trigger: 'blur' }],
|
||||
webServerRedirectUri: [
|
||||
{ required: true, message: '回调地址不能为空', trigger: 'blur' },
|
||||
|
@ -10,8 +10,8 @@ export default {
|
||||
authorizedGrantTypes: '授权模式',
|
||||
webServerRedirectUri: '回调地址',
|
||||
authorities: '权限',
|
||||
accessTokenValidity: '令牌时效',
|
||||
refreshTokenValidity: '刷新时效',
|
||||
accessTokenValidity: '令牌时效(秒)',
|
||||
refreshTokenValidity: '刷新时效(秒)',
|
||||
additionalInformation: '扩展信息',
|
||||
autoapprove: '自动放行',
|
||||
createBy: '创建人',
|
||||
|
@ -93,6 +93,7 @@ const multiple = ref(true);
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {},
|
||||
pageList: fetchList,
|
||||
descs: ['id'],
|
||||
});
|
||||
|
||||
// table hook
|
||||
|
@ -45,7 +45,7 @@
|
||||
<el-input-number v-model="state.ruleForm.sortOrder" :min="0" controls-position="right" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-col :span="12" class="mb20" v-if="state.ruleForm.menuType === '0'">
|
||||
<el-form-item :label="$t('sysmenu.icon')" prop="icon">
|
||||
<IconSelector :placeholder="$t('sysmenu.inputIconTip')" v-model="state.ruleForm.icon" />
|
||||
</el-form-item>
|
||||
|
@ -95,7 +95,7 @@ const dataRules = reactive({
|
||||
publicName: [{ required: true, message: '名称不能为空', trigger: 'blur' }],
|
||||
publicKey: [
|
||||
{ required: true, message: '参数键不能为空', trigger: 'blur' },
|
||||
{ validator: rule.validatorKey, trigger: 'blur' },
|
||||
{ validator: rule.validatorLowercase, trigger: 'blur' },
|
||||
],
|
||||
publicValue: [{ required: true, message: '参数值不能为空', trigger: 'blur' }],
|
||||
status: [{ required: true, message: '状态不能为空', trigger: 'blur' }],
|
||||
|
@ -115,7 +115,7 @@ const dataRules = ref({
|
||||
roleCode: [
|
||||
{ required: true, message: '角色标识不能为空', trigger: 'blur' },
|
||||
{ min: 3, max: 20, message: '长度在 3 到 20 个字符', trigger: 'blur' },
|
||||
{ validator: rule.validatorKey, trigger: 'blur' },
|
||||
{ validator: rule.validatorCapital, trigger: 'blur' },
|
||||
{ validator: validateRoleCode, trigger: 'blur' },
|
||||
],
|
||||
roleDesc: [{ max: 128, message: '长度在 128 个字符内', trigger: 'blur' }],
|
||||
|
@ -121,8 +121,8 @@ const dataForm = reactive({
|
||||
nickname: '',
|
||||
name: '',
|
||||
email: '',
|
||||
post: [] as String[],
|
||||
role: [] as String[],
|
||||
post: [] as string[],
|
||||
role: [] as string[],
|
||||
});
|
||||
|
||||
const dataRules = ref({
|
||||
|
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<el-dialog :close-on-click-modal="false" :title="state.ruleForm.menuId ? $t('common.editBtn') : $t('common.addBtn')" draggable v-model="visible">
|
||||
<el-form :model="state.ruleForm" :rules="dataRules" label-width="90px" ref="menuDialogFormRef" v-loading="loading">
|
||||
<el-form :model="state.ruleForm" :rules="dataRules" label-width="90px" ref="dataFormRef" v-loading="loading">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item :label="$t('sysmenu.menuType')" prop="menType">
|
||||
@ -35,9 +35,9 @@
|
||||
<el-input placeholder="请输入路由地址" v-model="state.ruleForm.path" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-col :span="12" class="mb20" v-if="state.ruleForm.menuType == '1'">
|
||||
<el-form-item :label="$t('sysmenu.permission')" prop="permission">
|
||||
<el-input maxlength="50" placeholder="请权限标识" v-model="state.ruleForm.permission" />
|
||||
<el-input maxlength="50" placeholder="请输入权限标识" v-model="state.ruleForm.permission" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
@ -76,7 +76,8 @@ const emit = defineEmits(['refresh']);
|
||||
const visible = ref(false);
|
||||
const loading = ref(false);
|
||||
// 定义变量内容
|
||||
const menuDialogFormRef = ref();
|
||||
const dataFormRef = ref();
|
||||
|
||||
// 定义需要的数据
|
||||
const state = reactive({
|
||||
ruleForm: {
|
||||
@ -88,7 +89,7 @@ const state = reactive({
|
||||
path: '',
|
||||
sortOrder: 0,
|
||||
menuType: '0',
|
||||
visible: '',
|
||||
visible: '1',
|
||||
id: '',
|
||||
},
|
||||
parentData: [] as any[], // 上级菜单数据
|
||||
@ -142,7 +143,7 @@ const dataRules = reactive({
|
||||
],
|
||||
permission: [
|
||||
{ required: true, message: '权限标识不能为空', trigger: 'blur' },
|
||||
{ validator: rule.validatorKey, trigger: 'blur' },
|
||||
{ validator: rule.validatorLowercase, trigger: 'blur' },
|
||||
{ min: 3, max: 20, message: '长度在 3 到 20 个字符', trigger: 'blur' },
|
||||
{
|
||||
validator: (rule: any, value: any, callback: any) => {
|
||||
@ -168,7 +169,7 @@ const openDialog = (type: string, row?: any) => {
|
||||
} else {
|
||||
// 清空表单,此项需加表单验证才能使用
|
||||
nextTick(() => {
|
||||
menuDialogFormRef?.value?.resetFields();
|
||||
dataFormRef?.value?.resetFields();
|
||||
state.ruleForm.parentId = row?.id || '-1';
|
||||
});
|
||||
}
|
||||
@ -178,6 +179,10 @@ const openDialog = (type: string, row?: any) => {
|
||||
|
||||
// 保存数据
|
||||
const onSubmit = () => {
|
||||
dataFormRef.value.validate((valid: boolean) => {
|
||||
if (!valid) {
|
||||
return false;
|
||||
}
|
||||
// 保存 调用刷新
|
||||
if (state.ruleForm.id) {
|
||||
loading.value = true;
|
||||
@ -206,6 +211,7 @@ const onSubmit = () => {
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 暴露变量 只有暴漏出来的变量 父组件才能使用
|
||||
|
@ -85,7 +85,7 @@ const dataRules = ref({
|
||||
roleCode: [
|
||||
{ required: true, message: '角色标识不能为空', trigger: 'blur' },
|
||||
{ min: 3, max: 20, message: '长度在 3 到 20 个字符', trigger: 'blur' },
|
||||
{ validator: rule.validatorKey, trigger: 'blur' },
|
||||
{ validator: rule.validatorCapital, trigger: 'blur' },
|
||||
{
|
||||
validator: (rule: any, value: any, callback: any) => {
|
||||
validateAppRoleCode(rule, value, callback, form.roleId !== '');
|
||||
|
@ -95,8 +95,8 @@ const dataForm = reactive({
|
||||
nickname: '',
|
||||
name: '',
|
||||
email: '',
|
||||
post: [] as String[],
|
||||
role: [] as String[],
|
||||
post: [] as string[],
|
||||
role: [] as string[],
|
||||
});
|
||||
|
||||
const dataRules = ref({
|
||||
|
@ -96,17 +96,17 @@
|
||||
|
||||
<el-table-column :label="$t('common.action')" width="300" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button size="small" text type="primary" @click="handleJobLog(scope.row)">日志</el-button>
|
||||
<el-button text type="primary" @click="handleJobLog(scope.row)">日志</el-button>
|
||||
|
||||
<el-button size="small" text type="primary" @click="handleStartJob(scope.row)">启动</el-button>
|
||||
<el-button v-if="scope.row.jobStatus !== '2'" text type="primary" @click="handleStartJob(scope.row)">启动</el-button>
|
||||
|
||||
<el-button size="small" text type="primary" @click="handleShutDownJob(scope.row)">暂停</el-button>
|
||||
<el-button v-if="scope.row.jobStatus === '2'" text type="primary" @click="handleShutDownJob(scope.row)">暂停</el-button>
|
||||
|
||||
<el-button size="small" text type="primary" @click="handleEditJob(scope.row)">{{ $t('common.editBtn') }}</el-button>
|
||||
<el-button text type="primary" @click="handleEditJob(scope.row)">{{ $t('common.editBtn') }}</el-button>
|
||||
|
||||
<el-button size="small" text type="primary" @click="handleRunJob(scope.row)">执行</el-button>
|
||||
<el-button text type="primary" @click="handleRunJob(scope.row)">执行</el-button>
|
||||
|
||||
<el-button size="small" text type="primary" @click="handleDelete(scope.row)">{{ $t('common.delBtn') }}</el-button>
|
||||
<el-button text type="primary" @click="handleDelete(scope.row)">{{ $t('common.delBtn') }}</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@ -170,7 +170,7 @@ const handleSelectionChange = (val: any) => {
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile('/pigx/job/export', state.queryForm, 'job.xlsx');
|
||||
downBlobFile('/admin/job/export', state.queryForm, 'job.xlsx');
|
||||
};
|
||||
|
||||
const handleJobLog = (row: any) => {
|
||||
|
@ -51,7 +51,7 @@ const form = reactive({
|
||||
id: '',
|
||||
groupName: '',
|
||||
groupDesc: '',
|
||||
templateId: [] as String[],
|
||||
templateId: [] as string[],
|
||||
putList: [],
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user