taskTypeSearch.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430
  1. <template>
  2. <view class="content">
  3. <view class="search-keyword">
  4. <view class="padding">
  5. <uni-easyinput prefixIcon="search" v-model="key" :clearable="false" placeholder="请输入" @input="searchKey">
  6. </uni-easyinput>
  7. </view>
  8. <scroll-view class="keyword-list-box" scroll-y>
  9. <label v-for="(row, index) in dataList" :key="row.id" @click="itemClick(row)"
  10. >
  11. <view class="keyword-entry" :class="selectId == row.id ? 'selectStyle' : ''">
  12. <view class="keyword-text">
  13. {{row.dept}}
  14. </view>
  15. </view>
  16. </label>
  17. </scroll-view>
  18. </view>
  19. <view class="toolbar">
  20. <view class="btn cancel" @click="determine('back')" hover-class="seimin-btn-hover">
  21. 取消
  22. </view>
  23. <view class="btn affirm" @click="determine('submit')" hover-class="seimin-btn-hover">
  24. 确定
  25. </view>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. import {
  31. post,
  32. webHandle
  33. } from "../../http/http.js";
  34. import debounce from 'lodash-es/debounce'
  35. export default {
  36. data() {
  37. return {
  38. key:null,
  39. type: "", //进入该页面的类型
  40. hosId: "",
  41. dataList: [],
  42. selectData: [],
  43. allData:[],
  44. gdId:null,
  45. startTarget:null,
  46. endTarget:null,
  47. selectId:null,
  48. taskTypeData:null,
  49. taskTypeId:null,
  50. taskName:null
  51. };
  52. },
  53. onLoad(options) {
  54. this.hosId = uni.getStorageSync("userData").user.currentHospital.id;
  55. this.taskTypeData = JSON.parse(options.taskTypeData)
  56. console.log(this.options, '777');
  57. console.log(this.taskTypeData, '123');
  58. this.taskTypeId = options.taskTypeId
  59. this.taskName = options.taskName
  60. this.type = options.type
  61. // 科室类型:201:默认发起科室
  62. // 科室类型:202:固定科室范围
  63. // 科室类型:203:固定科室
  64. // 科室类型:204:自主填写
  65. // 科室类型:205:固定科室类型
  66. this.startTarget = this.taskTypeData.startStatus
  67. this.endTarget = this.taskTypeData.endStatus
  68. this.gdId = options.id
  69. if(options.type=='applyDept'){
  70. this.getapplyDept()
  71. }else if (options.type=='startDept'){
  72. this.getStartDept()
  73. }else if (options.type=='endDept'){
  74. this.getEndDept()
  75. }
  76. },
  77. methods: {
  78. searchKey(e){
  79. if(this.type=='applyDept'){
  80. this.handleSearch1()
  81. }else if (this.type=='startDept'){
  82. this.handleSearch2()
  83. }else if (this.type=='endDept'){
  84. this.handleSearch3()
  85. }
  86. },
  87. handleSearch1: debounce(function() {
  88. this.getapplyDept();
  89. }, 500),
  90. handleSearch2: debounce(function() {
  91. this.getStartDept();
  92. }, 500),
  93. handleSearch3: debounce(function() {
  94. this.getEndDept();
  95. }, 500),
  96. //获取申请科室
  97. getapplyDept() {
  98. let postData = {
  99. idx: 0,
  100. sum: 20,
  101. department:{
  102. searchType: 1,
  103. hospital: {
  104. id: this.hosId
  105. },
  106. dept: this.key
  107. }
  108. }
  109. post("/simple/data/fetchDataList/department", postData).then((res) => {
  110. this.dataList = res.list
  111. })
  112. },
  113. //获取起点科室
  114. getStartDept() {
  115. // 科室类型:201:默认发起科室
  116. // 科室类型:202:固定科室范围
  117. // 科室类型:203:固定科室
  118. // 科室类型:204:自主填写
  119. // 科室类型:205:固定科室类型
  120. if(this.startTarget == 204 || this.startTarget== 205){
  121. let postData = {
  122. idx: 0,
  123. sum: 20,
  124. department:{
  125. searchType: 1,
  126. cascadeHosId: this.hosId,
  127. type:{
  128. id: null
  129. },
  130. dept: this.key
  131. }
  132. }
  133. if(this.startTarget == 204){
  134. delete postData.department.type
  135. }else{
  136. postData.department.type.id = this.taskTypeData.startTypeId
  137. }
  138. post("/simple/data/fetchDataList/department", postData).then((res) => {
  139. this.dataList = res.list
  140. })
  141. }else if(this.startTarget== 202){
  142. if(this.key){
  143. this.dataList = this.taskTypeData.startDept.filter(i=>i.dept.indexOf(this.key)!=-1)
  144. }else{
  145. this.dataList = this.taskTypeData.startDept
  146. }
  147. }else{
  148. this.dataList = this.taskTypeData.startDept
  149. }
  150. },
  151. // 获取终点科室
  152. getEndDept(){
  153. // 科室类型:201:默认发起科室
  154. // 科室类型:202:固定科室范围
  155. // 科室类型:203:固定科室
  156. // 科室类型:204:自主填写
  157. // 科室类型:205:固定科室类型
  158. if(this.endTarget == 204 || this.endTarget== 205){
  159. let postData = {
  160. idx: 0,
  161. sum: 20,
  162. department:{
  163. searchType: 1,
  164. cascadeHosId: this.hosId,
  165. type:{
  166. id: null
  167. },
  168. dept: this.key
  169. }
  170. }
  171. if(this.endTarget == 204){
  172. delete postData.department.type
  173. }else{
  174. postData.department.type.id = this.taskTypeData.endTypeId
  175. }
  176. post("/simple/data/fetchDataList/department", postData).then((res) => {
  177. this.dataList = res.list
  178. })
  179. }else if(this.endTarget== 202){
  180. if(this.key){
  181. this.dataList = this.taskTypeData.endDept.filter(i=>i.dept.indexOf(this.key)!=-1)
  182. }else{
  183. this.dataList = this.taskTypeData.endDept
  184. }
  185. }else{
  186. this.dataList = this.taskTypeData.endDept
  187. }
  188. },
  189. // 确认
  190. determine(type) {
  191. this.allData = this.selectData
  192. if (type == 'back') {
  193. uni.navigateBack({
  194. delta: 1,
  195. })
  196. } else {
  197. if(this.type=='applyDept'){
  198. uni.setStorageSync('applyDept', JSON.stringify(this.allData))
  199. }else if (this.type=='startDept'){
  200. uni.setStorageSync('taskStartDept', JSON.stringify(this.allData))
  201. }else if (this.type=='endDept'){
  202. uni.setStorageSync('taskEndDept', JSON.stringify(this.allData))
  203. }
  204. uni.redirectTo ({
  205. url: `../sponsorTaskBuild/sponsorTaskBuild?type=${this.type}&startTarget=${this.startTarget}&endTarget=${this.endTarget}&taskTypeId=${this.taskTypeId}&taskName=${this.taskName}`
  206. });
  207. }
  208. },
  209. // 选择楼栋
  210. itemClick(item) {
  211. this.selectData = item
  212. this.selectId = item.id
  213. }
  214. },
  215. };
  216. </script>
  217. <style scoped>
  218. .is-input-border{
  219. border-color: #eee !important
  220. }
  221. </style>
  222. <style scoped lang="less">
  223. view {
  224. display: block;
  225. }
  226. .title {
  227. padding: 30rpx;
  228. font-size: 32rpx;
  229. text-align: center;
  230. font-weight: bold;
  231. }
  232. // 底部
  233. .toolbar {
  234. position: fixed;
  235. left: 0;
  236. right: 0;
  237. bottom: 30rpx;
  238. width: 96%;
  239. margin-left: 2%;
  240. z-index: 9999;
  241. display: flex;
  242. justify-content: space-between;
  243. align-items: center;
  244. box-sizing: border-box;
  245. .btn {
  246. width: 48%;
  247. height: 88rpx;
  248. line-height: 88rpx;
  249. text-align: center;
  250. border-radius: 10rpx;
  251. }
  252. .affirm {
  253. background-color: #49B856;
  254. color: #fff;
  255. }
  256. .cancel {
  257. background-color: #AFAFAF;
  258. color: #fff;
  259. }
  260. }
  261. .search-box {
  262. width: 95%;
  263. background-color: rgb(242, 242, 242);
  264. padding: 15upx 2.5%;
  265. display: flex;
  266. justify-content: space-between;
  267. position: sticky;
  268. top: 0;
  269. }
  270. .search-box .mSearch-input-box {
  271. width: 100%;
  272. }
  273. .search-box .input-box {
  274. width: 85%;
  275. flex-shrink: 1;
  276. display: flex;
  277. justify-content: center;
  278. align-items: center;
  279. }
  280. .search-box .search-btn {
  281. width: 15%;
  282. margin: 0 0 0 2%;
  283. display: flex;
  284. justify-content: center;
  285. align-items: center;
  286. flex-shrink: 0;
  287. font-size: 28upx;
  288. color: #fff;
  289. background: linear-gradient(to right, #ff9801, #ff570a);
  290. border-radius: 60upx;
  291. }
  292. .search-box .input-box>input {
  293. width: 100%;
  294. height: 60upx;
  295. font-size: 32upx;
  296. border: 0;
  297. border-radius: 60upx;
  298. -webkit-appearance: none;
  299. -moz-appearance: none;
  300. appearance: none;
  301. padding: 0 3%;
  302. margin: 0;
  303. background-color: #ffffff;
  304. }
  305. .placeholder-class {
  306. color: #9e9e9e;
  307. }
  308. .search-keyword {
  309. width: 100%;
  310. background-color: rgb(242, 242, 242);
  311. }
  312. .padding{
  313. // padding: 0 20rpx;
  314. }
  315. .keyword-list-box {
  316. height: calc(100vh - 220rpx);
  317. padding-top: 10upx;
  318. border-radius: 20upx 20upx 0 0;
  319. background-color: #fff;
  320. }
  321. .selectStyle {
  322. color: #49B856 !important;
  323. }
  324. .keyword-entry-tap {
  325. background-color: #eee;
  326. }
  327. .keyword-entry {
  328. width: 94%;
  329. height: 80rpx;
  330. margin: 0 3%;
  331. font-size: 30rpx;
  332. color: #333;
  333. display: flex;
  334. justify-content: center;
  335. align-items: center;
  336. border-bottom: solid 1rpx #DEDEDE;
  337. }
  338. .keyword-entry image {
  339. width: 60upx;
  340. height: 60upx;
  341. }
  342. .keyword-entry .keyword-text,
  343. .keyword-entry .keyword-img {
  344. height: 80upx;
  345. display: flex;
  346. align-items: center;
  347. }
  348. .keyword-entry .keyword-text {
  349. // width: 90%;
  350. }
  351. .keyword-entry .keyword-img {
  352. width: 10%;
  353. justify-content: center;
  354. }
  355. .keyword-box {
  356. height: calc(100vh - 110upx);
  357. border-radius: 20upx 20upx 0 0;
  358. background-color: #fff;
  359. }
  360. .keyword-box .keyword-block {
  361. padding: 10upx 0;
  362. }
  363. .keyword-box .keyword-block .keyword-list-header {
  364. width: 94%;
  365. padding: 10upx 3%;
  366. font-size: 27upx;
  367. color: #333;
  368. display: flex;
  369. justify-content: space-between;
  370. }
  371. .keyword-box .keyword-block .keyword-list-header image {
  372. width: 40upx;
  373. height: 40upx;
  374. }
  375. .keyword-box .keyword-block .keyword {
  376. width: 94%;
  377. padding: 3px 3%;
  378. display: flex;
  379. flex-flow: wrap;
  380. justify-content: flex-start;
  381. }
  382. .keyword-box .keyword-block .hide-hot-tis {
  383. display: flex;
  384. justify-content: center;
  385. font-size: 28upx;
  386. color: #6b6b6b;
  387. }
  388. .keyword-box .keyword-block .keyword>view {
  389. display: flex;
  390. justify-content: center;
  391. align-items: center;
  392. border-radius: 60upx;
  393. padding: 0 20upx;
  394. margin: 10upx 20upx 10upx 0;
  395. height: 60upx;
  396. font-size: 28upx;
  397. background-color: rgb(242, 242, 242);
  398. color: #6b6b6b;
  399. }
  400. </style>