Compare commits

...

9 Commits

  1. 104
      src/api/airqualitycollection/index.ts
  2. 2
      src/api/system/taglibrary/index.ts
  3. 4
      src/components/UploadFile/index.ts
  4. 227
      src/components/UploadFile/src/UploadExcel.vue
  5. 58
      src/components/UploadFile/src/useUpload.ts
  6. 8
      src/styles/variables.scss
  7. 32
      src/views/airqualitycollection/index.vue
  8. 10
      src/views/enterprises/index.vue
  9. 89
      src/views/task/create copy 2.vue
  10. 378
      src/views/task/index.vue
  11. 2
      vite.config.ts

104
src/api/airqualitycollection/index.ts

@ -1,52 +1,52 @@
import request from '@/config/axios'
// 空气质量采集 VO
export interface QualityCollectionVO {
id: number // 主键
siteName: string // 站点名称
city: string // 城市
type: number // 数据类型
pm25: number // PM2.s(ugim3)
pm10: number // PMo(ug/m3
so2: number // sOz(ug/m3)
no2: number // NOz(ug/m3)
no: number // NO(Hg/m3)
nOx: number // NOx(Hg/m3)
co: number // CO(mg/m3)
o3: number // 0з(ug/m3)
remark: string // 备用1
remark2: string // 备用2
}
// 空气质量采集 API
export const QualityCollectionApi = {
// 查询空气质量采集分页
getQualityCollectionPage: async (params: any) => {
return await request.get({ url: `/system/quality-collection/page`, params })
},
// 查询空气质量采集详情
getQualityCollection: async (id: number) => {
return await request.get({ url: `/system/quality-collection/get?id=` + id })
},
// 新增空气质量采集
createQualityCollection: async (data: QualityCollectionVO) => {
return await request.post({ url: `/system/quality-collection/create`, data })
},
// 修改空气质量采集
updateQualityCollection: async (data: QualityCollectionVO) => {
return await request.put({ url: `/system/quality-collection/update`, data })
},
// 删除空气质量采集
deleteQualityCollection: async (id: number) => {
return await request.delete({ url: `/system/quality-collection/delete?id=` + id })
},
// 导出空气质量采集 Excel
exportQualityCollection: async (params) => {
return await request.download({ url: `/system/quality-collection/export-excel`, params })
},
}
import request from '@/config/axios'
// 空气质量采集 VO
export interface QualityCollectionVO {
id: number // 主键
siteName: string // 站点名称
city: string // 城市
type: number // 数据类型
pm25: number // PM2.s(ugim3)
pm10: number // PMo(ug/m3
so2: number // sOz(ug/m3)
no2: number // NOz(ug/m3)
no: number // NO(Hg/m3)
nOx: number // NOx(Hg/m3)
co: number // CO(mg/m3)
o3: number // 0з(ug/m3)
remark: string // 备用1
remark2: string // 备用2
}
// 空气质量采集 API
export const QualityCollectionApi = {
// 查询空气质量采集分页
getQualityCollectionPage: async (params: any) => {
return await request.get({ url: `/system/quality-collection/page`, params })
},
// 查询空气质量采集详情
getQualityCollection: async (id: number) => {
return await request.get({ url: `/system/quality-collection/get?id=` + id })
},
// 新增空气质量采集
createQualityCollection: async (data: QualityCollectionVO) => {
return await request.post({ url: `/system/quality-collection/create`, data })
},
// 修改空气质量采集
updateQualityCollection: async (data: QualityCollectionVO) => {
return await request.put({ url: `/system/quality-collection/update`, data })
},
// 删除空气质量采集
deleteQualityCollection: async (id: number) => {
return await request.delete({ url: `/system/quality-collection/delete?id=` + id })
},
// 导出空气质量采集 Excel
exportQualityCollection: async (data:any) => {
return await request.upload({ url: `/system/quality-collection/upload-excel`, data })
}
}

2
src/api/system/taglibrary/index.ts

