Browse Source

Merge remote-tracking branch 'origin/master'

master
parent
commit
4a01397432
  1. 52
      src/api/airqualitycollection/index.ts
  2. 3
      src/api/enterprises/index.ts
  3. 1
      src/api/system/user/index.ts
  4. 1
      src/config/axios/service.ts
  5. 1
      src/utils/dict.ts
  6. 159
      src/views/airqualitycollection/QualityCollectionForm.vue
  7. 259
      src/views/airqualitycollection/index.vue
  8. 2
      src/views/enterpriseinspections/index.vue
  9. 30
      src/views/enterprises/index.vue
  10. 2
      src/views/enterprises/update.vue
  11. 47
      src/views/qualification/index.vue
  12. 17
      src/views/system/user/UserForm.vue
  13. 4
      src/views/system/user/index.vue
  14. 745
      src/views/task/create copy 2.vue
  15. 134
      src/views/task/create copy.vue
  16. 6
      src/views/task/createEnterprise.vue
  17. 397
      src/views/task/createEnterprise2.vue
  18. 66
      src/views/task/index.vue

52
src/api/airqualitycollection/index.ts

@ -0,0 +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 })
},
}

3
src/api/enterprises/index.ts

@ -17,7 +17,8 @@ export interface EnterprisesVO {
establishmentDate: Date // 企业成立时间
gpsLocation: string // 企业经纬度
signRadius:string//签到半径
managerDeptId: number // 管理部门
managerDeptId: number, // 管理部门
tagList: any
}
// 企业 API

1
src/api/system/user/index.ts

@ -16,6 +16,7 @@ export interface UserVO {
remark: string
loginDate: Date
createTime: Date
area: string
}

1
src/config/axios/service.ts

@ -12,6 +12,7 @@ import { deleteUserCache } from '@/hooks/web/useCache'
const tenantEnable = import.meta.env.VITE_APP_TENANT_ENABLE
const { result_code, base_url, request_timeout } = config
// 需要忽略的提示。忽略后,自动 Promise.reject('error')
const ignoreMsgs = [
'无效的刷新令牌', // 刷新令牌被删除时,不用提示

1
src/utils/dict.ts

@ -144,6 +144,7 @@ export enum DICT_TYPE {
TASK_EXEC_TIME = 'task_exec_time',
TASK_STATE = 'task_state',
INSPECTIONS_STATUS = 'Inspections_status',
AIR_COLLECTION_TYPE = 'air_collection_type',
// ========== INFRA 模块 ==========
INFRA_BOOLEAN_STRING = 'infra_boolean_string',
INFRA_JOB_STATUS = 'infra_job_status',

159
src/views/airqualitycollection/QualityCollectionForm.vue

@ -0,0 +1,159 @@
<template>
<Dialog :title="dialogTitle" v-model="dialogVisible">
<el-form
ref="formRef"
:model="formData"
:rules="formRules"
label-width="100px"
v-loading="formLoading"
>
<el-form-item label="站点名称" prop="siteName">
<el-input v-model="formData.siteName" placeholder="请输入站点名称" />
</el-form-item>
<el-form-item label="城市" prop="city">
<el-input v-model="formData.city" placeholder="请输入城市" />
</el-form-item>
<el-form-item label="数据类型" prop="type">
<el-select v-model="formData.type" placeholder="请选择数据类型">
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.AIR_COLLECTION_TYPE)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="PM2.s(ugim3)" prop="pm25">
<el-input v-model="formData.pm25" placeholder="请输入PM2.s(ugim3)" />
</el-form-item>
<el-form-item label="PMo(ug/m3" prop="pm10">
<el-input v-model="formData.pm10" placeholder="请输入PMo(ug/m3" />
</el-form-item>
<el-form-item label="sOz(ug/m3)" prop="so2">
<el-input v-model="formData.so2" placeholder="请输入sOz(ug/m3)" />
</el-form-item>
<el-form-item label="NOz(ug/m3)" prop="no2">
<el-input v-model="formData.no2" placeholder="请输入NOz(ug/m3)" />
</el-form-item>
<el-form-item label="NO(Hg/m3)" prop="no">
<el-input v-model="formData.no" placeholder="请输入NO(Hg/m3)" />
</el-form-item>
<el-form-item label="NOx(Hg/m3)" prop="nOx">
<el-input v-model="formData.nOx" placeholder="请输入NOx(Hg/m3)" />
</el-form-item>
<el-form-item label="CO(mg/m3)" prop="co">
<el-input v-model="formData.co" placeholder="请输入CO(mg/m3)" />
</el-form-item>
<el-form-item label="0з(ug/m3)" prop="o3">
<el-input v-model="formData.o3" placeholder="请输入0з(ug/m3)" />
</el-form-item>
<el-form-item label="备用1" prop="remark">
<el-input v-model="formData.remark" placeholder="请输入备用1" />
</el-form-item>
<el-form-item label="备用2" prop="remark2">
<el-input v-model="formData.remark2" placeholder="请输入备用2" />
</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 { QualityCollectionApi, QualityCollectionVO } from '@/api/airqualitycollection'
/** 空气质量采集 表单 */
defineOptions({ name: 'QualityCollectionForm' })
const { t } = useI18n() //
const message = useMessage() //
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
const formType = ref('') // create - update -
const formData = ref({
id: undefined,
siteName: undefined,
city: undefined,
type: undefined,
pm25: undefined,
pm10: undefined,
so2: undefined,
no2: undefined,
no: undefined,
nOx: undefined,
co: undefined,
o3: undefined,
remark: undefined,
remark2: undefined,
})
const formRules = reactive({
})
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 QualityCollectionApi.getQualityCollection(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 QualityCollectionVO
if (formType.value === 'create') {
await QualityCollectionApi.createQualityCollection(data)
message.success(t('common.createSuccess'))
} else {
await QualityCollectionApi.updateQualityCollection(data)
message.success(t('common.updateSuccess'))
}
dialogVisible.value = false
//
emit('success')
} finally {
formLoading.value = false
}
}
/** 重置表单 */
const resetForm = () => {
formData.value = {
id: undefined,
siteName: undefined,
city: undefined,
type: undefined,
pm25: undefined,
pm10: undefined,
so2: undefined,
no2: undefined,
no: undefined,
nOx: undefined,
co: undefined,
o3: undefined,
remark: undefined,
remark2: undefined,
}
formRef.value?.resetFields()
}
</script>

