fanzhen0119

This commit is contained in:
fanzhen123
2020-01-19 17:21:17 +08:00
parent 1bf723e62e
commit 2e781758f4
3 changed files with 68 additions and 23 deletions

View File

@@ -79,7 +79,7 @@
<input
type="checkbox"
v-model="item.inputState"
@change="clickStateOption('oneClick',index)"
@change="clickStateOption('oneClick',index,'left')"
:ref="'input'+index"
/>
<img :src="zhibiaoImg" alt @click="explainSd(item.desc)" />
@@ -90,7 +90,7 @@
</pane>
<pane min-size="25" size="27.5">
<div class="rightNavs">
<div class="title">指标({{rightGoCount}}/100)</div>
<div class="title">指标({{changeActiveDataS}}/100)</div>
<div class="titleContSelect">
<span @click="clickStateOption('clearAll')">全部清除</span>
<span @click="clickStateOption('clearUnselected')">清除未选项</span>
@@ -100,7 +100,7 @@
<input
type="checkbox"
v-model="item.inputState"
@change="clickStateOption('oneClick',index)"
@change="clickStateOption('oneClick',index,'right')"
:ref="'input'+index"
/>
<img :src="zhibiaoImg" alt @click="explainSd(item.desc)" />
@@ -214,15 +214,28 @@ export default {
this.showColoect(key)
},
// 全选、反选、清空、全部清除、清除未选项
clickStateOption (state, ind) {
clickStateOption (state, ind, statefr) {
switch (state) {
case 'checkAll':// 全选
console.log(this.searchDatas, 'this.searchDatas')
// 计算剩余指标空间
let computedKj = 100
if (this.changeActive.length > 0) {
computedKj = computedKj - this.changeActive.filter((item, index) => {
return item.inputState === true
}).length
}
console.log(computedKj, 'computedKj')
this.searchDatas.forEach((item, index) => {
/* eslint-disable */
this.rightGoCount < 100 ? (item.inputState = true, this.changeActive.find((list, key) => { return list.nameText === item.nameText }) === undefined ? this.changeActive.push(item) : 1) : (item.inputState = false)
console.log(index)
if (index < computedKj) {
item.inputState = true
this.changeActive.push(item)
} else {
item.inputState = false
}
})
this.rightGoCount = this.searchDatas.length
break
case 'inverse':// 反选
let numSd = []
@@ -247,19 +260,29 @@ export default {
})
break
case 'oneClick'://单点
let inputNum = this.searchDatas.map((item, index) => {
/* eslint-disable */
if (index === ind && this.changeActive.find((list, key) => { return list.nameText === item.nameText }) === undefined) {
this.rightGoCount < 100 ? this.changeActive.push(item) : (item.inputState = false, this.$refs['input' + ind][0].checked = false)
}
return item.inputState
})
this.rightGoCount = inputNum.reduce(function (prev, next) {
prev[next] = (prev[next] + 1) || 1
return prev
}, {})['true']
if (this.rightGoCount === undefined) {
this.rightGoCount = 0
let computedKjs = 100
if (this.changeActive.length > 0) {
computedKjs = computedKjs - this.changeActive.filter((item, index) => {
return item.inputState === true
}).length
}
console.log(computedKjs,statefr,'computedKjs')
if (statefr === 'left') {
this.searchDatas.forEach((item, index) => {
/* eslint-disable */
if (index === ind && this.changeActive.find((list, key) => { return list.nameText === item.nameText }) === undefined) {
computedKjs !== 0 ? this.changeActive.push(item) : (item.inputState = false, this.$refs['input' + ind][0].checked = false)
}
})
}
if (statefr === 'right') {
this.changeActive.forEach((item, index) => {
/* eslint-disable */
if (index === ind) {
item.inputState = false
this.$refs['input' + ind][1].checked = false
}
})
}
break
}
@@ -363,6 +386,21 @@ export default {
this.$store.state.labelExplainState = true
}
},
computed: {
/**
* @desc 计算指标的个数
* */
changeActiveDataS() {
let dataSLength = 0
if (this.changeActive.length !== 0) {
console.log(this.changeActive, 'this.changeActive')
dataSLength = this.changeActive.filter((item, index) => {
return item.inputState === true
}).length
}
return dataSLength
}
},
mounted() {
this.getCateData()
// this.defaultOpenDataCode = this.$store.state.openOpenLeft
@@ -370,9 +408,9 @@ export default {
}
</script>
<style lang="scss" scoped>
/deep/ .el-col-24{
/deep/ .el-col-24 {
min-width: 100%;
width:auto;
width: auto;
}
/deep/ .el-menu {
border: none;

View File

@@ -1436,6 +1436,11 @@ export default {
if (this.$route.query.defaultLeftId !== 'default') {
this.$store.state.defaultShowDataState = false
}
if (this.$route.query.type !== 'area') {
setTimeout(() => {
this.loadings = false
}, 1500)
}
}
}
</script>

View File

@@ -380,7 +380,9 @@ export default {
methods: {
loctionHref (url) {
console.log(url, 'url')
window.location.href = url
if (url !== '') {
window.location.href = url
}
},
handleClick (tab, event) {
console.log(101010)