vue2-client 1.2.117 → 1.3.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.
Files changed (28) hide show
  1. package/CHANGELOG.md +304 -287
  2. package/package.json +76 -76
  3. package/src/base-client/all.js +62 -62
  4. package/src/base-client/components/common/CreateQuery/CreateQuery.vue +551 -547
  5. package/src/base-client/components/common/XCard/XCard.vue +64 -64
  6. package/src/base-client/components/common/XFormTable/XFormTable.vue +503 -514
  7. package/src/base-client/components/common/XFormTable/index.md +96 -96
  8. package/src/base-client/components/iot/DeviceDetailsView/DeviceDetailsView.vue +232 -232
  9. package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsCount.vue +678 -678
  10. package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsException.vue +57 -57
  11. package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsRead.vue +131 -131
  12. package/src/base-client/components/iot/DeviceTypeDetailsView/DeviceTypeDetailsView.vue +300 -300
  13. package/src/base-client/components/iot/InstructDetailsView/InstructDetailsView.vue +464 -461
  14. package/src/base-client/components/ticket/TicketSubmitSuccessView/TicketSubmitSuccessView.vue +532 -532
  15. package/src/base-client/plugins/AppData.js +71 -71
  16. package/src/base-client/plugins/compatible/LoginServiceOA.js +20 -20
  17. package/src/pages/login/Login.vue +277 -277
  18. package/src/pages/resourceManage/orgListManage.vue +98 -98
  19. package/src/router/async/config.async.js +27 -26
  20. package/src/router/index.js +27 -27
  21. package/src/services/api/common.js +58 -58
  22. package/src/services/api/index.js +39 -39
  23. package/src/services/api/iot/DeviceDetailsView/DeviceDetailsCountApi.js +18 -18
  24. package/src/store/mutation-types.js +2 -2
  25. package/src/theme/default/style.less +47 -47
  26. package/src/utils/request.js +225 -225
  27. package/src/utils/routerUtil.js +358 -350
  28. package/src/utils/util.js +230 -230
