qingyiay
2023-09-16 71a830c0c6adfd19dd726abe6772df35e94313e9
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
<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">
                        <u-icon name="arrow-right"
                            slot="right-icon"
                            size="30"></u-icon></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="row"
                @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>
    </view>
</template>
 
<script>
    export default {
        data() {
            return {
                dataForm: {
                    firstClass: "",
                    secondClass: "",
                },
                index: '',
                // 煤场操作菜单
                firstClassActionsList: [],
                firstClassShow: false,
                // 煤仓操作菜单
                secondClassActionsList: [],
                secondClassShow: false,
                coalList: [],
                checkedCoal: [],
                userInfo: {},
                filedId: "",
                selectedCoal: []
            };
        },
        methods: {
            getUserInfo() {
                this.$reqGet('getUserEntity').then(res => {
                    this.userInfo = res.data;
                    this.userInfo.password = null
                })
            },
            // 获取煤场
            getDeptIdFiled() {
                uni.showLoading({
                    title: "加载中"
                })
                this.$reqGet('getDeptIdFiled').then(res => {
                    uni.hideLoading()
                    if (res.code === 0) {
                        this.firstClassActionsList = res.data
                    } 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
                    }
                })
                console.log(this.coalList);
            },
            checkboxChange(e) {
                this.selectedCoal = e
            },
            formHandle() {
                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`
                    })
                })
            }
        }
    }
</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>