You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

264 lines
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':'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. let isPass = false // 默认通过
  83. let indexs = 0; //
  84. let checkArr = {}
  85. this.allList.map(item => {
  86. checkArr = this.allList.find(item => item.mustSelected == 0)
  87. isPass = checkArr.children.findIndex(item => item.selected == 0) == -1
  88. if (isPass) return;
  89. item.children.map(item1 => {
  90. if (item1.selected == 0) {
  91. str.push(item1.keywordsId)
  92. }
  93. })
  94. })
  95. if (isPass) {
  96. uni.showToast({
  97. title: `${checkArr.name}为必选项~`,
  98. icon: 'none',
  99. duration: 2000
  100. })
  101. return
  102. }
  103. str = str.join(',')
  104. param.keywordIds = str
  105. this.$u.post("matchKeywords/updateManualCalibration", param).then(res => {
  106. uni.showToast({
  107. title: '操作成功',
  108. icon: 'none',
  109. success: () => {
  110. let sdd={
  111. keywordIds: this.customerId,
  112. id: this.customerId,
  113. bg:0,
  114. speaker:0
  115. }
  116. let pages = getCurrentPages() //获取当前页面栈的信息
  117. let prevPage = pages[pages.length - 2] //获取上一个页面
  118. prevPage.setData({ //把需要回传的值保存到上一个页面
  119. info: sdd
  120. });
  121. uni.navigateBack()
  122. }
  123. })
  124. })
  125. },
  126. }
  127. }
  128. </script>
  129. <style lang="scss" scoped>
  130. .box {
  131. width: 100%;
  132. height: 100%;
  133. background: #F8F8F8;
  134. overflow: hidden;
  135. }
  136. .conmsg {
  137. background: #FFFFFF;
  138. margin-top: 20rpx;
  139. .conmsg-title {
  140. height: 92rpx;
  141. line-height: 92rpx;
  142. font-weight: bold;
  143. padding: 0 30rpx;
  144. // font-weight: 500;
  145. color: #303030;
  146. font-size: 32rpx;
  147. border-bottom: 1px solid #E0E0E0;
  148. }
  149. .conmsg-msg {
  150. padding: 0 30rpx;
  151. .conmsg-msg-lab {
  152. position: relative;
  153. height: 102rpx;
  154. display: flex;
  155. font-size: 30rpx;
  156. font-weight: 400;
  157. color: #333333;
  158. border-bottom: 1px solid #E0E0E0;
  159. line-height: 102rpx;
  160. &.mustSe::before {
  161. content: '*';
  162. color: red;
  163. position: absolute;
  164. left: -10rpx;
  165. right: -10rpx;
  166. z-index: 10;
  167. }
  168. .conmsg-msg-lab-1 {
  169. display: flex;
  170. min-width: 136rpx;
  171. .star {
  172. color: #E7483C;
  173. line-height: 108rpx;
  174. }
  175. }
  176. .conmsg-msg-lab-inp {
  177. margin-top: 30rpx;
  178. margin-left: 44rpx;
  179. }
  180. .conmsg-msg-lab-img {
  181. width: 14rpx;
  182. height: 30rpx;
  183. margin-top: 6rpx;
  184. margin-left: auto;
  185. image {
  186. width: 100%;
  187. height: 100%;
  188. }
  189. }
  190. }
  191. }
  192. }
  193. .submit {
  194. position: fixed;
  195. bottom: 20rpx;
  196. left: 20rpx;
  197. height: 120rpx;
  198. background: #FFFFFF;
  199. .btn {
  200. // margin: 60rpx auto;
  201. text-align: center;
  202. width: 690rpx;
  203. height: 88rpx;
  204. background: #2671E2;
  205. border-radius: 8rpx;
  206. font-size: 32tpx;
  207. font-weight: 400;
  208. color: #FFFFFF;
  209. line-height: 88rpx;
  210. }
  211. }
  212. .con-msg-con {
  213. display: flex;
  214. flex-wrap: wrap;
  215. // justify-content: space-around;
  216. border-bottom: 1px solid #E0E0E0;
  217. padding-bottom: 16rpx;
  218. .chebox {
  219. // width: 20%;
  220. height: 60rpx;
  221. line-height: 60rpx;
  222. // margin: 10rpx 0;
  223. margin-bottom: 25rpx;
  224. margin-right: 20rpx;
  225. border: 1px solid #E0E0E0;
  226. box-sizing: border-box;
  227. padding: 0 10rpx;
  228. }
  229. }
  230. .sexchose {
  231. width: 120rpx;
  232. height: 60rpx;
  233. background: #FFFFFF;
  234. border-radius: 4rpx;
  235. border: 1px solid #E0E0E0;
  236. text-align: center;
  237. line-height: 60rpx;
  238. margin-right: 20rpx;
  239. }
  240. </style>