Commit 5edcd9bf authored by 曹庆宇's avatar 曹庆宇

fix: 首页跳转

parent c8ebe0d3
......@@ -8,13 +8,14 @@
"lint": "vue-cli-service lint"
},
"dependencies": {
"@antv/g2": "^4.0.15",
"@antv/g2": "^5.1.15",
"ant-design-vue": "^1.7.8",
"axios": "^0.21.1",
"core-js": "^3.6.5",
"dayjs": "^1.10.6",
"echarts": "^4.9.0",
"element-resize-detector": "^1.2.3",
"element-ui": "^2.15.14",
"lodash.debounce": "^4.0.8",
"mapbox-gl": "^2.0.1",
"vue": "^2.6.11",
......
......@@ -69,6 +69,7 @@
class="species-item"
v-for="(species, idx) in dataList"
:key="'全部物种'"
@click="open(species)"
>
{{ species["物种名称"] }}
</div>
......@@ -85,7 +86,7 @@
class="species-item"
v-for="(species, idx) in getFilterDataList(item)"
:key="idx"
@click="open(item)"
@click="open(species)"
>
{{ species["物种名称"] }}
</div>
......@@ -287,12 +288,21 @@ export default {
}
},
search() {
let path = "/data/species";
if (this.roster === BATCH_KEY.KEY_PROTECTED_AGRICULTURE) {
path = "/data/speciesPlant";
this.currentType
this.name
let path = '/data/speciesDataList'
if (this.currentType || this.name) {
path += '?'
this.currentType && ( path += `currentType=${this.currentType}`)
this.name && (path += `${ this.currentType ? '&' : ''}name=${this.name}`);
}
this.name && (path += `?name=${this.name}`);
this.$router.push(path);
this.$router.push(path)
// let path = "/data/species";
// if (this.roster === BATCH_KEY.KEY_PROTECTED_AGRICULTURE) {
// path = "/data/speciesPlant";
// }
// this.name && (path += `?name=${this.name}`);
// this.$router.push(path);
this.selectListShow = false;
},
checkSpeciesType(type) {
......@@ -300,18 +310,24 @@ export default {
this.selectListShow = false;
},
async open(item) {
if (item.properties.id !== "无") {
this.$router.push({
path: `${
this.pKey === "alienSpecies"
? "/detail/species"
: "/detail/speciesplant"
}`,
query: {
id: item.properties.id,
},
});
const { 序号 } = item
if (!序号) {
this.$router.push({ path: '/data/speciesDataList'})
} else {
this.$router.push({ path: `/detail/speciesData?id=${序号}`})
}
// if (item.properties.id !== "无") {
// this.$router.push({
// path: `${
// this.pKey === "alienSpecies"
// ? "/detail/species"
// : "/detail/speciesplant"
// }`,
// query: {
// id: item.properties.id,
// },
// });
// }
},
async recordOpen(item) {
if (item.properties.id !== "无") {
......
......@@ -92,9 +92,10 @@ export default {
},
methods: {
tabChange() {
this.showDataList = this.dataList.filter((item) => {
const res = JSON.parse(JSON.stringify(this.dataList))
this.showDataList = res.filter((item) => {
if (this.type == "全部物种") return true;
return item.类型 == this.type;
return item.类型 === this.type;
});
this.searchValue = null;
......@@ -104,14 +105,17 @@ export default {
},
onSearch() {
// this.init();
this.showDataList = this.dataList.filter((item) => {
let r = true;
const res = JSON.parse(JSON.stringify(this.dataList))
this.showDataList = res.filter((item) => {
const r = this.type === "全部物种" || this.type === item.类型;
if (this.searchValue) {
r = r = item["物种名称"].indexOf(this.searchValue) !== -1;
return item["物种名称"].indexOf(this.searchValue) !== -1 && r;
}
return r;
});
this.type = "全部物种";
// this.type = "全部物种";
setTimeout(() => {
this.waterFull();
......@@ -129,8 +133,19 @@ export default {
this.dataList = res.data.sort((a, b) => {
return a.序号 - b.序号;
});
this.showDataList = this.dataList;
this.showDataList = JSON.parse(JSON.stringify(this.dataList));
console.log(this.$route);
const { query } = this.$route;
const { name, currentType } = query;
if (currentType) {
this.type = currentType;
this.tabChange();
}
if (name) {
this.searchValue = name;
this.onSearch();
}
setTimeout(() => {
this.waterFull();
}, 1000);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment