allOptions.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. import { mapGetters, mapActions } from 'vuex'
  2. export default {
  3. data() {
  4. return {
  5. selectData: {}
  6. }
  7. },
  8. computed: {
  9. ...mapGetters(['allOptions']),
  10. sysBookingStatus() {
  11. return this.$util.isEmpty(this.$store.getters.allOptions) ? [] : this.$store.getters.allOptions.sysBookingStatus.option
  12. },
  13. sysRenovationStatus() {
  14. return this.$util.isEmpty(this.$store.getters.allOptions) ? [] : this.$store.getters.allOptions.sysRenovationStatus.option
  15. },
  16. sysBudgetStatus() {
  17. return this.$util.isEmpty(this.$store.getters.allOptions) ? [] : this.$store.getters.allOptions.sysBudgetStatus.option
  18. },
  19. sysBookingChannel() {
  20. return this.$util.isEmpty(this.$store.getters.allOptions) ? [] : this.$store.getters.allOptions.sysBookingChannel.option
  21. }
  22. },
  23. created() {
  24. // uni.setStorageSync('allOptions', {})
  25. },
  26. mounted() {
  27. console.log(this.allOptions)
  28. },
  29. methods: {
  30. ...mapActions(['getAllOptions']),
  31. formatOptions(data) {
  32. return Object.keys(data).map(i => ({
  33. name: data[i],
  34. status: false,
  35. id: i
  36. }))
  37. }, /** fliterMask 列表 */
  38. filterMaskBtn(item, status, pIndex, index) {
  39. if (this.filterMaskData[pIndex].type !== 2) {
  40. for (let i in item) {
  41. // eslint-disable-next-line no-param-reassign
  42. item[i].status = false
  43. }
  44. }
  45. // eslint-disable-next-line no-param-reassign
  46. item[index].status = !status
  47. }, // 初始化
  48. initSelectStatus(data) {
  49. Object.keys(this.selectData).forEach(i => {
  50. this.selectData[i] = data[i]
  51. this.filterMaskData.forEach(j => {
  52. if (i === j.key) {
  53. let arr = []
  54. if (data[i] !== 0) {
  55. arr = data[i].toString().split()
  56. }
  57. if (!this.$util.isEmpty(arr)) {
  58. arr.forEach(s => {
  59. // eslint-disable-next-line no-param-reassign
  60. let idx = j.list.findIndex(i => i.id == s)
  61. j.list[idx].status = true
  62. })
  63. }
  64. }
  65. })
  66. })
  67. }, /** 格式化上传数据 */
  68. formatFilterMaskData() {
  69. Object.keys(this.selectData).forEach(s => {
  70. this.filterMaskData.forEach((i) => {
  71. if (s === i.key) {
  72. let current = []
  73. i.list.forEach((j, idx) => {
  74. if (j.status) {
  75. current.push((j.id))
  76. }
  77. })
  78. this.selectData[s] = current.join(',')
  79. }
  80. })
  81. })
  82. return this.selectData
  83. }
  84. }
  85. }