k94314517
2024-04-09 02bc3bfe47e3d5311a0bb041c94e70a34b1ca73c
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
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
<template>
    <view class="box">
        <view class="box_list">
            <u--form
                labelPosition="top"
                :model="model"
                :rules="rules"
                labelWidth="160"
                ref="uForm"
            >
                <u-form-item
                    label="姓名:"
                    prop="memberName"
                    borderBottom
                    required
                >
                    <u--input v-model="model.memberName" border="none" @input="changeSearch" placeholder="请输入"></u--input>
                    <scroll-view scroll-y class="box_list_data" v-if="model.memberName && user.length > 0">
                        <view class="box_list_data_item" v-for="(item, index) in user" :key="index" @click="clickItem(item)">
                            {{item.name}} - {{item.idcardNo}}
                        </view>
                    </scroll-view>
                </u-form-item>
                <u-form-item
                    label="身份证号:"
                    prop="idcardNo"
                    borderBottom
                    required
                >
                    <u--input v-model="model.idcardNo" maxlength="18" border="none" placeholder="请输入"></u--input>
                </u-form-item>
                <u-form-item
                    label="原派遣单位:"
                    prop="oldDuName"
                    borderBottom
                    required
                >
                    <u--input v-model="model.oldDuName" disabled disabledColor="#ffffff" placeholder="请选择" border="none"></u--input>
                </u-form-item>
                <u-form-item
                    label="原所属工种:"
                    prop="oldWorkTypeName"
                    borderBottom
                    required
                >
                    <u--input v-model="model.oldWorkTypeName" disabled disabledColor="#ffffff" placeholder="请选择" border="none"></u--input>
                </u-form-item>
                <u-form-item
                    label="更换后派遣单位:"
                    prop="duName"
                    borderBottom
                    required
                    @click="show = true"
                >
                    <u--input v-model="model.duName" disabled disabledColor="#ffffff" placeholder="请选择" border="none"></u--input>
                    <u-icon slot="right" name="arrow-right"></u-icon>
                </u-form-item>
                <u-form-item
                    label="更换后所属工种:"
                    prop="workTypeName"
                    borderBottom
                    required
                    @click="show1 = true"
                >
                    <u--input v-model="model.workTypeName" disabled disabledColor="#ffffff" placeholder="请选择" border="none"></u--input>
                    <u-icon slot="right" name="arrow-right"></u-icon>
                </u-form-item>
            </u--form>
        </view>
        <view class="box_footer">
            <u-button type="primary" shape="circle" color="#437CB3" text="确认添加" @click="submit"></u-button>
        </view>
        <!-- 派遣单位 -->
        <u-picker :show="show" :columns="columns" confirmColor="#437CB3" keyName="label" @cancel="show = false" @confirm="confirm"></u-picker>
        <!-- 工种 -->
        <u-picker :show="show1" :columns="columns1" confirmColor="#437CB3" keyName="label" @cancel="show1 = false" @confirm="confirm1"></u-picker>
    </view>
</template>
 
