n20-common-lib 1.3.62 → 1.3.65

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n20-common-lib",
3
- "version": "1.3.62",
3
+ "version": "1.3.65",
4
4
  "private": false,
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -55,7 +55,6 @@
55
55
  "@vue/cli-plugin-babel": "~4.5.0",
56
56
  "@vue/cli-plugin-eslint": "~4.5.0",
57
57
  "@vue/cli-service": "~4.5.0",
58
- "@vue/compiler-sfc": "^3.0.0-rc.6",
59
58
  "babel-eslint": "^10.1.0",
60
59
  "babel-plugin-component": "^1.1.1",
61
60
  "clipboard": "^2.0.11",
@@ -12,7 +12,9 @@
12
12
  </div>
13
13
 
14
14
  <el-table :data="tableData" :row-key="keys.rowKey" @selection-change="(selection) => (selectionList = selection)">
15
- <slot name="selection-column"><el-table-column type="selection" width="50" align="center" /> </slot>
15
+ <slot name="selection-column">
16
+ <el-table-column type="selection" width="50" align="center" />
17
+ </slot>
16
18
  <template v-if="dataPorp.slotHeader">
17
19
  <el-table-column
18
20
  v-for="item in dataPorp.slotHeader"
@@ -137,7 +139,7 @@
137
139
  <clUpload
138
140
  :ref="'upload' + $index"
139
141
  class="n20-upload-table-up"
140
- :file-name="row['_name'] || row[keys.name]"
142
+ :file-name="row | fileName(keys.url)"
141
143
  :data="row['_fileData'] || fileData"
142
144
  :msg-type="null"
143
145
  :show-clear="false"
@@ -261,6 +263,7 @@
261
263
  :data="fileData"
262
264
  :headers="headers"
263
265
  :accept="fileAccept"
266
+ :size="fileSize"
264
267
  :http-request="uploadHttpRequest"
265
268
  :on-remove="(file) => $emit('on-remove', file)"
266
269
  :on-success="batchSuccess"
@@ -299,6 +302,16 @@ export default {
299
302
  },
300
303
  sizeFilter(type, typeOptions, fileSize) {
301
304
  return typeOptions.find((c) => c.type === type)?.size || fileSize
305
+ },
306
+ fileName(row, urlK) {
307
+ if (row['_name']) {
308
+ return row['_name']
309
+ } else if (row[urlK]) {
310
+ let urlArr = row[urlK].split('/')
311
+ let _n = urlArr[urlArr.length - 1]
312
+ return _n ? decodeURI(_n) : undefined
313
+ }
314
+ return undefined
302
315
  }
303
316
  },
