index.vue 27 KB

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