searchSqType.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412
  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="selectData.includes(row.id) ? 'selectStyle' : ''">
  12. <view class="keyword-text">
  13. {{type=="startDept" || type=="checkoutDept" ? row.dept : row.name}}
  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. // startDept: [],
  45. // checkoutDept: [],
  46. // testTube: [],
  47. // speState: []
  48. gdId:null
  49. };
  50. },
  51. onLoad(options) {
  52. this.hosId = uni.getStorageSync("userData").user.currentHospital.id;
  53. console.log(options, 'options');
  54. this.type = options.type
  55. this.gdId = options.id
  56. if(options.type=='startDept'){
  57. this.getStartDept()
  58. }else if (options.type=='checkoutDept'){
  59. this.getCheckoutDept()
  60. }else if (options.type=='testTube'){
  61. this.getTestTube()
  62. }else if (options.type=='speState'){
  63. this.getSpeState()
  64. }
  65. },
  66. methods: {
  67. searchKey(e){
  68. if(this.type=='startDept'){
  69. this.handleSearch1()
  70. }else if (this.type=='checkoutDept'){
  71. this.handleSearch2()
  72. }
  73. },
  74. handleSearch1: debounce(function() {
  75. this.getStartDept();
  76. }, 500),
  77. handleSearch2: debounce(function() {
  78. this.getCheckoutDept();
  79. }, 500),
  80. //获取起点科室
  81. getStartDept() {
  82. let postData = {
  83. idx: 0,
  84. sum: 20,
  85. department:{
  86. searchType: 1,
  87. hospital: {
  88. id: this.hosId
  89. },
  90. dept: this.key
  91. }
  92. }
  93. post("/simple/data/fetchDataList/department", postData).then((res) => {
  94. this.dataList = res.list
  95. })
  96. },
  97. // 获取检验科室
  98. getCheckoutDept(){
  99. let postData1 = {
  100. key:'dept_type',
  101. type: "list"
  102. }
  103. post("/common/common/getDictionary", postData1).then((res2) => {
  104. let item = res2.find(i=>i.name=='检验科室')
  105. let data1 = {
  106. idx: 0,
  107. sum: 20,
  108. department: {
  109. hospital: { id: this.hosId || "" },
  110. type: { id: item.id || "" },
  111. dept: this.key,
  112. },
  113. };
  114. post("/simple/data/fetchDataList/department", data1).then((res) => {
  115. this.dataList = res.list;
  116. });
  117. })
  118. },
  119. // 获取试管类型
  120. getTestTube(){
  121. let postData1 = {
  122. key:'specimen_tube_type',
  123. type: "list"
  124. }
  125. post("/common/common/getDictionary", postData1).then((res) => {
  126. this.dataList = res
  127. })
  128. },
  129. // 获取标本状态
  130. getSpeState(){
  131. let postData1 = {
  132. key:'speState',
  133. type: "list"
  134. }
  135. post("/common/common/getDictionary", postData1).then((res) => {
  136. this.dataList = res
  137. })
  138. },
  139. // 确认
  140. determine(type) {
  141. this.allData = []
  142. this.dataList.forEach(i=>{
  143. for(let x of this.selectData){
  144. if(i.id == x){
  145. this.allData.push(i)
  146. }
  147. }
  148. })
  149. console.log(3333, this.allData)
  150. if (type == 'back') {
  151. uni.navigateBack({
  152. delta: 1,
  153. })
  154. } else {
  155. if(this.type=='startDept'){
  156. let data = uni.getStorageSync('startDept')
  157. if(data){
  158. let arr = JSON.parse(data)
  159. for(let i of this.allData){
  160. arr.push(i)
  161. }
  162. uni.setStorageSync('startDept', JSON.stringify(arr))
  163. }else{
  164. uni.setStorageSync('startDept', JSON.stringify(this.allData))
  165. }
  166. }else if (this.type=='checkoutDept'){
  167. let data = uni.getStorageSync('checkoutDept')
  168. if(data){
  169. let arr = JSON.parse(data)
  170. for(let i of this.allData){
  171. arr.push(i)
  172. }
  173. uni.setStorageSync('checkoutDept', JSON.stringify(arr))
  174. }else{
  175. uni.setStorageSync('checkoutDept', JSON.stringify(this.allData))
  176. }
  177. }else if (this.type=='testTube'){
  178. uni.setStorageSync('testTube', JSON.stringify(this.allData))
  179. }else if (this.type=='speState'){
  180. uni.setStorageSync('speState', JSON.stringify(this.allData))
  181. }
  182. uni.navigateTo({
  183. url: `../speConfigurationGather/speConfigurationGather?type=${this.type}&id=${this.gdId}&back=1`
  184. });
  185. }
  186. },
  187. // 选择楼栋
  188. itemClick(item) {
  189. let index = this.selectData.indexOf(item.id)
  190. if (index == -1) {
  191. this.selectData.push(item.id)
  192. } else {
  193. this.selectData.splice(index, 1)
  194. }
  195. }
  196. },
  197. };
  198. </script>
  199. <style scoped>
  200. .is-input-border{
  201. border-color: #eee !important
  202. }
  203. </style>
  204. <style scoped lang="less">
  205. view {
  206. display: block;
  207. }
  208. .title {
  209. padding: 30rpx;
  210. font-size: 32rpx;
  211. text-align: center;
  212. font-weight: bold;
  213. }
  214. // 底部
  215. .toolbar {
  216. position: fixed;
  217. left: 0;
  218. right: 0;
  219. bottom: 30rpx;
  220. width: 96%;
  221. margin-left: 2%;
  222. z-index: 9999;
  223. display: flex;
  224. justify-content: space-between;
  225. align-items: center;
  226. box-sizing: border-box;
  227. .btn {
  228. width: 48%;
  229. height: 88rpx;
  230. line-height: 88rpx;
  231. text-align: center;
  232. border-radius: 10rpx;
  233. }
  234. .affirm {
  235. background-color: #49B856;
  236. color: #fff;
  237. }
  238. .cancel {
  239. background-color: #AFAFAF;
  240. color: #fff;
  241. }
  242. }
  243. .search-box {
  244. width: 95%;
  245. background-color: rgb(242, 242, 242);
  246. padding: 15upx 2.5%;
  247. display: flex;
  248. justify-content: space-between;
  249. position: sticky;
  250. top: 0;
  251. }
  252. .search-box .mSearch-input-box {
  253. width: 100%;
  254. }
  255. .search-box .input-box {
  256. width: 85%;
  257. flex-shrink: 1;
  258. display: flex;
  259. justify-content: center;
  260. align-items: center;
  261. }
  262. .search-box .search-btn {
  263. width: 15%;
  264. margin: 0 0 0 2%;
  265. display: flex;
  266. justify-content: center;
  267. align-items: center;
  268. flex-shrink: 0;
  269. font-size: 28upx;
  270. color: #fff;
  271. background: linear-gradient(to right, #ff9801, #ff570a);
  272. border-radius: 60upx;
  273. }
  274. .search-box .input-box>input {
  275. width: 100%;
  276. height: 60upx;
  277. font-size: 32upx;
  278. border: 0;
  279. border-radius: 60upx;
  280. -webkit-appearance: none;
  281. -moz-appearance: none;
  282. appearance: none;
  283. padding: 0 3%;
  284. margin: 0;
  285. background-color: #ffffff;
  286. }
  287. .placeholder-class {
  288. color: #9e9e9e;
  289. }
  290. .search-keyword {
  291. width: 100%;
  292. background-color: rgb(242, 242, 242);
  293. }
  294. .padding{
  295. // padding: 0 20rpx;
  296. }
  297. .keyword-list-box {
  298. height: calc(100vh - 220rpx);
  299. padding-top: 10upx;
  300. border-radius: 20upx 20upx 0 0;
  301. background-color: #fff;
  302. }
  303. .selectStyle {
  304. color: #49B856 !important;
  305. }
  306. .keyword-entry-tap {
  307. background-color: #eee;
  308. }
  309. .keyword-entry {
  310. width: 94%;
  311. height: 80rpx;
  312. margin: 0 3%;
  313. font-size: 30rpx;
  314. color: #333;
  315. display: flex;
  316. justify-content: center;
  317. align-items: center;
  318. border-bottom: solid 1rpx #DEDEDE;
  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>