Commit df24e712b80a87c155fbe86ef7563377d2e8ad42

Authored by 刘淇
1 parent ec13a95c

养护计划 添加 待优化

pages-sub/daily/maintain-manage/add-record.vue
1 <template> 1 <template>
2 - <view class="u-page"> 2 + <view class="page-container">
3 <!-- 核心:将所有 up-form-item 包裹在同一个 up-form 内 --> 3 <!-- 核心:将所有 up-form-item 包裹在同一个 up-form 内 -->
4 <view class="inspect-form-content commonPageLRpadding"> 4 <view class="inspect-form-content commonPageLRpadding">
5 <up-form 5 <up-form
@@ -42,7 +42,7 @@ @@ -42,7 +42,7 @@
42 ></up-upload> 42 ></up-upload>
43 </up-form-item> 43 </up-form-item>
44 44
45 - <!-- 3. 完成进度(滑块) --> 45 + <!-- 3. 完成进度(滑块)- 核心修改:min绑定initProgress -->
46 <up-form-item 46 <up-form-item
47 label="完成进度" 47 label="完成进度"
48 prop="progress" 48 prop="progress"
@@ -52,17 +52,18 @@ @@ -52,17 +52,18 @@
52 <view class="progress-wrap"> 52 <view class="progress-wrap">
53 <up-slider 53 <up-slider
54 v-model="inspectForm.progress" 54 v-model="inspectForm.progress"
55 - :min="initProgress"  
56 - :max="100"  
57 -  
58 - active-color="#1989fa"  
59 - inactive-color="#e5e5e5"  
60 - block-size="24"  
61 - class="progress-slider" 55 + :min="0"
  56 + :max="100"
  57 + active-color="#1989fa"
  58 + inactive-color="#e5e5e5"
  59 + block-size="24"
  60 + class="progress-slider"
  61 + @change="handleProgressChange"
62 ></up-slider> 62 ></up-slider>
63 <view class="progress-value">{{ inspectForm.progress }}%</view> 63 <view class="progress-value">{{ inspectForm.progress }}%</view>
  64 + <!-- 优化提示文案:动态显示初始进度值 -->
