orderList.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552
  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. @click="toDetail(newOrder.id)">
  18. <image class="ji" src="../../static/imgs/icon_ji.png" mode="widthFix"
  19. v-if="newOrder.emergencyType && newOrder.emergencyType.value == 2"></image>
  20. <image class="jiaji" src="../../static/imgs/icon_jiaji.png" mode="widthFix"
  21. v-if="newOrder.emergencyType && newOrder.emergencyType.value == 3"></image>
  22. <view class="orderList_listItem_header">
  23. <view class="orderList_listItem_header_title">
  24. <view class="associationType_icon" v-if="newOrder.isHalfInspect === 1"> 半 </view>
  25. <view class="associationType_icon" v-else-if="newOrder.taskType.associationType.value == 'specimen'">标
  26. </view>
  27. <view class="associationType_icon" v-else-if="newOrder.taskType.associationType.value == 'drugsBag'"> 药
  28. </view>
  29. <view class="associationType_icon" v-else-if="newOrder.taskType.associationType.value == 'specimenPlan'"> 巡
  30. </view>
  31. <view class="associationType_icon" v-else-if="newOrder.taskType.associationType.value == 'jPBag'"> 静 </view>
  32. <view class="associationType_icon" v-else-if="newOrder.taskType.associationType.value == 'inspect'"> 病
  33. </view>
  34. <view class="associationType_icon"
  35. v-else-if="newOrder.taskType.associationType.value == 'patientTransport'"> 病
  36. </view>
  37. <view class="associationType_icon" v-else-if="newOrder.taskType.associationType.value == 'other'"> 其
  38. </view>
  39. <view class="taskNameAndWorkerName">
  40. <text class="taskName">{{newOrder.isHalfInspect === 1? "半程陪检": newOrder.taskType.taskName}}</text>
  41. <text class="workerName"
  42. v-if="newOrder.patient &&(newOrder.taskType.associationType.value =='patientTransport' ||newOrder.taskType.associationType.value =='inspect')">-{{newOrder.patient.patientName}}</text>
  43. </view>
  44. </view>
  45. <text class="orderList_listItem_header_more"
  46. :class="newOrder.stateTextClass">{{newOrder.gdState.name }}</text>
  47. </view>
  48. <view class="orderList_listItem_item">
  49. <view class="orderList_listItem_item_content">
  50. <text class="orderList_listItem_item_name"
  51. v-if="newOrder.worker">{{newOrder.worker.name}}{{newOrder.worker.phone? "-" + newOrder.worker.phone: ""}}</text>
  52. <text class="orderList_listItem_item_name" v-else>暂未接单</text>
  53. <text class="orderList_listItem_item_time" v-if="newOrder.showCreateTime">{{newOrder.showCreateTime}}</text>
  54. <text class="orderList_listItem_item_time"
  55. v-else-if="newOrder.yyjdTime && newOrder.gdState.value == GDSTATE['定时预约']">{{newOrder.yyjdTime | formatDate('MM-dd HH:mm')}}</text>
  56. </view>
  57. <view class="orderList_listItem_item_btns" v-if="
  58. newOrder.gdState.value == GDSTATE['待抢单'] ||
  59. newOrder.gdState.value == GDSTATE['待接单'] ||
  60. newOrder.gdState.value == GDSTATE['待到达'] ||
  61. newOrder.gdState.value == GDSTATE['定时预约'] ||
  62. newOrder.gdState.value == GDSTATE['待评价']
  63. ">
  64. <button type="primary" class="btn" v-if="newOrder.gdState.value == GDSTATE['待评价']"
  65. @click.stop="showAppraise(newOrder.id)">评价</button>
  66. <button type="primary" class="btn" v-if="
  67. newOrder.gdState.value == GDSTATE['待抢单'] ||
  68. newOrder.gdState.value == GDSTATE['待接单'] ||
  69. newOrder.gdState.value == GDSTATE['待到达'] ||
  70. newOrder.gdState.value == GDSTATE['定时预约']
  71. " @click.stop="openRecallModal(newOrder.id)">撤销</button>
  72. <button type="primary" class="btn" v-if="newOrder.gdState.value == GDSTATE['定时预约']"
  73. @click.stop="openExecModal(newOrder.id)">立即执行</button>
  74. <button type="primary" class="btn" v-if="
  75. (newOrder.gdState.value == GDSTATE['待抢单'] ||
  76. newOrder.gdState.value == GDSTATE['待到达']) &&
  77. newOrder.taskType.allowUrgent == 1 &&
  78. !newOrder.urgentDetails
  79. " @click.stop="showJiaji(newOrder.id)">加急</button>
  80. </view>
  81. </view>
  82. </view>
  83. </view>
  84. <seiminFooterNav></seiminFooterNav>
  85. <seiminModel ref="seiminModel"></seiminModel>
  86. <seiminPicker ref="sPicker" titleColor="#808080" titleFontSize="28rpx" confirmColor="#333" confirmFontSize="38rpx"
  87. confirmFontWeight="500" itemFontSize="32rpx" @onClose="closePicker" @onConfirm="confirmPicker"
  88. :pickerList="pickerList">
  89. </seiminPicker>
  90. </view>
  91. </template>
  92. <script>
  93. import {
  94. mapState,
  95. mapActions
  96. } from "vuex";
  97. import {
  98. reqFetchDataList,
  99. } from "../../request/api.js";
  100. import {
  101. GDSTATE
  102. } from "../../utils/enum.gdstate.js";
  103. import {
  104. WORKORDER_EVALUATION
  105. } from "../../utils/enum.workorderEvaluation.js";
  106. import {
  107. showAppraise,
  108. openRecallModal,
  109. openExecModal,
  110. showJiaji,
  111. } from "../../utils/index.js";
  112. export default {
  113. name: 'orderList',
  114. data() {
  115. return {
  116. // 工单状态
  117. GDSTATE: GDSTATE,
  118. // 当前筛选的工单状态
  119. selectedGdState: '执行中',
  120. // 当前筛选的关联类型
  121. selectedAssociationType: '全部',
  122. //工单状态筛选列表
  123. gdStates: [{
  124. value: -1,
  125. label: '全部'
  126. },
  127. {
  128. value: 1,
  129. label: '执行中'
  130. },
  131. {
  132. value: 2,
  133. label: '待评价'
  134. },
  135. ],
  136. //关联类型筛选列表
  137. associationTypes: [{
  138. value: -1,
  139. label: '全部'
  140. }, ],
  141. newOrderList: [], //工单列表
  142. totalNum: 0, //工单总数量
  143. idx: 0, //页码
  144. pageNum: 20, //每页的工单数量
  145. pickerList: [], //picker列表
  146. type: '', //打开picker的类型,工单状态||关联类型
  147. };
  148. },
  149. computed: {
  150. ...mapState("login", ["loginInfo"]),
  151. },
  152. methods: {
  153. ...mapActions("dictionary", ["vxDictionary"]),
  154. // 前往工单详情
  155. toDetail(id) {
  156. uni.navigateTo({
  157. url: `/pages/orderDetail/orderDetail?id=${id}`
  158. })
  159. },
  160. //评价
  161. showAppraise(id) {
  162. showAppraise.call(this, id, () => {
  163. this.$refs.seiminModel.close();
  164. this.init();
  165. });
  166. },
  167. //撤销
  168. openRecallModal(id) {
  169. openRecallModal.call(this, id, () => {
  170. this.$refs.seiminModel.close();
  171. this.init();
  172. });
  173. },
  174. //立即执行
  175. openExecModal(id) {
  176. openExecModal.call(this, id, () => {
  177. this.$refs.seiminModel.close();
  178. this.init();
  179. });
  180. },
  181. //加急
  182. showJiaji(id) {
  183. showJiaji.call(this, id, () => {
  184. this.$refs.seiminModel.close();
  185. this.init();
  186. });
  187. },
  188. //关闭
  189. closePicker() {
  190. this.$refs.sPicker._close();
  191. },
  192. //打开
  193. openPicker(type) {
  194. this.type = type;
  195. this.$refs.sPicker._open();
  196. if (type === 'gdState') {
  197. //工单状态
  198. this.pickerList = this.gdStates;
  199. let index = this.pickerList.findIndex(v => v.label === this.selectedGdState);
  200. let obj = this.pickerList.find(v => v.label === this.selectedGdState);
  201. this.$refs.sPicker._changeValue(index);
  202. this.selectedGdState = obj && obj.label;
  203. } else if (type === 'associationType') {
  204. //关联类型
  205. this.pickerList = this.associationTypes;
  206. let index = this.pickerList.findIndex(v => v.label === this.selectedAssociationType);
  207. let obj = this.pickerList.find(v => v.label === this.selectedAssociationType);
  208. this.$refs.sPicker._changeValue(index);
  209. this.selectedAssociationType = obj && obj.label;
  210. }
  211. },
  212. //确定:接收子组件传来的参数
  213. confirmPicker(checkedObj) {
  214. if (this.type === 'gdState') {
  215. //工单状态
  216. this.selectedGdState = checkedObj.label;
  217. } else if (this.type === 'associationType') {
  218. //关联类型
  219. this.selectedAssociationType = checkedObj.label;
  220. }
  221. let index = this.pickerList.findIndex(v => v.label === checkedObj.label);
  222. this.$refs.sPicker._changeValue(index);
  223. this.init();
  224. },
  225. // 获取页面数据
  226. init() {
  227. uni.showLoading({
  228. title: "加载中",
  229. mask: true,
  230. });
  231. Promise.all([
  232. this.queryWorkOrdersRequest(), //查询最新工单列表
  233. this.queryDictionary('association_types'), //获取数据字典-关联类型
  234. ]).then((values) => {
  235. uni.hideLoading();
  236. uni.stopPullDownRefresh();
  237. this.queryWorkOrdersResponse(values[0]);
  238. this.queryDictionaryResponse(values[1], 'association_types');
  239. });
  240. },
  241. // 查询最新工单列表(上拉)
  242. reachBottom() {
  243. //没有更多
  244. if (this.newOrderList.length == this.totalNum) {
  245. uni.showToast({
  246. icon: 'none',
  247. title: '没有更多工单了'
  248. })
  249. return;
  250. }
  251. uni.showLoading({
  252. title: "加载中",
  253. mask: true,
  254. });
  255. Promise.all([
  256. this.queryWorkOrdersRequest(true), //查询最新工单列表
  257. ]).then((values) => {
  258. uni.hideLoading();
  259. this.queryWorkOrdersResponse(values[0], true);
  260. });
  261. },
  262. // 查询最新工单列表
  263. queryWorkOrdersRequest(idxPlus = false) {
  264. console.log(this.selectedGdState, this.selectedAssociationType);
  265. console.log(this.gdStates, this.associationTypes);
  266. if (idxPlus) {
  267. //累加
  268. ++this.idx;
  269. } else {
  270. this.idx = 0;
  271. }
  272. let postData = {
  273. workOrder: {
  274. createDept: this.loginInfo.user.dept.id,
  275. platform: 2,
  276. searchDays: 2,
  277. },
  278. idx: this.idx,
  279. sum: this.pageNum,
  280. };
  281. let selectedGdStateValue = this.gdStates.find(v => v.label == this.selectedGdState).value;
  282. let associationTypesValue = this.associationTypes.find(v => v.label == this.selectedAssociationType).value;
  283. // 工单状态
  284. // 执行中包含状态:待抢单、待接单、待到达、待送达、执行中、定时预约
  285. if (selectedGdStateValue == 1) {
  286. // 执行中
  287. postData.workOrder.nurseState = 1;
  288. } else if (selectedGdStateValue == 2) {
  289. // 待评价
  290. postData.workOrder.gdState = {
  291. id: "73"
  292. };
  293. }
  294. //关联类型
  295. if (associationTypesValue != -1) {
  296. postData.workOrder.taskType = {
  297. associationType: {
  298. id: associationTypesValue,
  299. }
  300. }
  301. }
  302. return reqFetchDataList("nurse", "workOrder", postData);
  303. },
  304. // 查询最新工单列表
  305. queryWorkOrdersResponse(res, idxPlus = false) {
  306. if (res.status == 200) {
  307. res.list = res.list || [];
  308. this.totalNum = res.totalNum || 0;
  309. let newOrderList = res.list.map((v) => {
  310. if (v.gdState) {
  311. if (
  312. v.gdState.value == GDSTATE["待接单"] ||
  313. v.gdState.value == GDSTATE["待抢单"]
  314. ) {
  315. v.stateTextClass = "red";
  316. } else if (
  317. v.gdState.value == GDSTATE["待评价"] ||
  318. v.gdState.value == GDSTATE["已完成"]
  319. ) {
  320. v.stateTextClass = "green";
  321. } else {
  322. v.stateTextClass = "yellow";
  323. }
  324. }
  325. return v;
  326. });
  327. if (idxPlus) {
  328. //累加
  329. this.newOrderList = this.newOrderList.concat(newOrderList);
  330. } else {
  331. this.newOrderList = newOrderList;
  332. }
  333. } else {
  334. this.$refs.seiminModel.show({
  335. skin: "toast",
  336. icon: "error",
  337. content: res.msg || "获取数据失败",
  338. });
  339. throw new Error(res.msg || '获取数据失败');
  340. }
  341. },
  342. // 获取数据字典
  343. queryDictionary(key) {
  344. let postData = {
  345. "type": "list",
  346. key
  347. };
  348. return this.vxDictionary(postData);
  349. },
  350. // 获取数据字典
  351. queryDictionaryResponse(res, type) {
  352. let arr = [];
  353. switch (type) {
  354. case 'association_types':
  355. arr = res.map(v => ({
  356. value: v.id,
  357. label: v.name
  358. }));
  359. this.associationTypes = [{
  360. label: '全部',
  361. value: -1
  362. }, ...arr];
  363. break;
  364. }
  365. },
  366. },
  367. mounted() {
  368. this.init();
  369. },
  370. onPullDownRefresh() {
  371. this.init();
  372. },
  373. onReachBottom() {
  374. this.reachBottom();
  375. }
  376. }
  377. </script>
  378. <style lang="scss" scoped>
  379. .orderList {
  380. padding-bottom: 108rpx;
  381. // 头部筛选
  382. .orderList_header {
  383. height: 88rpx;
  384. background-color: #fff;
  385. position: fixed;
  386. left: 0;
  387. z-index: 99;
  388. width: 100%;
  389. @include border(bottom);
  390. @include flex(center, center);
  391. .orderList_header_item {
  392. flex: 1;
  393. height: 100%;
  394. padding: 0 50rpx;
  395. @include border(right);
  396. @include flex(space-between, center);
  397. &:last-of-type {
  398. border-right: none;
  399. }
  400. .orderList_header_itemText {
  401. color: #333;
  402. font-size: 38rpx;
  403. }
  404. .pda-xiala {
  405. color: #DDE1E5;
  406. }
  407. }
  408. }
  409. // 列表
  410. .orderList_list {
  411. padding: 88rpx 24rpx 0;
  412. .orderList_listItem {
  413. width: 702rpx;
  414. min-height: 320rpx;
  415. background-color: #fff;
  416. margin-top: 8rpx;
  417. border-radius: 8rpx;
  418. position: relative;
  419. padding: 0 24rpx;
  420. font-size: 32rpx;
  421. @include border;
  422. @include semicircle(#f9fafb, 82rpx);
  423. @include flex(flex-start, stretch, column);
  424. .ji,
  425. .jiaji {
  426. width: 60rpx;
  427. position: absolute;
  428. right: 0;
  429. top: 0;
  430. }
  431. .orderList_listItem_header {
  432. height: 86rpx;
  433. @include border($directive:bottom, $style:dashed);
  434. @include flex(space-between, center);
  435. .orderList_listItem_header_title {
  436. color: #333;
  437. flex: 1;
  438. @include flex(flex-start, center);
  439. .associationType_icon {
  440. width: 48rpx;
  441. height: 48rpx;
  442. border-radius: 50%;
  443. background-color: #F0F6ED;
  444. font-size: 24rpx;
  445. color: #39b199;
  446. margin-right: 8rpx;
  447. @include border($color:#39b199);
  448. @include flex(center, center);
  449. }
  450. .taskNameAndWorkerName {
  451. flex: 1;
  452. @include flex;
  453. .taskName {
  454. max-width: 10em;
  455. @include clamp;
  456. }
  457. .workerName {
  458. flex: 1;
  459. @include clamp;
  460. }
  461. }
  462. }
  463. .orderList_listItem_header_more {
  464. color: #666;
  465. @include clamp;
  466. }
  467. }
  468. .orderList_listItem_item {
  469. height: 88rpx;
  470. color: #333;
  471. font-size: 30rpx;
  472. flex: 1;
  473. @include border(bottom);
  474. @include flex(flex-start, stretch, column);
  475. &:last-of-type {
  476. border-bottom: none;
  477. }
  478. .orderList_listItem_item_content {
  479. min-height: 143rpx;
  480. flex: 1;
  481. @include flex(space-between, center);
  482. .orderList_listItem_item_name {
  483. font-size: 38rpx;
  484. font-weight: bold;
  485. }
  486. .orderList_listItem_item_time {
  487. color: #666;
  488. font-size: 28rpx;
  489. }
  490. }
  491. .orderList_listItem_item_btns {
  492. position: relative;
  493. left: -24rpx;
  494. width: 698rpx;
  495. height: 88rpx;
  496. @include btn_background;
  497. @include flex;
  498. .btn {
  499. flex: 1;
  500. background-color: transparent;
  501. position: relative;
  502. @include flex(center, center);
  503. &::before {
  504. content: '';
  505. position: absolute;
  506. right: 0;
  507. top: 0;
  508. width: 1px;
  509. height: 100%;
  510. @include border(right, #fff);
  511. }
  512. &:last-of-type::before {
  513. border-right: none;
  514. }
  515. &::after {
  516. border: none;
  517. }
  518. }
  519. }
  520. }
  521. }
  522. }
  523. }
  524. </style>