laboratorySearch.vue 13 KB

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