259
src/views/airqualitycollection/index.vue

@ -0,0 +1,259 @@
<template>
<!-- 列表 -->
<ContentWrap>
<div class="tabs">
<el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
<el-tab-pane
v-for="dict in getIntDictOptions(DICT_TYPE.AIR_COLLECTION_TYPE)"
:key="dict.value"
:label="dict.label"
:name="dict.value"
>
<el-form
:model="queryParams"
ref="queryFormRef"
:inline="true"
size="large"
label-width="68px"
label-position="right"
>
<el-form-item label="站点" prop="siteName">
<el-input
v-model="queryParams.siteName"
placeholder="请输入站点名称"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="时间" prop="createTime">
<el-date-picker
v-model="queryParams.createTime"
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: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>
</el-form-item>
</el-form>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<template #empty>
<el-empty description="暂无数据" />
</template>
<el-table-column label="站点名称" align="center" prop="siteName" />
<el-table-column
label="时间"
align="center"
prop="createTime"
:formatter="dateFormatter"
width="180px"
:cell-style="{ borderBottom: '1px solid #EBEEF5' }"
:header-cell-style="{
borderBottom: '1px solid #EBEEF5',
backgroundColor: '#F5F7FA'
}"
/>
<el-table-column label="数据类型" align="center" prop="type">
<template #default="scope">
<dict-tag :type="DICT_TYPE.AIR_COLLECTION_TYPE" :value="scope.row.type" />
</template>
</el-table-column>
<el-table-column label="PM2.s(ugim3)" align="center" prop="pm25" />
<el-table-column label="PMo(ug/m3)" align="center" prop="pm10" />
<el-table-column label="sOz(ug/m3)" align="center" prop="so2" />
<el-table-column label="NOz(ug/m3)" align="center" prop="no2" />
<el-table-column label="NO(Hg/m3)" align="center" prop="no" />
<el-table-column label="NOx(Hg/m3)" align="center" prop="nOx" />
<el-table-column label="CO(mg/m3)" align="center" prop="co" />
<el-table-column label="0з(ug/m3)" align="center" prop="o3" />
<!-- <el-table-column label="操作" align="center" min-width="120px">
<template #default="scope">
<el-button
link
type="primary"
@click="openForm('update', scope.row.id)"
v-hasPermi="['system:quality-collection:update']"
>
编辑
</el-button>
<el-button
link
type="danger"
@click="handleDelete(scope.row.id)"
v-hasPermi="['system:quality-collection:delete']"
>
删除
</el-button>
</template>
</el-table-column> -->
</el-table>
<!-- 分页 -->
<Pagination
:total="total"
v-model:page="queryParams.pageNo"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
</el-tab-pane>
</el-tabs>
</div>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<QualityCollectionForm 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 { QualityCollectionApi, QualityCollectionVO } from '@/api/airqualitycollection'
import QualityCollectionForm from './QualityCollectionForm.vue'
const activeName = ref(1)
/** 空气质量采集 列表 */
defineOptions({ name: 'QualityCollection' })
const message = useMessage() //
const { t } = useI18n() //
const loading = ref(true) //
const list = ref<QualityCollectionVO[]>([]) //
const total = ref(0) //
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
siteName: undefined,
city: undefined,
type: undefined,
pm25: undefined,
pm10: undefined,
so2: undefined,
no2: undefined,
no: undefined,
nOx: undefined,
co: undefined,
o3: undefined,
remark: undefined,
remark2: undefined,
createTime: [],
})
const queryFormRef = ref() //
const exportLoading = ref(false) //
/** 查询列表 */
const getList = async () => {
loading.value = true
try {
const data = await QualityCollectionApi.getQualityCollectionPage(queryParams)
list.value = data.list
total.value = data.total
} finally {
loading.value = false
}
}
const handleClick = (tab: TabsPaneContext, event: Event) => {
console.log(tab, event)
}
/** 搜索按钮操作 */
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 QualityCollectionApi.deleteQualityCollection(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
}
/** 导出按钮操作 */
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await QualityCollectionApi.exportQualityCollection(queryParams)
download.excel(data, '空气质量采集.xls')
} catch {
} finally {
exportLoading.value = false
}
}
/** 初始化 **/
onMounted(() => {
getList()
})
</script>
<style>
.tabs {
display: flex;
flex-direction: column;
::v-deep(.el-form-item__label) {
display: inline-flex;
}
}
.demo-tabs > .el-tabs__content {
color: #6b778c;
font-size: 32px;
font-weight: 600;
}
</style>

2
src/views/enterpriseinspections/index.vue

@ -1,5 +1,5 @@
<template>
<ContentWrap>
<ContentWrap style="align-items: center; display: flex; padding: 25px 20px;">
<!-- 搜索工作栏 -->
<el-form
class="-mb-15px"

30
src/views/enterprises/index.vue

@ -2,11 +2,12 @@
<ContentWrap>
<!-- 搜索工作栏 -->
<el-form
class="-mb-15px"
:model="queryParams"
ref="queryFormRef"
:inline="true"
label-width="108px"
size="large"
class="formClass"
>
<el-form-item label="企业名称" prop="enterprisesName">
<el-input
@ -14,7 +15,6 @@
placeholder="请输入企业名称"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<!-- <el-form-item label="邀请人" prop="userId">-->
@ -42,7 +42,7 @@
/>
</el-select>
</el-form-item>
<el-form-item label="企业所属区域" prop="region">
<el-form-item label="所属区域" prop="region">
<el-select
v-model="queryParams.region"
placeholder="请选择企业所属区域"
@ -67,7 +67,7 @@
class="!w-240px"
/>
</el-form-item>
<el-form-item label="企业成立时间" prop="establishmentDate">
<el-form-item label="成立时间" prop="establishmentDate">
<el-date-picker
v-model="queryParams.establishmentDate"
value-format="YYYY-MM-DD HH:mm:ss"
@ -94,7 +94,7 @@
/>
</el-select>
</el-form-item>
<el-form-item>
<el-form-item class="btnClass">
<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="
@ -120,7 +120,7 @@
<!-- 列表 -->
<ContentWrap>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true" :cell-style="{'text-align': 'left'}">
<el-table-column label="企业名称" align="center" fixed="left" prop="enterprisesName" />
<el-table-column label="专管员" align="center" prop="inviterName" fixed="left" />
<el-table-column label="企业类型" align="center" prop="type" fixed="left" >
@ -309,3 +309,21 @@ onMounted(() => {
getList()
})
</script>
<style lang="css" >
:deep(.el-card__body) {
padding: 0 !important;
}
.formClass {
display: grid;
grid-template-columns: 1fr 1fr 1fr 1fr;
grid-template-rows: 1fr 1fr;
align-items: center;
:deep(.el-form-item) {
margin: 0 !important;
}
.btnClass {
grid-column: span 2;
}
}
</style>