@ -15,7 +15,7 @@ export interface TagLibraryVO {
export const TagLibraryApi = {
// 查询企业标签分页
getTagLibraryPage: async (params: any) => {
return await request.get({ url: `/system/tag-library/page`, params })
return await request.get({ url: `/system/tag-library/pageInfo`, params })
},
// 查询企业标签分页

4
src/components/UploadFile/index.ts

@ -1,6 +1,8 @@
import UploadImg from './src/UploadImg.vue'
import UploadImgs from './src/UploadImgs.vue'
import UploadFile from './src/UploadFile.vue'
export { UploadImg, UploadImgs, UploadFile}
import UploadExcel from './src/UploadExcel.vue'
export { UploadImg, UploadImgs, UploadFile, UploadExcel}

227
src/components/UploadFile/src/UploadExcel.vue

@ -0,0 +1,227 @@
<template>
<div v-if="!disabled" class="upload-file" >
<el-upload
ref="uploadRef"
v-model:file-list="fileList"
:action="uploadUrl"
:auto-upload="autoUpload"
:before-upload="beforeUpload"
:disabled="disabled"
:drag="drag"
:http-request="httpRequest"
:limit="props.limit"
:multiple="props.limit > 1"
:on-error="excelUploadError"
:on-exceed="handleExceed"
:on-preview="handlePreview"
:on-remove="handleRemove"
:on-success="handleFileSuccess"
:show-file-list="true"
class="upload-file-uploader"
name="file"
>
<el-button type="primary">
<Icon icon="ep:upload" />
&nbsp;上传Excel
</el-button>
<template #file="row">
<div class="flex items-center">
<span>{{ row.file.name }}</span>
<div class="ml-10px">
<el-link
:href="row.file.url"
:underline="false"
download
target="_blank"
type="primary"
>
下载
</el-link>
</div>
<div class="ml-10px">
<el-button link type="danger" @click="handleRemove(row.file)"> 删除</el-button>
</div>
</div>
</template>
</el-upload>
</div>
<!-- 上传操作禁用时 -->
<div v-if="disabled" class="upload-file">
<div v-for="(file, index) in fileList" :key="index" class="flex items-center file-list-item">
<span>{{ file.name }}</span>
<div class="ml-10px">
<el-link :href="file.url" :underline="false" download target="_blank" type="primary">
下载
</el-link>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import { propTypes } from '@/utils/propTypes'
import type { UploadInstance, UploadProps, UploadRawFile, UploadUserFile } from 'element-plus'
import { isString } from '@/utils/is'
import { useExcelUpload } from '@/components/UploadFile/src/useUpload'
import { UploadFile } from 'element-plus/es/components/upload/src/upload'
defineOptions({ name: 'UploadFile' })
const message = useMessage() //
const emit = defineEmits(['update:modelValue'])
const props = defineProps({
modelValue: propTypes.oneOfType<string | string[]>([String, Array<String>]).isRequired,
fileType: propTypes.array.def(['doc', 'xls', 'ppt', 'txt', 'pdf']), // , ['png', 'jpg', 'jpeg']
fileSize: propTypes.number.def(5), // (MB)
limit: propTypes.number.def(5), //
autoUpload: propTypes.bool.def(true), //
drag: propTypes.bool.def(false), //
isShowTip: propTypes.bool.def(true), //
disabled: propTypes.bool.def(false), // ==> false
type: Number
})
// ========== ==========
const uploadRef = ref<UploadInstance>()
const uploadList = ref<UploadUserFile[]>([])
const fileList = ref<UploadUserFile[]>([])
const uploadNumber = ref<number>(0)
console.log('props.type', props.type)
const { uploadUrl, httpRequest } = useExcelUpload(props.type)
//
const beforeUpload: UploadProps['beforeUpload'] = (file: UploadRawFile) => {
if (fileList.value.length >= props.limit) {
message.error(`上传文件数量不能超过${props.limit}个!`)
return false
}
let fileExtension = ''
if (file.name.lastIndexOf('.') > -1) {
fileExtension = file.name.slice(file.name.lastIndexOf('.') + 1)
}
const isImg = props.fileType.some((type: string) => {
if (file.type.indexOf(type) > -1) return true
return !!(fileExtension && fileExtension.indexOf(type) > -1)
})
const isLimit = file.size < props.fileSize * 1024 * 1024
if (!isImg) {
message.error(`文件格式不正确, 请上传${props.fileType.join('/')}格式!`)
return false
}
if (!isLimit) {
message.error(`上传文件大小不能超过${props.fileSize}MB!`)
return false
}
message.success('正在上传文件,请稍候...')
uploadNumber.value++
}
//
// const handleFileChange = (uploadFile: UploadFile): void => {
// uploadRef.value.data.path = uploadFile.name
// }
//
const handleFileSuccess: UploadProps['onSuccess'] = (res: any): void => {
message.success('上传成功')
//
const index = fileList.value.findIndex((item) => item.response?.data === res.data)
fileList.value.splice(index, 1)
uploadList.value.push({ name: res.data, url: res.data })
if (uploadList.value.length == uploadNumber.value) {
fileList.value.push(...uploadList.value)
uploadList.value = []
uploadNumber.value = 0
emitUpdateModelValue()
}
}
//
const handleExceed: UploadProps['onExceed'] = (): void => {
message.error(`上传文件数量不能超过${props.limit}个!`)
}
//
const excelUploadError: UploadProps['onError'] = (): void => {
message.error('导入数据失败,请您重新上传!')
}
//
const handleRemove = (file: UploadFile) => {
const index = fileList.value.map((f) => f.name).indexOf(file.name)
if (index > -1) {
fileList.value.splice(index, 1)
emitUpdateModelValue()
}
}
const handlePreview: UploadProps['onPreview'] = (uploadFile) => {
console.log(uploadFile)
}
//
watch(
() => props.modelValue,
(val: string | string[]) => {
if (!val) {
fileList.value = [] // fix
return
}
fileList.value = [] //
// 1
if (isString(val)) {
fileList.value.push(
...val.split(',').map((url) => ({ name: url.substring(url.lastIndexOf('/') + 1), url }))
)
return
}
// 2
fileList.value.push(
...(val as string[]).map((url) => ({ name: url.substring(url.lastIndexOf('/') + 1), url }))
)
},
{ immediate: true, deep: true }
)
//
const emitUpdateModelValue = () => {
// 1
let result: string | string[] = fileList.value.map((file) => file.url!)
// 2
if (props.limit === 1 || isString(props.modelValue)) {
result = result.join(',')
}
emit('update:modelValue', result)
}
</script>
<style lang="scss" scoped>
.upload-file-uploader {
margin-bottom: -8px;
margin-left: 10px
}
:deep(.upload-file-list .el-upload-list__item) {
position: relative;
// margin-bottom: 10px;
line-height: 2;
border: 1px solid #e4e7ed;
}
:deep(.el-upload-list__item-file-name) {
max-width: 250px;
}
:deep(.upload-file-list .ele-upload-list__item-content) {
display: flex;
justify-content: space-between;
align-items: center;
color: inherit;
}
:deep(.ele-upload-list__item-content-action .el-link) {
margin-right: 10px;
}
.file-list-item {
border: 1px dashed var(--el-border-color-darker);
border-radius: 8px;
}
</style>

58
src/components/UploadFile/src/useUpload.ts

@ -1,4 +1,5 @@
import * as FileApi from '@/api/infra/file'
import { QualityCollectionApi } from '@/api/airqualitycollection'
import CryptoJS from 'crypto-js'
import { UploadRawFile, UploadRequestOptions } from 'element-plus/es/components/upload/src/upload'
import axios from 'axios'
@ -10,6 +11,10 @@ export const getUploadUrl = (): string => {
return import.meta.env.VITE_BASE_URL + import.meta.env.VITE_API_URL + '/infra/file/upload'
}
export const getImportExcel = (): string => {
return import.meta.env.VITE_BASE_URL + import.meta.env.VITE_API_URL + '/system/quality-collection/upload-excel'
}
export const useUpload = () => {
// 后端上传地址
const uploadUrl = getUploadUrl()
@ -61,6 +66,59 @@ export const useUpload = () => {
}
}
export const useExcelUpload = (type: any) => {
//excel 上传地址
const uploadUrl = getImportExcel()
// 是否使用前端直连上传
const isClientUpload = UPLOAD_TYPE.CLIENT === import.meta.env.VITE_UPLOAD_TYPE
// 重写ElUpload上传方法
const httpRequest = async (options: UploadRequestOptions) => {
// 模式一:前端上传
if (isClientUpload) {
// 1.1 生成文件名称
const fileName = await generateFileName(options.file)
// 1.2 获取文件预签名地址
const presignedInfo = await FileApi.getFilePresignedUrl(fileName)
// 1.3 上传文件(不能使用 ElUpload 的 ajaxUpload 方法的原因:其使用的是 FormData 上传,Minio 不支持)
return axios
.put(presignedInfo.uploadUrl, options.file, {
headers: {
'Content-Type': options.file.type
}
})
.then(() => {
// 1.4. 记录文件信息到后端(异步)
createFile(presignedInfo, fileName, options.file)
// 通知成功,数据格式保持与后端上传的返回结果一致
return { data: presignedInfo.url }
})
} else {
// 模式二:后端上传
// 重写 el-upload httpRequest 文件上传成功会走成功的钩子,失败走失败的钩子
return new Promise((resolve, reject) => {
QualityCollectionApi.exportQualityCollection({ file: options.file, type: type })
.then((res) => {
if (res.code === 0) {
resolve(res)
} else {
reject(res)
}
})
.catch((res) => {
reject(res)
})
})
}
}
return {
uploadUrl,
httpRequest
}
}
/**
*
* @param vo

8
src/styles/variables.scss

@ -6,7 +6,7 @@ $elNamespace: el;
.el-form--inline {
display: flex;
flex-flow: row wrap;
gap: 40px;
gap: 20px;
margin-bottom: 0;
.el-form-item {
margin-right: 0;
@ -19,13 +19,17 @@ $elNamespace: el;
.el-table {
border: 1px solid #ebeef5;
border-bottom: none;
--el-table-header-bg-color: #f5f7fa;
.el-table__header {
color: #909399;
}
}
.el-pagination--large .btn-next, .el-pagination--large .btn-prev, .el-pagination--large .el-pager li{
.el-pagination--large .btn-next,
.el-pagination--large .btn-prev,
.el-pagination--large .el-pager li {
height: fit-content;
line-height: normal;
}

32
src/views/airqualitycollection/index.vue

@ -40,26 +40,17 @@
class="!w-220px"
/>
</el-form-item>
<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:quality-collection:create']"
>
<Icon icon="ep:plus" class="mr-5px" /> 新增
</el-button>
<el-button
type="success"
plain
@click="handleExport"
:loading="exportLoading"
v-hasPermi="['system:quality-collection:export']"
>
<Icon icon="ep:download" class="mr-5px" /> 导出
</el-button>
<UploadExcel
v-model="fileUrls"
:file-type="['xlsx', 'xls']"
:file-size="1"
class="mr-5px"
:type="activeName"
/>
</el-form-item>
</el-form>
@ -137,6 +128,7 @@ import download from '@/utils/download'
import { QualityCollectionApi, QualityCollectionVO } from '@/api/airqualitycollection'
import QualityCollectionForm from './QualityCollectionForm.vue'
const activeName = ref(1)
import { UploadExcel } from '@/components/UploadFile'
/** 空气质量采集 列表 */
@ -169,6 +161,8 @@ const queryParams = reactive({
const queryFormRef = ref() //
const exportLoading = ref(false) //
const fileUrls = ref()
/** 查询列表 */
const getList = async () => {
loading.value = true
@ -182,7 +176,7 @@ const getList = async () => {
}
const handleClick = (tab: TabsPaneContext, event: Event) => {
console.log(tab, event)
console.log(tab.props, event)
}
/** 搜索按钮操作 */

10
src/views/enterprises/index.vue

@ -17,16 +17,6 @@
@keyup.enter="handleQuery"
/>
</el-form-item>
<!-- <el-form-item label="邀请人" prop="userId">-->
<!-- <el-select-->
<!-- v-model="queryParams.userId"-->
<!-- placeholder="请选择邀请人"-->
<!-- clearable-->
<!-- class="!w-240px"-->
<!-- >-->
<!-- <el-option label="请选择字典生成" value="" />-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<el-form-item label="企业类型" prop="type">
<el-select
v-model="queryParams.type"

89
src/views/task/create copy 2.vue

@ -75,6 +75,23 @@
<div class="wrapper-down">
<div class="title">执法范围</div>
<div class="box">
<div>
<el-input
v-model="enterprise.queryParams.enterprisesName"
placeholder="请输入企业名称" size="large"
/>
<el-select v-model="enterprise.queryParams.userId" placeholder="请选择执法人员" size="large" filterable clearable>
<el-option
v-for="dict in userList"
:key="dict.id"
:label="dict.deptName +'_'+ dict.realName"
:value="dict.id"
/>
</el-select>
</div>
<div>
<el-select
v-model="enterprise.queryParams.qy"
@ -89,26 +106,7 @@
:value="dict.value"
/>
</el-select>
<el-input
v-model="enterprise.queryParams.enterprisesName"
placeholder="请输入企业名称" size="large"
/>
</div>
<div>
<el-select
v-model="enterprise.queryParams.hy"
placeholder="请选择行业"
clearable
size="large"
>
<el-option
v-for="dict in hyList"
:key="dict.id"
:label="dict.tagName"
:value="dict.tagName"
/>
</el-select>
<div class="btn">
<el-button type="primary" plain size="large" @click="handleQuery">
@ -121,14 +119,23 @@
</div>
<div>
<el-select v-model="enterprise.queryParams.userId" placeholder="请选择执法人员" size="large" filterable clearable>
<el-select
v-model="enterprise.queryParams.hy"
placeholder="请选择行业列别"
clearable
size="large"
multiple
filterable
>
<el-option
v-for="dict in userList"
v-for="dict in hyList"
:key="dict.id"
:label="dict.deptName +'_'+ dict.realName"
:value="dict.id"
:label="dict.tagName"
:value="dict.tagName"
/>
</el-select>
<div class="btn2">
<el-button @click="insertEnterprise" type="primary" size="large">
<el-icon><Sort /></el-icon> &nbsp;
@ -154,7 +161,7 @@
</template>
<el-table-column type="selection" width="30" :reserve-selection="true"/>
<el-table-column property="enterprisesName" label="企业名称" min-width="100" />
<el-table-column property="region" label="区域">
<el-table-column property="region" label="所属区域">
<template #default="scope">
{{
getStrDictOptions(DICT_TYPE.ENTERPRISES_AREA).find(
@ -163,7 +170,7 @@
}}
</template>
</el-table-column>
<el-table-column property="enterprisesName" label="行业">
<el-table-column property="enterprisesName" label="行业类别">
<template #default="scope">
{{
scope.row.tagListName &&
@ -174,30 +181,12 @@
}}
</template>
</el-table-column>
<el-table-column property="enterprisesName" label="生态">
<template #default="scope">
{{
scope.row.tagListName &&
scope.row.tagListName
.filter((item) => item.value == 2)
.map((item) => item.label)
.join(', ')
}}
</template>
</el-table-column>
<el-table-column property="enterprisesName" label="类型">
<el-table-column property="inviterName" label="执法人员" min-width="100" >
<template #default="scope">
{{
scope.row.tagListName &&
scope.row.tagListName
.filter((item) => item.value == 4)
.map((item) => item.label)
.join(', ')
}}
{{scope.row.inviterName}} | {{scope.row.inviterNameDept}}
</template>
</el-table-column>
<el-table-column property="inviterName" label="执法人员" min-width="100" />
<el-table-column label="操作" align="center" min-width="80px">
<el-table-column label="操作" align="left" >
<template #default="scope">
<el-button
link
@ -234,11 +223,11 @@
</div>
</div>
<div class="footer">
<el-button type="primary" @click="submitForm(false)" size="large">{{btnTitle}}</el-button>
<el-button type="primary" @click="submitForm(false)" size="large" v-if="!formData.status || formData.status == 0 || formData.status == 1" >{{btnTitle}}</el-button>
<el-button
type="primary"
v-if="showButton"
v-if="formData.status == 0"
@click="submitForm(true)"
size="large"
v-hasPermi="['system:enterprise-inspections:audit']"
@ -456,7 +445,6 @@ const filterList = (list: EnterprisesVO[]) => {
const { enterprisesName, qy, hy, userId } = enterprise.value.queryParams;
return list.filter(item => {
if (item.tagList) {
//
@ -465,7 +453,8 @@ const filterList = (list: EnterprisesVO[]) => {
//
const typeMatch = qy ? item.region == qy : true;
//
const hyMatch = hy ? item.tagList.includes(hy) : true
const hyMatch = hy ? hy.filter(h => item.tagList.includes(h)) : true
const userIdMatch = userId ? item.userId == userId : true

378
src/views/task/index.vue

@ -1,75 +1,71 @@
<template>
<ContentWrap style="align-items: center; display: flex; padding: 25px 0;">
<!-- 搜索工作栏 -->
<el-form
class="formClass"
:model="queryParams"
ref="queryFormRef"
:inline="true"
label-width="108px"
>
<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.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>
</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 taskTypeList"
:key="dict.id"
:label="dict.tagName"
:value="dict.id"
<ContentWrap style="padding: 10px">
<section class="flex flex-col gap-20px">
<el-form :model="queryParams" ref="queryFormRef" inline>
<el-form-item label="" prop="title">
<el-input
v-model="queryParams.title"
placeholder="请输入任务标题"
clearable
@keyup.enter="handleQuery"
/>
</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
v-hasPermi="['system:task-info:create']"
@click="push({ path: '/task/create' })"
>
<Icon icon="ep:plus" class="mr-5px" /> 创建任务
</el-button>
<el-button
</el-form-item>
<el-form-item label="" prop="taskType">
<el-select v-model="queryParams.taskType" placeholder="请选择任务类型" clearable>
<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">
<el-select v-model="queryParams.status" placeholder="请选择任务状态" clearable>
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.TASK_STATE)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="" prop="taskType">
<el-select v-model="queryParams.taskType" placeholder="请选择任务类型" clearable>
<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="startDate">
<el-select v-model="queryParams.selectWeek" placeholder="请选择日期范围" clearable>
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.SELECT_WEEK)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button @click="handleQuery" type="primary" plain
><Icon icon="ep:search" class="mr-5px" /> 查询</el-button
>
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
</el-form-item>
<el-form-item class="last-children">
<el-button
type="primary"
v-hasPermi="['system:task-info:create']"
@click="push({ path: '/task/create' })"
>
<Icon icon="ep:circle-plus" class="mr-5px" /> 新增
</el-button>
<!-- <el-button
type="success"
plain
@click="handleExport"
@ -77,163 +73,87 @@
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" :cell-style="{'text-align': 'left'}">
<el-table-column label="任务名称" align="left" prop="title" width="200"/>
<el-table-column label="任务状态" align="left" prop="status">
<template #default="scope">
<dict-tag :type="DICT_TYPE.TASK_STATE" :value="scope.row.status" />
</template>
</el-table-column>
<!-- <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="left" prop="taskType">
<template #default="scope">
<el-tag>{{ scope.row.taskTypeName }}</el-tag>
</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="left" prop="deptName" />
<el-table-column
label="开始时间"
align="center"
prop="startDate"
:formatter="dateFormatter3"
/>
<el-table-column
label="结束时间"
align="center"
prop="endDate"
:formatter="dateFormatter3"
</el-button> -->
</el-form-item>
</el-form>
<el-table
v-loading="loading"
:data="list"
:show-overflow-tooltip="true"
>
<el-table-column label="任务名称" align="left" prop="title" width="200" />
<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" />
<el-table-column label="任务状态" align="left" prop="status">
<template #default="scope">
<dict-tag :type="DICT_TYPE.TASK_STATE" :value="scope.row.status" />
</template>
</el-table-column>
<el-table-column label="执法对象" align="left" min-width="100px">
<template #default="scope">
{{ new Set(scope.row.enterpriseIdes?.map((e) => e.type)).size }}个区域 ,
{{ scope.row.enterpriseIdes.length }}家企业
</template>
</el-table-column>
<el-table-column label="执行时间" align="left" prop="startDate">
<template #default="scope">
{{ scope.row.startDate }}
{{ getDictLabel(DICT_TYPE.TASK_NOTICE_TIME, scope.row.execCycle) }}
</template>
</el-table-column>
<el-table-column label="操作选项" align="center" width="100px">
<template #default="scope">
<el-button
link
type="primary"
@click="
push({
path: 'create',
query: {
id: scope.row.id
}
})
"
v-hasPermi="['system:task-info:update']"
>
详情
</el-button>
<!-- <el-button link type="primary" @click="openForm(scope.row.id)"> 详情 </el-button> -->
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<el-pagination
:total="total"
:show-page-size="false"
layout="total, prev, pager, next"
v-model:current-page="queryParams.pageNo"
v-model:page-size="queryParams.pageSize"
@change="getList"
class="ml-auto"
/>
<!-- <el-table-column
label="任务创建时间"
align="center"
prop="createTime"
:formatter="dateFormatter"
width="180px"
/> -->
<el-table-column label="创建人" align="left" 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="left" min-width="50px">
<template #default="scope">
<el-button link type="primary" @click="
push({
path: 'create',
query: {
id: scope.row.id
}
})
">
<el-Tag type="success">{{scope.row.enterpriseIdes.length}}</el-Tag>&nbsp;
</el-button>&nbsp;
</template>
</el-table-column>
<el-table-column label="" align="center" min-width="120px">
<template #default="scope">
<el-button
link
type="primary"
@click="
push({
path: 'create',
query: {
id: scope.row.id
}
})
"
v-hasPermi="['system:task-info:update']"
>
详情
</el-button>
<el-button
link
type="primary"
@click="taskExec(scope.row)"
v-if="scope.row.status == 1"
v-hasPermi="['system:task-info:update']"
>
立即执行
</el-button>
<el-button
link
type="danger"
@click="handleDelete(scope.row.id)"
v-hasPermi="['system:task-info:delete']"
v-if="scope.row.status == 1"
>
删除
</el-button>
<el-button
link
type="danger"
@click="handleDelete(scope.row.id)"
v-hasPermi="['system:task-info:audit']"
v-if="scope.row.status == 0"
>
审核
</el-button>
<!-- <el-button link type="primary" @click="openForm(scope.row.id)"> 详情 </el-button> -->
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<Pagination
:total="total"
v-model:page="queryParams.pageNo"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
</section>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<TaskInfoForm ref="formRef" @success="getList" />
</template>
<script setup lang="ts">
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
import { dateFormatter3 } from '@/utils/formatTime'
import { dateFormatter } from '@/utils/formatTime'
import { getDictLabel, DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import download from '@/utils/download'
import { TaskInfoApi, TaskInfoVO } from '@/api/system/taskinfo'
import TaskInfoForm from './TaskInfoForm.vue'
import { TagLibraryApi } from '@/api/system/taglibrary'
/** 任务表,用于存储所有的任务信息,任务可由不同用户创建并管理。 列表 */
defineOptions({ name: 'TaskList' })
@ -243,7 +163,7 @@ const { push } = useRouter()
const loading = ref(true) //
const list = ref<TaskInfoVO[]>([]) //
const total = ref(0) //
const taskTypeMap=ref()
const taskTypeMap = ref()
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
@ -261,12 +181,15 @@ const queryParams = reactive({
parentId: undefined,
parentType: undefined,
taskStep: undefined,
taskTotal: undefined
taskTotal: undefined,
selectWeek: undefined
})
const queryFormRef = ref() //
const exportLoading = ref(false) //
const taskTypeList:any = ref([])
const taskTypeList: any = ref([])
const mydateFormatter3 = () => {}
/** 查询列表 */
const getList = async () => {
@ -278,12 +201,12 @@ const getList = async () => {
//
const params = {
tagType: 2
tagType: 2,
pageSize: -1
}
const tag = await TagLibraryApi.getTagLibraryPage(params)
taskTypeList.value = tag[0].children
taskTypeList.value = tag.list
} finally {
loading.value = false
}
@ -291,7 +214,6 @@ const getList = async () => {
//
const taskExec = async (data) => {
loading.value = true
try {
@ -300,7 +222,6 @@ const taskExec = async (data) => {
getList()
} finally {
loading.value = false
}
}
@ -359,14 +280,11 @@ onMounted(() => {
})
</script>
<style scoped lang="scss">
.formClass {
display: grid;
grid-template-columns: 1fr 1fr 1fr 2fr;
grid-template-rows: 1fr;
align-items: center;
:deep(.el-form-item) {
margin: 0 !important;
}
::v-deep(.el-form-item) {
width: calc(25% - 15px);
&:last-child {
margin-left: auto;
width: fit-content;
}
}
</style>

2
vite.config.ts

@ -27,7 +27,7 @@ export default ({command, mode}: ConfigEnv): UserConfig => {
// 服务端渲染
server: {
port: env.VITE_PORT, // 端口号
host: "0.0.0.0",
// host: "0.0.0.0",
open: env.VITE_OPEN === 'true',
// 本地跨域代理. 目前注释的原因:暂时没有用途,server 端已经支持跨域
// proxy: {

Loading…
Cancel
Save