index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549
  1. <template>
  2. <view class="main">
  3. <NavBar :user-info="userInfo" @update-user="updateUser" />
  4. <view class="body">
  5. <view class="tab-box">
  6. <view class="tab-bar">
  7. <view class="tab_item" v-for="(tab, index) in tabList" :key="index"
  8. :class="{'active':tabActive==index}" @click="checkIndex(index)">
  9. <text class="text">{{tab.title}}{{index===0?"("+orderList.length+")":""}}</text>
  10. </view>
  11. </view>
  12. <view class="search-bar">
  13. <view v-if="tabActive === 0" class="today">
  14. <view class="search">
  15. <uni-easyinput prefixIcon="search" v-model="searchVal" placeholder="请输入姓名" />
  16. </view>
  17. <button type="primary" @click="handleSearch" class="search-button">搜索</button>
  18. <button type="primary" :disabled="userInfo.workStatus==='1'?false:true" @click="handleRefresh" class="refresh">一键释放</button>
  19. </view>
  20. <view v-else class="history">
  21. <view class="searchchoice">
  22. <view class="row1">
  23. <view class="timequan">
  24. <text class="time_t">时间区间:</text>
  25. <uni-datetime-picker v-model="searchTime" type="datetimerange" :hide-second="true" rangeSeparator=" - " />
  26. </view>
  27. <view class="office">
  28. <view class="uni-list-cell-left office_t">
  29. 科室:
  30. </view>
  31. <picker @change="handleGetOffice" :value="officeIndex" :range="officeArr">
  32. <view class="uni-input">{{officeArr[officeIndex]}}</view>
  33. </picker>
  34. </view>
  35. </view>
  36. <view class="row2">
  37. <view class="presid">
  38. <picker @change="handleGetType" :value="typeIndex" :range="typeArr">
  39. <view class="uni-input">{{typeArr[typeIndex]}}</view>
  40. </picker>
  41. </view>
  42. <view v-if="typeIndex === 0" class="search">
  43. <uni-easyinput prefixIcon="search" v-model="searchName" placeholder="请输入姓名" />
  44. </view>
  45. <view v-else class="search">
  46. <uni-easyinput prefixIcon="search" v-model="searchPreNo" placeholder="请输入处方号" />
  47. </view>
  48. <button type="primary" @click="handleSearch" class="search-button">搜索</button>
  49. </view>
  50. <view class="row3">
  51. <view class="tag-view" v-for="(v, i) in tags" :key="i">
  52. <uni-tag :circle="true" :inverted="!searchTags.includes(v)" :text=v type="primary" @click="handleGetTags(v)" />
  53. </view>
  54. </view>
  55. </view>
  56. </view>
  57. </view>
  58. </view>
  59. <view class="tab-content">
  60. <view class="order-list">
  61. <scroll-view v-if="orderList.length > 0" class="order-list-wrap" scroll-y="true" :scroll-top="50">
  62. <template v-for="(v,i) in orderList" :key="i">
  63. <orderCard v-if="v" :v="v" :index="i" :c=tabActive class="order-card"
  64. @update-list="updateList"
  65. />
  66. </template>
  67. </scroll-view>
  68. <view v-else class="text">-- 没有更多数据 --</view>
  69. </view>
  70. <view v-if="isBottom" class="order-bottom">
  71. <view class="text">-- 没有更多数据 --</view>
  72. </view>
  73. </view>
  74. </view>
  75. </view>
  76. </template>
  77. <script setup>
  78. import NavBar from "@/components/nav-bar/nav-bar.vue"
  79. import OrderCard from "@/components/order-card/order-card.vue"
  80. import { onMounted,ref } from 'vue'
  81. import { onLoad } from "@dcloudio/uni-app"
  82. import {receiveOrderList } from "@/static/js/api.js"
  83. const userInfo = ref({})
  84. const searchVal = ref('')
  85. const tabList = ref([
  86. {title:"今日待完成", status: 0},
  87. {title:"历史处方", status: 1},
  88. ])
  89. const currentStatus = ref('0')
  90. const tabActive = ref(0) // 当前tab Index
  91. const tabName = ref('今日待完成') // 当前tab Name
  92. // const tags = ref([])
  93. const orderList = ref([
  94. {id:1,prescriptionTime:'2023-07-06 14:54', faceurl:'/static/hz.png',name:'张三三',sex: '女',age: 23,disName:'胃脘痛病',symName:'脾胃虚寒证',deployState:'调配',preNo:10230516091026,department:'中医内科',dosageForm:'汤剂',number:3,prescriptionSum:135.62,preMzZy:'1'},
  95. {id:2,prescriptionTime:'2023-07-06 14:54', faceurl:'/static/hz.png',name:'张三三',sex: '女',age: 23,disName:'胃脘痛病',symName:'脾胃虚寒证',deployState:'调配',preNo:10230516091026,department:'中医内科',dosageForm:'汤剂',number:3,prescriptionSum:135.62,preMzZy:'1'},
  96. {id:3,prescriptionTime:'2023-07-06 14:54', faceurl:'/static/hz.png',name:'张三三',sex: '女',age: 23,disName:'胃脘痛病',symName:'脾胃虚寒证',deployState:'调配',preNo:10230516091026,department:'中医内科',dosageForm:'汤剂',number:3,prescriptionSum:135.62,preMzZy:'2'},
  97. {id:4,prescriptionTime:'2023-07-06 14:54', faceurl:'/static/hz.png',name:'张三三',sex: '女',age: 23,disName:'胃脘痛病',symName:'脾胃虚寒证',deployState:'调配',preNo:10230516091026,department:'中医内科',dosageForm:'汤剂',number:3,prescriptionSum:135.62,preMzZy:'1'},
  98. {id:5,prescriptionTime:'2023-07-06 14:54', faceurl:'/static/hz.png',name:'张三三',sex: '女',age: 23,disName:'胃脘痛病',symName:'脾胃虚寒证',deployState:'调配',preNo:10230516091026,department:'中医内科',dosageForm:'汤剂',number:3,prescriptionSum:135.62,preMzZy:'2'}
  99. ])
  100. const isBottom = ref(false) // 是否触底
  101. const officeArr = ref(['全部','中医骨伤科门诊一','中医内科门诊一','中医儿科门诊'])
  102. const officeIndex = ref(0)
  103. const typeArr = ref(['姓名:','处方号:'])
  104. const typeIndex = ref(0)
  105. const searchTime =ref([])
  106. const searchDepartment = ref('')
  107. const searchName = ref('')
  108. const searchPreNo = ref('')
  109. const searchSex = ref('')
  110. const searchPreMzZy = ref('')
  111. const searchStatus = ref('')
  112. const searchTags = ref([])
  113. const tags = ref(['全部','门诊','住院','男','女','煎煮','发药'])
  114. const page = ref(0)
  115. const total = ref(0)
  116. const pageSize = ref(10)
  117. onMounted(() => {
  118. })
  119. onLoad(async () => {
  120. const token = uni.getStorageSync('token')
  121. const userId = uni.getStorageSync('userId')
  122. userInfo.value.name = uni.getStorageSync('username')
  123. userInfo.value.workStatus = '0'
  124. const params = {
  125. token: token,
  126. data:{
  127. status: '0',
  128. currentUserId: userId,
  129. // page: page.value,
  130. // pageSize: pageSize.value,
  131. }
  132. }
  133. const {data:res} = await receiveOrderList(params)
  134. if (res.code === 200) {
  135. total.value = res.total
  136. orderList.value = res.rows
  137. }
  138. })
  139. // 子传父,更新userInfo
  140. const updateUser = (v)=>{
  141. console.log('updateUserStatus', v)
  142. userInfo.value.workStatus = v
  143. }
  144. const updateList = (v)=>{
  145. console.log('updateList', v)
  146. }
  147. const handleSearch = async()=>{
  148. const token = uni.getStorageSync('token')
  149. console.log('handleSearch searchVal', searchVal.value)
  150. searchVal.value = searchVal.value.trim()
  151. if(currentStatus.value ==='0' && searchVal.value) {
  152. const params = {
  153. token: token,
  154. data: {
  155. status: currentStatus.value,
  156. name: searchVal.value,
  157. page: page.value,
  158. pageSize: pageSize.value,
  159. }
  160. }
  161. const {data:res} = await receiveOrderList(params)
  162. if (res.code === 200) {
  163. total.value = res.total
  164. orderList.value = res.rows
  165. }
  166. }
  167. if(currentStatus.value==='1'){
  168. // searchTime.value = []
  169. // searchDepartment.value = ''
  170. // searchName.value = ''
  171. // searchPreNo.value = ''
  172. // searchSex.value = ''
  173. // searchPreMzZy.value = ''
  174. // searchStatus.value = ''
  175. const params = {
  176. token: token,
  177. data: {
  178. startTime: searchTime.value[0] || '',
  179. endTime: searchTime.value[1] || '',
  180. status: currentStatus.value || '',
  181. name: searchVal.value || '',
  182. preNo: searchPreNo.value || '',
  183. prescriptionStatus: searchStatus.value || '',
  184. sex: searchSex.value || '',
  185. preMzZy: searchPreMzZy.value || '',
  186. page: page.value,
  187. pageSize: pageSize.value,
  188. }
  189. }
  190. console.log('params',params)
  191. const {data:res} = await receiveOrderList(params)
  192. if (res.code === 200) {
  193. total.value = res.total
  194. orderList.value = res.rows
  195. }
  196. }
  197. }
  198. const handleRefresh = async()=>{
  199. let ids = orderList.value.map((v)=>{ return v.id }).join(',')
  200. const params = {
  201. token: token,
  202. data:{
  203. ids:ids
  204. }
  205. }
  206. const {data:res} = await releaseOrder(params)
  207. if (res.code === 200) {
  208. total.value = res.total
  209. orderList.value = []
  210. }
  211. }
  212. const handleGetOffice = (e)=>{
  213. console.log('handleGetOffice', e.detail.value)
  214. console.log('officeIndex', officeIndex)
  215. console.log('officeIndex', officeIndex)
  216. officeIndex.value = e.detail.value
  217. }
  218. const handleGetType = (e)=>{
  219. console.log('handleGetType', e.detail.value)
  220. console.log('typeIndex', typeIndex)
  221. console.log('typeArr', typeIndex)
  222. typeIndex.value = e.detail.value
  223. if(typeIndex.value ===1 ){
  224. searchName.value = ''
  225. } else {
  226. searchPreNo.value = ''
  227. }
  228. }
  229. const handleGetTags = (v)=>{
  230. console.log('handleGetTags', v)
  231. if(!searchTags.value.includes(v)) {
  232. searchTags.value.push(v)
  233. } else {
  234. searchTags.value.splice(searchTags.value.indexOf(v), 1)
  235. }
  236. switch (v) {
  237. case '全部':
  238. if(searchTags.value.includes(v)){
  239. searchTags.value = ['全部']
  240. searchTime.value = []
  241. searchDepartment.value = ''
  242. searchName.value = ''
  243. searchPreNo.value = ''
  244. searchSex.value = ''
  245. searchPreMzZy.value = ''
  246. searchStatus.value = ''
  247. }
  248. break
  249. case '门诊':
  250. if(searchTags.value.includes(v) && searchTags.value.includes('住院')){
  251. searchTags.value.splice(searchTags.value.indexOf('住院'), 1)
  252. }
  253. if(searchTags.value.includes('全部')){
  254. searchTags.value.splice(searchTags.value.indexOf('全部'), 1)
  255. }
  256. searchPreMzZy.value = '1'
  257. break
  258. case '住院':
  259. if(searchTags.value.includes(v) && searchTags.value.includes('门诊')){
  260. searchTags.value.splice(searchTags.value.indexOf('门诊'), 1)
  261. }
  262. if(searchTags.value.includes('全部')){
  263. searchTags.value.splice(searchTags.value.indexOf('全部'), 1)
  264. }
  265. searchPreMzZy.value = '2'
  266. break
  267. case '男':
  268. if(searchTags.value.includes(v) && searchTags.value.includes('女')){
  269. searchTags.value.splice(searchTags.value.indexOf('女'), 1)
  270. }
  271. if(searchTags.value.includes('全部')){
  272. searchTags.value.splice(searchTags.value.indexOf('全部'), 1)
  273. }
  274. searchSex.value = '男'
  275. break
  276. case '女':
  277. if(searchTags.value.includes(v) && searchTags.value.includes('男')){
  278. searchTags.value.splice(searchTags.value.indexOf('男'), 1)
  279. }
  280. if(searchTags.value.includes('全部')){
  281. searchTags.value.splice(searchTags.value.indexOf('全部'), 1)
  282. }
  283. searchSex.value = '女'
  284. break
  285. case '煎煮':
  286. if(searchTags.value.includes(v) && searchTags.value.includes('发药')){
  287. searchTags.value.splice(searchTags.value.indexOf('发药'), 1)
  288. }
  289. if(searchTags.value.includes('全部')){
  290. searchTags.value.splice(searchTags.value.indexOf('全部'), 1)
  291. }
  292. searchStatus.value = '煎煮'
  293. break
  294. case '发药':
  295. if(searchTags.value.includes(v) && searchTags.value.includes('煎煮')){
  296. searchTags.value.splice(searchTags.value.indexOf('煎煮'), 1)
  297. }
  298. if(searchTags.value.includes('全部')){
  299. searchTags.value.splice(searchTags.value.indexOf('全部'), 1)
  300. }
  301. searchStatus.value = '发药'
  302. break
  303. default:
  304. searchTags.value = ['全部']
  305. }
  306. }
  307. // 更新处方列表
  308. const checkIndex = async(index) => {
  309. tabActive.value = index
  310. tabName.value = tabList.value[index].title
  311. currentStatus.value = parseInt(tabList.value[index].status)
  312. const token = uni.getStorageSync('token')
  313. const params = {
  314. token: token,
  315. data: {
  316. status: currentStatus.value,
  317. page: page.value,
  318. pageSize: pageSize.value,
  319. }
  320. }
  321. console.log('checkIndex params',params)
  322. const {data:res} = await receiveOrderList(params)
  323. if (res.code === 200) {
  324. total.value = res.total
  325. orderList.value = res.rows
  326. }
  327. }
  328. </script>
  329. <style lang="scss">
  330. .main {
  331. display: flex;
  332. flex-direction:column;
  333. justify-content:flex-start;
  334. height: 2000px;
  335. width: 1200px;
  336. .nav{
  337. display: flex;
  338. height:140px;
  339. width: 1200px;
  340. // position: sticky;
  341. // top: 0;
  342. }
  343. .body{
  344. display: flex;
  345. height:calc(100% - 100px);
  346. flex-direction:column;
  347. justify-content:flex-start;
  348. .tab-box {
  349. display: flex;
  350. position: sticky;
  351. flex-direction:column;
  352. .tab-bar{
  353. height: 78px;
  354. display: flex;
  355. justify-content:center;
  356. width: 100%;
  357. // border: 1px solid #000;
  358. .tab_item{
  359. display: flex;
  360. flex:1;
  361. justify-content:center;
  362. align-items: center;
  363. font-size: 30px;
  364. background-color: #fff;
  365. color: #000;
  366. }
  367. .active{
  368. // background-color: #fff!important;
  369. border-bottom: 5px solid #18C7B0;
  370. // color:#000!important;
  371. }
  372. }
  373. .search-bar{
  374. display: flex;
  375. background-color: #fff;
  376. margin: 8px 10px;
  377. border-radius: 4px;
  378. width: calc(100% - 20px);
  379. .today{
  380. width: 100%;
  381. display: flex;
  382. flex-direction:row;
  383. justify-content: flex-start;
  384. .search{
  385. width: 100%;
  386. margin: 8px 12px;
  387. }
  388. .search-button{
  389. width:100px;
  390. margin: 8px 12px;
  391. font-size: 18px;
  392. background-color: #18C7B0;
  393. }
  394. .refresh {
  395. width:200px;
  396. margin: 8px 12px;
  397. font-size: 18px;
  398. background-color: #18C7B0;
  399. }
  400. }
  401. .history{
  402. display: flex;
  403. width: 100%;
  404. .searchchoice{
  405. padding: 0 20px;
  406. display: flex;
  407. width: 100%;
  408. flex-direction:column;
  409. font-size: 24px;
  410. .row1{
  411. display: flex;
  412. width: 100%;
  413. justify-content:flex-start;
  414. align-items: center;
  415. margin: 10px 0 10px;
  416. // height: 80px;
  417. .timequan{
  418. display: flex;
  419. justify-content:center;
  420. align-items: center;
  421. width:70%;
  422. .time_t{}
  423. }
  424. .office{
  425. display: flex;
  426. margin-left: 60px;
  427. justify-content:center;
  428. align-items: center;
  429. .uni-input{
  430. display: flex;
  431. justify-content:center;
  432. align-items: center;
  433. border:1px solid #e1e5f1;
  434. font-size: 18px;
  435. width:190px;
  436. height: 40px;
  437. border-radius: 5px;
  438. background-color: #e1e5f1;
  439. margin-right: 10px;
  440. }
  441. }
  442. }
  443. .row2{
  444. display: flex;
  445. width: 100%;
  446. justify-content:flex-start;
  447. align-items: center;
  448. margin: 0 0 10px;
  449. .uni-input{
  450. display: flex;
  451. justify-content:center;
  452. align-items: center;
  453. border:1px solid #e1e5f1;
  454. font-size: 18px;
  455. width:100px;
  456. height: 40px;
  457. border-radius: 5px;
  458. background-color: #e1e5f1;
  459. margin-right: 10px;
  460. }
  461. .search{
  462. width: 77%;
  463. }
  464. .search-button{
  465. width:120px;
  466. margin: 8px 12px;
  467. font-size: 16px;
  468. }
  469. }
  470. .row3{
  471. display: flex;
  472. width: 100%;
  473. justify-content:flex-start;
  474. align-items: center;
  475. margin: 0 0 18px;
  476. .tag-view:deep(.uni-tag){
  477. display: inline;
  478. font-size: 20px;
  479. margin-right: 40px;
  480. // height: 40px;
  481. width: 120px;
  482. padding: 6px 20px;
  483. }
  484. }
  485. }
  486. }
  487. }
  488. }
  489. .tab-content{
  490. display: flex;
  491. margin: 8px 10px;
  492. border-radius: 4px;
  493. background-color: #fff;
  494. width: calc(100% - 20px);
  495. height: 100%;
  496. .order-list{
  497. padding: 8px;
  498. display: flex;
  499. width: 100%;
  500. // height: 100%;
  501. .order-list-wrap{
  502. display: flex;
  503. .order-card{
  504. display: flex;
  505. width: 100%;
  506. border-bottom: 1px solid #e6e8ee;;
  507. }
  508. }
  509. }
  510. }
  511. }
  512. }
  513. </style>