张晓波
2023-09-19 164694c47c35d6654df69b533e8dbf8b5423efc5
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
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
<template>
  <div class="login">
    <div class="login_content" >
      <div class="login_logo">
        <img src="../../assets/logos.png"  width="100%" height="100%">
      </div>
      <div class="login_title">
        <span>面向现代制造的混凝土管片智慧工厂</span>
      </div>
      <el-form ref="form" :rules="rules" :model="ruleForm" label-width="auto" class="login_form">
        <el-form-item prop="username">
          <el-input 
            v-model="ruleForm.username" 
            size="medium" 
            clearable 
            placeholder="请输入用户名"
            prefix-icon="el-icon-user-solid">
          </el-input>
        </el-form-item>
        <el-form-item prop="password">                                                     
          <el-input 
            v-model="ruleForm.password" 
            size="medium" 
            clearable 
            placeholder="请输入密码" 
            @keydown.enter.native="userLogin()" 
            show-password
            prefix-icon="el-icon-s-goods">
          </el-input>
        </el-form-item>
        <el-form-item class="form_check">
          <el-checkbox label="记住密码" v-model="remember"></el-checkbox>
        </el-form-item>
        <div>
          <el-button class="form_button" type="primary" size="medium" @click="userLogin">登录</el-button>
        </div>
        <div class="login_version" @click="asyncVersion = true">
          <span>版本说明</span>
          <img src="../../assets/version.png" style="margin-left: 5px">
        </div>
      </el-form>
    </div>
    <span class="login_copyright">版权所有©中铁十四局集团房桥有限公司</span>
    <transition name="el-fade-in-linear">
      <div class="login_version_dialog" v-if="asyncVersion">
        <i @click="asyncVersion = false" class="el-icon-close dialog_back"></i>
        <div class="dialog_title">
          版本说明(V1.0 ~ V1.1)
        </div>
        <div class="dialog_content_item">
          <div class="item_title">生产计划管理</div>
          <ul class="item_ul">
            <li>
              钢筋需求计划:可将每年对钢筋笼的需求计划,按照配筋
              类型及整个隧道布置顺序进行设置,并可与用实际生产
              数量进行对比展示,通过图表可了解当前生产进度
            </li>
            <li>
              管片生产计划:可按照项目、年份、尺寸将当年各个月份
              的管片 (环) 需求及计划录入到系统中,方便生产人员比
              对及分析
            </li>
          </ul>
        </div>
        <div class="dialog_content_item">
          <div class="item_title">钢筋笼管理</div>
          <ul class="item_ul">
            <li>
              钢筋笼库存:可查看当前已质检合格,尚未消耗入模的各种型号钢筋笼库存情况
            </li>
            <li>
              成环统计:可根据项目、尺寸,统计已成环的钢筋笼数量及尚未成环的钢筋笼型号和数量
            </li>
          </ul>
        </div>
        <div class="dialog_content_item">
          <div class="item_title">报表中心</div>
          <ul class="item_ul">
            <li>
              模具使用报表:对模具使用的次数、时长等信息进行记录
            </li>
          </ul>
        </div>
        <div class="dialog_content_item">
          <div class="item_title">物资库存管理</div>
          <ul class="item_ul">
            <li>
              钢筋库存管理:使用系统中设置的钢筋理论耗量,可计算出钢筋库存的消耗值,可与实际库存消耗进行对比,对成本进行评估
            </li>
          </ul>
        </div>
      </div>
    </transition>
  </div>
</template>
 
