index.vue 17 KB

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