6 changed files with 505 additions and 335 deletions
@ -0,0 +1,51 @@
|
||||
import request from '@/config/axios' |
||||
|
||||
// 任务表,用于存储所有的任务信息,任务可由不同用户创建并管理。 VO
|
||||
export interface TaskInfoVO { |
||||
id: number // 任务ID,主键
|
||||
title: string // 任务标题
|
||||
description: string // 任务描述
|
||||
execCycle: number // 执行周期
|
||||
taskType: number // 任务类型,表示任务的类别,例如:1.发布任务、2.自动任务等
|
||||
priority: number // 任务优先级
|
||||
status: string // 任务状态
|
||||
startDate: Date // 任务计划开始时间
|
||||
endDate: Date // 任务计划结束时间
|
||||
parentId: number // 父任务id
|
||||
parentType: number // 父子任务类型 10 专项 父 11 专项子 20 周期父 21 周期子 30 父任务 31 子任务
|
||||
taskStep: number // 执行到第几
|
||||
taskTotal: number // 总共几步
|
||||
} |
||||
|
||||
// 任务表,用于存储所有的任务信息,任务可由不同用户创建并管理。 API
|
||||
export const TaskInfoApi = { |
||||
// 查询任务表,用于存储所有的任务信息,任务可由不同用户创建并管理。分页
|
||||
getTaskInfoPage: async (params: any) => { |
||||
return await request.get({ url: `/system/task-info/page`, params }) |
||||
}, |
||||
|
||||
// 查询任务表,用于存储所有的任务信息,任务可由不同用户创建并管理。详情
|
||||
getTaskInfo: async (id: number) => { |
||||
return await request.get({ url: `/system/task-info/get?id=` + id }) |
||||
}, |
||||
|
||||
// 新增任务表,用于存储所有的任务信息,任务可由不同用户创建并管理。
|
||||
createTaskInfo: async (data: TaskInfoVO) => { |
||||
return await request.post({ url: `/system/task-info/create`, data }) |
||||
}, |
||||
|
||||
// 修改任务表,用于存储所有的任务信息,任务可由不同用户创建并管理。
|
||||
updateTaskInfo: async (data: TaskInfoVO) => { |
||||
return await request.put({ url: `/system/task-info/update`, data }) |
||||
}, |
||||
|
||||
// 删除任务表,用于存储所有的任务信息,任务可由不同用户创建并管理。
|
||||
deleteTaskInfo: async (id: number) => { |
||||
return await request.delete({ url: `/system/task-info/delete?id=` + id }) |
||||
}, |
||||
|
||||
// 导出任务表,用于存储所有的任务信息,任务可由不同用户创建并管理。 Excel
|
||||
exportTaskInfo: async (params) => { |
||||
return await request.download({ url: `/system/task-info/export-excel`, params }) |
||||
}, |
||||
} |
@ -1,118 +0,0 @@
|
||||
<template> |
||||
<el-dialog :title="title" v-model="show" width="500px" append-to-body> |
||||
<el-form ref="roleRef" :model="form" :rules="rule" label-width="100px"> |
||||
<el-form-item label="任务标题" prop="roleName"> |
||||
<el-input v-model="form.roleName" placeholder="请输入任务标题" /> |
||||
</el-form-item> |
||||
<el-form-item label="任务类型" prop="roleSort"> |
||||
<el-select placeholder="请选择任务类型"> |
||||
<el-option |
||||
v-for="dict in task_type" |
||||
:key="dict.value" |
||||
:label="dict.label" |
||||
:value="dict.value" |
||||
/> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="执行周期"> |
||||
<el-select placeholder="请选择执行周期"> |
||||
<el-option |
||||
v-for="dict in task_period_type" |
||||
:key="dict.value" |
||||
:label="dict.label" |
||||
:value="dict.value" |
||||
/> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="执行日期"> |
||||
<el-date-picker |
||||
type="daterange" |
||||
range-separator="至" |
||||
start-placeholder="请选择开始日期" |
||||
end-placeholder="请选择结束日期" |
||||
/> |
||||
</el-form-item> |
||||
<el-form-item label="任务内容"> |
||||
<el-input |
||||
type="textarea" |
||||
:autosize="{ |
||||
minRows: 2, |
||||
}" |
||||
placeholder="请输入任务内容" |
||||
/> |
||||
</el-form-item> |
||||
</el-form> |
||||
<template #footer> |
||||
<div class="dialog-footer"> |
||||
<el-button type="primary" @click="submitForm">确 定</el-button> |
||||
<el-button @click="cancel">取 消</el-button> |
||||
</div> |
||||
</template> |
||||
</el-dialog> |
||||
</template> |
||||
<script setup> |
||||
const title = ref(""); |
||||
const show = ref(false); |
||||
const form = ref({}); |
||||
const rule = ref({}); |
||||
const { proxy } = getCurrentInstance(); |
||||
|
||||
const { task_period_type, task_type } = proxy.useDict( |
||||
"task_period_type", |
||||
"task_type", |
||||
); |
||||
|
||||
/** 提交按钮 */ |
||||
function submitForm() { |
||||
proxy.$refs["roleRef"].validate((valid) => { |
||||
if (valid) { |
||||
if (form.value.roleId != undefined) { |
||||
form.value.menuIds = getMenuAllCheckedKeys(); |
||||
updateRole(form.value).then((response) => { |
||||
proxy.$modal.msgSuccess("修改成功"); |
||||
open.value = false; |
||||
getList(); |
||||
}); |
||||
} else { |
||||
form.value.menuIds = getMenuAllCheckedKeys(); |
||||
addRole(form.value).then((response) => { |
||||
proxy.$modal.msgSuccess("新增成功"); |
||||
open.value = false; |
||||
getList(); |
||||
}); |
||||
} |
||||
} |
||||
}); |
||||
} |
||||
|
||||
/** 取消按钮 */ |
||||
function cancel() { |
||||
show.value = false; |
||||
reset(); |
||||
} |
||||
|
||||
/** 重置新增的表单以及其他数据 */ |
||||
function reset() { |
||||
form.value = { |
||||
roleId: undefined, |
||||
roleName: undefined, |
||||
roleKey: undefined, |
||||
roleSort: 0, |
||||
status: "0", |
||||
menuIds: [], |
||||
deptIds: [], |
||||
menuCheckStrictly: true, |
||||
deptCheckStrictly: true, |
||||
remark: undefined, |
||||
}; |
||||
proxy.resetForm("roleRef"); |
||||
} |
||||
|
||||
function open(param) { |
||||
title.value = param.title; |
||||
show.value = true; |
||||
} |
||||
|
||||
defineExpose({ open }); |
||||
</script> |
||||
<style scoped lang="scss"></style> |
@ -1,217 +0,0 @@
|
||||
<template> |
||||
<section class="app-container"> |
||||
<el-form |
||||
:model="queryParams" |
||||
ref="queryRef" |
||||
v-show="showSearch" |
||||
:inline="true" |
||||
label-width="auto" |
||||
> |
||||
<el-form-item label="任务标题" prop="roleName"> |
||||
<el-input |
||||
v-model="queryParams.roleName" |
||||
placeholder="请输入角色名称" |
||||
clearable |
||||
style="width: 240px" |
||||
@keyup.enter="handleQuery" |
||||
/> |
||||
</el-form-item> |
||||
<el-form-item label="权限字符" prop="roleKey"> |
||||
<el-input |
||||
v-model="queryParams.roleKey" |
||||
placeholder="请输入权限字符" |
||||
clearable |
||||
style="width: 240px" |
||||
@keyup.enter="handleQuery" |
||||
/> |
||||
</el-form-item> |
||||
<el-form-item label="任务类型" prop="status"> |
||||
<el-select |
||||
v-model="queryParams.status" |
||||
placeholder="角色状态" |
||||
clearable |
||||
style="width: 240px" |
||||
> |
||||
<el-option |
||||
v-for="dict in sys_normal_disable" |
||||
:key="dict.value" |
||||
:label="dict.label" |
||||
:value="dict.value" |
||||
/> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="创建时间" style="width: 308px"> |
||||
<el-date-picker |
||||
v-model="dateRange" |
||||
value-format="YYYY-MM-DD" |
||||
type="daterange" |
||||
range-separator="-" |
||||
start-placeholder="开始日期" |
||||
end-placeholder="结束日期" |
||||
></el-date-picker> |
||||
</el-form-item> |
||||
<el-form-item> |
||||
<el-button type="primary" icon="Search" @click="handleQuery"> |
||||
搜索 |
||||
</el-button> |
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button> |
||||
</el-form-item> |
||||
</el-form> |
||||
<el-row :gutter="10" class="mb8"> |
||||
<el-col :span="1.5"> |
||||
<el-button type="primary" plain icon="Plus" @click="create()" |
||||
>新增</el-button |
||||
> |
||||
</el-col> |
||||
<!-- <el-col :span="1.5">--> |
||||
<!-- <el-button--> |
||||
<!-- type="warning"--> |
||||
<!-- plain--> |
||||
<!-- icon="Download"--> |
||||
<!-- @click="handleExport"--> |
||||
<!-- v-hasPermi="['system:role:export']"--> |
||||
<!-- >导出</el-button--> |
||||
<!-- >--> |
||||
<!-- </el-col>--> |
||||
<right-toolbar |
||||
v-model:showSearch="showSearch" |
||||
@queryTable="getList" |
||||
></right-toolbar> |
||||
</el-row> |
||||
|
||||
<!-- 表格数据 --> |
||||
<el-table v-loading="loading" :data="list"> |
||||
<el-table-column label="任务标题" prop="roleId" align="center" /> |
||||
<el-table-column |
||||
label="执行周期" |
||||
prop="roleName" |
||||
:show-overflow-tooltip="true" |
||||
align="center" |
||||
/> |
||||
<el-table-column |
||||
label="任务类型" |
||||
prop="roleKey" |
||||
:show-overflow-tooltip="true" |
||||
align="center" |
||||
/> |
||||
<el-table-column |
||||
label="进度" |
||||
prop="roleKey" |
||||
:show-overflow-tooltip="true" |
||||
align="center" |
||||
/> |
||||
<el-table-column label="执行范围" prop="roleSort" align="center"> |
||||
<template #default> |
||||
<el-link type="primary" @click="selectCompany">共200家</el-link> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="任务状态" align="center" /> |
||||
<el-table-column |
||||
label="操作" |
||||
align="center" |
||||
class-name="small-padding fixed-width" |
||||
> |
||||
<template #default="scope"> |
||||
<el-tooltip content="执行日志" placement="top"> |
||||
<el-button link type="primary" icon="Document"></el-button> |
||||
</el-tooltip> |
||||
<el-tooltip content="修改" placement="top"> |
||||
<el-button link type="primary" icon="Edit"></el-button> |
||||
</el-tooltip> |
||||
<el-tooltip content="删除" placement="top"> |
||||
<el-button link type="primary" icon="Delete"></el-button> |
||||
</el-tooltip> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
|
||||
<pagination |
||||
v-show="total > 0" |
||||
:total="total" |
||||
v-model:page="queryParams.pageNum" |
||||
v-model:limit="queryParams.pageSize" |
||||
@pagination="getList" |
||||
/> |
||||
|
||||
<TaskForm ref="taskFormRef" /> |
||||
|
||||
<ChooseCompany ref="chooseCompanyRef"/> |
||||
</section> |
||||
</template> |
||||
|
||||
<script setup> |
||||
import TaskForm from "./form.vue"; |
||||
// import ChooseCompany from '@/BusinessCom/ChooseCompany/index.vue' |
||||
|
||||
const { proxy } = getCurrentInstance(); |
||||
const { task_period_type } = proxy.useDict("task_period_type"); |
||||
const chooseCompanyRef=ref() |
||||
const loading = ref(false); |
||||
const showSearch = ref(true); |
||||
const taskFormRef = ref(); |
||||
const data = reactive({ |
||||
form: {}, |
||||
queryParams: { |
||||
pageNum: 1, |
||||
pageSize: 10, |
||||
roleName: undefined, |
||||
roleKey: undefined, |
||||
status: undefined, |
||||
}, |
||||
rules: { |
||||
roleName: [ |
||||
{ required: true, message: "角色名称不能为空", trigger: "blur" }, |
||||
], |
||||
roleKey: [{ required: true, message: "权限字符不能为空", trigger: "blur" }], |
||||
roleSort: [ |
||||
{ required: true, message: "角色顺序不能为空", trigger: "blur" }, |
||||
], |
||||
}, |
||||
}); |
||||
const total = ref(0); |
||||
const { queryParams, form, rules } = toRefs(data); |
||||
const dateRange = ref([]); |
||||
const list = ref([ |
||||
{ |
||||
roleId: 1, |
||||
roleName: "超级管理员", |
||||
roleKey: "admin", |
||||
roleSort: 1, |
||||
roleStatus: "0", |
||||
roleRemark: "超级管理员拥有所有权限", |
||||
}, |
||||
]); |
||||
/** |
||||
* 获取列表 |
||||
*/ |
||||
function getList() {} |
||||
|
||||
/** 重置按钮操作 */ |
||||
function resetQuery() { |
||||
dateRange.value = []; |
||||
proxy.resetForm("queryRef"); |
||||
handleQuery(); |
||||
} |
||||
|
||||
/** 搜索按钮操作 */ |
||||
function handleQuery() { |
||||
queryParams.value.pageNum = 1; |
||||
getList(); |
||||
} |
||||
|
||||
/** |
||||
* 新增任务 |
||||
*/ |
||||
function create() { |
||||
unref(taskFormRef).open({ title: "新增任务" }); |
||||
} |
||||
|
||||
/** |
||||
* 选择公司 |
||||
*/ |
||||
function selectCompany(){ |
||||
unref(chooseCompanyRef).open({ title: "选择执行范围" }); |
||||
} |
||||
</script> |
||||
|
||||
<style scoped lang="scss"></style> |
@ -0,0 +1,195 @@
|
||||
<template> |
||||
<Dialog :title="dialogTitle" v-model="dialogVisible"> |
||||
<el-form |
||||
ref="formRef" |
||||
:model="formData" |
||||
:rules="formRules" |
||||
label-width="120px" |
||||
v-loading="formLoading" |
||||
> |
||||
<el-form-item label="任务标题" prop="title"> |
||||
<el-input v-model="formData.title" placeholder="请输入任务标题" /> |
||||
</el-form-item> |
||||
<el-form-item label="任务类型" prop="taskType"> |
||||
<el-select v-model="formData.taskType" placeholder="请选择任务类型"> |
||||
<el-option |
||||
v-for="dict in getIntDictOptions(DICT_TYPE.TASK_TYPE)" |
||||
:key="dict.value" |
||||
:label="dict.label" |
||||
:value="dict.value" |
||||
/> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="执行周期" prop="execCycle"> |
||||
<el-select v-model="formData.execCycle" placeholder="请输入执行周期"> |
||||
<el-option |
||||
v-for="dict in getIntDictOptions(DICT_TYPE.TASK_EXEC_TIME)" |
||||
:key="dict.value" |
||||
:label="dict.label" |
||||
:value="dict.value" |
||||
/> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="任务优先级" prop="priority"> |
||||
<el-select v-model="formData.priority" placeholder="请输入任务优先级"> |
||||
<el-option |
||||
v-for="dict in getIntDictOptions(DICT_TYPE.TASK_PRIORITY)" |
||||
:key="dict.value" |
||||
:label="dict.label" |
||||
:value="dict.value" |
||||
/> |
||||
</el-select> |
||||
</el-form-item> |
||||
<!-- <el-form-item label="任务状态" prop="status"> |
||||
<el-radio-group v-model="formData.status"> |
||||
<el-radio value="1">请选择字典生成</el-radio> |
||||
</el-radio-group> |
||||
</el-form-item> --> |
||||
<el-form-item label="开始时间" prop="startDate"> |
||||
<el-date-picker |
||||
v-model="formData.startDate" |
||||
type="date" |
||||
value-format="x" |
||||
placeholder="选择任务计划开始时间" |
||||
/> |
||||
</el-form-item> |
||||
<el-form-item label="结束时间" prop="endDate"> |
||||
<el-date-picker |
||||
v-model="formData.endDate" |
||||
type="date" |
||||
value-format="x" |
||||
placeholder="选择任务计划结束时间" |
||||
/> |
||||
</el-form-item> |
||||
<!-- <el-form-item label="父任务id" prop="parentId"> |
||||
<el-input v-model="formData.parentId" placeholder="请输入父任务id" /> |
||||
</el-form-item> --> |
||||
<!-- <el-form-item label="父子任务类型" prop="parentType"> |
||||
<el-select v-model="formData.parentType" placeholder="请选择父子任务类型"> |
||||
<el-option |
||||
v-for="dict in getIntDictOptions(DICT_TYPE.TASK_TYPE_PARENT)" |
||||
:key="dict.value" |
||||
:label="dict.label" |
||||
:value="dict.value" |
||||
/> |
||||
</el-select> |
||||
</el-form-item> --> |
||||
<el-form-item label="任务描述" prop="description"> |
||||
<Editor v-model="formData.description" height="150px" /> |
||||
</el-form-item> |
||||
<!-- <el-form-item label="执行到第几" prop="taskStep"> |
||||
<el-input v-model="formData.taskStep" placeholder="请输入执行到第几" /> |
||||
</el-form-item> |
||||
<el-form-item label="总共几步" prop="taskTotal"> |
||||
<el-input v-model="formData.taskTotal" placeholder="请输入总共几步" /> |
||||
</el-form-item> --> |
||||
</el-form> |
||||
<template #footer> |
||||
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button> |
||||
<el-button @click="dialogVisible = false">取 消</el-button> |
||||
</template> |
||||
</Dialog> |
||||
</template> |
||||
<script setup lang="ts"> |
||||
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict' |
||||
import { TaskInfoApi, TaskInfoVO } from '@/api/system/taskinfo' |
||||
|
||||
/** 任务表,用于存储所有的任务信息,任务可由不同用户创建并管理。 表单 */ |
||||
defineOptions({ name: 'TaskInfoForm' }) |
||||
|
||||
const { t } = useI18n() // 国际化 |
||||
const message = useMessage() // 消息弹窗 |
||||
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示 |
||||
const dialogTitle = ref('') // 弹窗的标题 |
||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用 |
||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改 |
||||
const formData = ref({ |
||||
id: undefined, |
||||
title: undefined, |
||||
description: undefined, |
||||
execCycle: undefined, |
||||
taskType: undefined, |
||||
priority: undefined, |
||||
status: undefined, |
||||
startDate: undefined, |
||||
endDate: undefined, |
||||
createBy: undefined, |
||||
updateBy: undefined, |
||||
parentId: undefined, |
||||
parentType: undefined, |
||||
taskStep: undefined, |
||||
taskTotal: undefined, |
||||
}) |
||||
const formRules = reactive({ |
||||
title: [{ required: true, message: '任务标题不能为空', trigger: 'blur' }], |
||||
taskType: [{ required: true, message: '任务类型,表示任务的类别,例如:1.发布任务、2.自动任务等不能为空', trigger: 'change' }], |
||||
priority: [{ required: true, message: '任务优先级不能为空', trigger: 'blur' }], |
||||
status: [{ required: true, message: '任务状态不能为空', trigger: 'blur' }], |
||||
}) |
||||
const formRef = ref() // 表单 Ref |
||||
|
||||
/** 打开弹窗 */ |
||||
const open = async (type: string, id?: number) => { |
||||
dialogVisible.value = true |
||||
dialogTitle.value = t('action.' + type) |
||||
formType.value = type |
||||
resetForm() |
||||
// 修改时,设置数据 |
||||
if (id) { |
||||
formLoading.value = true |
||||
try { |
||||
formData.value = await TaskInfoApi.getTaskInfo(id) |
||||
} finally { |
||||
formLoading.value = false |
||||
} |
||||
} |
||||
} |
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗 |
||||
|
||||
/** 提交表单 */ |
||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调 |
||||
const submitForm = async () => { |
||||
// 校验表单 |
||||
await formRef.value.validate() |
||||
// 提交请求 |
||||
formLoading.value = true |
||||
try { |
||||
const data = formData.value as unknown as TaskInfoVO |
||||
if (formType.value === 'create') { |
||||
await TaskInfoApi.createTaskInfo(data) |
||||
message.success(t('common.createSuccess')) |
||||
} else { |
||||
await TaskInfoApi.updateTaskInfo(data) |
||||
message.success(t('common.updateSuccess')) |
||||
} |
||||
dialogVisible.value = false |
||||
// 发送操作成功的事件 |
||||
emit('success') |
||||
} finally { |
||||
formLoading.value = false |
||||
} |
||||
} |
||||
|
||||
/** 重置表单 */ |
||||
const resetForm = () => { |
||||
formData.value = { |
||||
id: undefined, |
||||
title: undefined, |
||||
description: undefined, |
||||
execCycle: undefined, |
||||
taskType: undefined, |
||||
priority: undefined, |
||||
status: undefined, |
||||
startDate: undefined, |
||||
endDate: undefined, |
||||
createBy: undefined, |
||||
updateBy: undefined, |
||||
parentId: undefined, |
||||
parentType: undefined, |
||||
taskStep: undefined, |
||||
taskTotal: undefined, |
||||
} |
||||
formRef.value?.resetFields() |
||||
} |
||||
</script> |
@ -0,0 +1,255 @@
|
||||
<template> |
||||
<ContentWrap> |
||||
<!-- 搜索工作栏 --> |
||||
<el-form |
||||
class="-mb-15px" |
||||
:model="queryParams" |
||||
ref="queryFormRef" |
||||
:inline="true" |
||||
label-width="68px" |
||||
> |
||||
<el-form-item label="任务标题" prop="title"> |
||||
<el-input |
||||
v-model="queryParams.title" |
||||
placeholder="请输入任务标题" |
||||
clearable |
||||
@keyup.enter="handleQuery" |
||||
class="!w-240px" |
||||
/> |
||||
</el-form-item> |
||||
<el-form-item label="任务类型" prop="taskType"> |
||||
<el-select |
||||
v-model="queryParams.taskType" |
||||
placeholder="请选择任务类型" |
||||
clearable |
||||
class="!w-240px" |
||||
> |
||||
<el-option |
||||
v-for="dict in getIntDictOptions(DICT_TYPE.TASK_TYPE)" |
||||
:key="dict.value" |
||||
:label="dict.label" |
||||
:value="dict.value" |
||||
/> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="任务时间" prop="startDate"> |
||||
<el-date-picker |
||||
v-model="queryParams.startDate" |
||||
value-format="YYYY-MM-DD HH:mm:ss" |
||||
type="daterange" |
||||
start-placeholder="开始日期" |
||||
end-placeholder="结束日期" |
||||
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]" |
||||
class="!w-220px" |
||||
/> |
||||
</el-form-item> |
||||
<el-form-item> |
||||
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button> |
||||
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button> |
||||
<el-button |
||||
type="primary" |
||||
plain |
||||
@click="openForm('create')" |
||||
v-hasPermi="['system:task-info:create']" |
||||
> |
||||
<Icon icon="ep:plus" class="mr-5px" /> 新增 |
||||
</el-button> |
||||
<el-button |
||||
type="success" |
||||
plain |
||||
@click="handleExport" |
||||
:loading="exportLoading" |
||||
v-hasPermi="['system:task-info:export']" |
||||
> |
||||
<Icon icon="ep:download" class="mr-5px" /> 导出 |
||||
</el-button> |
||||
</el-form-item> |
||||
</el-form> |
||||
</ContentWrap> |
||||
|
||||
<!-- 列表 --> |
||||
<ContentWrap> |
||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true"> |
||||
<el-table-column label="任务标题" align="center" prop="title" /> |
||||
<el-table-column label="执行周期" align="center" prop="execCycle" > |
||||
<template #default="scope"> |
||||
<dict-tag :type="DICT_TYPE.TASK_EXEC_TIME" :value="scope.row.execCycle" /> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="任务类型" align="center" prop="taskType"> |
||||
<template #default="scope"> |
||||
<dict-tag :type="DICT_TYPE.TASK_TYPE" :value="scope.row.taskType" /> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="任务优先级" align="center" prop="priority" > |
||||
<template #default="scope"> |
||||
<dict-tag :type="DICT_TYPE.TASK_PRIORITY" :value="scope.row.priority" /> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="任务状态" align="center" prop="status" /> |
||||
<el-table-column label="计划开始时间" align="center" prop="startDate" :formatter="dateFormatter"/> |
||||
<el-table-column label="计划结束时间" align="center" prop="endDate" :formatter="dateFormatter"/> |
||||
<!-- <el-table-column |
||||
label="任务创建时间" |
||||
align="center" |
||||
prop="createTime" |
||||
:formatter="dateFormatter" |
||||
width="180px" |
||||
/> --> |
||||
<el-table-column label="创建人" align="center" prop="createName" /> |
||||
<!-- <el-table-column label="父任务id" align="center" prop="parentId" /> |
||||
<el-table-column label="父子任务类型" align="center" prop="parentType"> |
||||
<template #default="scope"> |
||||
<dict-tag :type="DICT_TYPE.TASK_TYPE_PARENT" :value="scope.row.parentType" /> |
||||
</template> |
||||
</el-table-column> --> |
||||
<!-- <el-table-column label="执行到第几" align="center" prop="taskStep" /> --> |
||||
<el-table-column label="操作" align="center" min-width="120px"> |
||||
<template #default="scope"> |
||||
|
||||
<el-button |
||||
link |
||||
type="danger" |
||||
@click="selectEnterprise(scope.row.id)" |
||||
> |
||||
企业范围 |
||||
</el-button> |
||||
|
||||
<el-button |
||||
link |
||||
type="primary" |
||||
@click="openForm('update', scope.row.id)" |
||||
v-hasPermi="['system:task-info:update']" |
||||
> |
||||
编辑 |
||||
</el-button> |
||||
<el-button |
||||
link |
||||
type="danger" |
||||
@click="handleDelete(scope.row.id)" |
||||
v-hasPermi="['system:task-info:delete']" |
||||
> |
||||
删除 |
||||
</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<!-- 分页 --> |
||||
<Pagination |
||||
:total="total" |
||||
v-model:page="queryParams.pageNo" |
||||
v-model:limit="queryParams.pageSize" |
||||
@pagination="getList" |
||||
/> |
||||
</ContentWrap> |
||||
|
||||
<!-- 表单弹窗:添加/修改 --> |
||||
<TaskInfoForm ref="formRef" @success="getList" /> |
||||
</template> |
||||
|
||||
<script setup lang="ts"> |
||||
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict' |
||||
import { dateFormatter } from '@/utils/formatTime' |
||||
import download from '@/utils/download' |
||||
import { TaskInfoApi, TaskInfoVO } from '@/api/system/taskinfo' |
||||
import TaskInfoForm from './TaskInfoForm.vue' |
||||
|
||||
/** 任务表,用于存储所有的任务信息,任务可由不同用户创建并管理。 列表 */ |
||||
defineOptions({ name: 'TaskInfo' }) |
||||
|
||||
const message = useMessage() // 消息弹窗 |
||||
const { t } = useI18n() // 国际化 |
||||
|
||||
const loading = ref(true) // 列表的加载中 |
||||
const list = ref<TaskInfoVO[]>([]) // 列表的数据 |
||||
const total = ref(0) // 列表的总页数 |
||||
const queryParams = reactive({ |
||||
pageNo: 1, |
||||
pageSize: 10, |
||||
title: undefined, |
||||
description: undefined, |
||||
execCycle: undefined, |
||||
taskType: undefined, |
||||
priority: undefined, |
||||
status: undefined, |
||||
startDate: [], |
||||
endDate: [], |
||||
createTime: [], |
||||
createBy: undefined, |
||||
updateBy: undefined, |
||||
parentId: undefined, |
||||
parentType: undefined, |
||||
taskStep: undefined, |
||||
taskTotal: undefined, |
||||
}) |
||||
const queryFormRef = ref() // 搜索的表单 |
||||
const exportLoading = ref(false) // 导出的加载中 |
||||
|
||||
/** 查询列表 */ |
||||
const getList = async () => { |
||||
loading.value = true |
||||
try { |
||||
const data = await TaskInfoApi.getTaskInfoPage(queryParams) |
||||
list.value = data.list |
||||
total.value = data.total |
||||
} finally { |
||||
loading.value = false |
||||
} |
||||
} |
||||
|
||||
//选择任务中企业范围 |
||||
const selectEnterprise = async (id: number) => { |
||||
|
||||
} |
||||
|
||||
/** 搜索按钮操作 */ |
||||
const handleQuery = () => { |
||||
queryParams.pageNo = 1 |
||||
getList() |
||||
} |
||||
|
||||
/** 重置按钮操作 */ |
||||
const resetQuery = () => { |
||||
queryFormRef.value.resetFields() |
||||
handleQuery() |
||||
} |
||||
|
||||
/** 添加/修改操作 */ |
||||
const formRef = ref() |
||||
const openForm = (type: string, id?: number) => { |
||||
formRef.value.open(type, id) |
||||
} |
||||
|
||||
/** 删除按钮操作 */ |
||||
const handleDelete = async (id: number) => { |
||||
try { |
||||
// 删除的二次确认 |
||||
await message.delConfirm() |
||||
// 发起删除 |
||||
await TaskInfoApi.deleteTaskInfo(id) |
||||
message.success(t('common.delSuccess')) |
||||
// 刷新列表 |
||||
await getList() |
||||
} catch {} |
||||
} |
||||
|
||||
/** 导出按钮操作 */ |
||||
const handleExport = async () => { |
||||
try { |
||||
// 导出的二次确认 |
||||
await message.exportConfirm() |
||||
// 发起导出 |
||||
exportLoading.value = true |
||||
const data = await TaskInfoApi.exportTaskInfo(queryParams) |
||||
download.excel(data, '任务表,用于存储所有的任务信息,任务可由不同用户创建并管理。.xls') |
||||
} catch { |
||||
} finally { |
||||
exportLoading.value = false |
||||
} |
||||
} |
||||
|
||||
/** 初始化 **/ |
||||
onMounted(() => { |
||||
getList() |
||||
}) |
||||
</script> |
Loading…
Reference in new issue