laboratorySearch.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673
  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 v-if="queryParams.searchValue" class="left-icons" @click="delSearchValue()">
  13. <uni-icons color="#0183FA" type="clear" size="20"></uni-icons>
  14. </view>
  15. </view>
  16. <view class="cancel" @click="cancelBtn()">取消</view>
  17. </view>
  18. </view>
  19. <view class="list">
  20. <view class="list-li" @click="listClick(item)" v-for="(item,index) in dataList">
  21. <view class="list-li-t">
  22. <img class="list-li-t-l" src="@/pages_safetyCheck/images/icon_aqjc_shiyanshi.png">
  23. <view class="list-li-t-c">{{item.subName}}</view>
  24. <view class="list-li-t-r" :style="'border:1rpx solid '+item.classLevelColor+';background:'+item.classLevelColorTow+';'">
  25. <text
  26. :style="'border-right:1rpx solid '+item.classLevelColor+';color:'+item.classLevelColor+';'">{{item.classLevelName?item.classLevelName:''}}</text>
  27. <text
  28. :style="'color:'+item.classLevelColor+';'">{{item.classTypeNames?item.classTypeNames:''}}</text>
  29. </view>
  30. </view>
  31. <view class="list-li-b">
  32. <view class="list-li-b-t">
  33. <img src="@/pages/images/icon_sy_zc@1x.png">
  34. {{(laboratoryStatus==0 || laboratoryStatus==3)?(item.roomNum?item.roomNum:'-'):(item.subRoom?item.subRoom:'-')}}房间&{{item.buildName}}
  35. </view>
  36. <view class="list-li-b-b">
  37. <view class="list-li-b-b-l">
  38. <img src="@/pages/images/icon_sy_zc@1x.png">
  39. {{item.deptName}}
  40. </view>
  41. <view :class="item.manageStatus==2?'finished':'notFinished'" v-if="laboratoryStatus==0">
  42. {{item.manageStatus==2?'已完成':'未完成'}}</view>
  43. </view>
  44. </view>
  45. </view>
  46. <view class="get-data-null-p" v-if="getDataType">- 没有更多数据 -</view>
  47. </view>
  48. <!-- <view class="lab">
  49. <view class="lab-info" @click="listClick(item)" v-for="(item,index) in dataList">
  50. <img v-if="laboratoryStatus!=0" class="lab-info-l"
  51. src="@/pages_safetyCheck/images/icon_aqjc_shiyanshi.png">
  52. <view :class="item.manageStatus==2?'finished':'notFinished'" v-if="laboratoryStatus==0">
  53. {{item.manageStatus==2?'已完成':'未完成'}}
  54. </view>
  55. <view class="lab-info-c">
  56. <view class="lab-info-c-t">
  57. <view class="lab-info-c-t-l">{{item.subName}}</view>
  58. <view class="lab-info-c-t-r"
  59. :style="'border:1rpx solid '+item.levelColor+';background:'+item.levelColorTow+';'">
  60. <text
  61. :style="'border-right:1rpx solid '+item.levelColor+';color:'+item.levelColor+';'">{{item.levelName?item.levelName:''}}</text>
  62. <text :style="'color:'+item.levelColor+';'">{{item.typeName?item.typeName:''}}</text>
  63. </view>
  64. </view>
  65. <view class="lab-info-c-b">
  66. <text
  67. v-if="laboratoryStatus==0">{{item.roomNum?item.roomNum:'-'}}房间&{{item.buildName}}</text>
  68. <text
  69. v-if="laboratoryStatus==1 || laboratoryStatus==2">{{item.subRoom?item.subRoom:'-'}}房间&{{item.buildName}}</text>
  70. <text>{{item.deptName}}</text>
  71. </view>
  72. </view>
  73. </view>
  74. </view> -->
  75. </scroll-view>
  76. </view>
  77. </template>
  78. <script>
  79. import {
  80. config
  81. } from '@/api/request/config.js'
  82. import {
  83. laboratorySubRelInfoSelectInfoByPage,
  84. } from '@/api/commonality/permission.js'
  85. import {
  86. securityCheckOptionList,
  87. laboratorySubRelInfoGetRelList,
  88. securityAppCheckManageList,
  89. securityAppCheckDangerReviewSubList,
  90. securityAppCheckDangerGetCheckDangerSubList,
  91. } from '@/pages_safetyCheck/api/index.js'
  92. export default {
  93. name: "hiddenDangerItemsSearch",
  94. components: {
  95. },
  96. data() {
  97. return {
  98. baseUrl: config.base_url,
  99. pageType: 1,
  100. checkOptionList: [],
  101. dataList: [],
  102. searchValue: '',
  103. form: {}, //接收上个页面传过来的参数
  104. getDataType: false,
  105. // 查询参数
  106. queryParams: {
  107. page: 1,
  108. pageSize: 20,
  109. searchValue: '',
  110. subId: '',
  111. },
  112. total: 0,
  113. laboratoryStatus: 0, // 0检查任务1复查验证2隐患整改 3从随手拍页面进入
  114. }
  115. },
  116. onLoad(option) {
  117. if (option.form) {
  118. this.form = JSON.parse(decodeURIComponent(option.form));
  119. console.log(this.form)
  120. if (this.form.subId) {
  121. this.queryParams.subId = this.form.subId
  122. }
  123. if (this.form.laboratoryStatus) {
  124. this.laboratoryStatus = this.form.laboratoryStatus
  125. }
  126. }
  127. },
  128. onShow() {
  129. },
  130. mounted() {
  131. this.getList();
  132. },
  133. methods: {
  134. //滚动事件
  135. scrollGet() {
  136. let self = this;
  137. if (self.total / self.queryParams.pageSize <= self.queryParams.page) {
  138. this.$set(this, 'getDataType', true);
  139. } else {
  140. this.queryParams.page += 1;
  141. this.$nextTick(() => {
  142. this.getList();
  143. })
  144. }
  145. },
  146. //实验室搜索
  147. searchBtn() {
  148. this.dataList = [];
  149. this.getList();
  150. },
  151. //清除输入框内容
  152. delSearchValue() {
  153. if (this.queryParams.searchValue) {
  154. this.$set(this.queryParams, 'searchValue', '');
  155. this.$set(this, 'dataList', []);
  156. this.getList();
  157. }
  158. },
  159. //级联等级
  160. //取消
  161. cancelBtn() {
  162. let self = this;
  163. /* self.queryParams.searchValue = '';
  164. self.dataList = [];
  165. self.getList(); */
  166. if (this.form.laboratoryStatus == 0 || this.form.laboratoryStatus == 1 || this.form.laboratoryStatus ==
  167. 2) {
  168. uni.redirectTo({
  169. url: '/pages_safetyCheck/views/inspectManage/inspectList?infoData=' +
  170. encodeURIComponent(
  171. JSON.stringify(this.form))
  172. });
  173. } else if (this.form.laboratoryStatus == 3) { //从计划实验室列表返回
  174. uni.redirectTo({
  175. url: '/pages_safetyCheck/views/snapshotManage/snapshotList?form=' +
  176. encodeURIComponent(JSON.stringify(this.form))
  177. });
  178. }
  179. },
  180. //十六进制颜色值和RGB格式转换
  181. hexToRgb(hex, opacity = 1) {
  182. // 去除#号
  183. var color = hex.replace("#", "");
  184. // 分割成红、绿、蓝三部分的16进制字符串
  185. var red = parseInt(color.substring(0, 2), 16);
  186. var green = parseInt(color.substring(2, 4), 16);
  187. var blue = parseInt(color.substring(4, 6), 16);
  188. return `RGB(${red}, ${green}, ${blue},${opacity})`;
  189. },
  190. listClick(item) {
  191. if (this.form.laboratoryStatus == 0 || this.form.laboratoryStatus == 1 || this.form.laboratoryStatus ==
  192. 2) {
  193. let infoData = {
  194. ...item,
  195. ...this.form
  196. };
  197. uni.redirectTo({
  198. url: '/pages_safetyCheck/views/itemsManage/hiddenDangerItems?infoData=' +
  199. encodeURIComponent(
  200. JSON.stringify(infoData))
  201. });
  202. } else if (this.form.laboratoryStatus == 3) { //从计划实验室列表返回
  203. this.$set(this.form, "subId", item.subId)
  204. this.$set(this.form, "subName", item.subName)
  205. this.$set(this.form, "subRoom", item.roomNum)
  206. this.$set(this.form, "deptId", item.deptId)
  207. this.$set(this.form, "deptName", item.deptName)
  208. this.$set(this.form, "buildId", item.buildId)
  209. this.$set(this.form, "buildName", item.buildName)
  210. this.$set(this.form, "floorId", item.floorId)
  211. this.$set(this.form, "floorName", item.floorName)
  212. this.$set(this.form, "typeId", item.typeId)
  213. this.$set(this.form, "classTypeNames", item.classTypeNames)
  214. this.$set(this.form, "levelId", item.levelId)
  215. this.$set(this.form, "classLevelName", item.classLevelName)
  216. uni.redirectTo({
  217. url: '/pages_safetyCheck/views/snapshotManage/snapshotList?form=' +
  218. encodeURIComponent(JSON.stringify(this.form))
  219. });
  220. }
  221. },
  222. //搜索房间接口
  223. async getList() {
  224. let self = this;
  225. let obj = JSON.parse(JSON.stringify(this.queryParams));
  226. if (this.laboratoryStatus == 0) {
  227. obj.planSetId = this.form.checkPlanSetVoList.planSetId;
  228. obj.planId = this.form.checkPlanSetVoList.planId;
  229. //检查计划
  230. const {
  231. data
  232. } = await securityAppCheckManageList(obj);
  233. if (data.code == 200) {
  234. data.data.records.forEach(function(item) {
  235. if (item.classLevelColor) {
  236. item.classLevelColorTow = self.hexToRgb(item.classLevelColor, 0.2)
  237. }
  238. })
  239. if (self.queryParams.page == 1) {
  240. this.dataList = data.data.records;
  241. this.total = data.data.total;
  242. if (data.data.total / self.queryParams.pageSize <= self.queryParams.page) {
  243. this.$set(this, 'getDataType', true);
  244. }
  245. } else {
  246. this.dataList = [...this.dataList, ...data.data.records]
  247. this.total = data.data.total;
  248. if (data.data.total / self.queryParams.pageSize <= self.queryParams.page) {
  249. this.$set(this, 'getDataType', true);
  250. }
  251. }
  252. }
  253. } else if (this.laboratoryStatus == 1) {
  254. obj.planSetId = this.form.checkPlanSetVoList.planSetId;
  255. obj.planId = this.form.checkPlanSetVoList.planId;
  256. obj.userId = uni.getStorageSync('userId');
  257. const {
  258. data
  259. } = await securityAppCheckDangerReviewSubList(obj);
  260. if (data.code == 200) {
  261. this.dataList = data.data;
  262. this.$set(this, 'getDataType', true);
  263. }
  264. } else if (this.laboratoryStatus == 2) {
  265. obj.planSetId = this.form.checkPlanSetVoList.planSetId;
  266. obj.planId = this.form.checkPlanSetVoList.planId;
  267. obj.userId = uni.getStorageSync('userId');
  268. const {
  269. data
  270. } = await securityAppCheckDangerGetCheckDangerSubList(obj);
  271. if (data.code == 200) {
  272. this.dataList = data.data;
  273. this.$set(this, 'getDataType', true);
  274. }
  275. } else if (this.laboratoryStatus == 3) {
  276. const {
  277. data
  278. } = await laboratorySubRelInfoSelectInfoByPage(this.queryParams);
  279. if (data.code == 200) {
  280. if (data.data.records[0]) {
  281. data.data.records.forEach(function(item) {
  282. if (item.levelColor) {
  283. item.classTypeNames = item.typeName
  284. item.classLevelName = item.levelName
  285. item.classLevelColor = item.levelColor
  286. item.classLevelColorTow = self.hexToRgb(item.levelColor, 0.2)
  287. }
  288. })
  289. if (self.queryParams.page == 1) {
  290. this.dataList = data.data.records;
  291. this.total = data.data.total;
  292. if (data.data.total / self.queryParams.pageSize <= self.queryParams.page) {
  293. this.$set(this, 'getDataType', true);
  294. }
  295. } else {
  296. this.dataList = [...this.dataList, ...data.data.records]
  297. this.total = data.data.total;
  298. if (data.data.total / self.queryParams.pageSize <= self.queryParams.page) {
  299. this.$set(this, 'getDataType', true);
  300. }
  301. }
  302. } else {
  303. uni.showToast({
  304. title: '未找到相关实验室',
  305. icon: "none",
  306. mask: true,
  307. duration: 2000
  308. });
  309. }
  310. }
  311. }
  312. },
  313. }
  314. }
  315. </script>
  316. <style lang="stylus" scoped>
  317. .hiddenDangerItemsSearch {
  318. height: 100%;
  319. display flex;
  320. overflow: hidden;
  321. .info-max-box {}
  322. #totalColor-A {
  323. color: #0183FA;
  324. background: rgba(1, 131, 250, 0.2);
  325. }
  326. #totalColor-B {
  327. color: #16B531;
  328. background: rgba(22, 181, 49, 0.2);
  329. }
  330. #totalColor-C {
  331. color: #FF8C00;
  332. background: rgba(255, 140, 0, 0.2);
  333. }
  334. .header {
  335. width: 100%;
  336. position: fixed;
  337. top: 0rpx;
  338. z-index: 100;
  339. background: #fff;
  340. .search {
  341. width: 750rpx;
  342. height: 100rpx;
  343. background: #FFFFFF;
  344. border-radius: 0rpx 0rpx 0rpx 0rpx;
  345. display: flex;
  346. justify-content: center;
  347. align-items: center;
  348. .search-r {
  349. width: 610rpx;
  350. height: 60rpx;
  351. background: #FFFFFF;
  352. border-radius: 50rpx 50rpx 50rpx 50rpx;
  353. border: 1rpx solid #E0E0E0;
  354. font-size: 24rpx;
  355. color: #999999;
  356. line-height: 60rpx;
  357. text-align: left;
  358. display: flex;
  359. justify-content: flex-start;
  360. align-items: center;
  361. padding: 0 20rpx;
  362. box-sizing: border-box;
  363. >img {
  364. width: 30rpx;
  365. height: 30rpx;
  366. margin-right: 20rpx;
  367. }
  368. >input {
  369. width: 500rpx;
  370. }
  371. }
  372. }
  373. .cancel {
  374. font-size: 28rpx;
  375. color: #0183FA;
  376. line-height: 30rpx;
  377. text-align: left;
  378. margin-left: 18rpx;
  379. }
  380. }
  381. .list {
  382. width: 750rpx;
  383. padding: 0 30rpx;
  384. box-sizing: border-box;
  385. margin-top: 120rpx;
  386. .list-li {
  387. width: 690rpx;
  388. min-height: 240rpx;
  389. background: #FFFFFF;
  390. border-radius: 10rpx 10rpx 10rpx 10rpx;
  391. padding: 0 30rpx;
  392. box-sizing: border-box;
  393. margin-top: 20rpx;
  394. .list-li-t {
  395. display: flex;
  396. justify-content: flex-start;
  397. align-items: center;
  398. height: 90rpx;
  399. border-bottom: 2rpx dashed #D8D8D8;
  400. .list-li-t-l {
  401. width: 40rpx;
  402. height: 40rpx;
  403. margin-right: 16rpx;
  404. }
  405. .list-li-t-c {
  406. width: 264rpx;
  407. font-size: 30rpx;
  408. color: #333333;
  409. line-height: 30rpx;
  410. text-align: left;
  411. overflow: hidden;
  412. text-overflow: ellipsis;
  413. white-space: nowrap;
  414. margin-right: 24rpx;
  415. }
  416. .list-li-t-r {
  417. display: flex;
  418. justify-content: flex-start;
  419. border-radius: 10rpx 10rpx 10rpx 10rpx;
  420. width: 200rpx;
  421. height: 40rpx;
  422. margin-left: 10rpx;
  423. >text {
  424. display: inline-block;
  425. flex: 1;
  426. text-align: center;
  427. font-size: 24rpx;
  428. line-height: 40rpx;
  429. text-align: center;
  430. overflow: hidden;
  431. text-overflow: ellipsis;
  432. white-space: nowrap;
  433. }
  434. }
  435. }
  436. .list-li-b {
  437. overflow: hidden;
  438. .list-li-b-t {
  439. display: flex;
  440. justify-content: flex-start;
  441. align-items: center;
  442. >img {
  443. width: 28rpx;
  444. height: 26rpx;
  445. margin-right: 16rpx;
  446. }
  447. font-size: 28rpx;
  448. color: #666666;
  449. line-height: 30rpx;
  450. text-align: left;
  451. margin-top: 32rpx;
  452. overflow: hidden;
  453. text-overflow: ellipsis;
  454. white-space: nowrap;
  455. }
  456. .list-li-b-b {
  457. display: flex;
  458. justify-content: space-between;
  459. align-items: center;
  460. margin-top: 20rpx;
  461. .list-li-b-b-l {
  462. display: flex;
  463. justify-content: flex-start;
  464. align-items: center;
  465. >img {
  466. width: 28rpx;
  467. height: 26rpx;
  468. margin-right: 16rpx;
  469. }
  470. font-size: 28rpx;
  471. color: #666666;
  472. line-height: 30rpx;
  473. text-align: left;
  474. overflow: hidden;
  475. text-overflow: ellipsis;
  476. white-space: nowrap;
  477. }
  478. .finished {
  479. width: 110rpx;
  480. height: 40rpx;
  481. background: rgba(1,131,250,0.2);
  482. border-radius: 20rpx 20rpx 20rpx 20rpx;
  483. font-size: 24rpx;
  484. color: #0183FA;
  485. line-height: 40rpx;
  486. text-align: center;
  487. }
  488. .notFinished {
  489. width: 110rpx;
  490. height: 40rpx;
  491. background: #E0E0E0;
  492. border-radius: 20rpx 20rpx 20rpx 20rpx;
  493. font-size: 24rpx;
  494. color: #666666;
  495. line-height: 40rpx;
  496. text-align: center;
  497. }
  498. }
  499. }
  500. }
  501. }
  502. .get-data-null-p {
  503. height: 100rpx;
  504. line-height: 100rpx;
  505. text-align: center;
  506. }
  507. .lab {
  508. margin-top: 120rpx;
  509. .lab-info {
  510. background: #FFFFFF;
  511. display: flex;
  512. justify-content: space-between;
  513. border: 2rpx dashed #D8D8D8;
  514. .lab-info-l {
  515. width: 80rpx;
  516. height: 80rpx;
  517. background: #0183FA;
  518. border-radius: 10rpx 10rpx 10rpx 10rpx;
  519. margin-left: 30rpx;
  520. margin-top: 30rpx;
  521. margin-bottom: 42rpx;
  522. }
  523. .finished {
  524. width: 90rpx;
  525. height: 90rpx;
  526. background: #0183FA;
  527. border-radius: 100rpx 100rpx 100rpx 100rpx;
  528. font-size: 24rpx;
  529. color: #FFFFFF;
  530. line-height: 90rpx;
  531. text-align: center;
  532. margin-left: 30rpx;
  533. margin-top: 30rpx;
  534. margin-bottom: 32rpx;
  535. }
  536. .notFinished {
  537. width: 90rpx;
  538. height: 90rpx;
  539. background: #E0E0E0;
  540. border-radius: 100rpx 100rpx 100rpx 100rpx;
  541. font-size: 24rpx;
  542. color: #999999;
  543. line-height: 90rpx;
  544. text-align: center;
  545. margin-left: 30rpx;
  546. margin-top: 30rpx;
  547. margin-bottom: 32rpx;
  548. }
  549. .lab-info-c {
  550. margin: 24rpx 30rpx 0 20rpx;
  551. flex: 1;
  552. .lab-info-c-t {
  553. display: flex;
  554. justify-content: space-between;
  555. .lab-info-c-t-l {
  556. font-size: 30rpx;
  557. color: #333333;
  558. line-height: 42rpx;
  559. text-align: left;
  560. overflow: hidden;
  561. text-overflow: ellipsis;
  562. white-space: nowrap;
  563. }
  564. .lab-info-c-t-r {
  565. display: flex;
  566. justify-content: flex-start;
  567. border-radius: 10rpx 10rpx 10rpx 10rpx;
  568. width: 180rpx;
  569. height: 40rpx;
  570. margin-left: 10rpx;
  571. >text {
  572. display: inline-block;
  573. flex: 1;
  574. text-align: center;
  575. font-size: 24rpx;
  576. line-height: 40rpx;
  577. text-align: center;
  578. }
  579. }
  580. }
  581. .lab-info-c-b {
  582. margin-top: 16rpx;
  583. display: flex;
  584. justify-content: space-between;
  585. >text {
  586. overflow: hidden;
  587. text-overflow: ellipsis;
  588. white-space: nowrap;
  589. }
  590. >text:nth-of-type(1) {
  591. font-size: 30rpx;
  592. color: #666666;
  593. line-height: 30rpx;
  594. text-align: left;
  595. }
  596. >text:nth-of-type(2) {
  597. font-size: 30rpx;
  598. color: #666666;
  599. line-height: 30rpx;
  600. text-align: left;
  601. }
  602. }
  603. }
  604. }
  605. }
  606. }
  607. </style>