You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

295 lines
8.3 KiB

<template>
<ContentWrap>
<section class="flex flex-col gap-20px">
<!-- 搜索工作栏 -->
<el-form
:model="queryParams"
ref="queryFormRef"
:inline="true"
label-width="0"
size="large"
class="formClass"
>
<el-form-item label="" prop="enterprisesName">
<el-input
v-model="queryParams.enterprisesName"
placeholder="请输入企业名称"
clearable
@keyup.enter="handleQuery"
:prefix-icon="Search"
/>
</el-form-item>
<el-form-item label="" prop="region">
<el-select v-model="queryParams.region" placeholder="请选择所属区域" clearable>
<el-option
v-for="dict in getStrDictOptions(DICT_TYPE.ENTERPRISES_AREA)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="" prop="type">
<el-select
v-model="queryParams.type"
placeholder="请选择行业类型"
clearable
multiple
collapse-tags
collapse-tags-tooltip
>
<el-option
v-for="dict in typeList"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="" prop="registrationNumber">
<el-select v-model="queryParams.registrationNumber" placeholder="请选择执法人员" filterable clearable>
<el-option
v-for="item in userList"
:key="item.id"
: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 label="" prop="establishmentDate">
<el-date-picker
v-model="queryParams.establishmentDate"
value-format="YYYY-MM-DD HH:mm:ss"
type="daterange"
format="YYYY年M月D日"
start-placeholder="起始日期"
end-placeholder="截止日期"
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
/>
</el-form-item>
<el-form-item class="btnClass">
<el-button @click="handleQuery" type="primary" plain>
<Icon icon="ep:search" class="mr-5px" /> 查询
</el-button>
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
</el-form-item>
<el-form-item>
<el-button
type="primary"
v-hasPermi="['system:enterprise:create']"
@click="push({ path: 'update' })"
>
<Icon
icon="ep:circle-plus"
class="mr-5px"
@click="
push({
path: 'update'
})
"
/>
新增
</el-button>
<el-button
@click="handleExport"
:loading="exportLoading"
v-hasPermi="['system:enterprise:export']"
>
<Icon icon="ep:download" class="mr-5px" /> 导出
</el-button>
</el-form-item>
</el-form>
<el-table v-loading="loading" :data="list" :show-overflow-tooltip="true">
<el-table-column label="企业名称" fixed="left" prop="enterprisesName" />
<el-table-column label="所属区域" width="200">
<template #default="scope">
{{ getDictLabel(DICT_TYPE.ENTERPRISES_AREA, scope.row.region) }}
</template>
</el-table-column>
<el-table-column label="行业类别" width="300">
<template #default="scope">
{{ getDictLabel(DICT_TYPE.ENTERPRISES_TYPE, scope.row.type) }}
</template>
</el-table-column>
<el-table-column label="执法人员" width="200">
<template #default="scope">
{{ `${scope.row.inviterName} | ${scope.row.inviterNameDept}` }}
</template>
</el-table-column>
<el-table-column
label="入驻时间"
prop="createTime"
:formatter="dateFormatter"
width="240"
/>
<el-table-column label="操作选项" align="center" width="120px">
<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
link
type="primary"
@click="
push({
path: 'detail',
query: {
id: scope.row.id
}
})
"
v-hasPermi="['system:enterprise:update']"
>
详情
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<el-pagination
:total="total"
:show-page-size="false"
layout="total, prev, pager, next"
v-model:current-page="queryParams.pageNo"
v-model:page-size="queryParams.pageSize"
@change="getList"
class="ml-auto"
/>
</section>
</ContentWrap>
<!-- 表单弹窗:添加/修改 -->
</template>
<script setup lang="ts">
import { getStrDictOptions, DICT_TYPE, getDictLabel } from '@/utils/dict'
import { dateFormatter } from '@/utils/formatTime'
import download from '@/utils/download'
import { EnterprisesApi, EnterprisesVO } from '@/api/enterprises'
import { getSimpleUserZGList } from '@/api/system/user'
import { TagLibraryApi } from '@/api/system/taglibrary'
import { Search } from '@element-plus/icons-vue'
/** 企业 列表 */
defineOptions({ name: 'Enterprises' })
const message = useMessage() // 消息弹窗
const loading = ref(true) // 列表的加载中
const list = ref<EnterprisesVO[]>([]) // 列表的数据
const total = ref(0) // 列表的总页数
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
departmentId: undefined,
userId: undefined,
type: undefined,
region: undefined,
enterprisesName: undefined,
address: undefined,
enterprisesStatus: undefined,
contactName: undefined,
environmentalContactPhone: undefined,
registrationNumber: undefined,
introduction: undefined,
establishmentDate: [],
gpsLocation: undefined,
createTime: [],
managerDeptId: undefined
})
const userList = ref()
//行业类别
const typeList = ref([] as any)
const queryFormRef = ref() // 搜索的表单
const exportLoading = ref(false) // 导出的加载中
const { push } = useRouter() // 路由
/** 查询列表 */
const getList = async () => {
loading.value = true
try {
const data = await EnterprisesApi.getEnterprisesPage(queryParams)
list.value = data.list
total.value = data.total
} finally {
loading.value = false
}
}
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.pageNo = 1
getList()
}
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value.resetFields()
handleQuery()
}
/** 导出按钮操作 */
const handleExport = async () => {
try {
// 导出的二次确认
await message.exportConfirm()
// 发起导出
exportLoading.value = true
const data = await EnterprisesApi.exportEnterprises(queryParams)
download.excel(data, '企业.xls')
} catch {
} finally {
exportLoading.value = false
}
}
/** 查询搜索项列表 */
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(() => {
getList()
})
</script>
<style lang="css" scoped>
.formClass {
.el-form-item {
width: calc(100% / 4 - 15px);
&:last-child {
margin-left: auto;
width: fit-content;
}
}
}
</style>