<script>
import { throttle, changeSize, setCookie, getCookie } from '../../plugins/public'; // 导入节流、动态切换组件尺寸、cookie方法
import { addRouterInfo } from '../../router/routerConfig'; // 导入处理路由方法
  export default {
    data() {
      return {
        size: changeSize(),
        remember: false,
        ruleForm: {
          username: '',
          password: ''
        },
        rules: {
          username: [{
            required: true,
            message: '请输入用户名',
            trigger: 'blur'
          }],
          password: [{
            required: true,
            message: '请输入密码',
            trigger: 'blur'
          }]
        },
        asyncVersion: false
      }
    },
    mounted() {
      const that = this;
      let data = getCookie('userInfo');
      this.remember = data.remember || false;
      this.$set(this.ruleForm, 'username', data.userName);
      this.$set(this.ruleForm, 'password', data.passWord);
      // 根据窗口大小动态修改组件尺寸
      window.onresize = () => {
        that.size = changeSize();
      }
    },
    methods: {
      // 用户登录
      userLogin: throttle(function () {
        if(this.remember) {
          let params = {
            userName: this.ruleForm.username,
            passWord: this.ruleForm.password,
            remember: this.remember
          }
          setCookie('userInfo', params, 30);
        } else {
          let params = {
            userName: "",
            passWord: "",
            remember: false
          }
          setCookie('userInfo', params, 30);
        }
        this.$refs.form.validate(valid => {
          if(valid) {
            this.$api.System.userLogin(this.ruleForm).then(res => {
              if(res.statusMsg === "ok") {
                this.$message.success('登录成功');
                let routerList = this.changeRouter(res.data.menus);
                sessionStorage.setItem("token", res.data.token);
                sessionStorage.setItem('realName', res.data.realName);
                sessionStorage.setItem("routerList", JSON.stringify(routerList));
                addRouterInfo(routerList);
                this.$router.push(routerList[0].children[0].path);
              } else {
                this.$message.warning(res.statusMsg); 
              }
            })
          }
        })
      }, 3000),
      // 处理路由菜单信息
      changeRouter(list) {
        let data = list.map(item => {
          return item = {
            path: item.path,
            name: item.name,
            children: this.changeRouter(item.childrens),
            meta: {
              title: item.title,
              menuId: item.menuId
            },
            component: item.component
          }
        })
        return data;
      }
    }
  }
</script>
 
<style lang="scss" scoped>
.login {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: url('../../assets/login_bg.png') no-repeat;
  background-size: 100% 100%;
 
  .login_content {
    position: absolute;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -40%);
    padding: 2rem 0 0 0;
    width: 35rem;
    // height: 30rem;
    text-align: center;
    border-radius: 15px;
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
    background-color: rgb(255, 255, 255);
 
    .login_logo {
      position: absolute;
      top: -3.5rem;
      left: calc(35rem /2);
      transform: translateX(-50%);
      padding: 1rem 2.3rem;
      width: 11.5rem;
      height: 8rem;
      background: #fff;
      border-radius: 50%;
    }
 
    .login_title {
      margin: 3rem 0;
      color: #0873FF;
      font-size: 1.7rem;
      font-weight: 600;
    }
 
    .login_form {
      margin: 1.5rem auto;
      width: 80%;
 
      .form_check {
        text-align: right;
      }
 
      .form_button {
        margin: 1.5rem 0;
        padding: 15px 20px;
        width: 100%;
        background: #0873FF;
      }
    }
 
    .login_version {
      display: flex;
      justify-content: center;
      align-items: center;
      color: #8DBBFF;
      font-size: 1.2rem;
      cursor: pointer;
 
      &:hover {
        opacity: .8;
      }
    }
  }
 
  .login_copyright {
    position: absolute;
    bottom: 1%;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 1rem;
  }
 
  .login_version_dialog {
    position: absolute;
    top: 15%;
    right: 2%;
    padding: 20px;
    width: 30rem;
    min-height: 30rem;
    background: url('../../assets/dialog_bg.png') no-repeat;
    background-size: 100% 100%;
 
    .dialog_back {
      position: absolute;
      top: 20px;
      right: 20px;
      color: #BEC6D4;
      font-size: 1.5rem;
      cursor: pointer;
 
      &:hover {
        color: #8DBBFF;
      }
    }
 
    .dialog_title {
      color: #39B5FE;
      font-size: 1.3rem;
      font-weight: 600;
    }
 
    .dialog_content_item {
 
      .item_title {
        position: relative;
        padding: 10px 15px;
        color: #39B5FE;
        font-size: 1.2rem;
        border-bottom: 1px solid #143164;
 
        &::before {
          content: '';
          position: absolute;
          top: 50%;
          left: 0;
          transform: translateY(-50%);
          width: 4px;
          height: 45%;
          background: #39B5FE;
        }
      }
 
      .item_ul {
        padding-left: 20px;
        color: #E2E3E9;
 
        & > li {
          margin: 10px 0;
        }
      }
    }
  }
}
 
/deep/ .el-icon-user-solid {
  color: #0873FF;
}
 
/deep/ .el-icon-s-goods {
  color: #0873FF;
}
 
/deep/.el-checkbox__label {
  color: #999;
}
</style>