|
@@ -10,19 +10,23 @@
|
|
|
<div class="clear" @click="handleClear">清空筛选条件</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <companyItem class="mt-3" :list="items"></companyItem>
|
|
|
- <MPagination
|
|
|
- :total="total"
|
|
|
- :page="pageInfo.pageNo"
|
|
|
- :limit="pageInfo.pageSize"
|
|
|
- @handleChange="handleChangePage"
|
|
|
- ></MPagination>
|
|
|
+ <div v-if="items.length">
|
|
|
+ <companyItem class="mt-3" :list="items"></companyItem>
|
|
|
+ <MPagination
|
|
|
+ :total="total"
|
|
|
+ :page="pageInfo.pageNo"
|
|
|
+ :limit="pageInfo.pageSize"
|
|
|
+ @handleChange="handleChangePage"
|
|
|
+ ></MPagination>
|
|
|
+ </div>
|
|
|
+ <Empty v-else class="mt-3"></Empty>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
defineOptions({name: 'retrieval-company-page'})
|
|
|
import { ref } from 'vue'
|
|
|
+import { useRoute, useRouter } from 'vue-router'
|
|
|
import { getEnterpriseSearch } from '@/api/enterprise'
|
|
|
import { dealDictArrayData } from '../position/components/dict'
|
|
|
import headSearch from '@/components/headSearch'
|
|
@@ -33,12 +37,15 @@ import areaType from './components/areaType'
|
|
|
import companyItem from './components/companyItem'
|
|
|
import MPagination from '@/components/CtPagination'
|
|
|
|
|
|
+const route = useRoute()
|
|
|
+const router = useRouter()
|
|
|
const clear = ref(false)
|
|
|
const handleClear = () => {
|
|
|
clear.value = true
|
|
|
query.value = {
|
|
|
...pageInfo.value
|
|
|
}
|
|
|
+ router.push(route.path)
|
|
|
}
|
|
|
|
|
|
const total = ref(0)
|
|
@@ -51,12 +58,24 @@ const query = ref({
|
|
|
...pageInfo.value
|
|
|
})
|
|
|
|
|
|
+const dealRouteQuery = (data) => {
|
|
|
+ const arr = Object.keys(data).map(e => {
|
|
|
+ if (e !== 'pageSize' && e !== 'pageNo') {
|
|
|
+ return Array.isArray(data[e]) ? `${e}=${data[e].join()}` : `${e}=${data[e]}`
|
|
|
+ }
|
|
|
+ }).filter(Boolean)
|
|
|
+ if (!arr.length) return router.push(route.path)
|
|
|
+ const str = arr?.join('&')
|
|
|
+ if (str) router.push(`${route.path}?${str}`)
|
|
|
+}
|
|
|
+
|
|
|
// 搜索
|
|
|
const handleSearch = async (val, key) => {
|
|
|
query.value.pageNo = 1
|
|
|
// val为-1时选择的是不限或者全国, 此时选中的字段不传
|
|
|
- if (val === -1) delete query.value[key]
|
|
|
+ if (val === -1 || val[0] === -1) delete query.value[key]
|
|
|
else query.value[key] = val
|
|
|
+ dealRouteQuery(query.value)
|
|
|
await getCompanyData()
|
|
|
}
|
|
|
|