WXL
5 天以前 871522ed7e06fd9c62a87c178d7f5c88d7853a20
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
<template>
  <view class="transport-record">
    <!-- 统计卡片 -->
    <view class="stats-card">
      <view class="stat-item">
        <text class="count">{{ stats.totalTransports }}</text>
        <text class="label">总转运单</text>
      </view>
      <view class="divider"></view>
      <view class="stat-item">
        <text class="count">{{ stats.pendingTransports }}</text>
        <text class="label">待出发</text>
      </view>
      <view class="divider"></view>
      <view class="stat-item">
        <text class="count">{{ stats.completedTransports }}</text>
        <text class="label">已完成</text>
      </view>
    </view>
 
    <!-- 筛选栏 -->
    <view class="filter-bar">
      <view class="type-filter">
        <text
          v-for="(type, index) in transportTypes"
          :key="index"
          :class="{ active: currentType === type.value }"
          @tap="selectType(type.value)"
          >{{ type.label }}</text
        >
      </view>
 
      <!-- 时间筛选 -->
      <view class="date-filter">
        <picker
          mode="date"
          :value="startDate"
          :end="endDate"
          @change="onStartDateChange"
        >
          <text>{{ startDate || "开始日期" }}</text>
        </picker>
        <text class="separator">至</text>
        <picker
          mode="date"
          :value="endDate"
          :start="startDate"
          @change="onEndDateChange"
        >
          <text>{{ endDate || "结束日期" }}</text>
        </picker>
      </view>
    </view>
 
    <!-- 转运单列表 -->
    <scroll-view
      scroll-y
      class="transport-list"
      refresher-enabled
      :refresher-triggered="refreshing"
      @refresherrefresh="onRefresh"
      @scrolltolower="onLoadMore"
    >
      <view
        class="transport-item card"
        v-for="(item, index) in filteredTransports"
        :key="index"
        @tap="viewDetail(item)"
      >
        <view class="header">
          <view class="case-info">
            <view class="info">
              <text class="case-no">{{ item.caseNo }}</text>
              <text class="patient"
                >{{ item.donorName }} | {{ item.gender }} |
                {{ item.age }}岁</text
              >
            </view>
          </view>
          <text class="status" :class="item.status">{{ item.statusText }}</text>
        </view>
 
        <view class="detail-info">
          <view class="info-item">
            <text class="label">疾病诊断</text>
            <text class="value">{{ item.diagnosis }}</text>
          </view>
          <view class="info-item">
            <text class="label">所在医疗机构</text>
            <text class="value">{{ item.hospitalName }}</text>
          </view>
          <view class="info-item">
            <text class="label">计划转运时间</text>
            <text class="value">{{ item.transportTime }}</text>
          </view>
          <view class="info-item">
            <text class="label">负责协调员</text>
            <text class="value">{{ item.coordinator }}</text>
          </view>
          <view class="info-item">
            <text class="label">创建时间</text>
            <text class="value">{{ item.createTime }}</text>
          </view>
        </view>
 
        <view class="footer">
          <view class="action-info">
            <text class="label">转运状态</text>
            <text class="transport-status">{{ item.statusText }}</text>
          </view>
          <view class="actions">
            <button
              class="action-btn"
              v-if="item.status === 'pending'"
              @tap.stop="startTransport(item)"
            >
              开始转运
            </button>
            <button
              class="action-btn"
              v-if="item.status === 'transporting'"
              @tap.stop="completeTransport(item)"
            >
              完成转运
            </button>
            <button
              class="action-btn secondary"
              @tap.stop="editTransport(item)"
            >
              编辑
            </button>
            <button class="action-btn secondary" @tap.stop="viewDetails(item)">
              查看详情
            </button>
          </view>
        </view>
      </view>
 
      <!-- 加载更多 -->
      <view class="load-more" v-if="hasMore">
        <text>加载中...</text>
      </view>
 
      <!-- 空状态 -->
      <view class="empty-state" v-if="filteredTransports.length === 0">
        <image src="/static/empty/no-transport.png" mode="aspectFit" />
        <text>暂无转运单记录</text>
      </view>
    </scroll-view>
 
    <!-- 操作确认弹窗 -->
    <view class="modal-mask" v-if="showActionModal">
      <view class="modal-content">
        <view class="modal-header">
          <text class="modal-title">{{ modalTitle }}</text>
        </view>
        <view class="modal-body">
          <text
            >确定要{{ modalAction }}转运单 "{{ currentTransport.caseNo }}"
            吗?</text
          >
        </view>
        <view class="modal-footer">
          <button class="modal-btn cancel" @tap="cancelAction">取消</button>
          <button class="modal-btn confirm" @tap="confirmAction">确认</button>
        </view>
      </view>
    </view>
  </view>
