index.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002
  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. 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. }
  241. }
  242. })
  243. const reset = ()=>{
  244. searchTime.value =[]
  245. officeIndex.value =0
  246. searchName.value =''
  247. searchPreNo.value =''
  248. searchSex.value =''
  249. searchPreMzZy.value =''
  250. searchStatus.value =''
  251. searchVal.value = ''
  252. officeArr.value = ['全部']
  253. }
  254. // 子传父,更新userInfo
  255. const updateUser = (v)=>{
  256. console.log('updateUserStatus', v)
  257. workStatus.value = v+''
  258. console.log('workStatus.value', workStatus.value)
  259. }
  260. const emitSelect = (v)=>{
  261. console.log('emitSelect', v)
  262. const index1 = orderList.value.findIndex(x=>x.id==v.id)
  263. if (index1>-1){
  264. orderList.value[index1].selected = v.selected
  265. }
  266. // 查在ids中查找v,如果存在就删除,如果不存在就添加
  267. const index = ids.value.findIndex(x=>x==v.id)
  268. if (index>-1){
  269. ids.value.splice(index, 1)
  270. } else {
  271. ids.value.push(v.id)
  272. }
  273. }
  274. const handleSearch = debounce(async()=>{
  275. console.log('handleSearch searchPreMzZy',searchPreMzZy.value)
  276. console.log('handleSearch searchStatus',searchStatus.value)
  277. console.log('handleSearch searchSex',searchSex.value)
  278. if(tabActive.value ===0) {
  279. const params = {
  280. token: uni.getStorageSync('token'),
  281. data: JSON.stringify({
  282. currentUserId: parseInt(uni.getStorageSync('userId')) || 0,
  283. name: searchVal.value.trim(),
  284. pageNum: page.value,
  285. pageSize: pageSize.value,
  286. status: tabList.value[tabActive.value].status,
  287. })
  288. }
  289. const {data:res} = await receiveOrderList(params)
  290. if (res.code === 200) {
  291. total.value = res.total
  292. orderList.value = res.rows
  293. if(total.value == orderList.value.length){
  294. isBottom.value = true
  295. } else {
  296. isBottom.value = false
  297. }
  298. }
  299. }
  300. if(tabActive.value==1){
  301. const params = {
  302. token: uni.getStorageSync('token'),
  303. data: JSON.stringify({
  304. currentUserId: parseInt(uni.getStorageSync('userId')) || 0,
  305. startTime: searchTime.value[0] || '',
  306. endTime: searchTime.value[1] || '',
  307. name: searchName.value.trim() || '',
  308. preNo: searchPreNo.value || '',
  309. department: searchDepartment.value || '',
  310. prescriptionStatus: searchStatus.value || '',//煎煮发药
  311. sex: searchSex.value || '',
  312. preMzZy: searchPreMzZy.value || '',//门诊住院
  313. pageNum: page.value,
  314. pageSize: pageSize.value,
  315. status: tabList.value[tabActive.value].status
  316. })
  317. }
  318. console.log('历史记录查询params',params)
  319. const {data:res} = await receiveOrderList(params)
  320. if (res.code === 200) {
  321. total.value = res.total
  322. orderList.value = res.rows
  323. if(total.value == orderList.value.length){
  324. isBottom.value = true
  325. } else {
  326. isBottom.value = false
  327. }
  328. if(tabActive.value ==0){
  329. tabList.value[0].leng = orderList.value.length
  330. }
  331. }
  332. }
  333. },500)
  334. const handleRefresh = async()=>{
  335. console.log('yijianshifang >orderList>>', orderList.value)
  336. // let ids = ''
  337. // orderList.value.forEach((v)=>{if(v.id){
  338. // ids= ids+v.id+','
  339. // console.log('yijianshifang >orderList>>',ids)
  340. // }})
  341. // console.log('yijianshifang >orderList>>666',ids)
  342. const params = {
  343. token: uni.getStorageSync('token'),
  344. data: JSON.stringify({
  345. currentUserId: parseInt(uni.getStorageSync('userId')) || 0,
  346. name: searchVal.value.trim(),
  347. pageNum: page.value,
  348. pageSize: pageSize.value,
  349. status: tabList.value[tabActive.value].status,
  350. })
  351. }
  352. const {data:res} = await receiveOrderList(params)
  353. if (res.code === 200) {
  354. total.value = res.total
  355. orderList.value = res.rows
  356. if(total.value == orderList.value.length){
  357. isBottom.value = true
  358. } else {
  359. isBottom.value = false
  360. }
  361. }
  362. s.value = '0'
  363. console.log('handleRefresh>>ids.value ',ids.value)
  364. ids.value = []
  365. orderList.value.forEach((x,i)=>{
  366. orderList.value[i].selected = false
  367. })
  368. console.log('yijianshifang >orderList>>forEach', orderList.value)
  369. // ccc.value = '完成'
  370. // const params = {
  371. // token: uni.getStorageSync('token'),
  372. // data:{ids:ids.value.toString()}
  373. // }
  374. // console.log('handleRefresh >params>>666',params)
  375. // const {data:res} = await releaseOrder(params)
  376. // if (res.code === 200) {
  377. // if(ids.value.length>0){
  378. // console.log('ids.value',ids.value)
  379. // ids.value.forEach(x=>{
  380. // console.log('orderList',orderList.value)
  381. // const index = orderList.value.findIndex(y=>y.id == x)
  382. // console.log('orderList index',index)
  383. // if(index>-1){
  384. // console.log('orderList',orderList.value)
  385. // orderList.value.splice(index,1)
  386. // console.log('orderList',orderList.value)
  387. // }
  388. // })
  389. // ids.value = []
  390. // }
  391. // }
  392. }
  393. const handleRelease = async()=>{
  394. console.log('ids.value.length',ids.value.length)
  395. const params = {
  396. token: uni.getStorageSync('token'),
  397. data:{ids:ids.value.toString()}
  398. }
  399. console.log('handleRefresh >params>>666',params)
  400. const {data:res} = await releaseOrder(params)
  401. if (res.code === 200) {
  402. console.log('after releaseOrder ids.value',ids.value)
  403. uni.$showMsg(res.msg, 2000)
  404. }
  405. if(ids.value.length==0){
  406. uni.$showMsg('尚未释放处方',2000)
  407. s.value = '1'
  408. return
  409. } else {
  410. uni.$showMsg(res.msg, 2000)
  411. }
  412. ids.value = []
  413. const paramss = {
  414. token: uni.getStorageSync('token'),
  415. data:JSON.stringify({
  416. currentUserId: parseInt(uni.getStorageSync('userId')),
  417. pageNum: page.value,
  418. pageSize: pageSize.value,
  419. status: tabList.value[tabActive.value].status
  420. })
  421. }
  422. console.log('refresh orderList checkIndex params',paramss)
  423. const {data:ress} = await receiveOrderList(paramss)
  424. if (ress.code === 200) {
  425. total.value = ress.total
  426. orderList.value = ress.rows
  427. if(total.value == orderList.value.length){
  428. isBottom.value = true
  429. } else {
  430. isBottom.value = false
  431. }
  432. if(tabActive.value ==0){
  433. tabList.value[0].leng = orderList.value.length
  434. }
  435. }
  436. s.value = '1'
  437. console.log('after refresh orderList handleRelease ids.value', ids.value)
  438. }
  439. const handleGetOffice = (e)=>{
  440. console.log('handleGetOffice', e.detail.value)
  441. console.log('officeIndex', officeIndex)
  442. console.log('officeIndex', officeIndex)
  443. if(e.detail.value==0){
  444. searchDepartment.value = ''
  445. officeIndex.value = e.detail.value
  446. } else {
  447. officeIndex.value = e.detail.value
  448. searchDepartment.value = officeArr.value[officeIndex.value]
  449. }
  450. }
  451. const handleGetType = (e)=>{
  452. console.log('handleGetType', e.detail.value)
  453. console.log('typeIndex', typeIndex)
  454. console.log('typeArr', typeIndex)
  455. typeIndex.value = e.detail.value
  456. if(typeIndex.value ===1 ){
  457. searchName.value = ''
  458. } else {
  459. searchPreNo.value = ''
  460. }
  461. }
  462. const handleGetTags = (v)=>{
  463. console.log('handleGetTags', v)
  464. if(!searchTags.value.includes(v)) {
  465. searchTags.value.push(v)
  466. } else {
  467. searchTags.value.splice(searchTags.value.indexOf(v), 1)
  468. if(v=='门诊' || v=='住院'){
  469. searchPreMzZy.value = ''
  470. console.log('删除了 v searchPreMzZy.value',v,searchPreMzZy.value)
  471. }
  472. if(v=='男' || v=='女'){
  473. searchSex.value = ''
  474. console.log('删除了 v searchSex.value',v,searchSex.value)
  475. }
  476. if(v=='煎煮' || v=='发药'){
  477. searchStatus.value = ''
  478. console.log('删除了 v searchStatus.value',v,searchStatus.value)
  479. }
  480. }
  481. switch (v) {
  482. case '全部':
  483. if(searchTags.value.includes(v)){
  484. searchTags.value = ['全部']
  485. searchTime.value = []
  486. searchDepartment.value = ''
  487. searchName.value = ''
  488. searchPreNo.value = ''
  489. searchSex.value = ''
  490. searchPreMzZy.value = ''
  491. searchStatus.value = ''
  492. officeIndex.value = 0
  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 = '1'
  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. searchPreMzZy.value = '2'
  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. searchSex.value = '女'
  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 = '2'
  548. }
  549. break
  550. case '发药':
  551. if(searchTags.value.includes(v)){
  552. if(searchTags.value.includes('煎煮')){
  553. searchTags.value.splice(searchTags.value.indexOf('煎煮'), 1)
  554. }
  555. if(searchTags.value.includes('全部')){
  556. searchTags.value.splice(searchTags.value.indexOf('全部'), 1)
  557. }
  558. searchStatus.value = '3'
  559. }
  560. break
  561. default:
  562. searchTags.value = ['全部']
  563. }
  564. }
  565. // 更新处方列表
  566. const checkIndex = async(index) => {
  567. tabActive.value = index
  568. page.value= 1
  569. console.log('index',index)
  570. ids.value = []
  571. reset()
  572. tabName.value = tabList.value[index].title
  573. currentStatus.value = parseInt(tabList.value[index].status)
  574. const token = uni.getStorageSync('token')
  575. const paramss = {
  576. token: uni.getStorageSync('token'),
  577. data:JSON.stringify({
  578. currentUserId: parseInt(uni.getStorageSync('userId')),
  579. pageNum: page.value,
  580. pageSize: pageSize.value,
  581. status: tabList.value[tabActive.value].status
  582. })
  583. }
  584. console.log('checkIndex params',paramss)
  585. const {data:res} = await receiveOrderList(paramss)
  586. if (res.code === 200) {
  587. total.value = res.total
  588. orderList.value = res.rows
  589. if(total.value == orderList.value.length){
  590. isBottom.value = true
  591. } else {
  592. isBottom.value = false
  593. }
  594. if(tabActive.value ==0){
  595. tabList.value[0].leng = orderList.value.length
  596. }
  597. }
  598. if(tabActive.value==1) {
  599. const param = {
  600. token: uni.getStorageSync('token'),
  601. // data:JSON.stringify({
  602. // currentUserId: parseInt(uni.getStorageSync('userId')),
  603. // page: page.value,
  604. // pageSize: pageSize.value,
  605. // status: tabList.value[tabActive.value].status
  606. // })
  607. }
  608. console.log('checkIndex param',param)
  609. const {data:res} = await selectDepartment(param)
  610. if (res.code === 200) {
  611. officeArr.value.push(...res.data)
  612. console.log('selectDepartment officeArr.value', officeArr.value)
  613. }
  614. }
  615. }
  616. const loadMoreList = async()=>{
  617. // if(s.value=='0'){
  618. // console.log('一键释放模式中,不需要加载更多')
  619. // return
  620. // }
  621. console.log('loadMoreList>>>')
  622. if(isBottom.value){
  623. return
  624. }
  625. page.value = page.value +1
  626. const params = {
  627. token: uni.getStorageSync('token'),
  628. data: JSON.stringify({
  629. currentUserId: parseInt(uni.getStorageSync('userId')) || 0,
  630. startTime: searchTime.value[0] || '',
  631. endTime: searchTime.value[1] || '',
  632. name: searchName.value.trim() || '',
  633. preNo: searchPreNo.value || '',
  634. department: searchDepartment.value || '',
  635. prescriptionStatus: searchStatus.value || '',//煎煮发药
  636. sex: searchSex.value || '',
  637. preMzZy: searchPreMzZy.value || '',//门诊住院
  638. pageNum: page.value,
  639. pageSize: pageSize.value,
  640. status: tabList.value[tabActive.value].status
  641. })
  642. }
  643. const {data:res} = await receiveOrderList(params)
  644. console.log('orderList.value before',orderList.value)
  645. if (res.code === 200) {
  646. total.value = res.total
  647. console.log('res.rows after',res.rows)
  648. // res.rows.forEach(item=>{
  649. // orderList.value.push(item)
  650. // })
  651. orderList.value.push(...res.rows)
  652. console.log('orderList.value after',orderList.value)
  653. if(total.value == orderList.value.length){
  654. isBottom.value = true
  655. } else {
  656. isBottom.value = false
  657. }
  658. if(tabActive.value ==0){
  659. console.log('tabActive===',)
  660. tabList.value[0].leng = orderList.value.length
  661. }
  662. }
  663. }
  664. const loadPreList = async()=>{
  665. console.log('loadPreList>>>')
  666. // if(s.value=='0'){
  667. // console.log('一键释放模式中,不需要刷新')
  668. // return
  669. // }
  670. trigger.value = true;
  671. page.value = 1
  672. const params = {
  673. token: uni.getStorageSync('token'),
  674. data: JSON.stringify({
  675. currentUserId: parseInt(uni.getStorageSync('userId')) || 0,
  676. startTime: searchTime.value[0] || '',
  677. endTime: searchTime.value[1] || '',
  678. name: searchName.value.trim() || '',
  679. preNo: searchPreNo.value || '',
  680. department: searchDepartment.value || '',
  681. prescriptionStatus: searchStatus.value || '',//煎煮发药
  682. sex: searchSex.value || '',
  683. preMzZy: searchPreMzZy.value || '',//门诊住院
  684. pageNum: page.value,
  685. pageSize: pageSize.value,
  686. status: tabList.value[tabActive.value].status
  687. })
  688. }
  689. const {data:res} = await receiveOrderList(params)
  690. if (res.code === 200) {
  691. total.value = res.total
  692. orderList.value = res.rows
  693. if(orderList.value.length < pageSize.value){
  694. isBottom.value = true
  695. } else {
  696. isBottom.value = false
  697. }
  698. if(tabActive ==0){
  699. tabList.value[0].leng = orderList.value.length
  700. }
  701. }
  702. setTimeout(() => {
  703. trigger.value = false;
  704. }, 1000)
  705. }
  706. </script>
  707. <style lang="scss">
  708. .main {
  709. display: flex;
  710. flex-direction:column;
  711. justify-content:flex-start;
  712. // height: 2000px;
  713. width: 750rpx;
  714. .nav{
  715. display: flex;
  716. height:74.34rpx;
  717. width: 750rpx;
  718. // position: sticky;
  719. // top: 0;
  720. }
  721. .body{
  722. display: flex;
  723. height:calc(100% - 74.34rpx);
  724. flex-direction:column;
  725. justify-content:flex-start;
  726. .tab-box {
  727. display: flex;
  728. position: sticky;
  729. flex-direction:column;
  730. z-index: 100;
  731. .tab-bar{
  732. height: 62.5rpx;
  733. display: flex;
  734. justify-content:center;
  735. width: 100%;
  736. // border: 1px solid #000;
  737. .tab_item{
  738. display: flex;
  739. flex:1;
  740. justify-content:center;
  741. align-items: center;
  742. font-size: 17.5rpx;
  743. background-color: #fff;
  744. color: #000;
  745. }
  746. .active{
  747. border-bottom: 5rpx solid #18C7B0;
  748. }
  749. }
  750. .search-bar{
  751. display: flex;
  752. background-color: #fff;
  753. border-radius: 4rpx;
  754. .today{
  755. display: flex;
  756. flex-direction:row;
  757. justify-content: flex-start;
  758. .search{
  759. width: 453.75rpx;
  760. margin: 13.75rpx 10.1rpx;
  761. :deep(.uni-easyinput__placeholder-class){
  762. font-size: 15rpx;
  763. }
  764. }
  765. .search-button{
  766. display: flex;
  767. justify-content:center;
  768. align-items: center;
  769. width:112.5rpx;
  770. margin: 13.75rpx 10.1rpx;
  771. font-size: 15rpx;
  772. background-color: #18C7B0;
  773. }
  774. .refresh {
  775. display: flex;
  776. justify-content:center;
  777. align-items: center;
  778. width:120rpx;
  779. margin: 13.75px 8rpx;
  780. font-size: 15rpx;
  781. background-color: #18C7B0;
  782. }
  783. .active{
  784. background-color:#DEDEDE;
  785. }
  786. }
  787. .history{
  788. display: flex;
  789. width: 100%;
  790. .searchchoice{
  791. padding: 0 10rpx;
  792. display: flex;
  793. width: 100%;
  794. flex-direction:column;
  795. font-size: 24rpx;
  796. .row1{
  797. display: flex;
  798. width: 100%;
  799. justify-content:flex-start;
  800. align-items: center;
  801. margin: 10rpx 0 10rpx;
  802. font-size: 15rpx;
  803. .timequan{
  804. display: flex;
  805. justify-content:center;
  806. align-items: center;
  807. :deep(.uni-date__x-input){
  808. font-size: 15rpx;
  809. }
  810. .datepick {
  811. z-index: 999;
  812. width: 300rpx;
  813. margin:0 10rpx;
  814. }
  815. }
  816. }
  817. .row2{
  818. display: flex;
  819. width: 100%;
  820. justify-content:flex-start;
  821. align-items: center;
  822. margin: 0 0 10rpx;
  823. .office{
  824. display: flex;
  825. justify-content:center;
  826. align-items: center;
  827. font-size: 15rpx;
  828. .uni-input{
  829. display: flex;
  830. justify-content:center;
  831. align-items: center;
  832. border:1px solid #e1e5f1;
  833. // font-size: 15rpx;
  834. width:190rpx;
  835. // height: 40rpx;
  836. border-radius: 5rpx;
  837. background-color: #e1e5f1;
  838. margin-right: 10rpx;
  839. }
  840. }
  841. .uni-input{
  842. display: flex;
  843. justify-content:center;
  844. align-items: center;
  845. border:1px solid #e1e5f1;
  846. font-size: 15rpx;
  847. width:100rpx;
  848. height: 40rpx;
  849. border-radius: 5rpx;
  850. background-color: #e1e5f1;
  851. margin-right: 10rpx;
  852. }
  853. .search{
  854. width: 187.5rpx;
  855. // height: 40rpx;
  856. // :deep(.easyinput__content-input){
  857. // // height: 40rpx!important;
  858. // }
  859. :deep(.uni-easyinput__placeholder-class){
  860. font-size: 14rpx;
  861. }
  862. }
  863. .search-button{
  864. display: flex;
  865. justify-content:center;
  866. align-items: center;
  867. width:120rpx;
  868. margin: 8rpx 12rpx;
  869. font-size: 14rpx;
  870. height: 40rpx!important;
  871. color: #fff;
  872. background-color: #18C7B0;
  873. }
  874. }
  875. .row3{
  876. display: flex;
  877. width: 100%;
  878. justify-content:flex-start;
  879. align-items: center;
  880. margin: 0 0 18rpx;
  881. .tag-view:deep(.uni-tag){
  882. display: inline;
  883. font-size: 15rpx;
  884. font-weight:500;
  885. margin-right: 16.67rpx;
  886. // height: 40px;
  887. width: 120rpx;
  888. padding: 6rpx 20rpx;
  889. }
  890. }
  891. }
  892. }
  893. }
  894. }
  895. .tab-content{
  896. display: flex;
  897. margin: 8rpx 10rpx;
  898. border-radius: 4rpx;
  899. background-color: #fff;
  900. width: calc(100% - 20rpx);
  901. height: 980rpx;
  902. z-index:10;
  903. .order-list{
  904. padding: 8rpx;
  905. display: flex;
  906. width: 100%;
  907. // height: 100%;
  908. .text{
  909. display: flex;
  910. width: 750rpx;
  911. justify-content:center;
  912. align-items: flex-start;
  913. .zwsj {
  914. margin-top: 103.13rpx;
  915. width: 640.63rpx;
  916. height: 310rpx;
  917. }
  918. }
  919. .order-list-wrap{
  920. display: flex;
  921. .order-card{
  922. display: flex;
  923. width: 100%;
  924. // border-bottom: 1px solid #e6e8ee;;
  925. }
  926. }
  927. }
  928. }
  929. }
  930. }
  931. </style>