laboratorySearch.vue 8.4 KB

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