laboratorySearch.vue 12 KB

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