orderList.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436
  1. <template>
  2. <view class="orderList">
  3. <!-- 头部筛选 -->
  4. <view class="orderList_header">
  5. <view class="orderList_header_item" @click="openPicker('gdState')">
  6. <text class="orderList_header_itemText">{{selectedGdState}}</text>
  7. <text class="pda pda-xiala"></text>
  8. </view>
  9. <view class="orderList_header_item" @click="openPicker('associationType')">
  10. <text class="orderList_header_itemText">{{selectedAssociationType}}</text>
  11. <text class="pda pda-xiala"></text>
  12. </view>
  13. </view>
  14. <!-- 列表 -->
  15. <view class="orderList_list">
  16. <view class="orderList_listItem" v-for="newOrder in newOrderList" :key="newOrder.id">
  17. <view class="orderList_listItem_header">
  18. <view class="orderList_listItem_header_title">
  19. <view class="associationType_icon" v-if="newOrder.isHalfInspect === 1"> 半 </view>
  20. <view class="associationType_icon" v-else-if="newOrder.taskType.associationType.value == 'specimen'">标
  21. </view>
  22. <view class="associationType_icon" v-else-if="newOrder.taskType.associationType.value == 'drugsBag'"> 药
  23. </view>
  24. <view class="associationType_icon" v-else-if="newOrder.taskType.associationType.value == 'specimenPlan'"> 巡
  25. </view>
  26. <view class="associationType_icon" v-else-if="newOrder.taskType.associationType.value == 'jPBag'"> 静 </view>
  27. <view class="associationType_icon" v-else-if="newOrder.taskType.associationType.value == 'inspect'"> 病
  28. </view>
  29. <view class="associationType_icon"
  30. v-else-if="newOrder.taskType.associationType.value == 'patientTransport'"> 病
  31. </view>
  32. <view class="associationType_icon" v-else-if="newOrder.taskType.associationType.value == 'other'"> 其
  33. </view>
  34. <view class="taskNameAndWorkerName">
  35. <text class="taskName">{{newOrder.isHalfInspect === 1? "半程陪检": newOrder.taskType.taskName}}</text>
  36. <text class="workerName"
  37. v-if="newOrder.patient &&(newOrder.taskType.associationType.value =='patientTransport' ||newOrder.taskType.associationType.value =='inspect')">-{{newOrder.patient.patientName}}</text>
  38. </view>
  39. </view>
  40. <text class="orderList_listItem_header_more"
  41. :class="newOrder.stateTextClass">{{newOrder.gdState.name }}</text>
  42. </view>
  43. <view class="orderList_listItem_item">
  44. <view class="orderList_listItem_item_content">
  45. <text class="orderList_listItem_item_name"
  46. v-if="newOrder.worker">{{newOrder.worker.name}}{{newOrder.worker.phone? "-" + newOrder.worker.phone: ""}}</text>
  47. <text class="orderList_listItem_item_name" v-else>暂未接单</text>
  48. <text class="orderList_listItem_item_time" v-if="newOrder.showCreateTime">{{newOrder.showCreateTime}}</text>
  49. <text class="orderList_listItem_item_time"
  50. v-else-if="newOrder.yyjdTime && newOrder.gdState.value == 11">{{newOrder.yyjdTime | formatDate('MM-dd HH:mm')}}</text>
  51. </view>
  52. <view class="orderList_listItem_item_btns">
  53. <button type="primary" class="btn">撤销</button>
  54. <button type="primary" class="btn">加急</button>
  55. </view>
  56. </view>
  57. </view>
  58. </view>
  59. <seiminFooterNav></seiminFooterNav>
  60. <seiminModel ref="seiminModel"></seiminModel>
  61. <seiminPicker ref="sPicker" titleColor="#808080" titleFontSize="28rpx" confirmColor="#333" confirmFontSize="38rpx"
  62. confirmFontWeight="500" itemFontSize="28rpx" @onClose="closePicker" @onConfirm="confirmPicker"
  63. :pickerList="pickerList">
  64. </seiminPicker>
  65. </view>
  66. </template>
  67. <script>
  68. import {
  69. mapState,
  70. mapActions
  71. } from "vuex";
  72. import {
  73. reqFetchDataList
  74. } from "../../request/api.js";
  75. import {
  76. GDSTATE
  77. } from "../../utils/enum.gdstate.js";
  78. export default {
  79. name: 'orderList',
  80. data() {
  81. return {
  82. selectedGdState: '执行中',
  83. selectedAssociationType: '全部',
  84. gdStates: [{
  85. value: -1,
  86. label: '全部'
  87. },
  88. {
  89. value: 1,
  90. label: '执行中'
  91. },
  92. {
  93. value: 2,
  94. label: '待评价'
  95. },
  96. ], //工单状态筛选列表
  97. associationTypes: [{
  98. value: -1,
  99. label: '全部'
  100. }, ], //关联类型筛选列表
  101. newOrderList: [], //工单列表
  102. totalNum: 0, //工单总数量
  103. idx: 0, //页码
  104. pageNum: 20, //每页的工单数量
  105. pickerList: [], //picker列表
  106. type: '',
  107. };
  108. },
  109. computed: {
  110. ...mapState("login", ["loginInfo"]),
  111. },
  112. methods: {
  113. ...mapActions("dictionary", ["vxDictionary"]),
  114. //关闭
  115. closePicker() {
  116. this.$refs.sPicker._close();
  117. },
  118. //打开
  119. openPicker(type) {
  120. this.type = type;
  121. this.$refs.sPicker._open();
  122. if (type === 'gdState') {
  123. //工单状态
  124. this.pickerList = this.gdStates;
  125. let index = this.pickerList.findIndex(v => v.label === this.selectedGdState);
  126. let obj = this.pickerList.find(v => v.label === this.selectedGdState);
  127. this.$refs.sPicker._changeValue(index);
  128. this.selectedGdState = obj && obj.label;
  129. } else if (type === 'associationType') {
  130. //关联类型
  131. this.pickerList = this.associationTypes;
  132. let index = this.pickerList.findIndex(v => v.label === this.selectedAssociationType);
  133. let obj = this.pickerList.find(v => v.label === this.selectedAssociationType);
  134. this.$refs.sPicker._changeValue(index);
  135. this.selectedAssociationType = obj && obj.label;
  136. }
  137. },
  138. //确定:接收子组件传来的参数
  139. confirmPicker(checkedObj) {
  140. if (this.type === 'gdState') {
  141. //工单状态
  142. this.selectedGdState = checkedObj.label;
  143. } else if (this.type === 'associationType') {
  144. //关联类型
  145. this.selectedAssociationType = checkedObj.label;
  146. }
  147. let index = this.pickerList.findIndex(v => v.label === checkedObj.label);
  148. this.$refs.sPicker._changeValue(index);
  149. this.init();
  150. },
  151. // 获取页面数据
  152. init() {
  153. uni.showLoading({
  154. title: "加载中",
  155. mask: true,
  156. });
  157. Promise.all([
  158. this.queryWorkOrdersRequest(), //查询最新工单列表
  159. this.queryDictionary('association_types'), //获取数据字典
  160. ]).then((values) => {
  161. uni.hideLoading();
  162. uni.stopPullDownRefresh();
  163. this.queryWorkOrdersResponse(values[0]);
  164. this.queryDictionaryResponse(values[1], 'association_types');
  165. });
  166. },
  167. // 查询最新工单列表(上拉)
  168. reachBottom() {
  169. //没有更多
  170. if (this.newOrderList.length == this.totalNum) {
  171. uni.showToast({
  172. icon: 'none',
  173. title: '没有更多工单了'
  174. })
  175. return;
  176. }
  177. uni.showLoading({
  178. title: "加载中",
  179. mask: true,
  180. });
  181. Promise.all([
  182. this.queryWorkOrdersRequest(true), //查询最新工单列表
  183. ]).then((values) => {
  184. uni.hideLoading();
  185. this.queryWorkOrdersResponse(values[0], true);
  186. });
  187. },
  188. // 查询最新工单列表
  189. queryWorkOrdersRequest(idxPlus = false) {
  190. if (idxPlus) {
  191. //累加
  192. ++this.idx;
  193. } else {
  194. this.idx = 0;
  195. }
  196. return reqFetchDataList("nurse", "workOrder", {
  197. workOrder: {
  198. createDept: this.loginInfo.user.dept.id,
  199. platform: 2,
  200. searchDays: 2,
  201. },
  202. idx: this.idx,
  203. sum: this.pageNum,
  204. });
  205. },
  206. // 查询最新工单列表
  207. queryWorkOrdersResponse(res, idxPlus = false) {
  208. if (res.status == 200) {
  209. res.list = res.list || [];
  210. this.totalNum = res.totalNum || 0;
  211. let newOrderList = res.list.map((v) => {
  212. if (v.gdState) {
  213. if (
  214. v.gdState.value == GDSTATE["待接单"] ||
  215. v.gdState.value == GDSTATE["待抢单"]
  216. ) {
  217. v.stateTextClass = "red";
  218. } else if (
  219. v.gdState.value == GDSTATE["待评价"] ||
  220. v.gdState.value == GDSTATE["已完成"]
  221. ) {
  222. v.stateTextClass = "green";
  223. } else {
  224. v.stateTextClass = "yellow";
  225. }
  226. }
  227. return v;
  228. });
  229. if (idxPlus) {
  230. //累加
  231. this.newOrderList = this.newOrderList.concat(newOrderList);
  232. } else {
  233. this.newOrderList = newOrderList;
  234. }
  235. } else {
  236. this.$refs.seiminModel.showChangeDept({
  237. skin: "toast",
  238. icon: "error",
  239. content: res.msg || "获取数据失败",
  240. });
  241. throw new Error(res.msg || '获取数据失败');
  242. }
  243. },
  244. // 获取数据字典
  245. queryDictionary(key) {
  246. let postData = {
  247. "type": "list",
  248. key
  249. };
  250. return this.vxDictionary(postData);
  251. },
  252. // 获取数据字典
  253. queryDictionaryResponse(res, type) {
  254. console.log(res, type);
  255. switch (type) {
  256. case 'association_types':
  257. let arr = res.map(v => ({
  258. value: v.id,
  259. label: v.name
  260. }));
  261. this.associationTypes = [{
  262. label: '全部',
  263. value: -1
  264. }, ...arr];
  265. break;
  266. }
  267. },
  268. },
  269. mounted() {
  270. this.init();
  271. },
  272. onPullDownRefresh() {
  273. this.init();
  274. },
  275. onReachBottom() {
  276. this.reachBottom();
  277. }
  278. }
  279. </script>
  280. <style lang="scss" scoped>
  281. .orderList {
  282. padding-top: 88rpx;
  283. padding-bottom: 108rpx;
  284. // 头部筛选
  285. .orderList_header {
  286. height: 88rpx;
  287. background-color: #fff;
  288. border-bottom: 1px solid #E5E9ED;
  289. position: fixed;
  290. top: 88rpx;
  291. left: 0;
  292. z-index: 99;
  293. width: 100%;
  294. @include flex(center, center);
  295. .orderList_header_item {
  296. flex: 1;
  297. height: 100%;
  298. padding: 0 50rpx;
  299. border-right: 1px solid #E5E9ED;
  300. @include flex(space-between, center);
  301. &:last-of-type {
  302. border-right: none;
  303. }
  304. .orderList_header_itemText {
  305. color: #333;
  306. font-size: 38rpx;
  307. }
  308. .pda-xiala {
  309. color: #DDE1E5;
  310. }
  311. }
  312. }
  313. // 列表
  314. .orderList_list {
  315. padding: 0 24rpx;
  316. .orderList_listItem {
  317. width: 702rpx;
  318. min-height: 320rpx;
  319. background-color: #fff;
  320. margin-top: 8rpx;
  321. border-radius: 8rpx;
  322. border: 2rpx solid #e5e9ed;
  323. position: relative;
  324. padding: 0 15rpx;
  325. font-size: 32rpx;
  326. @include semicircle(#f9fafb, 82rpx);
  327. @include flex(flex-start, stretch, column);
  328. .orderList_listItem_header {
  329. height: 86rpx;
  330. border-bottom: 1px dashed #e5e9ed;
  331. @include flex(space-between, center);
  332. .orderList_listItem_header_title {
  333. color: #333;
  334. flex: 1;
  335. @include flex(flex-start, center);
  336. .associationType_icon {
  337. width: 48rpx;
  338. height: 48rpx;
  339. border-radius: 50%;
  340. background-color: #F0F6ED;
  341. border: 1px solid #39b199;
  342. font-size: 24rpx;
  343. color: #39b199;
  344. margin-right: 8rpx;
  345. @include flex(center, center);
  346. }
  347. .taskNameAndWorkerName {
  348. flex: 1;
  349. @include flex;
  350. .taskName {
  351. max-width: 10em;
  352. @include clamp;
  353. }
  354. .workerName {
  355. flex: 1;
  356. @include clamp;
  357. }
  358. }
  359. }
  360. .orderList_listItem_header_more {
  361. color: #666;
  362. }
  363. }
  364. .orderList_listItem_item {
  365. height: 88rpx;
  366. border-bottom: 1px solid #e5e9ed;
  367. color: #333;
  368. font-size: 30rpx;
  369. flex: 1;
  370. @include flex(flex-start, stretch, column);
  371. &:last-of-type {
  372. border-bottom: none;
  373. }
  374. .orderList_listItem_item_content {
  375. min-height: 143rpx;
  376. flex: 1;
  377. @include flex(space-between, center);
  378. .orderList_listItem_item_name {
  379. font-size: 38rpx;
  380. font-weight: bold;
  381. }
  382. .orderList_listItem_item_time {
  383. color: #666;
  384. font-size: 28rpx;
  385. }
  386. }
  387. .orderList_listItem_item_btns {
  388. position: relative;
  389. left: -14rpx;
  390. width: 698rpx;
  391. height: 88rpx;
  392. @include btn_background;
  393. @include flex;
  394. .btn {
  395. flex: 1;
  396. background-color: transparent;
  397. border-right: 2rpx solid #fff;
  398. &:last-of-type {
  399. border-right: none;
  400. }
  401. &::after {
  402. border: none;
  403. }
  404. }
  405. }
  406. }
  407. }
  408. }
  409. }
  410. </style>