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.
 
 
 

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