</template>
 
<script setup>
import { ref, computed } from "vue";
import { onLoad } from "@dcloudio/uni-app";
 
// 统计数据
const stats = ref({
  totalTransports: 12,
  pendingTransports: 4,
  completedTransports: 6,
});
const pageNum = ref(1);
const pageSize = ref(10);
// 操作确认弹窗相关
const showActionModal = ref(false);
const currentTransport = ref({});
const modalTitle = ref("");
const modalAction = ref("");
 
onLoad(async (options) => {
  // 初始化数据
  loadTransports();
});
 
// 筛选相关
const transportTypes = [
  { label: "全部", value: "all" },
  { label: "待出发", value: "pending" },
  { label: "转运中", value: "transporting" },
  { label: "已完成", value: "completed" },
  { label: "已取消", value: "cancelled" },
];
const currentType = ref("all");
const startDate = ref("");
const endDate = ref("");
 
// 转运单数据
const transports = ref([
  {
    id: "T20241217001",
    caseNo: "DON20241216001",
    donorName: "张三",
    gender: "男",
    age: 38,
    diagnosis: "脑外伤导致脑死亡",
    hospitalName: "青岛镜湖医院",
    transportTime: "2024-12-17 14:30",
    coordinator: "张医生",
    createTime: "2024-12-16 09:30",
    status: "pending",
    statusText: "待出发",
    departureLocation: "青岛市立医院急诊科",
    destinationHospital: "青岛镜湖医院",
  },
  {
    id: "T20241217002",
    caseNo: "DON20241216002",
    donorName: "李四",
    gender: "女",
    age: 45,
    diagnosis: "脑梗死",
    hospitalName: "青岛大学附属医院",
    transportTime: "2024-12-17 16:00",
    coordinator: "李医生",
    createTime: "2024-12-16 11:20",
    status: "transporting",
    statusText: "转运中",
    departureLocation: "青岛大学附属医院ICU",
    destinationHospital: "青岛器官移植中心",
  },
  {
    id: "T20241216003",
    caseNo: "DON20241215001",
    donorName: "王五",
    gender: "男",
    age: 52,
    diagnosis: "心脏骤停",
    hospitalName: "青岛市立医院",
    transportTime: "2024-12-16 10:15",
    coordinator: "王医生",
    createTime: "2024-12-15 14:45",
    status: "completed",
    statusText: "已完成",
    departureLocation: "青岛市立医院心内科",
    destinationHospital: "青岛器官移植中心",
  },
  {
    id: "T20241216004",
    caseNo: "DON20241214001",
    donorName: "赵六",
    gender: "女",
    age: 29,
    diagnosis: "急性肝衰竭",
    hospitalName: "青岛科大医院",
    transportTime: "2024-12-16 08:30",
    coordinator: "赵医生",
    createTime: "2024-12-14 16:20",
    status: "cancelled",
    statusText: "已取消",
    departureLocation: "青岛科大医院消化科",
    destinationHospital: "青岛器官移植中心",
  },
]);
 
// 筛选记录
const filteredTransports = computed(() => {
  let result = transports.value;
 
  // 状态筛选
  if (currentType.value !== "all") {
    result = result.filter((item) => item.status === currentType.value);
  }
 
  // 日期筛选
  if (startDate.value && endDate.value) {
    result = result.filter((item) => {
      const transportDate = item.createTime.split(" ")[0];
      return transportDate >= startDate.value && transportDate <= endDate.value;
    });
  }
 
  return result;
});
 
// 分页相关
const hasMore = ref(true);
const refreshing = ref(false);
 
// 选择类型
const selectType = (type) => {
  currentType.value = type;
};
 
// 日期选择
const onStartDateChange = (e) => {
  startDate.value = e.detail.value;
};
 
const onEndDateChange = (e) => {
  endDate.value = e.detail.value;
};
 
// 查看详情
const viewDetail = (item) => {
  uni.navigateTo({
    url: `/pages/transport/detail?id=${item.id}`,
  });
};
 
// 开始转运
const startTransport = (item) => {
  currentTransport.value = item;
  modalTitle.value = "开始转运";
  modalAction.value = "开始";
  showActionModal.value = true;
};
 
// 完成转运
const completeTransport = (item) => {
  currentTransport.value = item;
  modalTitle.value = "完成转运";
  modalAction.value = "完成";
  showActionModal.value = true;
};
 
