349 lines
8.9 KiB

2 months ago
<template>
3 weeks ago
<ContentWrap style="padding: 10px;">
2 months ago
<!-- 搜索工作栏 -->
<el-form
4 weeks ago
class="formClass"
2 months ago
:model="queryParams"
ref="queryFormRef"
:inline="true"
3 weeks ago
size="large"
2 months ago
>
3 weeks ago
<el-form-item label="" prop="title">
4 weeks ago
<el-input
v-model="queryParams.title"
placeholder="请输入任务标题"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
3 weeks ago
<el-form-item label="" prop="taskType">
<el-select
v-model="queryParams.taskType"
placeholder="请选择任务类型"
clearable
class="!w-240px"
>
<el-option
v-for="dict in taskTypeList"
:key="dict.id"
:label="dict.tagName"
:value="dict.id"
/>
</el-select>
</el-form-item>
<el-form-item label="" prop="taskType">
2 months ago
<el-select
v-model="queryParams.status"
placeholder="请选择任务状态"
clearable
class="!w-240px"
>
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.TASK_STATE)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
3 weeks ago
</el-form-item>
<el-form-item label="" prop="taskType">
2 months ago
<el-select
v-model="queryParams.taskType"
placeholder="请选择任务类型"
clearable
class="!w-240px"
>
<el-option
4 weeks ago
v-for="dict in taskTypeList"
:key="dict.id"
:label="dict.tagName"
:value="dict.id"
2 months ago
/>
</el-select>
</el-form-item>
3 weeks ago
<el-form-item label="" prop="startDate" style="width: 100%;">
<el-select
v-model="queryParams.selectWeek"
placeholder="请选择日期范围"
clearable
class="!w-240px"
>
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.SELECT_WEEK)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
2 months ago
</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>
3 weeks ago
</el-form-item>
<el-form-item class="mergeClass" >
2 months ago
<el-button
type="primary"
plain
v-hasPermi="['system:task-info:create']"
2 months ago
@click="push({ path: '/task/create' })"
2 months ago
>
3 weeks ago
<Icon icon="ep:plus" class="mr-5px" /> 新增
2 months ago
</el-button>
3 weeks ago
<!-- <el-button
2 months ago
type="success"
plain
@click="handleExport"
:loading="exportLoading"
v-hasPermi="['system:task-info:export']"
>
<Icon icon="ep:download" class="mr-5px" /> 导出
3 weeks ago
</el-button> -->
2 months ago
</el-form-item>
</el-form>
</ContentWrap>
<!-- 列表 -->
<ContentWrap>
3 weeks ago
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true" :cell-style="{'text-align': 'left'}">
3 weeks ago
<el-table-column label="任务名称" align="left" prop="title" width="200"/>
3 weeks ago
<el-table-column label="任务类型" align="left" prop="taskType">
<template #default="scope">
<el-tag>{{ scope.row.taskTypeName }}</el-tag>
</template>
</el-table-column>
<el-table-column label="发布部门" align="left" prop="deptName" />
3 weeks ago
<el-table-column label="任务状态" align="left" prop="status">
2 months ago
<template #default="scope">
<dict-tag :type="DICT_TYPE.TASK_STATE" :value="scope.row.status" />
</template>
2 months ago
</el-table-column>
3 weeks ago
<el-table-column label="执法对象" align="left" min-width="100px">
2 months ago
<template #default="scope">
3 weeks ago
{{new Set(scope.row.enterpriseIdes?.map(e => e.type)).size }}个区域 ,
{{scope.row.enterpriseIdes.length}}家企业
2 months ago
3 weeks ago
</template>
</el-table-column>
2 months ago
<el-table-column
3 weeks ago
label="执行时间"
align="left"
2 months ago
prop="startDate"
3 weeks ago
>
2 months ago
<template #default="scope">
3 weeks ago
{{scope.row.startDate}}
{{ getDictLabel(DICT_TYPE.TASK_NOTICE_TIME, scope.row.execCycle) }}
2 months ago
</template>
3 weeks ago
2 months ago
</el-table-column>
2 months ago
3 weeks ago
<el-table-column label="操作选项" align="left" min-width="50px">
2 months ago
<template #default="scope">
2 months ago
<el-button
link
type="primary"
2 months ago
@click="
push({
path: 'create',
query: {
id: scope.row.id
}
})
"
2 months ago
v-hasPermi="['system:task-info:update']"
2 months ago
2 months ago
>
2 months ago
详情
2 months ago
</el-button>
2 months ago
<!-- <el-button link type="primary" @click="openForm(scope.row.id)"> 详情 </el-button> -->
2 months ago
</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" />
2 months ago
2 months ago
</template>
<script setup lang="ts">
3 weeks ago
import { getDictLabel, DICT_TYPE, getIntDictOptions } from '@/utils/dict'
2 months ago
import download from '@/utils/download'
import { TaskInfoApi, TaskInfoVO } from '@/api/system/taskinfo'
import TaskInfoForm from './TaskInfoForm.vue'
4 weeks ago
import { TagLibraryApi } from '@/api/system/taglibrary'
2 months ago
/** 任务表,用于存储所有的任务信息,任务可由不同用户创建并管理。 列表 */
2 months ago
defineOptions({ name: 'TaskList' })
2 months ago
2 months ago
const message = useMessage() // 消息弹窗
const { t } = useI18n() // 国际化
2 months ago
const { push } = useRouter()
2 months ago
const loading = ref(true) // 列表的加载中
const list = ref<TaskInfoVO[]>([]) // 列表的数据
const total = ref(0) // 列表的总页数
const taskTypeMap=ref()
2 months ago
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,
3 weeks ago
taskTotal: undefined,
selectWeek: undefined
2 months ago
})
const queryFormRef = ref() // 搜索的表单
const exportLoading = ref(false) // 导出的加载中
4 weeks ago
const taskTypeList:any = ref([])
3 weeks ago
const mydateFormatter3 = ()=> {
}
2 months ago
/** 查询列表 */
const getList = async () => {
loading.value = true
try {
const data = await TaskInfoApi.getTaskInfoPage(queryParams)
list.value = data.list
total.value = data.total
4 weeks ago
3 weeks ago
4 weeks ago
//任务标签
const params = {
3 weeks ago
tagType: 2,
pageSize: -1
4 weeks ago
}
const tag = await TagLibraryApi.getTagLibraryPage(params)
3 weeks ago
taskTypeList.value = tag.list
4 weeks ago
2 months ago
} finally {
loading.value = false
}
}
1 month ago
// 立即执行
const taskExec = async (data) => {
loading.value = true
try {
await TaskInfoApi.taskExec(data)
message.success(t('common.createSuccess'))
getList()
} finally {
loading.value = false
}
}
2 months ago
//选择任务中企业范围
2 months ago
const selectEnterprise = async (id: number) => {}
2 months ago
/** 搜索按钮操作 */
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()
})
2 months ago
</script>
4 weeks ago
<style scoped lang="scss">
.formClass {
display: grid;
3 weeks ago
grid-template-columns: 1fr 1fr 1fr 1fr;
grid-template-rows: 2fr;
4 weeks ago
align-items: center;
3 weeks ago
row-gap: 20px;
column-gap: 40px;
.mergeClass {
grid-column: 2 span;
:deep(.el-form-item__content) {
display: flex !important;
justify-content:flex-end !important;
}
}
4 weeks ago
:deep(.el-form-item) {
margin: 0 !important;
}
}
</style>