index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543
  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/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. userInfo.value.name = uni.getStorageSync('username')
  122. userInfo.value.workStatus = '0'
  123. const params = {
  124. token: token,
  125. data:{
  126. status: '0',
  127. page: page.value,
  128. pageSize: pageSize.value,
  129. }
  130. }
  131. const {data:res} = await receiveOrderList(params)
  132. if (res.code === 200) {
  133. total.value = res.total
  134. orderList.value = res.rows
  135. }
  136. })
  137. // 子传父,更新userInfo
  138. const updateUser = (v)=>{
  139. console.log('updateUserStatus', v)
  140. userInfo.value.workStatus = v
  141. }
  142. const updateList = (v)=>{
  143. console.log('updateList', v)
  144. }
  145. const handleSearch = async()=>{
  146. const token = uni.getStorageSync('token')
  147. console.log('handleSearch searchVal', searchVal.value)
  148. searchVal.value = searchVal.value.trim()
  149. if(currentStatus.value ==='0' && searchVal.value) {
  150. const params = {
  151. token: token,
  152. data: {
  153. status: currentStatus.value,
  154. name: searchVal.value,
  155. page: page.value,
  156. pageSize: pageSize.value,
  157. }
  158. }
  159. const {data:res} = await receiveOrderList(params)
  160. if (res.code === 200) {
  161. total.value = res.total
  162. orderList.value = res.rows
  163. }
  164. }
  165. if(currentStatus.value==='1'){
  166. // searchTime.value = []
  167. // searchDepartment.value = ''
  168. // searchName.value = ''
  169. // searchPreNo.value = ''
  170. // searchSex.value = ''
  171. // searchPreMzZy.value = ''
  172. // searchStatus.value = ''
  173. const params = {
  174. token: token,
  175. data: {
  176. startTime: searchTime.value[0] || '',
  177. endTime: searchTime.value[1] || '',
  178. status: currentStatus.value || '',
  179. name: searchVal.value || '',
  180. preNo: searchPreNo.value || '',
  181. prescriptionStatus: searchStatus.value || '',
  182. sex: searchSex.value || '',
  183. preMzZy: searchPreMzZy.value || '',
  184. page: page.value,
  185. pageSize: pageSize.value,
  186. }
  187. }
  188. const {data:res} = await receiveOrderList(params)
  189. if (res.code === 200) {
  190. total.value = res.total
  191. orderList.value = res.rows
  192. }
  193. }
  194. }
  195. const handleRefresh = async()=>{
  196. let ids = orderList.value.map((v)=>{ return v.id }).join(',')
  197. const params = {
  198. token: token,
  199. data:{
  200. ids:ids
  201. }
  202. }
  203. const {data:res} = await releaseOrder(params)
  204. if (res.code === 200) {
  205. total.value = res.total
  206. orderList.value = []
  207. }
  208. }
  209. const handleGetOffice = (e)=>{
  210. console.log('handleGetOffice', e.detail.value)
  211. console.log('officeIndex', officeIndex)
  212. console.log('officeIndex', officeIndex)
  213. officeIndex.value = e.detail.value
  214. }
  215. const handleGetType = (e)=>{
  216. console.log('handleGetType', e.detail.value)
  217. console.log('typeIndex', typeIndex)
  218. console.log('typeArr', typeIndex)
  219. typeIndex.value = e.detail.value
  220. if(typeIndex.value ===1 ){
  221. searchName.value = ''
  222. } else {
  223. searchPreNo.value = ''
  224. }
  225. }
  226. const handleGetTags = (v)=>{
  227. console.log('handleGetTags', v)
  228. if(!searchTags.value.includes(v)) {
  229. searchTags.value.push(v)
  230. } else {
  231. searchTags.value.splice(searchTags.value.indexOf(v), 1)
  232. }
  233. switch (v) {
  234. case '全部':
  235. if(searchTags.value.includes(v)){
  236. searchTags.value = ['全部']
  237. searchTime.value = []
  238. searchDepartment.value = ''
  239. searchName.value = ''
  240. searchPreNo.value = ''
  241. searchSex.value = ''
  242. searchPreMzZy.value = ''
  243. searchStatus.value = ''
  244. }
  245. break
  246. case '门诊':
  247. if(searchTags.value.includes(v) && searchTags.value.includes('住院')){
  248. searchTags.value.splice(searchTags.value.indexOf('住院'), 1)
  249. }
  250. if(searchTags.value.includes('全部')){
  251. searchTags.value.splice(searchTags.value.indexOf('全部'), 1)
  252. }
  253. searchPreMzZy.value = '1'
  254. break
  255. case '住院':
  256. if(searchTags.value.includes(v) && searchTags.value.includes('门诊')){
  257. searchTags.value.splice(searchTags.value.indexOf('门诊'), 1)
  258. }
  259. if(searchTags.value.includes('全部')){
  260. searchTags.value.splice(searchTags.value.indexOf('全部'), 1)
  261. }
  262. searchPreMzZy.value = '2'
  263. break
  264. case '男':
  265. if(searchTags.value.includes(v) && searchTags.value.includes('女')){
  266. searchTags.value.splice(searchTags.value.indexOf('女'), 1)
  267. }
  268. if(searchTags.value.includes('全部')){
  269. searchTags.value.splice(searchTags.value.indexOf('全部'), 1)
  270. }
  271. searchSex.value = '男'
  272. break
  273. case '女':
  274. if(searchTags.value.includes(v) && searchTags.value.includes('男')){
  275. searchTags.value.splice(searchTags.value.indexOf('男'), 1)
  276. }
  277. if(searchTags.value.includes('全部')){
  278. searchTags.value.splice(searchTags.value.indexOf('全部'), 1)
  279. }
  280. searchSex.value = '女'
  281. break
  282. case '煎煮':
  283. if(searchTags.value.includes(v) && searchTags.value.includes('发药')){
  284. searchTags.value.splice(searchTags.value.indexOf('发药'), 1)
  285. }
  286. if(searchTags.value.includes('全部')){
  287. searchTags.value.splice(searchTags.value.indexOf('全部'), 1)
  288. }
  289. searchStatus.value = '煎煮'
  290. break
  291. case '发药':
  292. if(searchTags.value.includes(v) && searchTags.value.includes('煎煮')){
  293. searchTags.value.splice(searchTags.value.indexOf('煎煮'), 1)
  294. }
  295. if(searchTags.value.includes('全部')){
  296. searchTags.value.splice(searchTags.value.indexOf('全部'), 1)
  297. }
  298. searchStatus.value = '发药'
  299. break
  300. default:
  301. searchTags.value = ['全部']
  302. }
  303. }
  304. // 更新处方列表
  305. const checkIndex = async(index) => {
  306. tabActive.value = index
  307. tabName.value = tabList.value[index].title
  308. currentStatus.value = parseInt(tabList.value[index].status)
  309. const token = uni.getStorageSync('token')
  310. const params = {
  311. token: token,
  312. data: {
  313. status: currentStatus.value,
  314. page: page.value,
  315. pageSize: pageSize.value,
  316. }
  317. }
  318. console.log('checkIndex params',params)
  319. const {data:res} = await receiveOrderList(params)
  320. if (res.code === 200) {
  321. total.value = res.total
  322. orderList.value = res.rows
  323. }
  324. }
  325. </script>
  326. <style lang="scss">
  327. .main {
  328. display: flex;
  329. flex-direction:column;
  330. justify-content:flex-start;
  331. height: 2000px;
  332. width: 1200px;
  333. .nav{
  334. display: flex;
  335. height:140px;
  336. width: 1200px;
  337. // position: sticky;
  338. // top: 0;
  339. }
  340. .body{
  341. display: flex;
  342. height:calc(100% - 100px);
  343. flex-direction:column;
  344. justify-content:flex-start;
  345. .tab-box {
  346. display: flex;
  347. position: sticky;
  348. flex-direction:column;
  349. .tab-bar{
  350. height: 78px;
  351. display: flex;
  352. justify-content:center;
  353. width: 100%;
  354. // border: 1px solid #000;
  355. .tab_item{
  356. display: flex;
  357. flex:1;
  358. justify-content:center;
  359. align-items: center;
  360. font-size: 30px;
  361. background-color: #999;
  362. color: #000;
  363. }
  364. .active{
  365. background-color: #fff!important;
  366. color:#000!important;
  367. }
  368. }
  369. .search-bar{
  370. display: flex;
  371. background-color: #fff;
  372. margin: 8px 10px;
  373. border-radius: 4px;
  374. width: calc(100% - 20px);
  375. .today{
  376. width: 100%;
  377. display: flex;
  378. flex-direction:row;
  379. justify-content: flex-start;
  380. .search{
  381. width: 100%;
  382. margin: 8px 12px;
  383. }
  384. .search-button{
  385. width:100px;
  386. margin: 8px 12px;
  387. font-size: 18px;
  388. }
  389. .refresh {
  390. width:200px;
  391. margin: 8px 12px;
  392. font-size: 18px;
  393. }
  394. }
  395. .history{
  396. display: flex;
  397. width: 100%;
  398. .searchchoice{
  399. padding: 0 20px;
  400. display: flex;
  401. width: 100%;
  402. flex-direction:column;
  403. font-size: 24px;
  404. .row1{
  405. display: flex;
  406. width: 100%;
  407. justify-content:flex-start;
  408. align-items: center;
  409. margin: 10px 0 10px;
  410. // height: 80px;
  411. .timequan{
  412. display: flex;
  413. justify-content:center;
  414. align-items: center;
  415. width:70%;
  416. .time_t{}
  417. }
  418. .office{
  419. display: flex;
  420. margin-left: 60px;
  421. justify-content:center;
  422. align-items: center;
  423. .uni-input{
  424. display: flex;
  425. justify-content:center;
  426. align-items: center;
  427. border:1px solid #e1e5f1;
  428. font-size: 18px;
  429. width:190px;
  430. height: 40px;
  431. border-radius: 5px;
  432. background-color: #e1e5f1;
  433. margin-right: 10px;
  434. }
  435. }
  436. }
  437. .row2{
  438. display: flex;
  439. width: 100%;
  440. justify-content:flex-start;
  441. align-items: center;
  442. margin: 0 0 10px;
  443. .uni-input{
  444. display: flex;
  445. justify-content:center;
  446. align-items: center;
  447. border:1px solid #e1e5f1;
  448. font-size: 18px;
  449. width:100px;
  450. height: 40px;
  451. border-radius: 5px;
  452. background-color: #e1e5f1;
  453. margin-right: 10px;
  454. }
  455. .search{
  456. width: 77%;
  457. }
  458. .search-button{
  459. width:120px;
  460. margin: 8px 12px;
  461. font-size: 16px;
  462. }
  463. }
  464. .row3{
  465. display: flex;
  466. width: 100%;
  467. justify-content:flex-start;
  468. align-items: center;
  469. margin: 0 0 18px;
  470. .tag-view:deep(.uni-tag){
  471. display: inline;
  472. font-size: 20px;
  473. margin-right: 40px;
  474. // height: 40px;
  475. width: 120px;
  476. padding: 6px 20px;
  477. }
  478. }
  479. }
  480. }
  481. }
  482. }
  483. .tab-content{
  484. display: flex;
  485. margin: 8px 10px;
  486. border-radius: 4px;
  487. background-color: #fff;
  488. width: calc(100% - 20px);
  489. height: 100%;
  490. .order-list{
  491. padding: 8px;
  492. display: flex;
  493. width: 100%;
  494. // height: 100%;
  495. .order-list-wrap{
  496. display: flex;
  497. .order-card{
  498. display: flex;
  499. width: 100%;
  500. border-bottom: 1px solid #e6e8ee;;
  501. }
  502. }
  503. }
  504. }
  505. }
  506. }
  507. </style>