规范变量名

This commit is contained in:
aixianling
2022-06-14 17:12:06 +08:00
parent 8a8ba42d9b
commit 1c85ea5ecd

View File

@@ -2,14 +2,14 @@
<div class="SelectGird">
<div class="header-middle">
<div class="hint">
<span v-for="(item, index) in slectList" :key="index">
<span v-for="(item, index) in selectList" :key="index">
<span v-if="index" style="margin:0 4px;" v-text="`/`"/>
<span style="color:#3F8DF5" @click="girdNameClick(item, index)" v-text="item.girdName"/>
</span>
</div>
<div class="showTypes">
<div v-if="treeList.length > 0">
<div class="cards" v-for="(item, index) in treeList" :key="index" @click="itemClick(item)">
<div v-if="options.length > 0">
<div class="cards" v-for="(item, index) in options" :key="index" @click="itemClick(item)">
<div class="imges">
<img src="./img/xzh.png" alt="" class="imgselect" v-if="item.isChecked"
@click.stop="girdClick(item, index)"/>
@@ -25,7 +25,7 @@
</div>
</div>
<!-- <div style="padding-bottom: 70px;"></div> -->
<div class="subBtn" flex>
<div class="subBtn flex">
<div v-if="clearable" class="cancel" @click="cancel">清空</div>
<div @click="submit">确定选择</div>
</div>
@@ -37,12 +37,13 @@ import {mapState} from "vuex";
export default {
name: 'SelectGird',
appName: "网格选择",
data() {
return {
SelectGird: {},
allData: null,
treeList: [],
slectList: [],
options: [],
selectList: [],
parentGirdId: '',
isFormMap: 0, //1为网格地图 一级不允许选中
}
@@ -50,17 +51,18 @@ export default {
computed: {
...mapState(['user']),
isMyGirds() {
return this.$route.query.self == true
return this.$mp?.query.self == true
},
isGridMember() {
return this.user.girdCheckType > 0
},
//是否是网格员申报
isApply: v => v.$route.query.formType == 2,
clearable: v => v.$route.query.clearable,
selected: v => [v.$route.query.selected].flat()
isApply: v => v.$mp?.query.formType == 2,
clearable: v => v.$mp?.query.clearable,
selected: v => [v.$mp?.query.selected].flat()
},
onLoad(option) {
console.log(option, this.$mp)
if (option.isFormMap) {
this.isFormMap = option.isFormMap
}
@@ -68,7 +70,7 @@ export default {
},
methods: {
getAllGrids() {
this.slectList = []
this.selectList = []
let {girdMemberId} = this.user,
url = `/app/appgirdmemberinfo/queryMyGirdListByLevel2AndUser`,
params = {girdMemberId}
@@ -94,15 +96,15 @@ export default {
params: {girdId: last}
}).then(res => {
if (res?.data) {
this.slectList = [{girdName: '可选范围', id: ''}, res.data.filter(e => !!this.allData.find(a => a.id == e.id))].flat()
this.selectList = [{girdName: '可选范围', id: ''}, res.data.filter(e => !!this.allData.find(a => a.id == e.id))].flat()
this.getGridsByGridMemberAndParent({id: last})
}
})
} else {
this.treeList = this.allData.filter((e, i, arr) => !arr.map(e => e.id).includes(e.parentGirdId) || this.isMyGirds)
this.treeList.map((item) => item.isChecked = this.selected.includes(item.id))
this.options = this.allData.filter((e, i, arr) => !arr.map(e => e.id).includes(e.parentGirdId) || this.isMyGirds)
this.options.map((item) => item.isChecked = this.selected.includes(item.id))
let obj = {girdName: '可选范围', id: ''}
this.slectList.push(obj)
this.selectList.push(obj)
}
},
itemClick(row) {
@@ -111,33 +113,33 @@ export default {
girdName: row.girdName,
id: row.id,
}
this.slectList.push(obj)
this.selectList.push(obj)
this.getGridsByGridMemberAndParent(row)
}
},
getGridsByGridMemberAndParent(row) {
let {id: parentGirdId} = row
this.treeList = this.allData.filter(e => e.parentGirdId == parentGirdId)
this.treeList.map((item) => item.isChecked = this.selected.includes(item.id))
this.options = this.allData.filter(e => e.parentGirdId == parentGirdId)
this.options.map((item) => item.isChecked = this.selected.includes(item.id))
},
girdNameClick(row, index) {
if (!index) { //第一级别
this.slectList = []
this.selectList = []
this.treeInit(true)
} else {
this.slectList.splice(index, 8)
this.selectList.splice(index, 8)
this.getGridsByGridMemberAndParent(row)
}
},
girdClick(row, index) {
if (this.treeList[index].isChecked) {//取消
this.treeList[index].isChecked = false
if (this.options[index].isChecked) {//取消
this.options[index].isChecked = false
this.SelectGird = {}
} else {
this.treeList.map((item) => {
this.options.map((item) => {
item.isChecked = false
})
this.treeList[index].isChecked = true
this.options[index].isChecked = true
this.SelectGird = row
}
this.$forceUpdate()
@@ -236,7 +238,6 @@ export default {
}
}
}
}
.subBtn {
@@ -267,6 +268,5 @@ export default {
}
}
}
}
</style>