index.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991
  1. <template>
  2. <view class="main">
  3. <NavBar :user-info="userInfo" :work-Status="workStatus" @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}}{{tabActive===0 && index==0 && orderList.length>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" v-if="s=='1'" :disabled="workStatus==='1'?false:true" @click="handleRefresh" :class="workStatus==='1'?'refresh':'refresh active'">{{ccc}}</button>
  19. <button type="primary" v-else @click="handleRelease" :class="'refresh'">完成释放</button>
  20. </view>
  21. <view v-else class="history">
  22. <view class="searchchoice">
  23. <view class="row1">
  24. <view class="timequan">
  25. <text class="time_t">时间区间:</text>
  26. <uni-datetime-picker v-model="searchTime[0]" placeholder="开始时间" type="datetime" :hide-second="true" class="datepick"/>
  27. <uni-datetime-picker v-model="searchTime[1]" placeholder="结束时间" type="datetime" :hide-second="true" class="datepick"/>
  28. <!-- <timeSlot
  29. ref="timeslot"
  30. :title="'选择时间段'"
  31. @confirm="confirmTime">
  32. </timeSlot> -->
  33. <!-- <el-date-picker
  34. v-model="searchTime"
  35. type="datetimerange"
  36. range-separator="-"
  37. start-placeholder="开始时间"
  38. end-placeholder="结束时间"
  39. /> -->
  40. </view>
  41. </view>
  42. <view class="row2">
  43. <view class="office">
  44. <view class="time_t">
  45. 科室:
  46. </view>
  47. <picker @change="handleGetOffice" placeholder="请选择" :value="officeIndex" :range="officeArr">
  48. <view class="uni-input">{{officeArr[officeIndex]}}</view>
  49. </picker>
  50. </view>
  51. <view class="presid">
  52. <picker @change="handleGetType" :value="typeIndex" :range="typeArr">
  53. <view class="uni-input">{{typeArr[typeIndex]}}</view>
  54. </picker>
  55. </view>
  56. <view v-if="typeIndex === 0" class="search">
  57. <uni-easyinput prefixIcon="search" v-model="searchName" placeholder="请输入姓名" />
  58. </view>
  59. <view v-else class="search">
  60. <uni-easyinput prefixIcon="search" v-model="searchPreNo" placeholder="请输入处方号" />
  61. </view>
  62. <button type="primary" @click="handleSearch" class="search-button">搜索</button>
  63. </view>
  64. <view class="row3">
  65. <view class="tag-view" v-for="(v, i) in tags" :key="i">
  66. <uni-tag :circle="true" :inverted="!searchTags.includes(v)" :text=v @click="handleGetTags(v)" />
  67. </view>
  68. </view>
  69. </view>
  70. </view>
  71. </view>
  72. </view>
  73. <view class="tab-content">
  74. <view class="order-list">
  75. <scroll-view
  76. v-if="orderList.length > 0"
  77. class="order-list-wrap"
  78. scroll-y="true"
  79. :scroll-top="0"
  80. refresher-enabled="true"
  81. :refresher-triggered="trigger"
  82. @refresherrefresh="loadPreList"
  83. @scrolltolower="loadMoreList"
  84. >
  85. <!-- @scrolltoupper="loadPreList" -->
  86. <template v-for="(v,i) in orderList" :key="i">
  87. <orderCard v-if="v " :s="s" :v="v" :work-Status="workStatus" :c="tabActive"
  88. @emit-select="emitSelect"
  89. />
  90. </template>
  91. <view v-if="isBottom" class="order-bottom">
  92. <view class="text">-- 没有更多数据 --</view>
  93. </view>
  94. </scroll-view>
  95. <view v-else class="text">
  96. <image class="zwsj" aspectFill :src="'/static/zwsj.png'" />
  97. </view>
  98. </view>
  99. </view>
  100. </view>
  101. </view>
  102. </template>
  103. <script setup>
  104. import NavBar from "@/components/nav-bar/nav-bar.vue"
  105. import OrderCard from "@/components/order-card/order-card.vue"
  106. import { onMounted,ref, getCurrentInstance } from 'vue'
  107. import { onLoad, onPullDownRefresh } from "@dcloudio/uni-app"
  108. import {receiveOrderList, selectDepartment, getIp } from "@/static/js/api.js"
  109. import {releaseOrder} from "@/static/js/request.js"
  110. import debounce from 'lodash.debounce'
  111. // import { ID_INJECTION_KEY } from 'element-plus'
  112. const trigger = ref(false)
  113. const userInfo = ref({})
  114. const workStatus = ref('0')
  115. const tabList = ref([
  116. {title:"今日待完成", status: '0', leng:0},
  117. {title:"历史处方", status: '1'},
  118. ])
  119. const currentStatus = ref(0)
  120. const tabActive = ref(0) // 当前tab Index
  121. const tabName = ref('今日待完成') // 当前tab Name
  122. // const tags = ref([])
  123. const orderList = ref([
  124. // {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'},
  125. // {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'},
  126. // {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'},
  127. // {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'},
  128. // {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'}
  129. ])
  130. const isBottom = ref(false) // 是否触底
  131. const officeArr = ref(['全部'])
  132. const officeIndex = ref(0)
  133. const typeArr = ref(['姓名:','处方号:'])
  134. const typeIndex = ref(0)
  135. const searchVal = ref('')
  136. const searchTime =ref([])
  137. const searchDepartment = ref('')
  138. const searchName = ref('')
  139. const searchPreNo = ref('')
  140. const searchSex = ref('')
  141. const searchPreMzZy = ref('')
  142. const searchStatus = ref('')
  143. const searchTags = ref([])
  144. const tags = ref(['全部','门诊','住院','男','女','煎煮','发药'])
  145. const deployArr = ref([
  146. {name:'抓药', id: '1' },
  147. {name:'复核', id: '2' },
  148. {name:'浸泡', id: '3' },
  149. {name:'煎煮', id: '4' },
  150. {name:'打包', id: '5' },
  151. ])
  152. const page = ref(1)
  153. const pageSize = ref(10)
  154. const total = ref(0)
  155. const status = ref('')
  156. const s = ref('1')
  157. const ccc = ref('一键释放')
  158. const ids = ref([])
  159. const today =ref({
  160. leng: 0,
  161. })
  162. const plug= uni.requireNativePlugin('Html5app-Gprinter')
  163. // app.provide(ID_INJECTION_KEY, {
  164. // prefix: Math.floor(Math.random() * 10000),
  165. // current: 0,
  166. // })
  167. const {proxy} = getCurrentInstance()
  168. // 进入index页面,首先获取ip和port,然后连接打印机
  169. onMounted(async() => {
  170. // userInfo.value.username = uni.getStorageSync('userId')
  171. // userInfo.value.password = uni.getStorageSync('password')
  172. // 获取ip,port
  173. console.log('获取ip,port>>>>>>',uni.getStorageSync('userId'))
  174. const {data: res} = await getIp({
  175. token:uni.getStorageSync('token'),
  176. data:JSON.stringify({
  177. userId: uni.getStorageSync('userId')+''
  178. })
  179. })
  180. if(res.code === 200){
  181. userInfo.value.ip = res.data.ip || ''
  182. userInfo.value.port = res.data.port || ''
  183. console.log('userInfo.value', userInfo.value)
  184. const ipReg = /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/
  185. if(ipReg.test(userInfo.value.ip)){
  186. if(RegExp.$1<256 && RegExp.$2<256 && RegExp.$3<256 && RegExp.$4<256){
  187. plug.connectIP({"ip":userInfo.value.ip,"port":userInfo.value.port},ret=>{
  188. console.log('connectPrint>>ret',ret)
  189. const res = JSON.parse(JSON.stringify(ret))
  190. console.log('connectPrint>>res',res.code)
  191. if(res.code==3){
  192. // initPrint.value = true
  193. uni.setStorageSync('hasPrinter', '1')
  194. uni.setStorageSync('printerIp', userInfo.value.ip)
  195. console.log('已经连接打印机:',userInfo.value.ip)
  196. // _this.tip=JSON.stringify(ret);
  197. // console.log(_this.tip);
  198. // 关闭配置页操作
  199. }
  200. })
  201. }
  202. }
  203. }
  204. })
  205. onLoad(async () => {
  206. const token = uni.getStorageSync('token')
  207. userInfo.value.name = uni.getStorageSync('username')
  208. workStatus.value = uni.getStorageSync('workStatus') || '0'
  209. const params = {
  210. token: token,
  211. data:JSON.stringify({
  212. currentUserId: parseInt(uni.getStorageSync('userId')) || 0,
  213. pageNum: page.value,
  214. pageSize: pageSize.value,
  215. status: '0'
  216. })
  217. }
  218. const {data:res} = await receiveOrderList(params)
  219. if (res.code === 200) {
  220. total.value = res.total
  221. orderList.value = res.rows
  222. if(total.value == orderList.value.length){
  223. isBottom.value = true
  224. } else {
  225. isBottom.value = false
  226. }
  227. if(tabActive.value ==0){
  228. tabList.value[0].leng = orderList.value.length
  229. }
  230. }
  231. })
  232. const reset = ()=>{
  233. searchTime.value =[]
  234. officeIndex.value =0
  235. searchName.value =''
  236. searchPreNo.value =''
  237. searchSex.value =''
  238. searchPreMzZy.value =''
  239. searchStatus.value =''
  240. searchVal.value = ''
  241. officeArr.value = ['全部']
  242. }
  243. // 子传父,更新userInfo
  244. const updateUser = (v)=>{
  245. console.log('updateUserStatus', v)
  246. workStatus.value = v+''
  247. console.log('workStatus.value', workStatus.value)
  248. }
  249. const emitSelect = (v)=>{
  250. console.log('emitSelect', v)
  251. const index1 = orderList.value.findIndex(x=>x.id==v.id)
  252. if (index1>-1){
  253. orderList.value[index1].selected = v.selected
  254. }
  255. // 查在ids中查找v,如果存在就删除,如果不存在就添加
  256. const index = ids.value.findIndex(x=>x==v.id)
  257. if (index>-1){
  258. ids.value.splice(index, 1)
  259. } else {
  260. ids.value.push(v.id)
  261. }
  262. }
  263. const handleSearch = debounce(async()=>{
  264. console.log('handleSearch searchPreMzZy',searchPreMzZy.value)
  265. console.log('handleSearch searchStatus',searchStatus.value)
  266. console.log('handleSearch searchSex',searchSex.value)
  267. if(tabActive.value ===0) {
  268. const params = {
  269. token: uni.getStorageSync('token'),
  270. data: JSON.stringify({
  271. currentUserId: parseInt(uni.getStorageSync('userId')) || 0,
  272. name: searchVal.value.trim(),
  273. pageNum: page.value,
  274. pageSize: pageSize.value,
  275. status: tabList.value[tabActive.value].status,
  276. })
  277. }
  278. const {data:res} = await receiveOrderList(params)
  279. if (res.code === 200) {
  280. total.value = res.total
  281. orderList.value = res.rows
  282. if(total.value == orderList.value.length){
  283. isBottom.value = true
  284. } else {
  285. isBottom.value = false
  286. }
  287. }
  288. }
  289. if(tabActive.value==1){
  290. const params = {
  291. token: uni.getStorageSync('token'),
  292. data: JSON.stringify({
  293. currentUserId: parseInt(uni.getStorageSync('userId')) || 0,
  294. startTime: searchTime.value[0] || '',
  295. endTime: searchTime.value[1] || '',
  296. name: searchName.value.trim() || '',
  297. preNo: searchPreNo.value || '',
  298. department: searchDepartment.value || '',
  299. prescriptionStatus: searchStatus.value || '',//煎煮发药
  300. sex: searchSex.value || '',
  301. preMzZy: searchPreMzZy.value || '',//门诊住院
  302. pageNum: page.value,
  303. pageSize: pageSize.value,
  304. status: tabList.value[tabActive.value].status
  305. })
  306. }
  307. console.log('历史记录查询params',params)
  308. const {data:res} = await receiveOrderList(params)
  309. if (res.code === 200) {
  310. total.value = res.total
  311. orderList.value = res.rows
  312. if(total.value == orderList.value.length){
  313. isBottom.value = true
  314. } else {
  315. isBottom.value = false
  316. }
  317. if(tabActive.value ==0){
  318. tabList.value[0].leng = orderList.value.length
  319. }
  320. }
  321. }
  322. },500)
  323. const handleRefresh = async()=>{
  324. console.log('yijianshifang >orderList>>', orderList.value)
  325. // let ids = ''
  326. // orderList.value.forEach((v)=>{if(v.id){
  327. // ids= ids+v.id+','
  328. // console.log('yijianshifang >orderList>>',ids)
  329. // }})
  330. // console.log('yijianshifang >orderList>>666',ids)
  331. const params = {
  332. token: uni.getStorageSync('token'),
  333. data: JSON.stringify({
  334. currentUserId: parseInt(uni.getStorageSync('userId')) || 0,
  335. name: searchVal.value.trim(),
  336. pageNum: page.value,
  337. pageSize: pageSize.value,
  338. status: tabList.value[tabActive.value].status,
  339. })
  340. }
  341. const {data:res} = await receiveOrderList(params)
  342. if (res.code === 200) {
  343. total.value = res.total
  344. orderList.value = res.rows
  345. if(total.value == orderList.value.length){
  346. isBottom.value = true
  347. } else {
  348. isBottom.value = false
  349. }
  350. }
  351. s.value = '0'
  352. console.log('handleRefresh>>ids.value ',ids.value)
  353. ids.value = []
  354. orderList.value.forEach((x,i)=>{
  355. orderList.value[i].selected = false
  356. })
  357. console.log('yijianshifang >orderList>>forEach', orderList.value)
  358. // ccc.value = '完成'
  359. // const params = {
  360. // token: uni.getStorageSync('token'),
  361. // data:{ids:ids.value.toString()}
  362. // }
  363. // console.log('handleRefresh >params>>666',params)
  364. // const {data:res} = await releaseOrder(params)
  365. // if (res.code === 200) {
  366. // if(ids.value.length>0){
  367. // console.log('ids.value',ids.value)
  368. // ids.value.forEach(x=>{
  369. // console.log('orderList',orderList.value)
  370. // const index = orderList.value.findIndex(y=>y.id == x)
  371. // console.log('orderList index',index)
  372. // if(index>-1){
  373. // console.log('orderList',orderList.value)
  374. // orderList.value.splice(index,1)
  375. // console.log('orderList',orderList.value)
  376. // }
  377. // })
  378. // ids.value = []
  379. // }
  380. // }
  381. }
  382. const handleRelease = async()=>{
  383. console.log('ids.value.length',ids.value.length)
  384. const params = {
  385. token: uni.getStorageSync('token'),
  386. data:{ids:ids.value.toString()}
  387. }
  388. console.log('handleRefresh >params>>666',params)
  389. const {data:res} = await releaseOrder(params)
  390. if (res.code === 200) {
  391. console.log('after releaseOrder ids.value',ids.value)
  392. uni.$showMsg(res.msg, 2000)
  393. }
  394. if(ids.value.length==0){
  395. uni.$showMsg('尚未释放处方',2000)
  396. s.value = '1'
  397. return
  398. } else {
  399. uni.$showMsg(res.msg, 2000)
  400. }
  401. ids.value = []
  402. const paramss = {
  403. token: uni.getStorageSync('token'),
  404. data:JSON.stringify({
  405. currentUserId: parseInt(uni.getStorageSync('userId')),
  406. pageNum: page.value,
  407. pageSize: pageSize.value,
  408. status: tabList.value[tabActive.value].status
  409. })
  410. }
  411. console.log('refresh orderList checkIndex params',paramss)
  412. const {data:ress} = await receiveOrderList(paramss)
  413. if (ress.code === 200) {
  414. total.value = ress.total
  415. orderList.value = ress.rows
  416. if(total.value == orderList.value.length){
  417. isBottom.value = true
  418. } else {
  419. isBottom.value = false
  420. }
  421. if(tabActive.value ==0){
  422. tabList.value[0].leng = orderList.value.length
  423. }
  424. }
  425. s.value = '1'
  426. console.log('after refresh orderList handleRelease ids.value', ids.value)
  427. }
  428. const handleGetOffice = (e)=>{
  429. console.log('handleGetOffice', e.detail.value)
  430. console.log('officeIndex', officeIndex)
  431. console.log('officeIndex', officeIndex)
  432. if(e.detail.value==0){
  433. searchDepartment.value = ''
  434. officeIndex.value = e.detail.value
  435. } else {
  436. officeIndex.value = e.detail.value
  437. searchDepartment.value = officeArr.value[officeIndex.value]
  438. }
  439. }
  440. const handleGetType = (e)=>{
  441. console.log('handleGetType', e.detail.value)
  442. console.log('typeIndex', typeIndex)
  443. console.log('typeArr', typeIndex)
  444. typeIndex.value = e.detail.value
  445. if(typeIndex.value ===1 ){
  446. searchName.value = ''
  447. } else {
  448. searchPreNo.value = ''
  449. }
  450. }
  451. const handleGetTags = (v)=>{
  452. console.log('handleGetTags', v)
  453. if(!searchTags.value.includes(v)) {
  454. searchTags.value.push(v)
  455. } else {
  456. searchTags.value.splice(searchTags.value.indexOf(v), 1)
  457. if(v=='门诊' || v=='住院'){
  458. searchPreMzZy.value = ''
  459. console.log('删除了 v searchPreMzZy.value',v,searchPreMzZy.value)
  460. }
  461. if(v=='男' || v=='女'){
  462. searchSex.value = ''
  463. console.log('删除了 v searchSex.value',v,searchSex.value)
  464. }
  465. if(v=='煎煮' || v=='发药'){
  466. searchStatus.value = ''
  467. console.log('删除了 v searchStatus.value',v,searchStatus.value)
  468. }
  469. }
  470. switch (v) {
  471. case '全部':
  472. if(searchTags.value.includes(v)){
  473. searchTags.value = ['全部']
  474. searchTime.value = []
  475. searchDepartment.value = ''
  476. searchName.value = ''
  477. searchPreNo.value = ''
  478. searchSex.value = ''
  479. searchPreMzZy.value = ''
  480. searchStatus.value = ''
  481. officeIndex.value = 0
  482. }
  483. break
  484. case '门诊':
  485. if(searchTags.value.includes(v)){
  486. if(searchTags.value.includes('住院')){
  487. searchTags.value.splice(searchTags.value.indexOf('住院'), 1)
  488. }
  489. if(searchTags.value.includes('全部')){
  490. searchTags.value.splice(searchTags.value.indexOf('全部'), 1)
  491. }
  492. searchPreMzZy.value = '1'
  493. }
  494. break
  495. case '住院':
  496. if(searchTags.value.includes(v)){
  497. if(searchTags.value.includes('门诊')){
  498. searchTags.value.splice(searchTags.value.indexOf('门诊'), 1)
  499. }
  500. if(searchTags.value.includes('全部')){
  501. searchTags.value.splice(searchTags.value.indexOf('全部'), 1)
  502. }
  503. searchPreMzZy.value = '2'
  504. }
  505. break
  506. case '男':
  507. if(searchTags.value.includes(v)){
  508. if(searchTags.value.includes('女')){
  509. searchTags.value.splice(searchTags.value.indexOf('女'), 1)
  510. }
  511. if(searchTags.value.includes('全部')){
  512. searchTags.value.splice(searchTags.value.indexOf('全部'), 1)
  513. }
  514. searchSex.value = '男'
  515. }
  516. break
  517. case '女':
  518. if(searchTags.value.includes(v)){
  519. if(searchTags.value.includes('男')){
  520. searchTags.value.splice(searchTags.value.indexOf('男'), 1)
  521. }
  522. if(searchTags.value.includes('全部')){
  523. searchTags.value.splice(searchTags.value.indexOf('全部'), 1)
  524. }
  525. searchSex.value = '女'
  526. }
  527. break
  528. case '煎煮':
  529. if(searchTags.value.includes(v)){
  530. if(searchTags.value.includes('发药')){
  531. searchTags.value.splice(searchTags.value.indexOf('发药'), 1)
  532. }
  533. if(searchTags.value.includes('全部')){
  534. searchTags.value.splice(searchTags.value.indexOf('全部'), 1)
  535. }
  536. searchStatus.value = '2'
  537. }
  538. break
  539. case '发药':
  540. if(searchTags.value.includes(v)){
  541. if(searchTags.value.includes('煎煮')){
  542. searchTags.value.splice(searchTags.value.indexOf('煎煮'), 1)
  543. }
  544. if(searchTags.value.includes('全部')){
  545. searchTags.value.splice(searchTags.value.indexOf('全部'), 1)
  546. }
  547. searchStatus.value = '3'
  548. }
  549. break
  550. default:
  551. searchTags.value = ['全部']
  552. }
  553. }
  554. // 更新处方列表
  555. const checkIndex = async(index) => {
  556. tabActive.value = index
  557. page.value= 1
  558. console.log('index',index)
  559. ids.value = []
  560. reset()
  561. tabName.value = tabList.value[index].title
  562. currentStatus.value = parseInt(tabList.value[index].status)
  563. const token = uni.getStorageSync('token')
  564. const paramss = {
  565. token: uni.getStorageSync('token'),
  566. data:JSON.stringify({
  567. currentUserId: parseInt(uni.getStorageSync('userId')),
  568. pageNum: page.value,
  569. pageSize: pageSize.value,
  570. status: tabList.value[tabActive.value].status
  571. })
  572. }
  573. console.log('checkIndex params',paramss)
  574. const {data:res} = await receiveOrderList(paramss)
  575. if (res.code === 200) {
  576. total.value = res.total
  577. orderList.value = res.rows
  578. if(total.value == orderList.value.length){
  579. isBottom.value = true
  580. } else {
  581. isBottom.value = false
  582. }
  583. if(tabActive.value ==0){
  584. tabList.value[0].leng = orderList.value.length
  585. }
  586. }
  587. if(tabActive.value==1) {
  588. const param = {
  589. token: uni.getStorageSync('token'),
  590. // data:JSON.stringify({
  591. // currentUserId: parseInt(uni.getStorageSync('userId')),
  592. // page: page.value,
  593. // pageSize: pageSize.value,
  594. // status: tabList.value[tabActive.value].status
  595. // })
  596. }
  597. console.log('checkIndex param',param)
  598. const {data:res} = await selectDepartment(param)
  599. if (res.code === 200) {
  600. officeArr.value.push(...res.data)
  601. console.log('selectDepartment officeArr.value', officeArr.value)
  602. }
  603. }
  604. }
  605. const loadMoreList = async()=>{
  606. // if(s.value=='0'){
  607. // console.log('一键释放模式中,不需要加载更多')
  608. // return
  609. // }
  610. console.log('loadMoreList>>>')
  611. if(isBottom.value){
  612. return
  613. }
  614. page.value = page.value +1
  615. const params = {
  616. token: uni.getStorageSync('token'),
  617. data: JSON.stringify({
  618. currentUserId: parseInt(uni.getStorageSync('userId')) || 0,
  619. startTime: searchTime.value[0] || '',
  620. endTime: searchTime.value[1] || '',
  621. name: searchName.value.trim() || '',
  622. preNo: searchPreNo.value || '',
  623. department: searchDepartment.value || '',
  624. prescriptionStatus: searchStatus.value || '',//煎煮发药
  625. sex: searchSex.value || '',
  626. preMzZy: searchPreMzZy.value || '',//门诊住院
  627. pageNum: page.value,
  628. pageSize: pageSize.value,
  629. status: tabList.value[tabActive.value].status
  630. })
  631. }
  632. const {data:res} = await receiveOrderList(params)
  633. console.log('orderList.value before',orderList.value)
  634. if (res.code === 200) {
  635. total.value = res.total
  636. console.log('res.rows after',res.rows)
  637. // res.rows.forEach(item=>{
  638. // orderList.value.push(item)
  639. // })
  640. orderList.value.push(...res.rows)
  641. console.log('orderList.value after',orderList.value)
  642. if(total.value == orderList.value.length){
  643. isBottom.value = true
  644. } else {
  645. isBottom.value = false
  646. }
  647. if(tabActive.value ==0){
  648. console.log('tabActive===',)
  649. tabList.value[0].leng = orderList.value.length
  650. }
  651. }
  652. }
  653. const loadPreList = async()=>{
  654. console.log('loadPreList>>>')
  655. // if(s.value=='0'){
  656. // console.log('一键释放模式中,不需要刷新')
  657. // return
  658. // }
  659. trigger.value = true;
  660. page.value = 1
  661. const params = {
  662. token: uni.getStorageSync('token'),
  663. data: JSON.stringify({
  664. currentUserId: parseInt(uni.getStorageSync('userId')) || 0,
  665. startTime: searchTime.value[0] || '',
  666. endTime: searchTime.value[1] || '',
  667. name: searchName.value.trim() || '',
  668. preNo: searchPreNo.value || '',
  669. department: searchDepartment.value || '',
  670. prescriptionStatus: searchStatus.value || '',//煎煮发药
  671. sex: searchSex.value || '',
  672. preMzZy: searchPreMzZy.value || '',//门诊住院
  673. pageNum: page.value,
  674. pageSize: pageSize.value,
  675. status: tabList.value[tabActive.value].status
  676. })
  677. }
  678. const {data:res} = await receiveOrderList(params)
  679. if (res.code === 200) {
  680. total.value = res.total
  681. orderList.value = res.rows
  682. if(orderList.value.length < pageSize.value){
  683. isBottom.value = true
  684. } else {
  685. isBottom.value = false
  686. }
  687. if(tabActive ==0){
  688. tabList.value[0].leng = orderList.value.length
  689. }
  690. }
  691. setTimeout(() => {
  692. trigger.value = false;
  693. }, 1000)
  694. }
  695. </script>
  696. <style lang="scss">
  697. .main {
  698. display: flex;
  699. flex-direction:column;
  700. justify-content:flex-start;
  701. // height: 2000px;
  702. width: 750rpx;
  703. .nav{
  704. display: flex;
  705. height:74.34rpx;
  706. width: 750rpx;
  707. // position: sticky;
  708. // top: 0;
  709. }
  710. .body{
  711. display: flex;
  712. height:calc(100% - 74.34rpx);
  713. flex-direction:column;
  714. justify-content:flex-start;
  715. .tab-box {
  716. display: flex;
  717. position: sticky;
  718. flex-direction:column;
  719. z-index: 100;
  720. .tab-bar{
  721. height: 62.5rpx;
  722. display: flex;
  723. justify-content:center;
  724. width: 100%;
  725. // border: 1px solid #000;
  726. .tab_item{
  727. display: flex;
  728. flex:1;
  729. justify-content:center;
  730. align-items: center;
  731. font-size: 17.5rpx;
  732. background-color: #fff;
  733. color: #000;
  734. }
  735. .active{
  736. border-bottom: 5rpx solid #18C7B0;
  737. }
  738. }
  739. .search-bar{
  740. display: flex;
  741. background-color: #fff;
  742. border-radius: 4rpx;
  743. .today{
  744. display: flex;
  745. flex-direction:row;
  746. justify-content: flex-start;
  747. .search{
  748. width: 453.75rpx;
  749. margin: 13.75rpx 10.1rpx;
  750. :deep(.uni-easyinput__placeholder-class){
  751. font-size: 15rpx;
  752. }
  753. }
  754. .search-button{
  755. display: flex;
  756. justify-content:center;
  757. align-items: center;
  758. width:112.5rpx;
  759. margin: 13.75rpx 10.1rpx;
  760. font-size: 15rpx;
  761. background-color: #18C7B0;
  762. }
  763. .refresh {
  764. display: flex;
  765. justify-content:center;
  766. align-items: center;
  767. width:120rpx;
  768. margin: 13.75px 8rpx;
  769. font-size: 15rpx;
  770. background-color: #18C7B0;
  771. }
  772. .active{
  773. background-color:#DEDEDE;
  774. }
  775. }
  776. .history{
  777. display: flex;
  778. width: 100%;
  779. .searchchoice{
  780. padding: 0 10rpx;
  781. display: flex;
  782. width: 100%;
  783. flex-direction:column;
  784. font-size: 24rpx;
  785. .row1{
  786. display: flex;
  787. width: 100%;
  788. justify-content:flex-start;
  789. align-items: center;
  790. margin: 10rpx 0 10rpx;
  791. font-size: 15rpx;
  792. .timequan{
  793. display: flex;
  794. justify-content:center;
  795. align-items: center;
  796. :deep(.uni-date__x-input){
  797. font-size: 15rpx;
  798. }
  799. .datepick {
  800. z-index: 999;
  801. width: 300rpx;
  802. margin:0 10rpx;
  803. }
  804. }
  805. }
  806. .row2{
  807. display: flex;
  808. width: 100%;
  809. justify-content:flex-start;
  810. align-items: center;
  811. margin: 0 0 10rpx;
  812. .office{
  813. display: flex;
  814. justify-content:center;
  815. align-items: center;
  816. font-size: 15rpx;
  817. .uni-input{
  818. display: flex;
  819. justify-content:center;
  820. align-items: center;
  821. border:1px solid #e1e5f1;
  822. // font-size: 15rpx;
  823. width:190rpx;
  824. // height: 40rpx;
  825. border-radius: 5rpx;
  826. background-color: #e1e5f1;
  827. margin-right: 10rpx;
  828. }
  829. }
  830. .uni-input{
  831. display: flex;
  832. justify-content:center;
  833. align-items: center;
  834. border:1px solid #e1e5f1;
  835. font-size: 15rpx;
  836. width:100rpx;
  837. height: 40rpx;
  838. border-radius: 5rpx;
  839. background-color: #e1e5f1;
  840. margin-right: 10rpx;
  841. }
  842. .search{
  843. width: 187.5rpx;
  844. // height: 40rpx;
  845. // :deep(.easyinput__content-input){
  846. // // height: 40rpx!important;
  847. // }
  848. :deep(.uni-easyinput__placeholder-class){
  849. font-size: 14rpx;
  850. }
  851. }
  852. .search-button{
  853. display: flex;
  854. justify-content:center;
  855. align-items: center;
  856. width:120rpx;
  857. margin: 8rpx 12rpx;
  858. font-size: 14rpx;
  859. height: 40rpx!important;
  860. color: #fff;
  861. background-color: #18C7B0;
  862. }
  863. }
  864. .row3{
  865. display: flex;
  866. width: 100%;
  867. justify-content:flex-start;
  868. align-items: center;
  869. margin: 0 0 18rpx;
  870. .tag-view:deep(.uni-tag){
  871. display: inline;
  872. font-size: 15rpx;
  873. font-weight:500;
  874. margin-right: 16.67rpx;
  875. // height: 40px;
  876. width: 120rpx;
  877. padding: 6rpx 20rpx;
  878. }
  879. }
  880. }
  881. }
  882. }
  883. }
  884. .tab-content{
  885. display: flex;
  886. margin: 8rpx 10rpx;
  887. border-radius: 4rpx;
  888. background-color: #fff;
  889. width: calc(100% - 20rpx);
  890. height: 980rpx;
  891. z-index:10;
  892. .order-list{
  893. padding: 8rpx;
  894. display: flex;
  895. width: 100%;
  896. // height: 100%;
  897. .text{
  898. display: flex;
  899. width: 750rpx;
  900. justify-content:center;
  901. align-items: flex-start;
  902. .zwsj {
  903. margin-top: 103.13rpx;
  904. width: 640.63rpx;
  905. height: 310rpx;
  906. }
  907. }
  908. .order-list-wrap{
  909. display: flex;
  910. .order-card{
  911. display: flex;
  912. width: 100%;
  913. // border-bottom: 1px solid #e6e8ee;;
  914. }
  915. }
  916. }
  917. }
  918. }
  919. }
  920. </style>