import { mapGetters, mapActions } from 'vuex' export default { data() { return { selectData: {} } }, computed: { ...mapGetters(['allOptions']), sysBookingStatus() { return this.$util.isEmpty(this.$store.getters.allOptions) ? [] : this.$store.getters.allOptions.sysBookingStatus.option }, sysRenovationStatus() { return this.$util.isEmpty(this.$store.getters.allOptions) ? [] : this.$store.getters.allOptions.sysRenovationStatus.option }, sysBudgetStatus() { return this.$util.isEmpty(this.$store.getters.allOptions) ? [] : this.$store.getters.allOptions.sysBudgetStatus.option }, sysBookingChannel() { return this.$util.isEmpty(this.$store.getters.allOptions) ? [] : this.$store.getters.allOptions.sysBookingChannel.option } }, created() { // uni.setStorageSync('allOptions', {}) }, mounted() { console.log(this.allOptions) }, methods: { ...mapActions(['getAllOptions']), formatOptions(data) { return Object.keys(data).map(i => ({ name: data[i], status: false, id: i })) }, /** fliterMask 列表 */ filterMaskBtn(item, status, pIndex, index) { if (this.filterMaskData[pIndex].type !== 2) { for (let i in item) { // eslint-disable-next-line no-param-reassign item[i].status = false } } // eslint-disable-next-line no-param-reassign item[index].status = !status }, // 初始化 initSelectStatus(data) { Object.keys(this.selectData).forEach(i => { this.selectData[i] = data[i] this.filterMaskData.forEach(j => { if (i === j.key) { let arr = [] if (data[i] !== 0) { arr = data[i].toString().split() } if (!this.$util.isEmpty(arr)) { arr.forEach(s => { // eslint-disable-next-line no-param-reassign let idx = j.list.findIndex(i => i.id == s) j.list[idx].status = true }) } } }) }) }, /** 格式化上传数据 */ formatFilterMaskData() { Object.keys(this.selectData).forEach(s => { this.filterMaskData.forEach((i) => { if (s === i.key) { let current = [] i.list.forEach((j, idx) => { if (j.status) { current.push((j.id)) } }) this.selectData[s] = current.join(',') } }) }) return this.selectData } } }