laboratorySearch.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367
  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. <!--
  15. <view class="list">
  16. <view class="list-li" v-for="(item,index) in dataList" @click="confirm(item)">
  17. {{item.hazardCheckCode}}{{item.hazardCheckName}}
  18. </view>
  19. </view> -->
  20. <view class="lab-info" @click="listClick(item)" v-for="(item,index) in dataList">
  21. <img class="lab-info-l" src="@/pages_safetyCheck/images/icon_aqjc_shiyanshi.png">
  22. <view class="lab-info-c">
  23. <view class="lab-info-c-t">
  24. <view class="lab-info-c-t-l">{{item.subName}}</view>
  25. <view class="lab-info-c-t-r"
  26. :style="'border:1rpx solid '+item.classLevelColor+';background:'+item.classLevelColorTow+';'">
  27. <text
  28. :style="'border-right:1rpx solid '+item.classLevelColor+';color:'+item.classLevelColor+';'">{{item.classLevelName?item.classLevelName:''}}</text>
  29. <text
  30. :style="'color:'+item.classLevelColor+';'">{{item.classTypeNames?item.classTypeNames:''}}</text>
  31. </view>
  32. </view>
  33. <view class="lab-info-c-b">
  34. <text>{{tabIndexTow==0?item.roomNum:item.subRoom}}房间&{{item.buildName}}</text>
  35. <text>{{item.deptName}}</text>
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. </template>
  41. <script>
  42. import {
  43. config
  44. } from '@/api/request/config.js'
  45. import {
  46. systemSubjectGetList,
  47. } from '@/api/commonality/permission.js'
  48. import {
  49. securityCheckOptionList,
  50. laboratorySubRelInfoGetRelList
  51. } from '@/pages_safetyCheck/api/index.js'
  52. export default {
  53. name: "hiddenDangerItemsSearch",
  54. components: {
  55. },
  56. data() {
  57. return {
  58. baseUrl: config.base_url,
  59. pageType: 1,
  60. checkOptionList: [],
  61. dataList: [],
  62. searchValue: '',
  63. form: {}, //接收上个页面传过来的参数
  64. // 查询参数
  65. queryParams: {
  66. page: 1,
  67. pageSize: 20,
  68. },
  69. total:0,
  70. }
  71. },
  72. onLoad(option) {
  73. if (option.form) {
  74. this.form = JSON.parse(decodeURIComponent(option.form));
  75. this.pageType = this.form.pageType;
  76. }
  77. },
  78. onShow() {
  79. },
  80. mounted() {
  81. this.buildBySub();
  82. //this.treeselect();
  83. },
  84. methods: {
  85. //滚动事件
  86. scrollGet() {},
  87. //实验室搜索
  88. searchBtn() {
  89. this.dataList = [];
  90. this.treeselect();
  91. },
  92. //取消
  93. cancelBtn() {
  94. this.searchValue = '';
  95. this.dataList = [];
  96. this.treeselect();
  97. },
  98. confirm(row) {
  99. this.$set(this.form, "hazardCheckId1", row.hazardCheckId1)
  100. this.$set(this.form, "hazardCheckName1", row.hazardCheckName1)
  101. this.$set(this.form, "hazardCheckCode1", row.hazardCheckCode1)
  102. this.$set(this.form, "hazardCheckId2", row.hazardCheckId2)
  103. this.$set(this.form, "hazardCheckName2", row.hazardCheckName2)
  104. this.$set(this.form, "hazardCheckCode2", row.hazardCheckCode2)
  105. this.$set(this.form, "hazardCheckId", row.hazardCheckId)
  106. this.$set(this.form, "hazardCheckName", row.hazardCheckName)
  107. this.$set(this.form, "hazardCheckCode", row.hazardCheckCode)
  108. this.$set(this.form, "hazardCheckPoint", row.hazardCheckPoint)
  109. if (this.pageType == 1) {
  110. //随手拍进入
  111. uni.redirectTo({
  112. url: '/pages_safetyCheck/views/snapshotManage/snapshotList?form=' + encodeURIComponent(JSON
  113. .stringify(this.form))
  114. });
  115. } else if (this.pageType == 2) {
  116. //隐患项列表进入
  117. uni.redirectTo({
  118. url: '/pages_safetyCheck/views/itemsManage/hiddenDangerItems?infoData=' +
  119. encodeURIComponent(JSON.stringify(this.form))
  120. });
  121. }
  122. },
  123. //搜索房间接口
  124. async buildBySub() {
  125. let self = this;
  126. const {
  127. data
  128. } = await systemSubjectGetList({
  129. 'searchValue': this.form.searchValue,
  130. 'subId': this.form.subId,
  131. });
  132. if (data.code == 200) {
  133. if (data.data[0]) {
  134. if (self.queryParams.page == 1) {
  135. this.dataList = data.data.records;
  136. this.total = data.data.total;
  137. if (data.data.total / self.queryParams.pageSize <= self.queryParams.page) {
  138. this.$set(this, 'getDataType', true);
  139. }
  140. } else {
  141. this.dataList = [...this.dataList, ...data.data.records]
  142. this.total = data.data.total;
  143. if (data.data.total / self.queryParams.pageSize <= self.queryParams.page) {
  144. this.$set(this, 'getDataType', true);
  145. }
  146. }
  147. } else {
  148. uni.showToast({
  149. title: '未找到相关实验室',
  150. icon: "none",
  151. mask: true,
  152. duration: 2000
  153. });
  154. }
  155. }
  156. },
  157. async treeselect() {
  158. let self = this;
  159. const {
  160. data
  161. } = await securityCheckOptionList({
  162. searchValue: this.searchValue
  163. });
  164. if (data.code == 200) {
  165. let list = [];
  166. data.data.forEach(function(item) {
  167. item.children.forEach(function(item2) {
  168. item2.children.forEach(function(item3) {
  169. list.push({
  170. hazardCheckId1: item.id,
  171. hazardCheckName1: item.name,
  172. hazardCheckCode1: item.code,
  173. hazardCheckId2: item2.id,
  174. hazardCheckName2: item2.name,
  175. hazardCheckCode2: item2.code,
  176. hazardCheckId: item3.id,
  177. hazardCheckName: item3.name,
  178. hazardCheckCode: item3.code,
  179. hazardCheckPoint: item3.mainPoint
  180. })
  181. })
  182. })
  183. })
  184. this.dataList = list
  185. }
  186. },
  187. }
  188. }
  189. </script>
  190. <style lang="stylus" scoped>
  191. .hiddenDangerItemsSearch {
  192. height: 100%;
  193. display flex;
  194. box-sizing: border-box;
  195. #totalColor-A {
  196. color: #0183FA;
  197. background: rgba(1, 131, 250, 0.2);
  198. }
  199. #totalColor-B {
  200. color: #16B531;
  201. background: rgba(22, 181, 49, 0.2);
  202. }
  203. #totalColor-C {
  204. color: #FF8C00;
  205. background: rgba(255, 140, 0, 0.2);
  206. }
  207. .header {
  208. width: 100%;
  209. position: fixed;
  210. top: 0rpx;
  211. z-index: 100;
  212. background: #fff;
  213. .search {
  214. width: 750rpx;
  215. height: 100rpx;
  216. background: #FFFFFF;
  217. border-radius: 0rpx 0rpx 0rpx 0rpx;
  218. display: flex;
  219. justify-content: center;
  220. align-items: center;
  221. .search-r {
  222. width: 610rpx;
  223. height: 60rpx;
  224. background: #FFFFFF;
  225. border-radius: 50rpx 50rpx 50rpx 50rpx;
  226. border: 1rpx solid #E0E0E0;
  227. font-size: 24rpx;
  228. color: #999999;
  229. line-height: 60rpx;
  230. text-align: left;
  231. display: flex;
  232. justify-content: flex-start;
  233. align-items: center;
  234. padding: 0 20rpx;
  235. box-sizing: border-box;
  236. >img {
  237. width: 30rpx;
  238. height: 30rpx;
  239. margin-right: 20rpx;
  240. }
  241. >input {
  242. width: 500rpx;
  243. }
  244. }
  245. }
  246. .cancel {
  247. font-size: 28rpx;
  248. color: #0183FA;
  249. line-height: 30rpx;
  250. text-align: left;
  251. margin-left: 18rpx;
  252. }
  253. }
  254. .list {
  255. width: 750rpx;
  256. background: #FFFFFF;
  257. margin-top: 110rpx;
  258. padding-top: 12rpx;
  259. box-sizing: border-box;
  260. .list-li {
  261. min-height: 80rpx;
  262. margin: 0 30rpx;
  263. font-size: 29rpx;
  264. color: #3D3D3D;
  265. line-height: 80rpx;
  266. text-align: left;
  267. border-bottom: 1rpx solid #E0E0E0;
  268. }
  269. }
  270. .lab-info {
  271. background: #FFFFFF;
  272. display: flex;
  273. justify-content: space-between;
  274. border: 2rpx dashed #D8D8D8;
  275. .lab-info-l {
  276. width: 80rpx;
  277. height: 80rpx;
  278. background: #0183FA;
  279. border-radius: 10rpx 10rpx 10rpx 10rpx;
  280. margin-left: 30rpx;
  281. margin-top: 30rpx;
  282. margin-bottom: 42rpx;
  283. }
  284. .lab-info-c {
  285. margin: 24rpx 30rpx 0 20rpx;
  286. flex: 1;
  287. .lab-info-c-t {
  288. display: flex;
  289. justify-content: space-between;
  290. .lab-info-c-t-l {
  291. font-size: 30rpx;
  292. color: #333333;
  293. line-height: 42rpx;
  294. text-align: left;
  295. overflow: hidden;
  296. text-overflow: ellipsis;
  297. white-space: nowrap;
  298. }
  299. .lab-info-c-t-r {
  300. display: flex;
  301. justify-content: flex-start;
  302. border-radius: 10rpx 10rpx 10rpx 10rpx;
  303. width: 180rpx;
  304. height: 40rpx;
  305. margin-left: 10rpx;
  306. >text {
  307. display: inline-block;
  308. flex: 1;
  309. text-align: center;
  310. font-size: 24rpx;
  311. line-height: 40rpx;
  312. text-align: center;
  313. }
  314. }
  315. }
  316. .lab-info-c-b {
  317. margin-top: 16rpx;
  318. display: flex;
  319. justify-content: space-between;
  320. >text:nth-of-type(1) {
  321. font-size: 30rpx;
  322. color: #666666;
  323. line-height: 30rpx;
  324. text-align: left;
  325. }
  326. >text:nth-of-type(2) {
  327. font-size: 30rpx;
  328. color: #666666;
  329. line-height: 30rpx;
  330. text-align: left;
  331. }
  332. }
  333. }
  334. }
  335. }
  336. </style>