64 <view class="progress-tips" v-if="inspectForm.progress <= initProgress"> 65 <view class="progress-tips" v-if="inspectForm.progress <= initProgress">
65 - 进度低于等于{{ initProgress }}%,无法调整 66 + 进度不能低于或等于{{ initProgress }}%,请调整
66 </view> 67 </view>
67 </view> 68 </view>
68 </up-form-item> 69 </up-form-item>
@@ -135,7 +136,7 @@ export default { @@ -135,7 +136,7 @@ export default {
135 message: '请设置完成进度', 136 message: '请设置完成进度',
136 trigger: ['change'], 137 trigger: ['change'],
137 validator: (rule, value, callback) => { 138 validator: (rule, value, callback) => {
138 - // 自定义校验:进度必须大于初始进度值 139 + // 自定义校验:进度必须大于初始进度值(兜底校验)
139 if (value <= this.initProgress) { 140 if (value <= this.initProgress) {
140 callback(new Error(`完成进度必须大于${this.initProgress}%`)) 141 callback(new Error(`完成进度必须大于${this.initProgress}%`))
141 } else { 142 } else {
@@ -152,9 +153,9 @@ export default { @@ -152,9 +153,9 @@ export default {
152 this.paramsOptins = option 153 this.paramsOptins = option
153 154
154 // 从URL参数中获取进度值,默认0 155 // 从URL参数中获取进度值,默认0
155 - this.initProgress = option.progress ? Number(option.progress) : 0  
156 - // 设置表单初始进度值  
157 - this.inspectForm.progress = this.initProgress 156 + this.initProgress = option.finishPercent ? Number(option.finishPercent) : 0
  157 + // 设置表单初始进度值(若初始进度>0,默认设为初始进度+1,避免刚进入就提示)
  158 + this.inspectForm.progress = this.initProgress + 1 || 1
158 159
159 console.log('初始进度值:', this.initProgress) 160 console.log('初始进度值:', this.initProgress)
160 }, 161 },
@@ -165,6 +166,21 @@ export default { @@ -165,6 +166,21 @@ export default {
165 }, 166 },
166 methods: { 167 methods: {
167 /** 168 /**
  169 + * 新增:进度滑块拖动后校验(兜底,防止手动修改值)
  170 + */
  171 + handleProgressChange(val) {
  172 + // 若拖动后值<=初始进度,强制重置为初始进度+1
  173 + if (val <= this.initProgress) {
  174 + this.inspectForm.progress = this.initProgress + 1
  175 + uni.showToast({
  176 + title: `进度不能低于${this.initProgress}%`,
  177 + icon: 'none',
  178 + duration: 1500
  179 + })
  180 + }
  181 + },
  182 +
  183 + /**
168 * 删除图片 184 * 删除图片
169 */ 185 */
170 deleteImg(event) { 186 deleteImg(event) {
@@ -300,7 +316,7 @@ export default { @@ -300,7 +316,7 @@ export default {
300 // 延迟跳转(等待提示框显示完成) 316 // 延迟跳转(等待提示框显示完成)
301 setTimeout(() => { 317 setTimeout(() => {
302 uni.redirectTo({ 318 uni.redirectTo({
303 - url: '/pages-sub/daily/maintain-manage/road-detail-list' 319 + url: '/pages-sub/daily/maintain-manage/index'
304 }) 320 })
305 }, 1000) 321 }, 1000)
306 322
@@ -327,11 +343,7 @@ export default { @@ -327,11 +343,7 @@ export default {
327 </script> 343 </script>
328 344
329 <style lang="scss" scoped> 345 <style lang="scss" scoped>
330 -// 全局页面样式  
331 -.u-page {  
332 - background-color: #f5f5f5;  
333 - min-height: 100vh;  
334 -} 346 +
335 347
336 // 巡查表单内容容器 348 // 巡查表单内容容器
337 .inspect-form-content { 349 .inspect-form-content {
@@ -362,10 +374,5 @@ export default { @@ -362,10 +374,5 @@ export default {
362 } 374 }
363 } 375 }
364 376
365 -// 表单项目间距  
366 -.form-item {  
367 - margin-bottom: 20rpx;  
368 -}  
369 -  
370 377
371 </style> 378 </style>
372 \ No newline at end of file 379 \ No newline at end of file
pages-sub/daily/maintain-manage/finish-plan-detail.vue
1 <template> 1 <template>
2 - <view class="u-page"> 2 + <view class="page-container">
3 <!-- 页面级加载组件 --> 3 <!-- 页面级加载组件 -->
4 <up-loading-page 4 <up-loading-page
5 v-if="loading" 5 v-if="loading"
pages-sub/daily/maintain-manage/pending-plan-detail.vue
@@ -93,12 +93,14 @@ const batchNo = ref(&#39;&#39;) @@ -93,12 +93,14 @@ const batchNo = ref(&#39;&#39;)
93 const planNo = ref('') 93 const planNo = ref('')
94 const finishState = ref('') 94 const finishState = ref('')
95 const planTypeId = ref('') 95 const planTypeId = ref('')
  96 +const finishPercent = ref('')
96 97
97 // 页面加载接收参数(逻辑完全保留) 98 // 页面加载接收参数(逻辑完全保留)
98 onLoad((options) => { 99 onLoad((options) => {
99 planNo.value = options.planNo; 100 planNo.value = options.planNo;
100 finishState.value = options.finishState 101 finishState.value = options.finishState
101 planTypeId.value = options.planTypeId 102 planTypeId.value = options.planTypeId
  103 + finishPercent.value = options.finishPercent
102 }); 104 });
103 105
104 // 页面显示时请求数据(逻辑完全保留) 106 // 页面显示时请求数据(逻辑完全保留)
@@ -135,7 +137,7 @@ const gotoFinishPlanDetail = (i) =&gt; { @@ -135,7 +137,7 @@ const gotoFinishPlanDetail = (i) =&gt; {
135 // 新增记录(逻辑完全保留) 137 // 新增记录(逻辑完全保留)
136 const addNewRecord = () => { 138 const addNewRecord = () => {
137 uni.navigateTo({ 139 uni.navigateTo({
138 - url: `/pages-sub/daily/maintain-manage/add-record?planNo=${planInfo.value[0].planNo}&batchNo=${batchNo.value}`, 140 + url: `/pages-sub/daily/maintain-manage/add-record?planNo=${planNo.value}&finishPercent=${finishPercent.value}`,
139 }); 141 });
140 }; 142 };
141 </script> 143 </script>
@@ -144,6 +146,4 @@ const addNewRecord = () =&gt; { @@ -144,6 +146,4 @@ const addNewRecord = () =&gt; {
144 .page-container { 146 .page-container {
145 147
146 } 148 }
147 -  
148 -  
149 </style> 149 </style>
150 \ No newline at end of file 150 \ No newline at end of file
pages-sub/daily/maintain-manage/record-detail-list.vue
1 <template> 1 <template>
2 - <view class="u-page"> 2 + <view class="page-container">
3 <!-- 页面级加载组件 --> 3 <!-- 页面级加载组件 -->
4 <up-loading-page 4 <up-loading-page
5 v-if="loading" 5 v-if="loading"