laboratorySearch.vue 8.6 KB

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