n20-common-lib 1.3.63 → 1.3.66

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.63",
3
+ "version": "1.3.66",
4
4
  "private": false,
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -13,7 +13,8 @@
13
13
  "build:gzip": "vue-cli-service build --gzip",
14
14
  "build:report": "vue-cli-service build --analy",
15
15
  "build:css": "node build_css",
16
- "build:js": "vue-cli-service build --formats umd-min --target lib src/index.js --name index --dest lib --analy"
16
+ "build:js": "vue-cli-service build --formats umd-min --target lib src/index.js --name index --dest lib --analy",
17
+ "getI18n": "node ./node_modules/nstc-get-i18n"
17
18
  },
18
19
  "files": [
19
20
  "src/_qiankun",
@@ -55,7 +56,7 @@
55
56
  "@vue/cli-plugin-babel": "~4.5.0",
56
57
  "@vue/cli-plugin-eslint": "~4.5.0",
57
58
  "@vue/cli-service": "~4.5.0",
58
- "@vue/compiler-sfc": "^3.0.0-rc.6",
59
+ "@vue/compiler-sfc": "^3.2.38",
59
60
  "babel-eslint": "^10.1.0",
60
61
  "babel-plugin-component": "^1.1.1",
61
62
  "clipboard": "^2.0.11",
@@ -75,6 +76,7 @@
75
76
  "md2vue-loader": "git+https://gitee.com/bable2000/md2vue-loader.git",
76
77
  "mockjs": "^1.1.0",
77
78
  "node-sass": "6.0.0",
79
+ "nstc-get-i18n": "^0.0.1",
78
80
  "qiankun": "^2.5.1",
79
81
  "sass-loader": "^10.2.0",
80
82
  "screenfull": "^5.1.0",
@@ -2,6 +2,7 @@
2
2
  background-color: #303133;
3
3
  border: none;
4
4
  min-width: auto;
5
+ max-width: 80vw;
5
6
  color: $--color-white;
6
7
  padding: 5px 8px;
7
8
  }
@@ -9,7 +9,7 @@
9
9
  </div>
10
10
  <div>
11
11
  <div class="flex-box">
12
- <div class="n20-worker flex-item m-r-s">
12
+ <div v-title="item.assignee" class="n20-worker flex-item m-r-s text-ellipsis" :show-overflow-tooltip="true">
13
13
  <span class="worker-icon cl-icon-user"></span>
14
14
  <span>{{ item.assignee }}</span>
15
15
  </div>
@@ -0,0 +1,62 @@
1
+ <template>
2
+ <div v-if="isEqual">
3
+ {{ value }}
4
+ </div>
5
+ <div v-else class="n20-descriptions">
6
+ <div class="m-b-ss">
7
+ <span class="after-color">{{ value }}</span>
8
+ </div>
9
+ <div>
10
+ <span class="before-color">{{ oldValue }}</span>
11
+ <el-tooltip v-if="tooltip" :content="tooltipContent" placement="top">
12
+ <i class="n20-icon-xinxitishi m-l-ss color-placeholder"></i>
13
+ </el-tooltip>
14
+ </div>
15
+ </div>
16
+ </template>
17
+
18
+ <script>
19
+ export default {
20
+ name: 'Diff',
21
+ props: {
22
+ value: {
23
+ type: [String, Boolean, Array],
24
+ default: undefined
25
+ },
26
+ oldValue: {
27
+ type: [String, Boolean, Array],
28
+ default: undefined
29
+ },
30
+ tooltip: {
31
+ type: [String, Boolean],
32
+ default: undefined
33
+ }
34
+ },
35
+ computed: {
36
+ isEqual() {
37
+ if (this.value === this.oldValue) {
38
+ return true
39
+ } else if (
40
+ Array.isArray(this.value) &&
41
+ Array.isArray(this.oldValue) &&
42
+ this.value.toString() === this.oldValue.toString()
43
+ ) {
44
+ return true
45
+ } else {
46
+ return false
47
+ }
48
+ },
49
+ tooltipContent() {
50
+ if (!this.tooltip) {
51
+ return undefined
52
+ } else {
53
+ if (this.tooltip === true) {
54
+ return '修改前数据内容'
55
+ } else {
56
+ return this.tooltip
57
+ }
58
+ }
59
+ }
60
+ }
61
+ }
62
+ </script>
@@ -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"
@@ -248,7 +250,7 @@
248
250
  </component>
249
251
  </div>
250
252
  </el-dialog>
251
- <Dialog title="附件批量上传" :visible.sync="visibleBatch" top="5vh" width="692px">
253
+ <Dialog title="附件批量上传" :visible.sync="visibleBatch" top="5vh" width="692px" :destroy-on-open="true">
252
254
  <clUpload
253
255
  ref="upload-batch"
254
256
  class="n20-upload-drag"
@@ -300,6 +302,16 @@ export default {
300
302
  },
301
303
  sizeFilter(type, typeOptions, fileSize) {
302
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
303
315
  }
304
316
  },
305
317
  props: {
@@ -413,7 +425,7 @@ export default {
413
425
  if (_url) {
414
426
  let blob = await axios.get(_url, {}, { responseType: 'blob' })
415
427
  let url = URL.createObjectURL(blob)
416
- let name = blob.name
428
+ let name = row['_name'] || blob.name
417
429
  let sameOrg = this.seeTypes.test(name) || this.seeTypes.test(_url)
418
430
  return {
419
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
package/src/index.js CHANGED
@@ -57,6 +57,7 @@ import Descriptions from './components/Descriptions/index.vue'
57
57
  import EventBubble from './components/EventBubble/index.vue'
58
58
  // ECharts 不要打包进来
59
59
  import Stamp from './components/Stamp/index.vue'
60
+ import Diff from './components/Diff/index.vue'
60
61
  /* old */
61
62
  import TableO from './components/Table/indexO.vue'
62
63
  import FiltersO from './components/Filters/indexO.vue'
@@ -150,6 +151,7 @@ const components = [
150
151
  EventBubble,
151
152
  ApprovalImg,
152
153
  Stamp,
154
+ Diff,
153
155
  /* old */
154
156
  TableO,
155
157
  FiltersO,
@@ -264,5 +266,6 @@ export {
264
266
  Descriptions,
265
267
  EventBubble,
266
268
  ApprovalImg,
267
- Stamp
269
+ Stamp,
270
+ Diff
268
271
  }
@@ -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 = {}