| | |
| | | '':'', |
| | | 'db.sys_host.name':'Name', |
| | | 'db.sys_host.status':'Status', |
| | | 'db.sys_host.create_time':'createTime', |
| | | 'db.sys_host.update_time':'updateTime', |
| | | 'db.sys_host.create_time':'CreateTime', |
| | | 'db.sys_host.update_time':'UpdateTime', |
| | | 'db.sys_host.memo':'Memo', |
| | | '':'', |
| | | '':'', |
| | | '':'', |
| | | '':'', |
| | | '':'', |
| | | '':'', |
| | | 'db.sys_role.name':'Name', |
| | | 'db.sys_role.code':'Code', |
| | | 'db.sys_role.status':'Status', |
| | | 'db.sys_role.create_time':'CreateTime', |
| | | 'db.sys_role.update_time':'UpdateTime', |
| | | 'db.sys_role.memo':'Memo', |
| | | }; |
New file |
| | |
| | | <script setup> |
| | | import { ref, nextTick } from 'vue'; |
| | | import { get, post, postBlob, postForm } from '@/utils/request.js' |
| | | import { formatMessage } from '@/utils/localeUtils.js'; |
| | | import { message } from 'ant-design-vue'; |
| | | |
| | | const submitButton = ref(null); |
| | | const isSave = ref(true); |
| | | const open = ref(false); |
| | | const initFormData = {} |
| | | let formData = ref(initFormData); |
| | | const treeData = ref(null); |
| | | |
| | | const emit = defineEmits(['tableReload']) |
| | | |
| | | const handleOk = (e) => { |
| | | nextTick(() => { |
| | | setTimeout(() => { |
| | | submitButton.value.$el.click(); |
| | | }, 100); |
| | | }); |
| | | }; |
| | | |
| | | const onFinish = values => { |
| | | // console.log('Success:', values); |
| | | open.value = false; |
| | | post(isSave.value ? '/api/operationRecord/save' : '/api/operationRecord/update', formData.value).then((resp) => { |
| | | let result = resp.data; |
| | | if (result.code === 200) { |
| | | message.success(formatMessage('page.update.success', '更新成功')); |
| | | } else { |
| | | message.error(result.msg); |
| | | } |
| | | emit('tableReload', 'reload') |
| | | }) |
| | | }; |
| | | const onFinishFailed = errorInfo => { |
| | | console.log('Failed:', errorInfo); |
| | | }; |
| | | |
| | | const UserQueryList = ref(null); |
| | | UserQuery(); |
| | | function UserQuery() { |
| | | postForm('/api/user/query', {}).then(resp => { |
| | | let result = resp.data; |
| | | UserQueryList.value = result.data; |
| | | }) |
| | | } |
| | | |
| | | |
| | | defineExpose({ |
| | | open, |
| | | formData, |
| | | initFormData, |
| | | treeData, |
| | | isSave, |
| | | }) |
| | | |
| | | </script> |
| | | |
| | | <script> |
| | | export default { |
| | | name: '操作日志-edit' |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | | <div> |
| | | <a-modal v-model:open="open" |
| | | :title="isSave ? formatMessage('page.add', '添加') : formatMessage('page.edit', '编辑')" @ok="handleOk" |
| | | style="width: 600px;"> |
| | | <a-form :model="formData" name="formTable" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }" |
| | | style="display: flex;justify-content: space-between;flex-wrap: wrap;" autocomplete="off" |
| | | @finish="onFinish" @finishFailed="onFinishFailed"> |
| | | <a-form-item |
| | | label="名称空间" |
| | | name="namespace" |
| | | style="width: 250px;" |
| | | > |
| | | <a-input |
| | | v-model:value="formData.namespace" |
| | | /> |
| | | </a-form-item> |
| | | <a-form-item |
| | | label="接口地址" |
| | | name="url" |
| | | style="width: 250px;" |
| | | > |
| | | <a-input |
| | | v-model:value="formData.url" |
| | | /> |
| | | </a-form-item> |
| | | <a-form-item |
| | | label="平台密钥" |
| | | name="appkey" |
| | | style="width: 250px;" |
| | | > |
| | | <a-input |
| | | v-model:value="formData.appkey" |
| | | /> |
| | | </a-form-item> |
| | | <a-form-item |
| | | label="时间戳" |
| | | name="timestamp" |
| | | style="width: 250px;" |
| | | > |
| | | <a-input |
| | | v-model:value="formData.timestamp" |
| | | /> |
| | | </a-form-item> |
| | | <a-form-item |
| | | label="客户端IP" |
| | | name="clientIp" |
| | | style="width: 250px;" |
| | | > |
| | | <a-input |
| | | v-model:value="formData.clientIp" |
| | | /> |
| | | </a-form-item> |
| | | <a-form-item |
| | | label="请求内容" |
| | | name="request" |
| | | style="width: 250px;" |
| | | > |
| | | <a-input |
| | | v-model:value="formData.request" |
| | | /> |
| | | </a-form-item> |
| | | <a-form-item |
| | | label="响应内容" |
| | | name="response" |
| | | style="width: 250px;" |
| | | > |
| | | <a-input |
| | | v-model:value="formData.response" |
| | | /> |
| | | </a-form-item> |
| | | <a-form-item |
| | | label="消耗时间" |
| | | name="spendTime" |
| | | style="width: 250px;" |
| | | > |
| | | <a-input |
| | | v-model:value="formData.spendTime" |
| | | /> |
| | | </a-form-item> |
| | | <a-form-item |
| | | label="异常内容" |
| | | name="err" |
| | | style="width: 250px;" |
| | | > |
| | | <a-input |
| | | v-model:value="formData.err" |
| | | /> |
| | | </a-form-item> |
| | | <a-form-item |
| | | label="结果" |
| | | name="result" |
| | | style="width: 250px;" |
| | | > |
| | | <a-select |
| | | v-model:value="formData.result" |
| | | :options="[ |
| | | { label: '成功', value: 1 }, |
| | | { label: '失败', value: 0 }, |
| | | ]" |
| | | > |
| | | </a-select> |
| | | </a-form-item> |
| | | <a-form-item |
| | | label="用户" |
| | | name="userId" |
| | | style="width: 250px;" |
| | | > |
| | | <a-select |
| | | v-model:value="formData.userId" |
| | | placeholder="Select users" |
| | | style="width: 100%" |
| | | show-search |
| | | :options="UserQueryList" |
| | | optionFilterProp="label" |
| | | optionLabelProp="label" |
| | | > |
| | | </a-select> |
| | | </a-form-item> |
| | | <a-form-item |
| | | label="添加时间" |
| | | name="createTime" |
| | | style="width: 250px;" |
| | | > |
| | | <a-date-picker |
| | | v-model:value="formData.createTime" |
| | | show-time |
| | | format="YYYY-MM-DD HH:mm:ss" |
| | | value-format="YYYY-MM-DD HH:mm:ss" |
| | | /> |
| | | </a-form-item> |
| | | <a-form-item |
| | | label="备注" |
| | | name="memo" |
| | | style="width: 250px;" |
| | | > |
| | | <a-input |
| | | v-model:value="formData.memo" |
| | | /> |
| | | </a-form-item> |
| | | |
| | | <a-form-item> |
| | | <a-button type="primary" html-type="submit" ref="submitButton" |
| | | style="visibility: hidden;">Submit</a-button> |
| | | </a-form-item> |
| | | </a-form> |
| | | </a-modal> |
| | | </div> |
| | | </template> |
| | | |
| | | <style></style> |
New file |
| | |
| | | <script setup> |
| | | import { getCurrentInstance, ref, computed, reactive } from 'vue'; |
| | | import { useRouter } from "vue-router"; |
| | | import { get, post, postBlob } from '@/utils/request.js' |
| | | import { message, Modal } from 'ant-design-vue'; |
| | | import { logout } from '@/config.js'; |
| | | import EditView from './edit.vue' |
| | | import { formatMessage } from '@/utils/localeUtils.js'; |
| | | const context = getCurrentInstance()?.appContext.config.globalProperties; |
| | | |
| | | const router = useRouter(); |
| | | |
| | | const TABLE_KEY = 'table-operationRecord'; |
| | | let currentPage = 1; |
| | | let pageSize = 10; |
| | | const searchInput = ref("") |
| | | const editChild = ref(null) |
| | | |
| | | let tableData = ref([]); |
| | | getPage(); |
| | | |
| | | const columns = [ |
| | | { |
| | | title: formatMessage('db.sys_operation_record.namespace', '名称空间'), |
| | | dataIndex: 'namespace', |
| | | width: 140, |
| | | }, |
| | | { |
| | | title: formatMessage('db.sys_operation_record.url', '接口地址'), |
| | | dataIndex: 'url', |
| | | width: 140, |
| | | }, |
| | | { |
| | | title: formatMessage('db.sys_operation_record.appkey', '平台密钥'), |
| | | dataIndex: 'appkey', |
| | | width: 140, |
| | | }, |
| | | { |
| | | title: formatMessage('db.sys_operation_record.timestamp', '时间戳'), |
| | | dataIndex: 'timestamp', |
| | | width: 140, |
| | | }, |
| | | { |
| | | title: formatMessage('db.sys_operation_record.client_ip', '客户端IP'), |
| | | dataIndex: 'clientIp', |
| | | width: 140, |
| | | }, |
| | | { |
| | | title: formatMessage('db.sys_operation_record.request', '请求内容'), |
| | | dataIndex: 'request', |
| | | width: 140, |
| | | ellipsis: true, |
| | | }, |
| | | { |
| | | title: formatMessage('db.sys_operation_record.response', '响应内容'), |
| | | dataIndex: 'response', |
| | | width: 140, |
| | | ellipsis: true, |
| | | }, |
| | | { |
| | | title: formatMessage('db.sys_operation_record.spend_time', '消耗时间'), |
| | | dataIndex: 'spendTime', |
| | | width: 140, |
| | | }, |
| | | { |
| | | title: formatMessage('db.sys_operation_record.err', '异常内容'), |
| | | dataIndex: 'err', |
| | | width: 140, |
| | | }, |
| | | { |
| | | title: formatMessage('db.sys_operation_record.result', '结果'), |
| | | dataIndex: 'result$', |
| | | width: 140, |
| | | }, |
| | | { |
| | | title: formatMessage('db.sys_operation_record.user_id', '用户'), |
| | | dataIndex: 'userId$', |
| | | width: 140, |
| | | }, |
| | | { |
| | | title: formatMessage('db.sys_operation_record.create_time', '添加时间'), |
| | | dataIndex: 'createTime$', |
| | | width: 140, |
| | | }, |
| | | { |
| | | title: formatMessage('db.sys_operation_record.memo', '备注'), |
| | | dataIndex: 'memo', |
| | | width: 140, |
| | | }, |
| | | |
| | | { |
| | | title: formatMessage('common.operation', '操作'), |
| | | name: 'oper', |
| | | dataIndex: 'oper', |
| | | key: 'oper', |
| | | width: 140, |
| | | }, |
| | | ]; |
| | | |
| | | const state = reactive({ |
| | | selectedRowKeys: [], |
| | | loading: false, |
| | | }); |
| | | const hasSelected = computed(() => state.selectedRowKeys.length > 0); |
| | | const start = () => { |
| | | state.loading = true; |
| | | // ajax request after empty completing |
| | | setTimeout(() => { |
| | | state.loading = false; |
| | | state.selectedRowKeys = []; |
| | | }, 1000); |
| | | }; |
| | | const onSelectChange = selectedRowKeys => { |
| | | // console.log('selectedRowKeys changed: ', selectedRowKeys); |
| | | state.selectedRowKeys = selectedRowKeys; |
| | | }; |
| | | |
| | | function getPage() { |
| | | post('/api/operationRecord/page', { |
| | | current: currentPage, |
| | | pageSize: pageSize, |
| | | condition: searchInput.value |
| | | }).then((resp) => { |
| | | let result = resp.data; |
| | | if (result.code == 200) { |
| | | let data = result.data; |
| | | tableData.value = data; |
| | | } else if (result.code === 401) { |
| | | message.error(result.msg); |
| | | logout() |
| | | } else { |
| | | message.error(result.msg); |
| | | } |
| | | }) |
| | | } |
| | | |
| | | const handleEdit = (item) => { |
| | | editChild.value.open = true; |
| | | editChild.value.formData = item == null ? editChild.value.initFormData : JSON.parse(JSON.stringify(item)); |
| | | editChild.value.isSave = item == null; |
| | | } |
| | | |
| | | const handleDel = (rows) => { |
| | | Modal.confirm({ |
| | | title: formatMessage('page.delete', '删除'), |
| | | content: formatMessage('page.delete.confirm', '确定删除该项吗?'), |
| | | maskClosable: true, |
| | | onOk: async () => { |
| | | const hide = message.loading(formatMessage('common.loading', '请求中')); |
| | | try { |
| | | post('/api/operationRecord/remove/' + rows.map((row) => row.id).join(','), {}).then(resp => { |
| | | let result = resp.data; |
| | | if (result.code === 200) { |
| | | message.success(result.msg); |
| | | } else { |
| | | message.error(result.msg); |
| | | } |
| | | getPage() |
| | | hide() |
| | | }) |
| | | } catch (error) { |
| | | message.error(formatMessage('common.fail', '请求失败')); |
| | | } |
| | | }, |
| | | }); |
| | | } |
| | | |
| | | const handleExport = async (intl) => { |
| | | postBlob('/api/operationRecord/export', {}).then(result => { |
| | | const blob = new Blob([result.data], { type: 'application/vnd.ms-excel' }); |
| | | window.location.href = window.URL.createObjectURL(blob); |
| | | return true; |
| | | }) |
| | | }; |
| | | |
| | | const onSearch = () => { |
| | | // console.log('search'); |
| | | getPage() |
| | | } |
| | | |
| | | const onPageChange = (page, size) => { |
| | | currentPage = page; |
| | | pageSize = size; |
| | | getPage(); |
| | | } |
| | | |
| | | function handleTableReload(value) { |
| | | getPage() |
| | | } |
| | | |
| | | </script> |
| | | |
| | | <script> |
| | | export default { |
| | | name: '操作日志' |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | | <div> |
| | | <EditView ref="editChild" @tableReload="handleTableReload" /> |
| | | <div class="table-header"> |
| | | <a-input-search v-model:value="searchInput" :placeholder="formatMessage('page.input', '请输入')" |
| | | style="width: 200px;" @search="onSearch" /> |
| | | <div class="table-header-right"> |
| | | <a-button @click="handleEdit(null)" type="primary">{{ formatMessage('page.add', '添加') }}</a-button> |
| | | <a-button @click="handleExport">{{ formatMessage('page.export', '导出') }}</a-button> |
| | | </div> |
| | | </div> |
| | | <a-table :row-selection="{ selectedRowKeys: state.selectedRowKeys, onChange: onSelectChange }" |
| | | :data-source="tableData.records" :defaultExpandAllRows="false" :key="TABLE_KEY" rowKey="id" |
| | | :pagination="{ total: tableData.total, onChange: onPageChange }" |
| | | :scroll="{ y: 768, scrollToFirstRowOnChange: true }" :columns="columns"> |
| | | <template #bodyCell="{ column, text, record }"> |
| | | <template v-if="column.dataIndex === 'oper'"> |
| | | <div style="display: flex;justify-content: space-evenly;"> |
| | | <a-button type="link" primary @click="handleEdit(record)">{{ formatMessage('page.edit', '编辑') }}</a-button> |
| | | <a-button type="link" danger @click="handleDel([record])">{{ formatMessage('page.delete', '删除') |
| | | }}</a-button> |
| | | </div> |
| | | </template> |
| | | </template> |
| | | </a-table> |
| | | </div> |
| | | </template> |
| | | |
| | | <style></style> |
New file |
| | |
| | | <script setup> |
| | | import { ref, nextTick } from 'vue'; |
| | | import { get, post, postBlob, postForm } from '@/utils/request.js' |
| | | import { formatMessage } from '@/utils/localeUtils.js'; |
| | | import { message } from 'ant-design-vue'; |
| | | |
| | | const submitButton = ref(null); |
| | | const isSave = ref(true); |
| | | const open = ref(false); |
| | | const initFormData = {} |
| | | let formData = ref(initFormData); |
| | | const treeData = ref(null); |
| | | |
| | | const emit = defineEmits(['tableReload']) |
| | | |
| | | const handleOk = (e) => { |
| | | nextTick(() => { |
| | | setTimeout(() => { |
| | | submitButton.value.$el.click(); |
| | | }, 100); |
| | | }); |
| | | }; |
| | | |
| | | const onFinish = values => { |
| | | // console.log('Success:', values); |
| | | open.value = false; |
| | | post(isSave.value ? '/api/role/save' : '/api/role/update', formData.value).then((resp) => { |
| | | let result = resp.data; |
| | | if (result.code === 200) { |
| | | message.success(formatMessage('page.update.success', '更新成功')); |
| | | } else { |
| | | message.error(result.msg); |
| | | } |
| | | emit('tableReload', 'reload') |
| | | }) |
| | | }; |
| | | const onFinishFailed = errorInfo => { |
| | | console.log('Failed:', errorInfo); |
| | | }; |
| | | |
| | | |
| | | |
| | | defineExpose({ |
| | | open, |
| | | formData, |
| | | initFormData, |
| | | treeData, |
| | | isSave, |
| | | }) |
| | | |
| | | </script> |
| | | |
| | | <script> |
| | | export default { |
| | | name: '角色管理-edit' |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | | <div> |
| | | <a-modal v-model:open="open" |
| | | :title="isSave ? formatMessage('page.add', '添加') : formatMessage('page.edit', '编辑')" @ok="handleOk" |
| | | style="width: 600px;"> |
| | | <a-form :model="formData" name="formTable" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }" |
| | | style="display: flex;justify-content: space-between;flex-wrap: wrap;" autocomplete="off" |
| | | @finish="onFinish" @finishFailed="onFinishFailed"> |
| | | <a-form-item |
| | | label="名称" |
| | | name="name" |
| | | style="width: 250px;" |
| | | :rules="[{ required: true }]" |
| | | > |
| | | <a-input |
| | | v-model:value="formData.name" |
| | | /> |
| | | </a-form-item> |
| | | <a-form-item |
| | | label="标识" |
| | | name="code" |
| | | style="width: 250px;" |
| | | > |
| | | <a-input |
| | | v-model:value="formData.code" |
| | | /> |
| | | </a-form-item> |
| | | <a-form-item |
| | | label="状态" |
| | | name="status" |
| | | style="width: 250px;" |
| | | > |
| | | <a-select |
| | | v-model:value="formData.status" |
| | | :options="[ |
| | | { label: '正常', value: 1 }, |
| | | { label: '禁用', value: 0 }, |
| | | ]" |
| | | > |
| | | </a-select> |
| | | </a-form-item> |
| | | <a-form-item |
| | | label="添加时间" |
| | | name="createTime" |
| | | style="width: 250px;" |
| | | > |
| | | <a-date-picker |
| | | v-model:value="formData.createTime" |
| | | show-time |
| | | format="YYYY-MM-DD HH:mm:ss" |
| | | value-format="YYYY-MM-DD HH:mm:ss" |
| | | /> |
| | | </a-form-item> |
| | | <a-form-item |
| | | label="修改时间" |
| | | name="updateTime" |
| | | style="width: 250px;" |
| | | > |
| | | <a-date-picker |
| | | v-model:value="formData.updateTime" |
| | | show-time |
| | | format="YYYY-MM-DD HH:mm:ss" |
| | | value-format="YYYY-MM-DD HH:mm:ss" |
| | | /> |
| | | </a-form-item> |
| | | <a-form-item |
| | | label="备注" |
| | | name="memo" |
| | | style="width: 250px;" |
| | | > |
| | | <a-input |
| | | v-model:value="formData.memo" |
| | | /> |
| | | </a-form-item> |
| | | |
| | | <a-form-item> |
| | | <a-button type="primary" html-type="submit" ref="submitButton" |
| | | style="visibility: hidden;">Submit</a-button> |
| | | </a-form-item> |
| | | </a-form> |
| | | </a-modal> |
| | | </div> |
| | | </template> |
| | | |
| | | <style></style> |
New file |
| | |
| | | <script setup> |
| | | import { getCurrentInstance, ref, computed, reactive } from 'vue'; |
| | | import { useRouter } from "vue-router"; |
| | | import { get, post, postBlob } from '@/utils/request.js' |
| | | import { message, Modal } from 'ant-design-vue'; |
| | | import { globalState, logout } from '@/config.js'; |
| | | import EditView from './edit.vue' |
| | | import { formatMessage } from '@/utils/localeUtils.js'; |
| | | const context = getCurrentInstance()?.appContext.config.globalProperties; |
| | | |
| | | const router = useRouter(); |
| | | |
| | | const TABLE_KEY = 'table-role'; |
| | | let currentPage = 1; |
| | | let pageSize = 10; |
| | | const searchInput = ref("") |
| | | const editChild = ref(null) |
| | | const openDrawer = ref(false); |
| | | const currentDrawerData = ref(null); |
| | | |
| | | let treeData = ref([]); |
| | | let checkedKeys = ref([]); |
| | | let halfCheckedKeys = ref([]); |
| | | let expandedKeys = ref([]); |
| | | let selectedKeys = ref([]); |
| | | |
| | | let tableData = ref([]); |
| | | getPage(); |
| | | |
| | | const columns = [ |
| | | { |
| | | title: formatMessage('db.sys_role.name', '名称'), |
| | | dataIndex: 'name', |
| | | width: 140, |
| | | }, |
| | | { |
| | | title: formatMessage('db.sys_role.code', '标识'), |
| | | dataIndex: 'code', |
| | | width: 140, |
| | | }, |
| | | { |
| | | title: formatMessage('db.sys_role.status', '状态'), |
| | | dataIndex: 'status$', |
| | | width: 140, |
| | | }, |
| | | { |
| | | title: formatMessage('db.sys_role.create_time', '添加时间'), |
| | | dataIndex: 'createTime$', |
| | | width: 140, |
| | | }, |
| | | { |
| | | title: formatMessage('db.sys_role.update_time', '修改时间'), |
| | | dataIndex: 'updateTime$', |
| | | width: 140, |
| | | }, |
| | | { |
| | | title: formatMessage('db.sys_role.memo', '备注'), |
| | | dataIndex: 'memo', |
| | | width: 140, |
| | | }, |
| | | |
| | | { |
| | | title: formatMessage('common.operation', '操作'), |
| | | name: 'oper', |
| | | dataIndex: 'oper', |
| | | key: 'oper', |
| | | width: 140, |
| | | }, |
| | | ]; |
| | | |
| | | const state = reactive({ |
| | | selectedRowKeys: [], |
| | | loading: false, |
| | | }); |
| | | const hasSelected = computed(() => state.selectedRowKeys.length > 0); |
| | | const start = () => { |
| | | state.loading = true; |
| | | // ajax request after empty completing |
| | | setTimeout(() => { |
| | | state.loading = false; |
| | | state.selectedRowKeys = []; |
| | | }, 1000); |
| | | }; |
| | | const onSelectChange = selectedRowKeys => { |
| | | // console.log('selectedRowKeys changed: ', selectedRowKeys); |
| | | state.selectedRowKeys = selectedRowKeys; |
| | | }; |
| | | |
| | | function getPage() { |
| | | post('/api/role/page', { |
| | | current: currentPage, |
| | | pageSize: pageSize, |
| | | condition: searchInput.value |
| | | }).then((resp) => { |
| | | let result = resp.data; |
| | | if (result.code == 200) { |
| | | let data = result.data; |
| | | tableData.value = data; |
| | | } else if (result.code === 401) { |
| | | message.error(result.msg); |
| | | logout() |
| | | } else { |
| | | message.error(result.msg); |
| | | } |
| | | }) |
| | | } |
| | | |
| | | const handleEdit = (item) => { |
| | | editChild.value.open = true; |
| | | editChild.value.formData = item == null ? editChild.value.initFormData : JSON.parse(JSON.stringify(item)); |
| | | editChild.value.isSave = item == null; |
| | | } |
| | | |
| | | const handleAssign = (item) => { |
| | | openDrawer.value = true; |
| | | currentDrawerData.value = item; |
| | | loadMenuTree(item) |
| | | } |
| | | |
| | | const handleDel = (rows) => { |
| | | Modal.confirm({ |
| | | title: formatMessage('page.delete', '删除'), |
| | | content: formatMessage('page.delete.confirm', '确定删除该项吗?'), |
| | | maskClosable: true, |
| | | onOk: async () => { |
| | | const hide = message.loading(formatMessage('common.loading', '请求中')); |
| | | try { |
| | | post('/api/role/remove/' + rows.map((row) => row.id).join(','), {}).then(resp => { |
| | | let result = resp.data; |
| | | if (result.code === 200) { |
| | | message.success(result.msg); |
| | | } else { |
| | | message.error(result.msg); |
| | | } |
| | | getPage() |
| | | hide() |
| | | }) |
| | | } catch (error) { |
| | | message.error(formatMessage('common.fail', '请求失败')); |
| | | } |
| | | }, |
| | | }); |
| | | } |
| | | |
| | | const handleExport = async (intl) => { |
| | | postBlob('/api/role/export', {}).then(result => { |
| | | const blob = new Blob([result.data], { type: 'application/vnd.ms-excel' }); |
| | | window.location.href = window.URL.createObjectURL(blob); |
| | | return true; |
| | | }) |
| | | }; |
| | | |
| | | const onSearch = () => { |
| | | // console.log('search'); |
| | | getPage() |
| | | } |
| | | |
| | | const onPageChange = (page, size) => { |
| | | currentPage = page; |
| | | pageSize = size; |
| | | getPage(); |
| | | } |
| | | |
| | | function handleTableReload(value) { |
| | | getPage() |
| | | } |
| | | |
| | | const onCloseDrawer = () => { |
| | | openDrawer.value = false; |
| | | }; |
| | | |
| | | const onSubmitDrawer = () => { |
| | | const hide = message.loading(formatMessage('common.loading', '请求中')); |
| | | try { |
| | | post('/api/role/scope/update', { |
| | | id: currentDrawerData.value.id, |
| | | menuIds: { |
| | | checked: checkedKeys.value, |
| | | halfChecked: halfCheckedKeys.value |
| | | } |
| | | }).then(resp => { |
| | | let result = resp.data; |
| | | if (result.code === 200) { |
| | | message.success(result.msg); |
| | | } else { |
| | | message.error(result.msg); |
| | | } |
| | | hide() |
| | | }) |
| | | } catch (error) { |
| | | message.error(formatMessage('common.fail', '请求失败')); |
| | | } |
| | | |
| | | } |
| | | |
| | | const loadMenuTree = (param) => { |
| | | post('/api/menu/tree', {}).then(resp => { |
| | | let result = resp.data; |
| | | let data = result.data; |
| | | treeData.value = data; |
| | | }) |
| | | |
| | | get('/api/role/scope/list', { |
| | | roleId: param.id |
| | | }).then(resp => { |
| | | let result = resp.data; |
| | | let data = result.data; |
| | | checkedKeys.value = data |
| | | }) |
| | | } |
| | | |
| | | const handleTreeChecked = (keys, e) => { |
| | | halfCheckedKeys.value = e.halfCheckedKeys; |
| | | } |
| | | |
| | | </script> |
| | | |
| | | <script> |
| | | export default { |
| | | name: '角色管理' |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | | <div> |
| | | <EditView ref="editChild" @tableReload="handleTableReload" /> |
| | | <div class="table-header"> |
| | | <a-input-search v-model:value="searchInput" :placeholder="formatMessage('page.input', '请输入')" |
| | | style="width: 200px;" @search="onSearch" /> |
| | | <div class="table-header-right"> |
| | | <a-button @click="handleEdit(null)" type="primary">{{ formatMessage('page.add', '添加') }}</a-button> |
| | | <a-button @click="handleExport">{{ formatMessage('page.export', '导出') }}</a-button> |
| | | </div> |
| | | </div> |
| | | <a-table :row-selection="{ selectedRowKeys: state.selectedRowKeys, onChange: onSelectChange }" |
| | | :data-source="tableData.records" :defaultExpandAllRows="false" :key="TABLE_KEY" rowKey="id" |
| | | :pagination="{ total: tableData.total, onChange: onPageChange }" |
| | | :scroll="{ y: 768, scrollToFirstRowOnChange: true }" :columns="columns"> |
| | | <template #bodyCell="{ column, text, record }"> |
| | | <template v-if="column.dataIndex === 'oper'"> |
| | | <div style="display: flex;justify-content: space-evenly;"> |
| | | <a-button type="link" primary @click="handleEdit(record)">{{ formatMessage('page.edit', '编辑') }}</a-button> |
| | | <a-button type="link" primary @click="handleAssign(record)">{{ formatMessage('page.assign.permission', |
| | | '分配权限') }}</a-button> |
| | | <a-button type="link" danger @click="handleDel([record])">{{ formatMessage('page.delete', '删除') |
| | | }}</a-button> |
| | | </div> |
| | | </template> |
| | | </template> |
| | | </a-table> |
| | | |
| | | <a-drawer :width="500" :title="formatMessage('page.assign.role', '分配权限') + ' - ' + currentDrawerData?.name" |
| | | placement="right" :open="openDrawer" @close="onCloseDrawer"> |
| | | <template #extra> |
| | | <a-button style="margin-right: 8px" @click="onCloseDrawer">{{ formatMessage('common.cancel', '取消') }}</a-button> |
| | | <a-button type="primary" @click="onSubmitDrawer">{{ formatMessage('common.submit', '提交') }}</a-button> |
| | | </template> |
| | | <a-tree v-model:expandedKeys="expandedKeys" v-model:selectedKeys="selectedKeys" v-model:checkedKeys="checkedKeys" |
| | | checkable :tree-data="treeData" :field-names="{ children: 'children', title: 'name', key: 'id' }" |
| | | @check="handleTreeChecked"> |
| | | <template #title="{ name, key }"> |
| | | <span>{{ name }}</span> |
| | | </template> |
| | | </a-tree> |
| | | </a-drawer> |
| | | </div> |
| | | </template> |
| | | |
| | | <style></style> |
| | |
| | | console.log('Failed:', errorInfo); |
| | | }; |
| | | |
| | | const DeptQueryList = ref(null); |
| | | const DeptQueryList = ref(null); |
| | | DeptQuery(); |
| | | function DeptQuery() { |
| | | postForm('/api/dept/query', {}).then(resp => { |
| | | function DeptQuery() { |
| | | postForm('/api/dept/query', {}).then(resp => { |
| | | let result = resp.data; |
| | | DeptQueryList.value = result.data; |
| | | }) |
| | | } |
| | | const UserQueryList = ref(null); |
| | | const UserQueryList = ref(null); |
| | | UserQuery(); |
| | | function UserQuery() { |
| | | postForm('/api/user/query', {}).then(resp => { |
| | | function UserQuery() { |
| | | postForm('/api/user/query', {}).then(resp => { |
| | | let result = resp.data; |
| | | UserQueryList.value = result.data; |
| | | }) |
| | |
| | | <a-form :model="formData" name="formTable" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }" |
| | | style="display: flex;justify-content: space-between;flex-wrap: wrap;" autocomplete="off" |
| | | @finish="onFinish" @finishFailed="onFinishFailed"> |
| | | <a-form-item label="账号" name="username" style="width: 250px;" :rules="[{ required: true }]"> |
| | | <a-input v-model:value="formData.username" /> |
| | | </a-form-item> |
| | | <a-form-item label="密码" name="password" style="width: 250px;"> |
| | | <a-input v-model:value="formData.password" /> |
| | | </a-form-item> |
| | | <a-form-item label="昵称" name="nickname" style="width: 250px;"> |
| | | <a-input v-model:value="formData.nickname" /> |
| | | </a-form-item> |
| | | <a-form-item label="头像" name="avatar" style="width: 250px;"> |
| | | <a-input v-model:value="formData.avatar" /> |
| | | </a-form-item> |
| | | <a-form-item label="工号" name="code" style="width: 250px;"> |
| | | <a-input v-model:value="formData.code" /> |
| | | </a-form-item> |
| | | <a-form-item label="性别" name="sex" style="width: 250px;"> |
| | | <a-select v-model:value="formData.sex" :options="[ |
| | | { label: '未知', value: 0 }, |
| | | { label: '男', value: 1 }, |
| | | { label: '女', value: 2 }, |
| | | ]"> |
| | | <a-form-item |
| | | label="账号" |
| | | name="username" |
| | | style="width: 250px;" |
| | | :rules="[{ required: true }]" |
| | | > |
| | | <a-input |
| | | v-model:value="formData.username" |
| | | /> |
| | | </a-form-item> |
| | | <a-form-item |
| | | label="密码" |
| | | name="password" |
| | | style="width: 250px;" |
| | | > |
| | | <a-input |
| | | v-model:value="formData.password" |
| | | /> |
| | | </a-form-item> |
| | | <a-form-item |
| | | label="昵称" |
| | | name="nickname" |
| | | style="width: 250px;" |
| | | > |
| | | <a-input |
| | | v-model:value="formData.nickname" |
| | | /> |
| | | </a-form-item> |
| | | <a-form-item |
| | | label="头像" |
| | | name="avatar" |
| | | style="width: 250px;" |
| | | > |
| | | <a-input |
| | | v-model:value="formData.avatar" |
| | | /> |
| | | </a-form-item> |
| | | <a-form-item |
| | | label="工号" |
| | | name="code" |
| | | style="width: 250px;" |
| | | > |
| | | <a-input |
| | | v-model:value="formData.code" |
| | | /> |
| | | </a-form-item> |
| | | <a-form-item |
| | | label="性别" |
| | | name="sex" |
| | | style="width: 250px;" |
| | | > |
| | | <a-select |
| | | v-model:value="formData.sex" |
| | | :options="[ |
| | | { label: '未知', value: 0 }, |
| | | { label: '男', value: 1 }, |
| | | { label: '女', value: 2 }, |
| | | ]" |
| | | > |
| | | </a-select> |
| | | </a-form-item> |
| | | <a-form-item label="手机号" name="phone" style="width: 250px;"> |
| | | <a-input v-model:value="formData.phone" /> |
| | | </a-form-item> |
| | | <a-form-item label="邮箱" name="email" style="width: 250px;"> |
| | | <a-input v-model:value="formData.email" /> |
| | | </a-form-item> |
| | | <a-form-item label="邮箱验证" name="emailVerified" style="width: 250px;"> |
| | | <a-select v-model:value="formData.emailVerified" :options="[ |
| | | { label: '否', value: 0 }, |
| | | { label: '是', value: 1 }, |
| | | ]"> |
| | | </a-form-item> |
| | | <a-form-item |
| | | label="手机号" |
| | | name="phone" |
| | | style="width: 250px;" |
| | | > |
| | | <a-input |
| | | v-model:value="formData.phone" |
| | | /> |
| | | </a-form-item> |
| | | <a-form-item |
| | | label="邮箱" |
| | | name="email" |
| | | style="width: 250px;" |
| | | > |
| | | <a-input |
| | | v-model:value="formData.email" |
| | | /> |
| | | </a-form-item> |
| | | <a-form-item |
| | | label="邮箱验证" |
| | | name="emailVerified" |
| | | style="width: 250px;" |
| | | > |
| | | <a-select |
| | | v-model:value="formData.emailVerified" |
| | | :options="[ |
| | | { label: '否', value: 0 }, |
| | | { label: '是', value: 1 }, |
| | | ]" |
| | | > |
| | | </a-select> |
| | | </a-form-item> |
| | | <a-form-item label="所属部门" name="deptId" style="width: 250px;"> |
| | | <a-select v-model:value="formData.deptId" placeholder="Select users" style="width: 100%" show-search |
| | | :options="DeptQueryList" optionFilterProp="label" optionLabelProp="label"> |
| | | </a-form-item> |
| | | <a-form-item |
| | | label="所属部门" |
| | | name="deptId" |
| | | style="width: 250px;" |
| | | > |
| | | <a-select |
| | | v-model:value="formData.deptId" |
| | | placeholder="Select users" |
| | | style="width: 100%" |
| | | show-search |
| | | :options="DeptQueryList" |
| | | optionFilterProp="label" |
| | | optionLabelProp="label" |
| | | > |
| | | </a-select> |
| | | </a-form-item> |
| | | <a-form-item label="真实姓名" name="realName" style="width: 250px;"> |
| | | <a-input v-model:value="formData.realName" /> |
| | | </a-form-item> |
| | | <a-form-item label="身份证号" name="idCard" style="width: 250px;"> |
| | | <a-input v-model:value="formData.idCard" /> |
| | | </a-form-item> |
| | | <a-form-item label="出生日期" name="birthday" style="width: 250px;"> |
| | | <a-input v-model:value="formData.birthday" /> |
| | | </a-form-item> |
| | | <a-form-item label="个人简介" name="introduction" style="width: 250px;"> |
| | | <a-input v-model:value="formData.introduction" /> |
| | | </a-form-item> |
| | | <a-form-item label="状态" name="status" style="width: 250px;"> |
| | | <a-select v-model:value="formData.status" :options="[ |
| | | { label: '正常', value: 1 }, |
| | | { label: '禁用', value: 0 }, |
| | | ]"> |
| | | </a-form-item> |
| | | <a-form-item |
| | | label="真实姓名" |
| | | name="realName" |
| | | style="width: 250px;" |
| | | > |
| | | <a-input |
| | | v-model:value="formData.realName" |
| | | /> |
| | | </a-form-item> |
| | | <a-form-item |
| | | label="身份证号" |
| | | name="idCard" |
| | | style="width: 250px;" |
| | | > |
| | | <a-input |
| | | v-model:value="formData.idCard" |
| | | /> |
| | | </a-form-item> |
| | | <a-form-item |
| | | label="出生日期" |
| | | name="birthday" |
| | | style="width: 250px;" |
| | | > |
| | | <a-input |
| | | v-model:value="formData.birthday" |
| | | /> |
| | | </a-form-item> |
| | | <a-form-item |
| | | label="个人简介" |
| | | name="introduction" |
| | | style="width: 250px;" |
| | | > |
| | | <a-input |
| | | v-model:value="formData.introduction" |
| | | /> |
| | | </a-form-item> |
| | | <a-form-item |
| | | label="状态" |
| | | name="status" |
| | | style="width: 250px;" |
| | | > |
| | | <a-select |
| | | v-model:value="formData.status" |
| | | :options="[ |
| | | { label: '正常', value: 1 }, |
| | | { label: '禁用', value: 0 }, |
| | | ]" |
| | | > |
| | | </a-select> |
| | | </a-form-item> |
| | | <a-form-item label="添加时间" name="createTime" style="width: 250px;"> |
| | | <a-date-picker v-model:value="formData.createTime" show-time format="YYYY-MM-DD HH:mm:ss" |
| | | value-format="YYYY-MM-DD HH:mm:ss" /> |
| | | </a-form-item> |
| | | <a-form-item label="添加人员" name="createBy" style="width: 250px;"> |
| | | <a-select v-model:value="formData.createBy" placeholder="Select users" style="width: 100%" |
| | | show-search :options="UserQueryList" optionFilterProp="label" optionLabelProp="label"> |
| | | </a-form-item> |
| | | <a-form-item |
| | | label="添加时间" |
| | | name="createTime" |
| | | style="width: 250px;" |
| | | > |
| | | <a-date-picker |
| | | v-model:value="formData.createTime" |
| | | show-time |
| | | format="YYYY-MM-DD HH:mm:ss" |
| | | value-format="YYYY-MM-DD HH:mm:ss" |
| | | /> |
| | | </a-form-item> |
| | | <a-form-item |
| | | label="添加人员" |
| | | name="createBy" |
| | | style="width: 250px;" |
| | | > |
| | | <a-select |
| | | v-model:value="formData.createBy" |
| | | placeholder="Select users" |
| | | style="width: 100%" |
| | | show-search |
| | | :options="UserQueryList" |
| | | optionFilterProp="label" |
| | | optionLabelProp="label" |
| | | > |
| | | </a-select> |
| | | </a-form-item> |
| | | <a-form-item label="修改时间" name="updateTime" style="width: 250px;"> |
| | | <a-date-picker v-model:value="formData.updateTime" show-time format="YYYY-MM-DD HH:mm:ss" |
| | | value-format="YYYY-MM-DD HH:mm:ss" /> |
| | | </a-form-item> |
| | | <a-form-item label="修改人员" name="updateBy" style="width: 250px;"> |
| | | <a-select v-model:value="formData.updateBy" placeholder="Select users" style="width: 100%" |
| | | show-search :options="UserQueryList" optionFilterProp="label" optionLabelProp="label"> |
| | | </a-form-item> |
| | | <a-form-item |
| | | label="修改时间" |
| | | name="updateTime" |
| | | style="width: 250px;" |
| | | > |
| | | <a-date-picker |
| | | v-model:value="formData.updateTime" |
| | | show-time |
| | | format="YYYY-MM-DD HH:mm:ss" |
| | | value-format="YYYY-MM-DD HH:mm:ss" |
| | | /> |
| | | </a-form-item> |
| | | <a-form-item |
| | | label="修改人员" |
| | | name="updateBy" |
| | | style="width: 250px;" |
| | | > |
| | | <a-select |
| | | v-model:value="formData.updateBy" |
| | | placeholder="Select users" |
| | | style="width: 100%" |
| | | show-search |
| | | :options="UserQueryList" |
| | | optionFilterProp="label" |
| | | optionLabelProp="label" |
| | | > |
| | | </a-select> |
| | | </a-form-item> |
| | | <a-form-item label="备注" name="memo" style="width: 250px;"> |
| | | <a-input v-model:value="formData.memo" /> |
| | | </a-form-item> |
| | | </a-form-item> |
| | | <a-form-item |
| | | label="备注" |
| | | name="memo" |
| | | style="width: 250px;" |
| | | > |
| | | <a-input |
| | | v-model:value="formData.memo" |
| | | /> |
| | | </a-form-item> |
| | | |
| | | <a-form-item> |
| | | <a-button type="primary" html-type="submit" ref="submitButton" |
| | |
| | | |
| | | const columns = [ |
| | | { |
| | | title: '账号', |
| | | title: formatMessage('db.sys_user.username', '账号'), |
| | | dataIndex: 'username', |
| | | width: 140, |
| | | }, |
| | | { |
| | | title: '密码', |
| | | title: formatMessage('db.sys_user.password', '密码'), |
| | | dataIndex: 'password', |
| | | width: 140, |
| | | }, |
| | | { |
| | | title: '昵称', |
| | | title: formatMessage('db.sys_user.nickname', '昵称'), |
| | | dataIndex: 'nickname', |
| | | width: 140, |
| | | }, |
| | | { |
| | | title: '头像', |
| | | title: formatMessage('db.sys_user.avatar', '头像'), |
| | | dataIndex: 'avatar', |
| | | width: 140, |
| | | }, |
| | | { |
| | | title: '工号', |
| | | title: formatMessage('db.sys_user.code', '工号'), |
| | | dataIndex: 'code', |
| | | width: 140, |
| | | }, |
| | | { |
| | | title: '性别', |
| | | title: formatMessage('db.sys_user.sex', '性别'), |
| | | dataIndex: 'sex$', |
| | | width: 140, |
| | | }, |
| | | { |
| | | title: '手机号', |
| | | title: formatMessage('db.sys_user.phone', '手机号'), |
| | | dataIndex: 'phone', |
| | | width: 140, |
| | | }, |
| | | { |
| | | title: '邮箱', |
| | | title: formatMessage('db.sys_user.email', '邮箱'), |
| | | dataIndex: 'email', |
| | | width: 140, |
| | | }, |
| | | { |
| | | title: '邮箱验证', |
| | | title: formatMessage('db.sys_user.email_verified', '邮箱验证'), |
| | | dataIndex: 'emailVerified$', |
| | | width: 140, |
| | | }, |
| | | { |
| | | title: '所属部门', |
| | | title: formatMessage('db.sys_user.dept_id', '所属部门'), |
| | | dataIndex: 'deptId$', |
| | | width: 140, |
| | | }, |
| | | { |
| | | title: '真实姓名', |
| | | title: formatMessage('db.sys_user.real_name', '真实姓名'), |
| | | dataIndex: 'realName', |
| | | width: 140, |
| | | }, |
| | | { |
| | | title: '身份证号', |
| | | title: formatMessage('db.sys_user.id_card', '身份证号'), |
| | | dataIndex: 'idCard', |
| | | width: 140, |
| | | }, |
| | | { |
| | | title: '出生日期', |
| | | title: formatMessage('db.sys_user.birthday', '出生日期'), |
| | | dataIndex: 'birthday', |
| | | width: 140, |
| | | }, |
| | | { |
| | | title: '个人简介', |
| | | title: formatMessage('db.sys_user.introduction', '个人简介'), |
| | | dataIndex: 'introduction', |
| | | width: 140, |
| | | }, |
| | | { |
| | | title: '状态', |
| | | title: formatMessage('db.sys_user.status', '状态'), |
| | | dataIndex: 'status$', |
| | | width: 140, |
| | | }, |
| | | { |
| | | title: '添加时间', |
| | | title: formatMessage('db.sys_user.create_time', '添加时间'), |
| | | dataIndex: 'createTime$', |
| | | width: 140, |
| | | }, |
| | | { |
| | | title: '添加人员', |
| | | title: formatMessage('db.sys_user.create_by', '添加人员'), |
| | | dataIndex: 'createBy$', |
| | | width: 140, |
| | | }, |
| | | { |
| | | title: '修改时间', |
| | | title: formatMessage('db.sys_user.update_time', '修改时间'), |
| | | dataIndex: 'updateTime$', |
| | | width: 140, |
| | | }, |
| | | { |
| | | title: '修改人员', |
| | | title: formatMessage('db.sys_user.update_by', '修改人员'), |
| | | dataIndex: 'updateBy$', |
| | | width: 140, |
| | | }, |
| | | { |
| | | title: '备注', |
| | | title: formatMessage('db.sys_user.memo', '备注'), |
| | | dataIndex: 'memo', |
| | | width: 140, |
| | | }, |
| | | |
| | | { |
| | | title: '操作', |
| | | title: formatMessage('common.operation', '操作'), |
| | | name: 'oper', |
| | | dataIndex: 'oper', |
| | | key: 'oper', |
| | | width: 140, |
| | | }, |
| | | ]; |
| | | |
| | |
| | | content: formatMessage('page.delete.confirm', '确定删除该项吗?'), |
| | | maskClosable: true, |
| | | onOk: async () => { |
| | | post('/api/user/remove/' + rows.map((row) => row.id).join(','), {}).then(resp => { |
| | | let result = resp.data; |
| | | if (result.code === 200) { |
| | | message.success(result.msg); |
| | | } else { |
| | | message.error(result.msg); |
| | | } |
| | | getPage() |
| | | }) |
| | | const hide = message.loading(formatMessage('common.loading', '请求中')); |
| | | try { |
| | | post('/api/user/remove/' + rows.map((row) => row.id).join(','), {}).then(resp => { |
| | | let result = resp.data; |
| | | if (result.code === 200) { |
| | | message.success(result.msg); |
| | | } else { |
| | | message.error(result.msg); |
| | | } |
| | | getPage() |
| | | hide() |
| | | }) |
| | | } catch (error) { |
| | | message.error(formatMessage('common.fail', '请求失败')); |
| | | } |
| | | }, |
| | | }); |
| | | } |
| | |
| | | <script setup> |
| | | import { ref, nextTick } from 'vue'; |
| | | import { get, post } from '@/utils/request.js' |
| | | import { get, post, postBlob, postForm } from '@/utils/request.js' |
| | | import { formatMessage } from '@/utils/localeUtils.js'; |
| | | import { message } from 'ant-design-vue'; |
| | | |
| | | const submitButton = ref(null); |
| | | const isSave = ref(true); |
| | | const open = ref(false); |
| | | const initFormData = { |
| | | name: null |
| | | } |
| | | const initFormData = {} |
| | | let formData = ref(initFormData); |
| | | const treeData = ref(null); |
| | | |
| | |
| | | const onFinish = values => { |
| | | // console.log('Success:', values); |
| | | open.value = false; |
| | | post(isSave.value ? '/api/userLogin/save' : '/api/userLogin/update', formData.value).then((result) => { |
| | | console.log(result); |
| | | post(isSave.value ? '/api/userLogin/save' : '/api/userLogin/update', formData.value).then((resp) => { |
| | | let result = resp.data; |
| | | if (result.code === 200) { |
| | | message.success(formatMessage('page.update.success', '更新成功')); |
| | | } else { |
| | | message.error(result.msg); |
| | | } |
| | | emit('tableReload', 'reload') |
| | | }) |
| | | }; |
| | | const onFinishFailed = errorInfo => { |
| | | console.log('Failed:', errorInfo); |
| | | }; |
| | | |
| | | const UserQueryList = ref(null); |
| | | UserQuery(); |
| | | function UserQuery() { |
| | | postForm('/api/user/query', {}).then(resp => { |
| | | let result = resp.data; |
| | | UserQueryList.value = result.data; |
| | | }) |
| | | } |
| | | |
| | | |
| | | defineExpose({ |
| | | open, |
| | |
| | | |
| | | <script> |
| | | export default { |
| | | name: '菜单管理' |
| | | name: '登录日志-edit' |
| | | } |
| | | </script> |
| | | |
| | |
| | | <a-form :model="formData" name="formTable" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }" |
| | | style="display: flex;justify-content: space-between;flex-wrap: wrap;" autocomplete="off" |
| | | @finish="onFinish" @finishFailed="onFinishFailed"> |
| | | <a-form-item label="用户" name="userId" style="width: 250px;" |
| | | :rules="[{ required: true, message: '用户不能为空!' }]"> |
| | | <a-input v-model:value="formData.userId" /> |
| | | </a-form-item> |
| | | <a-form-item label="密钥" name="token" style="width: 250px;"> |
| | | <a-input v-model:value="formData.token" /> |
| | | </a-form-item> |
| | | <a-form-item label="登录ip" name="ip" style="width: 250px;"> |
| | | <a-input v-model:value="formData.ip" /> |
| | | </a-form-item> |
| | | <a-form-item label="类型" name="type" style="width: 250px;" |
| | | :rules="[{ required: true, message: '类型不能为空!' }]"> |
| | | <a-select v-model:value="formData.type" :options="[ |
| | | { label: '登录成功', value: 0 }, |
| | | { label: '登录失败', value: 1 }, |
| | | { label: '退出登录', value: 2 }, |
| | | { label: '续签token', value: 3 }, |
| | | ]"></a-select> |
| | | </a-form-item> |
| | | <a-form-item label="备注" name="memo" style="width: 250px;"> |
| | | <a-input v-model:value="formData.memo" /> |
| | | </a-form-item> |
| | | <a-form-item |
| | | label="用户" |
| | | name="userId" |
| | | style="width: 250px;" |
| | | :rules="[{ required: true }]" |
| | | > |
| | | <a-select |
| | | v-model:value="formData.userId" |
| | | placeholder="Select users" |
| | | style="width: 100%" |
| | | show-search |
| | | :options="UserQueryList" |
| | | optionFilterProp="label" |
| | | optionLabelProp="label" |
| | | > |
| | | </a-select> |
| | | </a-form-item> |
| | | <a-form-item |
| | | label="密钥" |
| | | name="token" |
| | | style="width: 250px;" |
| | | > |
| | | <a-input |
| | | v-model:value="formData.token" |
| | | /> |
| | | </a-form-item> |
| | | <a-form-item |
| | | label="登录ip" |
| | | name="ip" |
| | | style="width: 250px;" |
| | | > |
| | | <a-input |
| | | v-model:value="formData.ip" |
| | | /> |
| | | </a-form-item> |
| | | <a-form-item |
| | | label="类型" |
| | | name="type" |
| | | style="width: 250px;" |
| | | > |
| | | <a-select |
| | | v-model:value="formData.type" |
| | | :options="[ |
| | | { label: '登录成功', value: 0 }, |
| | | { label: '登录失败', value: 1 }, |
| | | { label: '退出登录', value: 2 }, |
| | | { label: '续签token', value: 3 }, |
| | | ]" |
| | | > |
| | | </a-select> |
| | | </a-form-item> |
| | | <a-form-item |
| | | label="添加时间" |
| | | name="createTime" |
| | | style="width: 250px;" |
| | | > |
| | | <a-date-picker |
| | | v-model:value="formData.createTime" |
| | | show-time |
| | | format="YYYY-MM-DD HH:mm:ss" |
| | | value-format="YYYY-MM-DD HH:mm:ss" |
| | | /> |
| | | </a-form-item> |
| | | <a-form-item |
| | | label="登录系统" |
| | | name="system" |
| | | style="width: 250px;" |
| | | > |
| | | <a-input |
| | | v-model:value="formData.system" |
| | | /> |
| | | </a-form-item> |
| | | <a-form-item |
| | | label="备注" |
| | | name="memo" |
| | | style="width: 250px;" |
| | | > |
| | | <a-input |
| | | v-model:value="formData.memo" |
| | | /> |
| | | </a-form-item> |
| | | |
| | | <a-form-item> |
| | | <a-button type="primary" html-type="submit" ref="submitButton" |
| | | style="visibility: hidden;">Submit</a-button> |
| | |
| | | </div> |
| | | </template> |
| | | |
| | | <style></style> |
| | | <style></style> |
| | |
| | | const context = getCurrentInstance()?.appContext.config.globalProperties; |
| | | |
| | | const router = useRouter(); |
| | | |
| | | const TABLE_KEY = 'table-userLogin'; |
| | | let currentPage = 1; |
| | | let pageSize = 10; |
| | |
| | | |
| | | const columns = [ |
| | | { |
| | | title: 'ID', |
| | | name: 'id', |
| | | dataIndex: 'id', |
| | | key: 'id', |
| | | }, |
| | | { |
| | | title: '用户', |
| | | name: 'userId$', |
| | | title: formatMessage('db.sys_user_login.user_id', '用户'), |
| | | dataIndex: 'userId$', |
| | | key: 'userId$', |
| | | width: 140, |
| | | }, |
| | | { |
| | | title: '密钥', |
| | | name: 'token', |
| | | title: formatMessage('db.sys_user_login.token', '密钥'), |
| | | dataIndex: 'token', |
| | | key: 'token', |
| | | width: 140, |
| | | ellipsis: true, |
| | | }, |
| | | { |
| | | title: '登录ip', |
| | | name: 'ip', |
| | | title: formatMessage('db.sys_user_login.ip', '登录ip'), |
| | | dataIndex: 'ip', |
| | | key: 'ip', |
| | | width: 140, |
| | | }, |
| | | { |
| | | title: '类型', |
| | | name: 'type', |
| | | dataIndex: 'type', |
| | | key: 'type', |
| | | customRender: (column) => { |
| | | let typeMap = { |
| | | 0: { |
| | | text: formatMessage('login.success', '登录成功'), |
| | | }, |
| | | 1: { |
| | | text: formatMessage('login.fail', '登录失败'), |
| | | }, |
| | | 2: { |
| | | text: formatMessage('login.logout', '退出登录'), |
| | | }, |
| | | 3: { |
| | | text: formatMessage('login.retoken', '续签token'), |
| | | }, |
| | | }; |
| | | return typeMap[column.value].text; |
| | | } |
| | | title: formatMessage('db.sys_user_login.type', '类型'), |
| | | dataIndex: 'type$', |
| | | width: 140, |
| | | }, |
| | | { |
| | | title: '添加时间', |
| | | name: 'createTime$', |
| | | title: formatMessage('db.sys_user_login.create_time', '添加时间'), |
| | | dataIndex: 'createTime$', |
| | | key: 'createTime$', |
| | | width: 140, |
| | | }, |
| | | { |
| | | title: '备注', |
| | | name: 'memo', |
| | | title: formatMessage('db.sys_user_login.system', '登录系统'), |
| | | dataIndex: 'system', |
| | | width: 140, |
| | | }, |
| | | { |
| | | title: formatMessage('db.sys_user_login.memo', '备注'), |
| | | dataIndex: 'memo', |
| | | key: 'memo', |
| | | width: 140, |
| | | }, |
| | | |
| | | { |
| | | title: '操作', |
| | | title: formatMessage('common.operation', '操作'), |
| | | name: 'oper', |
| | | dataIndex: 'oper', |
| | | key: 'oper', |
| | | width: 140, |
| | | }, |
| | | ]; |
| | | |
| | |
| | | content: formatMessage('page.delete.confirm', '确定删除该项吗?'), |
| | | maskClosable: true, |
| | | onOk: async () => { |
| | | post('/api/userLogin/remove/' + rows.map((row) => row.id).join(','), {}).then(resp => { |
| | | let result = resp.data; |
| | | if (result.code === 200) { |
| | | message.success(result.msg); |
| | | } else { |
| | | message.error(result.msg); |
| | | } |
| | | getPage() |
| | | }) |
| | | const hide = message.loading(formatMessage('common.loading', '请求中')); |
| | | try { |
| | | post('/api/userLogin/remove/' + rows.map((row) => row.id).join(','), {}).then(resp => { |
| | | let result = resp.data; |
| | | if (result.code === 200) { |
| | | message.success(result.msg); |
| | | } else { |
| | | message.error(result.msg); |
| | | } |
| | | getPage() |
| | | hide() |
| | | }) |
| | | } catch (error) { |
| | | message.error(formatMessage('common.fail', '请求失败')); |
| | | } |
| | | }, |
| | | }); |
| | | } |
| | |
| | | </div> |
| | | </template> |
| | | |
| | | <style></style> |
| | | <style></style> |
| | |
| | | private Long userId; |
| | | |
| | | /** |
| | | * 类型 0: 登录成功 1: 登录失败 2: 退出登录 3: 续签token |
| | | */ |
| | | @ApiModelProperty(value= "类型 0: 登录成功 1: 登录失败 2: 退出登录 3: 续签token") |
| | | private Integer type; |
| | | |
| | | /** |
| | | * 凭证值 |
| | | */ |
| | | private String token; |
| | |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.createTime); |
| | | } |
| | | |
| | | public String getType$(){ |
| | | if (Cools.isEmpty(this.getType())){ |
| | | return ""; |
| | | } |
| | | //0: 登录成功 1: 登录失败 2: 退出登录 3: 续签token |
| | | switch (this.getType()) { |
| | | case 0: |
| | | return "登录成功"; |
| | | case 1: |
| | | return "登录失败"; |
| | | case 2: |
| | | return "退出登录"; |
| | | case 3: |
| | | return "续签token"; |
| | | default: |
| | | return String.valueOf(this.getType()); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | generator.frontendPrefixPath = "zy-asrs-admin/"; |
| | | |
| | | generator.sqlOsType = SqlOsType.MYSQL; |
| | | generator.url="localhost:3306/asrs"; |
| | | generator.url="localhost:3306/wms_dev"; |
| | | generator.username="root"; |
| | | generator.password="root"; |
| | | // generator.url="47.97.1.152:51433;databasename=jkasrs"; |
| | | // generator.username="sa"; |
| | | // generator.password="Zoneyung@zy56$"; |
| | | |
| | | generator.table="sys_user"; |
| | | generator.tableName="用户管理"; |
| | | generator.table="sys_user_login"; |
| | | generator.tableName="登录日志"; |
| | | generator.packagePath="com.zy.asrs.wms.system"; |
| | | |
| | | generator.build(); |
New file |
| | |
| | | -- save userLogin record |
| | | -- mysql |
| | | insert into `sys_menu` ( `name`, `parent_id`, `route`, `component`, `type`, `sort`, `host_id`, `status`) values ( '登录日志管理', '0', '/system/userLogin', '/system/userLogin', '0' , '0', '1' , '1'); |
| | | |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `host_id`, `status`) values ( '查询登录日志', '', '1', 'system:userLogin:list', '0', '1', '1'); |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `host_id`, `status`) values ( '添加登录日志', '', '1', 'system:userLogin:save', '1', '1', '1'); |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `host_id`, `status`) values ( '修改登录日志', '', '1', 'system:userLogin:update', '2', '1', '1'); |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `host_id`, `status`) values ( '删除登录日志', '', '1', 'system:userLogin:remove', '3', '1', '1'); |
| | | |