refactor(system): 重构系统模块接口和数据结构
- 更新了多个控制器的接口设计,使用 CsPageArgs 封装分页参数 - 修改了部分 API 的 HTTP 方法,优化了请求结构 - 统一了查询接口的命名规范 - 调整了部分参数和返回值类型,提高了代码复用性
This commit is contained in:
@@ -60,7 +60,11 @@ export default {
|
||||
params['pid'] = node.data.id
|
||||
}
|
||||
setTimeout(() => {
|
||||
queryDeptList(params).then(res => {
|
||||
queryDeptList({
|
||||
page: 1,
|
||||
size: 999999,
|
||||
args: params
|
||||
}).then(res => {
|
||||
if (resolve) {
|
||||
resolve(res.content)
|
||||
} else {
|
||||
|
||||
@@ -29,14 +29,11 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="顶级部门">
|
||||
<el-radio-group v-model="form.isTop" style="width: 140px">
|
||||
<el-radio-group v-model="form.isTop" style="width: 370px">
|
||||
<el-radio label="1">是</el-radio>
|
||||
<el-radio label="0">否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="enabled">
|
||||
<el-radio v-for="item in dict.dept_status" :key="item.id" v-model="form.enabled" :label="item.value">{{ item.label }}</el-radio>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="form.isTop === '0'" style="margin-bottom: 0;" label="上级部门" prop="pid">
|
||||
<treeselect
|
||||
v-model="form.pid"
|
||||
@@ -46,6 +43,9 @@
|
||||
placeholder="选择上级类目"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="enabled">
|
||||
<el-radio v-for="item in dict.dept_status" :key="item.id" v-model="form.enabled" :label="item.value">{{ item.label }}</el-radio>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="text" @click="crud.cancelCU">取消</el-button>
|
||||
@@ -139,7 +139,11 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
getDeptDatas(tree, treeNode, resolve) {
|
||||
const params = { pid: tree.id }
|
||||
const params = {
|
||||
page: 1,
|
||||
size: 999999,
|
||||
args: { pid: tree.id }
|
||||
}
|
||||
setTimeout(() => {
|
||||
crudDept.queryDeptList(params).then(res => {
|
||||
resolve(res.content)
|
||||
@@ -178,7 +182,11 @@ export default {
|
||||
})
|
||||
},
|
||||
getDepts() {
|
||||
crudDept.queryDeptList({ enabled: true }).then(res => {
|
||||
crudDept.queryDeptList({
|
||||
page: 1,
|
||||
size: 999999,
|
||||
args: { enabled: true }
|
||||
}).then(res => {
|
||||
this.depts = res.content.map(function(obj) {
|
||||
if (obj.hasChildren) {
|
||||
obj.children = null
|
||||
@@ -190,7 +198,11 @@ export default {
|
||||
// 获取弹窗内部门数据
|
||||
loadDepts({ action, parentNode, callback }) {
|
||||
if (action === LOAD_CHILDREN_OPTIONS) {
|
||||
crudDept.queryDeptList({ enabled: true, pid: parentNode.id }).then(res => {
|
||||
crudDept.queryDeptList({
|
||||
page: 1,
|
||||
size: 999999,
|
||||
args: { enabled: true, pid: parentNode.id }
|
||||
}).then(res => {
|
||||
parentNode.children = res.content.map(function(obj) {
|
||||
if (obj.hasChildren) {
|
||||
obj.children = null
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { queryEmailConfig, modifyEmailConfig } from '@/api/tools/email'
|
||||
import { queryEmailConfig, modifyEmailConfig } from '@/api/system/email'
|
||||
export default {
|
||||
name: 'Config',
|
||||
data() {
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { sendEmail } from '@/api/tools/email'
|
||||
import { sendEmail } from '@/api/system/email'
|
||||
import { upload } from '@/utils/upload'
|
||||
import { mapGetters } from 'vuex'
|
||||
import E from 'wangeditor'
|
||||
|
||||
@@ -200,7 +200,11 @@ export default {
|
||||
}
|
||||
},
|
||||
getMenus(tree, treeNode, resolve) {
|
||||
const params = { pid: tree.id }
|
||||
const params = {
|
||||
page: 1,
|
||||
size: 999999,
|
||||
args: { pid: tree.id }
|
||||
}
|
||||
setTimeout(() => {
|
||||
crudMenu.getMenus(params).then(res => {
|
||||
resolve(res.content)
|
||||
@@ -220,7 +224,7 @@ export default {
|
||||
},
|
||||
loadMenus({ action, parentNode, callback }) {
|
||||
if (action === LOAD_CHILDREN_OPTIONS) {
|
||||
crudMenu.getMenusTree(parentNode.id).then(res => {
|
||||
crudMenu.queryMenuListByPid(parentNode.id).then(res => {
|
||||
parentNode.children = res.map(function(obj) {
|
||||
if (!obj.leaf) {
|
||||
obj.children = null
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<div class="app-container">
|
||||
<div class="head-container">
|
||||
<div v-if="crud.props.searchToggle">
|
||||
<el-input v-model="query.username" clearable size="small" placeholder="输入用户名称查询" style="width: 200px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
|
||||
<el-input v-model="query.userName" clearable size="small" placeholder="输入用户名称查询" style="width: 200px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
|
||||
<rrOperation />
|
||||
</div>
|
||||
<crudOperation>
|
||||
@@ -55,7 +55,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { kickOutUser } from '@/api/monitor/online'
|
||||
import { kickOutUser } from '@/api/system/online'
|
||||
import CRUD, { presenter, header, crud } from '@crud/crud'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
@@ -65,7 +65,7 @@ export default {
|
||||
name: 'OnlineUser',
|
||||
components: { pagination, crudOperation, rrOperation },
|
||||
cruds() {
|
||||
return CRUD({ url: 'auth/online', title: '在线用户' })
|
||||
return CRUD({ url: 'api/user/online', title: '在线用户' })
|
||||
},
|
||||
mixins: [presenter(), header(), crud()],
|
||||
data() {
|
||||
|
||||
+11
-11
@@ -85,16 +85,16 @@
|
||||
</el-table-column>
|
||||
<el-table-column :show-overflow-tooltip="true" prop="description" width="150px" label="描述" />
|
||||
<el-table-column :show-overflow-tooltip="true" prop="createTime" width="136px" label="创建日期" />
|
||||
<el-table-column v-if="checkPer(['admin','timing:edit','timing:del'])" label="操作" width="170px" align="center" fixed="right">
|
||||
<el-table-column v-if="checkPer(['admin','quartzJob:edit','quartzJob:del'])" label="操作" width="170px" align="center" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<el-button v-permission="['admin','timing:edit']" size="mini" style="margin-right: 3px;" type="text" @click="crud.toEdit(scope.row)">编辑</el-button>
|
||||
<el-button v-permission="['admin','timing:edit']" style="margin-left: -2px" type="text" size="mini" @click="execute(scope.row.id)">执行</el-button>
|
||||
<el-button v-permission="['admin','timing:edit']" style="margin-left: 3px" type="text" size="mini" @click="updateStatus(scope.row.id,scope.row.isPause ? '恢复' : '暂停')">
|
||||
<el-button v-permission="['admin','quartzJob:edit']" size="mini" style="margin-right: 3px;" type="text" @click="crud.toEdit(scope.row)">编辑</el-button>
|
||||
<el-button v-permission="['admin','quartzJob:edit']" style="margin-left: -2px" type="text" size="mini" @click="execute(scope.row.id)">执行</el-button>
|
||||
<el-button v-permission="['admin','quartzJob:edit']" style="margin-left: 3px" type="text" size="mini" @click="updateStatus(scope.row.id,scope.row.isPause ? '恢复' : '暂停')">
|
||||
{{ scope.row.isPause ? '恢复' : '暂停' }}
|
||||
</el-button>
|
||||
<el-popover
|
||||
:ref="scope.row.id"
|
||||
v-permission="['admin','timing:del']"
|
||||
v-permission="['admin','quartzJob:del']"
|
||||
placement="top"
|
||||
width="200"
|
||||
>
|
||||
@@ -114,7 +114,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import crudJob from '@/api/quartzjob/timing'
|
||||
import crudJob from '@/api/system/quartzJob'
|
||||
import Log from './log'
|
||||
import CRUD, { presenter, header, form, crud } from '@crud/crud'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
@@ -124,19 +124,19 @@ import DateRangePicker from '@/components/DateRangePicker'
|
||||
|
||||
const defaultForm = { id: null, jobName: null, subTask: null, beanName: null, methodName: null, params: null, cronExpression: null, pauseAfterFailure: true, isPause: false, personInCharge: null, email: null, description: null }
|
||||
export default {
|
||||
name: 'Timing',
|
||||
name: 'QuartzJob',
|
||||
components: { Log, pagination, crudOperation, rrOperation, DateRangePicker },
|
||||
cruds() {
|
||||
return CRUD({ title: '定时任务', url: 'api/jobs', crudMethod: { ...crudJob }})
|
||||
return CRUD({ title: '定时任务', url: 'api/quartzJob', crudMethod: { ...crudJob }})
|
||||
},
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
data() {
|
||||
return {
|
||||
delLoading: false,
|
||||
permission: {
|
||||
add: ['admin', 'timing:add'],
|
||||
edit: ['admin', 'timing:edit'],
|
||||
del: ['admin', 'timing:del']
|
||||
add: ['admin', 'quartzJob:add'],
|
||||
edit: ['admin', 'quartzJob:edit'],
|
||||
del: ['admin', 'quartzJob:del']
|
||||
},
|
||||
rules: {
|
||||
jobName: [
|
||||
+1
-1
@@ -82,7 +82,7 @@ export default {
|
||||
},
|
||||
// 获取数据前设置好接口地址
|
||||
beforeInit() {
|
||||
this.url = 'api/jobs/logs'
|
||||
this.url = 'api/quartzJob/logs'
|
||||
this.size = 6
|
||||
return true
|
||||
},
|
||||
@@ -284,7 +284,11 @@ export default {
|
||||
},
|
||||
// 获取部门数据
|
||||
getDepts() {
|
||||
queryDeptList({ enabled: true }).then(res => {
|
||||
queryDeptList({
|
||||
page: 1,
|
||||
size: 999999,
|
||||
args: { enabled: true }
|
||||
}).then(res => {
|
||||
this.depts = res.content.map(function(obj) {
|
||||
if (obj.hasChildren) {
|
||||
obj.children = null
|
||||
@@ -317,7 +321,11 @@ export default {
|
||||
// 获取弹窗内部门数据
|
||||
loadDepts({ action, parentNode, callback }) {
|
||||
if (action === LOAD_CHILDREN_OPTIONS) {
|
||||
queryDeptList({ enabled: true, pid: parentNode.id }).then(res => {
|
||||
queryDeptList({
|
||||
page: 1,
|
||||
size: 999999,
|
||||
args: { enabled: true, pid: parentNode.id }
|
||||
}).then(res => {
|
||||
parentNode.children = res.content.map(function(obj) {
|
||||
if (obj.hasChildren) {
|
||||
obj.children = null
|
||||
|
||||
@@ -376,7 +376,11 @@ export default {
|
||||
this.crud.toQuery()
|
||||
},
|
||||
getDepts() {
|
||||
queryDeptList({ enabled: true }).then(res => {
|
||||
queryDeptList({
|
||||
page: 1,
|
||||
size: 999999,
|
||||
args: { enabled: true }
|
||||
}).then(res => {
|
||||
this.depts = res.content.map(function(obj) {
|
||||
if (obj.hasChildren) {
|
||||
obj.children = null
|
||||
@@ -405,7 +409,11 @@ export default {
|
||||
// 获取弹窗内部门数据
|
||||
loadDepts({ action, parentNode, callback }) {
|
||||
if (action === LOAD_CHILDREN_OPTIONS) {
|
||||
queryDeptList({ enabled: true, pid: parentNode.id }).then(res => {
|
||||
queryDeptList({
|
||||
page: 1,
|
||||
size: 999999,
|
||||
args: { enabled: true, pid: parentNode.id }
|
||||
}).then(res => {
|
||||
parentNode.children = res.content.map(function(obj) {
|
||||
if (obj.hasChildren) {
|
||||
obj.children = null
|
||||
|
||||
Reference in New Issue
Block a user