304
317
  props: {
@@ -412,7 +425,7 @@ export default {
412
425
  if (_url) {
413
426
  let blob = await axios.get(_url, {}, { responseType: 'blob' })
414
427
  let url = URL.createObjectURL(blob)
415
- let name = blob.name
428
+ let name = row['_name'] || blob.name
416
429
  let sameOrg = this.seeTypes.test(name) || this.seeTypes.test(_url)
417
430
  return {
418
431
  url,
@@ -113,7 +113,7 @@ export default {
113
113
  }
114
114
  switch (this.type) {
115
115
  case 'rate':
116
- return numerify(val, this.format || '0.00[00]')
116
+ return numerify(val, this.format || '0.0000')
117
117
  case 'money':
118
118
  default:
119
119
  return numerify(val, this.format || '0,0.00')
@@ -233,14 +233,24 @@ export default {
233
233
  }
234
234
  },
235
235
  created() {
236
- getJsonc('/server-config.jsonc').then(({ _layoutData = {} }) => {
237
- this.show = true
236
+ getJsonc('/server-config.jsonc').then(({ _layoutData = {}, loginSetting }) => {
237
+ let _loginSetting = loginSetting || _layoutData.loginSetting
238
238
 
239
239
  this.headerLogoUrl = realUrl(_layoutData.headerLogoUrl)
240
240
  this.headerUserUrl = realUrl(_layoutData.headerUserUrl)
241
241
  this.headerLogoWidth = _layoutData.headerLogoWidth
242
242
  this.headerLogoHeight = _layoutData.headerLogoHeight
243
243
  this.headerTitle = _layoutData.headerTitle
244
+
245
+ if (_loginSetting !== 'JSON') {
246
+ axios.get(`/bems/1.0/sysSetting/list`, null, { loading: false, noMsg: true }).then(({ data }) => {
247
+ this.headerTitle = data.find((d) => d.pmName === 'SYSTEM_NAME')?.pmValue || this.headerTitle
248
+
249
+ this.show = true
250
+ })
251
+ } else {
252
+ this.show = true
253
+ }
244
254
  })
245
255
  },
246
256
  methods: {
@@ -2,31 +2,23 @@
2
2
  <div v-if="alV" v-loading="alV" class="login-wrap">
3
3
  <loginForm
4
4
  ref="login-form"
5
- :login-types="LOGIN_MODE || loginTypes"
5
+ :login-types="loginTypes"
6
6
  :login-then="loginThen"
7
7
  class="login-form"
8
8
  style="display: none"
9
9
  />
10
10
  </div>
11
- <div
12
- v-else
13
- class="login-wrap"
14
- :style="{
15
- backgroundImage: BgImage ? `url(${BgImage})` : `url(${loginBg})`
16
- }"
17
- >
11
+ <div v-else class="login-wrap" :style="{ backgroundImage: loginBg }">
18
12
  <div class="login-logo-box flex-box flex-v">
19
- <img v-if="loginLogo" :src="LogoImage || loginLogo" :style="{ width: loginLogoWidth, height: loginLogoHeight }" />
13
+ <img v-if="loginLogo" :src="loginLogo" :style="{ width: loginLogoWidth, height: loginLogoHeight }" />
20
14
  <span v-if="loginLogo && loginLogoText" class="login-logo-hr m-l-s m-r-s"></span>
21
- <h3 class="login-logo-text">
22
- {{ SYSTEM_NAME || loginLogoText }}
23
- </h3>
15
+ <h3 class="login-logo-text">{{ loginLogoText }}</h3>
24
16
  </div>
25
17
  <!-- eslint-disable-next-line vue/no-v-html -->
26
18
  <div doc="登录页标语" v-html="sloganHtml"></div>
27
19
  <loginForm
28
20
  v-if="operateType === 'login'"
29
- :login-types="LOGIN_MODE || loginTypes"
21
+ :login-types="loginTypes"
30
22
  :login-then="loginThen"
31
23
  class="login-form"
32
24
  @changType="getChangetype"
@@ -45,6 +37,13 @@
45
37
  </div>
46
38
  </loginForm>
47
39
  <retrievePw v-if="operateType === 'retrievePw'" class="login-form" @changType="getChangetype" />
40
+ <div
41
+ v-if="loginCopyright"
42
+ class="login-copyright w-100p text-c color-placeholder"
43
+ style="position: absolute; bottom: 6px; left: 0"
44
+ >
45
+ {{ loginCopyright }}
46
+ </div>
48
47
  </div>
49
48
  </template>
50
49
 
@@ -77,98 +76,98 @@ export default {
77
76
  },
78
77
  data() {
79
78
  return {
80
- loginTypes: ['account'],
81
- LOGIN_MODE: ['account'],
82
- MAIN_PAGE_TEXT: '',
83
- SYSTEM_NAME: '',
84
- BgImage: '',
85
- LogoImage: '',
86
- loginBg: undefined,
87
- loginLogo: undefined,
88
- loginLogoWidth: '60px',
89
- loginLogoHeight: 'auto',
90
- loginLogoText: '',
91
- sloganHtml: '',
79
+ jsonData: {
80
+ loginTypes: ['account'],
81
+ loginBg: undefined,
82
+ loginLogo: undefined,
83
+ loginLogoWidth: '60px',
84
+ loginLogoHeight: 'auto',
85
+ loginLogoText: undefined,
86
+ loginCopyright: undefined,
87
+ sloganHtml: undefined
88
+ },
89
+ pageData: {
90
+ LOGIN_MODE: undefined, // 登录方式
91
+ SYSTEM_NAME: undefined, // 系统名称
92
+ MAIN_PAGE_TEXT: undefined, // 版权所有信息
93
+ BgImage: undefined,
94
+ LogoImage: undefined
95
+ },
92
96
  operateType: 'login',
93
97
  alV: false
94
98
  }
95
99
  },
96
- created() {
97
- if (this.autoLogin) {
98
- this.autoLoginSC()
99
- return
100
- }
101
- if (window.sessionStorage.getItem('_auto_login_ing_')) {
102
- this.autoLoginSS()
103
- return
100
+ computed: {
101
+ loginTypes() {
102
+ return this.pageData.LOGIN_MODE?.pmValue?.split(',') || this.jsonData.loginTypes || ['account']
103
+ },
104
+ loginBg() {
105
+ if (this.pageData.BgImage) {
106
+ return `url(${this.pageData.BgImage})`
107
+ } else if (this.jsonData.loginBg) {
108
+ return `url(${realUrl(this.jsonData.loginBg)})`
109
+ } else {
110
+ return 'none'
111
+ }
112
+ },
113
+ loginLogo() {
114
+ return this.pageData.LogoImage || (this.jsonData.loginLogo && realUrl(this.jsonData.loginLogo)) || undefined
115
+ },
116
+ loginLogoWidth() {
117
+ return this.jsonData.loginLogoWidth || '60px'
118
+ },
119
+ loginLogoHeight() {
120
+ return this.jsonData.loginLogoHeight || 'auto'
121
+ },
122
+ loginLogoText() {
123
+ return this.pageData.SYSTEM_NAME?.pmValue || this.jsonData.loginLogoText || ''
124
+ },
125
+ loginCopyright() {
126
+ return this.jsonData.loginCopyright || ''
127
+ },
128
+ sloganHtml() {
129
+ return this.jsonData.sloganHtml || ''
104
130
  }
105
-
131
+ },
132
+ created() {
133
+ if (this.autoLogin) return this.autoLoginSC()
134
+ if (window.sessionStorage.getItem('_auto_login_ing_')) return this.autoLoginSS()
106
135
  this.removeStorage()
136
+
107
137
  this.init()
108
138
  },
109
139
  methods: {
110
140
  async init() {
111
- const { _layoutData } = await getJsonc('/server-config.jsonc')
112
- if (_layoutData && _layoutData.loginSetting === 'JSON') {
113
- return this.setConfig()
114
- }
115
-
116
- axios
117
- .get(`/bems/1.0/sysSetting/list`, null, {
118
- loading: false,
119
- noMsg: true
141
+ const { _layoutData = {}, loginSetting } = await getJsonc('/server-config.jsonc')
142
+ let _loginSetting = loginSetting || _layoutData.loginSetting
143
+ if (_loginSetting !== 'JSON') {
144
+ let P_1 = axios.get(`/bems/1.0/sysSetting/list`, null, { loading: false, noMsg: true }).then(({ data }) => {
145
+ this.pageData.LOGIN_MODE = data.find((d) => d.pmName === 'LOGIN_MODE')
146
+ this.pageData.SYSTEM_NAME = data.find((d) => d.pmName === 'SYSTEM_NAME')
147
+ this.pageData.MAIN_PAGE_TEXT = data.find((d) => d.pmName === 'MAIN_PAGE_TEXT')
120
148
  })
121
- .then(({ data }) => {
122
- this.getdata(data)
149
+ let P_2 = this.getImg('/bems/1.0/attach/LOGIN_BACKGROUND_IMAGE').then((url) => {
150
+ this.pageData.BgImage = url
123
151
  })
124
- .finally(() => {
125
- this.setConfig()
152
+ let P_3 = this.getImg('/bems/1.0/attach/COMPANY_LOGOE').then((url) => {
153
+ this.pageData.LogoImage = url
126
154
  })
127
155
 
128
- this.getLogoImag()
129
- },
130
- async getLogoImag() {
131
- axios
132
- .get(`/bems/1.0/attach/LOGIN_BACKGROUND_IMAGE`, null, {
133
- responseType: 'blob',
134
- loading: false,
135
- noMsg: true
136
- })
137
- .then((blob) => {
138
- this.BgImage = window.URL.createObjectURL(blob)
139
- })
140
- axios
141
- .get(`/bems/1.0/attach/COMPANY_LOGOE`, null, {
142
- responseType: 'blob',
143
- loading: false,
144
- noMsg: true
145
- })
146
- .then((blob) => {
147
- this.LogoImage = window.URL.createObjectURL(blob)
148
- })
149
- },
150
- getdata(list) {
151
- list.forEach((item) => {
152
- if (item.pmName === 'LOGIN_MODE') {
153
- this.LOGIN_MODE = item.pmValue.split(',')
154
- } else if (item.pmName === 'MAIN_PAGE_TEXT') {
155
- this.MAIN_PAGE_TEXT = item.pmValue
156
- } else if (item.pmName === 'SYSTEM_NAME') {
157
- this.SYSTEM_NAME = item.pmValue
158
- }
159
- })
156
+ await Promise.all([P_1, P_2, P_3])
157
+ this.jsonData = _layoutData
158
+ } else {
159
+ this.jsonData = _layoutData
160
+ }
160
161
  },
161
- setConfig() {
162
- getJsonc('/server-config.jsonc').then(({ _layoutData = {} }) => {
163
- _layoutData.loginTypes && (this.loginTypes = _layoutData.loginTypes)
164
- this.loginBg = realUrl(_layoutData.loginBg)
165
- this.loginLogo = realUrl(_layoutData.loginLogo)
166
- this.loginLogoWidth = _layoutData.loginLogoWidth
167
- this.loginLogoHeight = _layoutData.loginLogoHeight
168
- this.loginLogoText = _layoutData.loginLogoText
169
- this.sloganHtml = _layoutData.loginSloganHtml
170
- })
162
+ async getImg(url) {
163
+ try {
164
+ let blob = await axios.get(url, null, { responseType: 'blob', loading: false, noMsg: true })
165
+ return window.URL.createObjectURL(blob)
166
+ } catch (error) {
167
+ return undefined
168
+ }
171
169
  },
170
+
172
171
  removeStorage() {
173
172
  for (let k in window.sessionStorage) {
174
173
  !['subEntry'].includes(k) && window.sessionStorage.removeItem(k)
@@ -177,6 +176,7 @@ export default {
177
176
  getChangetype(val) {
178
177
  this.operateType = val
179
178
  },
179
+
180
180
  autoLoginSC() {
181
181
  this.alV = true
182
182
  let alData = this.autoLoginDate
@@ -141,8 +141,8 @@ function request(opt) {
141
141
  .then((res) => {
142
142
  if (opt.responseType === 'blob') {
143
143
  let filename = getFilename(res.headers['content-disposition'])
144
- filename && res.data && (res.data.name = filename)
145
- resolve(res.data)
144
+ filename && res.data && (res.data.name = filename.replace(/"/g, ''))
145
+ res.data.size === 0 ? reject(opt.url + '请求返回文件大小0KB') : resolve(res.data)
146
146
  } else {
147
147
  if (typeof res.data === 'object' && res.data.data === undefined) {
148
148
  res.data.data = {}