vue2-client 1.1.0 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +81 -81
- package/README.md +65 -63
- package/babel.config.js +15 -14
- package/docs/index.md +29 -29
- package/docs/notice.md +22 -0
- package/index.js +28 -0
- package/jest.config.js +3 -3
- package/package.json +1 -1
- package/public/index.html +27 -27
- package/src/App.vue +2 -2
- package/src/assets/img/SunClientDownload.png +0 -0
- package/src/assets/img/SunClientManual/1.png +0 -0
- package/src/assets/img/SunClientManual/2.png +0 -0
- package/src/assets/img/SunClientManual/3.png +0 -0
- package/src/assets/img/SunClientManual/4.png +0 -0
- package/src/assets/img/ToDeskDownload.png +0 -0
- package/src/assets/img/ToDeskManual/1.png +0 -0
- package/src/assets/img/ToDeskManual/2.png +0 -0
- package/src/assets/img/ToDeskManual/3.png +0 -0
- package/src/assets/img/ToDeskManual/4.png +0 -0
- package/src/assets/sound/newNote.mp3 +0 -0
- package/src/base-client/all.js +57 -57
- package/src/base-client/components/common/CreateQuery/CreateQuery.vue +1157 -1159
- package/src/base-client/components/common/CreateQuery/index.md +1 -1
- package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQuery.vue +540 -540
- package/src/base-client/components/common/CreateSimpleFormQuery/index.md +1 -1
- package/src/base-client/components/common/CustomColumnsDrawer/index.md +1 -1
- package/src/base-client/components/common/FormGroupEdit/FormGroupEdit.vue +150 -150
- package/src/base-client/components/common/FormGroupEdit/index.md +1 -1
- package/src/base-client/components/common/FormGroupQuery/index.md +1 -1
- package/src/base-client/components/common/XAddForm/XAddForm.vue +323 -323
- package/src/base-client/components/common/XAddForm/index.md +1 -1
- package/src/base-client/components/common/XBadge/index.md +1 -1
- package/src/base-client/components/common/XCard/index.md +1 -1
- package/src/base-client/components/common/XForm/XForm.vue +275 -275
- package/src/base-client/components/common/XForm/XFormItem.vue +217 -217
- package/src/base-client/components/common/XForm/index.md +196 -196
- package/src/base-client/components/common/XFormCol/index.md +1 -1
- package/src/base-client/components/common/XFormTable/XFormTable.vue +407 -405
- package/src/base-client/components/common/XFormTable/index.md +3 -3
- package/src/base-client/components/common/XTable/XTable.vue +262 -262
- package/src/base-client/components/common/XTable/index.md +255 -255
- package/src/base-client/components/common/XTreeOne/XTreeOne.vue +1 -1
- package/src/base-client/components/iot/CustomerDetailsView/CustomerDetailsView.vue +226 -226
- package/src/base-client/components/iot/CustomerDetailsView/index.md +2 -2
- package/src/base-client/components/iot/DataAnalysisUser/DataAnalysisUser.vue +1 -1
- package/src/base-client/components/iot/DataAnalysisViewGD/DataAnalysisViewGD.vue +548 -548
- package/src/base-client/components/iot/DeviceBrandDetailsView/DeviceBrandDetailsView.vue +453 -453
- package/src/base-client/components/iot/DeviceDetailsView/DeviceDetailsView.vue +231 -231
- package/src/base-client/components/iot/DeviceDetailsView/index.md +1 -1
- package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsCount.vue +330 -330
- package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsException.vue +1 -1
- package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsInstruct.vue +3 -3
- package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsInstructOperate.vue +122 -122
- package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsMain.vue +1 -1
- package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsRead.vue +3 -3
- package/src/base-client/components/iot/DeviceTypeDetailsView/DeviceTypeDetailsView.vue +277 -277
- package/src/base-client/components/iot/InstructDetailsView/InstructDetailsView.vue +472 -472
- package/src/base-client/components/iot/InstructDetailsView/index.md +1 -1
- package/src/base-client/components/iot/LogDetailsView/LogDetailsView.vue +380 -380
- package/src/base-client/components/iot/LogDetailsView/index.md +1 -1
- package/src/base-client/components/iot/MeterDetailsView/MeterDetailsView.vue +360 -360
- package/src/base-client/components/iot/MeterDetailsView/index.md +1 -1
- package/src/base-client/components/iot/MeterDetailsView/part/MeterDetailsCount.vue +335 -335
- package/src/base-client/components/iot/MeterDetailsView/part/MeterDetailsException.vue +185 -185
- package/src/base-client/components/iot/MeterDetailsView/part/MeterDetailsHandPlan.vue +292 -292
- package/src/base-client/components/iot/MeterDetailsView/part/MeterDetailsInstruct.vue +237 -237
- package/src/base-client/components/iot/MeterDetailsView/part/MeterDetailsMain.vue +257 -257
- package/src/base-client/components/iot/MeterDetailsView/part/MeterDetailsSellGas.vue +190 -190
- package/src/base-client/components/iot/WebmeterAnalysisView/WebmeterAnalysisView.vue +723 -723
- package/src/base-client/components/iot/WebmeterAnalysisView/index.md +1 -1
- package/src/base-client/components/system/DictionaryDetailsView/DictionaryDetailsView.vue +232 -232
- package/src/base-client/components/system/DictionaryDetailsView/index.md +1 -1
- package/src/base-client/components/system/QueryParamsDetailsView/QueryParamsDetailsView.vue +248 -248
- package/src/base-client/components/ticket/EmployeeDetailsView/EmployeeDetailsView.vue +371 -406
- package/src/base-client/components/ticket/TicketDetailsView/TicketDetailsView.vue +838 -486
- package/src/base-client/components/ticket/TicketDetailsView/part/TicketDetailsFlow.vue +261 -184
- package/src/base-client/components/ticket/TicketSubmitSuccessView/TicketSubmitSuccessView.vue +528 -303
- package/src/base-client/plugins/AppData.js +69 -69
- package/src/base-client/plugins/GetLoginInfoService.js +221 -221
- package/src/base-client/plugins/index.js +21 -21
- package/src/bootstrap.js +27 -27
- package/src/components/Ellipsis/Ellipsis.vue +1 -1
- package/src/components/Ellipsis/index.md +2 -2
- package/src/components/NumberInfo/index.md +1 -1
- package/src/components/STable/README.md +3 -3
- package/src/components/Trend/index.md +1 -1
- package/src/components/cache/AKeepAlive.js +1 -1
- package/src/components/checkbox/index.js +2 -2
- package/src/components/index.js +15 -15
- package/src/components/menu/menu.js +1 -1
- package/src/components/setting/Setting.vue +4 -4
- package/src/components/table/advance/AdvanceTable.vue +3 -3
- package/src/components/transition/PageToggleTransition.vue +1 -1
- package/src/config/default/setting.config.js +33 -33
- package/src/layouts/CommonLayout.vue +1 -1
- package/src/layouts/ComponentLayoutOne.vue +47 -47
- package/src/layouts/PageLayout.vue +2 -2
- package/src/layouts/SinglePageView.vue +1 -1
- package/src/layouts/header/AdminHeader.vue +2 -2
- package/src/layouts/header/HeaderAvatar.vue +1 -1
- package/src/layouts/header/HeaderNotice.vue +97 -97
- package/src/layouts/tabs/TabsHead.vue +1 -1
- package/src/layouts/tabs/TabsView.vue +6 -6
- package/src/main.js +20 -20
- package/src/mock/common/reportData.js +20 -20
- package/src/mock/goods/index.js +2 -2
- package/src/mock/index.js +6 -6
- package/src/mock/project/index.js +1 -1
- package/src/mock/user/current.js +1 -1
- package/src/mock/user/login.js +1 -1
- package/src/mock/user/routes.js +61 -61
- package/src/mock/workplace/index.js +1 -1
- package/src/pages/exception/403.vue +25 -25
- package/src/pages/exception/404.vue +25 -25
- package/src/pages/exception/500.vue +25 -25
- package/src/pages/login/Login.vue +194 -194
- package/src/pages/report/ReportTable.js +125 -125
- package/src/pages/report/ReportTableHome.vue +28 -28
- package/src/pages/resourceManage/resourceManageMain.vue +55 -55
- package/src/pages/system/applyInstallView/Core.vue +1 -1
- package/src/pages/system/applyInstallView/index.vue +1 -1
- package/src/pages/system/dictionary/index.vue +1 -1
- package/src/pages/system/queryParams/index.vue +1 -1
- package/src/router/async/config.async.js +1 -1
- package/src/router/async/router.map.js +59 -59
- package/src/router/guards.js +3 -3
- package/src/router/index.js +27 -27
- package/src/services/api/EmployeeDetailsViewApi.js +3 -1
- package/src/services/api/TicketDetailsViewApi.js +9 -1
- package/src/services/api/common.js +37 -39
- package/src/services/api/restTools.js +23 -23
- package/src/services/dataSource.js +1 -1
- package/src/services/user.js +2 -2
- package/src/store/index.js +5 -5
- package/src/store/modules/setting.js +5 -5
- package/src/theme/index.less +5 -5
- package/src/theme/reportTable.less +58 -58
- package/src/utils/i18n.js +2 -2
- package/src/utils/indexedDB.js +146 -146
- package/src/utils/request.js +197 -197
- package/src/utils/routerUtil.js +18 -5
- package/tests/unit/ReportTable.spec.js +15 -15
- package/vue.config.js +153 -152
- package/webpack.config.js +12 -12
- package/src/index.js +0 -28
- package/src/router/config.js +0 -23
|
@@ -1,194 +1,194 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<common-layout>
|
|
3
|
-
<div class="top">
|
|
4
|
-
<div class="header">
|
|
5
|
-
<img alt="logo" class="logo" src="@/assets/img/logo.png" />
|
|
6
|
-
<span class="title">{{ systemName }}</span>
|
|
7
|
-
</div>
|
|
8
|
-
<div class="desc">为物联网设备的兼容、监控和统计提供支持</div>
|
|
9
|
-
</div>
|
|
10
|
-
<div class="login">
|
|
11
|
-
<a-form @submit="onSubmit" :form="form">
|
|
12
|
-
<a-tabs size="large" :tabBarStyle="{textAlign: 'center'}" style="padding: 0 2px;">
|
|
13
|
-
<a-tab-pane tab="账户密码登录" key="1">
|
|
14
|
-
<a-alert
|
|
15
|
-
type="error"
|
|
16
|
-
:closable="true"
|
|
17
|
-
v-show="error"
|
|
18
|
-
:message="error"
|
|
19
|
-
showIcon
|
|
20
|
-
style="margin-bottom: 24px;" />
|
|
21
|
-
<a-form-item>
|
|
22
|
-
<a-input
|
|
23
|
-
autocomplete="autocomplete"
|
|
24
|
-
size="large"
|
|
25
|
-
placeholder="admin"
|
|
26
|
-
v-decorator="['name', {rules: [{ required: true, message: '请输入账户名', whitespace: true}]}]"
|
|
27
|
-
>
|
|
28
|
-
<a-icon slot="prefix" type="user" />
|
|
29
|
-
</a-input>
|
|
30
|
-
</a-form-item>
|
|
31
|
-
<a-form-item>
|
|
32
|
-
<a-input
|
|
33
|
-
size="large"
|
|
34
|
-
placeholder="888888"
|
|
35
|
-
autocomplete="autocomplete"
|
|
36
|
-
type="password"
|
|
37
|
-
v-decorator="['password', {rules: [{ required: true, message: '请输入密码', whitespace: true}]}]"
|
|
38
|
-
>
|
|
39
|
-
<a-icon slot="prefix" type="lock" />
|
|
40
|
-
</a-input>
|
|
41
|
-
</a-form-item>
|
|
42
|
-
</a-tab-pane>
|
|
43
|
-
</a-tabs>
|
|
44
|
-
<div>
|
|
45
|
-
<a-checkbox :checked="true" >自动登录</a-checkbox>
|
|
46
|
-
</div>
|
|
47
|
-
<a-form-item>
|
|
48
|
-
<a-button :loading="logging" style="width: 100%;margin-top: 24px" size="large" htmlType="submit" type="primary">登录</a-button>
|
|
49
|
-
</a-form-item>
|
|
50
|
-
</a-form>
|
|
51
|
-
</div>
|
|
52
|
-
</common-layout>
|
|
53
|
-
</template>
|
|
54
|
-
|
|
55
|
-
<script>
|
|
56
|
-
import CommonLayout from '
|
|
57
|
-
import { getRoutesConfig, login } from '
|
|
58
|
-
import { setAuthorization } from '
|
|
59
|
-
import { loadRoutes, funcToRouter } from '
|
|
60
|
-
import { mapMutations } from 'vuex'
|
|
61
|
-
import JSEncrypt from 'jsencrypt'
|
|
62
|
-
import { ACCESS_TOKEN } from '
|
|
63
|
-
import Vue from 'vue'
|
|
64
|
-
import Mock from 'mockjs'
|
|
65
|
-
import { positions } from '
|
|
66
|
-
const { homePage } = require('
|
|
67
|
-
// import { router } from '
|
|
68
|
-
|
|
69
|
-
export default {
|
|
70
|
-
name: 'Login',
|
|
71
|
-
components: { CommonLayout },
|
|
72
|
-
data () {
|
|
73
|
-
return {
|
|
74
|
-
logging: false,
|
|
75
|
-
error: '',
|
|
76
|
-
form: this.$form.createForm(this)
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
computed: {
|
|
80
|
-
systemName () {
|
|
81
|
-
return this.$store.state.setting.systemName
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
methods: {
|
|
85
|
-
...mapMutations('account', ['setUser', 'setPermissions', 'setRoles']),
|
|
86
|
-
onSubmit (e) {
|
|
87
|
-
e.preventDefault()
|
|
88
|
-
this.form.validateFields((err) => {
|
|
89
|
-
if (!err) {
|
|
90
|
-
this.logging = true
|
|
91
|
-
const name = this.form.getFieldValue('name')
|
|
92
|
-
const password = this.form.getFieldValue('password')
|
|
93
|
-
login(name, password).then(this.afterLogin)
|
|
94
|
-
}
|
|
95
|
-
})
|
|
96
|
-
},
|
|
97
|
-
afterLogin (res) {
|
|
98
|
-
const name = this.form.getFieldValue('name')
|
|
99
|
-
const password = this.form.getFieldValue('password')
|
|
100
|
-
this.logging = false
|
|
101
|
-
const loginRes = res.states
|
|
102
|
-
if (loginRes === '登录成功') {
|
|
103
|
-
const encrypt = new JSEncrypt()
|
|
104
|
-
encrypt.setPublicKey('MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqPvovSfXcwBbW8cKMCgwqNpsYuzF8RPAPFb7LGsnVo44JhM/xxzDyzoYtdfNmtbIuKVi9PzIsyp6rg+09gbuI6UGwBZ5DWBDBMqv5MPdOF5dCQkB2Bbr5yPfURPENypUz+pBFBg41d+BC+rwRiXELwKy7Y9caD/MtJyHydj8OUwIDAQAB')
|
|
105
|
-
const data = encrypt.encrypt(JSON.stringify({ username: name, password: password }))
|
|
106
|
-
localStorage.setItem(ACCESS_TOKEN, data)
|
|
107
|
-
// 获取路由配置
|
|
108
|
-
getRoutesConfig(data).then(result => {
|
|
109
|
-
Vue.$login.login(result).then(() => {
|
|
110
|
-
const user = Object.assign({
|
|
111
|
-
username: result.ename,
|
|
112
|
-
name: result.name,
|
|
113
|
-
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/jZUIxmJycoymBprLOUbT.png',
|
|
114
|
-
address: '西安市',
|
|
115
|
-
position: positions[0]
|
|
116
|
-
}, result)
|
|
117
|
-
this.setUser(user)
|
|
118
|
-
this.setPermissions([{ id: 'queryForm', operation: ['add', 'edit'] }])
|
|
119
|
-
this.setRoles([{ id: 'admin', operation: ['add', 'edit', 'delete'] }])
|
|
120
|
-
let timestamp = new Date().getTime()// 当前的时间戳
|
|
121
|
-
timestamp = timestamp + 60 * 60 * 1000
|
|
122
|
-
// 格式化时间获取年月日, 登陆过期时间
|
|
123
|
-
const dateAfter = new Date(timestamp)
|
|
124
|
-
setAuthorization({ token: data, expireAt: dateAfter })
|
|
125
|
-
loadRoutes(funcToRouter(user.functions))
|
|
126
|
-
this.$router.push(homePage).catch(() => {})
|
|
127
|
-
this.$message.success(Mock.mock('@TIMEFIX').CN + ',欢迎回来', 3)
|
|
128
|
-
})
|
|
129
|
-
})
|
|
130
|
-
} else {
|
|
131
|
-
this.error = loginRes
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
</script>
|
|
137
|
-
|
|
138
|
-
<style lang="less" scoped>
|
|
139
|
-
.common-layout{
|
|
140
|
-
.top {
|
|
141
|
-
text-align: center;
|
|
142
|
-
.header {
|
|
143
|
-
height: 44px;
|
|
144
|
-
line-height: 44px;
|
|
145
|
-
a {
|
|
146
|
-
text-decoration: none;
|
|
147
|
-
}
|
|
148
|
-
.logo {
|
|
149
|
-
height: 44px;
|
|
150
|
-
vertical-align: top;
|
|
151
|
-
margin-right: 16px;
|
|
152
|
-
}
|
|
153
|
-
.title {
|
|
154
|
-
font-size: 33px;
|
|
155
|
-
color: @title-color;
|
|
156
|
-
font-family: 'Myriad Pro', 'Helvetica Neue', Arial, Helvetica, sans-serif;
|
|
157
|
-
font-weight: 600;
|
|
158
|
-
position: relative;
|
|
159
|
-
top: 2px;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
.desc {
|
|
163
|
-
font-size: 14px;
|
|
164
|
-
color: @text-color-second;
|
|
165
|
-
margin-top: 12px;
|
|
166
|
-
margin-bottom: 40px;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
.login{
|
|
170
|
-
width: 368px;
|
|
171
|
-
margin: 0 auto;
|
|
172
|
-
@media screen and (max-width: 576px) {
|
|
173
|
-
width: 95%;
|
|
174
|
-
}
|
|
175
|
-
@media screen and (max-width: 320px) {
|
|
176
|
-
.captcha-button{
|
|
177
|
-
font-size: 14px;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
.icon {
|
|
181
|
-
font-size: 24px;
|
|
182
|
-
color: @text-color-second;
|
|
183
|
-
margin-left: 16px;
|
|
184
|
-
vertical-align: middle;
|
|
185
|
-
cursor: pointer;
|
|
186
|
-
transition: color 0.3s;
|
|
187
|
-
|
|
188
|
-
&:hover {
|
|
189
|
-
color: @primary-color;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<common-layout>
|
|
3
|
+
<div class="top">
|
|
4
|
+
<div class="header">
|
|
5
|
+
<img alt="logo" class="logo" src="@/assets/img/logo.png" />
|
|
6
|
+
<span class="title">{{ systemName }}</span>
|
|
7
|
+
</div>
|
|
8
|
+
<div class="desc">为物联网设备的兼容、监控和统计提供支持</div>
|
|
9
|
+
</div>
|
|
10
|
+
<div class="login">
|
|
11
|
+
<a-form @submit="onSubmit" :form="form">
|
|
12
|
+
<a-tabs size="large" :tabBarStyle="{textAlign: 'center'}" style="padding: 0 2px;">
|
|
13
|
+
<a-tab-pane tab="账户密码登录" key="1">
|
|
14
|
+
<a-alert
|
|
15
|
+
type="error"
|
|
16
|
+
:closable="true"
|
|
17
|
+
v-show="error"
|
|
18
|
+
:message="error"
|
|
19
|
+
showIcon
|
|
20
|
+
style="margin-bottom: 24px;" />
|
|
21
|
+
<a-form-item>
|
|
22
|
+
<a-input
|
|
23
|
+
autocomplete="autocomplete"
|
|
24
|
+
size="large"
|
|
25
|
+
placeholder="admin"
|
|
26
|
+
v-decorator="['name', {rules: [{ required: true, message: '请输入账户名', whitespace: true}]}]"
|
|
27
|
+
>
|
|
28
|
+
<a-icon slot="prefix" type="user" />
|
|
29
|
+
</a-input>
|
|
30
|
+
</a-form-item>
|
|
31
|
+
<a-form-item>
|
|
32
|
+
<a-input
|
|
33
|
+
size="large"
|
|
34
|
+
placeholder="888888"
|
|
35
|
+
autocomplete="autocomplete"
|
|
36
|
+
type="password"
|
|
37
|
+
v-decorator="['password', {rules: [{ required: true, message: '请输入密码', whitespace: true}]}]"
|
|
38
|
+
>
|
|
39
|
+
<a-icon slot="prefix" type="lock" />
|
|
40
|
+
</a-input>
|
|
41
|
+
</a-form-item>
|
|
42
|
+
</a-tab-pane>
|
|
43
|
+
</a-tabs>
|
|
44
|
+
<div>
|
|
45
|
+
<a-checkbox :checked="true" >自动登录</a-checkbox>
|
|
46
|
+
</div>
|
|
47
|
+
<a-form-item>
|
|
48
|
+
<a-button :loading="logging" style="width: 100%;margin-top: 24px" size="large" htmlType="submit" type="primary">登录</a-button>
|
|
49
|
+
</a-form-item>
|
|
50
|
+
</a-form>
|
|
51
|
+
</div>
|
|
52
|
+
</common-layout>
|
|
53
|
+
</template>
|
|
54
|
+
|
|
55
|
+
<script>
|
|
56
|
+
import CommonLayout from '@vue2-client/layouts/CommonLayout'
|
|
57
|
+
import { getRoutesConfig, login } from '@vue2-client/services/user'
|
|
58
|
+
import { setAuthorization } from '@vue2-client/utils/request'
|
|
59
|
+
import { loadRoutes, funcToRouter } from '@vue2-client/utils/routerUtil'
|
|
60
|
+
import { mapMutations } from 'vuex'
|
|
61
|
+
import JSEncrypt from 'jsencrypt'
|
|
62
|
+
import { ACCESS_TOKEN } from '@vue2-client/store/mutation-types'
|
|
63
|
+
import Vue from 'vue'
|
|
64
|
+
import Mock from 'mockjs'
|
|
65
|
+
import { positions } from '@vue2-client/mock/common'
|
|
66
|
+
const { homePage } = require('@vue2-client/config')
|
|
67
|
+
// import { router } from '@vue2-client/mock/user/routes'
|
|
68
|
+
|
|
69
|
+
export default {
|
|
70
|
+
name: 'Login',
|
|
71
|
+
components: { CommonLayout },
|
|
72
|
+
data () {
|
|
73
|
+
return {
|
|
74
|
+
logging: false,
|
|
75
|
+
error: '',
|
|
76
|
+
form: this.$form.createForm(this)
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
computed: {
|
|
80
|
+
systemName () {
|
|
81
|
+
return this.$store.state.setting.systemName
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
methods: {
|
|
85
|
+
...mapMutations('account', ['setUser', 'setPermissions', 'setRoles']),
|
|
86
|
+
onSubmit (e) {
|
|
87
|
+
e.preventDefault()
|
|
88
|
+
this.form.validateFields((err) => {
|
|
89
|
+
if (!err) {
|
|
90
|
+
this.logging = true
|
|
91
|
+
const name = this.form.getFieldValue('name')
|
|
92
|
+
const password = this.form.getFieldValue('password')
|
|
93
|
+
login(name, password).then(this.afterLogin)
|
|
94
|
+
}
|
|
95
|
+
})
|
|
96
|
+
},
|
|
97
|
+
afterLogin (res) {
|
|
98
|
+
const name = this.form.getFieldValue('name')
|
|
99
|
+
const password = this.form.getFieldValue('password')
|
|
100
|
+
this.logging = false
|
|
101
|
+
const loginRes = res.states
|
|
102
|
+
if (loginRes === '登录成功') {
|
|
103
|
+
const encrypt = new JSEncrypt()
|
|
104
|
+
encrypt.setPublicKey('MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqPvovSfXcwBbW8cKMCgwqNpsYuzF8RPAPFb7LGsnVo44JhM/xxzDyzoYtdfNmtbIuKVi9PzIsyp6rg+09gbuI6UGwBZ5DWBDBMqv5MPdOF5dCQkB2Bbr5yPfURPENypUz+pBFBg41d+BC+rwRiXELwKy7Y9caD/MtJyHydj8OUwIDAQAB')
|
|
105
|
+
const data = encrypt.encrypt(JSON.stringify({ username: name, password: password }))
|
|
106
|
+
localStorage.setItem(ACCESS_TOKEN, data)
|
|
107
|
+
// 获取路由配置
|
|
108
|
+
getRoutesConfig(data).then(result => {
|
|
109
|
+
Vue.$login.login(result).then(() => {
|
|
110
|
+
const user = Object.assign({
|
|
111
|
+
username: result.ename,
|
|
112
|
+
name: result.name,
|
|
113
|
+
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/jZUIxmJycoymBprLOUbT.png',
|
|
114
|
+
address: '西安市',
|
|
115
|
+
position: positions[0]
|
|
116
|
+
}, result)
|
|
117
|
+
this.setUser(user)
|
|
118
|
+
this.setPermissions([{ id: 'queryForm', operation: ['add', 'edit'] }])
|
|
119
|
+
this.setRoles([{ id: 'admin', operation: ['add', 'edit', 'delete'] }])
|
|
120
|
+
let timestamp = new Date().getTime()// 当前的时间戳
|
|
121
|
+
timestamp = timestamp + 60 * 60 * 1000
|
|
122
|
+
// 格式化时间获取年月日, 登陆过期时间
|
|
123
|
+
const dateAfter = new Date(timestamp)
|
|
124
|
+
setAuthorization({ token: data, expireAt: dateAfter })
|
|
125
|
+
loadRoutes(funcToRouter(user.functions))
|
|
126
|
+
this.$router.push(homePage).catch(() => {})
|
|
127
|
+
this.$message.success(Mock.mock('@TIMEFIX').CN + ',欢迎回来', 3)
|
|
128
|
+
})
|
|
129
|
+
})
|
|
130
|
+
} else {
|
|
131
|
+
this.error = loginRes
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
</script>
|
|
137
|
+
|
|
138
|
+
<style lang="less" scoped>
|
|
139
|
+
.common-layout{
|
|
140
|
+
.top {
|
|
141
|
+
text-align: center;
|
|
142
|
+
.header {
|
|
143
|
+
height: 44px;
|
|
144
|
+
line-height: 44px;
|
|
145
|
+
a {
|
|
146
|
+
text-decoration: none;
|
|
147
|
+
}
|
|
148
|
+
.logo {
|
|
149
|
+
height: 44px;
|
|
150
|
+
vertical-align: top;
|
|
151
|
+
margin-right: 16px;
|
|
152
|
+
}
|
|
153
|
+
.title {
|
|
154
|
+
font-size: 33px;
|
|
155
|
+
color: @title-color;
|
|
156
|
+
font-family: 'Myriad Pro', 'Helvetica Neue', Arial, Helvetica, sans-serif;
|
|
157
|
+
font-weight: 600;
|
|
158
|
+
position: relative;
|
|
159
|
+
top: 2px;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
.desc {
|
|
163
|
+
font-size: 14px;
|
|
164
|
+
color: @text-color-second;
|
|
165
|
+
margin-top: 12px;
|
|
166
|
+
margin-bottom: 40px;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
.login{
|
|
170
|
+
width: 368px;
|
|
171
|
+
margin: 0 auto;
|
|
172
|
+
@media screen and (max-width: 576px) {
|
|
173
|
+
width: 95%;
|
|
174
|
+
}
|
|
175
|
+
@media screen and (max-width: 320px) {
|
|
176
|
+
.captcha-button{
|
|
177
|
+
font-size: 14px;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
.icon {
|
|
181
|
+
font-size: 24px;
|
|
182
|
+
color: @text-color-second;
|
|
183
|
+
margin-left: 16px;
|
|
184
|
+
vertical-align: middle;
|
|
185
|
+
cursor: pointer;
|
|
186
|
+
transition: color 0.3s;
|
|
187
|
+
|
|
188
|
+
&:hover {
|
|
189
|
+
color: @primary-color;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
</style>
|
|
@@ -1,125 +1,125 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
name: 'ReportTable',
|
|
3
|
-
functional: true,
|
|
4
|
-
render (h, content) {
|
|
5
|
-
if (!content.props.tableData) {
|
|
6
|
-
console.log('没有报表数据')
|
|
7
|
-
return
|
|
8
|
-
}
|
|
9
|
-
console.log('content=>', content)
|
|
10
|
-
const html = reportCompute(h, content.props.tableData)
|
|
11
|
-
console.log('html=>', html)
|
|
12
|
-
// 报表整体高度和宽度
|
|
13
|
-
const reportClass = `h-${html.h} w-${html.w}`
|
|
14
|
-
const report = (
|
|
15
|
-
<div id='ReportTableHome'>
|
|
16
|
-
<div id='reportTable' class={reportClass}>
|
|
17
|
-
{html.el}
|
|
18
|
-
</div>
|
|
19
|
-
</div>
|
|
20
|
-
)
|
|
21
|
-
return report
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* class类生成
|
|
26
|
-
* @param w 宽
|
|
27
|
-
* @param h 高
|
|
28
|
-
* @param l left
|
|
29
|
-
* @param t top
|
|
30
|
-
* @returns {string}
|
|
31
|
-
*/
|
|
32
|
-
function generClass ({ w = 1, h = 1, l, t }) {
|
|
33
|
-
return `w-${w} h-${h} l-${l} t-${t}`
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* 判断是否是个Number数据
|
|
37
|
-
* @param value
|
|
38
|
-
* @returns {boolean}
|
|
39
|
-
*/
|
|
40
|
-
function typeNumber (value) {
|
|
41
|
-
return Object.prototype.toString.call(value) === '[object Number]'
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* 判断是否是个object数据
|
|
45
|
-
* @param value
|
|
46
|
-
* @returns {boolean}
|
|
47
|
-
*/
|
|
48
|
-
function typeObject (value) {
|
|
49
|
-
return Object.prototype.toString.call(value) === '[object Object]'
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* 判断是否是个Array数据
|
|
53
|
-
* @param value
|
|
54
|
-
* @returns {boolean}
|
|
55
|
-
*/
|
|
56
|
-
function typeArray (value) {
|
|
57
|
-
return Object.prototype.toString.call(value) === '[object Array]'
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* 一行数据转换html函数
|
|
61
|
-
* @param h vue的h
|
|
62
|
-
* @param row 一行json数据
|
|
63
|
-
* @param left 起始left距离
|
|
64
|
-
* @param top 起始top距离
|
|
65
|
-
* @returns {{el: Array, h: number}}
|
|
66
|
-
*/
|
|
67
|
-
function rowCompute (h, row, left, top) {
|
|
68
|
-
if (typeObject(row)) {
|
|
69
|
-
const el = []
|
|
70
|
-
const keys = Object.keys(row).filter((res) => res != 'span')
|
|
71
|
-
let heigth = 0
|
|
72
|
-
for (const key of keys.values()) {
|
|
73
|
-
const value = row[key]['value'] ? row[key]['value'] : row[key]
|
|
74
|
-
const style = { l: left, t: top + heigth }
|
|
75
|
-
style.w = row[key]['span'] ? row[key]['span'] : 1
|
|
76
|
-
const nextL = left + style.w
|
|
77
|
-
const nextT = top + heigth
|
|
78
|
-
const divObject = rowCompute(h, value, nextL, nextT)
|
|
79
|
-
el.push(divObject.el)
|
|
80
|
-
style.h = divObject.h ? divObject.h : 1
|
|
81
|
-
heigth += style.h
|
|
82
|
-
const attrs = { class: generClass(style) + ' title' }
|
|
83
|
-
const div = <div {...attrs}>{key == 'value' ? value : key}</div>
|
|
84
|
-
el.push(div)
|
|
85
|
-
}
|
|
86
|
-
return { h: heigth, el: el }
|
|
87
|
-
} else if (typeArray(row)) {
|
|
88
|
-
const el = []
|
|
89
|
-
for (const [i, value] of row.entries()) {
|
|
90
|
-
const style = { l: (left + i), t: top, w: 1, h: 1 }
|
|
91
|
-
const extraClass = typeNumber(value) ? 'bold' : 'title'
|
|
92
|
-
const attrs = { class: generClass(style) + ` ${extraClass}` }
|
|
93
|
-
const div = <div {...attrs}>{value}</div>
|
|
94
|
-
el.push(div)
|
|
95
|
-
}
|
|
96
|
-
return { h: 1, el: el }
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* 完整报表数据转换html函数
|
|
101
|
-
* @param h vue的h
|
|
102
|
-
* @param jsonArr json数组
|
|
103
|
-
* @returns {{el: Array, h: number}}
|
|
104
|
-
*/
|
|
105
|
-
function reportCompute (h, jsonArr) {
|
|
106
|
-
const html = []
|
|
107
|
-
let heigth = 0
|
|
108
|
-
let width = 0
|
|
109
|
-
for (const [index, row] of jsonArr.entries()) {
|
|
110
|
-
const rowHtml = rowCompute(h, row, 0, index)
|
|
111
|
-
// 取第一行的宽度作为整个报表的宽度
|
|
112
|
-
if (index == 0) {
|
|
113
|
-
const reg = /w-\d\s/
|
|
114
|
-
for (const vNode of rowHtml.el) {
|
|
115
|
-
if (!vNode.data || !vNode.data.class) continue
|
|
116
|
-
const c = vNode.data.class
|
|
117
|
-
const w = c.match(reg)[0].split('-')[1]
|
|
118
|
-
width += (w - 0)
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
heigth += rowHtml.h
|
|
122
|
-
html.push(rowHtml.el)
|
|
123
|
-
}
|
|
124
|
-
return { el: html, h: heigth, w: width }
|
|
125
|
-
}
|
|
1
|
+
export default {
|
|
2
|
+
name: 'ReportTable',
|
|
3
|
+
functional: true,
|
|
4
|
+
render (h, content) {
|
|
5
|
+
if (!content.props.tableData) {
|
|
6
|
+
console.log('没有报表数据')
|
|
7
|
+
return
|
|
8
|
+
}
|
|
9
|
+
console.log('content=>', content)
|
|
10
|
+
const html = reportCompute(h, content.props.tableData)
|
|
11
|
+
console.log('html=>', html)
|
|
12
|
+
// 报表整体高度和宽度
|
|
13
|
+
const reportClass = `h-${html.h} w-${html.w}`
|
|
14
|
+
const report = (
|
|
15
|
+
<div id='ReportTableHome'>
|
|
16
|
+
<div id='reportTable' class={reportClass}>
|
|
17
|
+
{html.el}
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
)
|
|
21
|
+
return report
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* class类生成
|
|
26
|
+
* @param w 宽
|
|
27
|
+
* @param h 高
|
|
28
|
+
* @param l left
|
|
29
|
+
* @param t top
|
|
30
|
+
* @returns {string}
|
|
31
|
+
*/
|
|
32
|
+
function generClass ({ w = 1, h = 1, l, t }) {
|
|
33
|
+
return `w-${w} h-${h} l-${l} t-${t}`
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* 判断是否是个Number数据
|
|
37
|
+
* @param value
|
|
38
|
+
* @returns {boolean}
|
|
39
|
+
*/
|
|
40
|
+
function typeNumber (value) {
|
|
41
|
+
return Object.prototype.toString.call(value) === '[object Number]'
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* 判断是否是个object数据
|
|
45
|
+
* @param value
|
|
46
|
+
* @returns {boolean}
|
|
47
|
+
*/
|
|
48
|
+
function typeObject (value) {
|
|
49
|
+
return Object.prototype.toString.call(value) === '[object Object]'
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* 判断是否是个Array数据
|
|
53
|
+
* @param value
|
|
54
|
+
* @returns {boolean}
|
|
55
|
+
*/
|
|
56
|
+
function typeArray (value) {
|
|
57
|
+
return Object.prototype.toString.call(value) === '[object Array]'
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* 一行数据转换html函数
|
|
61
|
+
* @param h vue的h
|
|
62
|
+
* @param row 一行json数据
|
|
63
|
+
* @param left 起始left距离
|
|
64
|
+
* @param top 起始top距离
|
|
65
|
+
* @returns {{el: Array, h: number}}
|
|
66
|
+
*/
|
|
67
|
+
function rowCompute (h, row, left, top) {
|
|
68
|
+
if (typeObject(row)) {
|
|
69
|
+
const el = []
|
|
70
|
+
const keys = Object.keys(row).filter((res) => res != 'span')
|
|
71
|
+
let heigth = 0
|
|
72
|
+
for (const key of keys.values()) {
|
|
73
|
+
const value = row[key]['value'] ? row[key]['value'] : row[key]
|
|
74
|
+
const style = { l: left, t: top + heigth }
|
|
75
|
+
style.w = row[key]['span'] ? row[key]['span'] : 1
|
|
76
|
+
const nextL = left + style.w
|
|
77
|
+
const nextT = top + heigth
|
|
78
|
+
const divObject = rowCompute(h, value, nextL, nextT)
|
|
79
|
+
el.push(divObject.el)
|
|
80
|
+
style.h = divObject.h ? divObject.h : 1
|
|
81
|
+
heigth += style.h
|
|
82
|
+
const attrs = { class: generClass(style) + ' title' }
|
|
83
|
+
const div = <div {...attrs}>{key == 'value' ? value : key}</div>
|
|
84
|
+
el.push(div)
|
|
85
|
+
}
|
|
86
|
+
return { h: heigth, el: el }
|
|
87
|
+
} else if (typeArray(row)) {
|
|
88
|
+
const el = []
|
|
89
|
+
for (const [i, value] of row.entries()) {
|
|
90
|
+
const style = { l: (left + i), t: top, w: 1, h: 1 }
|
|
91
|
+
const extraClass = typeNumber(value) ? 'bold' : 'title'
|
|
92
|
+
const attrs = { class: generClass(style) + ` ${extraClass}` }
|
|
93
|
+
const div = <div {...attrs}>{value}</div>
|
|
94
|
+
el.push(div)
|
|
95
|
+
}
|
|
96
|
+
return { h: 1, el: el }
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* 完整报表数据转换html函数
|
|
101
|
+
* @param h vue的h
|
|
102
|
+
* @param jsonArr json数组
|
|
103
|
+
* @returns {{el: Array, h: number}}
|
|
104
|
+
*/
|
|
105
|
+
function reportCompute (h, jsonArr) {
|
|
106
|
+
const html = []
|
|
107
|
+
let heigth = 0
|
|
108
|
+
let width = 0
|
|
109
|
+
for (const [index, row] of jsonArr.entries()) {
|
|
110
|
+
const rowHtml = rowCompute(h, row, 0, index)
|
|
111
|
+
// 取第一行的宽度作为整个报表的宽度
|
|
112
|
+
if (index == 0) {
|
|
113
|
+
const reg = /w-\d\s/
|
|
114
|
+
for (const vNode of rowHtml.el) {
|
|
115
|
+
if (!vNode.data || !vNode.data.class) continue
|
|
116
|
+
const c = vNode.data.class
|
|
117
|
+
const w = c.match(reg)[0].split('-')[1]
|
|
118
|
+
width += (w - 0)
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
heigth += rowHtml.h
|
|
122
|
+
html.push(rowHtml.el)
|
|
123
|
+
}
|
|
124
|
+
return { el: html, h: heigth, w: width }
|
|
125
|
+
}
|