#
whycq
2023-11-24 e680ee8cc2c34ec2d21c238e8110e4f1501eb8bc
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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
<template>
    <view>
        <view class="status_bar">
            <!-- 这里是状态栏 -->
        </view>
        <uni-nav-bar left-icon="left" title="出差" @clickLeft="back" @clickRight="scan" :fixed="true" :border="false"
            rightWidth="160rpx" leftWidth="160rpx">
            <block slot="right">
                <view class="city">
                    <view>
                        <text class="uni-nav-bar-text">{{user.username}}</text>
                    </view>
                    <uni-icons type="arrowdown" color="#333333" size="20" />
                </view>
            </block>
        </uni-nav-bar>
        
        <!-- 搜索框 -->
        <view class="search-bg">
            <u-search placeholder="输入" v-model="keyword" :clearabled="true" @custom="search()" @search="search()"></u-search>
        </view>
 
        <view class="main-box">
            <view class="box" v-for="item in list" @click="goDetl(item)">
                <view style="display: flex;">
                    <view class="box-title" style="flex: 1;">{{item.userId$}}提交的出差申请</view>
                    <view class="box-time">{{item.createTime$.substring(0,10)}}</view>
                </view>
                <view class="box-item">出差事由:{{item.businessTripReasons}}</view>
                <view class="box-item">出差天数:{{item.businessTripDays$}}</view>
                <view style="display: flex;">
                    <view class="box-item" style="flex: 1;">同行人:{{item.businessPeers}}</view>
                    <view class="box-settle" :style="item.bgcolor">{{item.settle$}}</view>
                </view>
            </view>
        </view>
        
        <u-empty v-if="true" icon="../../../static/image/emptyList.png" v-show="list.length <= 0" />
        <view class="fxbtn">
            <uni-icons type="plusempty" color="#fff" @click="add()" ></uni-icons>
        </view>
 
        <!-- 垫底 -->
        <view style="height: 120rpx;"></view>
    </view>
</template>
 
<script>
    import user from '@/pages/api/user/user.js'
    export default {
        data() {
            return {
                keyword: '',
                user: {
                    username: '',
                    id: 0,
                    type: 'user_id'
                },
                falg: true,
                list: [{
                        businessTripReasons: '沟通立库事宜',
                        businessTransportation$: '交通工具',
                        businessStartAddr$: '出发地',
                        businessEndAddr$: '目的地',
                        businessStartTimeDay$: '出发日期',
                        businessEndTimeDay$: '结束日期',
                        businessDuration$: '出差时长',
                        businessTripDays$: '出差天数',
                        businessPeers: '同行人',
                        userId$: '申请人',
                        orderId: '跟踪项目',
                        updateTime$: '更新时间',
                        updateId$: '更新人员',
                        settle: 1,
                        settle$: '申请通过',
                        businessNotes: '出差备注',
                        createTime$: '2023-11-06 08:51:24',
                        bgcolor: 'color:#24ab59'
                    },
                ]
            }
        },
        onShow() {
            let that = this
            uni.$on('isRefresh',function(data){
                that.user.username = data.title
                that.user.id = data.id
                that.user.type = data.key
                that.falg = false
            })
            setTimeout(()=> {
                this.getBusinessTrip()
            },50)
            if (this.falg) {
                this.getDetail()
            }
        },
        methods: {
            async getDetail() {
                let res = await user.getDetail()
                if (res.code === 200) {
                    this.user.username = res.data.username
                    this.user.id = res.data.id
                } else if (res.code === 403) {
                    this.backLogin(res)
                }
            },
            goDetl(e) {
                uni.navigateTo({
                    url: '/pages/business/goBusiness/goBusinessDetil',
                    success: function(res) {
                        res.eventChannel.emit('busunessDetl', {
                            data: e
                        })
                    }
                })
            },
            getBusinessTrip() {
                let _this = this
                let param = {curr:1,limit:16,dept_id: 0,user_id: 67}
                if (_this.user.type == 'user_id') {
                    param = {curr:1,limit:16,user_id: _this.user.id}
                } else if(_this.user.type == 'dept_id') {
                    param = {curr:1,limit:16,dept_id: _this.user.id}
                } else {
                    param = {curr:1,limit:16}
                }
                uni.request({
                    url: `${_this.baseUrl}/businessTrip/list/auth`,
                    header: {
                        'token': uni.getStorageSync('token')
                    },
                    data: param,
                    success(res) {
                        res = res.data
                        if (res.code === 200) {
                            for (let k of res.data.records) {
                                if (k.settle == 2) {
                                    k['bgcolor'] = 'color: #12d489'
                                } else if (k.settle == 1) {
                                    k['bgcolor'] = 'color: #ffbd67'
                                }
                            }
                            _this.list = res.data.records
                        }
                        // _this.list = 
                    }
                })
            },
            // 出差申请
            add() {
                uni.navigateTo({
                    url: '/pages/business/goBusiness/addgoBusiness',
                    success: function(res) {
                        res.eventChannel.emit('goBusinessDel', {
                            data: 'add'
                        })
                    }
                })
            },
            back() {
                uni.navigateBack({})
            },
            scan() {
                uni.navigateTo({
                    url: '/pages/authority/authority'
                })
            },
        }
    }
</script>
 
<style>
    .flex-row {
        display: flex;
    }
 
    .flex-col {
        display: flex;
        flex-direction: column;
    }
 
    .main-box {
        /* margin: 16rpx; */
        /* background-color: #FFF; */
        border-radius: 20rpx;
        padding: 8rpx;
    }
 
    .box {
        margin: 16rpx 8rpx;
        /* height: 200px; */
        box-shadow: 0 0 5px #dddddd;
        background-color: #FFF;
        padding: 16rpx 32rpx;
        position: relative;
        border-radius: 20rpx;
        font-size: 24rpx;
        color: #bdbdbd;
    }
 
    .box-flag {
        position: absolute;
        right: 0;
        top: 10rpx;
        background-color: #74B9E9;
        padding: 6rpx;
        font-size: 10rpx;
        color: #FFF;
    }
 
    .box-time {
        color: #bdbdbd;
    }
 
    .box-settle {
        font-size: 26rpx;
        /* font-weight: bold; */
    }
 
    .box-title {
        font-size: 28rpx;
        font-weight: bold;
        color: #000;
    }
 
    .box-single-row {}
</style>
 
 
 
 
list: [
{
businessTripReasons: '沟通立库事宜',
businessTransportation$: '交通工具',
businessStartAddr$: '出发地',
businessEndAddr$: '目的地',
businessStartTimeDay$: '出发日期',
businessEndTimeDay$: '结束日期',
businessDuration$: '出差时长',
businessTripDays$: '出差天数',
businessPeers: '同行人',
userId$: '申请人',
orderId: '跟踪项目',
updateTime$: '更新时间',
updateId$: '更新人员',
settle$: '进度',
businessNotes: '出差备注',
},
]