add. crontab dev
This commit is contained in:
parent
975da13111
commit
f4995b8283
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use app\adminx\controller\CrontabController;
|
||||||
use app\controller\admin\system\OrganizationController;
|
use app\controller\admin\system\OrganizationController;
|
||||||
use app\entity\SysMenu;
|
use app\entity\SysMenu;
|
||||||
use app\entity\SysOrganization;
|
use app\entity\SysOrganization;
|
||||||
@ -73,6 +74,8 @@ Route::group("adminapi", function () {
|
|||||||
Route::group("system", function () {
|
Route::group("system", function () {
|
||||||
Route::get('composer', [ComposerController::class, "info"])->name("system.composerInfo");
|
Route::get('composer', [ComposerController::class, "info"])->name("system.composerInfo");
|
||||||
Route::get('command', [CommandController::class, "list"])->name("system.commandList");
|
Route::get('command', [CommandController::class, "list"])->name("system.commandList");
|
||||||
|
Route::get('crontab/page', [CrontabController::class, "page"])->name("system.pageCrontab");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
16
z_ele/src/api/system/dev-crontab/index.ts
Normal file
16
z_ele/src/api/system/dev-crontab/index.ts
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import request from '@/utils/request';
|
||||||
|
import type { ApiResult } from '@/api';
|
||||||
|
import type { Crontab, CrontabParam } from './model';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询记录任务列表
|
||||||
|
*/
|
||||||
|
export async function pageCrontab(params?: CrontabParam) {
|
||||||
|
const res = await request.get<ApiResult<Crontab[]>>('/system/crontab/page', {
|
||||||
|
params
|
||||||
|
});
|
||||||
|
if (res.data.code === 0 && res.data.data) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
7
z_ele/src/api/system/dev-crontab/model/index.ts
Normal file
7
z_ele/src/api/system/dev-crontab/model/index.ts
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import type { PageParam } from '@/api';
|
||||||
|
|
||||||
|
export interface Crontab {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CrontabParam extends PageParam {}
|
||||||
@ -1,202 +1,27 @@
|
|||||||
<template>
|
<template>
|
||||||
<ele-page>
|
<ele-page>
|
||||||
<!-- 搜索表单 -->
|
<ele-card
|
||||||
<role-search @search="reload" />
|
:header-style="{ paddingTop: 0, paddingBottom: 0 }"
|
||||||
<ele-card :body-style="{ paddingTop: '8px' }">
|
:body-style="{ padding: 0 }"
|
||||||
<!-- 表格 -->
|
|
||||||
<ele-pro-table
|
|
||||||
ref="tableRef"
|
|
||||||
row-key="roleId"
|
|
||||||
:columns="columns"
|
|
||||||
:datasource="datasource"
|
|
||||||
:show-overflow-tooltip="true"
|
|
||||||
v-model:selections="selections"
|
|
||||||
:highlight-current-row="true"
|
|
||||||
:export-config="{ fileName: '角色数据', datasource: exportSource }"
|
|
||||||
:print-config="{ datasource: exportSource }"
|
|
||||||
cache-key="systemRoleTable"
|
|
||||||
>
|
>
|
||||||
<template #toolbar>
|
<template #header>
|
||||||
<el-button
|
<ele-tabs
|
||||||
type="primary"
|
type="plain"
|
||||||
class="ele-btn-icon"
|
size="large"
|
||||||
:icon="PlusOutlined"
|
v-model="type"
|
||||||
@click="openEdit()"
|
:items="[
|
||||||
>
|
{ name: 'list', label: '计划任务' },
|
||||||
添加
|
{ name: 'arrange', label: '任务编排' }
|
||||||
</el-button>
|
]"
|
||||||
<el-button
|
/>
|
||||||
type="danger"
|
|
||||||
class="ele-btn-icon"
|
|
||||||
:icon="DeleteOutlined"
|
|
||||||
@click="remove()"
|
|
||||||
>
|
|
||||||
删除
|
|
||||||
</el-button>
|
|
||||||
</template>
|
</template>
|
||||||
<template #action="{ row }">
|
|
||||||
<el-link type="primary" underline="never" @click="openEdit(row)">
|
|
||||||
修改
|
|
||||||
</el-link>
|
|
||||||
<el-divider direction="vertical" />
|
|
||||||
<el-link type="primary" underline="never" @click="openAuth(row)">
|
|
||||||
分配权限
|
|
||||||
</el-link>
|
|
||||||
<el-divider direction="vertical" />
|
|
||||||
<el-link type="danger" underline="never" @click="remove(row)">
|
|
||||||
删除
|
|
||||||
</el-link>
|
|
||||||
</template>
|
|
||||||
</ele-pro-table>
|
|
||||||
</ele-card>
|
</ele-card>
|
||||||
<!-- 编辑弹窗 -->
|
<crontab-list />
|
||||||
<role-edit v-model="showEdit" :data="current" @done="reload" />
|
|
||||||
<!-- 权限分配弹窗 -->
|
|
||||||
<role-auth v-model="showAuth" :data="current" />
|
|
||||||
</ele-page>
|
</ele-page>
|
||||||
</template>
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
<script lang="ts" setup>
|
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
import { ElMessageBox } from 'element-plus';
|
import CrontabList from './list/index.vue';
|
||||||
import { EleMessage } from 'ele-admin-plus';
|
|
||||||
import type { EleProTable } from 'ele-admin-plus';
|
|
||||||
import type {
|
|
||||||
DatasourceFunction,
|
|
||||||
Columns
|
|
||||||
} from 'ele-admin-plus/es/ele-pro-table/types';
|
|
||||||
import { PlusOutlined, DeleteOutlined } from '@/components/icons';
|
|
||||||
import RoleSearch from './components/role-search.vue';
|
|
||||||
import RoleEdit from './components/role-edit.vue';
|
|
||||||
import RoleAuth from './components/role-auth.vue';
|
|
||||||
import { pageRoles, removeRoles, listRoles } from '@/api/system/role';
|
|
||||||
import type { Role, RoleParam } from '@/api/system/role/model';
|
|
||||||
|
|
||||||
defineOptions({ name: 'SystemRole' });
|
const type = ref('list');
|
||||||
|
|
||||||
/** 表格实例 */
|
|
||||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
|
||||||
|
|
||||||
/** 表格列配置 */
|
|
||||||
const columns = ref<Columns>([
|
|
||||||
{
|
|
||||||
type: 'selection',
|
|
||||||
columnKey: 'selection',
|
|
||||||
width: 50,
|
|
||||||
align: 'center' /* ,
|
|
||||||
fixed: 'left' */
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'index',
|
|
||||||
columnKey: 'index',
|
|
||||||
width: 50,
|
|
||||||
align: 'center'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
prop: 'roleName',
|
|
||||||
label: '角色名称',
|
|
||||||
sortable: 'custom',
|
|
||||||
minWidth: 120
|
|
||||||
},
|
|
||||||
{
|
|
||||||
prop: 'roleCode',
|
|
||||||
label: '角色标识',
|
|
||||||
sortable: 'custom',
|
|
||||||
minWidth: 120
|
|
||||||
},
|
|
||||||
{
|
|
||||||
prop: 'comments',
|
|
||||||
label: '备注',
|
|
||||||
sortable: 'custom',
|
|
||||||
minWidth: 140
|
|
||||||
},
|
|
||||||
{
|
|
||||||
prop: 'createTime',
|
|
||||||
label: '创建时间',
|
|
||||||
sortable: 'custom',
|
|
||||||
width: 180,
|
|
||||||
align: 'center'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
columnKey: 'action',
|
|
||||||
label: '操作',
|
|
||||||
width: 200,
|
|
||||||
align: 'center' /* ,
|
|
||||||
fixed: 'right' */,
|
|
||||||
slot: 'action',
|
|
||||||
hideInPrint: true,
|
|
||||||
hideInExport: true
|
|
||||||
}
|
|
||||||
]);
|
|
||||||
|
|
||||||
/** 表格选中数据 */
|
|
||||||
const selections = ref<Role[]>([]);
|
|
||||||
|
|
||||||
/** 当前编辑数据 */
|
|
||||||
const current = ref<Role | null>(null);
|
|
||||||
|
|
||||||
/** 是否显示编辑弹窗 */
|
|
||||||
const showEdit = ref(false);
|
|
||||||
|
|
||||||
/** 是否显示权限分配弹窗 */
|
|
||||||
const showAuth = ref(false);
|
|
||||||
|
|
||||||
/** 表格数据源 */
|
|
||||||
const datasource: DatasourceFunction = ({ pages, where, orders }) => {
|
|
||||||
return pageRoles({ ...where, ...orders, ...pages });
|
|
||||||
};
|
|
||||||
|
|
||||||
/** 搜索 */
|
|
||||||
const reload = (where?: RoleParam) => {
|
|
||||||
selections.value = [];
|
|
||||||
tableRef.value?.reload?.({ page: 1, where });
|
|
||||||
};
|
|
||||||
|
|
||||||
/** 打开编辑弹窗 */
|
|
||||||
const openEdit = (row?: Role) => {
|
|
||||||
current.value = row ?? null;
|
|
||||||
showEdit.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
/** 打开权限分配弹窗 */
|
|
||||||
const openAuth = (row?: Role) => {
|
|
||||||
current.value = row ?? null;
|
|
||||||
showAuth.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
/** 删除单个 */
|
|
||||||
const remove = (row?: Role) => {
|
|
||||||
const rows = row == null ? selections.value : [row];
|
|
||||||
if (!rows.length) {
|
|
||||||
EleMessage.error({ message: '请至少选择一条数据', plain: true });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ElMessageBox.confirm(
|
|
||||||
'确定要删除“' + rows.map((d) => d.roleName).join(', ') + '”吗?',
|
|
||||||
'系统提示',
|
|
||||||
{ type: 'warning', draggable: true }
|
|
||||||
)
|
|
||||||
.then(() => {
|
|
||||||
const loading = EleMessage.loading({
|
|
||||||
message: '请求中..',
|
|
||||||
plain: true
|
|
||||||
});
|
|
||||||
removeRoles(rows.map((d) => d.roleId))
|
|
||||||
.then((msg) => {
|
|
||||||
loading.close();
|
|
||||||
EleMessage.success({ message: msg, plain: true });
|
|
||||||
reload();
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
loading.close();
|
|
||||||
EleMessage.error({ message: e.message, plain: true });
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.catch(() => {});
|
|
||||||
};
|
|
||||||
|
|
||||||
/** 导出和打印全部数据的数据源 */
|
|
||||||
const exportSource: DatasourceFunction = ({ where, orders }) => {
|
|
||||||
return listRoles({ ...where, ...orders });
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
187
z_ele/src/views/system/dev-crontab/list/index.vue
Normal file
187
z_ele/src/views/system/dev-crontab/list/index.vue
Normal file
@ -0,0 +1,187 @@
|
|||||||
|
<template>
|
||||||
|
<!-- 搜索表单 -->
|
||||||
|
<role-search @search="reload" />
|
||||||
|
<ele-card :body-style="{ paddingTop: '8px' }">
|
||||||
|
<!-- 表格 -->
|
||||||
|
<ele-pro-table
|
||||||
|
ref="tableRef"
|
||||||
|
row-key="roleId"
|
||||||
|
:columns="columns"
|
||||||
|
:datasource="datasource"
|
||||||
|
:show-overflow-tooltip="true"
|
||||||
|
v-model:selections="selections"
|
||||||
|
:highlight-current-row="true"
|
||||||
|
cache-key="systemRoleTable"
|
||||||
|
>
|
||||||
|
<template #toolbar>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
class="ele-btn-icon"
|
||||||
|
:icon="PlusOutlined"
|
||||||
|
@click="openEdit()"
|
||||||
|
>
|
||||||
|
添加
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
class="ele-btn-icon"
|
||||||
|
:icon="DeleteOutlined"
|
||||||
|
@click="remove()"
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
<template #action="{ row }">
|
||||||
|
<el-link type="primary" underline="never" @click="openEdit(row)">
|
||||||
|
执行
|
||||||
|
</el-link>
|
||||||
|
<el-divider direction="vertical" />
|
||||||
|
<el-link type="primary" underline="never" @click="openEdit(row)">
|
||||||
|
编辑
|
||||||
|
</el-link>
|
||||||
|
<el-divider direction="vertical" />
|
||||||
|
<el-link type="primary" underline="never" @click="openEdit(row)">
|
||||||
|
日志
|
||||||
|
</el-link>
|
||||||
|
<el-divider direction="vertical" />
|
||||||
|
<el-link type="danger" underline="never" @click="remove(row)">
|
||||||
|
删除
|
||||||
|
</el-link>
|
||||||
|
</template>
|
||||||
|
</ele-pro-table>
|
||||||
|
</ele-card>
|
||||||
|
<!-- 编辑弹窗 -->
|
||||||
|
<role-edit v-model="showEdit" :data="current" @done="reload" />
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import { ElMessageBox } from 'element-plus';
|
||||||
|
import { EleMessage } from 'ele-admin-plus';
|
||||||
|
import type { EleProTable } from 'ele-admin-plus';
|
||||||
|
import type {
|
||||||
|
DatasourceFunction,
|
||||||
|
Columns
|
||||||
|
} from 'ele-admin-plus/es/ele-pro-table/types';
|
||||||
|
import { PlusOutlined, DeleteOutlined } from '@/components/icons';
|
||||||
|
import RoleSearch from './components/role-search.vue';
|
||||||
|
import RoleEdit from './components/role-edit.vue';
|
||||||
|
import { removeRoles } from '@/api/system/role';
|
||||||
|
import type { Role, RoleParam } from '@/api/system/role/model';
|
||||||
|
import { pageCrontab } from '@/api/system/dev-crontab';
|
||||||
|
|
||||||
|
defineOptions({ name: 'SystemRole' });
|
||||||
|
|
||||||
|
/** 表格实例 */
|
||||||
|
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||||
|
|
||||||
|
/** 表格列配置 */
|
||||||
|
const columns = ref<Columns>([
|
||||||
|
{
|
||||||
|
type: 'selection',
|
||||||
|
columnKey: 'selection',
|
||||||
|
width: 50,
|
||||||
|
align: 'center' /* ,
|
||||||
|
fixed: 'left' */
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'index',
|
||||||
|
columnKey: 'index',
|
||||||
|
width: 50,
|
||||||
|
align: 'center'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'roleName',
|
||||||
|
label: '角色名称',
|
||||||
|
sortable: 'custom',
|
||||||
|
minWidth: 120
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'roleCode',
|
||||||
|
label: '角色标识',
|
||||||
|
sortable: 'custom',
|
||||||
|
minWidth: 120
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'comments',
|
||||||
|
label: '备注',
|
||||||
|
sortable: 'custom',
|
||||||
|
minWidth: 140
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'createTime',
|
||||||
|
label: '创建时间',
|
||||||
|
sortable: 'custom',
|
||||||
|
width: 180,
|
||||||
|
align: 'center'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
columnKey: 'action',
|
||||||
|
label: '操作',
|
||||||
|
width: 200,
|
||||||
|
align: 'center' /* ,
|
||||||
|
fixed: 'right' */,
|
||||||
|
slot: 'action',
|
||||||
|
hideInPrint: true,
|
||||||
|
hideInExport: true
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
/** 表格选中数据 */
|
||||||
|
const selections = ref<Role[]>([]);
|
||||||
|
|
||||||
|
/** 当前编辑数据 */
|
||||||
|
const current = ref<Role | null>(null);
|
||||||
|
|
||||||
|
/** 是否显示编辑弹窗 */
|
||||||
|
const showEdit = ref(false);
|
||||||
|
|
||||||
|
/** 表格数据源 */
|
||||||
|
const datasource: DatasourceFunction = ({ pages, where, orders }) => {
|
||||||
|
return pageCrontab({ ...where, ...orders, ...pages });
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 搜索 */
|
||||||
|
const reload = (where?: RoleParam) => {
|
||||||
|
selections.value = [];
|
||||||
|
tableRef.value?.reload?.({ page: 1, where });
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 打开编辑弹窗 */
|
||||||
|
const openEdit = (row?: Role) => {
|
||||||
|
current.value = row ?? null;
|
||||||
|
showEdit.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 删除单个 */
|
||||||
|
const remove = (row?: Role) => {
|
||||||
|
const rows = row == null ? selections.value : [row];
|
||||||
|
if (!rows.length) {
|
||||||
|
EleMessage.error({ message: '请至少选择一条数据', plain: true });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ElMessageBox.confirm(
|
||||||
|
'确定要删除“' + rows.map((d) => d.roleName).join(', ') + '”吗?',
|
||||||
|
'系统提示',
|
||||||
|
{ type: 'warning', draggable: true }
|
||||||
|
)
|
||||||
|
.then(() => {
|
||||||
|
const loading = EleMessage.loading({
|
||||||
|
message: '请求中..',
|
||||||
|
plain: true
|
||||||
|
});
|
||||||
|
removeRoles(rows.map((d) => d.roleId))
|
||||||
|
.then((msg) => {
|
||||||
|
loading.close();
|
||||||
|
EleMessage.success({ message: msg, plain: true });
|
||||||
|
reload();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
loading.close();
|
||||||
|
EleMessage.error({ message: e.message, plain: true });
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
};
|
||||||
|
|
||||||
|
</script>
|
||||||
Loading…
Reference in New Issue
Block a user