searchFloor.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460
  1. <template>
  2. <view class="content">
  3. <view class="df-fl">
  4. <view class="df-all">
  5. <checkbox-group @change="allCheckChange">
  6. <checkbox value="all" color="#42b983" :checked="allCheck"/>
  7. <text class="text">全选</text>
  8. </checkbox-group>
  9. </view>
  10. <view class="title">{{name}}</view>
  11. </view>
  12. <view class="search-keyword">
  13. <scroll-view class="keyword-list-box" scroll-y>
  14. <checkbox-group @change="checkboxChange">
  15. <view v-for="(row, index) in dataList" :key="index" class="view-box">
  16. <checkbox class="top-check1" color="#42b983" :value="row.floor.id + 'parent'" :checked="row.checked" />
  17. <uni-collapse ref="collapse" v-model="row.floor.collapseValue">
  18. <uni-collapse-item :title="row.floor.floorName + '楼'">
  19. <view v-for="(item, index) in row.children" :key="item.id">
  20. <view class="keyword-entry">
  21. <view class="keyword-text">
  22. <checkbox class="top-check2" color="#42b983" :value="item.id" :checked="item.checked" />
  23. <view class="title-2">{{item.dept}}</view>
  24. </view>
  25. </view>
  26. </view>
  27. </uni-collapse-item>
  28. </uni-collapse>
  29. </view>
  30. </checkbox-group>
  31. </scroll-view>
  32. </view>
  33. <view class="toolbar">
  34. <view class="back" @click="back()">返回</view>
  35. <view class="confirm" @click="confirm()">确定</view>
  36. </view>
  37. <!-- 弹窗 -->
  38. <showModel :title="models.title" :icon="models.icon" :disjunctor="models.disjunctor" :content="models.content" @know="know" :operate="models.operate"></showModel>
  39. </view>
  40. </template>
  41. <script>
  42. import {
  43. post,
  44. webHandle
  45. } from "../../http/http.js";
  46. export default {
  47. data() {
  48. return {
  49. type: "", //进入该页面的类型
  50. configName: "", //快速组合名称
  51. id: "", //快速组合id
  52. name:"",
  53. changedept: 0, //是否从列表过来的切换负责科室
  54. hosId: "",
  55. dataList: [],
  56. //系统设置的科室类型
  57. sysDeptType: 0,
  58. quickCombinationDeptType: 0,
  59. // 弹窗model
  60. models: {
  61. disjunctor: false,
  62. },
  63. valueColl:false,
  64. allCheck:false,
  65. buildIds:[],
  66. ids:[]
  67. };
  68. },
  69. onLoad(options) {
  70. this.hosId = uni.getStorageSync("userData").user.currentHospital.id;
  71. console.log(options, 'options');
  72. this.name = options.name
  73. this.id = options.id;
  74. this.configName = options.configName;
  75. this.changedept = options.changedept;
  76. this.getBuildings();
  77. // #ifdef APP-PLUS
  78. webHandle("no", "app");
  79. // #endif
  80. // #ifdef H5
  81. webHandle("no", "wx");
  82. // #endif
  83. },
  84. onShow(){
  85. this.getBuildings();
  86. },
  87. methods: {
  88. // 全选
  89. allCheckChange(e){
  90. if(e.detail.value.length>0){
  91. this.dataList.forEach((item, index)=>{
  92. item.checked = true
  93. if(item.children && item.children.length>0){
  94. for(let i of item.children){
  95. i.checked = true
  96. this.buildIds.push(i)
  97. }
  98. }
  99. })
  100. }else{
  101. this.dataList.forEach((item, index)=>{
  102. item.checked = false
  103. if(item.children && item.children.length>0){
  104. for(let i of item.children){
  105. i.checked = false
  106. this.buildIds = []
  107. }
  108. }
  109. })
  110. }
  111. // this.buildIds = this.buildIds.filter(v => v.indexOf('parent')==-1);
  112. console.log(888,this.buildIds)
  113. },
  114. //知道了
  115. know() {
  116. this.models.disjunctor = false;
  117. },
  118. back(){
  119. uni.navigateBack({
  120. delta: 1,
  121. })
  122. },
  123. // 确认
  124. confirm() {
  125. // const dataList = this.buildIds.filter(v => v.indexOf('parent')==-1);
  126. console.log(3333,this.buildIds);
  127. if (this.buildIds.length === 0) {
  128. this.models = {
  129. disjunctor: true,
  130. title: "提示",
  131. content: "请选择至少一个楼层",
  132. icon: "warn",
  133. operate: {
  134. know: "知道了",
  135. },
  136. };
  137. } else {
  138. uni.setStorageSync("setDepts", this.buildIds)
  139. uni.navigateTo({
  140. url: `../setDept/setDept?configName=${this.configName}&id=${this.id}&changedept=${this.changedept}`,
  141. });
  142. }
  143. },
  144. // 选择楼栋
  145. itemClick(item){
  146. console.log(3333,item)
  147. },
  148. changeColl(){
  149. },
  150. // 选择楼栋
  151. checkboxChange: function(e) {
  152. // this.buildIds = e.detail.value
  153. this.buildIds = []
  154. // for (let i of dataList){
  155. // for(let item of i.children){
  156. // for(let x of e.detail.value){
  157. // if(x == item.id){
  158. // this.buildIds.push(i)
  159. // }else{
  160. // }
  161. // }
  162. // }
  163. // }
  164. if(e.detail.value.length>0){
  165. this.dataList.forEach((item, index)=>{
  166. if(item.children && item.children.length>0){
  167. for(let i of item.children){
  168. if(e.detail.value.includes(i.id)){
  169. this.buildIds.push(i)
  170. }
  171. }
  172. }
  173. })
  174. }
  175. console.log(888,this.buildIds)
  176. // var dataList = this.dataList,
  177. // values = e.detail.value;
  178. // for (let i of dataList) {
  179. // for(let item of i.children){
  180. // if (values.includes(item.id)) {
  181. // this.$set(item, 'checked', true)
  182. // } else {
  183. // this.$set(item, 'checked', false)
  184. // }
  185. // }
  186. // }
  187. },
  188. //获取楼栋列表
  189. getBuildings() {
  190. let data = uni.getStorageSync("floorList")
  191. data.forEach((item, index)=>{
  192. item.floor.collapseValue = []
  193. item.floor.id = item.floor.id.toString()
  194. item.floor.checked = false
  195. if(item.children && item.children.length>0){
  196. for(let i of item.children){
  197. i.checked = false
  198. i.id = i.id.toString()
  199. }
  200. }
  201. })
  202. console.log(3232131,data)
  203. this.dataList = data || [];
  204. }
  205. },
  206. };
  207. </script>
  208. <style>
  209. uni-checkbox-group{
  210. /* display: flex;
  211. align-items: center;
  212. position: relative; */
  213. }
  214. /deep/ .uni-collapse-item__title-box{
  215. margin-left: 50rpx
  216. }
  217. </style>
  218. <style scoped lang="less">
  219. view {
  220. display: block;
  221. }
  222. .df-fl{
  223. display: flex;
  224. align-items: center;
  225. justify-content: center;
  226. position: relative;
  227. }
  228. .df-all{
  229. position: absolute;
  230. left: 16rpx;
  231. .text{
  232. margin-left: 8rpx;
  233. }
  234. }
  235. .view-box{
  236. position: relative;
  237. }
  238. .top-check1{
  239. position: absolute;
  240. left: 0;
  241. top: 20rpx;
  242. z-index: 999;
  243. }
  244. .top-check2{
  245. position: absolute;
  246. left: 0;
  247. top: 20rpx;
  248. z-index: 999;
  249. }
  250. .title{
  251. padding: 30rpx;
  252. font-size: 32rpx;
  253. text-align: center;
  254. font-weight: bold;
  255. }
  256. // 底部
  257. .toolbar {
  258. position: fixed;
  259. left: 0;
  260. right: 0;
  261. bottom: 30rpx;
  262. width: 96%;
  263. margin-left: 2%;
  264. z-index: 9999;
  265. height: 88rpx;
  266. display: flex;
  267. justify-content: space-between;
  268. align-items: center;
  269. box-sizing: border-box;
  270. color: #fff;
  271. .back{
  272. width: 48%;
  273. height: 88rpx;
  274. display: flex;
  275. justify-content: center;
  276. align-items: center;
  277. box-sizing: border-box;
  278. border-radius: 10rpx;
  279. background-color: #8F939C;
  280. }
  281. .confirm{
  282. width: 46%;
  283. height: 88rpx;
  284. display: flex;
  285. justify-content: center;
  286. align-items: center;
  287. box-sizing: border-box;
  288. border-radius: 10rpx;
  289. background-color: #49B856;
  290. }
  291. }
  292. .search-box {
  293. width: 95%;
  294. background-color: rgb(242, 242, 242);
  295. padding: 15upx 2.5%;
  296. display: flex;
  297. justify-content: space-between;
  298. position: sticky;
  299. top: 0;
  300. }
  301. .search-box .mSearch-input-box {
  302. width: 100%;
  303. }
  304. .search-box .input-box {
  305. width: 85%;
  306. flex-shrink: 1;
  307. display: flex;
  308. justify-content: center;
  309. align-items: center;
  310. }
  311. .search-box .search-btn {
  312. width: 15%;
  313. margin: 0 0 0 2%;
  314. display: flex;
  315. justify-content: flex-start;
  316. align-items: center;
  317. flex-shrink: 0;
  318. font-size: 28upx;
  319. color: #fff;
  320. background: linear-gradient(to right, #ff9801, #ff570a);
  321. border-radius: 60upx;
  322. }
  323. .search-box .input-box>input {
  324. width: 100%;
  325. height: 60upx;
  326. font-size: 32upx;
  327. border: 0;
  328. border-radius: 60upx;
  329. -webkit-appearance: none;
  330. -moz-appearance: none;
  331. appearance: none;
  332. padding: 0 3%;
  333. margin: 0;
  334. background-color: #ffffff;
  335. }
  336. .placeholder-class {
  337. color: #9e9e9e;
  338. }
  339. .search-keyword {
  340. width: 100%;
  341. background-color: rgb(242, 242, 242);
  342. }
  343. .keyword-list-box {
  344. height: calc(100vh - 230rpx);
  345. padding-top: 10upx;
  346. // padding: 0 20rpx;
  347. border-radius: 20upx 20upx 0 0;
  348. background-color: #fff;
  349. width: 96%;
  350. padding-left: 2%;
  351. }
  352. .keyword-entry-tap {
  353. background-color: #eee;
  354. }
  355. .keyword-entry {
  356. width: 94%;
  357. height: 80rpx;
  358. margin: 0 3%;
  359. font-size: 30rpx;
  360. color: #333;
  361. display: flex;
  362. justify-content: start;
  363. align-items: center;
  364. border-bottom: solid 1rpx #DEDEDE;
  365. }
  366. .keyword-entry image {
  367. width: 60upx;
  368. height: 60upx;
  369. }
  370. .keyword-entry .keyword-text,
  371. .keyword-entry .keyword-img {
  372. height: 80upx;
  373. display: flex;
  374. align-items: center;
  375. position: relative;
  376. }
  377. .title-2{
  378. padding-left: 76rpx;
  379. }
  380. .keyword-entry .keyword-text {
  381. // width: 90%;
  382. }
  383. .keyword-entry .keyword-img {
  384. width: 10%;
  385. justify-content: center;
  386. }
  387. .keyword-box {
  388. height: calc(100vh - 110upx);
  389. border-radius: 20upx 20upx 0 0;
  390. background-color: #fff;
  391. }
  392. .keyword-box .keyword-block {
  393. padding: 10upx 0;
  394. }
  395. .keyword-box .keyword-block .keyword-list-header {
  396. width: 94%;
  397. padding: 10upx 3%;
  398. font-size: 27upx;
  399. color: #333;
  400. display: flex;
  401. justify-content: space-between;
  402. }
  403. .keyword-box .keyword-block .keyword-list-header image {
  404. width: 40upx;
  405. height: 40upx;
  406. }
  407. .keyword-box .keyword-block .keyword {
  408. width: 94%;
  409. padding: 3px 3%;
  410. display: flex;
  411. flex-flow: wrap;
  412. justify-content: flex-start;
  413. }
  414. .keyword-box .keyword-block .hide-hot-tis {
  415. display: flex;
  416. justify-content: center;
  417. font-size: 28upx;
  418. color: #6b6b6b;
  419. }
  420. .keyword-box .keyword-block .keyword>view {
  421. display: flex;
  422. justify-content: center;
  423. align-items: center;
  424. border-radius: 60upx;
  425. padding: 0 20upx;
  426. margin: 10upx 20upx 10upx 0;
  427. height: 60upx;
  428. font-size: 28upx;
  429. background-color: rgb(242, 242, 242);
  430. color: #6b6b6b;
  431. }
  432. </style>