mirror of
https://gitee.com/log4j/pig-ui.git
synced 2024-12-23 05:40:20 +08:00
♻️ Refactoring code. 增加密钥管理
This commit is contained in:
parent
7a8deb2131
commit
e1ed32a2e2
39
src/api/admin/social.ts
Normal file
39
src/api/admin/social.ts
Normal file
@ -0,0 +1,39 @@
|
||||
import request from "/@/utils/request"
|
||||
|
||||
export function fetchList(query?: Object) {
|
||||
return request({
|
||||
url: '/admin/social/page',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function addObj(obj?: Object) {
|
||||
return request({
|
||||
url: '/admin/social',
|
||||
method: 'post',
|
||||
data: obj
|
||||
})
|
||||
}
|
||||
|
||||
export function getObj(id?: string) {
|
||||
return request({
|
||||
url: '/admin/social/getById/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function delObj(id?: string) {
|
||||
return request({
|
||||
url: '/admin/social/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
export function putObj(obj?: Object) {
|
||||
return request({
|
||||
url: '/admin/social',
|
||||
method: 'put',
|
||||
data: obj
|
||||
})
|
||||
}
|
143
src/views/admin/social/form.vue
Normal file
143
src/views/admin/social/form.vue
Normal file
@ -0,0 +1,143 @@
|
||||
<template>
|
||||
<el-dialog v-model="visible" :close-on-click-modal="false"
|
||||
:title="form.id ? $t('common.editBtn') : $t('common.addBtn')" draggable>
|
||||
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="90px">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item :label="t('social.type')" prop="type">
|
||||
<el-select v-model="form.type" :placeholder="t('social.inputTypeTip')">
|
||||
<el-option v-for="(item, index) in social_type" :key="index" :label="item.label" :value="item.value">
|
||||
{{ item.label }}
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item :label="t('social.remark')" prop="remark">
|
||||
<el-input v-model="form.remark" :placeholder="t('social.inputRemarkTip')"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item :label="t('social.appId')" prop="appId">
|
||||
<el-input v-model="form.appId" :placeholder="t('social.inputAppIdTip')"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item :label="t('social.appSecret')" prop="appSecret">
|
||||
<el-input v-model="form.appSecret" :placeholder="t('social.inputAppSecretTip')"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item :label="t('social.redirectUrl')" prop="redirectUrl">
|
||||
<el-input v-model="form.redirectUrl" :placeholder="t('social.inputRedirectUrlTip')" type="textarea"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item :label="t('social.ext')" prop="ext">
|
||||
<el-input v-model="form.ext" :placeholder="t('social.inputExtTip')" type="textarea"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<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>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="AppSocialDetailsDialog" setup>
|
||||
// 定义子组件向父组件传值/事件
|
||||
import {useDict} from '/@/hooks/dict';
|
||||
import {useMessage} from "/@/hooks/message";
|
||||
import {addObj, getObj, putObj} from '/@/api/admin/social'
|
||||
import {useI18n} from "vue-i18n"
|
||||
|
||||
const emit = defineEmits(['refresh']);
|
||||
|
||||
const {t} = useI18n();
|
||||
|
||||
// 定义变量内容
|
||||
const dataFormRef = ref();
|
||||
const visible = ref(false)
|
||||
// 定义字典
|
||||
const {social_type} = useDict('social_type')
|
||||
|
||||
// 提交表单数据
|
||||
const form = reactive({
|
||||
id: '',
|
||||
type: '',
|
||||
remark: '',
|
||||
appId: '',
|
||||
appSecret: '',
|
||||
redirectUrl: '',
|
||||
ext: '',
|
||||
});
|
||||
|
||||
// 定义校验规则
|
||||
const dataRules = ref({
|
||||
type: [{required: true, message: '类型不能为空', trigger: 'blur'}],
|
||||
appId: [{required: true, message: 'appId不能为空', trigger: 'blur'}],
|
||||
appSecret: [{required: true, message: 'appSecret不能为空', trigger: 'blur'}],
|
||||
})
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = (id: string) => {
|
||||
visible.value = true
|
||||
form.id = ''
|
||||
|
||||
// 重置表单数据
|
||||
if (dataFormRef.value) {
|
||||
dataFormRef.value.resetFields()
|
||||
}
|
||||
|
||||
// 获取appSocialDetails信息
|
||||
if (id) {
|
||||
form.id = id
|
||||
getappSocialDetailsData(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 getappSocialDetailsData = (id: string) => {
|
||||
// 获取数据
|
||||
getObj(id).then((res: any) => {
|
||||
Object.assign(form, res.data)
|
||||
})
|
||||
};
|
||||
|
||||
// 暴露变量
|
||||
defineExpose({
|
||||
openDialog
|
||||
});
|
||||
</script>
|
32
src/views/admin/social/i18n/en.ts
Normal file
32
src/views/admin/social/i18n/en.ts
Normal file
@ -0,0 +1,32 @@
|
||||
export default {
|
||||
social: {
|
||||
index: 'index',
|
||||
importappSocialDetailsTip: 'import AppSocialDetails',
|
||||
id: 'id',
|
||||
type: 'type',
|
||||
remark: 'remark',
|
||||
appId: 'appId',
|
||||
appSecret: 'appSecret',
|
||||
redirectUrl: 'redirectUrl',
|
||||
ext: 'ext',
|
||||
createBy: 'createBy',
|
||||
updateBy: 'updateBy',
|
||||
createTime: 'createTime',
|
||||
updateTime: 'updateTime',
|
||||
delFlag: 'delFlag',
|
||||
tenantId: 'tenantId',
|
||||
inputIdTip: 'input id',
|
||||
inputTypeTip: 'input type',
|
||||
inputRemarkTip: 'input remark',
|
||||
inputAppIdTip: 'input appId',
|
||||
inputAppSecretTip: 'input appSecret',
|
||||
inputRedirectUrlTip: 'input redirectUrl',
|
||||
inputExtTip: 'input ext',
|
||||
inputCreateByTip: 'input createBy',
|
||||
inputUpdateByTip: 'input updateBy',
|
||||
inputCreateTimeTip: 'input createTime',
|
||||
inputUpdateTimeTip: 'input updateTime',
|
||||
inputDelFlagTip: 'input delFlag',
|
||||
inputTenantIdTip: 'input tenantId',
|
||||
}
|
||||
}
|
32
src/views/admin/social/i18n/zh-cn.ts
Normal file
32
src/views/admin/social/i18n/zh-cn.ts
Normal file
@ -0,0 +1,32 @@
|
||||
export default {
|
||||
social: {
|
||||
index: '序号',
|
||||
importappSocialDetailsTip: '导入系统社交登录账号表',
|
||||
id: '主鍵',
|
||||
type: '类型',
|
||||
remark: '描述',
|
||||
appId: 'appId',
|
||||
appSecret: 'appSecret',
|
||||
redirectUrl: '回调地址',
|
||||
ext: '拓展字段',
|
||||
createBy: '创建人',
|
||||
updateBy: '修改人',
|
||||
createTime: '创建时间',
|
||||
updateTime: '更新时间',
|
||||
delFlag: '${field.fieldComment}',
|
||||
tenantId: '所属租户',
|
||||
inputIdTip: '请输入主鍵',
|
||||
inputTypeTip: '请输入类型',
|
||||
inputRemarkTip: '请输入描述',
|
||||
inputAppIdTip: '请输入appId',
|
||||
inputAppSecretTip: '请输入appSecret',
|
||||
inputRedirectUrlTip: '请输入回调地址',
|
||||
inputExtTip: '请输入拓展字段',
|
||||
inputCreateByTip: '请输入创建人',
|
||||
inputUpdateByTip: '请输入修改人',
|
||||
inputCreateTimeTip: '请输入创建时间',
|
||||
inputUpdateTimeTip: '请输入更新时间',
|
||||
inputDelFlagTip: '请输入${field.fieldComment}',
|
||||
inputTenantIdTip: '请输入所属租户',
|
||||
}
|
||||
}
|
143
src/views/admin/social/index.vue
Normal file
143
src/views/admin/social/index.vue
Normal file
@ -0,0 +1,143 @@
|
||||
<template>
|
||||
<div class="layout-padding">
|
||||
<el-card class="layout-padding-auto">
|
||||
<el-row v-show="showSearch" class="mb8">
|
||||
<el-form ref="queryRef" :inline="true" :model="state.queryForm">
|
||||
<el-form-item :label="t('social.type')" class="ml2" prop="type">
|
||||
<el-select v-model="state.queryForm.type" :placeholder="t('social.inputTypeTip')">
|
||||
<el-option v-for="(item, index) in social_type" :key="index" :label="item.label"
|
||||
:value="item.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item class="ml2">
|
||||
<el-button formDialogRef icon="search" type="primary" @click="getDataList">
|
||||
{{ $t('common.queryBtn') }}
|
||||
</el-button>
|
||||
<el-button formDialogRef icon="Refresh" @click="resetQuery">{{ $t('common.resetBtn') }}</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button v-auth="'sys_social_details_add'" class="ml10" formDialogRef icon="folder-add" type="primary"
|
||||
@click="formDialogRef.openDialog()">
|
||||
{{ $t('common.addBtn') }}
|
||||
</el-button>
|
||||
<el-button class="ml10" formDialogRef icon="Download" type="primary"
|
||||
@click="exportExcel">
|
||||
{{ $t('common.exportBtn') }}
|
||||
</el-button>
|
||||
<el-button v-auth="'sys_social_details_del'" :disabled="multiple" class="ml10" formDialogRef icon="Delete"
|
||||
type="primary" @click="handleDelete(undefined)">
|
||||
{{ $t('common.delBtn') }}
|
||||
</el-button>
|
||||
<right-toolbar v-model:showSearch="showSearch" class="ml10" style="float: right;margin-right: 20px"
|
||||
@queryTable="getDataList"></right-toolbar>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-table v-loading="state.loading" :data="state.dataList" style="width: 100%"
|
||||
@selection-change="handleSelectionChange">
|
||||
<el-table-column align="center" type="selection" width="60"/>
|
||||
<el-table-column :label="t('social.index')" type="index" width="80"/>
|
||||
<el-table-column :label="t('social.type')" prop="type" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<dict-tag :options="social_type" :value="scope.row.type"></dict-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('social.remark')" prop="remark" show-overflow-tooltip/>
|
||||
<el-table-column :label="t('social.appId')" prop="appId" show-overflow-tooltip/>
|
||||
<el-table-column :label="t('social.appSecret')" prop="appSecret" show-overflow-tooltip/>
|
||||
<el-table-column :label="t('social.createTime')" prop="createTime" show-overflow-tooltip/>
|
||||
<el-table-column :label="$t('common.action')" width="150">
|
||||
<template #default="scope">
|
||||
<el-button v-auth="'sys_social_details_edit'" text type="primary"
|
||||
@click="formDialogRef.openDialog(scope.row.id)">{{ $t('common.editBtn') }}
|
||||
</el-button>
|
||||
<el-button v-auth="'sys_social_details_del'" text type="primary" @click="handleDelete(scope.row)">{{
|
||||
$t('common.delBtn')
|
||||
}}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination v-bind="state.pagination" @size-change="sizeChangeHandle" @current-change="currentChangeHandle"/>
|
||||
</el-card>
|
||||
|
||||
<!-- 编辑、新增 -->
|
||||
<form-dialog ref="formDialogRef" @refresh="getDataList()"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="systemAppSocialDetails" setup>
|
||||
import {BasicTableProps, useTable} from "/@/hooks/table";
|
||||
import {delObj, fetchList} from "/@/api/admin/social";
|
||||
import {useMessage, useMessageBox} from "/@/hooks/message";
|
||||
import {useDict} from '/@/hooks/dict';
|
||||
import {useI18n} from "vue-i18n";
|
||||
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
const {t} = useI18n()
|
||||
// 定义查询字典
|
||||
|
||||
const {social_type} = useDict('social_type')
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref()
|
||||
// 搜索变量
|
||||
const queryRef = ref()
|
||||
const showSearch = ref(true)
|
||||
// 多选变量
|
||||
const selectObjs = ref([])
|
||||
const multiple = ref(true)
|
||||
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {},
|
||||
pageList: fetchList
|
||||
})
|
||||
|
||||
// table hook
|
||||
const {
|
||||
getDataList,
|
||||
currentChangeHandle,
|
||||
sizeChangeHandle,
|
||||
downBlobFile
|
||||
} = useTable(state)
|
||||
|
||||
|
||||
// 清空搜索条件
|
||||
const resetQuery = () => {
|
||||
queryRef.value.resetFields()
|
||||
getDataList()
|
||||
}
|
||||
|
||||
// 多选事件
|
||||
const handleSelectionChange = (val: any) => {
|
||||
selectObjs.value = val
|
||||
multiple.value = !val.length
|
||||
}
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile('/admin/social/export', state.queryForm, 'social.xlsx')
|
||||
}
|
||||
|
||||
// 删除操作
|
||||
const handleDelete = (row: any) => {
|
||||
if (!row) {
|
||||
selectObjs.value.forEach((val: any) => {
|
||||
handleDelete(val)
|
||||
});
|
||||
return
|
||||
}
|
||||
|
||||
useMessageBox().confirm(t('common.delConfirmText') + row.id)
|
||||
.then(() => {
|
||||
delObj(row.id).then(() => {
|
||||
getDataList();
|
||||
useMessage().success(t('common.delSuccessText'));
|
||||
}).catch((err: any) => {
|
||||
useMessage().error(err.msg)
|
||||
})
|
||||
})
|
||||
};
|
||||
</script>
|
@ -1,6 +1,36 @@
|
||||
<template>
|
||||
<div class="layout-padding">
|
||||
<el-card class="layout-padding-auto">
|
||||
<el-row v-show="showSearch" class="mb8">
|
||||
<el-form :model="state.queryForm" ref="queryRef" :inline="true">
|
||||
<el-form-item :label="$t('job.jobName')" prop="jobName">
|
||||
<el-input v-model="state.queryForm.jobName" :placeholder="$t('job.inputjobNameTip')" clearable
|
||||
style="width: 240px" @keyup.enter="getDataList" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('job.jobGroup')" prop="jobGroup">
|
||||
<el-input v-model="state.queryForm.jobGroup" :placeholder="$t('job.inputjobGroupTip')" clearable
|
||||
style="width: 240px" @keyup.enter="getDataList" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item :label="t('job.jobStatus')" prop="jobStatus">
|
||||
<el-select v-model="state.queryForm.jobStatus" :placeholder="t('job.inputjobStatusTip')">
|
||||
<el-option v-for="(item, index) in job_status" :key="index" :label="item.label"
|
||||
:value="item.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('job.jobExecuteStatus')" prop="jobExecuteStatus">
|
||||
<el-select v-model="state.queryForm.jobExecuteStatus" :placeholder="t('job.inputjobExecuteStatusTip')">
|
||||
<el-option v-for="(item, index) in job_execute_status" :key="index" :label="item.label"
|
||||
:value="item.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="getDataList">{{ $t('common.queryBtn') }}</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">{{ $t('common.resetBtn') }}</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button class="ml10" formDialogRef icon="folder-add" type="primary" @click="formDialogRef.openDialog()">
|
||||
@ -105,7 +135,12 @@ const selectObjs = ref([])
|
||||
const multiple = ref(true)
|
||||
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {},
|
||||
queryForm: {
|
||||
jobName: '',
|
||||
jobGroup: '',
|
||||
jobStatus: '',
|
||||
jobExecuteStatus: ''
|
||||
},
|
||||
pageList: fetchList
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user