// 确认操作
const confirmAction = () => {
  const index = transports.value.findIndex(
    (item) => item.id === currentTransport.value.id
  );
  if (index !== -1) {
    if (modalAction.value === "开始") {
      transports.value[index].status = "transporting";
      transports.value[index].statusText = "转运中";
      stats.value.pendingTransports -= 1;
    } else if (modalAction.value === "完成") {
      transports.value[index].status = "completed";
      transports.value[index].statusText = "已完成";
      stats.value.completedTransports += 1;
    }
 
    uni.showToast({
      title: `${modalAction.value}成功`,
      icon: "success",
    });
  }
  showActionModal.value = false;
};
 
// 取消操作
const cancelAction = () => {
  showActionModal.value = false;
};
 
// 查看详情
const viewDetails = (item) => {
  uni.navigateTo({
    url: `/pages/case/transferinfo?id=${item.id}`,
  });
};
 
// 编辑转运单
const editTransport = (item) => {
  uni.navigateTo({
    url: `/pages/case/transferinfo?id=${item.id}`,
  });
};
 
// 下拉刷新
const onRefresh = () => {
  refreshing.value = true;
  loadTransports();
  setTimeout(() => {
    refreshing.value = false;
  }, 1000);
};
 
// 加载更多
const onLoadMore = () => {
  if (!hasMore.value) return;
  loadTransports();
};
 
// 加载记录
const loadTransports = async () => {
 
  // 这里调用API加载数据
  setTimeout(() => {
    hasMore.value = false;
  }, 1000);
};
</script>
 