@@ -1,277 +1,277 @@
1
- <template>
2
- <common-layout>
3
- <div class="top">
4
- <div class="header">
5
- <img alt="logo" class="logo" src="@vue2-client/assets/img/logo.png" />
6
- <span class="title">{{ systemName }}</span>
7
- </div>
8
- <div class="desc">{{ systemDesc }}</div>
9
- </div>
10
- <div class="login">
11
- <a-form :form="form" @submit="onSubmit">
12
- <a-tabs :tabBarStyle="{textAlign: 'center'}" size="large" style="padding: 0 2px;">
13
- <a-tab-pane key="1" tab="账户密码登录">
14
- <a-alert
15
- v-show="error"
16
- :closable="true"
17
- :message="error"
18
- showIcon
19
- style="margin-bottom: 24px;"
20
- type="error" />
21
- <a-form-item>
22
- <a-input
23
- v-decorator="['name', {rules: [{ required: true, message: '请输入账户名', whitespace: true}]}]"
24
- autocomplete="autocomplete"
25
- placeholder="admin"
26
- size="large"
27
- >
28
- <a-icon slot="prefix" type="user" />
29
- </a-input>
30
- </a-form-item>
31
- <a-form-item>
32
- <a-input
33
- v-decorator="['password', {rules: [{ required: true, message: '请输入密码', whitespace: true}]}]"
34
- autocomplete="autocomplete"
35
- placeholder="888888"
36
- size="large"
37
- type="password"
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" htmlType="submit" size="large" style="width: 100%;margin-top: 24px" 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, V4Login } 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, mapState } from 'vuex'
61
- import JSEncrypt from 'jsencrypt'
62
- import { ACCESS_TOKEN } from '@vue2-client/store/mutation-types'
63
- import { positions } from '@vue2-client/mock/common'
64
- import { timeFix } from '@vue2-client/utils/util'
65
- import { loginStart } from '@vue2-client/base-client/plugins/compatible/LoginServiceOA'
66
-
67
- export default {
68
- name: 'Login',
69
- components: { CommonLayout },
70
- data () {
71
- return {
72
- logging: false,
73
- error: '',
74
- form: this.$form.createForm(this)
75
- }
76
- },
77
- computed: {
78
- ...mapState('setting', ['systemName', 'systemDesc', 'homePage', 'ticketPage', 'compatible'])
79
- },
80
- methods: {
81
- ...mapMutations('account', ['setUser', 'setPermissions', 'setRoles']),
82
- onSubmit (e) {
83
- e.preventDefault()
84
- this.form.validateFields((err) => {
85
- if (!err) {
86
- this.logging = true
87
- const name = this.form.getFieldValue('name')
88
- const password = this.form.getFieldValue('password')
89
- switch (this.compatible) {
90
- case 'V3': {
91
- login(name, password).then(this.afterLogin)
92
- break
93
- }
94
- case 'OA' : {
95
- loginStart(name, password).then(this.afterLoginOA).finally(() => { this.logging = false })
96
- break
97
- }
98
- case 'V4' : {
99
- V4Login(name, password).then(this.afterLoginV4)
100
- break
101
- }
102
- }
103
- }
104
- })
105
- },
106
- afterLoginOA (result) {
107
- // 默认第一个是旧OA地址
108
- result.functions[0].navigate = result.functions[0].link
109
- result.functions[0].link = null
110
- this.afterGeneral(result)
111
- this.setAccessToken(result.password)
112
- this.$router.push(this.homePage).catch(() => {})
113
- },
114
- afterLoginV4 (res) {
115
- const name = this.form.getFieldValue('name')
116
- const password = this.form.getFieldValue('password')
117
- this.logging = false
118
- const loginRes = res
119
- // 如果这是用户首次打开本系统,localStorage无法初始化,改用code判断
120
- let pass = false
121
- let V4Token = {}
122
- // 判断是否是第一次使用本系统
123
- if (res.code) {
124
- if (res.code === 200) {
125
- pass = true
126
- // 如果返回值有code,证明是第一次使用系统,localStorage判断compatible失效
127
- // token需要从.data中获取
128
- V4Token = { token: res.data.access_token, expire: res.data.expires_in }
129
- }
130
- } else {
131
- V4Token = { token: res.access_token, expire: res.expires_in }
132
- }
133
- this.setV4AccessToken(V4Token)
134
- // 向本地缓存中临时存储compatible
135
- if (loginRes.access_token || pass) {
136
- const encrypt = new JSEncrypt()
137
- encrypt.setPublicKey('MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqPvovSfXcwBbW8cKMCgwqNpsYuzF8RPAPFb7LGsnVo44JhM/xxzDyzoYtdfNmtbIuKVi9PzIsyp6rg+09gbuI6UGwBZ5DWBDBMqv5MPdOF5dCQkB2Bbr5yPfURPENypUz+pBFBg41d+BC+rwRiXELwKy7Y9caD/MtJyHydj8OUwIDAQAB')
138
- const data = encrypt.encrypt(JSON.stringify({ username: name, password: password }))
139
- // 获取路由配置
140
- getRoutesConfig(data).then(result => {
141
- this.$login.login(result).then(() => {
142
- this.afterGeneral(result)
143
- if (result.deps === '用户工单登记') {
144
- this.$router.push(this.ticketPage).catch(() => {})
145
- } else {
146
- this.$router.push(this.homePage).catch(() => {})
147
- }
148
- })
149
- })
150
- } else {
151
- this.error = loginRes.msg
152
- }
153
- },
154
- afterLogin (res) {
155
- const name = this.form.getFieldValue('name')
156
- const password = this.form.getFieldValue('password')
157
- this.logging = false
158
- const loginRes = res.states
159
- if (loginRes === '登录成功') {
160
- const encrypt = new JSEncrypt()
161
- encrypt.setPublicKey('MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqPvovSfXcwBbW8cKMCgwqNpsYuzF8RPAPFb7LGsnVo44JhM/xxzDyzoYtdfNmtbIuKVi9PzIsyp6rg+09gbuI6UGwBZ5DWBDBMqv5MPdOF5dCQkB2Bbr5yPfURPENypUz+pBFBg41d+BC+rwRiXELwKy7Y9caD/MtJyHydj8OUwIDAQAB')
162
- const data = encrypt.encrypt(JSON.stringify({ username: name, password: password }))
163
- // 获取路由配置
164
- getRoutesConfig(data).then(result => {
165
- this.$login.login(result).then(() => {
166
- // V3任何情况首位加入资源管理
167
- const resourceManageMain = {
168
- name: '资源管理',
169
- icon: 'api',
170
- position: 1,
171
- link: 'resourceManageMain'
172
- }
173
- result.functions.unshift(resourceManageMain)
174
- this.afterGeneral(result)
175
- this.setAccessToken(data)
176
- if (result.deps === '用户工单登记') {
177
- this.$router.push(this.ticketPage).catch(() => {})
178
- } else {
179
- this.$router.push(this.homePage).catch(() => {})
180
- }
181
- })
182
- })
183
- } else {
184
- this.error = loginRes
185
- }
186
- },
187
- afterGeneral (result) {
188
- const user = Object.assign({
189
- username: result.ename,
190
- name: result.name,
191
- avatar: 'https://gw.alipayobjects.com/zos/rmsportal/jZUIxmJycoymBprLOUbT.png',
192
- address: '西安市',
193
- position: positions[0]
194
- }, result)
195
- this.setUser(user)
196
- this.setPermissions([{ id: 'queryForm', operation: ['add', 'edit'] }])
197
- this.setRoles([{ id: 'admin', operation: ['add', 'edit', 'delete'] }])
198
- loadRoutes(funcToRouter(user.functions))
199
- this.$message.success(timeFix().CN + `,${result.name} 欢迎回来`, 3)
200
- },
201
- setAccessToken (data) {
202
- if (data) {
203
- localStorage.setItem(ACCESS_TOKEN, data)
204
- let timestamp = new Date().getTime()// 当前的时间戳
205
- timestamp = timestamp + 12 * 60 * 60 * 1000
206
- // 格式化时间获取年月日, 登陆过期时间
207
- const dateAfter = new Date(timestamp)
208
- setAuthorization({ token: data, expireAt: dateAfter })
209
- }
210
- },
211
- setV4AccessToken (data) {
212
- if (data.token) {
213
- localStorage.setItem(ACCESS_TOKEN, data.token)
214
- setAuthorization({ token: data.token, expire: data.expire })
215
- }
216
- }
217
- }
218
- }
219
- </script>
220
-
221
- <style lang="less" scoped>
222
- .common-layout{
223
- .top {
224
- text-align: center;
225
- .header {
226
- height: 44px;
227
- line-height: 44px;
228
- a {
229
- text-decoration: none;
230
- }
231
- .logo {
232
- height: 44px;
233
- vertical-align: top;
234
- margin-right: 16px;
235
- }
236
- .title {
237
- font-size: 33px;
238
- color: @title-color;
239
- font-family: 'Myriad Pro', 'Helvetica Neue', Arial, Helvetica, sans-serif;
240
- font-weight: 600;
241
- position: relative;
242
- top: 2px;
243
- }
244
- }
245
- .desc {
246
- font-size: 14px;
247
- color: @text-color-second;
248
- margin-top: 12px;
249
- margin-bottom: 40px;
250
- }
251
- }
252
- .login{
253
- width: 368px;
254
- margin: 0 auto;
255
- @media screen and (max-width: 576px) {
256
- width: 95%;
257
- }
258
- @media screen and (max-width: 320px) {
259
- .captcha-button{
260
- font-size: 14px;
261
- }
262
- }
263
- .icon {
264
- font-size: 24px;
265
- color: @text-color-second;
266
- margin-left: 16px;
267
- vertical-align: middle;
268
- cursor: pointer;
269
- transition: color 0.3s;
270
-
271
- &:hover {
272
- color: @primary-color;
273
- }
274
- }
275
- }
276
- }
277
- </style>
1
+ <template>
2
+ <common-layout>
3
+ <div class="top">
4
+ <div class="header">
5
+ <img alt="logo" class="logo" src="@vue2-client/assets/img/logo.png" />
6
+ <span class="title">{{ systemName }}</span>
7
+ </div>
8
+ <div class="desc">{{ systemDesc }}</div>
9
+ </div>
10
+ <div class="login">
11
+ <a-form :form="form" @submit="onSubmit">
12
+ <a-tabs :tabBarStyle="{textAlign: 'center'}" size="large" style="padding: 0 2px;">
13
+ <a-tab-pane key="1" tab="账户密码登录">
14
+ <a-alert
15
+ v-show="error"
16
+ :closable="true"
17
+ :message="error"
18
+ showIcon
19
+ style="margin-bottom: 24px;"
20
+ type="error" />
21
+ <a-form-item>
22
+ <a-input
23
+ v-decorator="['name', {rules: [{ required: true, message: '请输入账户名', whitespace: true}]}]"
24
+ autocomplete="autocomplete"
25
+ placeholder="admin"
26
+ size="large"
27
+ >
28
+ <a-icon slot="prefix" type="user" />
29
+ </a-input>
30
+ </a-form-item>
31
+ <a-form-item>
32
+ <a-input
33
+ v-decorator="['password', {rules: [{ required: true, message: '请输入密码', whitespace: true}]}]"
34
+ autocomplete="autocomplete"
35
+ placeholder="888888"
36
+ size="large"
37
+ type="password"
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" htmlType="submit" size="large" style="width: 100%;margin-top: 24px" 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, V4Login } 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, mapState } from 'vuex'
61
+ import JSEncrypt from 'jsencrypt'
62
+ import { ACCESS_TOKEN } from '@vue2-client/store/mutation-types'
63
+ import { positions } from '@vue2-client/mock/common'
64
+ import { timeFix } from '@vue2-client/utils/util'
65
+ import { loginStart } from '@vue2-client/base-client/plugins/compatible/LoginServiceOA'
66
+
67
+ export default {
68
+ name: 'Login',
69
+ components: { CommonLayout },
70
+ data () {
71
+ return {
72
+ logging: false,
73
+ error: '',
74
+ form: this.$form.createForm(this)
75
+ }
76
+ },
77
+ computed: {
78
+ ...mapState('setting', ['systemName', 'systemDesc', 'homePage', 'ticketPage', 'compatible'])
79
+ },
80
+ methods: {
81
+ ...mapMutations('account', ['setUser', 'setPermissions', 'setRoles']),
82
+ onSubmit (e) {
83
+ e.preventDefault()
84
+ this.form.validateFields((err) => {
85
+ if (!err) {
86
+ this.logging = true
87
+ const name = this.form.getFieldValue('name')
88
+ const password = this.form.getFieldValue('password')
89
+ switch (this.compatible) {
90
+ case 'V3': {
91
+ login(name, password).then(this.afterLogin)
92
+ break
93
+ }
94
+ case 'OA' : {
95
+ loginStart(name, password).then(this.afterLoginOA).finally(() => { this.logging = false })
96
+ break
97
+ }
98
+ case 'V4' : {
99
+ V4Login(name, password).then(this.afterLoginV4)
100
+ break
101
+ }
102
+ }
103
+ }
104
+ })
105
+ },
106
+ afterLoginOA (result) {
107
+ // 默认第一个是旧OA地址
108
+ result.functions[0].navigate = result.functions[0].link
109
+ result.functions[0].link = null
110
+ this.afterGeneral(result)
111
+ this.setAccessToken(result.password)
112
+ this.$router.push(this.homePage).catch(() => {})
113
+ },
114
+ afterLoginV4 (res) {
115
+ const name = this.form.getFieldValue('name')
116
+ const password = this.form.getFieldValue('password')
117
+ this.logging = false
118
+ const loginRes = res
119
+ // 如果这是用户首次打开本系统,localStorage无法初始化,改用code判断
120
+ let pass = false
121
+ let V4Token = {}
122
+ // 判断是否是第一次使用本系统
123
+ if (res.code) {
124
+ if (res.code === 200) {
125
+ pass = true
126
+ // 如果返回值有code,证明是第一次使用系统,localStorage判断compatible失效
127
+ // token需要从.data中获取
128
+ V4Token = { token: res.data.access_token, expire: res.data.expires_in }
129
+ }
130
+ } else {
131
+ V4Token = { token: res.access_token, expire: res.expires_in }
132
+ }
133
+ this.setV4AccessToken(V4Token)
134
+ // 向本地缓存中临时存储compatible
135
+ if (loginRes.access_token || pass) {
136
+ const encrypt = new JSEncrypt()
137
+ encrypt.setPublicKey('MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqPvovSfXcwBbW8cKMCgwqNpsYuzF8RPAPFb7LGsnVo44JhM/xxzDyzoYtdfNmtbIuKVi9PzIsyp6rg+09gbuI6UGwBZ5DWBDBMqv5MPdOF5dCQkB2Bbr5yPfURPENypUz+pBFBg41d+BC+rwRiXELwKy7Y9caD/MtJyHydj8OUwIDAQAB')
138
+ const data = encrypt.encrypt(JSON.stringify({ username: name, password: password }))
139
+ // 获取路由配置
140
+ getRoutesConfig(data).then(result => {
141
+ this.$login.login(result).then(() => {
142
+ this.afterGeneral(result)
143
+ if (result.deps === '用户工单登记') {
144
+ this.$router.push(this.ticketPage).catch(() => {})
145
+ } else {
146
+ this.$router.push(this.homePage).catch(() => {})
147
+ }
148
+ })
149
+ })
150
+ } else {
151
+ this.error = loginRes.msg
152
+ }
153
+ },
154
+ afterLogin (res) {
155
+ const name = this.form.getFieldValue('name')
156
+ const password = this.form.getFieldValue('password')
157
+ this.logging = false
158
+ const loginRes = res.states
159
+ if (loginRes === '登录成功') {
160
+ const encrypt = new JSEncrypt()
161
+ encrypt.setPublicKey('MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqPvovSfXcwBbW8cKMCgwqNpsYuzF8RPAPFb7LGsnVo44JhM/xxzDyzoYtdfNmtbIuKVi9PzIsyp6rg+09gbuI6UGwBZ5DWBDBMqv5MPdOF5dCQkB2Bbr5yPfURPENypUz+pBFBg41d+BC+rwRiXELwKy7Y9caD/MtJyHydj8OUwIDAQAB')
162
+ const data = encrypt.encrypt(JSON.stringify({ username: name, password: password }))
163
+ // 获取路由配置
164
+ getRoutesConfig(data).then(result => {
165
+ this.$login.login(result).then(() => {
166
+ // V3任何情况首位加入资源管理
167
+ const resourceManageMain = {
168
+ name: '资源管理',
169
+ icon: 'api',
170
+ position: 1,
171
+ link: 'resourceManageMain'
172
+ }
173
+ result.functions.unshift(resourceManageMain)
174
+ this.afterGeneral(result)
175
+ this.setAccessToken(data)
176
+ if (result.deps === '用户工单登记') {
177
+ this.$router.push(this.ticketPage).catch(() => {})
178
+ } else {
179
+ this.$router.push(this.homePage).catch(() => {})
180
+ }
181
+ })
182
+ })
183
+ } else {
184
+ this.error = loginRes
185
+ }
186
+ },
187
+ afterGeneral (result) {
188
+ const user = Object.assign({
189
+ username: result.ename,
190
+ name: result.name,
191
+ avatar: 'https://gw.alipayobjects.com/zos/rmsportal/jZUIxmJycoymBprLOUbT.png',
192
+ address: '西安市',
193
+ position: positions[0]
194
+ }, result)
195
+ this.setUser(user)
196
+ this.setPermissions([{ id: 'queryForm', operation: ['add', 'edit'] }])
197
+ this.setRoles([{ id: 'admin', operation: ['add', 'edit', 'delete'] }])
198
+ loadRoutes(funcToRouter(user.functions))
199
+ this.$message.success(timeFix().CN + `,${result.name} 欢迎回来`, 3)
200
+ },
201
+ setAccessToken (data) {
202
+ if (data) {
203
+ localStorage.setItem(ACCESS_TOKEN, data)
204
+ let timestamp = new Date().getTime()// 当前的时间戳
205
+ timestamp = timestamp + 12 * 60 * 60 * 1000
206
+ // 格式化时间获取年月日, 登陆过期时间
207
+ const dateAfter = new Date(timestamp)
208
+ setAuthorization({ token: data, expireAt: dateAfter })
209
+ }
210
+ },
211
+ setV4AccessToken (data) {
212
+ if (data.token) {
213
+ localStorage.setItem(ACCESS_TOKEN, data.token)
214
+ setAuthorization({ token: data.token, expire: data.expire })
215
+ }
216
+ }
217
+ }
218
+ }
219
+ </script>
220
+
221
+ <style lang="less" scoped>
222
+ .common-layout{
223
+ .top {
224
+ text-align: center;
225
+ .header {
226
+ height: 44px;
227
+ line-height: 44px;
228
+ a {
229
+ text-decoration: none;
230
+ }
231
+ .logo {
232
+ height: 44px;
233
+ vertical-align: top;
234
+ margin-right: 16px;
235
+ }
236
+ .title {
237
+ font-size: 33px;
238
+ color: @title-color;
239
+ font-family: 'Myriad Pro', 'Helvetica Neue', Arial, Helvetica, sans-serif;
240
+ font-weight: 600;
241
+ position: relative;
242
+ top: 2px;
243
+ }
244
+ }
245
+ .desc {
246
+ font-size: 14px;
247
+ color: @text-color-second;
248
+ margin-top: 12px;
249
+ margin-bottom: 40px;
250
+ }
251
+ }
252
+ .login{
253
+ width: 368px;
254
+ margin: 0 auto;
255
+ @media screen and (max-width: 576px) {
256
+ width: 95%;
257
+ }
258
+ @media screen and (max-width: 320px) {
259
+ .captcha-button{
260
+ font-size: 14px;
261
+ }
262
+ }
263
+ .icon {
264
+ font-size: 24px;
265
+ color: @text-color-second;
266
+ margin-left: 16px;
267
+ vertical-align: middle;
268
+ cursor: pointer;
269
+ transition: color 0.3s;
270
+
271
+ &:hover {
272
+ color: @primary-color;
273
+ }
274
+ }
275
+ }
276
+ }
277
+ </style>