liuying
2025-09-24 16edbbe772e24eb71f6519558576d513e3cf2746
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
<template>
    <default-header-page-layout ref="page" title="班组维护">
        <view class="page-frame with-action-user-row" :style="{height:pageBodyHeight+'px'}" v-if="pageBodyHeight">
            <action-user-row />
            <view class="with-action-user-row-page-content">
                <view class="content">
                    <view class="card" v-for="(item,index) in data" :key="index">
                        <view class="card-title">班组名称:{{item.shiftName}}</view>
                        <u-row
                            style="justify-content:space-between;width:100%;flex-wrap: wrap;border-bottom: 2rpx solid #eee;padding-bottom:10rpx;">
                            <!-- <u-col span="12">
                                <u-row style="width:100%;flex-wrap: wrap;">
                                    <u-col span="4">:</u-col>
                                    <u-col span="8">{{item.}}</u-col>
                                </u-row>
                            </u-col> -->
 
                            <u-col span="12">
                                <u-row style="width:100%">
                                    <u-col span="4">是否隔日:</u-col>
                                    <u-col span="8">{{item.isNextDay?'是':'否'}}</u-col>
                                </u-row>
                            </u-col>
                            <u-col span="12">
                                <view class="demo-layout bg-purple card-item">
                                    <u-row>
                                        <u-col :span="4">开始时间:</u-col>
                                        <u-col :span="8">{{item.shiftStartTime}}</u-col>
                                    </u-row>
                                </view>
                            </u-col>
                            <u-col :span="12">
                                <u-row style="width:100%">
                                    <u-col span="4">结束时间:</u-col>
                                    <u-col span="8">{{item.shiftEndTime}}</u-col>
                                </u-row>
                            </u-col>
 
                            <u-col span="12">
                                <u-row style="width:100%">
                                    <u-col span="4">班组长:</u-col>
                                    <u-col span="8">{{item.shiftRemark}}</u-col>
                                </u-row>
                            </u-col>
                        </u-row>
                        <view class="card-action">
                            <u-button @click="toCreateShift('edit',item)"
                                style="width:150rpx;height:60rpx;margin: 10rpx 0 0;" text="修改"
                                type="primary"></u-button>
                        </view>
                    </view>
                </view>
 
            </view>
        </view>
 
        <!-- 新增班组 -->
        <template v-slot:footer>
            <view class="bottom-btns-row" v-if="data.length<2">
                <template>
                    <div class="btn-frame">
                        <u-button size="large" text="新增班组" :custom-style="{backgroundColor:'#F18201',color:'#fff'}"
                            @click="toCreateShift('add')"></u-button>
                    </div>
                </template>
            </view>
        </template>
    </default-header-page-layout>
</template>
 
<script>
    import DefaultHeaderPageLayout from '@/components/DefaultHeaderPageLayout.vue'
    import ActionUserRow from '@/components/ActionUserRow.vue'
    import {
        getShiftInfo
    } from '@/api/shift/index.js'
    import qs from 'qs'
    export default {
        name: 'shift',
        components: {
            DefaultHeaderPageLayout,
            ActionUserRow
        },
        data() {
            return {
                pageBodyHeight: 0,
                data: []
            }
        },
        created() {
            this.getShiftInfo()
        },
        methods: {
 
            // 跳转到创建巡检任务页面
            toCreateShift(type, item = {}) {
                item.type = type
                uni.navigateTo({
                    url: `/pages/shift/addOrEditShift?${qs.stringify(item)}`
                })
            },
 
            // 获取班组数据
            async getShiftInfo() {
                try {
                    let {
                        data
                    } = await getShiftInfo({
                        pageNo: 1,
                        pageSize: 10
                    })
                    console.log(data.rows);
                    this.data = data.rows
                } catch (e) {
                    //TODO handle the exception
                    console.log(e);
                }
            },
 
            /* 页面初始化获取页面body高度的定时器 */
            startInitInterval(callback) {
                this.initInterVal = setInterval(() => {
                    if (this.pageBodyHeight) {
                        this.clearInitInterval()
                        callback && callback()
                    } else {
                        this.pageBodyHeight = this.$refs.page.getBodyHeight()
                    }
                }, 200)
            },
            /* 清除定时器 */
            clearInitInterval() {
                try {
                    clearInterval(this.initInterVal)
                    this.initInterVal = null
                } catch (e) {
                    //TODO handle the exception
                }
            }
        },
        onReady() {
            this.startInitInterval(() => {
                /* 页面初始化后需要执行的代码在这边调用 */
            })
        },
        onUnload() {
            this.clearInitInterval()
        }
    }
</script>
 
<style lang="scss">
    .content {
        // width:100%;
        height: auto;
        margin: 0 20rpx;
 
 
 
        .card {
            // width: 100%;
            height: auto;
            background-color: #fff;
            border-radius: 10rpx;
            padding: 10rpx 20rpx;
            margin-bottom: 20rpx;
            font-size: 40rpx;
 
            .card-title {
                font-size: 50rpx;
                font-weight: 700;
                padding-bottom: 5rpx;
                border-bottom: 2rpx solid #eee;
            }
 
            .card-item {
                padding: 10rpx 0 0;
            }
 
            .card-action {
                width: 100%;
                display: flex;
                justify-content: flex-end;
                align-items: center;
            }
        }
 
 
    }
 
    ::v-deep .u-button__text {
        font-size: 40rpx !important;
    }
 
    .bottom-btns-row {
        display: flex;
        padding: 10rpx 0;
        background-color: #fff;
 
        .btn-frame {
            width: 90%;
            box-sizing: border-box;
            margin: 10rpx auto;
            font-weight: bold;
            border-radius: 5px;
        }
    }
</style>