hiddenDangerItemsSearch.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. <!-- 隐患项搜索 -->
  2. <template>
  3. <view class="hiddenDangerItemsSearch">
  4. <view class="header">
  5. <view class="search">
  6. <view class="search-r">
  7. <img src="@/pages_safetyCheck/images/icon_aqjc_ss.png" @click="searchBtn">
  8. <input type="text" v-model="searchValue" placeholder="模糊搜索检查项" name="search" @confirm='searchBtn'
  9. confirm-type='search' maxlength="50" placeholder-style="color: #333333;font-size:24rpx;">
  10. </view>
  11. <view class="cancel" @click="cancelBtn">取消</view>
  12. </view>
  13. </view>
  14. <view class="list">
  15. <view class="list-li" v-for="(item,index) in dataList" @click="confirm(item)">
  16. {{item.hazardCheckCode}}{{item.hazardCheckName}}
  17. </view>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. import {
  23. config
  24. } from '@/api/request/config.js'
  25. import {
  26. securityCheckOptionList,
  27. } from '@/pages_safetyCheck/api/index.js'
  28. export default {
  29. name: "hiddenDangerItemsSearch",
  30. components: {
  31. },
  32. data() {
  33. return {
  34. baseUrl: config.base_url,
  35. pageType: 1,
  36. checkOptionList: [],
  37. dataList: [],
  38. searchValue: '',
  39. form: {},//接收上个页面传过来的参数
  40. }
  41. },
  42. onLoad(option) {
  43. if (option.form) {
  44. this.form = JSON.parse(decodeURIComponent(option.form));
  45. this.pageType=this.form.pageType;
  46. }
  47. },
  48. onShow() {
  49. },
  50. mounted() {
  51. this.treeselect();
  52. },
  53. methods: {
  54. //滚动事件
  55. scrollGet() {},
  56. //实验室搜索
  57. searchBtn() {
  58. this.dataList = [];
  59. this.treeselect();
  60. },
  61. //取消
  62. cancelBtn() {
  63. this.searchValue = '';
  64. this.dataList = [];
  65. this.treeselect();
  66. },
  67. confirm(row) {
  68. this.$set(this.form, "hazardCheckId1", row.hazardCheckId1)
  69. this.$set(this.form, "hazardCheckName1", row.hazardCheckName1)
  70. this.$set(this.form, "hazardCheckCode1", row.hazardCheckCode1)
  71. this.$set(this.form, "hazardCheckId2", row.hazardCheckId2)
  72. this.$set(this.form, "hazardCheckName2", row.hazardCheckName2)
  73. this.$set(this.form, "hazardCheckCode2", row.hazardCheckCode2)
  74. this.$set(this.form, "hazardCheckId", row.hazardCheckId)
  75. this.$set(this.form, "hazardCheckName", row.hazardCheckName)
  76. this.$set(this.form, "hazardCheckCode", row.hazardCheckCode)
  77. this.$set(this.form, "hazardCheckPoint", row.hazardCheckPoint)
  78. if(this.pageType==1){
  79. //随手拍进入
  80. uni.redirectTo({
  81. url: '/pages_safetyCheck/views/snapshotManage/snapshotList?form=' + encodeURIComponent(JSON.stringify(this.form))
  82. });
  83. }else if(this.pageType==2){
  84. //隐患项列表进入
  85. uni.redirectTo({
  86. url: '/pages_safetyCheck/views/itemsManage/hiddenDangerItems?infoData=' + encodeURIComponent(JSON.stringify(this.form))
  87. });
  88. }
  89. },
  90. async treeselect() {
  91. let self = this;
  92. const {
  93. data
  94. } = await securityCheckOptionList({
  95. searchValue: this.searchValue
  96. });
  97. if (data.code == 200) {
  98. let list = [];
  99. data.data.forEach(function(item) {
  100. item.children.forEach(function(item2) {
  101. item2.children.forEach(function(item3) {
  102. list.push({
  103. hazardCheckId1: item.id,
  104. hazardCheckName1: item.name,
  105. hazardCheckCode1: item.code,
  106. hazardCheckId2: item2.id,
  107. hazardCheckName2: item2.name,
  108. hazardCheckCode2: item2.code,
  109. hazardCheckId: item3.id,
  110. hazardCheckName: item3.name,
  111. hazardCheckCode: item3.code,
  112. hazardCheckPoint: item3.mainPoint
  113. })
  114. })
  115. })
  116. })
  117. this.dataList = list
  118. }
  119. },
  120. }
  121. }
  122. </script>
  123. <style lang="stylus" scoped>
  124. .hiddenDangerItemsSearch {
  125. height: 100%;
  126. display flex;
  127. box-sizing: border-box;
  128. #totalColor-A {
  129. color: #0183FA;
  130. background: rgba(1, 131, 250, 0.2);
  131. }
  132. #totalColor-B {
  133. color: #16B531;
  134. background: rgba(22, 181, 49, 0.2);
  135. }
  136. #totalColor-C {
  137. color: #FF8C00;
  138. background: rgba(255, 140, 0, 0.2);
  139. }
  140. .header {
  141. width: 100%;
  142. position: fixed;
  143. top: 0rpx;
  144. z-index: 100;
  145. background: #fff;
  146. .search {
  147. width: 750rpx;
  148. height: 100rpx;
  149. background: #FFFFFF;
  150. border-radius: 0rpx 0rpx 0rpx 0rpx;
  151. display: flex;
  152. justify-content: center;
  153. align-items: center;
  154. .search-r {
  155. width: 610rpx;
  156. height: 60rpx;
  157. background: #FFFFFF;
  158. border-radius: 50rpx 50rpx 50rpx 50rpx;
  159. border: 1rpx solid #E0E0E0;
  160. font-size: 24rpx;
  161. color: #999999;
  162. line-height: 60rpx;
  163. text-align: left;
  164. display: flex;
  165. justify-content: flex-start;
  166. align-items: center;
  167. padding: 0 20rpx;
  168. box-sizing: border-box;
  169. >img {
  170. width: 30rpx;
  171. height: 30rpx;
  172. margin-right: 20rpx;
  173. }
  174. >input {
  175. width: 500rpx;
  176. }
  177. }
  178. }
  179. .cancel {
  180. font-size: 28rpx;
  181. color: #0183FA;
  182. line-height: 30rpx;
  183. text-align: left;
  184. margin-left: 18rpx;
  185. }
  186. }
  187. .list {
  188. width: 750rpx;
  189. background: #FFFFFF;
  190. margin-top: 110rpx;
  191. padding-top: 12rpx;
  192. box-sizing: border-box;
  193. .list-li {
  194. min-height: 80rpx;
  195. margin: 0 30rpx;
  196. font-size: 29rpx;
  197. color: #3D3D3D;
  198. line-height: 80rpx;
  199. text-align: left;
  200. border-bottom: 1rpx solid #E0E0E0;
  201. }
  202. }
  203. }
  204. </style>