Browse Source

执法记录相关

master
DX 2 months ago
parent
commit
ebd8d39959
  1. 7
      src/api/enterpriseinspections/index.ts
  2. 8
      src/api/system/user/index.ts
  3. 98
      src/views/enterpriseinspections/EnterpriseInspectionsForm.vue
  4. 187
      src/views/enterpriseinspections/changeInspections.vue
  5. 11
      src/views/enterpriseinspections/detail.vue
  6. 35
      src/views/enterpriseinspections/index.vue

7
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 })
},
}

8
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' })
}
/**
*

98
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) // 12
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>
</style>

187
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) // 12
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>

11
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,

35
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 {

Loading…
Cancel
Save