AI销管
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 

263 righe
5.3 KiB

  1. <template>
  2. <view class="box">
  3. <view class="conmsg" v-if="allList.length!=0">
  4. <view class="conmsg-msg">
  5. <view v-for="(item,index) in allList" :key="index">
  6. <view class="">
  7. <view class="conmsg-msg-lab" :class="{mustSe: item.level == 1 && item.mustSelected == 0 }" style="border: none;">
  8. <view class="conmsg-msg-lab-1">
  9. {{item.name}}
  10. </view>
  11. </view>
  12. <view class="con-msg-con"
  13. :style="{borderBottom:index==allList.length-1?'none':'1px solid #E0E0E0'}">
  14. <view v-for='(item1,i) in item.children' :key='i' @click="Edittag(item,item1,index,i)"
  15. :style="{border:item1.selected==0?'1px solid #0A6EE9;background: #0A6EE9;color: #fff;':'1px solid #E0E0E0'}"
  16. class="chebox">
  17. {{item1.label}}
  18. </view>
  19. </view>
  20. </view>
  21. </view>
  22. </view>
  23. </view>
  24. <view class="submit">
  25. <view class="btn" @click="submit">
  26. 确定
  27. </view>
  28. </view>
  29. <view class="" style="height: 220rpx;"></view>
  30. </view>
  31. </template>
  32. <script>
  33. export default {
  34. data() {
  35. return {
  36. allList:[],
  37. customerId:''
  38. }
  39. },
  40. onLoad(e) {
  41. this.customerId=e.id;
  42. this.getListByType()
  43. },
  44. methods: {
  45. Edittag(item,item1,index,i){
  46. if(this.allList[index].children[i].selected==0){
  47. this.allList[index].children[i].selected=1;
  48. }else{
  49. this.allList[index].children[i].selected=0;
  50. }
  51. this.$forceUpdate()
  52. },
  53. // 字典表接口
  54. getListByType() {
  55. this.$u.get("/matchKeywords/findManualCalibration", {
  56. customerId: this.customerId,
  57. type:2
  58. })
  59. .then(res => {
  60. res.forEach(item1 => {
  61. item1.children.map(item => {
  62. if (item.isInterval == 0) {
  63. item.label = item.name + item.unit + '-' + item.endName + item
  64. .unit;
  65. } else {
  66. item.label = item.name
  67. }
  68. item.value = item.id;
  69. })
  70. })
  71. this.allList = res
  72. })
  73. },
  74. // 提交
  75. submit() {
  76. let param = {
  77. keywordIds:'',
  78. id: this.customerId,
  79. projectId: uni.getStorageSync("buildingID").id
  80. }
  81. let str = []
  82. try {
  83. this.allList.forEach(item => {
  84. if (item.mustSelected == 0) {
  85. if (item.children.findIndex(item => item.selected == 0) == -1) {
  86. throw new Error(item.name)
  87. }
  88. }
  89. item.children.map(item1 => {
  90. if (item1.selected == 0) {
  91. str.push(item1.keywordsId)
  92. }
  93. })
  94. })
  95. } catch (e) {
  96. console.log(e)
  97. uni.showToast({
  98. title: `${e.message}为必选项~`,
  99. icon: 'none',
  100. duration: 2000
  101. })
  102. return
  103. }
  104. str = str.join(',')
  105. param.keywordIds = str
  106. this.$u.post("matchKeywords/updateManualCalibration", param).then(res => {
  107. uni.showToast({
  108. title: '操作成功',
  109. icon: 'none',
  110. success: () => {
  111. let sdd={
  112. keywordIds: this.customerId,
  113. id: this.customerId,
  114. bg:0,
  115. speaker:0
  116. }
  117. let pages = getCurrentPages() //获取当前页面栈的信息
  118. let prevPage = pages[pages.length - 2] //获取上一个页面
  119. prevPage.setData({ //把需要回传的值保存到上一个页面
  120. info: sdd
  121. });
  122. uni.navigateBack()
  123. }
  124. })
  125. })
  126. },
  127. }
  128. }
  129. </script>
  130. <style lang="scss" scoped>
  131. .box {
  132. width: 100%;
  133. height: 100%;
  134. background: #F8F8F8;
  135. overflow: hidden;
  136. }
  137. .conmsg {
  138. background: #FFFFFF;
  139. margin-top: 20rpx;
  140. .conmsg-title {
  141. height: 92rpx;
  142. line-height: 92rpx;
  143. font-weight: bold;
  144. padding: 0 30rpx;
  145. // font-weight: 500;
  146. color: #303030;
  147. font-size: 32rpx;
  148. border-bottom: 1px solid #E0E0E0;
  149. }
  150. .conmsg-msg {
  151. padding: 0 30rpx;
  152. .conmsg-msg-lab {
  153. position: relative;
  154. height: 102rpx;
  155. display: flex;
  156. font-size: 30rpx;
  157. font-weight: 400;
  158. color: #333333;
  159. border-bottom: 1px solid #E0E0E0;
  160. line-height: 102rpx;
  161. &.mustSe::before {
  162. content: '*';
  163. color: red;
  164. position: absolute;
  165. left: -10rpx;
  166. right: -10rpx;
  167. z-index: 10;
  168. }
  169. .conmsg-msg-lab-1 {
  170. display: flex;
  171. min-width: 136rpx;
  172. .star {
  173. color: #E7483C;
  174. line-height: 108rpx;
  175. }
  176. }
  177. .conmsg-msg-lab-inp {
  178. margin-top: 30rpx;
  179. margin-left: 44rpx;
  180. }
  181. .conmsg-msg-lab-img {
  182. width: 14rpx;
  183. height: 30rpx;
  184. margin-top: 6rpx;
  185. margin-left: auto;
  186. image {
  187. width: 100%;
  188. height: 100%;
  189. }
  190. }
  191. }
  192. }
  193. }
  194. .submit {
  195. position: fixed;
  196. bottom: 20rpx;
  197. left: 20rpx;
  198. height: 120rpx;
  199. background: #FFFFFF;
  200. .btn {
  201. // margin: 60rpx auto;
  202. text-align: center;
  203. width: 690rpx;
  204. height: 88rpx;
  205. background: #2671E2;
  206. border-radius: 8rpx;
  207. font-size: 32tpx;
  208. font-weight: 400;
  209. color: #FFFFFF;
  210. line-height: 88rpx;
  211. }
  212. }
  213. .con-msg-con {
  214. display: flex;
  215. flex-wrap: wrap;
  216. // justify-content: space-around;
  217. border-bottom: 1px solid #E0E0E0;
  218. padding-bottom: 16rpx;
  219. .chebox {
  220. // width: 20%;
  221. height: 60rpx;
  222. line-height: 60rpx;
  223. // margin: 10rpx 0;
  224. margin-bottom: 25rpx;
  225. margin-right: 20rpx;
  226. border: 1px solid #E0E0E0;
  227. box-sizing: border-box;
  228. padding: 0 10rpx;
  229. }
  230. }
  231. .sexchose {
  232. width: 120rpx;
  233. height: 60rpx;
  234. background: #FFFFFF;
  235. border-radius: 4rpx;
  236. border: 1px solid #E0E0E0;
  237. text-align: center;
  238. line-height: 60rpx;
  239. margin-right: 20rpx;
  240. }
  241. </style>