pending-plan-detail.vue
4.61 KB
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
<template>
<view class="page-container">
<!-- 计划详情卡片区域(复用目标卡片结构) -->
<view class="common-card-list">
<up-card
:border="false"
:foot-border-top="false"
v-for="(i, index) in planInfo"
:key="`${i.planNo}_${index}`"
>
<!-- 自定义标题区域(计划名称) -->
<template #head>
<view class="card-header">
<view class="common-card-title u-line-1">{{ i.planName || '无计划名称' }}</view>
</view>
</template>
<!-- 卡片主体内容(原详情项) -->
<template #body>
<view class="card-body">
<!-- 计划编码 -->
<view class="u-body-item u-flex">
<view class="u-body-item-title">计划编码:</view>
<view class="u-line-1 u-body-value">{{ i.planNo || '-' }}</view>
</view>
<!-- 养护周期 -->
<view class="u-body-item u-flex">
<view class="u-body-item-title">养护周期:</view>
<view class="u-line-1 u-body-value">
{{ i.rate || '-' }} {{ uni.$dict.getDictLabel('cycle_id_type', i.cycleId) }}
</view>
</view>
<!-- <!– 计划完成次数 –>-->
<!-- <view class="u-body-item u-flex">-->
<!-- <view class="u-body-item-title">计划完成次数:</view>-->
<!-- <view class="u-line-1 u-body-value">{{ i.planNum || 0 }} 次</view>-->
<!-- </view>-->
<!-- 已完成次数 + 查看记录按钮 -->
<view class="u-body-item u-flex common-item-center common-justify-between">
<view class="u-body-item-title">已完成比例: {{ i.finishPercent || 0 }} %</view>
<view class="u-line-1">
<up-button
type="primary"
size="mini"
@click="gotoFinishPlanDetail(i)"
class="submit-record-btn"
:style="{ width: '80px', height: '28px', fontSize: '14px', borderRadius: 4 }"
>
查看记录
</up-button>
</view>
</view>
<!-- 计划有效期 -->
<view class="u-body-item u-flex">
<view class="u-body-item-title">计划有效期:</view>
<view class="u-line-1 u-body-value">
{{ timeFormat(i.beginTime, 'yyyy-mm-dd') || '-' }} 至
{{ timeFormat(i.endTime, 'yyyy-mm-dd') || '-' }}
</view>
</view>
</view>
</template>
</up-card>
<!-- 底部新增记录按钮 -->
<view class="fixed-bottom-btn-wrap" v-if="finishState==1">
<up-button
type="primary"
size="default"
@click="addNewRecord"
:style="{ width: '100%', height: '88rpx', fontSize: '32rpx', borderRadius: 0 }"
>
新增记录
</up-button>
</view>
</view>
</view>
</template>
<script setup>
import { timeFormat } from '@/uni_modules/uview-plus';
import { ref } from 'vue';
import { onLoad, onShow } from '@dcloudio/uni-app';
import { notFinish } from "@/api/maintain-manage/maintain-manage";
// 响应式数据定义(逻辑完全保留)
const planInfo = ref([]);
const batchNo = ref('')
const planNo = ref('')
const finishState = ref('')
const planTypeId = ref('')
// 页面加载接收参数(逻辑完全保留)
onLoad((options) => {
planNo.value = options.planNo;
finishState.value = options.finishState
planTypeId.value = options.planTypeId
});
// 页面显示时请求数据(逻辑完全保留)
onShow(() => {
if (!planNo.value) {
uni.showToast({
title: '计划ID不存在',
icon: 'none'
});
return;
}
getPlanDetail();
});
// 获取计划详情(逻辑完全保留)
const getPlanDetail = async () => {
const queryData = {
planNo: planNo.value,
planTypeId: planTypeId.value
}
console.log(queryData)
const planInfoRes = await notFinish(queryData)
planInfo.value = planInfoRes
console.log(planInfoRes)
};
// 跳转到已完成计划明细(逻辑完全保留)
const gotoFinishPlanDetail = (i) => {
uni.navigateTo({
url: `/pages-sub/daily/maintain-manage/finish-plan-detail?planNo=${i.planNo}`
});
};
// 新增记录(逻辑完全保留)
const addNewRecord = () => {
uni.navigateTo({
url: `/pages-sub/daily/maintain-manage/add-record?planNo=${planInfo.value[0].planNo}&batchNo=${batchNo.value}`,
});
};
</script>
<style scoped lang="scss">
.page-container {
}
</style>