wjt
2024-06-20 6d79e62362f24665ccd8584d398be4b2f4671d67
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
<template>
    <view class="page-box">
        <u-form label-position="top" label-width="120px">
            <u-form-item label="执法主题">
                <u-input placeholder="请输入" v-model="form.enforceReason"></u-input>
            </u-form-item>
            <u-form-item label="执法对象">
                <u-input placeholder="请输入" v-model="form.companyName">
                    <template  slot="suffix">
                        <text @click="search">搜索</text>
                    </template>
                </u-input>
            </u-form-item>
            <u-form-item label="执法时间" @click="showTimeFun">
                <u-input placeholder="请输入" v-model="form.applyTime" readonly></u-input>
            </u-form-item>
            <u-form-item label="执法类型" @click="showType = true">
                <u-input placeholder="请输入" v-model="form.enforceTypeName" readonly></u-input>
            </u-form-item>
            <u-form-item label="执法内容">
                <u-input placeholder="请输入" v-model="form.regionReason"></u-input>
            </u-form-item>
            <u-form-item label="执法人员">
                <u-input placeholder="请输入" v-model="form.applyName"></u-input>
            </u-form-item>
            <u-form-item label="执法部门">
                <u-input placeholder="请输入" v-model="form.applyDeptName"></u-input>
            </u-form-item>
            <u-form-item label="随行人员数量">
                <u-input placeholder="请输入" v-model="form.userNum"></u-input>
            </u-form-item>
            <u-form-item label="是否通知企业">
                <u-switch v-model="form.isNoticeCompany" :activeValue="1" :inactiveValue="0"></u-switch>
            </u-form-item>
        </u-form>
        <u-button @click="submitApply">提交申请</u-button>
        <u-button @click="applyRecord">申请记录</u-button>
        <u-picker :show="show" @close="show = false" @confirm="confirmSearch" @cancel="show = false" :columns="columns" keyName="companyName"></u-picker>
        <u-datetime-picker
                    :show="showTime"
                    @close="showTime = false"
                    @cancel="showTime = false"
                    v-model="currentTime"
                    @confirm="confirmTime"
                    :minDate="minDate"
                    mode="dateTime"
                    ref="datetimePicker"
                    class="hide-clear-button"
            ></u-datetime-picker>
            <u-picker :show="showType" @close="showType = false" @confirm="confirmType" @cancel="showType = false" :columns="columnsType" keyName="dictLabel"></u-picker>
            
    </view>
</template>
 
<script>
    import { orderAdd, companyList } from '@/api/policy.js'
    import { getInfo } from '@/api/auth.js'
    import { getDicts } from '@/api/data'
    export default {
        data() {
            return {
                currentTime: "",
                form: {
                    executeTime: "",
                    applyName: '',
                    applyDeptName: '',
                    enforceType: 1,
                    isNoticeCompany: 0
                },
                show: false,
                columns: [],
                showTime: false,
                columnsType: [],
                showType: false,
                minDate: ''
            }
        },
        onLoad() {
            this.currentTime = this.$u.timeFormat(new Date(), 'yyyy-mm-dd hh:MM:ss')
            this.getInfo()
            this.getDicts()
        },
        methods: {
            getDicts() {
                getDicts('enforce_type').then(val =>{
                    console.log(val.data.data)
                    this.columnsType = [val.data.data]
                })
            },
            getInfo() {
                getInfo().then(val => {
                    const value = val.data.data
                    this.form.applyName = value.nickName
                    this.form.applyId = value.userId
                    this.form.applyDeptName = value.dept.deptName
                    this.form.applyDeptId = value.dept.deptId
                    this.form.applyPhone = value.phonenumber
                })
            },
            timeFilter(mode, options) {
                let d = new Date()
                // console.log(d.getFullYear());
                if(mode === 'year'){
                    return options.filter((option)=>option>= d.getFullYear())
                }
                if(mode === 'month'){
                    return options.filter((option)=>option>= d.getMonth()+1)
                }
                if (mode === 'minute') {
                    return options.filter((option) => option === '00' || option === '30');
                }
                return options;
            },
            submitApply(){
                orderAdd(this.form).then(val => {
                    if(val.data.code == 200) {
                        uni.navigateBack()
                    }
                })
            },
            applyRecord() {
            
            },
            search() {
                companyList({companyName: this.form.companyName}).then(val => {
                    if(val.data.code == 200){
                        if(!val.data.rows.length || !val.data.rows){
                            uni.showToast({
                                title: '没有符合的数据,请检查输入的执法对象',
                                icon: 'none',
                                duration: 3000
                            })
                        } else {
                            this.columns = [val.data.rows]
                            this.show = true
                        }
                        
                    }
                })
            },
            confirmSearch(e){
                const value =    this.columns[0].find(item => item.companyName == e.value[0].companyName)
                this.form.companyName = e.value[0].companyName
                this.form.companyCode = value.companyCode
                this.form.companyId     = value.companyId    
                this.form.companyPhone = value.companyPhone
                this.form.companyUser = value.companyUser
                this.form.companyAddress = value.companyAddress
                this.show = false
            },
            confirmTime(e) {
                // console.log(e.value)
                this.form.applyTime = e.value
                this.showTime = false
            },
            showTimeFun() {
                this.showTime = true
                
            },
            sheet(){
                
            },
            confirmType(e){
                this.form.enforceType = e.value[0].dictCode
                this.form.enforceTypeName = e.value[0].dictLabel
                this.showType = false
            }
        }
    }
</script>
 
<style scoped lang="scss">
.page-box{
    padding:0 30rpx;
}
/deep/ .u-picker__view{
    
}
</style>