index.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674
  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="userInfo.workStatus==='1'?'refresh':'refresh active'">一键释放</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" class="datepick" rangeSeparator=" - " />
  26. <!-- <timeSlot
  27. ref="timeslot"
  28. :title="'选择时间段'"
  29. @confirm="confirmTime">
  30. </timeSlot> -->
  31. <!-- <el-date-picker
  32. v-model="searchTime"
  33. type="datetimerange"
  34. range-separator="-"
  35. start-placeholder="开始时间"
  36. end-placeholder="结束时间"
  37. /> -->
  38. </view>
  39. </view>
  40. <view class="row2">
  41. <view class="office">
  42. <view class="time_t">
  43. 科室:
  44. </view>
  45. <picker @change="handleGetOffice" :value="officeIndex" :range="officeArr">
  46. <view class="uni-input">{{officeArr[officeIndex]}}</view>
  47. </picker>
  48. </view>
  49. <view class="presid">
  50. <picker @change="handleGetType" :value="typeIndex" :range="typeArr">
  51. <view class="uni-input">{{typeArr[typeIndex]}}</view>
  52. </picker>
  53. </view>
  54. <view v-if="typeIndex === 0" class="search">
  55. <uni-easyinput prefixIcon="search" v-model="searchName" placeholder="请输入姓名" />
  56. </view>
  57. <view v-else class="search">
  58. <uni-easyinput prefixIcon="search" v-model="searchPreNo" placeholder="请输入处方号" />
  59. </view>
  60. <button type="primary" @click="handleSearch" class="search-button">搜索</button>
  61. </view>
  62. <view class="row3">
  63. <view class="tag-view" v-for="(v, i) in tags" :key="i">
  64. <uni-tag :circle="true" :inverted="!searchTags.includes(v)" :text=v @click="handleGetTags(v)" />
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. </view>
  70. </view>
  71. <view class="tab-content">
  72. <view class="order-list">
  73. <scroll-view
  74. v-if="orderList.length > 0"
  75. class="order-list-wrap"
  76. scroll-y="true"
  77. :scroll-top="50"
  78. @scrolltoupper="loadPresList"
  79. @scrolltolower="loadMoreList"
  80. >
  81. <template v-for="(v,i) in orderList" :key="i">
  82. <orderCard v-if="v" :v="v" :index="i" :c=tabActive class="order-card"
  83. @update-list="updateList"
  84. />
  85. </template>
  86. </scroll-view>
  87. <view v-else class="text">
  88. <image class="zwsj" aspectFill :src="'/static/zwsj.png'" />
  89. </view>
  90. </view>
  91. <view v-if="isBottom" class="order-bottom">
  92. <view class="text">-- 没有更多数据 --</view>
  93. </view>
  94. </view>
  95. </view>
  96. </view>
  97. </template>
  98. <script setup>
  99. import NavBar from "@/components/nav-bar/nav-bar.vue"
  100. import OrderCard from "@/components/order-card/order-card.vue"
  101. import { onMounted,ref, getCurrentInstance } from 'vue'
  102. import { onLoad } from "@dcloudio/uni-app"
  103. import {receiveOrderList } from "@/static/js/api.js"
  104. import {releaseOrder} from "@/static/js/request.js"
  105. // import { ID_INJECTION_KEY } from 'element-plus'
  106. const userInfo = ref({})
  107. const searchVal = ref('')
  108. const tabList = ref([
  109. {title:"今日待完成", status: 0},
  110. {title:"历史处方", status: 1},
  111. ])
  112. const currentStatus = ref(0)
  113. const tabActive = ref(0) // 当前tab Index
  114. const tabName = ref('今日待完成') // 当前tab Name
  115. // const tags = ref([])
  116. const orderList = ref([
  117. {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'},
  118. {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'},
  119. {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'},
  120. {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'},
  121. {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'}
  122. ])
  123. const isBottom = ref(false) // 是否触底
  124. const officeArr = ref(['全部','中医骨伤科门诊一','中医内科门诊一','中医儿科门诊'])
  125. const officeIndex = ref(0)
  126. const typeArr = ref(['姓名:','处方号:'])
  127. const typeIndex = ref(0)
  128. const searchTime =ref([])
  129. const searchDepartment = ref('')
  130. const searchName = ref('')
  131. const searchPreNo = ref('')
  132. const searchSex = ref('')
  133. const searchPreMzZy = ref('')
  134. const searchStatus = ref('')
  135. const searchTags = ref([])
  136. const tags = ref(['全部','门诊','住院','男','女','煎煮','发药'])
  137. const deployArr = ref([
  138. {name:'抓药', id: '1' },
  139. {name:'复核', id: '2' },
  140. {name:'浸泡', id: '3' },
  141. {name:'煎煮', id: '4' },
  142. {name:'打包', id: '5' },
  143. ])
  144. const page = ref(1)
  145. const total = ref(0)
  146. const pageSize = ref(10)
  147. const status = ref('')
  148. // app.provide(ID_INJECTION_KEY, {
  149. // prefix: Math.floor(Math.random() * 10000),
  150. // current: 0,
  151. // })
  152. const {proxy} = getCurrentInstance()
  153. onMounted(() => {
  154. })
  155. onLoad(async () => {
  156. const token = uni.getStorageSync('token')
  157. userInfo.value.name = uni.getStorageSync('username')
  158. userInfo.value.workStatus = uni.getStorageSync('workStatus') || '0'
  159. const params = {
  160. token: token,
  161. data:JSON.stringify({
  162. currentUserId: parseInt(uni.getStorageSync('userId')) || 0,
  163. page: page.value,
  164. pageSize: pageSize.value,
  165. status: currentStatus.value
  166. })
  167. }
  168. const {data:res} = await receiveOrderList(params)
  169. if (res.code === 200) {
  170. total.value = res.total
  171. orderList.value = res.rows
  172. }
  173. })
  174. // 子传父,更新userInfo
  175. const updateUser = (v)=>{
  176. console.log('updateUserStatus', v)
  177. userInfo.value.workStatus = v
  178. }
  179. const updateList = (v)=>{
  180. console.log('updateList', v)
  181. }
  182. const handleSearch = async()=>{
  183. // const token = uni.getStorageSync('token')
  184. // console.log('handleSearch token',token)
  185. console.log('handleSearch searchVal', searchVal.value)
  186. console.log('currentStatus.value', currentStatus.value)
  187. searchVal.value = searchVal.value.trim()
  188. if(currentStatus.value ===0 && searchVal.value) {
  189. const params = {
  190. token: uni.getStorageSync('token'),
  191. data: JSON.stringify({
  192. currentUserId: parseInt(uni.getStorageSync('userId')) || 0,
  193. name: searchVal.value,
  194. page: page.value,
  195. pageSize: pageSize.value,
  196. status: currentStatus.value
  197. })
  198. }
  199. const {data:res} = await receiveOrderList(params)
  200. if (res.code === 200) {
  201. total.value = res.total
  202. orderList.value = res.rows
  203. }
  204. }
  205. if(currentStatus.value===1){
  206. const params = {
  207. token: uni.getStorageSync('token'),
  208. data: JSON.stringify({
  209. currentUserId: parseInt(uni.getStorageSync('userId')) || 0,
  210. startTime: searchTime.value[0] || '',
  211. endTime: searchTime.value[1] || '',
  212. name: searchVal.value || '',
  213. preNo: searchPreNo.value || '',
  214. prescriptionStatus: searchStatus.value || '',
  215. sex: searchSex.value || '',
  216. preMzZy: searchPreMzZy.value || '',
  217. page: page.value,
  218. pageSize: pageSize.value,
  219. status: currentStatus.value || 0
  220. })
  221. }
  222. console.log('params',params)
  223. const {data:res} = await receiveOrderList(params)
  224. if (res.code === 200) {
  225. total.value = res.total
  226. orderList.value = res.rows
  227. }
  228. }
  229. }
  230. const handleRefresh = async()=>{
  231. console.log('yijianshifang >orderList>>', orderList.value)
  232. let ids = ''
  233. orderList.value.forEach((v)=>{if(v.id){
  234. ids= ids+v.id+','
  235. console.log('yijianshifang >orderList>>',ids)
  236. }})
  237. console.log('yijianshifang >orderList>>666',ids)
  238. const params = {
  239. token: uni.getStorageSync('token'),
  240. data:{ids:ids}
  241. }
  242. const {data:res} = await releaseOrder(params)
  243. if (res.code === 200) {
  244. const paramss = {
  245. token: uni.getStorageSync('token'),
  246. data:JSON.stringify({
  247. currentUserId: parseInt(uni.getStorageSync('userId')),
  248. page: page.value,
  249. pageSize: pageSize.value,
  250. status: currentStatus.value
  251. })
  252. }
  253. const {data:res} = await receiveOrderList(paramss)
  254. if (res.code === 200) {
  255. total.value = res.total
  256. orderList.value = res.rows
  257. }
  258. }
  259. }
  260. const handleGetOffice = (e)=>{
  261. console.log('handleGetOffice', e.detail.value)
  262. console.log('officeIndex', officeIndex)
  263. console.log('officeIndex', officeIndex)
  264. officeIndex.value = e.detail.value
  265. }
  266. const handleGetType = (e)=>{
  267. console.log('handleGetType', e.detail.value)
  268. console.log('typeIndex', typeIndex)
  269. console.log('typeArr', typeIndex)
  270. typeIndex.value = e.detail.value
  271. if(typeIndex.value ===1 ){
  272. searchName.value = ''
  273. } else {
  274. searchPreNo.value = ''
  275. }
  276. }
  277. const handleGetTags = (v)=>{
  278. console.log('handleGetTags', v)
  279. if(!searchTags.value.includes(v)) {
  280. searchTags.value.push(v)
  281. } else {
  282. searchTags.value.splice(searchTags.value.indexOf(v), 1)
  283. }
  284. switch (v) {
  285. case '全部':
  286. if(searchTags.value.includes(v)){
  287. searchTags.value = ['全部']
  288. searchTime.value = []
  289. searchDepartment.value = ''
  290. searchName.value = ''
  291. searchPreNo.value = ''
  292. searchSex.value = ''
  293. searchPreMzZy.value = ''
  294. searchStatus.value = ''
  295. }
  296. break
  297. case '门诊':
  298. if(searchTags.value.includes(v) && searchTags.value.includes('住院')){
  299. searchTags.value.splice(searchTags.value.indexOf('住院'), 1)
  300. }
  301. if(searchTags.value.includes('全部')){
  302. searchTags.value.splice(searchTags.value.indexOf('全部'), 1)
  303. }
  304. searchPreMzZy.value = '1'
  305. break
  306. case '住院':
  307. if(searchTags.value.includes(v) && searchTags.value.includes('门诊')){
  308. searchTags.value.splice(searchTags.value.indexOf('门诊'), 1)
  309. }
  310. if(searchTags.value.includes('全部')){
  311. searchTags.value.splice(searchTags.value.indexOf('全部'), 1)
  312. }
  313. searchPreMzZy.value = '2'
  314. break
  315. case '男':
  316. if(searchTags.value.includes(v) && searchTags.value.includes('女')){
  317. searchTags.value.splice(searchTags.value.indexOf('女'), 1)
  318. }
  319. if(searchTags.value.includes('全部')){
  320. searchTags.value.splice(searchTags.value.indexOf('全部'), 1)
  321. }
  322. searchSex.value = '男'
  323. break
  324. case '女':
  325. if(searchTags.value.includes(v) && searchTags.value.includes('男')){
  326. searchTags.value.splice(searchTags.value.indexOf('男'), 1)
  327. }
  328. if(searchTags.value.includes('全部')){
  329. searchTags.value.splice(searchTags.value.indexOf('全部'), 1)
  330. }
  331. searchSex.value = '女'
  332. break
  333. case '煎煮':
  334. if(searchTags.value.includes(v) && searchTags.value.includes('发药')){
  335. searchTags.value.splice(searchTags.value.indexOf('发药'), 1)
  336. }
  337. if(searchTags.value.includes('全部')){
  338. searchTags.value.splice(searchTags.value.indexOf('全部'), 1)
  339. }
  340. searchStatus.value = '煎煮'
  341. break
  342. case '发药':
  343. if(searchTags.value.includes(v) && searchTags.value.includes('煎煮')){
  344. searchTags.value.splice(searchTags.value.indexOf('煎煮'), 1)
  345. }
  346. if(searchTags.value.includes('全部')){
  347. searchTags.value.splice(searchTags.value.indexOf('全部'), 1)
  348. }
  349. searchStatus.value = '发药'
  350. break
  351. default:
  352. searchTags.value = ['全部']
  353. }
  354. }
  355. // 更新处方列表
  356. const checkIndex = async(index) => {
  357. tabActive.value = index
  358. tabName.value = tabList.value[index].title
  359. currentStatus.value = parseInt(tabList.value[index].status)
  360. const token = uni.getStorageSync('token')
  361. const params = {
  362. token: token,
  363. data: {
  364. status: currentStatus.value,
  365. page: page.value,
  366. pageSize: pageSize.value,
  367. }
  368. }
  369. console.log('checkIndex params',params)
  370. const {data:res} = await receiveOrderList(params)
  371. if (res.code === 200) {
  372. total.value = res.total
  373. orderList.value = res.rows
  374. }
  375. }
  376. const openTime = ()=>{
  377. proxy.$refs.timeslot.open()
  378. }
  379. const loadMoreList =async()=>{
  380. console.log('loadMoreList>>>')
  381. page.value = page.value +1
  382. const params = {
  383. token: uni.getStorageSync('token'),
  384. data: JSON.stringify({
  385. currentUserId: parseInt(uni.getStorageSync('userId')) || 0,
  386. name: searchVal.value,
  387. page: page.value,
  388. pageSize: pageSize.value,
  389. status: currentStatus.value
  390. })
  391. }
  392. const {data:res} = await receiveOrderList(params)
  393. if (res.code === 200) {
  394. total.value = res.total
  395. orderList.value = orderList.value.push(res.rows)
  396. // if (total.value<page.value*pageSize.value){
  397. // isBottom.value= true
  398. // }
  399. }
  400. }
  401. const loadPreList = async()=>{
  402. console.log('loadPreList>>>')
  403. page.value = 1
  404. const params = {
  405. token: uni.getStorageSync('token'),
  406. data: JSON.stringify({
  407. currentUserId: parseInt(uni.getStorageSync('userId')) || 0,
  408. name: searchVal.value,
  409. page: page.value,
  410. pageSize: pageSize.value,
  411. status: currentStatus.value
  412. })
  413. }
  414. const {data:res} = await receiveOrderList(params)
  415. if (res.code === 200) {
  416. total.value = res.total
  417. orderList.value = res.rows
  418. }
  419. }
  420. </script>
  421. <style lang="scss">
  422. .main {
  423. display: flex;
  424. flex-direction:column;
  425. justify-content:flex-start;
  426. // height: 2000px;
  427. width: 750rpx;
  428. .nav{
  429. display: flex;
  430. height:74.34rpx;
  431. width: 750rpx;
  432. // position: sticky;
  433. // top: 0;
  434. }
  435. .body{
  436. display: flex;
  437. height:calc(100% - 74.34rpx);
  438. flex-direction:column;
  439. justify-content:flex-start;
  440. .tab-box {
  441. display: flex;
  442. position: sticky;
  443. flex-direction:column;
  444. z-index: 100;
  445. .tab-bar{
  446. height: 62.5rpx;
  447. display: flex;
  448. justify-content:center;
  449. width: 100%;
  450. // border: 1px solid #000;
  451. .tab_item{
  452. display: flex;
  453. flex:1;
  454. justify-content:center;
  455. align-items: center;
  456. font-size: 17.5rpx;
  457. background-color: #fff;
  458. color: #000;
  459. }
  460. .active{
  461. border-bottom: 5rpx solid #18C7B0;
  462. }
  463. }
  464. .search-bar{
  465. display: flex;
  466. background-color: #fff;
  467. border-radius: 4rpx;
  468. .today{
  469. display: flex;
  470. flex-direction:row;
  471. justify-content: flex-start;
  472. .search{
  473. width: 453.75rpx;
  474. margin: 13.75rpx 10.1rpx;
  475. :deep(.uni-easyinput__placeholder-class){
  476. font-size: 15rpx;
  477. }
  478. }
  479. .search-button{
  480. width:112.5rpx;
  481. margin: 13.75rpx 4rpx;
  482. font-size: 15rpx;
  483. background-color: #18C7B0;
  484. }
  485. .refresh {
  486. display: flex;
  487. justify-content:center;
  488. align-items: center;
  489. width:120rpx;
  490. margin: 13.75px 22.19rpx;
  491. font-size: 15rpx;
  492. background-color: #18C7B0;
  493. }
  494. .active{
  495. background-color:#DEDEDE;
  496. }
  497. }
  498. .history{
  499. display: flex;
  500. width: 100%;
  501. .searchchoice{
  502. padding: 0 10rpx;
  503. display: flex;
  504. width: 100%;
  505. flex-direction:column;
  506. font-size: 24rpx;
  507. .row1{
  508. display: flex;
  509. width: 100%;
  510. justify-content:flex-start;
  511. align-items: center;
  512. margin: 10rpx 0 10rpx;
  513. font-size: 15rpx;
  514. .timequan{
  515. display: flex;
  516. justify-content:center;
  517. align-items: center;
  518. :deep(.uni-date__x-input){
  519. font-size: 15rpx;
  520. }
  521. .datepick {
  522. z-index: 999;
  523. width: 627.5rpx;
  524. }
  525. }
  526. }
  527. .row2{
  528. display: flex;
  529. width: 100%;
  530. justify-content:flex-start;
  531. align-items: center;
  532. margin: 0 0 10rpx;
  533. .office{
  534. display: flex;
  535. justify-content:center;
  536. align-items: center;
  537. font-size: 15rpx;
  538. .uni-input{
  539. display: flex;
  540. justify-content:center;
  541. align-items: center;
  542. border:1px solid #e1e5f1;
  543. font-size: 15rpx;
  544. width:190rpx;
  545. // height: 40rpx;
  546. border-radius: 5rpx;
  547. background-color: #e1e5f1;
  548. margin-right: 10rpx;
  549. }
  550. }
  551. .uni-input{
  552. display: flex;
  553. justify-content:center;
  554. align-items: center;
  555. border:1px solid #e1e5f1;
  556. font-size: 15rpx;
  557. width:100rpx;
  558. height: 40rpx;
  559. border-radius: 5rpx;
  560. background-color: #e1e5f1;
  561. margin-right: 10rpx;
  562. }
  563. .search{
  564. width: 187.5rpx;
  565. :deep(.uni-easyinput__placeholder-class){
  566. font-size: 15rpx;
  567. }
  568. }
  569. .search-button{
  570. width:120rpx;
  571. margin: 8rpx 12rpx;
  572. font-size: 15rpx;
  573. color: #fff;
  574. background-color: #18C7B0;
  575. }
  576. }
  577. .row3{
  578. display: flex;
  579. width: 100%;
  580. justify-content:flex-start;
  581. align-items: center;
  582. margin: 0 0 18rpx;
  583. .tag-view:deep(.uni-tag){
  584. display: inline;
  585. font-size: 15rpx;
  586. margin-right: 16.67rpx;
  587. // height: 40px;
  588. width: 120rpx;
  589. padding: 6rpx 20rpx;
  590. }
  591. }
  592. }
  593. }
  594. }
  595. }
  596. .tab-content{
  597. display: flex;
  598. margin: 8rpx 10rpx;
  599. border-radius: 4rpx;
  600. background-color: #fff;
  601. width: calc(100% - 20rpx);
  602. height: 980rpx;
  603. z-index:10;
  604. .order-list{
  605. padding: 8rpx;
  606. display: flex;
  607. width: 100%;
  608. // height: 100%;
  609. .text{
  610. display: flex;
  611. width: 750rpx;
  612. justify-content:center;
  613. align-items: flex-start;
  614. .zwsj {
  615. margin-top: 103.13rpx;
  616. width: 640.63rpx;
  617. height: 310rpx;
  618. }
  619. }
  620. .order-list-wrap{
  621. display: flex;
  622. .order-card{
  623. display: flex;
  624. width: 100%;
  625. // border-bottom: 1px solid #e6e8ee;;
  626. }
  627. }
  628. }
  629. }
  630. }
  631. }
  632. </style>