<style lang="scss" scoped>
.transport-record {
  min-height: 100vh;
  background: linear-gradient(135deg, #fafdff 0%, #e3f0ff 100%);
 
  .stats-card {
    margin: 20rpx;
    background: linear-gradient(135deg, #0071e3 0%, #2997ff 100%);
    border-radius: 32rpx;
    padding: 40rpx 30rpx;
    display: flex;
    align-items: center;
    box-shadow: 0 12px 48px 0 rgba(0, 113, 227, 0.15);
 
    .stat-item {
      flex: 1;
      text-align: center;
 
      .count {
        font-size: 40rpx;
        color: #fff;
        font-weight: bold;
        margin-bottom: 8rpx;
        display: block;
      }
 
      .label {
        font-size: 26rpx;
        color: rgba(255, 255, 255, 0.9);
      }
    }
 
    .divider {
      width: 2rpx;
      height: 60rpx;
      background: rgba(255, 255, 255, 0.2);
    }
  }
 
  .filter-bar {
    background: #fff;
    padding: 30rpx;
    margin: 0 20rpx 20rpx;
    border-radius: 24rpx;
    box-shadow: 0 4px 16px 0 rgba(0, 0, 0, 0.05);
 
    .type-filter {
      display: flex;
      margin-bottom: 30rpx;
      background: #f8f9fa;
      border-radius: 16rpx;
      padding: 8rpx;
 
      text {
        flex: 1;
        text-align: center;
        font-size: 28rpx;
        color: #86868b;
        padding: 16rpx 0;
        position: relative;
        white-space: nowrap;
        transition: all 0.3s ease;
 
        &.active {
          color: #0071e3;
          font-weight: 600;
          background: #fff;
          border-radius: 12rpx;
          box-shadow: 0 2rpx 8rpx rgba(0, 113, 227, 0.15);
 
          &::after {
            content: "";
            position: absolute;
            left: 50%;
            bottom: 0;
            transform: translateX(-50%);
            width: 40rpx;
            height: 4rpx;
            background: #0071e3;
            border-radius: 2rpx;
          }
        }
      }
    }
 
    .date-filter {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 20rpx;
 
      picker {
        flex: 1;
 
        text {
          display: block;
          text-align: center;
          font-size: 26rpx;
          color: #515154;
          padding: 20rpx;
          background: #f8f9fa;
          border-radius: 16rpx;
          white-space: nowrap;
          overflow: hidden;
          text-overflow: ellipsis;
          transition: all 0.3s ease;
 
          &:active {
            background: #e9ecef;
          }
        }
      }
 
      .separator {
        padding: 0 10rpx;
        font-size: 26rpx;
        color: #86868b;
        min-width: 40rpx;
        text-align: center;
      }
    }
  }
 
  .transport-list {
    height: calc(100vh - 400rpx);
    // padding: 0 20rpx;
 
    .transport-item {
      margin: 20rpx;
      background: linear-gradient(135deg, #fff 60%, #f5f6fa 100%);
      border-radius: 32rpx;
      padding: 40rpx 30rpx;
      margin-bottom: 24rpx;
      box-shadow: 0 12px 48px 0 rgba(0, 113, 227, 0.1);
      border: 1.5px solid #e5eaf0;
      transition: all 0.3s ease;
 
      &:active {
        transform: translateY(-2rpx);
        box-shadow: 0 16px 56px 0 rgba(0, 113, 227, 0.15);
      }
 
      .header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        margin-bottom: 30rpx;
 
        .case-info {
          .info {
            .case-no {
              font-size: 28rpx;
              font-weight: 600;
              color: #0071e3;
              margin-bottom: 8rpx;
              display: block;
            }
 
            .patient {
              font-size: 26rpx;
              color: #515154;
              font-weight: 500;
            }
          }
        }
 
        .status {
          font-size: 22rpx;
          padding: 8rpx 20rpx;
          border-radius: 20rpx;
          font-weight: 500;
 
          &.pending {
            color: #ff9500;
            background: rgba(255, 149, 0, 0.1);
          }
 
          &.transporting {
            color: #007aff;
            background: rgba(0, 122, 255, 0.1);
          }
 
          &.completed {
            color: #34c759;
            background: rgba(52, 199, 89, 0.1);
          }
 
          &.cancelled {
            color: #ff3b30;
            background: rgba(255, 59, 48, 0.1);
          }
        }
      }
 
      .detail-info {
        padding: 30rpx 0;
        border-top: 1.5px solid #f0f0f0;
        border-bottom: 1.5px solid #f0f0f0;
 
        .info-item {
          display: flex;
          justify-content: space-between;
          margin-bottom: 20rpx;
          align-items: flex-start;
 
          &:last-child {
            margin-bottom: 0;
          }
 
          .label {
            font-size: 26rpx;
            color: #86868b;
            min-width: 160rpx;
          }
 
          .value {
            font-size: 26rpx;
            color: #1d1d1f;
            flex: 1;
            text-align: right;
            font-weight: 500;
            line-height: 1.4;
          }
        }
      }
 
      .footer {
        padding-top: 30rpx;
        display: flex;
        justify-content: space-between;
        align-items: center;
 
        .action-info {
          .label {
            font-size: 26rpx;
            color: #86868b;
            margin-right: 12rpx;
          }
 
          .transport-status {
            font-size: 28rpx;
            color: #0071e3;
            font-weight: 600;
          }
        }
 
        .actions {
          display: flex;
          gap: 16rpx;
 
          .action-btn {
            height: 60rpx;
            line-height: 60rpx;
            padding: 0 24rpx;
            font-size: 24rpx;
            color: #0071e3;
            background: rgba(0, 113, 227, 0.1);
            border-radius: 30rpx;
            font-weight: 500;
            transition: all 0.3s ease;
 
            &.secondary {
              color: #515154;
              background: #f5f5f7;
            }
 
            &:active {
              transform: scale(0.95);
            }
          }
        }
      }
    }
 
    .empty-state {
      padding: 120rpx 0;
      text-align: center;
 
      image {
        width: 240rpx;
        height: 240rpx;
        margin-bottom: 30rpx;
        opacity: 0.6;
      }
 
      text {
        font-size: 28rpx;
        color: #86868b;
      }
    }
  }
 
  /* 操作确认弹窗样式 */
  .modal-mask {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
  }
 
  .modal-content {
    background: #fff;
    border-radius: 32rpx;
    width: 600rpx;
    overflow: hidden;
    box-shadow: 0 20rpx 60rpx rgba(0, 0, 0, 0.2);
  }
 
  .modal-header {
    padding: 40rpx 40rpx 20rpx;
    text-align: center;
  }
 
  .modal-title {
    font-size: 32rpx;
    font-weight: 600;
    color: #1d1d1f;
  }
 
  .modal-body {
    padding: 20rpx 40rpx 40rpx;
    text-align: center;
    font-size: 28rpx;
    color: #515154;
    line-height: 1.6;
  }
 
  .modal-footer {
    display: flex;
    border-top: 1.5px solid #f0f0f0;
  }
 
  .modal-btn {
    flex: 1;
    height: 88rpx;
    line-height: 88rpx;
    font-size: 28rpx;
    border: none;
    border-radius: 0;
    background: transparent;
    transition: all 0.3s ease;
 
    &.cancel {
      color: #515154;
      border-right: 1.5px solid #f0f0f0;
 
      &:active {
        background: #f8f9fa;
      }
    }
 
    &.confirm {
      color: #0071e3;
      font-weight: 600;
 
      &:active {
        background: #f0f7ff;
      }
    }
  }
}
</style>