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.

calibration.vue 5.3 KiB

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