taskTypeSearch.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413
  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=='startDept'){
  80. this.handleSearch1()
  81. }else if (this.type=='checkoutDept'){
  82. this.handleSearch2()
  83. }
  84. },
  85. handleSearch1: debounce(function() {
  86. this.getStartDept();
  87. }, 500),
  88. handleSearch2: debounce(function() {
  89. this.getCheckoutDept();
  90. }, 500),
  91. //获取申请科室
  92. getapplyDept() {
  93. let postData = {
  94. idx: 0,
  95. sum: 20,
  96. department:{
  97. searchType: 1,
  98. hospital: {
  99. id: this.hosId
  100. },
  101. dept: this.key
  102. }
  103. }
  104. post("/simple/data/fetchDataList/department", postData).then((res) => {
  105. this.dataList = res.list
  106. })
  107. },
  108. //获取起点科室
  109. getStartDept() {
  110. // 科室类型:201:默认发起科室
  111. // 科室类型:202:固定科室范围
  112. // 科室类型:203:固定科室
  113. // 科室类型:204:自主填写
  114. // 科室类型:205:固定科室类型
  115. if(this.startTarget == 204 || this.startTarget== 205){
  116. let postData = {
  117. idx: 0,
  118. sum: 20,
  119. department:{
  120. searchType: 1,
  121. cascadeHosId: this.hosId,
  122. type:{
  123. id: null
  124. },
  125. dept: this.key
  126. }
  127. }
  128. if(this.startTarget == 204){
  129. delete postData.department.type
  130. }else{
  131. postData.department.type.id = this.taskTypeData.startTypeId
  132. }
  133. post("/simple/data/fetchDataList/department", postData).then((res) => {
  134. this.dataList = res.list
  135. })
  136. }else{
  137. this.dataList = this.taskTypeData.startDept
  138. }
  139. },
  140. // 获取终点科室
  141. getEndDept(){
  142. // 科室类型:201:默认发起科室
  143. // 科室类型:202:固定科室范围
  144. // 科室类型:203:固定科室
  145. // 科室类型:204:自主填写
  146. // 科室类型:205:固定科室类型
  147. if(this.endTarget == 204 || this.endTarget== 205){
  148. let postData = {
  149. idx: 0,
  150. sum: 20,
  151. department:{
  152. searchType: 1,
  153. cascadeHosId: this.hosId,
  154. type:{
  155. id: null
  156. },
  157. dept: this.key
  158. }
  159. }
  160. if(this.endTarget == 204){
  161. delete postData.department.type
  162. }else{
  163. postData.department.type.id = this.taskTypeData.endTypeId
  164. }
  165. post("/simple/data/fetchDataList/department", postData).then((res) => {
  166. this.dataList = res.list
  167. })
  168. }else{
  169. this.dataList = this.taskTypeData.endDept
  170. }
  171. },
  172. // 确认
  173. determine(type) {
  174. this.allData = this.selectData
  175. if (type == 'back') {
  176. uni.navigateBack({
  177. delta: 1,
  178. })
  179. } else {
  180. if(this.type=='applyDept'){
  181. uni.setStorageSync('applyDept', JSON.stringify(this.allData))
  182. }else if (this.type=='startDept'){
  183. uni.setStorageSync('taskStartDept', JSON.stringify(this.allData))
  184. }else if (this.type=='endDept'){
  185. uni.setStorageSync('taskEndDept', JSON.stringify(this.allData))
  186. }
  187. uni.redirectTo ({
  188. url: `../sponsorTaskBuild/sponsorTaskBuild?type=${this.type}&startTarget=${this.startTarget}&endTarget=${this.endTarget}&taskTypeId=${this.taskTypeId}&taskName=${this.taskName}`
  189. });
  190. }
  191. },
  192. // 选择楼栋
  193. itemClick(item) {
  194. this.selectData = item
  195. this.selectId = item.id
  196. }
  197. },
  198. };
  199. </script>
  200. <style scoped>
  201. .is-input-border{
  202. border-color: #eee !important
  203. }
  204. </style>
  205. <style scoped lang="less">
  206. view {
  207. display: block;
  208. }
  209. .title {
  210. padding: 30rpx;
  211. font-size: 32rpx;
  212. text-align: center;
  213. font-weight: bold;
  214. }
  215. // 底部
  216. .toolbar {
  217. position: fixed;
  218. left: 0;
  219. right: 0;
  220. bottom: 30rpx;
  221. width: 96%;
  222. margin-left: 2%;
  223. z-index: 9999;
  224. display: flex;
  225. justify-content: space-between;
  226. align-items: center;
  227. box-sizing: border-box;
  228. .btn {
  229. width: 48%;
  230. height: 88rpx;
  231. line-height: 88rpx;
  232. text-align: center;
  233. border-radius: 10rpx;
  234. }
  235. .affirm {
  236. background-color: #49B856;
  237. color: #fff;
  238. }
  239. .cancel {
  240. background-color: #AFAFAF;
  241. color: #fff;
  242. }
  243. }
  244. .search-box {
  245. width: 95%;
  246. background-color: rgb(242, 242, 242);
  247. padding: 15upx 2.5%;
  248. display: flex;
  249. justify-content: space-between;
  250. position: sticky;
  251. top: 0;
  252. }
  253. .search-box .mSearch-input-box {
  254. width: 100%;
  255. }
  256. .search-box .input-box {
  257. width: 85%;
  258. flex-shrink: 1;
  259. display: flex;
  260. justify-content: center;
  261. align-items: center;
  262. }
  263. .search-box .search-btn {
  264. width: 15%;
  265. margin: 0 0 0 2%;
  266. display: flex;
  267. justify-content: center;
  268. align-items: center;
  269. flex-shrink: 0;
  270. font-size: 28upx;
  271. color: #fff;
  272. background: linear-gradient(to right, #ff9801, #ff570a);
  273. border-radius: 60upx;
  274. }
  275. .search-box .input-box>input {
  276. width: 100%;
  277. height: 60upx;
  278. font-size: 32upx;
  279. border: 0;
  280. border-radius: 60upx;
  281. -webkit-appearance: none;
  282. -moz-appearance: none;
  283. appearance: none;
  284. padding: 0 3%;
  285. margin: 0;
  286. background-color: #ffffff;
  287. }
  288. .placeholder-class {
  289. color: #9e9e9e;
  290. }
  291. .search-keyword {
  292. width: 100%;
  293. background-color: rgb(242, 242, 242);
  294. }
  295. .padding{
  296. // padding: 0 20rpx;
  297. }
  298. .keyword-list-box {
  299. height: calc(100vh - 220rpx);
  300. padding-top: 10upx;
  301. border-radius: 20upx 20upx 0 0;
  302. background-color: #fff;
  303. }
  304. .selectStyle {
  305. color: #49B856 !important;
  306. }
  307. .keyword-entry-tap {
  308. background-color: #eee;
  309. }
  310. .keyword-entry {
  311. width: 94%;
  312. height: 80rpx;
  313. margin: 0 3%;
  314. font-size: 30rpx;
  315. color: #333;
  316. display: flex;
  317. justify-content: center;
  318. align-items: center;
  319. border-bottom: solid 1rpx #DEDEDE;
  320. }
  321. .keyword-entry image {
  322. width: 60upx;
  323. height: 60upx;
  324. }
  325. .keyword-entry .keyword-text,
  326. .keyword-entry .keyword-img {
  327. height: 80upx;
  328. display: flex;
  329. align-items: center;
  330. }
  331. .keyword-entry .keyword-text {
  332. // width: 90%;
  333. }
  334. .keyword-entry .keyword-img {
  335. width: 10%;
  336. justify-content: center;
  337. }
  338. .keyword-box {
  339. height: calc(100vh - 110upx);
  340. border-radius: 20upx 20upx 0 0;
  341. background-color: #fff;
  342. }
  343. .keyword-box .keyword-block {
  344. padding: 10upx 0;
  345. }
  346. .keyword-box .keyword-block .keyword-list-header {
  347. width: 94%;
  348. padding: 10upx 3%;
  349. font-size: 27upx;
  350. color: #333;
  351. display: flex;
  352. justify-content: space-between;
  353. }
  354. .keyword-box .keyword-block .keyword-list-header image {
  355. width: 40upx;
  356. height: 40upx;
  357. }
  358. .keyword-box .keyword-block .keyword {
  359. width: 94%;
  360. padding: 3px 3%;
  361. display: flex;
  362. flex-flow: wrap;
  363. justify-content: flex-start;
  364. }
  365. .keyword-box .keyword-block .hide-hot-tis {
  366. display: flex;
  367. justify-content: center;
  368. font-size: 28upx;
  369. color: #6b6b6b;
  370. }
  371. .keyword-box .keyword-block .keyword>view {
  372. display: flex;
  373. justify-content: center;
  374. align-items: center;
  375. border-radius: 60upx;
  376. padding: 0 20upx;
  377. margin: 10upx 20upx 10upx 0;
  378. height: 60upx;
  379. font-size: 28upx;
  380. background-color: rgb(242, 242, 242);
  381. color: #6b6b6b;
  382. }
  383. </style>