Browse Source

企业添加定位细节

master
zy 2 months ago
parent
commit
b538636b59
  1. 4
      index.html
  2. 154
      src/views/enterprises/components/SelectUser.vue
  3. 268
      src/views/enterprises/update.vue
  4. 42
      src/views/system/user/index.vue
  5. 27
      src/views/task/create.vue

4
index.html

@ -140,8 +140,8 @@
</div> </div>
<script type="module" src="/src/main.ts"></script> <script type="module" src="/src/main.ts"></script>
<!-- <script charset="utf-8" src="https://map.qq.com/api/js?v=2.exp&key=PQ5BZ-GZ5C7-RTMXB-HSAPB-3TOAV-5CBLZ"></script> --> <script charset="utf-8" src="https://map.qq.com/api/js?v=2.exp&key=OB4BZ-D4W3U-B7VVO-4PJWW-6TKDJ-WPB77"></script>
<div id="app"></div>
</body> </body>
</html> </html>

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

@ -1,85 +1,22 @@
<template> <template>
<section class="select-wrapper" v-if="show"> <Teleport to="body">
<!-- 左侧部门树 --> <section class="view-container" v-show="show">
<section class="dept-wrapper"> <section class="user-conatiner">
<DeptTree @node-click="handleDeptNodeClick" /> <section class="close">
</section> <el-button type="primary" circle size="small" @click="close">
<section class="dept-wrapper"> <Icon icon="ep:close" /> </el-button
<el-table v-loading="loading" :data="list" @row-click="handleClickRow"> ></section>
<el-table-column label="用户编号" align="center" key="id" prop="id" /> <User ref="userComponent" isInset v-bind="$attrs" />
<el-table-column
label="用户名称"
align="center"
prop="username"
:show-overflow-tooltip="true"
/>
<el-table-column
label="用户昵称"
align="center"
prop="nickname"
:show-overflow-tooltip="true"
/>
<el-table-column
label="部门"
align="center"
key="deptName"
prop="deptName"
:show-overflow-tooltip="true"
/>
</el-table>
<Pagination
:total="total"
v-model:page="queryParams.pageNo"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
<el-button type="primary" class="close" circle size="small" @click="close">
<Icon icon="ep:close" />
</el-button>
</section> </section>
</section> </section>
</Teleport>
</template> </template>
<script lang="ts" setup>
import * as UserApi from '@/api/system/user'
import DeptTree from '@/views/system/user/DeptTree.vue'
import {getPcUserPage} from "@/api/system/user";
const show = ref(false)
const loading = ref(true) //
const total = ref(0) //
const list = ref([]) //
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
username: undefined,
mobile: undefined,
status: undefined,
deptId: undefined,
createTime: []
})
const emit = defineEmits(['select', 'close'])
/** 查询列表 */
const getList = async () => {
loading.value = true
try {
const data = await UserApi.getPcUserPage(queryParams)
list.value = data.list
total.value = data.total
} finally {
loading.value = false
}
}
/** 处理部门被点击 */
const handleDeptNodeClick = async (row) => {
queryParams.deptId = row.id
await getList()
}
function handleClickRow(row) { <script setup>
emit('select', row) import User from '@/views/system/user/index.vue'
} const show = ref(false)
function open() { const emit = defineEmits(['select'])
getList() const open = () => {
show.value = true show.value = true
} }
@ -87,51 +24,40 @@ function close() {
show.value = false show.value = false
emit('close') emit('close')
} }
defineExpose({ open })
const dblclickRow = (row) => {
emit('dbClickRow', row)
}
provide('closeParent', close);
defineExpose({
open
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.select-wrapper { .view-container {
background-color: #0000006f;
position: absolute;
inset: 0;
display: flex; display: flex;
flex-flow: row nowrap; justify-content: center;
align-items: center;
z-index: 9999;
.user-conatiner {
width: 80vw;
border-radius: 8px;
// overflow: hidden;
padding: 12px;
background-color: #fff; background-color: #fff;
padding: 10px;
padding-top: 50px;
border-radius: 6px;
min-height: 50vh;
position: relative; position: relative;
.close { .close {
position: absolute; position: absolute;
top: 10px; right: 0;
right: 10px; top: 0;
} transform: translateX(50%) translateY(-50%);
.selec-wrapper {
max-width: 400px;
display: flex;
flex-flow: row nowrap;
gap: 5px;
.users {
flex: 1;
display: flex;
flex-flow: row wrap;
gap: 5px;
}
.select {
cursor: pointer;
background-color: #f1faff;
border: 1px dashed #00a3ff;
padding: 0px 15px;
color: #00a3ff;
// color: #00a3ff;
// text-decoration: underline;
border-radius: 6px;
height: fit-content;
&:hover {
opacity: 0.8;
}
} }
} }
} }

268
src/views/enterprises/update.vue

@ -1,7 +1,17 @@
<template> <template>
<ContentWrap title="企业基本信息"> <ContentWrap
>{{ formData.id ? '修改企业信息' : '发布企业信息' }}
<section class="taskForm"> <section class="taskForm">
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="auto" v-loading="loading"> <el-form
ref="formRef"
:model="formData"
:rules="formRules"
label-width="auto"
v-loading="loading"
>
<el-form-item label="企业名称" prop="enterprisesName">
<el-input v-model="formData.enterprisesName" placeholder="请输入企业名称" />
</el-form-item>
<el-form-item label="企业类型" prop="type"> <el-form-item label="企业类型" prop="type">
<el-select v-model="formData.type" placeholder="请选择企业类型"> <el-select v-model="formData.type" placeholder="请选择企业类型">
<el-option <el-option
@ -12,6 +22,7 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="企业所属区域" prop="region"> <el-form-item label="企业所属区域" prop="region">
<el-select v-model="formData.region" placeholder="请选择企业所属区域"> <el-select v-model="formData.region" placeholder="请选择企业所属区域">
<el-option <el-option
@ -22,36 +33,26 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="专管员" prop="startUserSelectAssignees"> <el-form-item label="专管员" prop="startUserSelectAssignees">
<section class="selec-wrapper"> <section class="selec-wrapper">
<section class="users"> <!-- 动态显示选中的专管员 -->
<el-tag <section class="select" @click="handlerClickSelect">
v-for="user in formData.startUserSelectAssignees" {{ selectedUser ? selectedUser : '请选择专管员' }}
:key="user.id"
closable
@close="removeUser(user.id)"
>
{{ user.nickname }} {{ user.deptName }}
</el-tag>
</section> </section>
<section class="select" @click="handlerClickSelect"> 请选择专管员</section>
</section> </section>
</el-form-item> </el-form-item>
<el-form-item label="企业名称" prop="enterprisesName">
<el-input v-model="formData.enterprisesName" placeholder="请输入企业名称" />
</el-form-item>
<el-form-item label="企业地址" prop="address"> <el-form-item label="企业地址" prop="address">
<el-input v-model="formData.address" type="textarea" placeholder="请输入企业地址" /> <el-input v-model="formData.address" type="textarea" placeholder="请输入企业地址" />
</el-form-item> </el-form-item>
<el-form-item label="环保负责人姓名" prop="contactName"> <el-form-item label="企业环保负责人姓名" prop="contactName">
<el-input v-model="formData.contactName" placeholder="请输入环保负责人姓名" /> <el-input v-model="formData.contactName" placeholder="请输入环保负责人姓名" />
</el-form-item> </el-form-item>
<el-form-item label="企业环保负责人联系电话" prop="environmentalContactPhone"> <el-form-item label="企业环保负责人联系电话" prop="environmentalContactPhone">
<el-input v-model="formData.environmentalContactPhone" placeholder="请输入企业环保负责人联系电话" /> <el-input
v-model="formData.environmentalContactPhone"
placeholder="请输入企业环保负责人联系电话"
/>
</el-form-item> </el-form-item>
<el-form-item label="企业注册号" prop="registrationNumber"> <el-form-item label="企业注册号" prop="registrationNumber">
<el-input v-model="formData.registrationNumber" placeholder="请输入企业注册号" /> <el-input v-model="formData.registrationNumber" placeholder="请输入企业注册号" />
@ -67,6 +68,18 @@
@handler-remove="uploadRemove" @handler-remove="uploadRemove"
/> />
</el-form-item> </el-form-item>
<el-form-item label="企业资质照片" prop="size">
<InnerUploadImg
:uploadList="uploadList"
@handler-success="uploadSuccess"
ref="uploadRef"
@handler-remove="uploadRemove"
/>
</el-form-item>
<el-form-item label="企业成立时间" prop="establishmentDate"> <el-form-item label="企业成立时间" prop="establishmentDate">
<el-date-picker <el-date-picker
v-model="formData.establishmentDate" v-model="formData.establishmentDate"
@ -76,12 +89,12 @@
/> />
</el-form-item> </el-form-item>
<el-form-item label="企业经纬度" prop="gpsLocation"> <el-form-item label="企业经纬度" prop="gpsLocation">
<el-input <el-input
v-model="formData.gpsLocation" v-model="formData.gpsLocation"
placeholder="点击按钮选择坐标" placeholder="点击按钮选择坐标"
readonly readonly
style="width: 500px"
> >
<template #append> <template #append>
<!-- 选择坐标按钮 --> <!-- 选择坐标按钮 -->
@ -91,39 +104,36 @@
</el-form-item> </el-form-item>
<!-- 地图弹窗 --> <!-- 地图弹窗 -->
<el-dialog <el-dialog v-model="showMap" title="选择坐标" width="80%" :before-el-close="handleClose">
v-model="showMap" <div>
title="选择坐标" <el-input
width="80%" type="text"
:before-close="handleClose" v-model="formData.searchQuery"
> placeholder="可通过名称联想搜索"
<div id="map-container" style="width: 100%; height: 400px;"></div> style="width: 20%"
/>
<el-button @click="handleSearch">搜索</el-button>
</div>
<div ref="mapContainerRef" style="width: 100%; height: 600px"></div>
<template #footer> <template #footer>
<el-button @click="showMap = false">取消</el-button> <el-button @click="showMap = false">关闭</el-button>
<el-button type="primary" @click="confirmCoordinate">确定</el-button> <el-button type="primary" @click="showMap = false">确定</el-button>
</template> </template>
</el-dialog> </el-dialog>
<el-form-item label="签到半径" prop="gpsLocation" > <el-form-item label="签到半径" prop="gpsLocation">
<el-input v-model="formData.signRadius" placeholder="请输入签到半径" style="width: 280px;" /><span style="margin-left: 10px">单位</span> <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-item>
</el-form> </el-form>
</section> </section>
<SelectUser ref="selectUserRef" @select-user="echoUser" />
<el-dialog v-model="dialogVisible" title="选择用户">
<!-- SelectUser 组件放入弹框中 -->
<template #content>
<SelectUser ref="selectUserRef" @select="handlerSelectUser" />
</template>
<!-- 弹框底部的取消和确定按钮 -->
<template #footer>
<el-button @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="dialogVisible = false">确定</el-button>
</template>
</el-dialog>
</ContentWrap> </ContentWrap>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@ -131,7 +141,8 @@ import { getStrDictOptions, DICT_TYPE } from '@/utils/dict'
import { EnterprisesApi, EnterprisesVO } from '@/api/enterprises' import { EnterprisesApi, EnterprisesVO } from '@/api/enterprises'
import { FileInfoApi } from '@/api/enterprises/fileinfo' import { FileInfoApi } from '@/api/enterprises/fileinfo'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import SelectUser from '@/views/enterprises/components/SelectUser.vue' import SelectUser from './components/SelectUser.vue'
import * as UserApi from '@/api/system/user'
/** 企业 表单 */ /** 企业 表单 */
defineOptions({ name: 'UpdateEnterprises' }) defineOptions({ name: 'UpdateEnterprises' })
@ -143,6 +154,8 @@ const formLoading = ref(false) // 表单的加载中:1)修改时的数据加
const formType = ref('') // create - update - const formType = ref('') // create - update -
const selectUserRef = ref() const selectUserRef = ref()
const loading = ref(false) const loading = ref(false)
const selectedUser = ref()
const formData = ref({ const formData = ref({
id: undefined, id: undefined,
departmentId: undefined, departmentId: undefined,
@ -152,44 +165,152 @@ const formData = ref({
enterprisesName: undefined, enterprisesName: undefined,
address: undefined, address: undefined,
contactName: undefined, contactName: undefined,
enterprisesStatus:undefined,
environmentalContactPhone: undefined, environmentalContactPhone: undefined,
registrationNumber: undefined, registrationNumber: undefined,
introduction: undefined, introduction: undefined,
establishmentDate: undefined, establishmentDate: undefined,
gpsLocation: undefined, gpsLocation: undefined,
searchQuery: undefined,
managerDeptId: undefined, managerDeptId: undefined,
ides:undefined, ides: undefined,
startUserSelectAssignees: [] startUserSelectAssignees:undefined
}) })
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' }],
environmentalContactPhone: [{ required: true, message: '企业环保负责人联系电话不能为空', trigger: 'blur' }]
}) })
const formRef = ref() // Ref const formRef = ref() // Ref
const {query}=useRoute() const { query } = useRoute()
function init() {
if (query.id) {
// id 'update'
formType.value = 'update'
EnterprisesApi.getEnterprises(query.id).then((res) => {
selectedUser.value=res.inviterName;
// formData.value.startUserSelectAssignees=res.userId;
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
}
function init(){ map = new window.qq.maps.Map(mapContainerRef.value, {
if(query.id){ center: new window.qq.maps.LatLng(41.520282, 121.265721), //
EnterprisesApi.getEnterprises(query.id).then(res=>{ zoom: 14
formData.value=res
}) })
//
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,
map: map
})
})
// 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('搜索出错,请重试')
}
})
} }
//
const handleSearch = () => {
if (searchService && formData.value.searchQuery) {
searchService.search(formData.value.searchQuery)
} else {
ElMessage.error('请输入搜索关键词')
}
}
onMounted(()=>{ onMounted(() => {
init() init()
})
const openMapAndInit = async () => {
if (showMap.value) {
await nextTick() // DOM
if (qq && qq.maps) {
initMap() //
} else {
console.error('腾讯地图 API 未加载完成')
}
}
}
// showMap
watch(
showMap,
() => {
openMapAndInit()
},
{ immediate: true }
)
})
function handlerClickSelect() { function handlerClickSelect() {
dialogVisible.value = true;
// SelectUser open // SelectUser open
unref(selectUserRef)?.open(); unref(selectUserRef)?.open()
} }
function handlerSelectUser(row) { function handlerSelectUser(row) {
if (formData.value.startUserSelectAssignees.findIndex((i) => i.id == row.id) > -1) return if (formData.value.startUserSelectAssignees.findIndex((i) => i.id == row.id) > -1) return
formData.value.startUserSelectAssignees.push(row) formData.value.startUserSelectAssignees.push(row)
@ -200,12 +321,15 @@ const emit = defineEmits(['success']) // 定义 success 事件,用于操作成
const submitForm = async () => { const submitForm = async () => {
// //
await formRef.value.validate() await formRef.value.validate()
formData.value.enterprisesStatus=1;
// //
loading.value = true loading.value = true
try { try {
const data = formData.value as unknown as EnterprisesVO const data = formData.value as unknown as EnterprisesVO
if (formType.value === 'create') { if (formType.value === 'create') {
await EnterprisesApi.createEnterprises(data)
await EnterprisesApi.pccreateEnterprises(data)
message.success(t('common.createSuccess')) message.success(t('common.createSuccess'))
} else { } else {
await EnterprisesApi.updateEnterprises(data) await EnterprisesApi.updateEnterprises(data)
@ -219,6 +343,13 @@ const submitForm = async () => {
} }
} }
const echoUser = async (v) => {
// console.log('',v)
const users = await UserApi.getUser(v)
selectedUser.value = users.username
formData.value.userId=users.id
}
/** 重置表单 */ /** 重置表单 */
const resetForm = () => { const resetForm = () => {
formData.value = { formData.value = {
@ -235,8 +366,9 @@ const resetForm = () => {
introduction: undefined, introduction: undefined,
establishmentDate: undefined, establishmentDate: undefined,
gpsLocation: undefined, gpsLocation: undefined,
searchadd: undefined,
managerDeptId: undefined, managerDeptId: undefined,
startUserSelectAssignees: [] startUserSelectAssignees: undefined
} }
formRef.value?.resetFields() formRef.value?.resetFields()
} }
@ -282,13 +414,10 @@ function uploadRemove(file) {
ElMessage.success('删除成功') ElMessage.success('删除成功')
}) })
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.selec-wrapper { .selec-wrapper {
max-width: 400px; max-width: 400px;
display: flex; display: flex;
flex-flow: row nowrap; flex-flow: row nowrap;
@ -305,7 +434,7 @@ function uploadRemove(file) {
cursor: pointer; cursor: pointer;
background-color: #f1faff; background-color: #f1faff;
border: 1px dashed #00a3ff; border: 1px dashed #00a3ff;
padding: 0px 15px; padding: 1px 40px;
color: #00a3ff; color: #00a3ff;
// color: #00a3ff; // color: #00a3ff;
// text-decoration: underline; // text-decoration: underline;
@ -316,7 +445,7 @@ function uploadRemove(file) {
opacity: 0.8; opacity: 0.8;
} }
} }
} }
.modal-enter-from { .modal-enter-from {
opacity: 0; opacity: 0;
@ -338,7 +467,4 @@ function uploadRemove(file) {
height: 400px; height: 400px;
margin-top: 20px; margin-top: 20px;
} }
</style> </style>

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

@ -1,8 +1,4 @@
<template> <template>
<el-row :gutter="20"> <el-row :gutter="20">
<!-- 左侧部门树 --> <!-- 左侧部门树 -->
<el-col :span="4" :xs="24"> <el-col :span="4" :xs="24">
@ -38,7 +34,7 @@
class="!w-240px" class="!w-240px"
/> />
</el-form-item> </el-form-item>
<el-form-item label="状态" prop="status"> <el-form-item label="状态" prop="status" v-if="!isInset">
<el-select <el-select
v-model="queryParams.status" v-model="queryParams.status"
placeholder="用户状态" placeholder="用户状态"
@ -53,7 +49,7 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="创建时间" prop="createTime"> <el-form-item label="创建时间" prop="createTime" v-if="!isInset">
<el-date-picker <el-date-picker
v-model="queryParams.createTime" v-model="queryParams.createTime"
value-format="YYYY-MM-DD HH:mm:ss" value-format="YYYY-MM-DD HH:mm:ss"
@ -71,6 +67,7 @@
plain plain
@click="openForm('create')" @click="openForm('create')"
v-hasPermi="['system:user:create']" v-hasPermi="['system:user:create']"
v-if="!isInset"
> >
<Icon icon="ep:plus" /> 新增 <Icon icon="ep:plus" /> 新增
</el-button> </el-button>
@ -79,6 +76,7 @@
plain plain
@click="handleImport" @click="handleImport"
v-hasPermi="['system:user:import']" v-hasPermi="['system:user:import']"
v-if="!isInset"
> >
<Icon icon="ep:upload" /> 导入 <Icon icon="ep:upload" /> 导入
</el-button> </el-button>
@ -88,6 +86,7 @@
@click="handleExport" @click="handleExport"
:loading="exportLoading" :loading="exportLoading"
v-hasPermi="['system:user:export']" v-hasPermi="['system:user:export']"
v-if="!isInset"
> >
<Icon icon="ep:download" />导出 <Icon icon="ep:download" />导出
</el-button> </el-button>
@ -117,7 +116,7 @@
:show-overflow-tooltip="true" :show-overflow-tooltip="true"
/> />
<el-table-column label="手机号码" align="center" prop="mobile" width="120" /> <el-table-column label="手机号码" align="center" prop="mobile" width="120" />
<el-table-column label="状态" key="status"> <el-table-column label="状态" key="status" v-if="!isInset">
<template #default="scope"> <template #default="scope">
<el-switch <el-switch
v-model="scope.row.status" v-model="scope.row.status"
@ -135,7 +134,7 @@
:formatter="dateFormatter" :formatter="dateFormatter"
width="180" width="180"
/> />
<el-table-column label="操作" align="center" width="160"> <el-table-column label="操作" align="center" width="160" v-if="!isInset">
<template #default="scope"> <template #default="scope">
<div class="flex items-center justify-center"> <div class="flex items-center justify-center">
<el-button <el-button
@ -181,6 +180,13 @@
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" width="100" v-if="isInset">
<template #default="{ row }">
<el-button type="primary" link @click="selectUser(row.id)">
<Icon icon="ep:select" />选择
</el-button>
</template>
</el-table-column>
</el-table> </el-table>
<Pagination <Pagination
:total="total" :total="total"
@ -213,6 +219,14 @@ import DeptTree from './DeptTree.vue'
defineOptions({ name: 'SystemUser' }) defineOptions({ name: 'SystemUser' })
const closeParent = inject('closeParent');
const props = defineProps({
isInset: {
type: Boolean,
default: false
}
})
const message = useMessage() // const message = useMessage() //
const { t } = useI18n() // const { t } = useI18n() //
@ -226,13 +240,12 @@ const queryParams = reactive({
mobile: undefined, mobile: undefined,
status: undefined, status: undefined,
deptId: undefined, deptId: undefined,
audit: "2", audit: '2',
userType: "3", userType: '3',
createTime: [] createTime: []
}) })
const queryFormRef = ref() // const queryFormRef = ref() //
const emit = defineEmits(['selectUser'])
/** 查询列表 */ /** 查询列表 */
const getList = async () => { const getList = async () => {
loading.value = true loading.value = true
@ -245,6 +258,11 @@ const getList = async () => {
} }
} }
const selectUser = (id) => {
emit('selectUser', id)
closeParent();
}
/** 搜索按钮操作 */ /** 搜索按钮操作 */
const handleQuery = () => { const handleQuery = () => {
queryParams.pageNo = 1 queryParams.pageNo = 1

27
src/views/task/create.vue

@ -18,19 +18,13 @@
<el-form-item label="类型" prop="taskType"> <el-form-item label="类型" prop="taskType">
<el-tree-select <el-tree-select
v-model="formData.tags" v-model="formData.taskType"
:data="tagList" :data="typeList"
:props="defaultProps"
check-strictly check-strictly
:render-after-expand="false"
placeholder="请选择类型"
node-key="id" node-key="id"
show-checkbox placeholder="请选择归属部门"
multiple
:props="{
label: 'tagName'
}"
/> />
</el-form-item> </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">
@ -252,12 +246,10 @@ import { TagLibraryApi } from '@/api/system/taglibrary'
import { EnterprisesApi, EnterprisesVO } from '@/api/enterprises' import { EnterprisesApi, EnterprisesVO } from '@/api/enterprises'
import { TaskInfoApi } from '@/api/system/taskinfo' import { TaskInfoApi } from '@/api/system/taskinfo'
import { useTagsViewStore} from '@/store/modules/tagsView' import { useTagsViewStore} from '@/store/modules/tagsView'
import {defaultProps, handleTree} from "@/utils/tree"; import {defaultProps} from "@/utils/tree";
defineOptions({ name: 'CreateTask' }) defineOptions({ name: 'CreateTask' })
const typeList = ref<Tree[]>([]) //
const loading = ref(false) const loading = ref(false)
const formData = ref({ const formData = ref({
id: undefined, id: undefined,
@ -323,11 +315,14 @@ const resetQuery = () => {
handleQuery() handleQuery()
} }
//
typeList.value = handleTree(await DeptApi.getSimpleDeptList())
/** /**
* 获取标签列表 * 获取标签列表
*/ */
function getTagList() { function getTagList() {
TagLibraryApi.getTagLibraryPage({tagType:'2'}).then((res) => { TagLibraryApi.getTagLibraryPage({}).then((res) => {
tagList.value = res tagList.value = res
}) })
} }
@ -403,7 +398,7 @@ function uniqueFunc(arr, uniId) {
const res = new Map() const res = new Map()
return arr.filter((item) => !res.has(item[uniId]) && res.set(item[uniId], 1)) return arr.filter((item) => !res.has(item[uniId]) && res.set(item[uniId], 1))
} }
// typeList.value = handleTree(await TagLibraryApi.getTagLibraryPage(formData.value.id))
/** /**
* 提交表单 * 提交表单
*/ */

Loading…
Cancel
Save