Browse Source

任务创建优化

master
DX 4 weeks ago
parent
commit
a9225c01e2
  1. 250
      src/views/task/create copy.vue
  2. 188
      src/views/task/createEnterprise.vue

250
src/views/task/create copy.vue

@ -2,10 +2,10 @@
<ContentWrap> <ContentWrap>
<section class="taskForm"> <section class="taskForm">
<div class="title">基本信息</div> <div class="title">基本信息</div>
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="auto" class="formClass"> <el-form ref="formRef" :model="formData" :rules="formRules" label-width="auto" class="formClass" size="large">
<el-form-item label="标题" prop="title"> <el-form-item label="标题" prop="title">
<el-input v-model="formData.title" placeholder="请输入任务标题" size="large" /> <el-input v-model="formData.title" placeholder="请输入任务标题" />
</el-form-item> </el-form-item>
<el-form-item label="时间周期" prop="planTime"> <el-form-item label="时间周期" prop="planTime">
<el-date-picker <el-date-picker
@ -29,7 +29,7 @@
placeholder="请输入描述" placeholder="请输入描述"
/> />
</el-form-item> </el-form-item>
<el-form-item label="类型" prop="taskType"> <el-form-item label="任务类型" prop="taskType">
<el-tree-select <el-tree-select
v-model="formData.taskType" v-model="formData.taskType"
:data="tagList" :data="tagList"
@ -50,7 +50,7 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="优先级" prop="priority"> <el-form-item label="类型选项" prop="priority">
<el-select v-model="formData.priority" placeholder="请选择任务优先级" size="large"> <el-select v-model="formData.priority" placeholder="请选择任务优先级" size="large">
<el-option <el-option
v-for="dict in getIntDictOptions(DICT_TYPE.TASK_PRIORITY)" v-for="dict in getIntDictOptions(DICT_TYPE.TASK_PRIORITY)"
@ -100,7 +100,7 @@
v-for="dict in hyList" v-for="dict in hyList"
:key="dict.id" :key="dict.id"
:label="dict.tagName" :label="dict.tagName"
:value="dict.id" :value="dict.tagName"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -130,13 +130,17 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="" prop="enterprisesName" class="form-item"> <el-form-item label="" prop="userId" class="form-item">
<el-input <el-select v-model="enterprise.queryParams.userId" placeholder="请选择执法人员" clearable>
v-model="enterprise.queryParams.inviterName" <el-option
placeholder="请选择执法人员" v-for="dict in userList"
clearable :key="dict.id"
:label="dict.deptName +'_'+ dict.realName"
:value="dict.id"
/> />
</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.enterprisesName"
@ -178,7 +182,7 @@
</template> </template>
<el-table-column type="selection" width="30" /> <el-table-column type="selection" width="30" />
<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="区域">
<template #default="scope"> <template #default="scope">
{{ {{
getStrDictOptions(DICT_TYPE.ENTERPRISES_AREA).find( getStrDictOptions(DICT_TYPE.ENTERPRISES_AREA).find(
@ -187,10 +191,40 @@
}} }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column property="enterprisesName" label="行业" min-width="100" /> <el-table-column property="enterprisesName" label="行业">
<el-table-column property="enterprisesName" label="生态" min-width="100" /> <template #default="scope">
<el-table-column property="enterprisesName" label="类型" min-width="100" /> {{
<el-table-column property="enterprisesName" label="执法人员" min-width="100" /> scope.row.tagListName &&
scope.row.tagListName
.filter((item) => item.value == 1)
.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 == 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="执法人员" min-width="100" />
<el-table-column label="操作" align="center" min-width="80px"> <el-table-column label="操作" align="center" min-width="80px">
<template #default="scope"> <template #default="scope">
<el-button <el-button
@ -204,18 +238,34 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
</section> </section>
<pagination <div class="pageArea" v-show="enterprise.total > 0">
v-show="enterprise.total > 0" <div class="selected">已选择 {{ selectedEnterprises.length }} / {{ enterprise.total }}
<el-button
link
type="primary"
@click="deletedSelected"
v-show="selectedEnterprises.length > 0"
>
删除所选
</el-button>
</div>
<el-pagination
:total="enterprise.total" :total="enterprise.total"
:show-page-size="false" :show-page-size="false"
size="small" size="small"
layout="total, prev, pager, next"
v-model:page="enterprise.queryParams.pageNo" v-model:page="enterprise.queryParams.pageNo"
v-model:limit="enterprise.queryParams.pageSize" v-model:limit="enterprise.queryParams.pageSize"
@pagination="getEnterPriseList" @pagination="getEnterPriseList"
class="page"
/> />
</div>
</section> </section>
<div class="footer"> <div class="footer">
<el-button type="primary" @click="submitForm"> </el-button> <el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="submitForm">返回列表</el-button>
<el-button <el-button
type="primary" type="primary"
@click="submitForm" @click="submitForm"
@ -231,7 +281,7 @@
</div> </div>
</section> </section>
</ContentWrap> </ContentWrap>
<CreateEnterprise ref="formRef" @success="getList" /> <CreateEnterprise ref="formCreateRef" @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'
@ -242,6 +292,7 @@ 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'; import { cloneDeep } from 'lodash-es';
import { getSimpleUserZGList } from '@/api/system/user'
defineOptions({ name: 'CreateTask' }) defineOptions({ name: 'CreateTask' })
@ -269,6 +320,7 @@ const formData = ref({
const router = useRouter() const router = useRouter()
const route = useRoute() const route = useRoute()
const tagView = useTagsViewStore() const tagView = useTagsViewStore()
const formCreateRef = ref()
const message = useMessage() // const message = useMessage() //
const formRules = reactive({ const formRules = reactive({
title: [{ required: true, message: '任务标题不能为空', trigger: 'blur' }], title: [{ required: true, message: '任务标题不能为空', trigger: 'blur' }],
@ -289,20 +341,43 @@ const enterprise = ref({
list: [] as any, list: [] as any,
queryParams: reactive({ queryParams: reactive({
pageNo: 1, pageNo: 1,
pageSize: 9, pageSize: 10,
enterprisesName: undefined, enterprisesName: undefined,
qy: undefined, qy: undefined,
hy: undefined, hy: undefined,
st: undefined, st: undefined,
wr: undefined, wr: undefined,
inviterName: undefined inviterName: undefined,
userId: undefined,
tagList: []
}), }),
total: ref(0) as any total: ref(0) as any
}) })
//
const deletedSelected = async () => {
await message.delConfirm()
selectedEnterprises.value.forEach(item=> {
deleteHandle(item.id)
})
}
const handleDelete = (id: number) => { const selectedEnterprises = ref<EnterprisesVO[]>([])
const handleSelectionChange = (selectedItems: EnterprisesVO[]) => {
selectedEnterprises.value = selectedItems
}
const handleDelete = async (id: number) => {
//
await message.delConfirm()
// //
deleteHandle(id)
}
const deleteHandle = (id: number) => {
const targetIndex = enterprise.value.list.findIndex(item => item.id === id); const targetIndex = enterprise.value.list.findIndex(item => item.id === id);
if (targetIndex === -1) return; if (targetIndex === -1) return;
@ -330,17 +405,20 @@ const enterprise_copy = ref({
list: [] as any, list: [] as any,
queryParams: reactive({ queryParams: reactive({
pageNo: 1, pageNo: 1,
pageSize: 9, pageSize: 10,
enterprisesName: undefined, enterprisesName: undefined,
qy: undefined, qy: undefined,
hy: undefined, hy: undefined,
st: undefined, st: undefined,
wr: undefined, wr: undefined,
inviterName: undefined userId: undefined
}), }),
total: ref(0) as any total: ref(0) as any
}) })
const userList:any = ref()
// //
const isAllConditionsEmpty = computed(() => { const isAllConditionsEmpty = computed(() => {
const params = enterprise.value.queryParams; const params = enterprise.value.queryParams;
@ -350,7 +428,7 @@ const isAllConditionsEmpty = computed(() => {
!params.hy && !params.hy &&
!params.st && !params.st &&
!params.wr && !params.wr &&
!params.inviterName !params.userId
); );
}); });
@ -358,9 +436,8 @@ const isAllConditionsEmpty = computed(() => {
/** 搜索按钮操作 */ /** 搜索按钮操作 */
const handleQuery = () => { const handleQuery = () => {
const list = filterList(enterprise.value.list)
console.log('listlist', list) const list = filterList(enterprise.value.list)
enterprise.value.list = list enterprise.value.list = list
enterprise.value.total = list?.length enterprise.value.total = list?.length
@ -370,7 +447,8 @@ const handleQuery = () => {
const filterList = (list: EnterprisesVO[]) => { const filterList = (list: EnterprisesVO[]) => {
if (isAllConditionsEmpty.value) return enterprise_copy.value.list; // if (isAllConditionsEmpty.value) return enterprise_copy.value.list; //
if (list.length > 0) { if (list.length > 0) {
const { enterprisesName, qy, hy, st, wr , inviterName } = enterprise.value.queryParams; const { enterprisesName, qy, hy, st, wr , userId } = enterprise.value.queryParams;
return list.filter(item => { return list.filter(item => {
// //
@ -379,42 +457,31 @@ const filterList = (list: EnterprisesVO[]) => {
// //
const typeMatch = qy ? item.region == qy : true; const typeMatch = qy ? item.region == qy : true;
// //
// const regionMatch = hy ? item.region === region : true; const hyMatch = hy ? item.tagList.includes(hy) : true
// //
const stMatch = st ? item.tagList.includes(st) : true
const wrMatch = wr ? item.tagList.includes(wr) : true
const userIdMatch = userId ? item.userId == userId : true
//
// const regNumMatch = registrationNumber ? // const regNumMatch = registrationNumber ?
// item.registrationNumber === registrationNumber : true; // item.registrationNumber === registrationNumber : true;
// // ID // // ID
// const idMatch = id !== undefined ? item.id === id : true; // const idMatch = id !== undefined ? item.id === id : true;
// return nameMatch && typeMatch && regionMatch && regNumMatch && idMatch; return nameMatch && typeMatch && hyMatch && stMatch && wrMatch && userIdMatch;
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() formCreateRef.value.open()
} }
/** 重置按钮操作 */ /** 重置按钮操作 */
const resetQuery = () => { const resetQuery = () => {
@ -445,35 +512,6 @@ const defaultProps = {
children: 'children' // 使 'children' children: 'children' // 使 'children'
} }
/**
* 全选
*/
async function selectAll() {
loading.value = true
const data = JSON.parse(JSON.stringify(enterprise.value.queryParams))
data.pageSize = -1
delete data.pageNo
const { list } = await EnterprisesApi.getEnterprisesPage(data)
const arr = [...formData.value.enterprises, ...list]
formData.value.enterprises = uniqueFunc(arr, 'id')
loading.value = false
}
/**
* 取消全选
*/
async function cancelAll() {
loading.value = true
const data = JSON.parse(JSON.stringify(enterprise.value.queryParams))
data.pageSize = -1
delete data.pageNo
const { list } = await EnterprisesApi.getEnterprisesPage(data)
if (list) {
formData.value.enterprises = formData.value.enterprises.filter((e) => {
return !list.some((r) => e.id == r.id)
})
}
loading.value = false
}
/** /**
* 单选企业 * 单选企业
* @param enterprise * @param enterprise
@ -502,6 +540,8 @@ function uniqueFunc(arr, uniId) {
* 提交表单 * 提交表单
*/ */
async function submitForm() { async function submitForm() {
// id
const validate = await unref(formRef).validate() const validate = await unref(formRef).validate()
if (validate) { if (validate) {
const data = JSON.parse(JSON.stringify(formData.value)) const data = JSON.parse(JSON.stringify(formData.value))
@ -509,34 +549,40 @@ async function submitForm() {
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]
data.endDate = data.planTime[1] data.endDate = data.planTime[1]
if (data.id) {
TaskInfoApi.updateTaskInfo(data).then(() => { console.log('data', data)
message.success('操作成功')
tagView.delView(route) // if (data.id) {
router.go(-1) // TaskInfoApi.updateTaskInfo(data).then(() => {
}) // message.success('')
} else { // tagView.delView(route)
TaskInfoApi.createTaskInfo(data).then(() => { // router.go(-1)
message.success('操作成功') // })
tagView.delView(route) // } else {
router.go(-1) // TaskInfoApi.createTaskInfo(data).then(() => {
}) // message.success('')
} // tagView.delView(route)
// router.go(-1)
// })
// }
} else { } else {
message.success('温馨提示:该任务已经执行,无法再进行修改') message.success('温馨提示:该任务已经执行,无法再进行修改')
} }
} }
} }
} }
function init() { async function init() {
const userData = await getSimpleUserZGList()
userList.value = userData
if (query.id) { if (query.id) {
TaskInfoApi.getTaskInfo(query.id).then((res) => { TaskInfoApi.getTaskInfo(query.id).then((res) => {
@ -550,6 +596,8 @@ function init() {
function getList(data) { function getList(data) {
enterprise.value.list.push(...data) enterprise.value.list.push(...data)
//
enterprise.value.list = uniqueFunc(enterprise.value.list, 'id')
enterprise.value.total = enterprise.value.list.length enterprise.value.total = enterprise.value.list.length
enterprise_copy.value = cloneDeep(enterprise.value); enterprise_copy.value = cloneDeep(enterprise.value);
@ -563,6 +611,8 @@ onMounted(() => {
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.title { .title {
font-size: 16px; font-size: 16px;
font-weight: bold; font-weight: bold;
@ -595,6 +645,14 @@ onMounted(() => {
} }
.pageArea{
display: flex;
flex-direction: row;
justify-content: space-between;
font-size: 13px;
padding: 20px 1.5%;
}
.enterprise-area { .enterprise-area {
flex: 1; flex: 1;
@ -632,6 +690,9 @@ onMounted(() => {
box-shadow: 0 0 1px 1px #ccc; box-shadow: 0 0 1px 1px #ccc;
} }
} }
} }
.check-area { .check-area {
border: 1px dashed #ccc; border: 1px dashed #ccc;
@ -679,6 +740,7 @@ onMounted(() => {
grid-template-rows: 1fr; grid-template-rows: 1fr;
grid-template-columns: minmax(0, 1fr); grid-template-columns: minmax(0, 1fr);
align-items: center; align-items: center;
gap: 20px;
::v-deep(.select-area .el-form) { ::v-deep(.select-area .el-form) {
margin-bottom: 15px; margin-bottom: 15px;
.el-form-item { .el-form-item {

188
src/views/task/createEnterprise.vue

@ -1,4 +1,5 @@
<template> <template>
<el-dialog <el-dialog
v-model="visible" v-model="visible"
title="新增企业" title="新增企业"
@ -9,28 +10,29 @@
<div class="enterprise-container"> <div class="enterprise-container">
<!-- 搜索区域 --> <!-- 搜索区域 -->
<div class="search-area"> <div class="search-area">
<el-form :model="queryParams" ref="queryFormRef" :inline="true" label-width="0" size="large" class="search-form"> <el-form
:model="enterprise.queryParams"
ref="queryFormRef"
:inline="true"
label-width="0"
size="large"
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" placeholder="请选择所属区域" clearable>
v-model="queryParams.region"
placeholder="请选择所属区域"
>
<el-option <el-option
v-for="dict in getStrDictOptions(DICT_TYPE.ENTERPRISES_AREA)" 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="enterprise.queryParams.hy" placeholder="请选择行业" clearable>
v-model="queryParams.hy"
placeholder="请选择行业"
>
<el-option <el-option
v-for="dict in hyList" v-for="dict in hyList"
:key="dict.id" :key="dict.id"
@ -41,10 +43,7 @@
</el-form-item> </el-form-item>
<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.st" placeholder="请选择生态" clearable>
v-model="queryParams.st"
placeholder="请选择生态"
>
<el-option <el-option
v-for="dict in stList" v-for="dict in stList"
:key="dict.id" :key="dict.id"
@ -55,10 +54,7 @@
</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.wr" placeholder="请选择污染程度" clearable>
v-model="queryParams.wr"
placeholder="请选择污染程度"
>
<el-option <el-option
v-for="dict in wrList" v-for="dict in wrList"
:key="dict.id" :key="dict.id"
@ -69,37 +65,27 @@
</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.userId" placeholder="请选择执法人员" clearable>
v-model="queryParams.inviterName"
placeholder="请选择执法人员"
>
<el-option <el-option
v-for="dict in getStrDictOptions(DICT_TYPE.ENTERPRISES_TYPE)" v-for="dict in userList"
:key="dict.value" :key="dict.id"
:label="dict.label" :label="dict.deptName +'_'+ dict.realName"
: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" placeholder="请输入企业名称" />
v-model="queryParams.enterprisesName"
placeholder="请输入企业名称"
/>
</el-form-item> </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" /> 搜索
</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>
</div> </div>
</el-form> </el-form>
@ -109,49 +95,77 @@
<el-table <el-table
ref="multipleTableRef" ref="multipleTableRef"
:data="enterprise.list" :data="enterprise.list"
@selection-change="handleSelectionChange" @select="handleSelectionChange"
style="width: 100%; border: 1px solid #EBEEF5" @select-all="selectAll"
style="width: 100%; border: 1px solid #ebeef5"
:cell-style="{ borderBottom: '1px solid #EBEEF5' }" :cell-style="{ borderBottom: '1px solid #EBEEF5' }"
height="400px"
row-key="id"
:header-cell-style="{ :header-cell-style="{
borderBottom: '1px solid #EBEEF5', borderBottom: '1px solid #EBEEF5',
backgroundColor: '#F5F7FA' backgroundColor: '#F5F7FA'
}" }"
> >
<el-table-column type="selection" /> <el-table-column type="selection" :reserve-selection="true" />
<el-table-column property="enterprisesName" label="企业名称" /> <el-table-column property="enterprisesName" label="企业名称" />
<el-table-column property="region" label="区域"> <el-table-column property="region" label="区域">
<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="行业"> <el-table-column property="enterprisesName" label="行业">
<template #default="scope"> <template #default="scope">
{{ scope.row.tagListName && scope.row.tagListName.filter(item => item.value == 1).map(item => item.label).join(', ') }} {{
scope.row.tagListName &&
scope.row.tagListName
.filter((item) => item.value == 1)
.map((item) => item.label)
.join(', ')
}}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column property="enterprisesName" label="生态"> <el-table-column property="enterprisesName" label="生态">
<template #default="scope"> <template #default="scope">
{{ scope.row.tagListName && scope.row.tagListName.filter(item => item.value == 2).map(item => item.label).join(', ') }} {{
scope.row.tagListName &&
scope.row.tagListName
.filter((item) => item.value == 2)
.map((item) => item.label)
.join(', ')
}}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column property="enterprisesName" label="类型"> <el-table-column property="enterprisesName" label="类型">
<template #default="scope"> <template #default="scope">
{{ scope.row.tagListName && scope.row.tagListName.filter(item => item.value == 4).map(item => item.label).join(', ') }} {{
scope.row.tagListName &&
scope.row.tagListName
.filter((item) => item.value == 4)
.map((item) => item.label)
.join(', ')
}}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column property="inviterName" label="执法人员" /> <el-table-column property="inviterName" label="执法人员" />
</el-table> </el-table>
<!-- 分页 --> <!-- 分页 -->
<div class="pagination-container"> <div class="pagination-container">
<pagination <div class="selected">已选择 {{ selectedEnterprises.length }} / {{ enterprise.total }}</div>
<el-pagination
v-show="enterprise.total > 0" v-show="enterprise.total > 0"
:total="enterprise.total" :total="enterprise.total"
:show-page-size="false" :show-page-size="false"
layout="total, prev, pager, next"
size="small" size="small"
v-model:page="enterprise.queryParams.pageNo" v-model:current-page="enterprise.queryParams.pageNo"
v-model:limit="enterprise.queryParams.pageSize" @update:current-page="getEnterPriseList"
v-model:page-size="enterprise.queryParams.pageSize"
@pagination="getEnterPriseList" @pagination="getEnterPriseList"
/> />
</div> </div>
@ -168,7 +182,7 @@
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 { TagLibraryVO, TagLibraryApi } from '@/api/system/taglibrary'
import { array } from 'vue-types' import { getSimpleUserZGList } from '@/api/system/user'
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({
@ -181,12 +195,16 @@ const enterprise = ref({
list: ref<EnterprisesVO[]>(), list: ref<EnterprisesVO[]>(),
queryParams: reactive({ queryParams: reactive({
pageNo: 1, pageNo: 1,
pageSize: 9, pageSize: 20,
enterprisesName: undefined, enterprisesName: undefined,
type: undefined,
region: undefined, region: undefined,
registrationNumber: undefined, hy: undefined,
id:undefined st: undefined,
wr: undefined,
inviterName: undefined,
id: undefined,
userId: undefined,
tagList: []
}), }),
total: ref(0) total: ref(0)
}) })
@ -196,31 +214,39 @@ const queryParams = ref({
st: undefined, st: undefined,
wr: undefined, wr: undefined,
region: undefined, region: undefined,
inviterName:undefined, userId: undefined,
// registrationNumber: undefined, // registrationNumber: undefined,
id: undefined id: undefined
}) })
// //
const visible = ref(false) // const visible = ref(true) //
// ... ... // ... ...
// //
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 selectAll = (selection) => {
selectedEnterprises.value = selection
} }
// //
const confirmSelect = () => { const confirmSelect = () => {
emit('success', selectedEnterprises.value) emit('success', selectedEnterprises.value)
} }
//
const handleConfirm = () => {
// TODO:
visible.value = false
}
//
// const handleSelectionChange = (selection) => {
// const currentPageIds = selection.map(item => item.id);
// currentPageIds.forEach(id => selectedIds.value.add(id));
// };
/** /**
* 获取企业列表 * 获取企业列表
*/ */
@ -229,25 +255,29 @@ const handleConfirm = () => {
console.log('enterprise.value.queryParams', enterprise.value.queryParams) console.log('enterprise.value.queryParams', enterprise.value.queryParams)
if (enterprise.value.queryParams.hy ||
enterprise.value.queryParams.st ||
enterprise.value.queryParams.wr
) {
enterprise.value.queryParams.tagList.push(enterprise.value.queryParams.hy)
enterprise.value.queryParams.tagList.push(enterprise.value.queryParams.st)
enterprise.value.queryParams.tagList.push(enterprise.value.queryParams.wr)
}
try { try {
const data = await EnterprisesApi.getEnterpriseByUserId(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
enterprise.value.queryParams.tagList = []
} }
} }
// //
const open = async () => { const open = async () => {
// TODO: // TODO:
visible.value = true visible.value = true
queryParams.value = {
enterprisesName: undefined,
type: undefined, // undefined
region: undefined,
registrationNumber: undefined,
id: undefined
}
} }
/** 搜索按钮操作 */ /** 搜索按钮操作 */
@ -267,22 +297,25 @@ const hyList:any = ref([])
const stList: any = ref([]) const stList: any = ref([])
// //
const wrList: any = ref([]) const wrList: any = ref([])
//
const userList:any = ref()
async function init() { async function init() {
try { try {
const codeList = 'codeList=hy&codeList=st&codeList=wr' const codeList = 'codeList=hy&codeList=st&codeList=wr'
const data = await TagLibraryApi.tagLibraryList(codeList) const data = await TagLibraryApi.tagLibraryList(codeList)
hyList.value = data[0].children hyList.value = data[0].children
stList.value = data[1].children stList.value = data[1].children
wrList.value = data[2].children wrList.value = data[2].children
} finally {
}
const userData = await getSimpleUserZGList()
} finally { userList.value = userData
} }
}
getEnterPriseList() getEnterPriseList()
onMounted(() => { onMounted(() => {
@ -291,6 +324,9 @@ onMounted(()=>{
defineExpose({ open }) defineExpose({ open })
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.enterprise-container { .enterprise-container {
// ... ... // ... ...
.search-form { .search-form {
@ -329,8 +365,16 @@ defineExpose({ open })
} }
.pagination-container { .pagination-container {
display: flex; display: flex;
justify-content: right; flex-direction: row;
justify-content: space-between;
margin-top: 20px; // margin-top: 20px; //
.selected {
font-size: 12px;
margin-left: 10px;
font-weight: bold;
}
} }
.footer { .footer {
display: flex; display: flex;

Loading…
Cancel
Save