|
@@ -21,7 +21,7 @@
|
|
<li v-for="(item, index) in navigation1" :key="index">
|
|
<li v-for="(item, index) in navigation1" :key="index">
|
|
<NuxtLink :to="'/primaryNavigation/' + item.category_id" v-if="item.children_count != 0" :title="item.alias">
|
|
<NuxtLink :to="'/primaryNavigation/' + item.category_id" v-if="item.children_count != 0" :title="item.alias">
|
|
<span class="active" v-if="item.category_id == routeId">{{ item.alias }}</span>
|
|
<span class="active" v-if="item.category_id == routeId">{{ item.alias }}</span>
|
|
- <span v-else>{{ item.alias }}</span>
|
|
|
|
|
|
+ <span v-else>{{ item.alias }}</span>
|
|
</NuxtLink>
|
|
</NuxtLink>
|
|
<NuxtLink :to="'/newsList/' + item.category_id" v-if="item.children_count == 0 && item.is_url != 1" :title="item.alias">
|
|
<NuxtLink :to="'/newsList/' + item.category_id" v-if="item.children_count == 0 && item.is_url != 1" :title="item.alias">
|
|
<span class="active" v-if="item.category_id == routeId">{{ item.alias }}</span>
|
|
<span class="active" v-if="item.category_id == routeId">{{ item.alias }}</span>
|
|
@@ -35,10 +35,68 @@
|
|
</ul>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
+ <!-- 展示地区 -->
|
|
|
|
+ <div class="cityBox">
|
|
|
|
+ <div class="cityMain">
|
|
|
|
+ <div class="cityTitle">
|
|
|
|
+ 地方频道
|
|
|
|
+ </div>
|
|
|
|
+ <ul class="cityList">
|
|
|
|
+ <li v-for="(item, index) in provinceList" :key="index" @click="goToSearch(item.id)">
|
|
|
|
+ {{item.abbreviation}}
|
|
|
|
+ </li>
|
|
|
|
+ </ul>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <!-- 行政查询 -->
|
|
|
|
+ <div class="select">
|
|
|
|
+ <div class="inner">
|
|
|
|
+ <div class="role left">
|
|
|
|
+ <div class="title">行政职能查询</div>
|
|
|
|
+ <div class="searchRole" v-if="department.length > 0">
|
|
|
|
+ <el-select v-model="depValue" placeholder="职能部门" size="large" style="width: 330px">
|
|
|
|
+ <el-option v-for="(item, index) in department" :key="index" :label="item.name" :value="item.id" />
|
|
|
|
+ </el-select>
|
|
|
|
+ <em @click="goToPrimary"></em>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="region left">
|
|
|
|
+ <div class="title">行政区划查询</div>
|
|
|
|
+ <div class="searchRole" v-if="provinceList.length > 0">
|
|
|
|
+ <el-select v-model="province" placeholder="请选择省" size="large" style="width: 80px">
|
|
|
|
+ <el-option v-for="item in provinceList" :key="item.id" :label="item.name" @click="change(item.id)" :value="item.id" />
|
|
|
|
+ </el-select>
|
|
|
|
+ <i></i>
|
|
|
|
+ <el-select v-model="city" placeholder="请选择市" no-data-text="请先选择省份" size="large" style="width: 80px">
|
|
|
|
+ <el-option v-for="(item, index) in cityList" :key="item.id" :label="item.name" @click="change1(item.id)" :value="item.id" />
|
|
|
|
+ </el-select>
|
|
|
|
+ <i></i>
|
|
|
|
+ <el-select v-model="region" placeholder="请选择区/县" no-data-text="请先选择市" size="large" style="width: 100px">
|
|
|
|
+ <el-option v-for="item in regionList" :key="item.id" :label="item.name" :value="item.id" />
|
|
|
|
+ </el-select>
|
|
|
|
+ <em @click="goToPrimary"></em>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
|
|
+//1.加载依赖 start ---------------------------------------->
|
|
|
|
+import { ElMessage } from 'element-plus'
|
|
|
|
+import { ref, onMounted } from 'vue';
|
|
|
|
+import { ElSelect, ElOption } from 'element-plus'
|
|
|
|
+
|
|
|
|
+const nuxtApp = useNuxtApp();
|
|
|
|
+const axios = nuxtApp.$axios;
|
|
|
|
+
|
|
|
|
+const route = useRoute();
|
|
|
|
+const routeId = route.params.id; //获得该页面的id
|
|
|
|
+//1.加载依赖 end ---------------------------------------->
|
|
|
|
+
|
|
|
|
+//2.加载模块数据 start ---------------------------------------->
|
|
const navigation1 = ref("");
|
|
const navigation1 = ref("");
|
|
async function getPageData2() {
|
|
async function getPageData2() {
|
|
const mkdata = await requestDataPromise('/web/getWebsiteModelCategory', {
|
|
const mkdata = await requestDataPromise('/web/getWebsiteModelCategory', {
|
|
@@ -52,6 +110,136 @@ async function getPageData2() {
|
|
navigation1.value = mkdata.data;
|
|
navigation1.value = mkdata.data;
|
|
}
|
|
}
|
|
getPageData2();
|
|
getPageData2();
|
|
|
|
+//2.加载模块数据 end ---------------------------------------->
|
|
|
|
+
|
|
|
|
+//3.职能部门 start ---------------------------------------->
|
|
|
|
+let department = ref("安全")
|
|
|
|
+const depValue = ref("")
|
|
|
|
+const typeValue = ref("")
|
|
|
|
+let departmentList = async () => {
|
|
|
|
+ const { data: mkdata, error: mkdataError } = requestData('/web/selectWebsiteDepartment', {
|
|
|
|
+ method: 'GET',
|
|
|
|
+ query: {
|
|
|
|
+ 'keyword': department.value,
|
|
|
|
+ },
|
|
|
|
+ });
|
|
|
|
+ if (mkdataError.value) {
|
|
|
|
+ //console.log()
|
|
|
|
+ } else {
|
|
|
|
+ console.log(department.value)
|
|
|
|
+ if (mkdata.value) {
|
|
|
|
+ console.log(mkdata.value.data.department)
|
|
|
|
+ department.value = mkdata.value.data.department;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+//获得所有部门
|
|
|
|
+departmentList();
|
|
|
|
+//3.职能部门 end ---------------------------------------->
|
|
|
|
+
|
|
|
|
+//4.展示行政区划 start ---------------------------------------->
|
|
|
|
+//let areaList = ref("")
|
|
|
|
+//4.1 省
|
|
|
|
+let province = ref("")
|
|
|
|
+let provinceid = ref("")
|
|
|
|
+let provinceList = ref("")
|
|
|
|
+//4.2 市
|
|
|
|
+let city = ref("")
|
|
|
|
+let cityid = ref("")
|
|
|
|
+let cityList = ref("")
|
|
|
|
+//4.3 县
|
|
|
|
+let region = ref("")
|
|
|
|
+//let regionid = ref("")
|
|
|
|
+let regionList = ref("")
|
|
|
|
+
|
|
|
|
+//选择省
|
|
|
|
+let areaArrList = async () => {
|
|
|
|
+ const { data: mkdata, error: mkdataError } = requestData('/web/selectWebsiteArea', {
|
|
|
|
+ method: 'GET',
|
|
|
|
+ query: {},
|
|
|
|
+ });
|
|
|
|
+ if (mkdataError.value) {
|
|
|
|
+ //console.log()
|
|
|
|
+ } else {
|
|
|
|
+ console.log(department.value)
|
|
|
|
+ if (mkdata.value) {
|
|
|
|
+ console.log(mkdata.value)
|
|
|
|
+ //areaList.value = mkdata.value.data;
|
|
|
|
+ provinceList.value = mkdata.value.data;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+//一开始只需要获取一下省
|
|
|
|
+areaArrList();
|
|
|
|
+
|
|
|
|
+//选择市
|
|
|
|
+let change = async (id) => {
|
|
|
|
+ provinceid.value = id;
|
|
|
|
+ const shengData = await requestDataPromise('/web/selectWebsiteArea', {
|
|
|
|
+ method: 'GET',
|
|
|
|
+ query: {
|
|
|
|
+ 'province': id,
|
|
|
|
+ 'city': 0
|
|
|
|
+ },
|
|
|
|
+ });
|
|
|
|
+ cityList.value = shengData.data.city;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+//选择县
|
|
|
|
+let change1 = async (id) => {
|
|
|
|
+ cityid.value = id;
|
|
|
|
+ const xianData = await requestDataPromise('/web/selectWebsiteArea', {
|
|
|
|
+ method: 'GET',
|
|
|
|
+ query: {
|
|
|
|
+ 'province': provinceid.value,
|
|
|
|
+ 'city': cityid.value
|
|
|
|
+ },
|
|
|
|
+ });
|
|
|
|
+ regionList.value = xianData.data.region;
|
|
|
|
+}
|
|
|
|
+//4.展示行政区划 end ---------------------------------------->
|
|
|
|
+
|
|
|
|
+//5.执行搜索 start ---------------------------------------->
|
|
|
|
+const getcityid = ref("")
|
|
|
|
+//跳转到搜索页面
|
|
|
|
+let goToSearch = (id) => {
|
|
|
|
+ console.log(id)
|
|
|
|
+ const route = `/search/search?catids=${id}`;
|
|
|
|
+ window.location.href = route;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+//获得cityid和
|
|
|
|
+let goToPrimary = async () => {
|
|
|
|
+ if (province.value != "") { getcityid.value = province.value }
|
|
|
|
+ if (city.value != "") { getcityid.value = city.value }
|
|
|
|
+ if (region.value != "") { getcityid.value = region.value }
|
|
|
|
+
|
|
|
|
+ if (province.value == ""&&city.value == ""&®ion.value == ""&&depValue.value=="") {
|
|
|
|
+ ElMessage.error('请选择行政区划或者职能部门!')
|
|
|
|
+ }else{
|
|
|
|
+
|
|
|
|
+ const responseStatus = await requestDataPromise('/web/selectWebsiteCategory', {
|
|
|
|
+ method: 'GET',
|
|
|
|
+ query: {
|
|
|
|
+ 'cityid': getcityid.value,
|
|
|
|
+ 'department_id': depValue.value
|
|
|
|
+ },
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ if (responseStatus.data.catid && responseStatus.data.catid.length > 0) {
|
|
|
|
+ const catids = responseStatus.data.catid.join(',');
|
|
|
|
+ const route = `/search/search?catids=${catids}`;
|
|
|
|
+ window.location.href = route;
|
|
|
|
+ } else {
|
|
|
|
+ // 可以在这里处理数组为空的情况
|
|
|
|
+ console.log('没有可用的分类ID');
|
|
|
|
+ const route = `/search/search`;
|
|
|
|
+ window.location.href = route;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+//5.执行搜索 end ---------------------------------------->
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style lang="less" scoped>
|
|
<style lang="less" scoped>
|