AI销管
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

RuleEditing.vue 6.6 KiB

há 1 ano
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. <template>
  2. <view class="pages">
  3. <!-- 待处理 -->
  4. <view class="grop">
  5. <view class="title">
  6. <image class="title-icon" src="https://static.quhouse.com/bc2ec951ad9a47e5bf58f2829926e143.png"
  7. mode="" />
  8. 待处理
  9. </view>
  10. <u-checkbox-group class="grop-box" @change="checkboxGroupChange($event, 'stayPendingProcessingArr')">
  11. <block v-for="(item, index) in stayPendingProcessingArr" :key="index">
  12. <u-checkbox class="grop-box-item" v-model="item.checked" :name="item.title">{{item.title}}
  13. </u-checkbox>
  14. </block>
  15. </u-checkbox-group>
  16. </view>
  17. <!-- 简报指标 -->
  18. <view class="grop">
  19. <view class="title">
  20. <image class="title-icon" src="https://static.quhouse.com/bc2ec951ad9a47e5bf58f2829926e143.png"
  21. mode="" />
  22. 简报指标
  23. </view>
  24. <u-checkbox-group class="grop-box" @change="checkboxGroupChange($event, 'ReceptionBriefingArr')">
  25. <block v-for="(item, index) in ReceptionBriefingArr" :key="index">
  26. <u-checkbox class="grop-box-item" v-model="item.checked" :name="item.title">{{item.title}}
  27. </u-checkbox>
  28. </block>
  29. </u-checkbox-group>
  30. </view>
  31. <!-- 指标排名 -->
  32. <view class="grop">
  33. <view class="title">
  34. <image class="title-icon" src="https://static.quhouse.com/bc2ec951ad9a47e5bf58f2829926e143.png"
  35. mode="" />
  36. 指标排名
  37. </view>
  38. <u-checkbox-group class="grop-box" :max="groupMax" @change="checkboxGroupChange($event, 'IndexRankingArr')">
  39. <block v-for="(item, index) in IndexRankingArr" :key="index">
  40. <u-checkbox class="grop-box-item" v-model="item.checked" :name="item.title">{{item.title}}
  41. </u-checkbox>
  42. </block>
  43. </u-checkbox-group>
  44. </view>
  45. <!-- 指标趋势 -->
  46. <view class="grop">
  47. <view class="title">
  48. <image class="title-icon" src="https://static.quhouse.com/bc2ec951ad9a47e5bf58f2829926e143.png"
  49. mode="" />
  50. 指标趋势
  51. </view>
  52. <u-checkbox-group class="grop-box" :max="groupMax"
  53. @change="checkboxGroupChange($event, 'IndicatorTrendsArr')">
  54. <block v-for="(item, index) in IndicatorTrendsArr" :key="index">
  55. <u-checkbox class="grop-box-item" v-model="item.checked" :name="item.title">{{item.title}}
  56. </u-checkbox>
  57. </block>
  58. </u-checkbox-group>
  59. </view>
  60. <!-- 指标分布 -->
  61. <view class="grop">
  62. <view class="title">
  63. <image class="title-icon" src="https://static.quhouse.com/bc2ec951ad9a47e5bf58f2829926e143.png"
  64. mode="" />
  65. 指标分布
  66. </view>
  67. <u-checkbox-group class="grop-box" :max="groupMax"
  68. @change="checkboxGroupChange($event, 'IndicatorDistributionArr')">
  69. <block v-for="(item, index) in IndicatorDistributionArr" :key="index">
  70. <u-checkbox class="grop-box-item" v-model="item.checked" :name="item.title">{{item.title}}
  71. </u-checkbox>
  72. </block>
  73. </u-checkbox-group>
  74. </view>
  75. <view class="save-btn" @click="saveBiRule">
  76. 保存
  77. </view>
  78. </view>
  79. </template>
  80. <script>
  81. var util = require("@/utils/util.js");
  82. import * as allArrList from '../dataBoard/arr.js'
  83. export default {
  84. data() {
  85. return {
  86. stayPendingProcessingArr: allArrList.stayPendingProcessingArr, // 待处理
  87. ReceptionBriefingArr: allArrList.ReceptionBriefingArr, // 接待简报
  88. IndexRankingArr: allArrList.IndexRankingArr, // 排名
  89. IndicatorTrendsArr: allArrList.IndicatorTrendsArr, // 排名
  90. IndicatorDistributionArr: allArrList.IndicatorDistributionArr, // 排名
  91. needFormatArr: ['stayPendingProcessingArr', 'ReceptionBriefingArr', 'IndexRankingArr',
  92. 'IndicatorTrendsArr', 'IndicatorDistributionArr'
  93. ], // 需要格式化的数组
  94. groupMax: 5, // 可选择的最大数量
  95. }
  96. },
  97. onLoad() {
  98. this.biDictionary()
  99. },
  100. methods: {
  101. // 选中任一checkbox时,由checkbox-group触发
  102. checkboxGroupChange(e, params) {},
  103. // 字典
  104. biDictionary() {
  105. this.$u.get('/customer/biDict').then(res => {
  106. console.log(res)
  107. if (res) {
  108. this.needFormatArr.forEach((item, index) => {
  109. this[item] = this[item].map(it => {
  110. return {
  111. ...it,
  112. indexType: index
  113. }
  114. })
  115. let arr1 = res.filter(arr => arr.indexType == index)
  116. arr1.map(ie => {
  117. let objs = this[item].findIndex(obj => {
  118. return obj.title == ie.indexName && obj.indexType == ie
  119. .indexType
  120. }) || 0
  121. this[item][objs].id = ie.id || ''
  122. })
  123. })
  124. this.getFindBiByAccountId()
  125. }
  126. })
  127. },
  128. // 回显
  129. getFindBiByAccountId() {
  130. this.$u.get('/customer/findBiByAccountId').then(res => {
  131. console.log(res, 'getFindBiByAccountId')
  132. if (res) {
  133. let arr = [...res.index1.split(','), ...res.index2.split(','), ...res.index3.split(','), ...res.index4.split(','), ...res.index5.split(',')]
  134. console.log(arr)
  135. this.needFormatArr.forEach(item => {
  136. this[item].forEach(items => {
  137. let obj = arr.find(obj => obj == items.id)
  138. if (obj) items.checked = true
  139. else items.checked = false
  140. })
  141. })
  142. }
  143. })
  144. },
  145. // bi看板指标保存
  146. saveBiRule() {
  147. const params = {
  148. index1: '', // 待处理
  149. index2: '', // 简报指标
  150. index3: '', // 指标排名
  151. index4: '', // 指标趋势
  152. index5: '', // 指标分布
  153. accountId: uni.getStorageSync('weapp_session_userInfo_data').accountId || '', // 用户id
  154. }
  155. this.needFormatArr.forEach((ite, index) => {
  156. let arr = this[ite].filter(obj => obj.checked).map(item => {
  157. return item.id
  158. })
  159. params['index' + (index + 1)] = arr.join((',')) || ''
  160. })
  161. console.log(params)
  162. // this.stayPendingProcessingArr
  163. this.$u.post('/customer/bisave', params).then(res => {
  164. console.log(res)
  165. util.showNone("提交成功!");
  166. setTimeout(() => {
  167. uni.navigateBack()
  168. }, 1500)
  169. })
  170. },
  171. }
  172. }
  173. </script>
  174. <style lang="scss" scoped>
  175. .pages {
  176. width: 100vw;
  177. min-height: 100vh;
  178. background: #f2f2f2;
  179. display: flex;
  180. flex-direction: column;
  181. .grop {
  182. margin: 20rpx 0 0 0;
  183. padding: 20rpx;
  184. width: 100%;
  185. background: #fff;
  186. .title {
  187. height: 42rpx;
  188. font-size: 30rpx;
  189. font-family: PingFangSC-Semibold, PingFang SC;
  190. font-weight: 600;
  191. color: #333333;
  192. line-height: 42rpx;
  193. margin-bottom: 24rpx;
  194. display: flex;
  195. align-items: center;
  196. .title-icon {
  197. width: 12rpx;
  198. height: 20rpx;
  199. margin-right: 18rpx;
  200. }
  201. }
  202. .grop-box {
  203. /deep/.u-checkbox-group {
  204. display: grid;
  205. grid-template-columns: repeat(2, 1fr);
  206. grid-gap: 20rpx;
  207. }
  208. }
  209. }
  210. .save-btn {
  211. position: sticky;
  212. bottom: 0;
  213. margin: 20rpx 0 0 0;
  214. width: 100%;
  215. height: 90rpx;
  216. display: flex;
  217. align-items: center;
  218. justify-content: center;
  219. font-size: 38rpx;
  220. color: #fff;
  221. background: #1890FF;
  222. }
  223. }
  224. </style>