Browse Source

优化企业信息表单,调整样式和逻辑,添加执法人员选择和坐标选择功能

master
parent
commit
108e3e6a9b
  1. 12
      src/components/ContentWrap/src/ContentWrap.vue
  2. 2
      src/components/Dialog/src/Dialog.vue
  3. 17
      src/components/UploadFile/src/UploadImgs.vue
  4. 7
      src/styles/variables.scss
  5. 2
      src/views/enterpriseinspections/ChangeUser.vue
  6. 4
      src/views/enterpriseinspections/detail.vue
  7. 64
      src/views/enterprises/components/SelectUser.vue
  8. 43
      src/views/enterprises/components/getGpsByQq.vue
  9. 75
      src/views/enterprises/index.vue
  10. 824
      src/views/enterprises/update.vue
  11. 21
      src/views/task/index.vue

12
src/components/ContentWrap/src/ContentWrap.vue

@ -16,7 +16,7 @@ defineProps({
</script> </script>
<template> <template>
<ElCard :body-style="bodyStyle" :class="[prefixCls, 'mb-15px']" shadow="never"> <ElCard :body-style="bodyStyle" :class="[prefixCls, 'mb-15px']" shadow="never" class="cs-card">
<template v-if="title" #header> <template v-if="title" #header>
<div class="flex items-center"> <div class="flex items-center">
<span class="text-16px font-700">{{ title }}</span> <span class="text-16px font-700">{{ title }}</span>
@ -36,8 +36,12 @@ defineProps({
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
:deep(.el-card__header) { .cs-card {
border-bottom: none; border: none;
padding-bottom: 0; --el-card-border-radius: 8px;
:deep(.el-card__header) {
border-bottom: none;
padding-bottom: 0;
}
} }
</style> </style>

2
src/components/Dialog/src/Dialog.vue

@ -29,8 +29,6 @@ const getBindValue = computed(() => {
const isFullscreen = ref(false) const isFullscreen = ref(false)
const dialogHeight = ref(isNumber(props.maxHeight) ? `${props.maxHeight}px` : props.maxHeight) const dialogHeight = ref(isNumber(props.maxHeight) ? `${props.maxHeight}px` : props.maxHeight)
watch( watch(

17
src/components/UploadFile/src/UploadImgs.vue

@ -16,17 +16,16 @@
:on-success="uploadSuccess" :on-success="uploadSuccess"
list-type="picture-card" list-type="picture-card"
> >
<div class="upload-empty" v-if="!disabled"> <div class="upload-empty" v-if="!disabled">
<slot name="empty"> <slot name="empty">
<Icon icon="ep:plus" /> <Icon icon="ep:plus" />
<!-- <span>请上传图片</span> --> <!-- <span>请上传图片</span> -->
</slot> </slot>
</div> </div>
<template #file="{ file }"> <template #file="{ file }">
<img :src="file.url" class="upload-image" /> <img :src="file.url" class="upload-image" />
<div class="upload-handle" @click.stop> <div class="upload-handle" @click.stop>
<div class="handle-icon" @click="imagePreview(file.url!)"> <div class="handle-icon" @click="imagePreview(file.url!)">
<Icon icon="ep:zoom-in" /> <Icon icon="ep:zoom-in" />
<span>查看</span> <span>查看</span>
@ -205,8 +204,6 @@ const handleExceed = () => {
} }
} }
.upload-box { .upload-box {
.no-border { .no-border {
:deep(.el-upload--picture-card) { :deep(.el-upload--picture-card) {

7
src/styles/variables.scss

@ -41,3 +41,10 @@ $elNamespace: el;
height: fit-content; height: fit-content;
padding: 10px; padding: 10px;
} }
.el-input__suffix{
margin-right: 15px;
}
.el-input-number.is-controls-right[class*=large] [class*=decrease], .el-input-number.is-controls-right[class*=large] [class*=increase]{
--el-input-number-controls-height:50%;
}

2
src/views/enterpriseinspections/ChangeUser.vue

@ -2,7 +2,7 @@
<Dialog title="变更人员" v-model="dialogVisible" width="480"> <Dialog title="变更人员" v-model="dialogVisible" width="480">
<el-form :model="formData" ref="formRef" :rules="formRules"> <el-form :model="formData" ref="formRef" :rules="formRules">
<el-form-item label="执法人员" prop="userId"> <el-form-item label="执法人员" prop="userId">
<el-select v-model="formData.userId" placeholder="请选择用户"> <el-select v-model="formData.userId" placeholder="请选择用户" filterable clearable>
<el-option <el-option
v-for="item in userList" v-for="item in userList"
:key="item.id" :key="item.id"

4
src/views/enterpriseinspections/detail.vue

@ -12,8 +12,8 @@
text text
@click=" @click="
push({ push({
path: `/enterprises/update`, path: `/task/create`,
query: { id: detailData.enterpriseId } query: { id: detailData.taskId }
}) })
" "
>详情 >详情

64
src/views/enterprises/components/SelectUser.vue

@ -1,64 +0,0 @@
<template>
<Teleport to="body">
<section class="view-container" v-show="show">
<section class="user-conatiner">
<section class="close">
<el-button type="primary" circle size="small" @click="close">
<Icon icon="ep:close" /> </el-button
></section>
<User ref="userComponent" isInset v-bind="$attrs" />
</section>
</section>
</Teleport>
</template>
<script setup>
import User from '@/views/system/user/index.vue'
const show = ref(false)
const emit = defineEmits(['select'])
const open = () => {
show.value = true
}
function close() {
show.value = false
emit('close')
}
const dblclickRow = (row) => {
emit('dbClickRow', row)
}
provide('closeParent', close);
defineExpose({
open
})
</script>
<style lang="scss" scoped>
.view-container {
background-color: #0000006f;
position: absolute;
inset: 0;
display: flex;
justify-content: center;
align-items: center;
z-index: 9999;
.user-conatiner {
width: 80vw;
border-radius: 8px;
// overflow: hidden;
padding: 12px;
background-color: #fff;
position: relative;
.close {
position: absolute;
right: 0;
top: 0;
transform: translateX(50%) translateY(-50%);
}
}
}
</style>

43
src/views/enterprises/components/getGpsByQq.vue

@ -0,0 +1,43 @@
<script setup lang="ts">
const show = ref(false)
const TMap = (window as any).qq.maps
let map: any = null
//
const coordinate = reactive({
latitude: undefined,
longitude: undefined,
address: ''
} as any)
const open = () => {
show.value = true
navigator.geolocation.getCurrentPosition((position) => {
coordinate.latitude = position.coords.latitude
coordinate.longitude = position.coords.longitude
})
nextTick(() => {
init()
})
}
const init = () => {
const center = new TMap.LatLng(coordinate.latitude, coordinate.longitude)
map = new TMap.Map(document.getElementById('tencent-container'), {
center: center, //
zoom: 11, //
viewMode: '2D'
})
}
defineExpose({
open
})
</script>
<template>
<Dialog v-model="show" title="选择地址">
<section id="tencent-container"></section>
</Dialog>
</template>
<style scoped lang="scss"></style>

75
src/views/enterprises/index.vue

@ -47,12 +47,17 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="" prop="registrationNumber"> <el-form-item label="" prop="registrationNumber">
<el-input <el-select v-model="queryParams.registrationNumber" placeholder="请选择执法人员" filterable clearable>
v-model="queryParams.registrationNumber" <el-option
placeholder="请选择执法人员" v-for="item in userList"
clearable :key="item.id"
@keyup.enter="handleQuery" :label="item.realName"
/> :value="item.id"
popper-class="user-wrapper"
>
<el-avatar :src="item.avatar" :size="30" /> <span>{{ item.realName }}</span>
</el-option>
</el-select>
</el-form-item> </el-form-item>
<el-form-item label="" prop="establishmentDate"> <el-form-item label="" prop="establishmentDate">
<el-date-picker <el-date-picker
@ -98,7 +103,7 @@
</el-button> </el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true"> <el-table v-loading="loading" :data="list" :show-overflow-tooltip="true">
<el-table-column label="企业名称" fixed="left" prop="enterprisesName" /> <el-table-column label="企业名称" fixed="left" prop="enterprisesName" />
<el-table-column label="所属区域" width="200"> <el-table-column label="所属区域" width="200">
<template #default="scope"> <template #default="scope">
@ -112,7 +117,7 @@
</el-table-column> </el-table-column>
<el-table-column label="执法人员" width="200"> <el-table-column label="执法人员" width="200">
<template #default="scope"> <template #default="scope">
{{`${scope.row.inviterName} | ${scope.row.inviterNameDept}`}} {{ `${scope.row.inviterName} | ${scope.row.inviterNameDept}` }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
@ -121,14 +126,29 @@
:formatter="dateFormatter" :formatter="dateFormatter"
width="240" width="240"
/> />
<el-table-column label="操作选项" align="center" width="100px"> <el-table-column label="操作选项" align="center" width="120px">
<template #default="scope"> <template #default="scope">
<el-button
link
type="primary"
@click="
push({
path: 'update',
query: {
id: scope.row.id
}
})
"
v-hasPermi="['system:enterprise:update']"
>
编辑
</el-button>
<el-button <el-button
link link
type="primary" type="primary"
@click=" @click="
push({ push({
path: 'update', path: 'detail',
query: { query: {
id: scope.row.id id: scope.row.id
} }
@ -162,10 +182,9 @@ import { getStrDictOptions, DICT_TYPE, getDictLabel } from '@/utils/dict'
import { dateFormatter } from '@/utils/formatTime' import { dateFormatter } from '@/utils/formatTime'
import download from '@/utils/download' import download from '@/utils/download'
import { EnterprisesApi, EnterprisesVO } from '@/api/enterprises' import { EnterprisesApi, EnterprisesVO } from '@/api/enterprises'
import { getEnterpriseManager } from '@/api/system/user' import { getSimpleUserZGList } from '@/api/system/user'
import { TagLibraryApi } from '@/api/system/taglibrary' import { TagLibraryApi } from '@/api/system/taglibrary'
import {Search} from "@element-plus/icons-vue"; import { Search } from '@element-plus/icons-vue'
/** 企业 列表 */ /** 企业 列表 */
defineOptions({ name: 'Enterprises' }) defineOptions({ name: 'Enterprises' })
@ -193,8 +212,9 @@ const queryParams = reactive({
createTime: [], createTime: [],
managerDeptId: undefined managerDeptId: undefined
}) })
const userList = ref()
// //
const typeList = ref([]) const typeList = ref([] as any)
const queryFormRef = ref() // const queryFormRef = ref() //
const exportLoading = ref(false) // const exportLoading = ref(false) //
const { push } = useRouter() // const { push } = useRouter() //
@ -238,22 +258,25 @@ const handleExport = async () => {
} }
} }
const getTypList = async () => {
const res = await TagLibraryApi.tagLibraryList('hy')
typeList.value = res[0].children.map((t) => {
return {
label: t.tagName,
value: t.id
}
})
}
getTypList()
const getUserList = async () => { /** 查询搜索项列表 */
// awitgetEnterpriseManager const getSearchOption = async () => {
userList.value = await getSimpleUserZGList({})
const res = await TagLibraryApi.tagLibraryList('hy')
typeList.value = res[0].children.map((t) => {
return {
label: t.tagName,
value: t.id
}
})
} }
getSearchOption()
/** 初始化 **/ /** 初始化 **/
onMounted(() => { onMounted(() => {
getList() getList()

824
src/views/enterprises/update.vue

@ -1,268 +1,131 @@
<template> <template>
<ContentWrap <content-wrap>
>{{ formData.id ? '修改企业信息' : '发布企业信息' }} <section class="view-wrapper">
<section class="taskForm"> <section class="w-70%">
<el-form <section class="mb-40px">
ref="formRef" <section class="title-wrapper"> 基本信息</section>
:model="formData" <el-form :rules="formRules" :model="formData" label-width="100px">
:rules="formRules" <section class="base-form">
label-width="auto" <el-form-item label="企业名称" prop="enterprisesName">
v-loading="loading" <el-input v-model="formData.enterprisesName" placeholder="请输入企业名称" />
> </el-form-item>
<el-form-item label="企业名称" prop="enterprisesName"> <el-form-item label="所属区域" prop="region">
<el-input v-model="formData.enterprisesName" placeholder="请输入企业名称" /> <el-select v-model="formData.region" placeholder="请选择所属区域" clearable>
</el-form-item> <el-option
<el-form-item label="企业类型标签" prop="type"> v-for="dict in getStrDictOptions(DICT_TYPE.ENTERPRISES_AREA)"
<el-select v-model="formData.type" placeholder="请选择企业类型"> :key="dict.value"
<el-option :label="dict.label"
v-for="dict in getStrDictOptions(DICT_TYPE.ENTERPRISES_TYPE)" :value="dict.value"
:key="dict.value" />
:label="dict.label" </el-select>
:value="dict.value" </el-form-item>
/> <el-form-item label="企业地址" prop="address">
</el-select> <el-input v-model="formData.address" placeholder="请选择企业地址" readonly @click="getGaps">
</el-form-item> <template #append>
<el-form-item label="企业所属区域" prop="region"> <Icon icon="ep:position" @click.stop="getGaps"/>
<el-select v-model="formData.region" placeholder="请选择企业所属区域"> </template>
<el-option </el-input>
v-for="dict in getStrDictOptions(DICT_TYPE.ENTERPRISES_AREA)" </el-form-item>
:key="dict.value" <el-form-item label="行业类别" prop="tags">
:label="dict.label" <el-select
:value="dict.value" v-model="formData.tags"
/> placeholder="请选择行业类型"
</el-select> clearable
</el-form-item> multiple
<el-form-item label="专管员" prop="startUserSelectAssignees"> collapse-tags
<section class="selec-wrapper"> collapse-tags-tooltip
<!-- 动态显示选中的专管员 --> >
<section class="select" @click="handlerClickSelect"> <el-option
{{ selectedUser ? selectedUser : '请选择专管员' }} v-for="dict in typeList"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="企业介绍" class="form-textarea" prop="introduction">
<el-input
v-model="formData.introduction"
placeholder="请输入企业介绍"
type="textarea"
maxlength="500"
show-word-limit
resize="none"
/>
</el-form-item>
<el-form-item label="环保负责人" prop="contactName">
<el-input v-model="formData.contactName" placeholder="请输入负责人名称" />
</el-form-item>
<el-form-item label="联系方式" prop="environmentalContactPhone">
<el-input
v-model="formData.environmentalContactPhone"
placeholder="请输入负责人联系方式"
/>
</el-form-item>
<el-form-item label="企业照片" prop="photo" class="form-photo">
<UploadImgs v-model="formData.photo" />
</el-form-item>
<section class="form-sub-title"> 执法配置</section>
<el-form-item label="执法人员" prop="userId">
<el-select
v-model="formData.userId"
placeholder="请选择执法人员"
filterable
clearable
>
<el-option
v-for="item in userList"
:key="item.userId"
:label="item.realName"
:value="item.userId"
popper-class="user-wrapper"
>
<el-avatar :src="item.avatar" :size="30" /> <span>{{ item.realName }}</span>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="签到半径" prop="signRadius">
<el-input-number
v-model="formData.signRadius"
:min="10"
:step="1"
placeholder="请输入执法半径"
controls-position="right"
class="!w-100%"
>
<template #suffix>
<span></span>
</template>
</el-input-number>
</el-form-item>
</section> </section>
</section> </el-form>
</el-form-item> </section>
<!-- <el-form-item label="企业关联微信用户" prop="address"> </section>
<el-select <section class="flex-1">
v-model="formData.enterpriseUserId" <section class="title-wrapper"> 相关资质 </section>
filterable </section>
placeholder="Select"
style="width: 240px"
>
<el-option
v-for="item in enterpriseUserList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item> -->
<el-form-item label="企业地址" prop="address">
<el-input v-model="formData.address" type="textarea" placeholder="请输入企业地址" />
</el-form-item>
<el-form-item label="企业环保负责人姓名" prop="contactName">
<el-input v-model="formData.contactName" placeholder="请输入环保负责人姓名" />
</el-form-item>
<el-form-item label="企业环保负责人联系电话" prop="environmentalContactPhone">
<el-input
v-model="formData.environmentalContactPhone"
placeholder="请输入企业环保负责人联系电话"
/>
</el-form-item>
<el-form-item label="企业注册号" prop="registrationNumber">
<el-input v-model="formData.registrationNumber" placeholder="请输入企业注册号" />
</el-form-item>
<el-form-item label="企业介绍" prop="introduction">
<el-input v-model="formData.introduction" type="textarea" placeholder="请输入企业介绍" />
</el-form-item>
<el-form-item label="企业照片" prop="fileIds">
<UploadImgs v-model="fileList" :limit="3" height="100px" width="100px" />
</el-form-item>
<el-form-item label="企业成立时间" prop="establishmentDate">
<el-date-picker
v-model="formData.establishmentDate"
type="date"
value-format="x"
placeholder="选择企业成立时间"
/>
</el-form-item>
<el-form-item label="企业经纬度" prop="gpsLocation">
<el-input
v-model="formData.gpsLocation"
placeholder="点击按钮选择坐标"
readonly
style="width: 500px"
>
<template #append>
<!-- 选择坐标按钮 -->
<el-button @click="showMap = true">选择坐标</el-button>
</template>
</el-input>
</el-form-item>
<!-- 地图弹窗 -->
<el-dialog v-model="showMap" title="选择坐标" width="80%" :before-el-close="handleClose">
<div>
<el-input
type="text"
v-model="formData.searchQuery"
placeholder="可通过名称联想搜索"
style="width: 20%"
/>
<el-button @click="handleSearch">搜索</el-button>
</div>
<div ref="mapContainerRef" style="width: 100%; height: 600px"></div>
<template #footer>
<el-button @click="showMap = false">关闭</el-button>
<el-button type="primary" @click="showMap = false">确定</el-button>
</template>
</el-dialog>
<el-form-item label="签到半径" prop="gpsLocation">
<el-input
v-model="formData.signRadius"
placeholder="请输入签到半径"
style="width: 280px"
/><span style="margin-left: 10px"></span>
</el-form-item>
<el-form-item style="align-items: center">
<el-button type="success" @click="submitForm">确认</el-button>
</el-form-item>
</el-form>
</section> </section>
<SelectUser ref="selectUserRef" @select-user="echoUser" /> <section>
</ContentWrap> <el-button>保存</el-button>
</section>
<el-card title="资质记录" v-if="formType === 'update'"> </content-wrap>
<template #header>
<div class="flex items-center justify-between">
<span class="text-16px font-700">资质记录</span>
<el-button type="primary" @click="openQualForm('create')">新增</el-button>
</div>
</template>
<el-table
v-loading="loading"
:data="qualificationlist"
:stripe="true"
:show-overflow-tooltip="true"
>
<el-table-column label="资质图片" align="center" fixed="left" prop="files">
<template #default="scope">
<UploadImgs
:disabled="true"
v-model="scope.row.files"
:limit="3"
height="100px"
width="100px"
/>
</template>
</el-table-column>
<el-table-column label="资质编号" align="center" fixed="left" prop="enterpriseAuth" />
<el-table-column label="资质名称" align="center" fixed="left" prop="qualificationName">
<template #default="scope">
<dict-tag :type="DICT_TYPE.ENTERPRISES_QUA" :value="scope.row.qualificationName" />
</template>
</el-table-column>
<el-table-column <GpsDialog ref="GpsDialogRef" @success="setGps" />
label="资质到期日期"
align="center"
prop="expiryDate"
:formatter="dateFormatter2"
width="180px"
/>
<el-table-column label="操作" align="center" min-width="120px">
<template #default="scope">
<el-button link type="primary" @click="openQualForm('update', scope.row.id)">
编辑
</el-button>
<el-button link type="danger" @click="handQualDelete(scope.row.id)"> 删除 </el-button>
</template>
</el-table-column>
</el-table>
</el-card>
<!-- 表单弹窗添加/修改 -->
<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">
<el-collapse-item
v-for="item in inspectionslist"
:key="item.taskId"
:name="item.taskName"
@click="getInspectionsLogList(item.id)"
>
<template #title>
<div class="custom-title"> 任务编号 {{ item.taskName }} </div>
<div class="custom-title"> 任务名称 {{ item.taskName }} </div>
<div class="custom-title"> 计划开始时间 {{ formatDate(item.taskStartTime) }} </div>
<div class="custom-title"> 计划结束时间 {{ formatDate(item.taskEndTime) }} </div>
</template>
<el-table
v-loading="loading"
:data="inspectionsLogList"
:stripe="true"
:show-overflow-tooltip="true"
>
<el-table-column label="执法人员" align="center" prop="inspectName" />
<el-table-column label="协同执法" align="center" prop="cooperateWithName" />
<el-table-column label="进度状态" align="center" prop="status">
<template #default="scope">
<dict-tag :type="DICT_TYPE.INSPECTIONS_STATUS" :value="scope.row.status" />
</template>
</el-table-column>
<el-table-column
label="执法时间"
align="center"
prop="createTime"
:formatter="dateFormatter"
width="180px"
/>
</el-table>
</el-collapse-item>
</el-collapse>
</div>
</ContentWrap>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { getStrDictOptions, DICT_TYPE } from '@/utils/dict' import { getStrDictOptions, DICT_TYPE } from '@/utils/dict'
import { EnterprisesApi } from '@/api/enterprises' import { TagLibraryApi } from '@/api/system/taglibrary'
import { EnterpriseQualificationApi, EnterpriseQualificationVO } from '@/api/qualification' import { getEnterpriseManager } from '@/api/system/user'
import { UserVO, getSimpleUserListByUserType } from '@/api/system/user'
import EnterpriseQualificationForm from '@/views/qualification/EnterpriseQualificationForm.vue'
import { EnterpriseInspectionsApi, EnterpriseInspectionsVO } from '@/api/enterpriseinspections'
import { UploadImgs } from '@/components/UploadFile' import { UploadImgs } from '@/components/UploadFile'
import * as FileApi from '@/api/infra/file' import GpsDialog from './components/getGpsByQq.vue'
import { ElMessage } from 'element-plus'
import SelectUser from './components/SelectUser.vue'
import * as UserApi from '@/api/system/user'
import { useTagsViewStore } from '@/store/modules/tagsView'
import { dateFormatter, dateFormatter2, formatDate } from '@/utils/formatTime'
/** 企业 表单 */ /** 企业 表单 */
defineOptions({ name: 'UpdateEnterprises' }) defineOptions({ name: 'UpdateEnterprises' })
const { t } = useI18n() // //
const message = useMessage() // const typeList = ref([] as any)
const dialogVisible = ref(false) // const userList = ref([] as any)
const formType = ref('') // create - update - const GpsDialogRef=ref()
const selectUserRef = ref()
const loading = ref(false)
const selectedUser = ref()
const router = useRouter()
const route = useRoute()
const tagView = useTagsViewStore()
const fileIds = ref([])
const qualificationlist = ref([])
const inspectionslist = ref([])
const inspectionsLogList = ref([])
const enterpriseUserList = ref([])
const formData = ref({ const formData = ref({
id: undefined, id: undefined,
departmentId: undefined, departmentId: undefined,
@ -282,375 +145,140 @@ const formData = ref({
managerDeptId: undefined, managerDeptId: undefined,
ides: undefined, ides: undefined,
startUserSelectAssignees: undefined, startUserSelectAssignees: undefined,
enterpriseUserId: undefined enterpriseUserId: undefined,
tags: undefined,
photo: undefined,
signRadius: 30
}) })
const fileList = ref([])
const getEnterpriseUserList = async () => {
const type: number = 2
const data = await getSimpleUserListByUserType(type)
console.log('datadata===>', data)
}
const formRules = reactive({ const formRules = reactive({
type: [{ required: true, message: '企业类型不能为空', trigger: 'change' }], type: [{ required: true, message: '企业类型不能为空', trigger: 'change' }],
enterprisesName: [{ required: true, message: '企业名称不能为空', trigger: 'blur' }], enterprisesName: [{ required: true, message: '企业名称不能为空', trigger: 'blur' }],
contactName: [{ required: true, message: '负责人不能为空', trigger: 'blur' }], contactName: [{ required: true, message: '负责人不能为空', trigger: 'blur' }],
environmentalContactPhone: [ environmentalContactPhone: [
{ required: true, message: '企业环保负责人联系电话不能为空', trigger: 'blur' } { required: true, message: '企业环保负责人联系电话不能为空', trigger: 'blur' }
] ],
}) userId: [
const formRef = ref() // Ref {
const { query } = useRoute() required: true,
message: '请选择执法人员',
function init() { trigger: 'change'
if (query.id) {
// id 'update'
formType.value = 'update'
EnterprisesApi.getEnterprises(query.id).then((res) => {
selectedUser.value = res.inviterName
// formData.value.startUserSelectAssignees=res.userId;
fileList.value = res.files
formData.value = res
})
} else {
formType.value = 'create'
}
}
//
const showMap = ref(false)
//
let map
//
let marker
let searchService = null
// const searchService = ref()
const mapContainerRef = ref<HTMLDivElement | null>(null)
//
const initMap = () => {
if (!window.qq || !window.qq.maps) {
ElMessage.error('腾讯地图 API 未加载完成')
return
}
if (!mapContainerRef.value) {
ElMessage.error('地图容器元素未找到')
return
}
map = new window.qq.maps.Map(mapContainerRef.value, {
center: new window.qq.maps.LatLng(41.520282, 121.265721), //
zoom: 14
})
//
window.qq.maps.event.addListener(map, 'click', (event: any) => {
const latLng = event.latLng
const lat = latLng.getLat()
const lng = latLng.getLng()
//
formData.value.gpsLocation = `${lat},${lng}`
//
if (marker) {
marker.setMap(null) //
} }
marker = new window.qq.maps.Marker({ ],
position: latLng, signRadius: [
map: map {
}) required: true,
}) message: '请输入执法半径',
trigger: 'change'
// searchService
searchService = new window.qq.maps.SearchService({
complete: (results) => {
// console.log(':', results) // results
if (results.detail && results.detail.pois.length > 0) {
const firstResult = results.detail.pois[0]
const position = firstResult.latLng
//
map.setCenter(position)
//
if (marker) {
marker.setMap(null)
}
marker = new window.qq.maps.Marker({
position: position,
map: map
})
//
formData.value.gpsLocation = `${position.getLat()},${position.getLng()}`
}
},
error: (e) => {
console.error('搜索出错:', e)
ElMessage.error('搜索出错,请重试')
} }
}) ],
} photo: [
{
// required: true,
const handleSearch = () => { message: '请上传企业照片',
if (searchService && formData.value.searchQuery) { trigger: 'change'
searchService.search(formData.value.searchQuery)
} else {
ElMessage.error('请输入搜索关键词')
}
}
/** 添加/修改操作 */
const formQualRef = ref()
const openQualForm = (type: string, id?: number) => {
formQualRef.value.open(type, id, formData.value.id)
}
/** 删除按钮操作 */
const handQualDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await EnterpriseQualificationApi.deleteEnterpriseQualification(id)
message.success(t('common.delSuccess'))
//
await getQualificationList()
} catch {}
}
onMounted(() => {
init()
//
if (query.id) {
getQualificationList()
getInspectionslList()
}
getEnterpriseUserList()
//getInspectionsLogList()
const openMapAndInit = async () => {
if (showMap.value) {
await nextTick() // DOM
if (qq && qq.maps) {
initMap() //
} else {
console.error('腾讯地图 API 未加载完成')
}
} }
} ],
introduction: [
// showMap {
watch( required: true,
showMap, message: '请输入企业介绍',
() => { trigger: 'change'
openMapAndInit() }
}, ],
{ immediate: true } address: [
) {
required: true,
message: '请输入企业地址',
trigger: 'change'
}
],
tags: [
{
required: true,
message: '请选择行业类别',
trigger: 'change'
}
],
region: [
{
required: true,
message: '请选择所属区域',
trigger: 'change'
}
]
}) })
/** 查询搜索项列表 */
function handlerClickSelect() { const getSelectOption = async () => {
// SelectUser open userList.value = await getEnterpriseManager()
unref(selectUserRef)?.open() const res = await TagLibraryApi.tagLibraryList('hy')
} typeList.value = res[0].children.map((t) => {
return {
function handlerSelectUser(row) { label: t.tagName,
if (formData.value.startUserSelectAssignees.findIndex((i) => i.id == row.id) > -1) return value: t.id
formData.value.startUserSelectAssignees.push(row)
}
/** 提交表单 */
const emit = defineEmits(['success']) // success
const submitForm = async () => {
//console.log(formData.value)
//
await formRef.value.validate()
//
loading.value = true
try {
let data = formData.value
// 1
data.enterprisesStatus = 1 as number
data.fileIds = (fileList.value || []).map((item: any) => item.id)
if (formType.value == 'create') {
await EnterprisesApi.pccreateEnterprises(data)
message.success(t('common.createSuccess'))
tagView.delView(route)
router.go(-1)
} else {
await EnterprisesApi.updateEnterprises(data)
message.success(t('common.updateSuccess'))
} }
dialogVisible.value = false })
//
emit('success')
} finally {
loading.value = false
//
tagView.delView(route)
router.go(-1)
}
}
const echoUser = async (v) => {
// console.log('',v)
const users = await UserApi.getUser(v)
selectedUser.value = users.username
formData.value.userId = users.id
}
/** 重置表单 */
const resetForm = () => {
formData.value = {
id: undefined,
departmentId: undefined,
userId: undefined,
type: undefined,
region: undefined,
enterprisesName: undefined,
address: undefined,
contactName: undefined,
environmentalContactPhone: undefined,
registrationNumber: undefined,
introduction: undefined,
establishmentDate: undefined,
gpsLocation: undefined,
searchadd: undefined,
managerDeptId: undefined,
startUserSelectAssignees: undefined
}
formRef.value?.resetFields()
}
const uploadList: any = ref([])
async function uploadSuccess(res) {
console.log(res.data.file_id)
fileIds.value.push(res.data.file_id)
if (res) {
await FileApi.createFile({
unitId: formData.value.id || id.value,
attachmentPath: res.data,
attachmentName: res.filename,
attachmentSuffix: res.type
//type: 4
}).then(() => {
loading.value.close()
dialogVisible.value = false
emit('success')
})
} else {
loading.value.close()
dialogVisible.value = false
emit('success')
}
} }
/** 资质查询列表 BY-ZY */ const setGps = (gps) => {
const getQualificationList = async () => { formData.value.gpsLocation = gps
loading.value = true
try {
const data = await EnterpriseQualificationApi.getEnterpriseQualificationPageEnterprise({
enterpriseId: query.id
})
qualificationlist.value = data.list
} finally {
loading.value = false
}
} }
/** 执法记录查询列表 by zy*/ const getGaps=()=>{
const getInspectionslList = async () => { unref(GpsDialogRef).open()
loading.value = true
try {
const data = await EnterpriseInspectionsApi.getEnterpriseInspectionsPage({
enterpriseId: query.id
})
if (!data.list || data.list.length === 0) {
console.log('No data or data is null')
} else {
inspectionslist.value = data.list
}
} finally {
loading.value = false
}
} }
/** 执法记录查询列表 by zy*/ getSelectOption()
const getInspectionsLogList = async (insprctionsId) => { onMounted(() => {})
console.log(insprctionsId)
loading.value = true
try {
const data = await EnterpriseInspectionsApi.inspectionsLogList({ inspectionsId: insprctionsId })
if (!data.list || data.list.length === 0) {
console.log('No data or data is null')
} else {
inspectionsLogList.value = data.list
}
} finally {
loading.value = false
}
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.selec-wrapper { .view-wrapper {
max-width: 400px;
display: flex; display: flex;
flex-flow: row nowrap; flex-flow: row nowrap;
gap: 5px; gap: 40px;
.title-wrapper {
.users { font-size: 16px;
flex: 1; line-height: 140%;
display: flex; font-weight: 700;
flex-flow: row wrap; margin-bottom: 40px;
gap: 5px;
} }
.form-photo {
.select { grid-column: span 2;
cursor: pointer; }
background-color: #f1faff; .base-form {
border: 1px dashed #00a3ff; display: grid;
padding: 1px 40px; grid-template-columns: repeat(2, 1fr);
color: #00a3ff; gap: 40px;
// color: #00a3ff; .form-textarea {
// text-decoration: underline; grid-row: span 2;
border-radius: 6px; ::v-deep(.el-textarea) {
height: fit-content; height: 100%;
.el-textarea__inner {
&:hover { height: 100%;
opacity: 0.8; white-space: pre-wrap;
&::-webkit-scrollbar {
width: 4px;
}
&::-webkit-scrollbar-thumb {
background-color: #ccc;
border-radius: 10px;
}
&::-webkit-scrollbar-track {
background-color: transparent;
}
&::-webkit-scrollbar-button {
display: none;
height: 2px;
}
}
}
}
.form-sub-title {
font-size: 16px;
line-height: 140%;
font-weight: 700;
grid-column: span 2;
} }
} }
} }
.modal-enter-from {
opacity: 0;
transition: 0.2s all;
}
.modal-leave-to {
opacity: 0;
}
.modal-enter-from .modal-container,
.modal-leave-to .modal-container {
-webkit-transform: scale(1.1);
transform: scale(1.1);
}
#map-container {
width: 100%;
height: 400px;
margin-top: 20px;
}
.custom-title {
font-size: 14px;
margin: 2% auto;
}
</style> </style>

21
src/views/task/index.vue

@ -164,7 +164,6 @@ const { push } = useRouter()
const loading = ref(true) // const loading = ref(true) //
const list = ref<TaskInfoVO[]>([]) // const list = ref<TaskInfoVO[]>([]) //
const total = ref(0) // const total = ref(0) //
const taskTypeMap = ref()
const queryParams = reactive({ const queryParams = reactive({
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
@ -191,8 +190,6 @@ const exportLoading = ref(false) // 导出的加载中
const taskTypeList: any = ref([]) const taskTypeList: any = ref([])
const mydateFormatter3 = () => {}
/** 查询列表 */ /** 查询列表 */
const getList = async () => { const getList = async () => {
loading.value = true loading.value = true
@ -214,21 +211,7 @@ const getList = async () => {
} }
} }
//
const taskExec = async (data) => {
loading.value = true
try {
await TaskInfoApi.taskExec(data)
message.success(t('common.createSuccess'))
getList()
} finally {
loading.value = false
}
}
//
const selectEnterprise = async (id: number) => {}
/** 搜索按钮操作 */ /** 搜索按钮操作 */
const handleQuery = () => { const handleQuery = () => {
@ -244,9 +227,7 @@ const resetQuery = () => {
/** 添加/修改操作 */ /** 添加/修改操作 */
const formRef = ref() const formRef = ref()
const openForm = (type: string, id?: number) => {
formRef.value.open(type, id)
}
/** 删除按钮操作 */ /** 删除按钮操作 */
const handleDelete = async (id: number) => { const handleDelete = async (id: number) => {

Loading…
Cancel
Save