2
src/views/enterprises/update.vue

@ -188,7 +188,7 @@
</el-table>
</el-card>
<!-- 表单弹窗添加/修改 -->
<EnterpriseQualificationForm ref="formQualRef" @success="getQualificationList" />
<EnterpriseQualificationForm ref="formQualRef" @success="getQualificationList" style="margin-top: 20px;"/>
<ContentWrap title="执法记录" v-if="formType === 'update'">
<div class="demo-collapse">
<el-collapse v-model="activeNames" @change="handleChange">

47
src/views/qualification/index.vue

@ -7,17 +7,32 @@
ref="queryFormRef"
:inline="true"
label-width="98px"
size="large"
>
<el-form-item label="资质名称" prop="qualificationName">
<el-form-item label="企业名称" prop="qualificationName">
<el-input
v-model="queryParams.qualificationName"
placeholder="请输入资质名称,例如:排污许可证、环保合格证"
v-model="queryParams.enterpriseName"
placeholder="请输入企业名称"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="资质名称" prop="qualificationName" >
<el-select
v-model="queryParams.qualificationName"
placeholder="请选择资质名称"
clearable
class="!w-240px"
>
<el-option
v-for="dict in getStrDictOptions(DICT_TYPE.ENTERPRISES_QUA)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="资质到期日期" prop="expiryDate">
<el-date-picker
v-model="queryParams.expiryDate"
@ -29,27 +44,6 @@
class="!w-220px"
/>
</el-form-item>
<el-form-item label="办理日期" prop="handleDate">
<el-date-picker
v-model="queryParams.handleDate"
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 label="资质编号" prop="enterpriseAuth">
<el-input
v-model="queryParams.enterpriseAuth"
placeholder="请输入资质编号"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</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>
@ -125,7 +119,7 @@ import { dateFormatter,dateFormatter2 } from '@/utils/formatTime'
import download from '@/utils/download'
import { EnterpriseQualificationApi, EnterpriseQualificationVO } from '@/api/qualification'
import EnterpriseQualificationForm from './EnterpriseQualificationForm.vue'
import {DICT_TYPE} from "@/utils/dict";
import {DICT_TYPE, getStrDictOptions} from "@/utils/dict";
/** 企业资质 列表 */
defineOptions({ name: 'EnterpriseQualification' })
@ -141,6 +135,7 @@ const queryParams = reactive({
pageSize: 10,
enterpriseId: undefined,
qualificationName: undefined,
enterpriseName: undefined,
expiryDate: [],
qualificationDescription: undefined,
createTime: [],

17
src/views/system/user/UserForm.vue

@ -26,6 +26,18 @@
node-key="id"
placeholder="请选择归属部门"
/>
</el-form-item>
<el-form-item label="管理区域" prop="deptId">
<el-select v-model="formData.area" placeholder="请选择" multiple>
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.ENTERPRISES_AREA)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
@ -129,7 +141,8 @@ const formData = ref({
postIds: [],
remark: '',
status: CommonStatusEnum.ENABLE,
roleIds: []
roleIds: [],
area: undefined
})
const formRules = reactive<FormRules>({
username: [{ required: true, message: '用户名称不能为空', trigger: 'blur' }],
@ -185,8 +198,10 @@ const submitForm = async () => {
if (!valid) return
//
formLoading.value = true
try {
const data = formData.value as unknown as UserApi.UserVO
if (formType.value === 'create') {
await UserApi.createUser(data)
message.success(t('common.createSuccess'))

4
src/views/system/user/index.vue

@ -18,7 +18,7 @@
>
<el-form-item label="用户名称" prop="username">
<el-input
v-model="queryParams.username"
v-model="queryParams.realName"
placeholder="请输入用户名称"
clearable
@keyup.enter="handleQuery"
@ -236,7 +236,7 @@ const list = ref([]) // 列表的数
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
username: undefined,
realName: undefined,
mobile: undefined,
status: undefined,
deptId: undefined,

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

@ -0,0 +1,745 @@
<template>
<div class="container">
<div class="wrapper">
<div class="title">基本信息</div>
<div class="box">
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="auto" class="formClass" size="large">
<el-form-item label="任务标题" prop="title">
<el-input v-model="formData.title" placeholder="请输入任务标题" />
</el-form-item>
<el-form-item label="时间周期" prop="planTime">
<el-date-picker
v-model="formData.planTime"
type="daterange"
format="YYYY年MM月DD日"
range-separator="至"
size="large"
start-placeholder="选择开始时间"
end-placeholder="选择结束时间"
value-format="YYYY-MM-DD"
/>
</el-form-item>
<el-form-item label="描述" prop="description" style="width: 100%; padding: 0; margin-top: 0px;" class="descClass">
<el-input
type="textarea"
v-model="formData.description"
:autosize="{
minRows: 5
}"
placeholder="请输入描述"
/>
</el-form-item>
<el-form-item label="任务类型" prop="taskTopType">
<el-select v-model="formData.taskTopType" placeholder="请选择任务优先级" size="large" @change="selectChild">
<el-option
v-for="dict in taskTagTopList"
:key="dict.id"
:label="dict.tagName"
:value="dict.id"
/>
</el-select>
</el-form-item>
<!-- <el-form-item label="执行周期" prop="execCycle" v-if="formData.taskType == 2">
<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="taskType">
<el-select v-model="formData.taskType" placeholder="请选择任务选项" >
<el-option
v-for="dict in tagChildList"
:key="dict.id"
:label="dict.tagName"
:value="dict.id"
/>
</el-select>
</el-form-item>
</el-form>
</div>
</div>
<div class="wrapper-down">
<div class="title">执法范围</div>
<div class="box">
<div>
<el-select
v-model="enterprise.queryParams.qy"
placeholder="请选择所属区域"
clearable
size="large"
>
<el-option
v-for="dict in getStrDictOptions(DICT_TYPE.ENTERPRISES_AREA)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
<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.hy"
placeholder="请选择行业"
clearable
size="large"
>
<el-option
v-for="dict in hyList"
:key="dict.id"
:label="dict.tagName"
:value="dict.tagName"
/>
</el-select>
<el-input
v-model="enterprise.queryParams.enterprisesName"
placeholder="请输入企业名称" size="large"
/>
</div>
<div>
<el-select
v-model="enterprise.queryParams.st"
placeholder="请选择生态" size="large"
>
<el-option
v-for="dict in stList"
:key="dict.id"
:label="dict.tagName"
:value="dict.id"
/>
</el-select>
<div class="btn">
<el-button type="primary" plain size="large" @click="handleQuery">
<Icon icon="ep:search" class="mr-5px" /> 查询
</el-button>
<el-button @click="resetQuery" class="mr-10px" type="primary" plain size="large">
<Icon icon="ep:refresh" class="mr-5px" /> 重置
</el-button>
</div>
</div>
<div>
<el-select
v-model="enterprise.queryParams.wr"
placeholder="请选择污染程度"
size="large"
>
<el-option
v-for="dict in wrList"
:key="dict.id"
:label="dict.tagName"
:value="dict.id"
/>
</el-select>
<div class="btn2">
<el-button @click="insertEnterprise" type="primary" size="large">
<el-icon><Sort /></el-icon> &nbsp;
</el-button>
</div>
</div>
</div>
<div class="table">
<el-table
ref="multipleTableRef"
@selection-change="handleSelectionChange"
:data="paginatedData"
row-key="id"
:cell-style="{'text-align': 'left'}"
:header-cell-style="{
borderBottom: '1px solid #EBEEF5',
backgroundColor: '#F5F7FA'
}"
>
<template #empty>
<el-empty description="暂无数据" />
</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="区域">
<template #default="scope">
{{
getStrDictOptions(DICT_TYPE.ENTERPRISES_AREA).find(
(dict) => dict.value == scope.row.region
)?.label || '未知区域'
}}
</template>
</el-table-column>
<el-table-column property="enterprisesName" label="行业">
<template #default="scope">
{{
scope.row.tagListName &&
scope.row.tagListName
.filter((item) => item.value == 1)
.map((item) => item.label)
.join(', ')
}}
</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="类型">
<template #default="scope">
{{
scope.row.tagListName &&
scope.row.tagListName
.filter((item) => item.value == 4)
.map((item) => item.label)
.join(', ')
}}
</template>
</el-table-column>
<el-table-column property="inviterName" label="执法人员" min-width="100" />
<el-table-column label="操作" align="center" min-width="80px">
<template #default="scope">
<el-button
link
type="primary"
@click="handleDelete(scope.row.id)"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
<div class="page">
<div class="selected">已选择 {{ selectedEnterprises.length }} / {{ enterprise.total }}
<el-button
link
type="primary"
@click="deletedSelected"
v-show="selectedEnterprises.length > 0"
>
删除所选
</el-button>
</div>
<div class="page-item">
<el-pagination
:total="enterprise.total"
:show-page-size="false"
size="small"
layout="total, prev, pager, next"
v-model:current-page="enterprise.queryParams.pageNo"
v-model:page-size="enterprise.queryParams.pageSize"
class="page"
/>
</div>
</div>
</div>
<div class="footer">
<el-button type="primary" @click="submitForm" size="large">发布任务</el-button>
<el-button @click="goBack" size="large">返回列表</el-button>
<el-button
type="warning"
v-if="showButton"
@click="submitForm"
size="large"
v-hasPermi="['system:enterprise-inspections:audit']"
>审核通过</el-button
>
<el-button
type="danger"
@click="submitForm"
v-if="showButton"
size="large"
v-hasPermi="['system:enterprise-inspections:audit']"
>删除</el-button
>
</div>
</div>
</div>
<CreateEnterprise ref="formCreateRef" @success="getList" />
</template>
<script setup lang="ts">
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
import { TagLibraryApi } from '@/api/system/taglibrary'
import { EnterprisesVO } from '@/api/enterprises'
import { TaskInfoApi } from '@/api/system/taskinfo'
import { useTagsViewStore } from '@/store/modules/tagsView'
import CreateEnterprise from './createEnterprise2.vue'
import { cloneDeep } from 'lodash-es';
import { getSimpleUserZGList } from '@/api/system/user'
defineOptions({ name: 'CreateTask'})
const formData = ref({
id: undefined,
title: undefined,
description: undefined,
execCycle: undefined,
taskType: undefined,
taskTopType: undefined,
priority: undefined,
status: undefined,
startDate: undefined,
endDate: undefined,
createBy: undefined,
updateBy: undefined,
parentId: undefined,
parentType: undefined,
taskStep: undefined,
taskTotal: undefined,
planTime: [] as any,
tags: [],
enterprises: [] as any
})
const router = useRouter()
const route = useRoute()
const tagView = useTagsViewStore()
const formCreateRef = ref()
const message = useMessage() //
const formRules = reactive({
title: [{ required: true, message: '任务标题不能为空', trigger: 'blur' }],
taskTopType: [
{
required: true,
message: '任务类型不能为空',
trigger: 'change'
}
],
taskType: [
{
required: true,
message: '类型不能为空',
trigger: 'change'
}
],
planTime: [{ required: true, message: '时间周期不能为空', trigger: 'blur' }]
})
const { query } = useRoute()
const formRef = ref() // Ref`
const tagList = ref([])
const queryFormRef = ref() //
const enterprise = ref({
list: [] as any,
queryParams: reactive({
pageNo: 1,
pageSize: 10,
enterprisesName: undefined,
qy: undefined,
hy: undefined,
st: undefined,
wr: undefined,
inviterName: undefined,
userId: undefined,
tagList: []
}),
total: ref(0) as any
})
const goBack = () => {
router.go(-1); // router.back()
};
//
const paginatedData = computed(() => {
const start = (enterprise.value.queryParams.pageNo -1) * enterprise.value.queryParams.pageSize
const end = enterprise.value.queryParams.pageNo * enterprise.value.queryParams.pageSize
return enterprise.value.list.slice(start, end); // :ml-citation{ref="1,4" data="citationList"}
});
//
const deletedSelected = async () => {
await message.delConfirm()
selectedEnterprises.value.forEach(item=> {
deleteHandle(item.id)
})
}
const selectedEnterprises = ref<EnterprisesVO[]>([])
const handleSelectionChange = (selectedItems: EnterprisesVO[]) => {
selectedEnterprises.value = selectedItems
}
const handleDelete = async (id: number) => {
//
await message.delConfirm()
//
deleteHandle(id)
}
const deleteHandle = (id: number) => {
const targetIndex = enterprise.value.list.findIndex(item => item.id === id);
if (targetIndex === -1) return;
//
enterprise.value.list.splice(targetIndex, 1);
enterprise_copy.value = cloneDeep(enterprise.value);
enterprise.value.total = enterprise.value.list.length
//
const { pageNo, pageSize } = enterprise.value.queryParams;
const itemsOnCurrentPage = enterprise.value.list.slice(
(pageNo - 1) * pageSize,
pageNo * pageSize
);
if (itemsOnCurrentPage.length === 0 && pageNo > 1) {
enterprise.value.queryParams.pageNo = pageNo - 1;
}
}
const enterprise_copy = ref({
list: [] as any,
queryParams: reactive({
pageNo: 1,
pageSize: 10,
enterprisesName: undefined,
qy: undefined,
hy: undefined,
st: undefined,
wr: undefined,
userId: undefined
}),
total: ref(0) as any
})
const userList:any = ref()
//
const isAllConditionsEmpty = computed(() => {
const params = enterprise.value.queryParams;
return (
!params.enterprisesName &&
!params.qy &&
!params.hy &&
!params.st &&
!params.wr &&
!params.userId
);
});
/** 搜索按钮操作 */
const handleQuery = () => {
const list = filterList(enterprise.value.list)
enterprise.value.list = list
enterprise.value.total = list?.length
}
//
const filterList = (list: EnterprisesVO[]) => {
if (isAllConditionsEmpty.value) return enterprise_copy.value.list; //
if (list.length > 0) {
const { enterprisesName, qy, hy, st, wr , userId } = enterprise.value.queryParams;
return list.filter(item => {
//
const nameMatch = enterprisesName ?
item.enterprisesName?.toLowerCase().includes(enterprisesName.toLowerCase()) : true;
//
const typeMatch = qy ? item.region == qy : true;
//
const hyMatch = hy ? item.tagList.includes(hy) : true
const stMatch = st ? item.tagList.includes(st) : true
const wrMatch = wr ? item.tagList.includes(wr) : true
const userIdMatch = userId ? item.userId == userId : true
//
// const regNumMatch = registrationNumber ?
// item.registrationNumber === registrationNumber : true;
// // ID
// const idMatch = id !== undefined ? item.id === id : true;
return nameMatch && typeMatch && hyMatch && stMatch && wrMatch && userIdMatch;
});
}
}
const insertEnterprise = () => {
formCreateRef.value.open()
}
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value.resetFields()
handleQuery()
}
//
const hyList:any = ref([])
//
const stList:any = ref([])
//
const wrList:any = ref([])
/**
* 获取标签列表
*/
async function getTagList() {
const codeList = 'codeList=hy&codeList=st&codeList=wr'
const data = await TagLibraryApi.tagLibraryList(codeList)
hyList.value = data[0].children
stList.value = data[1].children
wrList.value = data[2].children
}
const defaultProps = {
label: 'tagName', // 使 'name'
children: 'children' // 使 'children'
}
/**
* 数组去重
* @param arr
* @param uniId 唯一id
* @returns
*/
function uniqueFunc(arr, uniId) {
const res = new Map()
return arr.filter((item) => !res.has(item[uniId]) && res.set(item[uniId], 1))
}
/**
* 提交表单
*/
async function submitForm() {
const validate = await unref(formRef).validate()
if (validate) {
// id
const data = JSON.parse(JSON.stringify(formData.value))
enterprise.value.list
//1
data.status = 1
if (enterprise.value.list.length == 0) {
message.success('温馨提示:请您选择执法对象')
} else {
if (data.status < 2) {
data.startDate = data.planTime[0]
data.endDate = data.planTime[1]
data.enterpriseIds = enterprise.value.list.map(i=>i.id)
if (data.id) {
TaskInfoApi.updateTaskInfo(data).then(() => {
message.success('操作成功')
tagView.delView(route)
router.go(-1)
})
} else {
TaskInfoApi.createTaskInfo(data).then(() => {
message.success('操作成功')
tagView.delView(route)
router.go(-1)
})
}
} else {
message.success('温馨提示:该任务已经执行,无法再进行修改')
}
}
}
}
//
const taskTagTopList:any = ref([])
//
const tagChildList:any = ref([])
async function taskTopQuery() {
const params = {
tagType: 2
}
const data = await TagLibraryApi.getTagLibraryPage(params)
taskTagTopList.value = data
}
const showButton = ref(false)
async function init() {
//
const userData = await getSimpleUserZGList()
userList.value = userData
//
taskTopQuery()
if (query.id) {
showButton.value = true
const res= await TaskInfoApi.getTaskInfo(query.id)
formData.value = res
//
const tag = await TagLibraryApi.getTagLibrary(res.taskType)
formData.value.taskTopType = tag.parentId
selectChild(tag.parentId)
formData.value.taskType = tag.id
formData.value.planTime = [formData.value.startDate, formData.value.endDate]
formData.value.enterprises = res.enterpriseIdes
formData.value.tags = res.taskTagIdes.map((t) => t.tagId)
enterprise.value.list = res.enterpriseIdes
enterprise.value.total = res.enterpriseIdes.length
}
}
const selectChild = (value: any) => {
const data = taskTagTopList.value.find(item=>item.id == value)
tagChildList.value = data.children
}
function getList(data) {
enterprise.value.list.push(...data)
//
enterprise.value.list = uniqueFunc(enterprise.value.list, 'id')
enterprise.value.total = enterprise.value.list.length
enterprise_copy.value = cloneDeep(enterprise.value);
}
getTagList()
onMounted(() => {
init()
})
</script>
<style scoped lang="scss">
.error-border .el-input__wrapper { /* 错误状态边框 */
box-shadow: 0 0 0 1px var(--el-color-danger) inset;
}
.container {
display: flex;
flex-direction: column;
gap: 20px;
max-width: 100%;
.wrapper {
display: flex;
flex-direction: column;
padding: 40px;
gap: 40px;
background-color: white;
.title {
font-weight: bold;
font-size: 20px;
}
.box {
display: flex;
gap: 40px;
.formClass {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-template-rows: repeat(2, 1fr);
align-items: center;
gap: 20px;
width: 100%;
.descClass {
grid-row: span 2;
flex: 1 0 0;
align-self: stretch;
}
}
}
}
.wrapper-down{
display: flex;
flex-direction: column;
padding: 40px;
gap: 40px;
background-color: white;
.title {
font-weight: bold;
font-size: 20px;
}
.box {
display: flex;
gap: 20px;
div {
// background-color: rgb(206, 175, 175);
flex: 1;
display: flex;
flex-direction: column;
gap: 20px;
justify-items: center;
.btn {
display: flex;
flex-direction: row;
align-items: center;
}
.btn2 {
display: flex;
align-items: flex-end;
justify-content: center;
}
}
}
.table {
margin-top: -20px;
display: flex;
flex-direction: column;
gap: 20px;
.page{
display: flex;
flex-direction: row;
justify-content: space-between;
font-size: 14px;
}
}
.footer {
text-align: center;
}
}
}
</style>

134
src/views/task/create copy.vue

@ -14,8 +14,8 @@
format="YYYY年MM月DD日"
range-separator="至"
size="large"
start-placeholder="选择任务计划开始时间"
end-placeholder="选择任务计划结束时间"
start-placeholder="选择开始时间"
end-placeholder="选择结束时间"
value-format="YYYY-MM-DD"
/>
</el-form-item>
@ -24,23 +24,22 @@
type="textarea"
v-model="formData.description"
:autosize="{
minRows: 4
minRows: 5
}"
placeholder="请输入描述"
/>
</el-form-item>
<el-form-item label="任务类型" prop="taskType">
<el-tree-select
v-model="formData.taskType"
:data="tagList"
:props="defaultProps"
check-strictly
node-key="id"
size="large"
placeholder="请选择任务类型"
/>
<el-select v-model="formData.taskTopType" placeholder="请选择任务优先级" size="large" @change="selectChild">
<el-option
v-for="dict in taskTagTopList"
:key="dict.id"
:label="dict.tagName"
:value="dict.id"
/>
</el-select>
</el-form-item>
<el-form-item label="执行周期" prop="execCycle" v-if="formData.taskType == 2">
<!-- <el-form-item label="执行周期" prop="execCycle" v-if="formData.taskType == 2">
<el-select v-model="formData.execCycle" placeholder="请选择执行周期">
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.TASK_EXEC_TIME)"
@ -49,14 +48,14 @@
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-form-item> -->
<el-form-item label="类型选项" prop="priority">
<el-select v-model="formData.priority" placeholder="请选择任务优先级" size="large">
<el-select v-model="formData.taskType" placeholder="请选择任务选项" >
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.TASK_PRIORITY)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
v-for="dict in tagChildList"
:key="dict.id"
:label="dict.tagName"
:value="dict.id"
/>
</el-select>
</el-form-item>
@ -149,10 +148,10 @@
/>
</el-form-item>
<el-form-item class="form-item">
<el-button @click="handleQuery">
<Icon icon="ep:search" class="mr-5px" /> 搜索
<el-button type="primary" plain>
<Icon icon="ep:search" class="mr-5px" /> 查询
</el-button>
<el-button @click="resetQuery" class="mr-10px">
<el-button @click="resetQuery" class="mr-10px" type="primary" plain>
<Icon icon="ep:refresh" class="mr-5px" /> 重置
</el-button>
</el-form-item>
@ -175,10 +174,7 @@
}"
>
<template #empty>
<div class="no-data">
<el-image src="/src/assets/imgs/no_data.png" style="width: 120px" />
<p>暂无数据</p>
</div>
<el-empty description="暂无数据" />
</template>
<el-table-column type="selection" width="30" />
<el-table-column property="enterprisesName" label="企业名称" min-width="100" />
@ -264,8 +260,8 @@
</section>
<div class="footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="submitForm">返回列表</el-button>
<el-button type="primary" @click="submitForm" size="large">创建任务</el-button>
<el-button @click="submitForm" size="large">返回列表</el-button>
<el-button
type="primary"
@click="submitForm"
@ -324,13 +320,13 @@ const formCreateRef = ref()
const message = useMessage() //
const formRules = reactive({
title: [{ required: true, message: '任务标题不能为空', trigger: 'blur' }],
taskType: [
{
required: true,
message: '任务类型不能为空',
trigger: 'change'
}
],
// taskType: [
// {
// required: true,
// message: '',
// trigger: 'change'
// }
// ],
planTime: [{ required: true, message: '时间周期不能为空', trigger: 'blur' }]
})
const { query } = useRoute()
@ -545,45 +541,73 @@ async function submitForm() {
const validate = await unref(formRef).validate()
if (validate) {
const data = JSON.parse(JSON.stringify(formData.value))
enterprise.value.list
//1
data.status = 1
console.log('任务类型:', formData.value.taskType)
data.enterpriseIds = formData.value.enterprises.map((i) => i.id)
// data.enterpriseIds = formData.value.enterprises.map((i) => i.id)
if (data.enterpriseIds.length == 0) {
if (enterprise.value.list.length == 0) {
message.success('温馨提示:请您选择执法对象')
} else {
if (data.status < 2) {
data.startDate = data.planTime[0]
data.endDate = data.planTime[1]
data.enterpriseIds = enterprise.value.list.map(i=>i.id)
console.log('data', data)
// if (data.id) {
// TaskInfoApi.updateTaskInfo(data).then(() => {
// message.success('')
// tagView.delView(route)
// router.go(-1)
// })
// } else {
// TaskInfoApi.createTaskInfo(data).then(() => {
// message.success('')
// tagView.delView(route)
// router.go(-1)
// })
// }
if (data.id) {
TaskInfoApi.updateTaskInfo(data).then(() => {
message.success('操作成功')
tagView.delView(route)
router.go(-1)
})
} else {
TaskInfoApi.createTaskInfo(data).then(() => {
message.success('操作成功')
tagView.delView(route)
router.go(-1)
})
}
} else {
message.success('温馨提示:该任务已经执行,无法再进行修改')
}
}
}
}
// async function taskTopType() {
// const data = TagLibraryApi.getTagLibraryPage()
// }
//
const taskTagTopList:any = ref([])
//
const tagChildList:any = ref([])
async function taskTopQuery() {
const params = {
tagType: 2
}
const data = await TagLibraryApi.getTagLibraryPage(params)
taskTagTopList.value = data
}
async function init() {
//
const userData = await getSimpleUserZGList()
userList.value = userData
//
taskTopQuery()
if (query.id) {
TaskInfoApi.getTaskInfo(query.id).then((res) => {
formData.value = res
@ -594,6 +618,12 @@ async function init() {
}
}
const selectChild = (value: any) => {
const data = taskTagTopList.value.find(item=>item.id == value)
console.log('daratata', data.children)
tagChildList.value = data.children
}
function getList(data) {
enterprise.value.list.push(...data)
//
@ -634,6 +664,8 @@ onMounted(() => {
.descClass {
grid-row: span 2;
flex: 1 0 0;
align-self: stretch;
}
@ -762,7 +794,7 @@ onMounted(() => {
.form-container {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 24px;
gap: 20px;
margin-bottom: 20px;
}

6
src/views/task/createEnterprise.vue

@ -80,10 +80,10 @@
</el-form-item>
<el-form-item class="form-item">
<el-button @click="handleQuery">
<el-button @click="handleQuery" type="primary" plain>
<Icon icon="ep:search" class="mr-5px" /> 搜索
</el-button>
<el-button @click="resetQuery" class="mr-10px">
<el-button @click="resetQuery" class="mr-10px" type="primary" plain>
<Icon icon="ep:refresh" class="mr-5px" /> 重置
</el-button>
</el-form-item>
@ -220,7 +220,7 @@ const queryParams = ref({
})
//
const visible = ref(true) //
const visible = ref(false) //
// ... ...
//
const handleClose = () => {

397
src/views/task/createEnterprise2.vue

@ -0,0 +1,397 @@
<template>
<el-dialog
v-model="visible"
title="筛选企业"
width="1200px"
style="padding: 40px; "
:close-on-click-modal="false"
append-to-body
>
<template #header >
<span style="font-size: 20px; font-weight: bold;">筛选企业</span>
</template>
<div class="enterprise-container">
<!-- 搜索区域 -->
<div class="search-area">
<el-form
:model="enterprise.queryParams"
ref="queryFormRef"
:inline="true"
label-width="0"
size="large"
class="search-form"
>
<div class="form-container">
<el-form-item label="" prop="region" class="form-item">
<el-select v-model="enterprise.queryParams.region" placeholder="请选择所属区域" clearable>
<el-option
v-for="dict in getStrDictOptions(DICT_TYPE.ENTERPRISES_AREA)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="" prop="type" class="form-item">
<el-select v-model="enterprise.queryParams.hy" placeholder="请选择行业" clearable>
<el-option
v-for="dict in hyList"
:key="dict.id"
:label="dict.tagName"
:value="dict.id"
/>
</el-select>
</el-form-item>
<el-form-item label="" prop="region" class="form-item">
<el-select v-model="enterprise.queryParams.st" placeholder="请选择生态" clearable>
<el-option
v-for="dict in stList"
:key="dict.id"
:label="dict.tagName"
:value="dict.id"
/>
</el-select>
</el-form-item>
<el-form-item label="" prop="type" class="form-item">
<el-select v-model="enterprise.queryParams.wr" placeholder="请选择污染程度" clearable>
<el-option
v-for="dict in wrList"
:key="dict.id"
:label="dict.tagName"
:value="dict.id"
/>
</el-select>
</el-form-item>
<el-form-item label="" prop="type" class="form-item">
<el-select v-model="enterprise.queryParams.userId" placeholder="请选择执法人员" filterable clearable>
<el-option
v-for="dict in userList"
:key="dict.id"
:label="dict.deptName +'_'+ dict.realName"
:value="dict.id"
/>
</el-select>
</el-form-item>
<el-form-item label="" prop="enterprisesName" class="form-item">
<el-input v-model="enterprise.queryParams.enterprisesName" placeholder="请输入企业名称" />
</el-form-item>
<el-form-item class="form-item">
<el-button @click="handleQuery" type="primary" plain>
<Icon icon="ep:search" class="mr-5px" /> 搜索
</el-button>
<el-button @click="resetQuery" class="mr-10px" type="primary" plain>
<Icon icon="ep:refresh" class="mr-5px" /> 重置
</el-button>
</el-form-item>
</div>
</el-form>
</div>
<!-- 表格区域 -->
<el-table
ref="multipleTableRef"
:data="enterprise.list"
@select="handleSelectionChange"
@select-all="selectAll"
style="width: 100%; border: 1px solid #ebeef5"
:cell-style="{ borderBottom: '1px solid #EBEEF5', textAlign: 'left'}"
height="400px"
row-key="id"
:header-cell-style="{
borderBottom: '1px solid #EBEEF5',
backgroundColor: '#F5F7FA'
}"
>
<el-table-column type="selection" :reserve-selection="true" />
<el-table-column property="enterprisesName" label="企业名称" />
<el-table-column property="region" label="区域">
<template #default="scope">
{{
getStrDictOptions(DICT_TYPE.ENTERPRISES_AREA).find(
(dict) => dict.value == scope.row.region
)?.label || '未知区域'
}}
</template>
</el-table-column>
<el-table-column property="enterprisesName" label="行业">
<template #default="scope">
{{
scope.row.tagListName &&
scope.row.tagListName
.filter((item) => item.value == 1)
.map((item) => item.label)
.join(', ')
}}
</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="类型">
<template #default="scope">
{{
scope.row.tagListName &&
scope.row.tagListName
.filter((item) => item.value == 4)
.map((item) => item.label)
.join(', ')
}}
</template>
</el-table-column>
<el-table-column property="inviterName" label="执法人员" />
</el-table>
<!-- 分页 -->
<div class="pagination-container">
<div class="selected">已选择 {{ selectedEnterprises.length }} / {{ enterprise.total }}</div>
<el-pagination
v-show="enterprise.total > 0"
:total="enterprise.total"
:show-page-size="false"
layout="total, prev, pager, next"
size="small"
v-model:current-page="enterprise.queryParams.pageNo"
@update:current-page="getEnterPriseList"
v-model:page-size="enterprise.queryParams.pageSize"
@pagination="getEnterPriseList"
/>
</div>
<!-- 底部按钮 -->
<div class="footer">
<el-button type="primary" @click="confirmSelect">确认选择</el-button>
<el-button @click="handleClose">关闭窗口</el-button>
</div>
</div>
</el-dialog>
</template>
<script setup lang="ts">
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
import { EnterprisesApi, EnterprisesVO } from '@/api/enterprises'
import { TagLibraryVO, TagLibraryApi } from '@/api/system/taglibrary'
import { getSimpleUserZGList } from '@/api/system/user'
const loading = ref(true) //
const emit = defineEmits(['update:modelValue', 'success'])
const props = defineProps({
modelValue: {
type: Boolean,
default: false
}
})
const enterprise = ref({
list: ref<EnterprisesVO[]>(),
queryParams: reactive({
pageNo: 1,
pageSize: 20,
enterprisesName: undefined,
region: undefined,
hy: undefined,
st: undefined,
wr: undefined,
inviterName: undefined,
id: undefined,
userId: undefined,
tagList: []
}),
total: ref(0)
})
const queryParams = ref({
enterprisesName: undefined,
hy: undefined,
st: undefined,
wr: undefined,
region: undefined,
userId: undefined,
// registrationNumber: undefined,
id: undefined
})
//
const visible = ref(false) //
// ... ...
//
const handleClose = () => {
visible.value = false
}
const selectedEnterprises = ref<EnterprisesVO[]>([])
const handleSelectionChange = (selectedItems: EnterprisesVO[]) => {
selectedEnterprises.value = selectedItems
}
const selectAll = (selection) => {
selectedEnterprises.value = selection
}
//
const confirmSelect = () => {
emit('success', selectedEnterprises.value)
}
//
// const handleSelectionChange = (selection) => {
// const currentPageIds = selection.map(item => item.id);
// currentPageIds.forEach(id => selectedIds.value.add(id));
// };
/**
* 获取企业列表
*/
async function getEnterPriseList() {
loading.value = true
console.log('enterprise.value.queryParams', enterprise.value.queryParams)
if (enterprise.value.queryParams.hy ||
enterprise.value.queryParams.st ||
enterprise.value.queryParams.wr
) {
enterprise.value.queryParams.tagList.push(enterprise.value.queryParams.hy)
enterprise.value.queryParams.tagList.push(enterprise.value.queryParams.st)
enterprise.value.queryParams.tagList.push(enterprise.value.queryParams.wr)
}
try {
const data = await EnterprisesApi.getEnterpriseByUserId(enterprise.value.queryParams)
enterprise.value.list = data.list
enterprise.value.total = data.total
} finally {
loading.value = false
enterprise.value.queryParams.tagList = []
}
}
//
const open = async () => {
// TODO:
visible.value = true
}
/** 搜索按钮操作 */
const handleQuery = () => {
enterprise.value.queryParams.pageNo = 1
getEnterPriseList()
}
/** 重置按钮操作 */
const resetQuery = () => {
// queryFormRef.value.resetFields()
// handleQuery()
}
//
const hyList: any = ref([])
//
const stList: any = ref([])
//
const wrList: any = ref([])
//
const userList:any = ref()
async function init() {
try {
const codeList = 'codeList=hy&codeList=st&codeList=wr'
const data = await TagLibraryApi.tagLibraryList(codeList)
hyList.value = data[0].children
stList.value = data[1].children
wrList.value = data[2].children
} finally {
}
const userData = await getSimpleUserZGList()
userList.value = userData
}
getEnterPriseList()
onMounted(() => {
init()
})
defineExpose({ open })
</script>
<style scoped lang="scss">
::v-deep(.el-dialog) {
padding: 40px;
}
::v-deep(.el-dialog__title) {
font-weight: bold !important;
font-size: 20px;
}
.enterprise-container {
// ... ...
.search-form {
background-color: #fff;
padding: 20px 20px 0px 0;
border-radius: 4px;
position: relative;
.form-container {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 24px;
margin-bottom: 20px;
}
.form-item {
margin: 0;
width: 100%;
:deep(.el-input),
:deep(.el-select) {
width: 100%;
}
}
.action-buttons {
position: absolute;
right: 10px;
bottom: 0px;
}
.button-container {
display: flex;
justify-content: center;
gap: 8px;
}
}
.pagination-container {
display: flex;
flex-direction: row;
justify-content: space-between;
margin-top: 20px; //
.selected {
font-size: 12px;
margin-left: 10px;
font-weight: bold;
}
}
.footer {
display: flex;
justify-content: center; //
gap: 8px; //
padding-top: 20px;
margin-top: 20px; //
}
}
</style>

66
src/views/task/index.vue

@ -1,27 +1,23 @@
<template>
<ContentWrap>
<ContentWrap style="align-items: center; display: flex; padding: 25px 0;">
<!-- 搜索工作栏 -->
<el-form
class="-mb-15px"
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-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="请选择任务状态"
@ -35,8 +31,7 @@
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-form-item> -->
<el-form-item label="任务类型" prop="taskType">
<el-select
v-model="queryParams.taskType"
@ -45,10 +40,10 @@
class="!w-240px"
>
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.TASK_TYPE)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
v-for="dict in taskTypeList"
:key="dict.id"
:label="dict.tagName"
:value="dict.id"
/>
</el-select>
</el-form-item>
@ -113,7 +108,7 @@
</template>
</el-table-column> -->
<el-table-column label="发布部门" align="center" prop="publishDep" />
<el-table-column label="发布部门" align="center" prop="deptName" />
<el-table-column
label="开始时间"
align="center"
@ -236,6 +231,8 @@ import { dateFormatter } from '@/utils/formatTime'
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' })
@ -269,6 +266,8 @@ const queryParams = reactive({
const queryFormRef = ref() //
const exportLoading = ref(false) //
const taskTypeList:any = ref([])
/** 查询列表 */
const getList = async () => {
loading.value = true
@ -276,6 +275,15 @@ const getList = async () => {
const data = await TaskInfoApi.getTaskInfoPage(queryParams)
list.value = data.list
total.value = data.total
//
const params = {
tagType: 2
}
const tag = await TagLibraryApi.getTagLibraryPage(params)
taskTypeList.value = tag[0].children
} finally {
loading.value = false
}
@ -350,3 +358,15 @@ onMounted(() => {
getList()
})
</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;
}
}
</style>

Loading…
Cancel
Save