laboratorySearch.vue 12 KB

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