wjt
2024-06-26 6dd9823b8495252e6d0ba35e6114799321453cbe
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
<template>
    <view class="page-box">
        <view class="list">
            <view class="select-box" @click="setIsSelect(index)" v-for="(item,index) in list" :key="index" :class="{start: isJudege}">
                <view class="select-image" v-if="isJudege" >
                    <image src="/static/policy/checkbox.png" mode="widthFix" v-show="item.isSelect"></image>
                    <image src="/static/policy/none-checkbox.png" mode="widthFix" v-show="!item.isSelect"></image>
                </view>
                <view class="list-item">
                    <view class="top-title">
                        <text>{{item.enforceReason}}</text>
                        <text class="status">待审批</text>
                    </view>
                    <view class="user-info">
                        <text>{{item.applyUser}}</text>
                    <!--     <view class="driver"></view>
                        <text>{{item.checkDeptName}}</text> -->
                    </view>
                    <view class="user-info">
                        <!-- <text>{{item.applyUser}}</text>
                        <view class="driver"></view> -->
                        <text>{{item.checkDeptName}}</text>
                    </view>
                    <view class="set-line">
                        <text>执法对象:</text>{{item.companyName}}
                    </view>
                    <view class="line"></view>
                    <view class="set-flex set-start set-flex-content-between">
                        <view>
                            <view class="set-line1">
                                <text>执法时间:</text>{{item.planTime}}
                            </view>
                            <view class="set-line1">
                                <text>申请时间:</text>{{item.applyTime}}
                            </view>
                        </view>
                        <view class="button" v-if="!isJudege" @click.self="goStartJudeg([item.orderId])">
                            审批
                        </view>
                    </view>
                </view>
            </view>
            <u-empty v-if="!list.length" style="margin-top: 200rpx;"></u-empty>
        </view>
        <view class="down" v-if="!isJudege">
            <view class="button" @click="goRecord">审批记录</view>
            <view class="button more-options" @click="moreJudeg">批量审批</view>
        </view>
        <view class="down judge" v-else>
            <view class="select-image"  @click="allSelect()">
                <image src="/static/policy/checkbox.png" mode="widthFix" v-show="isAllSelect"></image>
                <image src="/static/policy/none-checkbox.png" mode="widthFix" v-show="!isAllSelect"></image>
                <view class="show-check">全选</view>
            </view>
            <view class="button more-options start-option" @click="moreStart">立即审批</view>
        </view>
        <popupCom ref="popup" @entery="entery" @cancel="cancelSelect"></popupCom>
    </view>
</template>
 
<script>
    import popupCom from '@/policy/components/popup.vue'
    import { checkLogList, checkUpd } from '@/api/policy.js'
    export default {
        components: {
            popupCom
        },
        data() {
            return {
                isJudege: false,
                list: [
                    
                ],
                total: 1,
                queryms: {
                    pageNum: 1,
                    pageSize: 10,
                    orderStatus: 1,
                    isAsc: "desc",
                    orderByColumn: "apply_time"
                },
                recordList: []
            }
        },
        computed: {
            isAllSelect(){
                if(this.list.length) {
                    const value = this.list.every(item => item.isSelect)
                    return value
                } else {
                    return false
                }
            }
        },
        onLoad() {
            this.checkLogList()
        },
        onReachBottom() {
            if(this.total == this.list.length) {
                return
            }
            this.queryms.pageNum++
            this.checkLogList()
        },
        methods: {
            goRecord() {
                uni.navigateTo({
                    url: `/policy/translateRecord/translateRecord`
                })
            },
            click() {
 
            },
            goStartJudeg(id) {
                this.recordList = id
                this.$refs.popup.open()
            },
            // 批量审批
            moreJudeg() {
                if(!this.list.length){
                    return
                }
                this.isJudege = true
            },
            setIsSelect(index){
                if(!this.isJudege) {
                    return
                }
                this.list[index].isSelect = !this.list[index].isSelect
            },
            allSelect() {
                const value = this.isAllSelect
                this.list.map(item => item.isSelect = !value)
            },
            moreStart() {
                const value = this.list.some(item => item.isSelect)
                if(value) {
                    const valueData = this.list.filter(item => item.isSelect).map(item => item.orderId)
                    // console.log(valueData)
                    this.goStartJudeg(valueData)
                } else {
                    uni.showToast({
                        title: '请选择审批',
                        icon: 'none'
                    })
                }
            },
            entery(form) {
                // 1企业审批,2执法单审批
                checkUpd({...form, ids: this.recordList, checkType: 2}).then(val => {
                    if(val.data.code == 200) {
                        uni.showToast({
                            title: '审批成功',
                            icon: 'none'
                        })
                    }
                    this.list = []
                    this.queryms.pageNum = 1
                    this.checkLogList()
                    this.$refs.popup.close()
                    this.isJudege = false
                })
                
            },
            cancelSelect() {
                this.isJudege = false
                this.list.map(item => item.isSelect = false)
            },
            checkLogList() {
                checkLogList(this.queryms).then(val => {
                    val.data.rows.map(item => {
                        item.isSelect = false
                    })
                    this.list = [...this.list,...val.data.rows ]
                    this.total = val.data.total
                })
            }
        }
    }
</script>
<style>
    page {
        background-color: #F4F4F4;
    }
</style>
<style lang="scss" scoped>
    @import "./translate.scss";
 
    /deep/ .u-radio {
        margin-right: 84rpx !important;
    }
 
    /deep/ .u-textarea {
        background-color: #F4F4F4 !important;
        border: none;
    }
</style>