Blame view

pages-sub/daily/patrol-manage/finish-plan-detail/index.vue 5.34 KB
5cb33b90   刘淇   完成巡查计划 详情
1
2
3
4
5
6
7
8
9
  <template>
    <view class="u-page">
      <!-- 页面级加载组件 -->
      <up-loading-page
          v-if="loading"
          :loading="true"
          title="加载中..."
          color="#3c9cff"
      ></up-loading-page>
a7c9cfdc   刘淇   巡查计划
10
  
5cb33b90   刘淇   完成巡查计划 详情
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
      <!-- 内容容器 -->
      <view v-else class="content-wrap">
  
  
        <template v-for="(i, index) in orderDetail" :key="index">
          <!-- 工单详情内容 -->
          <up-cell-group :border="false" inset style="margin: 20rpx;">
            <!-- 1. 工单编号 -->
            <up-cell
                :title="i.planName"
  
                class="up-line-1"
                align="middle"
            ></up-cell>
  
            <!-- 2. 工单位置 -->
            <up-cell
                title="计划编码"
                :value="i.planNo || '--'"
                class="up-line-1"
                align="middle"
            ></up-cell>
  
            <!-- 3. 工单名称 -->
            <up-cell
                title="养护周期"
                :value="`${i.rate}${uni.$dict.getDictLabel('cycle_id_type', i.cycleId)}`"
                class="up-line-1"
                align="middle"
            ></up-cell>
  
            <!-- 4. 情况描述 -->
            <up-cell
                title="计划有效期"
                :value="`${timeFormat(i.beginTime,'yy-mm-dd hh:MM:ss')} 至 ${timeFormat(i. endTime,'yy-mm-dd hh:MM:ss')}`"
                class="up-line-1"
                align="middle"
            ></up-cell>
  
            <!-- 5. 问题照片(核心修复:判断条件+空值处理) -->
            <up-cell title="照片" >
              <template #value>
                <view class="cell-content-wrap">
  
                  <!-- 修复1:正确判断problemImgsList,补充空数组默认值 -->
                  <up-album
                      v-if="!!i.imgList?.length"
                      :urls="i.imgList || []"
                      singleSize="70"
                      :preview-full-image="true"
  
                  ></up-album>
                  <text v-else class="empty-text">暂无问题照片</text>
                </view>
              </template>
            </up-cell>
  
            <!-- 7. 处理结果 -->
            <up-cell
                title="巡查描述"
                :value="i.remark || '--'"
                class="up-line-1"
                align="middle"
                :border="false"
            ></up-cell>
  
            <up-cell
                title="提交时间"
                :value="timeFormat(i.finishTime,'yy-mm-dd hh:MM:ss') || '--'"
                class="up-line-1"
                align="middle"
                :border="false"
            ></up-cell>
  
  
            <up-cell
                title="提交人"
                :value="i.userName || '--'"
                class="up-line-1"
                align="middle"
                :border="false"
            ></up-cell>
          </up-cell-group>
        </template>
a7c9cfdc   刘淇   巡查计划
95
  
a7c9cfdc   刘淇   巡查计划
96
  
5cb33b90   刘淇   完成巡查计划 详情
97
98
      </view>
    </view>
a7c9cfdc   刘淇   巡查计划
99
100
  </template>
  
5cb33b90   刘淇   完成巡查计划 详情
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
  <script setup lang="ts">
  import { ref, reactive } from 'vue';
  import { inspectioDetailByPlanno } from "@/api/patrol-manage/patrol-plan";
  import { onLoad, onShow } from '@dcloudio/uni-app';
  import { timeFormat } from '@/uni_modules/uview-plus';
  // 状态管理
  const loading = ref(true);
  const orderDetail = ref([]);
  
  
  /**
   * 获取工单详情
   */
  const getOrderDetail = async (plan_no: string) => {
    try {
      loading.value = true;
      const res = await inspectioDetailByPlanno({ plan_no });
      console.log('接口返回:', res);
      // 优化:确保图片数组为数组类型,避免非数组导致渲染错误
      orderDetail.value = {
        ...res,
        problemImgsList: Array.isArray(res.problemImgsList) ? res.problemImgsList : [],
        completeImgsList: Array.isArray(res.completeImgsList) ? res.completeImgsList : []
      };
    } catch (error) {
      console.error('获取工单详情失败:', error);
      uni.showToast({ title: '加载失败,请重试', icon: 'none' });
    } finally {
      loading.value = false;
    }
  };
  
  // 页面加载
  onLoad((options) => {
    const { planNo } = options;
    if (planNo) {
      getOrderDetail(planNo);
    } else {
      loading.value = false;
      uni.showToast({ title: '缺少工单ID', icon: 'none' });
    }
  });
  </script>
  
a7c9cfdc   刘淇   巡查计划
145
  <style scoped lang="scss">
5cb33b90   刘淇   完成巡查计划 详情
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
  // 页面基础样式
  .u-page {
    min-height: 100vh;
    background-color: #f5f5f5;
    box-sizing: border-box;
  }
  
  // 内容容器
  .content-wrap {
    background: #fff;
    width: 100%;
    box-sizing: border-box;
    overflow-y: auto;
    min-height: calc(100vh - 40rpx);
  }
  
  
  
  // 空文本样式
  .empty-text {
    color: #999;
    font-size: 28rpx;
    line-height: 80rpx;
    display: block;
    text-align: left;
  }
  
  // 优化uview组件样式
  :deep(.up-cell-group) {
    --u-cell-group-background-color: #fff;
    --u-cell-group-border-radius: 12rpx;
    --u-cell-group-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
  }
  
  :deep(.up-cell) {
    --u-cell-title-font-size: 28rpx;
    --u-cell-value-font-size: 28rpx;
    --u-cell-title-color: #666;
    --u-cell-value-color: #333;
    --u-cell-padding: 20rpx 15rpx;
    --u-cell-border-color: #f5f5f5;
  }
  
  // 相册样式优化(关键:适配图片展示)
  :deep(.up-album) {
    width: 100%;
    box-sizing: border-box;
  }
  
  :deep(.up-album__list) {
    display: flex;
    flex-wrap: wrap;
    padding: 0;
    margin: 0;
  }
  
  :deep(.up-album__item) {
    width: calc(33.333% - 10rpx);
    height: 200rpx; // 固定图片高度,避免变形
    margin: 5rpx;
    border-radius: 8rpx;
    overflow: hidden;
    background-color: #f8f8f8;
  }
  
  :deep(.up-album__image) {
    width: 100%;
    height: 100%;
    object-fit: cover; // 图片裁剪填充,避免拉伸
  }
  
a7c9cfdc   刘淇   巡查计划
217
218
  
  </style>