laboratorySearch.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  1. <!-- 实验室搜索 -->
  2. <template>
  3. <view class="hiddenDangerItemsSearch">
  4. <scroll-view scroll-y @scrolltolower="scrollGet" class="info-max-box">
  5. <view class="header">
  6. <view class="search">
  7. <view class="search-r">
  8. <img src="@/pages_safetyCheck/images/icon_aqjc_ss.png" @click="searchBtn">
  9. <input type="text" v-model="queryParams.searchValue" placeholder="学院单位、实验室名称或房间号" name="search"
  10. @confirm='searchBtn' confirm-type='search' maxlength="50"
  11. placeholder-style="color: #333333;font-size:24rpx;">
  12. </view>
  13. <view class="cancel" @click="cancelBtn()">取消</view>
  14. </view>
  15. </view>
  16. <view class="lab">
  17. <view class="lab-info" @click="listClick(item)" v-for="(item,index) in dataList">
  18. <img class="lab-info-l" src="@/pages_safetyCheck/images/icon_aqjc_shiyanshi.png">
  19. <view class="lab-info-c">
  20. <view class="lab-info-c-t">
  21. <view class="lab-info-c-t-l">{{item.subName}}</view>
  22. <view class="lab-info-c-t-r"
  23. :style="'border:1rpx solid '+item.levelColor+';background:'+item.levelColorTow+';'">
  24. <text
  25. :style="'border-right:1rpx solid '+item.levelColor+';color:'+item.levelColor+';'">{{item.levelName?item.levelName:''}}</text>
  26. <text :style="'color:'+item.levelColor+';'">{{item.typeName?item.typeName:''}}</text>
  27. </view>
  28. </view>
  29. <view class="lab-info-c-b">
  30. <text>{{item.roomNum?item.roomNum:'-'}}房间&{{item.buildName}}</text>
  31. <text>{{item.deptName}}</text>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. </scroll-view>
  37. </view>
  38. </template>
  39. <script>
  40. import {
  41. config
  42. } from '@/api/request/config.js'
  43. import {
  44. laboratorySubRelInfoSelectByPage,
  45. } from '@/api/commonality/permission.js'
  46. import {
  47. securityCheckOptionList,
  48. laboratorySubRelInfoGetRelList,
  49. securityAppCheckManageList,
  50. securityAppCheckDangerReviewSubList,
  51. securityAppCheckDangerGetCheckDangerSubList,
  52. } from '@/pages_safetyCheck/api/index.js'
  53. export default {
  54. name: "hiddenDangerItemsSearch",
  55. components: {
  56. },
  57. data() {
  58. return {
  59. baseUrl: config.base_url,
  60. pageType: 1,
  61. checkOptionList: [],
  62. dataList: [],
  63. searchValue: '',
  64. form: {}, //接收上个页面传过来的参数
  65. getDataType: false,
  66. // 查询参数
  67. queryParams: {
  68. page: 1,
  69. pageSize: 20,
  70. searchValue: '',
  71. subId: '',
  72. },
  73. total: 0,
  74. laboratoryStatus: 0, // 0检查任务1复查验证2隐患整改 3从随手拍页面进入
  75. }
  76. },
  77. onLoad(option) {
  78. if (option.form) {
  79. this.form = JSON.parse(decodeURIComponent(option.form));
  80. console.log(this.form)
  81. if (this.form.subId) {
  82. this.queryParams.subId = this.form.subId
  83. }
  84. if (this.form.laboratoryStatus) {
  85. this.laboratoryStatus = this.form.laboratoryStatus
  86. }
  87. }
  88. },
  89. onShow() {
  90. },
  91. mounted() {
  92. this.getList();
  93. },
  94. methods: {
  95. //滚动事件
  96. scrollGet() {
  97. let self = this;
  98. if (self.total / self.queryParams.pageSize <= self.queryParams.page) {
  99. this.$set(this, 'getDataType', true);
  100. } else {
  101. this.queryParams.page += 1;
  102. this.$nextTick(() => {
  103. this.getList();
  104. })
  105. }
  106. },
  107. //实验室搜索
  108. searchBtn() {
  109. this.dataList = [];
  110. this.getList();
  111. },
  112. //取消
  113. cancelBtn() {
  114. let self = this;
  115. self.queryParams.searchValue = '';
  116. self.dataList = [];
  117. self.getList();
  118. },
  119. //十六进制颜色值和RGB格式转换
  120. hexToRgb(hex, opacity = 1) {
  121. // 去除#号
  122. var color = hex.replace("#", "");
  123. // 分割成红、绿、蓝三部分的16进制字符串
  124. var red = parseInt(color.substring(0, 2), 16);
  125. var green = parseInt(color.substring(2, 4), 16);
  126. var blue = parseInt(color.substring(4, 6), 16);
  127. return `RGB(${red}, ${green}, ${blue},${opacity})`;
  128. },
  129. listClick(item) {
  130. if (this.form.laboratoryStatus == 0 || this.form.laboratoryStatus == 1 || this.form.laboratoryStatus ==
  131. 2) {
  132. let infoData = {
  133. ...item,
  134. ...this.form
  135. };
  136. uni.redirectTo({
  137. url: '/pages_safetyCheck/views/itemsManage/hiddenDangerItems?infoData=' +
  138. encodeURIComponent(
  139. JSON.stringify(infoData))
  140. });
  141. } else if (this.form.laboratoryStatus == 3) { //从计划实验室列表返回
  142. this.$set(this.form, "subId", item.subId)
  143. this.$set(this.form, "subName", item.subName)
  144. this.$set(this.form, "subRoom", item.roomNum)
  145. this.$set(this.form, "deptId", item.deptId)
  146. this.$set(this.form, "deptName", item.deptName)
  147. this.$set(this.form, "buildId", item.buildId)
  148. this.$set(this.form, "buildName", item.buildName)
  149. this.$set(this.form, "floorId", item.floorId)
  150. this.$set(this.form, "floorName", item.floorName)
  151. this.$set(this.form, "typeId", item.typeId)
  152. this.$set(this.form, "classTypeNames", item.classTypeNames)
  153. this.$set(this.form, "levelId", item.levelId)
  154. this.$set(this.form, "classLevelName", item.classLevelName)
  155. uni.redirectTo({
  156. url: '/pages_safetyCheck/views/snapshotManage/snapshotList?form=' +
  157. encodeURIComponent(JSON.stringify(this.form))
  158. });
  159. }
  160. },
  161. //搜索房间接口
  162. async getList() {
  163. let self = this;
  164. let obj = JSON.parse(JSON.stringify(this.queryParams));
  165. if (this.laboratoryStatus == 0) {
  166. obj.planSetId = this.form.checkPlanSetVoList.planSetId;
  167. obj.planId = this.form.checkPlanSetVoList.planId;
  168. //检查计划
  169. const {
  170. data
  171. } = await securityAppCheckManageList(obj);
  172. if (data.code == 200) {
  173. data.data.records.forEach(function(item) {
  174. if (item.classLevelColor) {
  175. item.classLevelColorTow = self.hexToRgb(item.classLevelColor, 0.2)
  176. }
  177. })
  178. if (self.queryParams.page == 1) {
  179. this.dataList = data.data.records;
  180. this.total = data.data.total;
  181. if (data.data.total / self.queryParams.pageSize <= self.queryParams.page) {
  182. this.$set(this, 'getDataType', true);
  183. }
  184. } else {
  185. this.dataList = [...this.dataList, ...data.data.records]
  186. this.total = data.data.total;
  187. if (data.data.total / self.queryParams.pageSize <= self.queryParams.page) {
  188. this.$set(this, 'getDataType', true);
  189. }
  190. }
  191. }
  192. } else if (this.laboratoryStatus == 1) {
  193. obj.planSetId = this.form.checkPlanSetVoList.planSetId;
  194. obj.planId = this.form.checkPlanSetVoList.planId;
  195. const {
  196. data
  197. } = await securityAppCheckDangerReviewSubList(obj);
  198. if (data.code == 200) {
  199. this.dataList = data.data;
  200. this.$set(this, 'getDataType', true);
  201. }
  202. } else if (this.laboratoryStatus == 2) {
  203. obj.planSetId = this.form.checkPlanSetVoList.planSetId;
  204. obj.planId = this.form.checkPlanSetVoList.planId;
  205. const {
  206. data
  207. } = await securityAppCheckDangerGetCheckDangerSubList(obj);
  208. if (data.code == 200) {
  209. this.dataList = data.data;
  210. this.$set(this, 'getDataType', true);
  211. }
  212. } else if (this.laboratoryStatus == 3) {
  213. const {
  214. data
  215. } = await laboratorySubRelInfoSelectByPage(this.queryParams);
  216. if (data.code == 200) {
  217. if (data.data.records[0]) {
  218. data.data.records.forEach(function(item) {
  219. if (item.levelColor) {
  220. item.levelColorTow = self.hexToRgb(item.levelColor, 0.2)
  221. }
  222. })
  223. if (self.queryParams.page == 1) {
  224. this.dataList = data.data.records;
  225. this.total = data.data.total;
  226. if (data.data.total / self.queryParams.pageSize <= self.queryParams.page) {
  227. this.$set(this, 'getDataType', true);
  228. }
  229. } else {
  230. this.dataList = [...this.dataList, ...data.data.records]
  231. this.total = data.data.total;
  232. if (data.data.total / self.queryParams.pageSize <= self.queryParams.page) {
  233. this.$set(this, 'getDataType', true);
  234. }
  235. }
  236. } else {
  237. uni.showToast({
  238. title: '未找到相关实验室',
  239. icon: "none",
  240. mask: true,
  241. duration: 2000
  242. });
  243. }
  244. }
  245. }
  246. },
  247. }
  248. }
  249. </script>
  250. <style lang="stylus" scoped>
  251. .hiddenDangerItemsSearch {
  252. height: 100%;
  253. display flex;
  254. overflow: hidden;
  255. .info-max-box {}
  256. #totalColor-A {
  257. color: #0183FA;
  258. background: rgba(1, 131, 250, 0.2);
  259. }
  260. #totalColor-B {
  261. color: #16B531;
  262. background: rgba(22, 181, 49, 0.2);
  263. }
  264. #totalColor-C {
  265. color: #FF8C00;
  266. background: rgba(255, 140, 0, 0.2);
  267. }
  268. .header {
  269. width: 100%;
  270. position: fixed;
  271. top: 0rpx;
  272. z-index: 100;
  273. background: #fff;
  274. .search {
  275. width: 750rpx;
  276. height: 100rpx;
  277. background: #FFFFFF;
  278. border-radius: 0rpx 0rpx 0rpx 0rpx;
  279. display: flex;
  280. justify-content: center;
  281. align-items: center;
  282. .search-r {
  283. width: 610rpx;
  284. height: 60rpx;
  285. background: #FFFFFF;
  286. border-radius: 50rpx 50rpx 50rpx 50rpx;
  287. border: 1rpx solid #E0E0E0;
  288. font-size: 24rpx;
  289. color: #999999;
  290. line-height: 60rpx;
  291. text-align: left;
  292. display: flex;
  293. justify-content: flex-start;
  294. align-items: center;
  295. padding: 0 20rpx;
  296. box-sizing: border-box;
  297. >img {
  298. width: 30rpx;
  299. height: 30rpx;
  300. margin-right: 20rpx;
  301. }
  302. >input {
  303. width: 500rpx;
  304. }
  305. }
  306. }
  307. .cancel {
  308. font-size: 28rpx;
  309. color: #0183FA;
  310. line-height: 30rpx;
  311. text-align: left;
  312. margin-left: 18rpx;
  313. }
  314. }
  315. .list {
  316. width: 750rpx;
  317. background: #FFFFFF;
  318. margin-top: 110rpx;
  319. padding-top: 12rpx;
  320. box-sizing: border-box;
  321. margin-top: 120rpx;
  322. .list-li {
  323. min-height: 80rpx;
  324. margin: 0 30rpx;
  325. font-size: 29rpx;
  326. color: #3D3D3D;
  327. line-height: 80rpx;
  328. text-align: left;
  329. border-bottom: 1rpx solid #E0E0E0;
  330. }
  331. }
  332. .lab {
  333. margin-top: 120rpx;
  334. .lab-info {
  335. background: #FFFFFF;
  336. display: flex;
  337. justify-content: space-between;
  338. border: 2rpx dashed #D8D8D8;
  339. .lab-info-l {
  340. width: 80rpx;
  341. height: 80rpx;
  342. background: #0183FA;
  343. border-radius: 10rpx 10rpx 10rpx 10rpx;
  344. margin-left: 30rpx;
  345. margin-top: 30rpx;
  346. margin-bottom: 42rpx;
  347. }
  348. .lab-info-c {
  349. margin: 24rpx 30rpx 0 20rpx;
  350. flex: 1;
  351. .lab-info-c-t {
  352. display: flex;
  353. justify-content: space-between;
  354. .lab-info-c-t-l {
  355. font-size: 30rpx;
  356. color: #333333;
  357. line-height: 42rpx;
  358. text-align: left;
  359. overflow: hidden;
  360. text-overflow: ellipsis;
  361. white-space: nowrap;
  362. }
  363. .lab-info-c-t-r {
  364. display: flex;
  365. justify-content: flex-start;
  366. border-radius: 10rpx 10rpx 10rpx 10rpx;
  367. width: 180rpx;
  368. height: 40rpx;
  369. margin-left: 10rpx;
  370. >text {
  371. display: inline-block;
  372. flex: 1;
  373. text-align: center;
  374. font-size: 24rpx;
  375. line-height: 40rpx;
  376. text-align: center;
  377. }
  378. }
  379. }
  380. .lab-info-c-b {
  381. margin-top: 16rpx;
  382. display: flex;
  383. justify-content: space-between;
  384. >text:nth-of-type(1) {
  385. font-size: 30rpx;
  386. color: #666666;
  387. line-height: 30rpx;
  388. text-align: left;
  389. }
  390. >text:nth-of-type(2) {
  391. font-size: 30rpx;
  392. color: #666666;
  393. line-height: 30rpx;
  394. text-align: left;
  395. }
  396. }
  397. }
  398. }
  399. }
  400. }
  401. </style>