From 30fc245a012523d4f33f52e17617edf2ee6ae6dd Mon Sep 17 00:00:00 2001 From: dx <1242347652@qq.com> Date: Sat, 8 Feb 2025 17:33:30 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=89=A7=E6=B3=95=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/enterpriseinspections/index.ts | 46 ++++ src/api/system/taglibrary/index.ts | 1 + src/utils/dict.ts | 1 + .../EnterpriseInspectionsForm.vue | 96 +++++++++ src/views/enterpriseinspections/detail.vue | 134 ++++++++++++ src/views/enterpriseinspections/index.vue | 201 ++++++++++++++++++ src/views/system/taglibrary/form.vue | 5 + src/views/system/user/UserForm.vue | 4 + 8 files changed, 488 insertions(+) create mode 100644 src/api/enterpriseinspections/index.ts create mode 100644 src/views/enterpriseinspections/EnterpriseInspectionsForm.vue create mode 100644 src/views/enterpriseinspections/detail.vue create mode 100644 src/views/enterpriseinspections/index.vue diff --git a/src/api/enterpriseinspections/index.ts b/src/api/enterpriseinspections/index.ts new file mode 100644 index 0000000..9b799e7 --- /dev/null +++ b/src/api/enterpriseinspections/index.ts @@ -0,0 +1,46 @@ +import request from '@/config/axios' + +// 企业检查记录表,用于记录与企业相关的环保检查信息。 VO +export interface EnterpriseInspectionsVO { + id: number // 检查记录ID,主键 + taskId: number // 任务ID + enterpriseId: number // 企业ID +} + +// 企业检查记录表,用于记录与企业相关的环保检查信息。 API +export const EnterpriseInspectionsApi = { + // 查询企业检查记录表,用于记录与企业相关的环保检查信息。分页 + getEnterpriseInspectionsPage: async (params: any) => { + return await request.get({ url: `/system/enterprise-inspections/page`, params }) + }, + + // 查询企业检查记录表,用于记录与企业相关的环保检查信息。详情 + getEnterpriseInspections: async (id: number) => { + return await request.get({ url: `/system/enterprise-inspections/get?id=` + id }) + }, + + // 新增企业检查记录表,用于记录与企业相关的环保检查信息。 + createEnterpriseInspections: async (data: EnterpriseInspectionsVO) => { + return await request.post({ url: `/system/enterprise-inspections/create`, data }) + }, + + // 修改企业检查记录表,用于记录与企业相关的环保检查信息。 + updateEnterpriseInspections: async (data: EnterpriseInspectionsVO) => { + return await request.put({ url: `/system/enterprise-inspections/update`, data }) + }, + + // 删除企业检查记录表,用于记录与企业相关的环保检查信息。 + deleteEnterpriseInspections: async (id: number) => { + return await request.delete({ url: `/system/enterprise-inspections/delete?id=` + id }) + }, + + // 导出企业检查记录表,用于记录与企业相关的环保检查信息。 Excel + exportEnterpriseInspections: async (params) => { + return await request.download({ url: `/system/enterprise-inspections/export-excel`, params }) + }, + + // 导出企业检查记录表,用于记录与企业相关的环保检查信息。 Excel + inspectionsLogList: async (params:any) => { + return await request.get({ url: `/system/inspections-log/list`, params }) + }, +} diff --git a/src/api/system/taglibrary/index.ts b/src/api/system/taglibrary/index.ts index 9062c28..06ffa81 100644 --- a/src/api/system/taglibrary/index.ts +++ b/src/api/system/taglibrary/index.ts @@ -8,6 +8,7 @@ export interface TagLibraryVO { tagLevel: number // 标签层级(一级、二级、三级) tagType: number // 1、企业标签2、执法标签 sort: number + tagCode: string } // 企业标签 API diff --git a/src/utils/dict.ts b/src/utils/dict.ts index 4b9f63f..e84af37 100644 --- a/src/utils/dict.ts +++ b/src/utils/dict.ts @@ -139,6 +139,7 @@ export enum DICT_TYPE { TASK_PRIORITY = 'task_priority', TASK_EXEC_TIME = 'task_exec_time', TASK_STATE = 'task_state', + INSPECTIONS_STATUS = 'Inspections_status', // ========== INFRA 模块 ========== INFRA_BOOLEAN_STRING = 'infra_boolean_string', INFRA_JOB_STATUS = 'infra_job_status', diff --git a/src/views/enterpriseinspections/EnterpriseInspectionsForm.vue b/src/views/enterpriseinspections/EnterpriseInspectionsForm.vue new file mode 100644 index 0000000..46a0a9b --- /dev/null +++ b/src/views/enterpriseinspections/EnterpriseInspectionsForm.vue @@ -0,0 +1,96 @@ +<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="任务ID" prop="taskId"> + <el-input v-model="formData.taskId" placeholder="请输入任务ID" /> + </el-form-item> + <el-form-item label="企业ID" prop="enterpriseId"> + <el-input v-model="formData.enterpriseId" placeholder="请输入企业ID" /> + </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 { EnterpriseInspectionsApi, EnterpriseInspectionsVO } from '@/api/enterpriseinspections' + +/** 企业检查记录表,用于记录与企业相关的环保检查信息。 表单 */ +defineOptions({ name: 'EnterpriseInspectionsForm' }) + +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, + taskId: undefined, + enterpriseId: 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 EnterpriseInspectionsApi.getEnterpriseInspections(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 EnterpriseInspectionsVO + if (formType.value === 'create') { + await EnterpriseInspectionsApi.createEnterpriseInspections(data) + message.success(t('common.createSuccess')) + } else { + await EnterpriseInspectionsApi.updateEnterpriseInspections(data) + message.success(t('common.updateSuccess')) + } + dialogVisible.value = false + // 发送操作成功的事件 + emit('success') + } finally { + formLoading.value = false + } +} + +/** 重置表单 */ +const resetForm = () => { + formData.value = { + id: undefined, + taskId: undefined, + enterpriseId: undefined, + } + formRef.value?.resetFields() +} +</script> \ No newline at end of file diff --git a/src/views/enterpriseinspections/detail.vue b/src/views/enterpriseinspections/detail.vue new file mode 100644 index 0000000..dacf6b4 --- /dev/null +++ b/src/views/enterpriseinspections/detail.vue @@ -0,0 +1,134 @@ +<template> + <ContentWrap title="" style="padding: 17px;"> + <el-descriptions> + <el-descriptions-item label="记录编号">{{detailData.id}}</el-descriptions-item> + <el-descriptions-item label="任务名称">{{detailData.taskName}}</el-descriptions-item> + <el-descriptions-item label="任务类型">{{detailData.tagList}}</el-descriptions-item> + <el-descriptions-item label="企业名称">{{detailData.enterpriseName}}</el-descriptions-item> + <el-descriptions-item label="执法部门">{{detailData.department}}</el-descriptions-item> + <el-descriptions-item label="执法人员"> + {{detailData.inspectName}} + <el-tag type="primary">变更</el-tag> + </el-descriptions-item> + </el-descriptions> + </ContentWrap> + <ContentWrap title=""> + <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true"> + <!-- <el-table-column label="检查记录ID,主键" align="center" prop="id" /> --> + + <el-table-column label="执法人员" align="center" prop="inspectName" /> + <el-table-column label="协同执法" align="center" prop="cooperateWithName" /> + <el-table-column + label="执法时间" + align="center" + prop="createTime" + :formatter="dateFormatter" + width="180px" + /> + <el-table-column label="进度状态" align="center" prop="inspectionStatus"> + <template #default="scope"> + <dict-tag :type="DICT_TYPE.INSPECTIONS_STATUS" :value="scope.row.status" /> + </template> + </el-table-column> + <el-table-column label="操作" align="center" min-width="120px"> + <template #default="scope"> + <el-button + link + v-if="scope.row.status > 1" + type="primary" + @click="openForm(scope.row.id)" + > + 查看 + </el-button> + + <span v-if="scope.row.status == 1">-</span> + + </template> + + </el-table-column> + </el-table> + <!-- 分页 --> + <Pagination + :total="total" + v-model:page="queryParams.pageNo" + v-model:limit="queryParams.pageSize" + @pagination="getList" + /> + </ContentWrap> + <EnterpriseInspectionsForm ref="formRef" @success="getList" /> +</template> + +<script setup> + +import { EnterpriseInspectionsApi } from '@/api/enterpriseinspections' +import { DICT_TYPE, getIntDictOptions, getStrDictOptions } from '@/utils/dict' +import EnterpriseInspectionsForm from './EnterpriseInspectionsForm.vue' + + +defineOptions({ name: 'EnterpriseInspections' }) +import { ref } from 'vue' +const message = ref('Hello, Vue 3!') + +const loading = ref(true) // 列表的加载中 +const list = ref() // 列表的数据 +const total = ref(0) // 列表的总页数 +const queryParams = ref({ + inspectionsId: undefined +}) +const queryFormRef = ref() + +const route = useRoute() + +/** 添加/修改操作 */ +const formRef = ref() +const openForm = (id) => { + const type = 'create' + formRef.value.open(type, id) +} + + +/** 查询列表 */ +const getList = async () => { + loading.value = true + try { + const data = await EnterpriseInspectionsApi.inspectionsLogList(queryParams.value) + list.value = data + total.value = data.total + } finally { + loading.value = false + } +} + +const detailData = ref({ + enterpriseName: undefined, + taskName: undefined, + tagList: undefined, + department: undefined, + inspectName: undefined, + cooperateWithName: undefined, + id: undefined +}) + +/** 初始化 **/ +onMounted(() => { + + const data = JSON.parse(route.query.data) + detailData.value = { + enterpriseName: data.enterpriseName, + taskName: data.taskName, + tagList: data.tagList, + department: data.department, + inspectName: data.inspectName, + cooperateWithName: data.cooperateWithName, + id: data.id + } + + queryParams.value.inspectionsId = data.id + + + getList() +}) + +</script> + +<style scoped></style> diff --git a/src/views/enterpriseinspections/index.vue b/src/views/enterpriseinspections/index.vue new file mode 100644 index 0000000..a35b6fd --- /dev/null +++ b/src/views/enterpriseinspections/index.vue @@ -0,0 +1,201 @@ +<template> + <ContentWrap> + <!-- 搜索工作栏 --> + <el-form + class="-mb-15px" + :model="queryParams" + ref="queryFormRef" + :inline="true" + label-width="68px" + > + <el-form-item label="任务标题" prop="taskId"> + <el-input + v-model="queryParams.taskId" + placeholder="请输入任务标题" + clearable + @keyup.enter="handleQuery" + class="!w-240px" + /> + </el-form-item> + <el-form-item label="企业名称" prop="enterpriseId"> + <el-input + v-model="queryParams.enterpriseId" + 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:enterprise-inspections:create']" + > + <Icon icon="ep:plus" class="mr-5px" /> 新增 + </el-button> + <el-button + type="success" + plain + @click="handleExport" + :loading="exportLoading" + v-hasPermi="['system:enterprise-inspections: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="检查记录ID,主键" align="center" prop="id" /> --> + <el-table-column label="企业名称" align="center" prop="enterpriseName" /> + <el-table-column label="进度状态" align="center" prop="inspectionStatus"> + <template #default="scope"> + <dict-tag :type="DICT_TYPE.INSPECTIONS_STATUS" :value="scope.row.inspectionStatus" /> + </template> + </el-table-column> + <el-table-column label="任务名称" align="center" prop="taskName" /> + <el-table-column label="任务类型" align="center" prop="tagList" /> + <el-table-column label="执法部门" align="center" prop="department" /> + <el-table-column label="执法人员" align="center" prop="inspectName" /> + <el-table-column label="协同执法" align="center" prop="cooperateWithName" /> + <el-table-column + label="执法时间" + align="center" + prop="execTime" + :formatter="dateFormatter" + width="180px" + /> + <el-table-column label="操作" align="center" min-width="120px"> + <template #default="scope"> + <el-button + link + type="primary" + @click="push({ path: '/task/inspectionsDetail', query: {data: JSON.stringify(scope.row)} })" + > + 查看 + </el-button> + </template> + </el-table-column> + </el-table> + <!-- 分页 --> + <Pagination + :total="total" + v-model:page="queryParams.pageNo" + v-model:limit="queryParams.pageSize" + @pagination="getList" + /> + </ContentWrap> + + <!-- 表单弹窗:添加/修改 --> + <EnterpriseInspectionsForm ref="formRef" @success="getList" /> +</template> + +<script setup lang="ts"> +import { dateFormatter } from '@/utils/formatTime' +import download from '@/utils/download' +import { EnterpriseInspectionsApi, EnterpriseInspectionsVO } from '@/api/enterpriseinspections' +import EnterpriseInspectionsForm from './EnterpriseInspectionsForm.vue' +import { DICT_TYPE, getIntDictOptions, getStrDictOptions } from '@/utils/dict' + +const { push } = useRouter() + +/** 企业检查记录表,用于记录与企业相关的环保检查信息。 列表 */ +defineOptions({ name: 'EnterpriseInspections' }) + +const message = useMessage() // 消息弹窗 +const { t } = useI18n() // 国际化 + +const loading = ref(true) // 列表的加载中 +const list = ref<EnterpriseInspectionsVO[]>([]) // 列表的数据 +const total = ref(0) // 列表的总页数 +const queryParams = reactive({ + pageNo: 1, + pageSize: 10, + taskId: undefined, + enterpriseId: undefined, + createTime: [], +}) +const queryFormRef = ref() // 搜索的表单 +const exportLoading = ref(false) // 导出的加载中 + +/** 查询列表 */ +const getList = async () => { + loading.value = true + try { + const data = await EnterpriseInspectionsApi.getEnterpriseInspectionsPage(queryParams) + list.value = data.list + total.value = data.total + } finally { + loading.value = false + } +} + +/** 搜索按钮操作 */ +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 EnterpriseInspectionsApi.deleteEnterpriseInspections(id) + message.success(t('common.delSuccess')) + // 刷新列表 + await getList() + } catch {} +} + +/** 导出按钮操作 */ +const handleExport = async () => { + try { + // 导出的二次确认 + await message.exportConfirm() + // 发起导出 + exportLoading.value = true + const data = await EnterpriseInspectionsApi.exportEnterpriseInspections(queryParams) + download.excel(data, '企业检查记录表,用于记录与企业相关的环保检查信息。.xls') + } catch { + } finally { + exportLoading.value = false + } +} + +/** 初始化 **/ +onMounted(() => { + getList() +}) +</script> \ No newline at end of file diff --git a/src/views/system/taglibrary/form.vue b/src/views/system/taglibrary/form.vue index c9918c7..dfff1b2 100644 --- a/src/views/system/taglibrary/form.vue +++ b/src/views/system/taglibrary/form.vue @@ -26,6 +26,10 @@ <el-input v-model="formData.tagName" placeholder="请输入标签的名称" /> </el-form-item> + <el-form-item label="助记码" prop="tagCode"> + <el-input v-model="formData.tagCode" placeholder="助记码" /> + </el-form-item> + <el-form-item label="排序" prop="sort"> <el-input v-model="formData.sort" placeholder="排序" /> </el-form-item> @@ -55,6 +59,7 @@ const formData = ref({ tagLevel: undefined, tagType: null as any, sort: undefined, + tagCode:undefined, id: null as any }) const formRules = reactive({}) diff --git a/src/views/system/user/UserForm.vue b/src/views/system/user/UserForm.vue index 630688a..5c4195a 100644 --- a/src/views/system/user/UserForm.vue +++ b/src/views/system/user/UserForm.vue @@ -12,6 +12,9 @@ <el-form-item label="用户昵称" prop="nickname"> <el-input v-model="formData.nickname" placeholder="请输入用户昵称" /> </el-form-item> + <el-form-item label="真实姓名" prop="realName"> + <el-input v-model="formData.realName" placeholder="请输入真实姓名" /> + </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="归属部门" prop="deptId"> @@ -115,6 +118,7 @@ const formLoading = ref(false) // 表单的加载中:1)修改时的数据加 const formType = ref('') // 表单的类型:create - 新增;update - 修改 const formData = ref({ nickname: '', + realName: '', deptId: '', mobile: '', email: '', From ebd8d39959cd5680b931cbeb211bf494660b97aa Mon Sep 17 00:00:00 2001 From: dx <1242347652@qq.com> Date: Mon, 10 Feb 2025 14:06:21 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=89=A7=E6=B3=95=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/enterpriseinspections/index.ts | 7 + src/api/system/user/index.ts | 8 +- .../EnterpriseInspectionsForm.vue | 98 +++++---- .../changeInspections.vue | 187 ++++++++++++++++++ src/views/enterpriseinspections/detail.vue | 11 +- src/views/enterpriseinspections/index.vue | 35 +++- 6 files changed, 299 insertions(+), 47 deletions(-) create mode 100644 src/views/enterpriseinspections/changeInspections.vue diff --git a/src/api/enterpriseinspections/index.ts b/src/api/enterpriseinspections/index.ts index 9b799e7..6f3adc3 100644 --- a/src/api/enterpriseinspections/index.ts +++ b/src/api/enterpriseinspections/index.ts @@ -5,6 +5,7 @@ export interface EnterpriseInspectionsVO { id: number // 检查记录ID,主键 taskId: number // 任务ID enterpriseId: number // 企业ID + tagList: String } // 企业检查记录表,用于记录与企业相关的环保检查信息。 API @@ -43,4 +44,10 @@ export const EnterpriseInspectionsApi = { inspectionsLogList: async (params:any) => { return await request.get({ url: `/system/inspections-log/list`, params }) }, + + //根据 用户id和任务名称查询可以转发的任务 + inspectionsLogListByUserAndTaskName: async (params:any) => { + return await request.get({ url: `/system/enterprise-inspections/getListByUserIdAndTaskName`, params }) + }, + } diff --git a/src/api/system/user/index.ts b/src/api/system/user/index.ts index 94b67e2..0a440f6 100644 --- a/src/api/system/user/index.ts +++ b/src/api/system/user/index.ts @@ -4,6 +4,7 @@ export interface UserVO { id: number username: string nickname: string + realName: string deptId: number postIds: string[] email: string @@ -80,7 +81,12 @@ export const updateUserStatus = (id: number, status: number) => { // 获取用户精简信息列表 export const getSimpleUserList = (): Promise<UserVO[]> => { return request.get({ url: '/system/user/simple-list' }) -} +} + +// 获取用户精简信息列表 +export const getSimpleUserZGList = (): Promise<UserVO[]> => { + return request.get({ url: '/system/user/simple-zg-list' }) +} /** * 查询审核列表 diff --git a/src/views/enterpriseinspections/EnterpriseInspectionsForm.vue b/src/views/enterpriseinspections/EnterpriseInspectionsForm.vue index 46a0a9b..1f86e7b 100644 --- a/src/views/enterpriseinspections/EnterpriseInspectionsForm.vue +++ b/src/views/enterpriseinspections/EnterpriseInspectionsForm.vue @@ -1,19 +1,14 @@ <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="任务ID" prop="taskId"> - <el-input v-model="formData.taskId" placeholder="请输入任务ID" /> - </el-form-item> - <el-form-item label="企业ID" prop="enterpriseId"> - <el-input v-model="formData.enterpriseId" placeholder="请输入企业ID" /> - </el-form-item> - </el-form> + <Dialog title="反馈信息" v-model="dialogVisible"> + <div class="box"> + <div class="img"> + <div v-for="item in imgList" :key="item"> + <el-image style="width: 180px; height: 180px" :src="item" :preview-src-list="imgList" /> + </div> + </div> + <div class="text">{{dataValue.feedBack}}</div> + </div> + <template #footer> <el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button> <el-button @click="dialogVisible = false">取 消</el-button> @@ -30,7 +25,7 @@ const { t } = useI18n() // 国际化 const message = useMessage() // 消息弹窗 const dialogVisible = ref(false) // 弹窗的是否展示 -const dialogTitle = ref('') // 弹窗的标题 +const dialogTitle = ref('反馈信息') // 弹窗的标题 const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用 const formType = ref('') // 表单的类型:create - 新增;update - 修改 const formData = ref({ @@ -38,25 +33,34 @@ const formData = ref({ taskId: undefined, enterpriseId: undefined, }) -const formRules = reactive({ -}) +// const formRules = reactive({ +// }) const formRef = ref() // 表单 Ref +const dataValue = ref() +const imgList = ref([]) + /** 打开弹窗 */ -const open = async (type: string, id?: number) => { +const open = async (data) => { + dialogVisible.value = true - dialogTitle.value = t('action.' + type) - formType.value = type - resetForm() - // 修改时,设置数据 - if (id) { - formLoading.value = true - try { - formData.value = await EnterpriseInspectionsApi.getEnterpriseInspections(id) - } finally { - formLoading.value = false - } + dataValue.value = data + + if (data.fileList.length > 0) { + imgList.value = data.fileList.map(i=>i.url) } + + console.log("imgList.value=>", imgList.value) + + // // 修改时,设置数据 + // if (id) { + // formLoading.value = true + // try { + // formData.value = await EnterpriseInspectionsApi.getEnterpriseInspections(id) + // } finally { + // formLoading.value = false + // } + // } } defineExpose({ open }) // 提供 open 方法,用于打开弹窗 @@ -84,13 +88,29 @@ const submitForm = async () => { } } -/** 重置表单 */ -const resetForm = () => { - formData.value = { - id: undefined, - taskId: undefined, - enterpriseId: undefined, +// /** 重置表单 */ +// const resetForm = () => { +// formData.value = { +// id: undefined, +// taskId: undefined, +// enterpriseId: undefined, +// } +// formRef.value?.resetFields() +// } +</script> +<style scoped> + .box{ + display: flex; + flex-direction: column; + .img{ + display: flex; + flex-direction: row; + flex-wrap: wrap; + justify-content: center; + gap: 15px + } + .text{ + padding: 15px; + } } - formRef.value?.resetFields() -} -</script> \ No newline at end of file +</style> diff --git a/src/views/enterpriseinspections/changeInspections.vue b/src/views/enterpriseinspections/changeInspections.vue new file mode 100644 index 0000000..205b1bd --- /dev/null +++ b/src/views/enterpriseinspections/changeInspections.vue @@ -0,0 +1,187 @@ +<template> + <Dialog title="任务转发" v-model="dialogVisible"> + <el-form :model="form" label-width="auto" style="max-width: 600px"> + <el-form-item label="转发用户" prop="name" style="max-width: 500px"> + <el-select v-model="form.resUserId" placeholder="请选择用户"> + <el-option + v-for="item in userList" + :key="item.id" + :label=" item.deptName +'-'+ item.realName " + :value="item.id!" + /> + </el-select> + </el-form-item> + </el-form> + + <el-form-item label="目标用户" prop="name" style="max-width: 500px"> + <el-select v-model="form.userId" placeholder="请选择目标用户"> + <el-option + v-for="item in userList" + :key="item.id" + :label=" item.deptName +'-'+ item.realName " + :value="item.id!" + /> + </el-select> + </el-form-item> + + <el-form-item label="任务名称" prop="name"> + <el-input + v-model="taskName" + style="width: 240px" + placeholder="请输入任务名称" + clearable + /><el-button type="primary" >查询</el-button> + </el-form-item> + + + + + <el-table :data="tableData" style="width: 100%"> + <el-table-column prop="date" label="Date" width="180" /> + <el-table-column prop="name" label="Name" width="180" /> + <el-table-column prop="address" label="Address" /> + </el-table> + + + + <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 { EnterpriseInspectionsApi, EnterpriseInspectionsVO } from '@/api/enterpriseinspections' +import { getSimpleUserZGList, UserVO } from '@/api/system/user' + + +/** 企业检查记录表,用于记录与企业相关的环保检查信息。 表单 */ +defineOptions({ name: 'EnterpriseInspectionsForm' }) + +const { t } = useI18n() // 国际化 +const message = useMessage() // 消息弹窗 + +const dialogVisible = ref(false) // 弹窗的是否展示 +const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用 +const formType = ref('') // 表单的类型:create - 新增;update - 修改 +const formData = ref({ + id: undefined, + taskId: undefined, + enterpriseId: undefined, +}) + +const taskName = ref() + +const tableData = [ + { + date: '2016-05-03', + name: 'Tom', + address: 'No. 189, Grove St, Los Angeles', + }, + { + date: '2016-05-02', + name: 'Tom', + address: 'No. 189, Grove St, Los Angeles', + }, + { + date: '2016-05-04', + name: 'Tom', + address: 'No. 189, Grove St, Los Angeles', + }, + { + date: '2016-05-01', + name: 'Tom', + address: 'No. 189, Grove St, Los Angeles', + }, +] + +const form = reactive({ + userId: '', + resUserId: '', + inspectionsId: [], +}) + +// const formRules = reactive({ +// }) +const formRef = ref() // 表单 Ref + +const dataValue = ref() + +const userList = ref() +const getUserList = async () => { + const data = await getSimpleUserZGList(); + userList.value = data +} + + +/** 打开弹窗 */ +const open = async (data) => { + + dialogVisible.value = true + dataValue.value = data + + getUserList() + + + // // 修改时,设置数据 + // if (id) { + // formLoading.value = true + // try { + // formData.value = await EnterpriseInspectionsApi.getEnterpriseInspections(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 EnterpriseInspectionsVO + if (formType.value === 'create') { + await EnterpriseInspectionsApi.createEnterpriseInspections(data) + message.success(t('common.createSuccess')) + } else { + await EnterpriseInspectionsApi.updateEnterpriseInspections(data) + message.success(t('common.updateSuccess')) + } + dialogVisible.value = false + // 发送操作成功的事件 + emit('success') + } finally { + formLoading.value = false + } +} + +// /** 重置表单 */ +// const resetForm = () => { +// formData.value = { +// id: undefined, +// taskId: undefined, +// enterpriseId: undefined, +// } +// formRef.value?.resetFields() +// } +</script> +<style scoped> + .box{ + display: flex; + flex-direction: column; + .img{ + display: flex; + flex-direction: row; + flex-wrap: wrap; + justify-content: center; + gap: 15px + } + .text{ + padding: 15px; + } + } +</style> diff --git a/src/views/enterpriseinspections/detail.vue b/src/views/enterpriseinspections/detail.vue index dacf6b4..7f214cd 100644 --- a/src/views/enterpriseinspections/detail.vue +++ b/src/views/enterpriseinspections/detail.vue @@ -36,7 +36,7 @@ link v-if="scope.row.status > 1" type="primary" - @click="openForm(scope.row.id)" + @click="openForm(scope.row)" > 查看 </el-button> @@ -63,6 +63,7 @@ import { EnterpriseInspectionsApi } from '@/api/enterpriseinspections' import { DICT_TYPE, getIntDictOptions, getStrDictOptions } from '@/utils/dict' import EnterpriseInspectionsForm from './EnterpriseInspectionsForm.vue' +import { dateFormatter } from '@/utils/formatTime' defineOptions({ name: 'EnterpriseInspections' }) @@ -75,15 +76,14 @@ const total = ref(0) // 列表的总页数 const queryParams = ref({ inspectionsId: undefined }) -const queryFormRef = ref() +const queryFormRef = ref() const route = useRoute() /** 添加/修改操作 */ const formRef = ref() -const openForm = (id) => { - const type = 'create' - formRef.value.open(type, id) +const openForm = (data) => { + formRef.value.open(data) } @@ -113,6 +113,7 @@ const detailData = ref({ onMounted(() => { const data = JSON.parse(route.query.data) + detailData.value = { enterpriseName: data.enterpriseName, taskName: data.taskName, diff --git a/src/views/enterpriseinspections/index.vue b/src/views/enterpriseinspections/index.vue index a35b6fd..e86f0ea 100644 --- a/src/views/enterpriseinspections/index.vue +++ b/src/views/enterpriseinspections/index.vue @@ -40,6 +40,7 @@ <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 @click="openChangeForm"><Icon icon="ep:refresh" class="mr-5px" /> 任务转发</el-button> <el-button type="primary" plain @@ -63,7 +64,15 @@ <!-- 列表 --> <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" + @selection-change="handleSelectionChange" + > + <el-table-column type="selection" width="55" /> + <!-- <el-table-column label="检查记录ID,主键" align="center" prop="id" /> --> <el-table-column label="企业名称" align="center" prop="enterpriseName" /> <el-table-column label="进度状态" align="center" prop="inspectionStatus"> @@ -106,6 +115,9 @@ <!-- 表单弹窗:添加/修改 --> <EnterpriseInspectionsForm ref="formRef" @success="getList" /> + + <ChangeInspections ref="changeRef" @success="getList" /> + </template> <script setup lang="ts"> @@ -113,7 +125,8 @@ import { dateFormatter } from '@/utils/formatTime' import download from '@/utils/download' import { EnterpriseInspectionsApi, EnterpriseInspectionsVO } from '@/api/enterpriseinspections' import EnterpriseInspectionsForm from './EnterpriseInspectionsForm.vue' -import { DICT_TYPE, getIntDictOptions, getStrDictOptions } from '@/utils/dict' +import ChangeInspections from './changeInspections.vue' +import { DICT_TYPE } from '@/utils/dict' const { push } = useRouter() @@ -136,11 +149,23 @@ const queryParams = reactive({ const queryFormRef = ref() // 搜索的表单 const exportLoading = ref(false) // 导出的加载中 +const selectedRows = ref([]); +const handleSelectionChange = (selection) => { + selectedRows.value = selection; + console.log('Selected Rows:', selectedRows.value); +}; + + /** 查询列表 */ const getList = async () => { loading.value = true try { const data = await EnterpriseInspectionsApi.getEnterpriseInspectionsPage(queryParams) + + data.list.forEach(item => { + item.tagList = item.tagList.join() + }); + list.value = data.list total.value = data.total } finally { @@ -166,6 +191,12 @@ const openForm = (type: string, id?: number) => { formRef.value.open(type, id) } +//任务转发 +const changeRef = ref() +const openChangeForm = () => { + changeRef.value.open(selectedRows.value) +} + /** 删除按钮操作 */ const handleDelete = async (id: number) => { try {