yangan
2024-05-21 04a9c3c671a17dc73305b412ae24d3f35d63cfcc
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
<template>
    <view class="main">
        <u--form labelPosition="top"
            labelWidth="20%"
            :borderBottom="false"
            :model="dataForm"
            ref="uForm">
            <u-form-item label="仓库"
                prop="firstClass"
                :borderBottom="false">
                <u-cell-group>
                    <u-cell :title="dataForm.firstClass"
                        value="请选择"
                        @click="firstClassSelect">
                        <u-icon name="arrow-right"
                            slot="right-icon"
                            size="30"></u-icon></u-cell>
                </u-cell-group>
            </u-form-item>
            <!-- <u-form-item label="煤仓"
                prop="secondClass"
                :borderBottom="false">
                <u-cell-group>
                    <u-cell :title="dataForm.secondClass"
                        value="请选择"
                        @click="secondClassSelect"
                        :disabled="!dataForm.firstClass">
                        <u-icon name="arrow-right"
                            slot="right-icon"
                            size="30"></u-icon></u-cell>
                </u-cell-group>
            </u-form-item>
            <u-form-item label="磅单"
                prop="orderType"
                :borderBottom="false">
                <u-cell-group>
                    <u-cell :title="dataForm.orderType"
                        :value="isOrderType"
                        @click="orderTypeSelect">
                        <view slot="right-icon"
                            @click.stop="cleanOrderType">
                            <u-icon :name="!dataForm.orderType?'arrow-right':'close-circle'"
                                size="30"></u-icon>
                        </view>
                    </u-cell>
                </u-cell-group>
            </u-form-item> -->
        </u--form>
        <view class="coal-name"
            v-show="coalList.length!==0">
            <u-checkbox-group v-model="checkedCoal"
                placement="column"
                @change="checkboxChange"
                size="30">
                <u-checkbox :customStyle="{marginBottom: '8px',fontSize:'20px'}"
                    v-for="(item, index) in coalList"
                    :key="item.id"
                    :label="item.name"
                    :name="item.name"
                    labelSize='40'
                    iconSize='40'></u-checkbox></u-checkbox-group>
        </view>
        <view style="margin-top: 20rpx;">
            <u-button type="primary"
                shape="circle"
                text="提交"
                @click.stop="formHandle"></u-button>
        </view>
        <!-- 煤场 -->
        <u-action-sheet :actions="firstClassActionsList"
            :show="firstClassShow"
            cancelText='取消'
            :closeOnClickOverlay='true'
            @close='firstClassClose'
            @select="firstClassSelectClick"></u-action-sheet>
        <!-- 煤仓 -->
        <!-- <u-action-sheet :actions="secondClassActionsList"
            :show="secondClassShow"
            cancelText='取消'
            :closeOnClickOverlay='true'
            @close='secondClassClose'
            @select="secondClassSelectClick"></u-action-sheet> -->
        <!--磅单类型 -->
        <!-- <u-action-sheet :actions="orderTypeList"
            :show="orderTypeShow"
            cancelText='取消'
            :closeOnClickOverlay='true'
            @close='orderTypeClose'
            @select="orderTypeSelectClick"></u-action-sheet> -->
    </view>
</template>
 
<script>
    export default {
        data() {
            return {
                dataForm: {
                    firstClass: "",
                    secondClass: "",
                    orderType: ''
                },
                index: '',
                // 煤场操作菜单
                firstClassActionsList: [],
                firstClassShow: false,
                // 煤仓操作菜单
                secondClassActionsList: [],
                secondClassShow: false,
                coalList: [],
                checkedCoal: [],
                userInfo: {},
                filedId: "",
                selectedCoal: [],
                orderTypeShow: false,
                orderTypeList: [{
                        name: '外销',
                        id: Math.floor(Math.random() * 100) + 1,
                    },
                    {
                        name: '外购',
                        id: Math.floor(Math.random() * 100) + 1,
                    }
                ],
                isOrderType: '请选择', //磅房类型是否选择了 选择了清空
                cleanIconClick: true, //修改点击清空磅房选择会出现
 
            };
        },
        methods: {
            getUserInfo() {
                this.$reqGet('getUserEntity').then(res => {
                    this.userInfo = res.data;
                    this.userInfo.password = null
                })
            },
            // 获取煤场
            getDeptIdFiled() {
                uni.showLoading({
                    title: "加载中"
                })
                this.$reqGet('getWarehouseList').then(res => {
                    uni.hideLoading()
                    if (res.code === 0) {
                        this.firstClassActionsList = res.data;
                        if(res.data.length === 1){
                            uni.navigateTo({
                           url: `/pages/loadUnload-page/loadUnload-detail/loadUnload-detail?orderType=${this.dataForm.orderType}`
                    })
                        }
                    } else {
                        this.$u.toast('加载失败')
                    }
                }).then(() => {
                    this.getUserInfo()
                })
            },
            firstClassSelect() {
                this.firstClassShow = true
            },
            firstClassClose() {
                this.firstClassShow = false
            },
            firstClassSelectClick(val) {
                this.dataForm.firstClass = val.name
                this.getFiledIdCoalBunker(val.id)
                this.filedId = val.id
            },
            // 获取煤仓
            // getFiledIdCoalBunker(filedId) {
            //     this.$reqGet('getFiledIdCoalBunker', { filedId, }).then(res => {
            //         this.secondClassActionsList = res.data
            //     })
            // },
            //煤仓菜单
            secondClassSelect() {
                this.secondClassShow = true
            },
            secondClassClose() {
                this.secondClassShow = false
            },
            secondClassSelectClick(val) {
                this.dataForm.secondClass = val.name
                this.coalList = this.secondClassActionsList.find(v => v.id === val.id).coalNames.split(',').map(v => {
                    return {
                        name: v,
                        id: Math.floor(Math.random() * 100) + 1,
                        checked: false
                    }
                })
            },
            orderTypeSelect() {
                this.orderTypeShow = true
            },
            orderTypeClose() {
                this.orderTypeShow = false
            },
            orderTypeSelectClick(val) {
                this.orderTypeShow = false
                this.dataForm.orderType = val.name
                this.isOrderType = ''
            },
            cleanOrderType() {
                this.dataForm.orderType = null
                this.isOrderType = '请选择'
                this.orderTypeShow = false
            },
            checkboxChange(e) {
                this.selectedCoal = e
            },
            formHandle() {
                if (!this.dataForm.firstClass || !this.dataForm.secondClass) return this.$u.toast('请选择煤场或者煤仓')
                if (this.selectedCoal.length === 0) return this.$u.toast('请选择煤种')
                this.$reqPost('updateUser', Object.assign(this.userInfo, {
                    responsibilityCoal: this.selectedCoal.join(),
                    filedId: this.filedId
                }), 'json').then(res => {
                    uni.navigateTo({
                        url: `/pages/loadUnload-page/loadUnload-detail/loadUnload-detail?orderType=${this.dataForm.orderType}`
                    })
                })
            }
        }
    }
</script>
 
<style lang="scss"
    scoped>
    .main {
        width: 94%;
        margin: 10px;
        // margin-top: vww(100);
        position: relative;
        top: vww(-120);
    }
 
    .slide-fade-enter-active {
        transition: all 0.3s ease-out;
    }
 
    .coal-name {
        width: 95%;
        min-height: vww(100);
 
        .u-checkbox-group {
            .u-checkbox {}
        }
    }
</style>