searchMuti.vue 10 KB

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