Browse Source

创建任务页面优化

master
DX 4 weeks ago
parent
commit
667ccbcfde
  1. 4
      src/api/enterprises/index.ts
  2. 5
      src/api/system/taglibrary/index.ts
  3. 306
      src/views/task/create copy.vue
  4. 182
      src/views/task/createEnterprise.vue

4
src/api/enterprises/index.ts

@ -27,6 +27,10 @@ export const EnterprisesApi = {
return await request.get({ url: `/system/enterprise/pcpage`, params }) return await request.get({ url: `/system/enterprise/pcpage`, params })
}, },
getEnterpriseByUserId: async (params: any) => {
return await request.get({ url: `/system/enterprise/getEnterpriseByUserId`, params })
},
// 查询企业详情 // 查询企业详情
getEnterprises: async (id: any) => { getEnterprises: async (id: any) => {
return await request.get({ url: `/system/enterprise/get?id=` + id }) return await request.get({ url: `/system/enterprise/get?id=` + id })

5
src/api/system/taglibrary/index.ts

@ -38,6 +38,11 @@ export const TagLibraryApi = {
return await request.delete({ url: `/system/tag-library/delete?id=` + id }) return await request.delete({ url: `/system/tag-library/delete?id=` + id })
}, },
// 删除企业标签
tagLibraryList: async (codeList: string) => {
return await request.get({ url: `/system/tag-library/list?` + codeList })
},
// 导出企业标签 Excel // 导出企业标签 Excel
exportTagLibrary: async (params) => { exportTagLibrary: async (params) => {
return await request.download({ url: `/system/tag-library/export-excel`, params }) return await request.download({ url: `/system/tag-library/export-excel`, params })

306
src/views/task/create copy.vue

@ -78,15 +78,19 @@
<!-- <template #header> </template> --> <!-- <template #header> </template> -->
<section class="select-area" v-loading="loading"> <section class="select-area" v-loading="loading">
<section> <section>
<el-form :model="enterprise.queryParams" ref="queryFormRef" :inline="true" label-width="0" class="search-form"> <el-form
:model="enterprise.queryParams"
ref="queryFormRef"
:inline="true"
label-width="0"
class="search-form"
>
<div class="form-container"> <div class="form-container">
<el-form-item label="" prop="region" class="form-item"> <el-form-item label="" prop="region" class="form-item">
<el-select <el-select
v-model="enterprise.queryParams.region" v-model="enterprise.queryParams.qy"
placeholder="请选择所属区域" placeholder="请选择所属区域"
clearable clearable
@clear="handleQuery"
@change="handleQuery"
> >
<el-option <el-option
v-for="dict in getStrDictOptions(DICT_TYPE.ENTERPRISES_AREA)" v-for="dict in getStrDictOptions(DICT_TYPE.ENTERPRISES_AREA)"
@ -98,66 +102,56 @@
</el-form-item> </el-form-item>
<el-form-item label="" prop="type" class="form-item"> <el-form-item label="" prop="type" class="form-item">
<el-select <el-select
v-model="enterprise.queryParams.type" v-model="enterprise.queryParams.hy"
placeholder="请选择行业" placeholder="请选择行业"
clearable clearable
@change="handleQuery"
@clear="handleQuery"
> >
<el-option <el-option
v-for="dict in getStrDictOptions(DICT_TYPE.ENTERPRISES_TYPE)" v-for="dict in hyList"
:key="dict.value" :key="dict.id"
:label="dict.label" :label="dict.tagName"
:value="dict.value" :value="dict.id"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="" prop="type" class="form-item"> <el-form-item label="" prop="type" class="form-item">
<el-select <el-select
v-model="enterprise.queryParams.type" v-model="enterprise.queryParams.st"
placeholder="请选择生态" placeholder="请选择生态"
clearable
@change="handleQuery"
@clear="handleQuery"
> >
<el-option <el-option
v-for="dict in getStrDictOptions(DICT_TYPE.ENTERPRISES_TYPE)" v-for="dict in stList"
:key="dict.value" :key="dict.id"
:label="dict.label" :label="dict.tagName"
:value="dict.value" :value="dict.id"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="" prop="type" class="form-item"> <el-form-item label="" prop="type" class="form-item">
<el-select <el-select
v-model="enterprise.queryParams.type" v-model="enterprise.queryParams.wr"
placeholder="请选择类型" placeholder="请选择污染程度"
clearable
@change="handleQuery"
@clear="handleQuery"
> >
<el-option <el-option
v-for="dict in getStrDictOptions(DICT_TYPE.ENTERPRISES_TYPE)" v-for="dict in wrList"
:key="dict.value" :key="dict.id"
:label="dict.label" :label="dict.tagName"
:value="dict.value" :value="dict.id"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="" prop="enterprisesName" class="form-item"> <el-form-item label="" prop="enterprisesName" class="form-item">
<el-input <el-input
v-model="enterprise.queryParams.enterprisesName" v-model="enterprise.queryParams.inviterName"
placeholder="请选择执法人员" placeholder="请选择执法人员"
clearable clearable
@keyup.enter="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="" prop="enterprisesName" class="form-item"> <el-form-item label="" prop="enterprisesName" class="form-item">
<el-input <el-input
v-model="enterprise.queryParams.enterprisesName" v-model="enterprise.queryParams.enterprisesName"
placeholder="请输入企业名称" placeholder="请输入企业名称"
clearable
@keyup.enter="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item class="form-item"> <el-form-item class="form-item">
@ -165,8 +159,8 @@
<Icon icon="ep:search" class="mr-5px" /> 搜索 <Icon icon="ep:search" class="mr-5px" /> 搜索
</el-button> </el-button>
<el-button @click="resetQuery" class="mr-10px"> <el-button @click="resetQuery" class="mr-10px">
<Icon icon="ep:refresh" class="mr-5px" /> 重置 </el-button <Icon icon="ep:refresh" class="mr-5px" /> 重置
> </el-button>
</el-form-item> </el-form-item>
<el-form-item class="action-buttons"> <el-form-item class="action-buttons">
<el-button @click="insertEnterprise" type="primary"> <el-button @click="insertEnterprise" type="primary">
@ -175,12 +169,11 @@
</el-form-item> </el-form-item>
</div> </div>
</el-form> </el-form>
<section class="enterprise-area"> <section class="enterprise-area" style="border: 1px solid #ebeef5">
<el-table <el-table
ref="multipleTableRef" ref="multipleTableRef"
:data="enterprise.list" :data="enterprise.list"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
style="width: 100%; border: 1px solid #EBEEF5; "
:cell-style="{ borderBottom: '1px solid #EBEEF5' }" :cell-style="{ borderBottom: '1px solid #EBEEF5' }"
:header-cell-style="{ :header-cell-style="{
borderBottom: '1px solid #EBEEF5', borderBottom: '1px solid #EBEEF5',
@ -189,7 +182,7 @@
> >
<template #empty> <template #empty>
<div class="no-data"> <div class="no-data">
<el-image src="/src/assets/imgs/no_data.png" style="width: 120px;" /> <el-image src="/src/assets/imgs/no_data.png" style="width: 120px" />
<p>暂无数据</p> <p>暂无数据</p>
</div> </div>
</template> </template>
@ -197,13 +190,28 @@
<el-table-column property="enterprisesName" label="企业名称" min-width="100" /> <el-table-column property="enterprisesName" label="企业名称" min-width="100" />
<el-table-column property="region" label="区域" min-width="100"> <el-table-column property="region" label="区域" min-width="100">
<template #default="scope"> <template #default="scope">
{{ getStrDictOptions(DICT_TYPE.ENTERPRISES_AREA).find(dict => dict.value == scope.row.region)?.label || '未知区域' }} {{
getStrDictOptions(DICT_TYPE.ENTERPRISES_AREA).find(
(dict) => dict.value == scope.row.region
)?.label || '未知区域'
}}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column property="enterprisesName" label="行业" min-width="100" /> <el-table-column property="enterprisesName" label="行业" min-width="100" />
<el-table-column property="enterprisesName" label="生态" min-width="100" /> <el-table-column property="enterprisesName" label="生态" min-width="100" />
<el-table-column property="enterprisesName" label="类型" min-width="100" /> <el-table-column property="enterprisesName" label="类型" min-width="100" />
<el-table-column property="enterprisesName" label="执法人员" min-width="100" /> <el-table-column property="enterprisesName" label="执法人员" min-width="100" />
<el-table-column label="操作" align="center" min-width="80px">
<template #default="scope">
<el-button
link
type="danger"
@click="handleDelete(scope.row.id)"
>
删除
</el-button>
</template>
</el-table-column>
</el-table> </el-table>
</section> </section>
<pagination <pagination
@ -219,16 +227,21 @@
<div class="footer"> <div class="footer">
<el-button type="primary" @click="submitForm"> </el-button> <el-button type="primary" @click="submitForm"> </el-button>
<el-button <el-button
type="primary" @click="submitForm" v-hasPermi="['system:enterprise-inspections:audit']">审核通过</el-button> type="primary"
@click="submitForm"
v-hasPermi="['system:enterprise-inspections:audit']"
>审核通过</el-button
>
<el-button <el-button
type="danger" type="danger"
@click="submitForm" @click="submitForm"
v-hasPermi="['system:enterprise-inspections:audit']" v-hasPermi="['system:enterprise-inspections:audit']"
>删除</el-button> >删除</el-button
>
</div> </div>
</section> </section>
</ContentWrap> </ContentWrap>
<CreateEnterprise ref="formRef"/> <CreateEnterprise ref="formRef" @success="getList" />
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { DICT_TYPE, getIntDictOptions, getStrDictOptions } from '@/utils/dict' import { DICT_TYPE, getIntDictOptions, getStrDictOptions } from '@/utils/dict'
@ -236,8 +249,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} from "@/utils/tree"; import { defaultProps } from '@/utils/tree'
import CreateEnterprise from './createEnterprise.vue' import CreateEnterprise from './createEnterprise.vue'
import { cloneDeep } from 'lodash-es';
defineOptions({ name: 'CreateTask' }) defineOptions({ name: 'CreateTask' })
const loading = ref(false) const loading = ref(false)
@ -281,64 +296,171 @@ const formRef = ref() // 表单 Ref`
const tagList = ref([]) const tagList = ref([])
const queryFormRef = ref() // const queryFormRef = ref() //
const enterprise = ref({ const enterprise = ref({
list: ref<EnterprisesVO[]>(), list: [] as any,
queryParams: reactive({ queryParams: reactive({
pageNo: 1, pageNo: 1,
pageSize: 9, pageSize: 9,
enterprisesName: undefined, enterprisesName: undefined,
type: undefined, qy: undefined,
region: undefined, hy: undefined,
registrationNumber: undefined, st: undefined,
id:undefined wr: undefined,
inviterName: undefined
}), }),
total: ref(0) total: ref(0) as any
}) })
const handleDelete = (id: number) => {
//
const targetIndex = enterprise.value.list.findIndex(item => item.id === id);
if (targetIndex === -1) return;
//
enterprise.value.list.splice(targetIndex, 1);
enterprise_copy.value = cloneDeep(enterprise.value);
enterprise.value.total = enterprise.value.list.length
//
const { pageNo, pageSize } = enterprise.value.queryParams;
const itemsOnCurrentPage = enterprise.value.list.slice(
(pageNo - 1) * pageSize,
pageNo * pageSize
);
if (itemsOnCurrentPage.length === 0 && pageNo > 1) {
enterprise.value.queryParams.pageNo = pageNo - 1;
}
}
const enterprise_copy = ref({
list: [] as any,
queryParams: reactive({
pageNo: 1,
pageSize: 9,
enterprisesName: undefined,
qy: undefined,
hy: undefined,
st: undefined,
wr: undefined,
inviterName: undefined
}),
total: ref(0) as any
})
//
const isAllConditionsEmpty = computed(() => {
const params = enterprise.value.queryParams;
return (
!params.enterprisesName &&
!params.qy &&
!params.hy &&
!params.st &&
!params.wr &&
!params.inviterName
);
});
/** 搜索按钮操作 */ /** 搜索按钮操作 */
const handleQuery = () => { const handleQuery = () => {
enterprise.value.queryParams.pageNo = 1
getEnterPriseList() const list = filterList(enterprise.value.list)
console.log('listlist', list)
enterprise.value.list = list
enterprise.value.total = list?.length
}
//
const filterList = (list: EnterprisesVO[]) => {
if (isAllConditionsEmpty.value) return enterprise_copy.value.list; //
if (list.length > 0) {
const { enterprisesName, qy, hy, st, wr , inviterName } = enterprise.value.queryParams;
return list.filter(item => {
//
const nameMatch = enterprisesName ?
item.enterprisesName?.toLowerCase().includes(enterprisesName.toLowerCase()) : true;
//
const typeMatch = qy ? item.region == qy : true;
//
// const regionMatch = hy ? item.region === region : true;
// //
// const regNumMatch = registrationNumber ?
// item.registrationNumber === registrationNumber : true;
// // ID
// const idMatch = id !== undefined ? item.id === id : true;
// return nameMatch && typeMatch && regionMatch && regNumMatch && idMatch;
return nameMatch && typeMatch
});
}
} }
// //
// const filteredData = computed(() => {
// return filterList(enterprise.value.list);
// });
//
// const pagedData = computed(() => {
// const { pageNo, pageSize } = enterprise.value.queryParams;
// const start = (pageNo - 1) * pageSize;
// const end = start + pageSize;
// return filteredData.value.slice(start, end);
// });
// //
// watch(filteredData, (newList) => {
// enterprise.value.total = newList.length;
// }, { immediate: true });
const insertEnterprise = () => { const insertEnterprise = () => {
formRef.value.open() formRef.value.open()
} }
/** 重置按钮操作 */ /** 重置按钮操作 */
const resetQuery = () => { const resetQuery = () => {
queryFormRef.value.resetFields() queryFormRef.value.resetFields()
handleQuery() handleQuery()
} }
//
const hyList:any = ref([])
//
const stList:any = ref([])
//
const wrList:any = ref([])
/** /**
* 获取标签列表 * 获取标签列表
*/ */
function getTagList() { async function getTagList() {
TagLibraryApi.getTagLibraryPage({tagType:2}).then((res) => { const codeList = 'codeList=hy&codeList=st&codeList=wr'
tagList.value = res const data = await TagLibraryApi.tagLibraryList(codeList)
})
hyList.value = data[0].children
stList.value = data[1].children
wrList.value = data[2].children
} }
const defaultProps = { const defaultProps = {
label: 'tagName', // 使 'name' label: 'tagName', // 使 'name'
children: 'children', // 使 'children' children: 'children' // 使 'children'
};
/**
* 获取企业列表
*/
async function getEnterPriseList() {
loading.value = true
try {
const data = await EnterprisesApi.getEnterprisesPage(enterprise.value.queryParams)
enterprise.value.list = data.list
enterprise.value.total = data.total
} finally {
loading.value = false
}
} }
/** /**
* 全选 * 全选
*/ */
async function selectAll() { async function selectAll() {
loading.value = true loading.value = true
const data = JSON.parse(JSON.stringify(enterprise.value.queryParams)); const data = JSON.parse(JSON.stringify(enterprise.value.queryParams))
data.pageSize = -1 data.pageSize = -1
delete data.pageNo delete data.pageNo
const { list } = await EnterprisesApi.getEnterprisesPage(data) const { list } = await EnterprisesApi.getEnterprisesPage(data)
@ -351,7 +473,7 @@ async function selectAll() {
*/ */
async function cancelAll() { async function cancelAll() {
loading.value = true loading.value = true
const data = JSON.parse(JSON.stringify(enterprise.value.queryParams)); const data = JSON.parse(JSON.stringify(enterprise.value.queryParams))
data.pageSize = -1 data.pageSize = -1
delete data.pageNo delete data.pageNo
const { list } = await EnterprisesApi.getEnterprisesPage(data) const { list } = await EnterprisesApi.getEnterprisesPage(data)
@ -394,11 +516,11 @@ async function submitForm() {
if (validate) { if (validate) {
const data = JSON.parse(JSON.stringify(formData.value)) const data = JSON.parse(JSON.stringify(formData.value))
//1 //1
data.status=1; data.status = 1
console.log("任务类型:",formData.value.taskType) console.log('任务类型:', formData.value.taskType)
data.enterpriseIds = formData.value.enterprises.map((i) => i.id) data.enterpriseIds = formData.value.enterprises.map((i) => i.id)
if (data.enterpriseIds.length == 0) { if (data.enterpriseIds.length == 0) {
message.success("温馨提示:请您选择执法对象") message.success('温馨提示:请您选择执法对象')
} else { } else {
if (data.status < 2) { if (data.status < 2) {
data.startDate = data.planTime[0] data.startDate = data.planTime[0]
@ -423,15 +545,26 @@ async function submitForm() {
} }
} }
function init() { function init() {
if (query.id) { if (query.id) {
TaskInfoApi.getTaskInfo(query.id).then(res=>{ TaskInfoApi.getTaskInfo(query.id).then((res) => {
formData.value = res formData.value = res
formData.value.planTime = [formData.value.startDate, formData.value.endDate] formData.value.planTime = [formData.value.startDate, formData.value.endDate]
formData.value.enterprises = res.enterpriseIdes formData.value.enterprises = res.enterpriseIdes
formData.value.tags=res.taskTagIdes.map(t=>t.tagId) formData.value.tags = res.taskTagIdes.map((t) => t.tagId)
}) })
} }
} }
function getList(data) {
enterprise.value.list.push(...data)
enterprise.value.total = enterprise.value.list.length
enterprise_copy.value = cloneDeep(enterprise.value);
}
// getEnterPriseList() // getEnterPriseList()
getTagList() getTagList()
onMounted(() => { onMounted(() => {
@ -439,13 +572,8 @@ onMounted(()=>{
}) })
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
::v-deep(.el-card__header) {
border-bottom: 0;
::v-deep .ContentWrap .el-card__header {
text-decoration: none !important; /* 去除下划线 */
border-bottom: 0px solid #ebeef5 !important;
padding-left: 20px;
} }
::v-deep(.taskForm .el-form) { ::v-deep(.taskForm .el-form) {
@ -465,17 +593,13 @@ onMounted(()=>{
margin: 0 20px; // margin: 0 20px; //
overflow-x: hidden; // overflow-x: hidden; //
width: calc(100% - 40px); // width: calc(100% - 40px); //
::v-deep(.el-table) {
:deep(.el-table) {
width: 100% !important; // width: 100% !important; //
.el-table__cell { .el-table__cell {
text-align: center; text-align: center;
} }
} }
:deep(.no-data) { :deep(.no-data) {
padding: 30px 0; padding: 30px 0;
display: flex; display: flex;
@ -488,7 +612,6 @@ onMounted(()=>{
color: #909399; color: #909399;
} }
} }
.enterprise { .enterprise {
cursor: pointer; cursor: pointer;
box-shadow: 0 0 1px 1px #eaeaea; box-shadow: 0 0 1px 1px #eaeaea;
@ -561,7 +684,6 @@ onMounted(()=>{
margin-bottom: 10px; margin-bottom: 10px;
} }
} }
.search-form { .search-form {
background-color: #fff; background-color: #fff;
padding: 20px 20px 0px 20px; padding: 20px 20px 0px 20px;
@ -584,7 +706,6 @@ onMounted(()=>{
width: 100%; width: 100%;
} }
} }
.action-buttons { .action-buttons {
position: absolute; position: absolute;
right: 10px; right: 10px;
@ -597,13 +718,11 @@ onMounted(()=>{
gap: 8px; gap: 8px;
} }
} }
.pagination-container { .pagination-container {
display: flex; display: flex;
justify-content: right; justify-content: right;
margin: 10px; // margin: 10px; //
} }
.footer { .footer {
display: flex; display: flex;
justify-content: center; // justify-content: center; //
@ -611,6 +730,5 @@ onMounted(()=>{
padding-top: 20px; padding-top: 20px;
margin: 10px; // margin: 10px; //
} }
} }
</style> </style>

182
src/views/task/createEnterprise.vue

@ -11,77 +11,88 @@
<div class="search-area"> <div class="search-area">
<el-form :model="queryParams" ref="queryFormRef" :inline="true" label-width="0" class="search-form"> <el-form :model="queryParams" ref="queryFormRef" :inline="true" label-width="0" class="search-form">
<div class="form-container"> <div class="form-container">
<el-form-item label="" prop="enterprisesName" class="form-item">
<el-input <el-form-item label="" prop="region" class="form-item">
v-model="queryParams.enterprisesName"
placeholder="请输入企业名称"
/>
</el-form-item>
<el-form-item label="" prop="type" class="form-item">
<el-select <el-select
v-model="queryParams.type" v-model="queryParams.region"
placeholder="请选择企业规模" placeholder="请选择所属区域"
> >
<el-option <el-option
v-for="dict in getStrDictOptions(DICT_TYPE.ENTERPRISES_TYPE)" v-for="dict in getStrDictOptions(DICT_TYPE.ENTERPRISES_AREA)"
:key="dict.value" :key="dict.value"
:label="dict.label" :label="dict.label"
:value="dict.value" :value="dict.value"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="" prop="type" class="form-item"> <el-form-item label="" prop="type" class="form-item">
<el-select <el-select
v-model="queryParams.type" v-model="queryParams.hy"
placeholder="请选择企业规模" placeholder="请选择行业"
> >
<el-option <el-option
v-for="dict in getStrDictOptions(DICT_TYPE.ENTERPRISES_TYPE)" v-for="dict in hyList"
:key="dict.value" :key="dict.id"
:label="dict.label" :label="dict.tagName"
:value="dict.value" :value="dict.id"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="" prop="type" class="form-item">
<el-form-item label="" prop="region" class="form-item">
<el-select <el-select
v-model="queryParams.type" v-model="queryParams.st"
placeholder="请选择企业规模" placeholder="请选择生态"
> >
<el-option <el-option
v-for="dict in getStrDictOptions(DICT_TYPE.ENTERPRISES_TYPE)" v-for="dict in stList"
:key="dict.value" :key="dict.id"
:label="dict.label" :label="dict.tagName"
:value="dict.value" :value="dict.id"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="" prop="region" class="form-item">
<el-form-item label="" prop="type" class="form-item">
<el-select <el-select
v-model="queryParams.region" v-model="queryParams.wr"
placeholder="请选择所属区域" placeholder="请选择污染程度"
> >
<el-option <el-option
v-for="dict in getStrDictOptions(DICT_TYPE.ENTERPRISES_AREA)" v-for="dict in wrList"
:key="dict.value" :key="dict.id"
:label="dict.label" :label="dict.tagName"
:value="dict.value" :value="dict.id"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="" prop="region" class="form-item">
<el-form-item label="" prop="type" class="form-item">
<el-select <el-select
v-model="queryParams.region" v-model="queryParams.inviterName"
placeholder="请选择所属区域" placeholder="请选择执法人员"
> >
<el-option <el-option
v-for="dict in getStrDictOptions(DICT_TYPE.ENTERPRISES_AREA)" v-for="dict in getStrDictOptions(DICT_TYPE.ENTERPRISES_TYPE)"
:key="dict.value" :key="dict.value"
:label="dict.label" :label="dict.label"
:value="dict.value" :value="dict.value"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="" prop="enterprisesName" class="form-item">
<el-input
v-model="queryParams.enterprisesName"
placeholder="请输入企业名称"
/>
</el-form-item>
<el-form-item class="form-item"> <el-form-item class="form-item">
<el-button @click="handleQuery"> <el-button @click="handleQuery">
<Icon icon="ep:search" class="mr-5px" /> 搜索 <Icon icon="ep:search" class="mr-5px" /> 搜索
@ -113,13 +124,25 @@
{{ getStrDictOptions(DICT_TYPE.ENTERPRISES_AREA).find(dict => dict.value == scope.row.region)?.label || '未知区域' }} {{ getStrDictOptions(DICT_TYPE.ENTERPRISES_AREA).find(dict => dict.value == scope.row.region)?.label || '未知区域' }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column property="enterprisesName" label="行业" /> <el-table-column property="enterprisesName" label="行业" >
<el-table-column property="enterprisesName" label="生态" /> <template #default="scope">
<el-table-column property="enterprisesName" label="类型" /> {{ scope.row.tagListName && scope.row.tagListName.filter(item => item.value == 1).map(item => item.label).join(', ') }}
<el-table-column property="enterprisesName" label="执法人员" /> </template>
</el-table-column>
<el-table-column property="enterprisesName" label="生态">
<template #default="scope">
{{ scope.row.tagListName && scope.row.tagListName.filter(item => item.value == 2).map(item => item.label).join(', ') }}
</template>
</el-table-column>
<el-table-column property="enterprisesName" label="类型">
<template #default="scope">
{{ scope.row.tagListName && scope.row.tagListName.filter(item => item.value == 4).map(item => item.label).join(', ') }}
</template>
</el-table-column>
<el-table-column property="inviterName" label="执法人员" />
</el-table> </el-table>
<!-- 分页 -->
<!-- 分页 --> <!-- 分页 -->
<div class="pagination-container"> <div class="pagination-container">
<pagination <pagination
@ -144,10 +167,9 @@
<script setup lang="ts"> <script setup lang="ts">
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict' import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
import { EnterprisesApi, EnterprisesVO } from '@/api/enterprises' import { EnterprisesApi, EnterprisesVO } from '@/api/enterprises'
import {TagLibraryVO, TagLibraryApi} from '@/api/system/taglibrary'
import { array } from 'vue-types'
const loading = ref(true) // const loading = ref(true) //
const emit = defineEmits(['update:modelValue', 'success']) const emit = defineEmits(['update:modelValue', 'success'])
const props = defineProps({ const props = defineProps({
modelValue: { modelValue: {
@ -155,7 +177,6 @@ const props = defineProps({
default: false default: false
} }
}) })
const enterprise = ref({ const enterprise = ref({
list: ref<EnterprisesVO[]>(), list: ref<EnterprisesVO[]>(),
queryParams: reactive({ queryParams: reactive({
@ -169,60 +190,53 @@ const enterprise = ref({
}), }),
total: ref(0) total: ref(0)
}) })
const queryParams = ref({ const queryParams = ref({
enterprisesName: undefined, enterprisesName: undefined,
type: '', hy: undefined,
st: undefined,
wr: undefined,
region: undefined, region: undefined,
registrationNumber: undefined, inviterName:undefined,
// registrationNumber: undefined,
id:undefined id:undefined
}) })
// //
const visible = ref(false) // const visible = ref(false) //
// ... ... // ... ...
// //
const handleClose = () => { const handleClose = () => {
visible.value = false visible.value = false
} }
const selectedEnterprises = ref<EnterprisesVO[]>([]); const selectedEnterprises = ref<EnterprisesVO[]>([]);
const handleSelectionChange = (selectedItems: EnterprisesVO[]) => { const handleSelectionChange = (selectedItems: EnterprisesVO[]) => {
selectedEnterprises.value = selectedItems; selectedEnterprises.value = selectedItems;
} }
// //
const confirmSelect = () => { const confirmSelect = () => {
emit('success', selectedEnterprises.value)
} }
// //
const handleConfirm = () => { const handleConfirm = () => {
// TODO: // TODO:
visible.value = false visible.value = false
emit('success')
}
}
/** /**
* 获取企业列表 * 获取企业列表
*/ */
async function getEnterPriseList() { async function getEnterPriseList() {
loading.value = true loading.value = true
console.log('enterprise.value.queryParams', enterprise.value.queryParams)
try { try {
const data = await EnterprisesApi.getEnterprisesPage(enterprise.value.queryParams) const data = await EnterprisesApi.getEnterpriseByUserId(enterprise.value.queryParams)
enterprise.value.list = data.list enterprise.value.list = data.list
enterprise.value.total = data.total enterprise.value.total = data.total
} finally { } finally {
loading.value = false loading.value = false
} }
} }
// //
const open = async () => { const open = async () => {
// TODO: // TODO:
@ -234,17 +248,51 @@ const open = async () => {
registrationNumber: undefined, registrationNumber: undefined,
id: undefined id: undefined
} }
} }
/** 搜索按钮操作 */
const handleQuery = () => {
enterprise.value.queryParams.pageNo = 1
getEnterPriseList() getEnterPriseList()
}
/** 重置按钮操作 */
const resetQuery = () => {
// queryFormRef.value.resetFields()
// handleQuery()
}
//
const hyList:any = ref([])
//
const stList:any = ref([])
//
const wrList:any = ref([])
async function init() {
try {
const codeList = 'codeList=hy&codeList=st&codeList=wr'
const data = await TagLibraryApi.tagLibraryList(codeList)
hyList.value = data[0].children
stList.value = data[1].children
wrList.value = data[2].children
} finally {
}
}
getEnterPriseList()
onMounted(()=>{
init()
})
defineExpose({ open }) defineExpose({ open })
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.enterprise-container { .enterprise-container {
// ... ... // ... ...
.search-form { .search-form {
background-color: #fff; background-color: #fff;
padding: 20px 20px 0px 20px; padding: 20px 20px 0px 20px;
@ -267,7 +315,6 @@ defineExpose({ open })
width: 100%; width: 100%;
} }
} }
.action-buttons { .action-buttons {
position: absolute; position: absolute;
right: 10px; right: 10px;
@ -280,13 +327,11 @@ defineExpose({ open })
gap: 8px; gap: 8px;
} }
} }
.pagination-container { .pagination-container {
display: flex; display: flex;
justify-content: right; justify-content: right;
margin-top: 20px; // margin-top: 20px; //
} }
.footer { .footer {
display: flex; display: flex;
justify-content: center; // justify-content: center; //
@ -294,8 +339,5 @@ defineExpose({ open })
padding-top: 20px; padding-top: 20px;
margin-top: 20px; // margin-top: 20px; //
} }
} }
</style> </style>
Loading…
Cancel
Save