searchMuti.vue 12 KB

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