orderList.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459
  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. console.log(this.selectedGdState, this.selectedAssociationType);
  191. console.log(this.gdStates, this.associationTypes);
  192. if (idxPlus) {
  193. //累加
  194. ++this.idx;
  195. } else {
  196. this.idx = 0;
  197. }
  198. let postData = {
  199. workOrder: {
  200. createDept: this.loginInfo.user.dept.id,
  201. platform: 2,
  202. searchDays: 2,
  203. },
  204. idx: this.idx,
  205. sum: this.pageNum,
  206. };
  207. let selectedGdStateValue = this.gdStates.find(v => v.label == this.selectedGdState).value;
  208. let associationTypesValue = this.associationTypes.find(v => v.label == this.selectedAssociationType).value;
  209. // 工单状态
  210. // 执行中包含状态:待抢单、待接单、待到达、待送达、执行中、定时预约
  211. if (selectedGdStateValue == 1) {
  212. // 执行中
  213. postData.workOrder.nurseState = 1;
  214. } else if (selectedGdStateValue == 2) {
  215. // 待评价
  216. postData.workOrder.gdState = {
  217. id: "73"
  218. };
  219. }
  220. //关联类型
  221. if (associationTypesValue != -1) {
  222. postData.workOrder.taskType = {
  223. associationType: {
  224. id: associationTypesValue,
  225. }
  226. }
  227. }
  228. return reqFetchDataList("nurse", "workOrder", postData);
  229. },
  230. // 查询最新工单列表
  231. queryWorkOrdersResponse(res, idxPlus = false) {
  232. if (res.status == 200) {
  233. res.list = res.list || [];
  234. this.totalNum = res.totalNum || 0;
  235. let newOrderList = res.list.map((v) => {
  236. if (v.gdState) {
  237. if (
  238. v.gdState.value == GDSTATE["待接单"] ||
  239. v.gdState.value == GDSTATE["待抢单"]
  240. ) {
  241. v.stateTextClass = "red";
  242. } else if (
  243. v.gdState.value == GDSTATE["待评价"] ||
  244. v.gdState.value == GDSTATE["已完成"]
  245. ) {
  246. v.stateTextClass = "green";
  247. } else {
  248. v.stateTextClass = "yellow";
  249. }
  250. }
  251. return v;
  252. });
  253. if (idxPlus) {
  254. //累加
  255. this.newOrderList = this.newOrderList.concat(newOrderList);
  256. } else {
  257. this.newOrderList = newOrderList;
  258. }
  259. } else {
  260. this.$refs.seiminModel.showChangeDept({
  261. skin: "toast",
  262. icon: "error",
  263. content: res.msg || "获取数据失败",
  264. });
  265. throw new Error(res.msg || '获取数据失败');
  266. }
  267. },
  268. // 获取数据字典
  269. queryDictionary(key) {
  270. let postData = {
  271. "type": "list",
  272. key
  273. };
  274. return this.vxDictionary(postData);
  275. },
  276. // 获取数据字典
  277. queryDictionaryResponse(res, type) {
  278. switch (type) {
  279. case 'association_types':
  280. let arr = res.map(v => ({
  281. value: v.id,
  282. label: v.name
  283. }));
  284. this.associationTypes = [{
  285. label: '全部',
  286. value: -1
  287. }, ...arr];
  288. break;
  289. }
  290. },
  291. },
  292. mounted() {
  293. this.init();
  294. },
  295. onPullDownRefresh() {
  296. this.init();
  297. },
  298. onReachBottom() {
  299. this.reachBottom();
  300. }
  301. }
  302. </script>
  303. <style lang="scss" scoped>
  304. .orderList {
  305. padding-top: 88rpx;
  306. padding-bottom: 108rpx;
  307. // 头部筛选
  308. .orderList_header {
  309. height: 88rpx;
  310. background-color: #fff;
  311. border-bottom: 1px solid #E5E9ED;
  312. position: fixed;
  313. top: 88rpx;
  314. left: 0;
  315. z-index: 99;
  316. width: 100%;
  317. @include flex(center, center);
  318. .orderList_header_item {
  319. flex: 1;
  320. height: 100%;
  321. padding: 0 50rpx;
  322. border-right: 1px solid #E5E9ED;
  323. @include flex(space-between, center);
  324. &:last-of-type {
  325. border-right: none;
  326. }
  327. .orderList_header_itemText {
  328. color: #333;
  329. font-size: 38rpx;
  330. }
  331. .pda-xiala {
  332. color: #DDE1E5;
  333. }
  334. }
  335. }
  336. // 列表
  337. .orderList_list {
  338. padding: 0 24rpx;
  339. .orderList_listItem {
  340. width: 702rpx;
  341. min-height: 320rpx;
  342. background-color: #fff;
  343. margin-top: 8rpx;
  344. border-radius: 8rpx;
  345. border: 2rpx solid #e5e9ed;
  346. position: relative;
  347. padding: 0 15rpx;
  348. font-size: 32rpx;
  349. @include semicircle(#f9fafb, 82rpx);
  350. @include flex(flex-start, stretch, column);
  351. .orderList_listItem_header {
  352. height: 86rpx;
  353. border-bottom: 1px dashed #e5e9ed;
  354. @include flex(space-between, center);
  355. .orderList_listItem_header_title {
  356. color: #333;
  357. flex: 1;
  358. @include flex(flex-start, center);
  359. .associationType_icon {
  360. width: 48rpx;
  361. height: 48rpx;
  362. border-radius: 50%;
  363. background-color: #F0F6ED;
  364. border: 1px solid #39b199;
  365. font-size: 24rpx;
  366. color: #39b199;
  367. margin-right: 8rpx;
  368. @include flex(center, center);
  369. }
  370. .taskNameAndWorkerName {
  371. flex: 1;
  372. @include flex;
  373. .taskName {
  374. max-width: 10em;
  375. @include clamp;
  376. }
  377. .workerName {
  378. flex: 1;
  379. @include clamp;
  380. }
  381. }
  382. }
  383. .orderList_listItem_header_more {
  384. color: #666;
  385. }
  386. }
  387. .orderList_listItem_item {
  388. height: 88rpx;
  389. border-bottom: 1px solid #e5e9ed;
  390. color: #333;
  391. font-size: 30rpx;
  392. flex: 1;
  393. @include flex(flex-start, stretch, column);
  394. &:last-of-type {
  395. border-bottom: none;
  396. }
  397. .orderList_listItem_item_content {
  398. min-height: 143rpx;
  399. flex: 1;
  400. @include flex(space-between, center);
  401. .orderList_listItem_item_name {
  402. font-size: 38rpx;
  403. font-weight: bold;
  404. }
  405. .orderList_listItem_item_time {
  406. color: #666;
  407. font-size: 28rpx;
  408. }
  409. }
  410. .orderList_listItem_item_btns {
  411. position: relative;
  412. left: -14rpx;
  413. width: 698rpx;
  414. height: 88rpx;
  415. @include btn_background;
  416. @include flex;
  417. .btn {
  418. flex: 1;
  419. background-color: transparent;
  420. border-right: 2rpx solid #fff;
  421. &:last-of-type {
  422. border-right: none;
  423. }
  424. &::after {
  425. border: none;
  426. }
  427. }
  428. }
  429. }
  430. }
  431. }
  432. }
  433. </style>