<script>
    export default {
        data() {
            return {
                show: false,
                show1: false,
                validTime: null,
                insuranceApplyId: null,
                solutionId: null,
                columns: [],
                columns1: [],
                duSolutionId: '',
                user: [],
                model: {
                    memberName: '',
                    memberId: '',
                    idcardNo: '',
                    oldDuName: '',
                    oldDuId: '',
                    oldWorkTypeName: '',
                    oldWorktypeId: '',
                    worktypeId: '',
                    workTypeName: '',
                    duId: '',
                    duName: ''
                },
                rules: {
                    'memberName': {
                        type: 'string',
                        required: true,
                        message: '请填写姓名',
                        trigger: ['blur', 'change']
                    },
                    'idcardNo': {
                        type: 'string',
                        required: true,
                        message: '请填写身份证号',
                        trigger: ['blur', 'change']
                    },
                    'oldDuName': {
                        type: 'string',
                        required: true,
                        message: '原派遣单位不能为空',
                        trigger: ['blur', 'change']
                    },
                    'oldDuName': {
                        type: 'string',
                        required: true,
                        message: '原派遣单位不能为空',
                        trigger: ['blur', 'change']
                    },
                    'oldWorkTypeName': {
                        type: 'string',
                        required: true,
                        message: '原所属工种不能为空',
                        trigger: ['blur', 'change']
                    },
                    'duName': {
                        type: 'string',
                        required: true,
                        message: '更换后派遣单位不能为空',
                        trigger: ['blur', 'change']
                    },
                    'workTypeName': {
                        type: 'string',
                        required: true,
                        message: '更换后所属工种不能为空',
                        trigger: ['blur', 'change']
                    }
                }
            };
        },
        onLoad(options) {
            this.solutionId = options.solutionId
            this.validTime = options.validTime
            this.insuranceApplyId = options.insuranceApplyId
            this.getDispatchingUnit()
        },
        methods: {
            clickItem(item) {
                this.model.memberName = item.name
                this.model.memberId = item.id
                this.model.idcardNo = item.idcardNo
                this.model.oldDuName = item.duName
                this.model.oldDuId = item.duId
                this.model.oldWorkTypeName = item.workTypeName
                this.model.oldWorktypeId = item.worktypeId
                this.user = []
            },
            // 搜索
            changeSearch(name) {
                this.$u.api.memberFindListByDTO({
                    name,
                    insuranceApplyId: this.insuranceApplyId,
                    validTime: this.validTime
                }).then(res => {
                    if (res.code === 200) {
                        this.user = res.data
                    }
                })
            },
            // 派遣单位
            getDispatchingUnit() {
                this.$u.api.findListByDTO({
                    solutionId: this.solutionId
                }).then(res => {
                    if (res.code === 200) {
                        let arr = res.data.map(item => {
                            return {
                                label: item.name,
                                duSolutionId: item.duSolutionId,
                                id: item.id
                            }
                        })
                        this.columns.push(arr)
                    }
                })
            },
            // 工种
            getGZ() {
                this.$u.api.worktypeFindListByDTO({
                    id: this.duSolutionId,
                    queryType: 1
                }).then(res => {
                    if (res.code === 200) {
                        let arr = res.data.map(item => {
                            return {
                                label: item.name,
                                id: item.id
                            }
                        })
                        this.columns1 = [arr]
                    }
                })
            },
            confirm(e) {
                this.model.duId = e.value[0].id
                this.model.duName = e.value[0].label
                this.duSolutionId = e.value[0].duSolutionId
                this.model.worktypeId = ''
                this.model.workTypeName = ''
                this.getGZ()
                this.show = false
            },
            confirm1(e) {
                this.model.worktypeId = e.value[0].id
                this.model.workTypeName = e.value[0].label
                this.show1 = false
            },
            submit() {
                this.$refs.uForm.validate().then(res => {
                    uni.$emit('data', this.model)
                    uni.navigateBack({ delta: 1 });
                }).catch(errors => {
                    
                })
            }
        }
    }
</script>
<style>
    page {
        background-color: #f7f7f7;
    }
</style>
<style lang="scss" scoped>
    .box {
        width: 100vw;
        height: 100vh;
        padding: 20rpx 30rpx;
        box-sizing: border-box;
        .box_list {
            width: 100%;
            height: calc(100vh - 158rpx - env(safe-area-inset-bottom));
            background: #FFFFFF;
            border-radius: 16rpx;
            padding: 32rpx 30rpx;
            box-sizing: border-box;
            .box_list_data {
                width: 100%;
                max-height: 400rpx;
                margin-top: 10rpx;
                .box_list_data_item {
                    width: 100%;
                    height: 80rpx;
                    padding: 0 20rpx;
                    box-sizing: border-box;
                    line-height: 80rpx;
                    border-bottom: 1px solid #dfdfdf;
                    &:last-child {
                        border: none;
                    }
                }
            }
        }
        .box_footer {
            width: 100%;
            margin-top: 40rpx;
            height: 88rpx;
        }
    }
</style>