subList.vue
2.12 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
<template>
<view class="container">
<tui-list-cell :hover="false" v-for="(item, index) in dataList">
<view class="fs-flex__between">
<view>{{item.planNo}}({{item.currentPlanNum}})</view>
<view>完成比例 <tui-text :text="item.totalFinishPercent" type="danger"></tui-text>%</view>
</view>
<view class="fs-mt20 fs-align__right">
<tui-tag v-if="item.totalFinishPercent < 100" type="primary" padding="12rpx 30rpx" shape="circle" plain @click="toAdd(item.planNo, item.currentPlanNum, item.totalFinishPercent)">添加记录</tui-tag>
<tui-tag type="primary" padding="12rpx 30rpx" margin="0 0 0 20rpx" shape="circle" plain @click="toRecord(item.planNo, item.currentPlanNum)">提交记录</tui-tag>
</view>
</tui-list-cell>
</view>
</template>
<script>
import { apiMaintainSubList, apiInspectionDetail } from '@/api/work'
export default {
data() {
return {
info: {},
dataList: []
}
},
onLoad(options) {
this.getList(options.planNo)
this.getInspectionInfo(options.planNo)
},
methods: {
// 获取次数列表
getList(planNo) {
apiMaintainSubList({data:{plan_no:planNo}}).then(res => {
this.dataList = res.data
})
},
// 获取养护详情
getInspectionInfo(planNo) {
apiInspectionDetail({data:{plan_no:planNo}}).then(res => {
this.info = res.data
})
},
// 跳转记录添加
toAdd(planNo, currentPlanNum, totalFinishPercent) {
let path = 'water'
// switch (this.info.maintainTypeId) {
// case 2:
// path = 'water'
// break
// case 3:
// path = 'trim'
// break
// case 4:
// path = 'prevention'
// break
// case 5:
// path = 'weed'
// break
// case 10:
// path = 'manure'
// break
// }
uni.$tui.href(`/pages/work/daily/maintain/${path}?plan_no=${planNo}¤t_plan_num=${currentPlanNum}&total_finish_percent=${totalFinishPercent}`)
},
// 跳转记录
toRecord(planNo, currentPlanNum) {
uni.$tui.href(`/pages/work/daily/maintain/record?plan_no=${planNo}&maintainTypeId=${this.info.maintainTypeId}¤t_plan_num=${currentPlanNum}`)
}
}
}
</script>
<style lang="scss" scoped>
</style>