全部清除
清除未选项
@@ -100,7 +100,7 @@
![]()
@@ -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 {
}