n20-common-lib 1.3.37 → 1.3.40

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 (38) hide show
  1. package/package.json +2 -2
  2. package/src/assets/css/alert.scss +2 -5
  3. package/src/assets/getJsonc.js +4 -1
  4. package/src/assets/realUrl.js +2 -1
  5. package/src/components/Anchor/AnchorItem.vue +1 -1
  6. package/src/components/Button/button-group.vue +0 -6
  7. package/src/components/ECharts/index.vue +0 -1
  8. package/src/components/EventBubble/demo/a.vue +1 -1
  9. package/src/components/EventBubble/demo/b.vue +1 -1
  10. package/src/components/EventBubble/demo/c.vue +2 -2
  11. package/src/components/FileImport/index.vue +70 -143
  12. package/src/components/FileUploadTable/index.vue +8 -0
  13. package/src/components/Filters/form-item-input.vue +0 -1
  14. package/src/components/Filters/indexO.vue +14 -12
  15. package/src/components/FlowStep/index.vue +50 -27
  16. package/src/components/Layout/HeaderWrap/index.vue +1 -7
  17. package/src/components/Layout/TabsNav/index.vue +1 -2
  18. package/src/components/Layout/index.vue +1 -1
  19. package/src/components/LoginTemporary/retrievePw.vue +6 -3
  20. package/src/components/MoreTab/index.vue +1 -4
  21. package/src/components/PageHeader/index.vue +5 -2
  22. package/src/components/SecondaryTab/index.vue +0 -1
  23. package/src/components/SelectLazy/index.vue +1 -2
  24. package/src/components/Sifting/index.vue +1 -2
  25. package/src/components/Step/index.vue +0 -1
  26. package/src/components/TertiaryTab/index.vue +0 -1
  27. package/src/components/Upload/index.vue +17 -5
  28. package/src/components/Upload/uploadMsg.vue +114 -0
  29. package/src/directives/VClickOutside/index.js +10 -2
  30. package/src/directives/VDrag/index.js +12 -8
  31. package/src/directives/VMove/index.js +3 -3
  32. package/src/directives/VRuleKey/index.js +10 -3
  33. package/src/utils/auth.js +3 -1
  34. package/src/utils/axios.js +3 -1
  35. package/src/utils/repairElementUI.js +32 -8
  36. package/src/utils/tableheaderFilterpanel.vue +0 -1
  37. package/src/utils/xls2json.js +1 -1
  38. package/src/components/FileImport/_index.vue +0 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n20-common-lib",
3
- "version": "1.3.37",
3
+ "version": "1.3.40",
4
4
  "private": false,
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -12,7 +12,7 @@
12
12
  "build:Jenkins_1": "vue-cli-service build --serverConfig ./server-config-jenkins.jsonc",
13
13
  "build:gzip": "vue-cli-service build --gzip",
14
14
  "build:report": "vue-cli-service build --analy",
15
- "build:css": "vue-cli-service build --formats umd-min --target lib src/assets/css/index.scss --name index --dest style",
15
+ "build:css": "node build_css",
16
16
  "build:js": "vue-cli-service build --formats umd-min --target lib src/index.js --name index --dest lib --analy"
17
17
  },
18
18
  "files": [
@@ -4,12 +4,11 @@
4
4
  }
5
5
  .el-alert {
6
6
  width: 616px;
7
- padding:10px 16px;
7
+ padding: 10px 16px;
8
8
  }
9
9
 
10
-
11
10
  .el-alert--success.is-light {
12
- border: 1px solid rgba(72,210,160,0.40);
11
+ border: 1px solid rgba(72, 210, 160, 0.4);
13
12
  }
14
13
 
15
14
  .el-alert--error.is-light {
@@ -27,5 +26,3 @@
27
26
  color: #1677ff;
28
27
  }
29
28
  }
30
-
31
-
@@ -39,7 +39,10 @@ export default function getJsonc(url, sync) {
39
39
  jsoncs[url + '?sync'] = _data
40
40
  resolve(_data)
41
41
  } catch (error) {
42
- throw { error: url + ' illegal file', content: oAjax.responseText }
42
+ throw {
43
+ error: url + ' illegal file',
44
+ content: oAjax.responseText
45
+ }
43
46
  }
44
47
  }
45
48
  }
@@ -1,5 +1,6 @@
1
1
  /* 前缀,针对乾坤做了处理 */
2
- const prefix = window.__INJECTED_PUBLIC_PATH_BY_QIANKUN__ || process.env.BASE_URL || '/'
2
+ const prefix =
3
+ window.__INJECTED_PUBLIC_PATH_BY_QIANKUN__ || process.env.BASE_URL || '/'
3
4
 
4
5
  export default function realUrl(url) {
5
6
  if (/^http(s)?:|\/\//.test(url)) {
@@ -27,4 +27,4 @@ export default {
27
27
  }
28
28
  }
29
29
  }
30
- </script>
30
+ </script>
@@ -44,9 +44,6 @@ export default {
44
44
  })
45
45
  }
46
46
 
47
-
48
-
49
-
50
47
  if (btnt.includes('pass')) {
51
48
  btns.push({
52
49
  emit: 'pass',
@@ -128,8 +125,6 @@ export default {
128
125
  btns.push({ emit: 'information', label: '附件信息', plain: true })
129
126
  }
130
127
 
131
-
132
-
133
128
  if (btnt.includes('orderCancel')) {
134
129
  btns.push({
135
130
  emit: 'orderCancel',
@@ -146,7 +141,6 @@ export default {
146
141
  btns.push({ emit: 'back', label: '返回', plain: true })
147
142
  }
148
143
 
149
-
150
144
  return btns
151
145
  }
152
146
  }
@@ -165,4 +165,3 @@ export default {
165
165
  }
166
166
  }
167
167
  </script>
168
-
@@ -26,4 +26,4 @@ export default {
26
26
  })
27
27
  }
28
28
  }
29
- </script>
29
+ </script>
@@ -9,4 +9,4 @@ import cC from './c.vue'
9
9
  export default {
10
10
  components: { cC }
11
11
  }
12
- </script>
12
+ </script>
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div class="flex-box flex-v">
3
- <label>标题</label><el-input class="flex-item m-l" v-model="title" />
3
+ <label>标题</label><el-input v-model="title" class="flex-item m-l" />
4
4
  <EventBubble :data-custom="{ title: title }" data-event="demoEv" />
5
5
  </div>
6
6
  </template>
@@ -15,4 +15,4 @@ export default {
15
15
  }
16
16
  }
17
17
  }
18
- </script>
18
+ </script>
@@ -1,180 +1,107 @@
1
1
  <template>
2
- <el-dropdown
3
- trigger="click"
4
- placement="bottom-start"
5
- @command="handleCommand"
6
- >
7
- <el-button size="mini" type="primary"> 导入 </el-button>
2
+ <el-dropdown trigger="click" placement="bottom-start" @command="commandFn">
3
+ <el-button size="mini" type="primary">导入</el-button>
8
4
  <el-dropdown-menu slot="dropdown">
9
- <el-dropdown-item command="a">导入数据</el-dropdown-item>
10
- <el-dropdown-item command="b">模板下载</el-dropdown-item>
5
+ <el-dropdown-item command="import">导入数据</el-dropdown-item>
6
+ <el-dropdown-item command="down">模板下载</el-dropdown-item>
11
7
  </el-dropdown-menu>
8
+ <div style="display: none">
9
+ <cl-upload
10
+ v-if="!uploadHttpRequest"
11
+ v-bind="uploadProps"
12
+ :validate-result="validateResult"
13
+ >
14
+ <span ref="upload-trigger" slot="trigger">upload</span>
15
+ </cl-upload>
16
+ <uploadMsg
17
+ v-else
18
+ title="导入文件"
19
+ :visible.sync="errorV"
20
+ :validate-result="validateResult"
21
+ :hide-percent="true"
22
+ />
23
+ </div>
12
24
  </el-dropdown>
13
25
  </template>
14
26
 
15
27
  <script>
16
- import XLSX from 'xlsx'
17
28
  import axios from '../../utils/axios'
29
+ import downloadBlob from '../../utils/downloadBlob'
30
+ import uploadMsg from '../Upload/uploadMsg.vue'
18
31
  export default {
19
32
  name: 'FileImport',
33
+ components: { uploadMsg },
20
34
  props: {
21
35
  templateUrl: {
22
36
  type: String,
23
37
  default: ''
24
38
  },
25
- downConfig: {
39
+ fileName: {
40
+ type: String,
41
+ default: '下载.xlsx'
42
+ },
43
+ uploadHttpRequest: {
44
+ type: Function,
45
+ default: undefined
46
+ },
47
+ validateResult: {
26
48
  type: Object,
27
- default() {
28
- return {
29
- isFrontDown: true,
30
- fileName: '下载.xlsx'
31
- }
32
- }
49
+ default: undefined
50
+ },
51
+ validateDialog: {
52
+ type: Boolean,
53
+ default: false
33
54
  },
34
- footerHandlers: {
55
+ uploadProps: {
35
56
  type: Object,
36
- default: function () {
37
- return {
38
- // cancel: {
39
- // text: '取消'
40
- // },
41
- // confirm: {
42
- // text: '导入'
43
- // }
44
- }
45
- }
57
+ default: undefined
46
58
  },
47
- beforeUpload: Function, // eslint-disable-line
48
- callback: {
49
- type: Function,
50
- default: () => {}
59
+ uploadOn: {
60
+ type: Object,
61
+ default: undefined
51
62
  }
52
63
  },
53
64
  data() {
54
65
  return {
55
- excelData: {
56
- tableHeader: [],
57
- tableData: []
58
- },
59
-
60
- analysisText: 'analysis',
61
- fileName: '',
62
- statisticsFlag: false,
63
- columnsListTemp: [],
64
- errorListTemp: [],
65
- successFlag: false,
66
- confirmDisabledFlag: true
66
+ errorV: false
67
+ }
68
+ },
69
+ watch: {
70
+ validateDialog(val) {
71
+ this.errorV = val
67
72
  }
68
73
  },
69
74
  methods: {
70
- handleCommand(val) {
71
- if (val === 'a') {
72
- this.seletFile()
73
- } else if (val === 'b') {
74
- this.downloadTemplate()
75
- }
75
+ commandFn(val) {
76
+ val === 'import' && this.importFn()
77
+ val === 'down' && this.downFn()
76
78
  },
77
- seletFile() {
79
+ importFn() {
80
+ this.$emit('update:validateResult', undefined)
81
+
82
+ if (!this.uploadHttpRequest) {
83
+ this.$refs['upload-trigger'].click()
84
+ return
85
+ }
78
86
  let input = document.createElement('input')
79
- let self = this
80
87
  input.type = 'file'
81
- input.accept = '.xlsx, .xls, .csv'
82
- input.addEventListener('change', function (event) {
83
- const files = event.target.files
84
- const rawFile = files[0] // only use files[0]
85
- console.log('导入的文件:', rawFile)
86
- self.fileName = rawFile.name
87
- if (!rawFile) return
88
- self.upload(rawFile)
89
- this.value = null // fix can't select the same excel
88
+ input.accept = '.xlsx,.xls,.csv'
89
+
90
+ input.addEventListener('change', (event) => {
91
+ this.uploadHttpRequest && this.uploadHttpRequest(event.target.files[0])
90
92
  })
91
- input.click()
92
- },
93
- /* 上传文件 */
94
- upload(rawFile) {
95
- if (!this.beforeUpload) {
96
- this.readerData(rawFile)
97
- return
98
- }
99
- const before = this.beforeUpload(rawFile)
100
- if (before) {
101
- this.readerData(rawFile)
102
- }
103
- },
104
- /*解析传入的表格 */
105
- readerData(rawFile) {
106
- return new Promise((resolve) => {
107
- const reader = new FileReader()
108
- reader.onload = (e) => {
109
- const data = e.target.result
110
- const workbook = XLSX.read(data, {
111
- type: 'array',
112
- cellDates: true
113
- })
114
- const firstSheetName = workbook.SheetNames[0]
115
- const worksheet = workbook.Sheets[firstSheetName]
116
- const header = this.getHeaderRow(worksheet)
117
- const results = XLSX.utils.sheet_to_json(worksheet)
118
93
 
119
- this.generateData({ header, results })
120
- resolve()
121
- }
122
- reader.readAsArrayBuffer(rawFile)
94
+ input.click()
95
+ this.$nextTick(() => {
96
+ input = undefined
123
97
  })
124
98
  },
125
- generateData({ header, results }) {
126
- this.excelData.tableHeader = header
127
- this.excelData.tableData = results
128
- this.callback && this.callback(this.excelData)
129
- },
130
- getHeaderRow(sheet) {
131
- console.log(sheet)
132
- const headers = []
133
- const range = XLSX.utils.decode_range(sheet['!ref'])
134
- let C
135
- const R = range.s.r
136
- /* start in the first row */
137
- for (C = range.s.c; C <= range.e.c; ++C) {
138
- /* walk every column in the range */
139
- const cell = sheet[XLSX.utils.encode_cell({ c: C, r: R })]
140
- /* find the cell in the first row */
141
- let hdr = 'UNKNOWN ' + C // <-- replace with your desired default
142
- if (cell && cell.t) hdr = XLSX.utils.format_cell(cell)
143
- headers.push(hdr)
144
- }
145
- return headers
146
- },
147
- // 下载文件
148
- downloadTemplate() {
149
- // 前端下载
150
- if (this.downConfig.isFrontDown) {
151
- const aEl = document.createElement('a')
152
- aEl.setAttribute('href', this.templateUrl)
153
- aEl.target = '_blank'
154
- // aEl.download = this.templateUrl
155
- aEl.click()
156
- } else {
157
- axios({
158
- url: this.templateUrl,
159
- method: 'get',
160
- responseType: 'blob'
161
- }).then((res) => {
162
- const content = res
163
- const blob = new Blob([content])
164
- if ('download' in document.createElement('a')) {
165
- const link = document.createElement('a')
166
- link.download = this.downConfig.fileName
167
- link.style.display = 'none'
168
- link.href = URL.createObjectURL(blob)
169
- document.body.appendChild(link)
170
- link.click()
171
- URL.revokeObjectURL(link.href)
172
- document.body.removeChild(link)
173
- } else {
174
- navigator.msSaveBlob(blob, this.downConfig.fileName)
175
- }
99
+ downFn() {
100
+ axios
101
+ .get(this.templateUrl, null, { responseType: 'blob' })
102
+ .then((blob) => {
103
+ downloadBlob(blob, this.fileName)
176
104
  })
177
- }
178
105
  }
179
106
  }
180
107
  }
@@ -397,6 +397,10 @@ export default {
397
397
  uploadHttpRequest: {
398
398
  type: Function,
399
399
  default: undefined
400
+ },
401
+ getFileMethod: {
402
+ type: Function,
403
+ default: undefined
400
404
  }
401
405
  },
402
406
  data() {
@@ -463,6 +467,10 @@ export default {
463
467
  },
464
468
 
465
469
  async getFileInfo(row) {
470
+ if (this.getFileMethod) {
471
+ return await this.getFileMethod(row)
472
+ }
473
+
466
474
  let _url = row[this.keys.url]
467
475
  this.seePrefix && (_url = this.seePrefix + _url)
468
476
  if (_url) {
@@ -183,4 +183,3 @@ export default {
183
183
  }
184
184
  }
185
185
  </script>
186
-
@@ -1,19 +1,22 @@
1
1
  <template>
2
2
  <el-popover
3
+ v-model="showPop"
3
4
  :width="width"
4
5
  placement="bottom-end"
5
6
  title="筛选"
6
- v-model="showPop"
7
- @after-leave="
8
- showMore = false
9
- "
10
7
  trigger="manual"
8
+ @after-leave="showMore = false"
11
9
  >
12
10
  <span slot="reference">
13
- <el-button @click="clickBtn" icon="n20-icon-iconfontshaixuan" plain onlyicon size="mini"
11
+ <el-button
12
+ icon="n20-icon-iconfontshaixuan"
13
+ plain
14
+ onlyicon
15
+ size="mini"
16
+ @click="clickBtn"
14
17
  /></span>
15
18
 
16
- <div class="n20-filter p-a-s" v-click-outside="clickOut">
19
+ <div v-click-outside="clickOut" class="n20-filter p-a-s">
17
20
  <slot></slot>
18
21
  <el-button
19
22
  v-if="$slots.more"
@@ -67,7 +70,7 @@ export default {
67
70
  data() {
68
71
  return {
69
72
  showMore: false,
70
- showPop:false
73
+ showPop: false
71
74
  }
72
75
  },
73
76
  mounted() {},
@@ -89,10 +92,10 @@ export default {
89
92
  clickOut() {
90
93
  let elPoppers = []
91
94
  document
92
- .querySelectorAll('.el-popper,.el-dialog__wrapper')
93
- .forEach((e) => {
94
- e.style.display !== 'none' && elPoppers.push(e)
95
- })
95
+ .querySelectorAll('.el-popper,.el-dialog__wrapper')
96
+ .forEach((e) => {
97
+ e.style.display !== 'none' && elPoppers.push(e)
98
+ })
96
99
 
97
100
  if (elPoppers.length <= 1) {
98
101
  this.showPop = false
@@ -101,4 +104,3 @@ export default {
101
104
  }
102
105
  }
103
106
  </script>
104
-
@@ -1,63 +1,86 @@
1
1
  <template>
2
- <div class="n20-steps-area">
2
+ <div class="n20-steps-area">
3
3
  <div class="n20-steps">
4
- <div
5
- :class="['n20-steps-item',
6
- { 'finished': current > n,
7
- 'process': current === n && n !== totalSteps,
8
- 'last-process': current === totalSteps && n === totalSteps,
9
- 'middle-wait': current < n && n !== totalSteps,
10
- 'last-wait': current < n && n === totalSteps,
11
- }
12
- ]"
4
+ <div
13
5
  v-for="n in totalSteps"
14
6
  :key="n"
15
- @click="onChange(n)">
16
- <div class="n20-steps-icon">
17
- <span :class="['n20-u-icon',{'n20-icon-danxuankuang-yixuanzhong': current === n && n !== totalSteps|| current === totalSteps && n === totalSteps},]" v-if="current<=n"></span>
18
- <span class="n20-u-icon n20-icon-fankui-chenggongkongxin" v-else></span>
19
- </div>
20
- <div class="n20-steps-content">
21
- <div class="n20-steps-title">{{ stepsLabel[n-1] || 'S ' + n }}</div>
22
- <div class="n20-steps-description">{{ stepsDesc[n-1] || 'Desc ' + n }}</div>
7
+ :class="[
8
+ 'n20-steps-item',
9
+ {
10
+ finished: current > n,
11
+ process: current === n && n !== totalSteps,
12
+ 'last-process': current === totalSteps && n === totalSteps,
13
+ 'middle-wait': current < n && n !== totalSteps,
14
+ 'last-wait': current < n && n === totalSteps
15
+ }
16
+ ]"
17
+ @click="onChange(n)"
18
+ >
19
+ <div class="n20-steps-icon">
20
+ <span
21
+ v-if="current <= n"
22
+ :class="[
23
+ 'n20-u-icon',
24
+ {
25
+ 'n20-icon-danxuankuang-yixuanzhong':
26
+ (current === n && n !== totalSteps) ||
27
+ (current === totalSteps && n === totalSteps)
28
+ }
29
+ ]"
30
+ ></span>
31
+ <span
32
+ v-else
33
+ class="n20-u-icon n20-icon-fankui-chenggongkongxin"
34
+ ></span>
35
+ </div>
36
+ <div class="n20-steps-content">
37
+ <div class="n20-steps-title">{{ stepsLabel[n - 1] || 'S ' + n }}</div>
38
+ <div class="n20-steps-description">
39
+ {{ stepsDesc[n - 1] || 'Desc ' + n }}
40
+ </div>
41
+ </div>
23
42
  </div>
24
- </div>
25
43
  </div>
26
- </div>
44
+ </div>
27
45
  </template>
28
46
  <script>
29
47
  export default {
30
48
  name: 'FlowStep',
31
49
  props: {
32
- stepsLabel: { // 步骤title数组
50
+ stepsLabel: {
51
+ // 步骤title数组
33
52
  type: Array,
34
53
  default: () => {
35
54
  return []
36
55
  }
37
56
  },
38
- stepsDesc: { // 步骤description数组
57
+ stepsDesc: {
58
+ // 步骤description数组
39
59
  type: Array,
40
60
  default: () => {
41
61
  return []
42
62
  }
43
63
  },
44
- totalSteps: { // 总的步骤数
64
+ totalSteps: {
65
+ // 总的步骤数
45
66
  type: Number,
46
67
  default: 3
47
68
  },
48
- currentStep: { // 当前选中的步骤
69
+ currentStep: {
70
+ // 当前选中的步骤
49
71
  type: Number,
50
72
  default: 1
51
73
  }
52
74
  },
53
- data () {
75
+ data() {
54
76
  return {
55
77
  // 若当前选中步骤超过总步骤数,则默认选择步骤1
56
78
  current: this.currentStep > this.totalSteps ? 1 : this.currentStep
57
79
  }
58
80
  },
59
81
  methods: {
60
- onChange (index) { // 点击切换选择步骤
82
+ onChange(index) {
83
+ // 点击切换选择步骤
61
84
  console.log('index:', index)
62
85
  if (this.current !== index) {
63
86
  this.current = index
@@ -66,4 +89,4 @@ export default {
66
89
  }
67
90
  }
68
91
  }
69
- </script>
92
+ </script>
@@ -64,13 +64,7 @@
64
64
  <div class="flex-column flex-l">
65
65
  <span
66
66
  v-title="userInfo.companyName"
67
- class="
68
- flex-item
69
- text-ellipsis
70
- m-l m-b-ss
71
- font-size-small
72
- color-primary
73
- "
67
+ class="flex-item text-ellipsis m-l m-b-ss font-size-small color-primary"
74
68
  :show-overflow-tooltip="true"
75
69
  >{{ userInfo.companyName }}</span
76
70
  >
@@ -166,5 +166,4 @@ export default {
166
166
  }
167
167
  </script>
168
168
 
169
- <style>
170
- </style>
169
+ <style></style>
@@ -508,7 +508,7 @@ function getShowUuid(uuid, list) {
508
508
  return menu.hide ? menu.pid : menu.uuid
509
509
  }
510
510
 
511
- let pid = uuid.replace(/\/[^\/]+\/*$/, '')
511
+ let pid = uuid.replace(/\/[^/]+\/*$/, '')
512
512
  if (pid !== '' && pid !== '/') {
513
513
  return getShowUuid(pid, list)
514
514
  }
@@ -133,14 +133,14 @@ export default {
133
133
  )
134
134
  )
135
135
  } else if (
136
- this.dataForm.passwordStrength == 2 &&
136
+ Number(this.dataForm.passwordStrength) === 2 &&
137
137
  !/^(((?=.*[0-9])(?=.*[a-zA-Z])|(?=.*[0-9])(?=.*[^\s0-9a-zA-Z])|(?=.*[a-zA-Z])(?=.*[^\s0-9a-zA-Z]))[^\s]+)$/.test(
138
138
  value
139
139
  )
140
140
  ) {
141
141
  callback(new Error(`密码至少包括数字,字母,特殊符号其中两种`))
142
142
  } else if (
143
- this.dataForm.passwordStrength == 3 &&
143
+ Number(this.dataForm.passwordStrength) === 3 &&
144
144
  !/^(?=.*\d)(?=.*[a-zA-Z])(?=.*[~!@#$%^&*])[\da-zA-Z~!@#$%^&*]{0,}$/.test(
145
145
  value
146
146
  )
@@ -269,7 +269,10 @@ export default {
269
269
  .get(
270
270
  `/bems/prod_1.0/uas/api/authorization/captcha/${this.updateForm[type]}/1`,
271
271
  null,
272
- { loading: false, noMsg: true }
272
+ {
273
+ loading: false,
274
+ noMsg: true
275
+ }
273
276
  )
274
277
  .then(() => {
275
278
  this.$message.success(
@@ -1,7 +1,4 @@
1
- /**
2
- * author: zhengwei
3
- * tiem: 2021-8-31
4
- */
1
+ /** * author: zhengwei * tiem: 2021-8-31 */
5
2
  <template>
6
3
  <div class="__common-layout-pageTabs">
7
4
  <el-scrollbar>
@@ -22,7 +22,10 @@ export default {
22
22
  return '返回'
23
23
  }
24
24
  },
25
- content: String,
25
+ content: {
26
+ type: String,
27
+ default: ''
28
+ },
26
29
  disable: {
27
30
  type: Boolean,
28
31
  default: false
@@ -33,4 +36,4 @@ export default {
33
36
  }
34
37
  }
35
38
  }
36
- </script>
39
+ </script>
@@ -1,4 +1,3 @@
1
-
2
1
  <template>
3
2
  <el-tabs
4
3
  :value="init"
@@ -72,5 +72,4 @@ export default {
72
72
  }
73
73
  </script>
74
74
 
75
- <style>
76
- </style>
75
+ <style></style>
@@ -95,5 +95,4 @@ export default {
95
95
  }
96
96
  </script>
97
97
 
98
- <style scoped>
99
- </style>
98
+ <style scoped></style>
@@ -1,4 +1,3 @@
1
-
2
1
  <template>
3
2
  <el-steps
4
3
  :direction="direction"
@@ -1,4 +1,3 @@
1
-
2
1
  <template>
3
2
  <el-tabs
4
3
  :value="init"
@@ -38,17 +38,23 @@
38
38
  <template slot="tip">
39
39
  <slot name="tip"></slot>
40
40
  </template>
41
- <el-dialog :visible.sync="progressV" title="提示" append-to-body>
42
- <p v-if="!percentType">系统处理中,请稍等......</p>
43
- <p v-else>{{ percentMsg }}</p>
44
- <el-progress class="m-b" :percentage="percent" :status="percentType" />
45
- </el-dialog>
41
+ <uploadMsg
42
+ :visible.sync="progressV"
43
+ :percent-type="percentType"
44
+ :percent-msg="percentMsg"
45
+ :percent="percent"
46
+ :validate-result="validateResult"
47
+ />
46
48
  </el-upload>
47
49
  </template>
48
50
 
49
51
  <script>
52
+ import uploadMsg from './uploadMsg.vue'
50
53
  export default {
51
54
  name: 'Upload',
55
+ components: {
56
+ uploadMsg
57
+ },
52
58
  props: {
53
59
  fileName: {
54
60
  type: String,
@@ -127,6 +133,10 @@ export default {
127
133
  showClear: {
128
134
  type: Boolean,
129
135
  default: true
136
+ },
137
+ validateResult: {
138
+ type: Object,
139
+ default: undefined
130
140
  }
131
141
  },
132
142
  data() {
@@ -168,6 +178,8 @@ export default {
168
178
  }
169
179
  },
170
180
  beforeUploadFn(file) {
181
+ this.$emit('update:validateResult', undefined)
182
+
171
183
  let size = this.size
172
184
  let sizeNum
173
185
 
@@ -0,0 +1,114 @@
1
+ <template>
2
+ <el-dialog v-drag :visible.sync="progressV" :title="title" append-to-body>
3
+ <template v-if="!hidePercent">
4
+ <p v-if="!percentType">系统处理中,请稍等......</p>
5
+ <p v-else>{{ percentMsg }}</p>
6
+ <el-progress class="m-b" :percentage="percent" :status="percentType" />
7
+ </template>
8
+ <!-- 错误数据行提示 -->
9
+ <template v-if="validateResult">
10
+ <div>
11
+ <span class="m-r">导入统计</span>
12
+ <span>共计导入{{ validateResult.totalNum }}条, </span>
13
+ <span class="m-r-s">
14
+ 其中有效数据
15
+ <span class="color-primary">{{ validateResult.successNum }}</span
16
+ >条,
17
+ </span>
18
+ <span>
19
+ 无效数据
20
+ <span class="color-danger">{{ validateResult.errorList.length }}</span
21
+ >条。
22
+ </span>
23
+ </div>
24
+ <template v-if="validateResult.errorList.length">
25
+ <div class="m-t m-b">无效数据详情</div>
26
+ <el-table :data="errorList">
27
+ <el-table-column
28
+ v-for="column in columnsList"
29
+ :key="column.prop"
30
+ :prop="column.prop"
31
+ :label="column.label"
32
+ >
33
+ <template slot-scope="scope">
34
+ <!-- eslint-disable-next-line vue/no-v-html -->
35
+ <span v-html="scope.row[column.prop]"></span>
36
+ </template>
37
+ </el-table-column>
38
+ </el-table>
39
+ <div class="color-warning m-t-s">
40
+ 上述数据输入有误,请修改导入文件中相关信息!
41
+ </div>
42
+ </template>
43
+ <span slot="footer">
44
+ <el-button type="primary" @click="progressV = false">确定</el-button>
45
+ </span>
46
+ </template>
47
+ </el-dialog>
48
+ </template>
49
+
50
+ <script>
51
+ export default {
52
+ props: {
53
+ title: {
54
+ type: String,
55
+ default: '提示'
56
+ },
57
+ visible: {
58
+ type: Boolean,
59
+ default: false
60
+ },
61
+ percentType: {
62
+ type: String,
63
+ default: undefined
64
+ },
65
+ percentMsg: {
66
+ type: String,
67
+ default: undefined
68
+ },
69
+ percent: {
70
+ type: Number,
71
+ default: undefined
72
+ },
73
+ validateResult: {
74
+ type: Object,
75
+ default: undefined
76
+ },
77
+ hidePercent: {
78
+ type: Boolean,
79
+ default: false
80
+ }
81
+ },
82
+ computed: {
83
+ progressV: {
84
+ get() {
85
+ return this.visible
86
+ },
87
+ set(v) {
88
+ this.$emit('update:visible', v)
89
+ }
90
+ },
91
+ columnsList() {
92
+ return (this.validateResult && this.validateResult.columnsList) || []
93
+ },
94
+ errorList() {
95
+ let errorList = this.validateResult && this.validateResult.errorList
96
+ if (errorList) {
97
+ let _errorList = []
98
+ errorList.forEach((item) => {
99
+ const temp = { ...item }
100
+ if (item.errorList) {
101
+ item.errorList.forEach((eK) => {
102
+ temp[eK] = `<span class="color-danger">${temp[eK]}</span>`
103
+ })
104
+ }
105
+ _errorList.push(temp)
106
+ })
107
+ return _errorList
108
+ } else {
109
+ return undefined
110
+ }
111
+ }
112
+ }
113
+ }
114
+ </script>
@@ -8,10 +8,18 @@ directive.install = (Vue) => {
8
8
  binding.value(event)
9
9
  }
10
10
  }
11
- document.body.addEventListener('click', el.clickOutsideEvent, binding.arg === 'capture')
11
+ document.body.addEventListener(
12
+ 'click',
13
+ el.clickOutsideEvent,
14
+ binding.arg === 'capture'
15
+ )
12
16
  },
13
17
  unbind: function (el, binding) {
14
- document.body.removeEventListener('click', el.clickOutsideEvent, binding.arg === 'capture')
18
+ document.body.removeEventListener(
19
+ 'click',
20
+ el.clickOutsideEvent,
21
+ binding.arg === 'capture'
22
+ )
15
23
  }
16
24
  })
17
25
  }
@@ -6,12 +6,14 @@
6
6
  // 封装全局弹窗拖拽指令 v-drag
7
7
  function dialogMoveFn(_this) {
8
8
  var dialogDom = _this.parentNode
9
- dialogDom.style.top = parseFloat(dialogDom.style.top || '0') + _this.pageYc + 'px'
10
- dialogDom.style.left = parseFloat(dialogDom.style.left || '0') + _this.pageXc + 'px'
9
+ dialogDom.style.top =
10
+ parseFloat(dialogDom.style.top || '0') + _this.pageYc + 'px'
11
+ dialogDom.style.left =
12
+ parseFloat(dialogDom.style.left || '0') + _this.pageXc + 'px'
11
13
  }
12
14
 
13
15
  const dialogMove = {
14
- install: function(Vue) {
16
+ install: function (Vue) {
15
17
  Vue.directive('drag', {
16
18
  update(el, binding) {
17
19
  if (el.style.display === 'none') {
@@ -21,14 +23,14 @@ const dialogMove = {
21
23
  dialogDom.style.top = ''
22
24
  }
23
25
  }
24
- Vue.nextTick(function() {
26
+ Vue.nextTick(function () {
25
27
  var dialogHeader = el.querySelector('.el-dialog__header')
26
28
  if (dialogHeader && !dialogHeader._hasMoveDir) {
27
29
  var _this, pvrPageX, pvrPageY
28
30
  dialogHeader._hasMoveDir = true
29
31
  dialogHeader.style.cursor = 'move'
30
32
 
31
- dialogHeader.addEventListener('mousedown', function(evt) {
33
+ dialogHeader.addEventListener('mousedown', function (evt) {
32
34
  var ev = evt || event
33
35
  this.pageXc = this.pageYc = 0
34
36
  _this = this
@@ -38,7 +40,7 @@ const dialogMove = {
38
40
  document.addEventListener('mouseup', mouseupThisMove)
39
41
  })
40
42
 
41
- var mousemoveThisMove = function(evt) {
43
+ var mousemoveThisMove = function (evt) {
42
44
  var ev = evt || event
43
45
  ev.stopPropagation()
44
46
  ev.preventDefault()
@@ -51,14 +53,16 @@ const dialogMove = {
51
53
  _this.pageXc = ev.pageX - pvrPageX
52
54
  _this.pageYc = ev.pageY - pvrPageY
53
55
  if (_this.pageXc !== 0 || _this.pageYc !== 0) {
54
- binding.value ? binding.value(_this, binding.arg) : dialogMoveFn(_this)
56
+ binding.value
57
+ ? binding.value(_this, binding.arg)
58
+ : dialogMoveFn(_this)
55
59
  }
56
60
  pvrPageX = ev.pageX
57
61
  pvrPageY = ev.pageY
58
62
  }
59
63
  }
60
64
 
61
- var mouseupThisMove = function() {
65
+ var mouseupThisMove = function () {
62
66
  document.removeEventListener('mousemove', mousemoveThisMove)
63
67
  document.removeEventListener('mouseup', mouseupThisMove)
64
68
  }
@@ -4,7 +4,7 @@ directive.install = (Vue) => {
4
4
  Vue.directive('move', {
5
5
  bind(el, binding) {
6
6
  var _this, pvrPageX, pvrPageY
7
- var mousemoveThisMove = function(evt) {
7
+ var mousemoveThisMove = function (evt) {
8
8
  var ev = evt || event
9
9
  ev.stopPropagation()
10
10
  ev.preventDefault()
@@ -16,11 +16,11 @@ directive.install = (Vue) => {
16
16
  pvrPageX = ev.pageX
17
17
  pvrPageY = ev.pageY
18
18
  }
19
- var mouseupThisMove = function() {
19
+ var mouseupThisMove = function () {
20
20
  document.removeEventListener('mousemove', mousemoveThisMove)
21
21
  document.removeEventListener('mouseup', mouseupThisMove)
22
22
  }
23
- el.addEventListener('mousedown', function(evt) {
23
+ el.addEventListener('mousedown', function (evt) {
24
24
  var ev = evt || event
25
25
  this.pageXc = this.pageYc = 0
26
26
  _this = this
@@ -21,7 +21,12 @@ function getRules(rules, evType) {
21
21
  function validateRoule(rule, value) {
22
22
  return new Promise(function (resolve, reject) {
23
23
  if (rule.required) {
24
- if (value === undefined || value === null || value === '' || (Array.isArray(value) && value.length === 0)) {
24
+ if (
25
+ value === undefined ||
26
+ value === null ||
27
+ value === '' ||
28
+ (Array.isArray(value) && value.length === 0)
29
+ ) {
25
30
  reject(rule.message)
26
31
  return
27
32
  }
@@ -126,7 +131,8 @@ directive.install = (Vue) => {
126
131
  let ruleForm = _this.$attrs['rule-form'] || _this.$attrs['ruleForm']
127
132
  ruleForm && el.classList.add(ruleForm)
128
133
 
129
- let rErr = _this.$attrs['rule-error-hide'] || _this.$attrs['ruleErrorHide']
134
+ let rErr =
135
+ _this.$attrs['rule-error-hide'] || _this.$attrs['ruleErrorHide']
130
136
  rErr = rErr !== 'true' && rErr !== true
131
137
 
132
138
  el[VD] = (val, type) => {
@@ -167,7 +173,8 @@ function rulesValidateForm(query, fn) {
167
173
  if (nodeList.length) {
168
174
  let validateList = []
169
175
  nodeList.forEach((el) => {
170
- typeof el[VD] === 'function' && validateList.push(el[VD](undefined, 'submit'))
176
+ typeof el[VD] === 'function' &&
177
+ validateList.push(el[VD](undefined, 'submit'))
171
178
  })
172
179
  return Promise.all(validateList)
173
180
  .then(() => {
package/src/utils/auth.js CHANGED
@@ -44,7 +44,9 @@ auth.cokenKey = 'Admin-Token'
44
44
  let ownLoginPath = '/login'
45
45
  function toLogin() {
46
46
  let hrefOld = window.location.href
47
- let loginHref = window.__POWERED_BY_QIANKUN__ ? window.location.origin + '/login' : ownLoginPath
47
+ let loginHref = window.__POWERED_BY_QIANKUN__
48
+ ? window.location.origin + '/login'
49
+ : ownLoginPath
48
50
  if (hrefOld !== loginHref) {
49
51
  history.pushState(null, null, loginHref)
50
52
  window.location.reload()
@@ -60,7 +60,9 @@ const axios = _axios.create(config)
60
60
  axios.interceptors.request.use((opt) => {
61
61
  let token = auth.getToken()
62
62
  let headers = {
63
- Authorization: token ? 'Bearer ' + token : 'Basic TlNUQzpWVkIxVG1sVlVURlNMemxyTkhoc2VtNXdObFJaUVQwOQ==',
63
+ Authorization: token
64
+ ? 'Bearer ' + token
65
+ : 'Basic TlNUQzpWVkIxVG1sVlVURlNMemxyTkhoc2VtNXdObFJaUVQwOQ==',
64
66
  OperationDesc: opt.OperationDesc ? encodeURI(opt.OperationDesc) : 'default',
65
67
  timestamp: Date.now(),
66
68
  requestKey: Date.now()
@@ -6,7 +6,8 @@ import FilterPanel from './tableheaderFilterpanel.vue'
6
6
 
7
7
  function hasClass(el, cls) {
8
8
  if (!el || !cls) return false
9
- if (cls.indexOf(' ') !== -1) throw new Error('className should not contain space.')
9
+ if (cls.indexOf(' ') !== -1)
10
+ throw new Error('className should not contain space.')
10
11
  if (el.classList) {
11
12
  return el.classList.contains(cls)
12
13
  } else {
@@ -32,14 +33,29 @@ function repairPopper() {
32
33
  Popper.prototype.repairR = true
33
34
 
34
35
  let __getBoundaries = Popper.prototype._getBoundaries
35
- Popper.prototype._getBoundaries = function (data, padding, boundariesElement) {
36
- const boundaries = __getBoundaries.call(this, data, padding, boundariesElement)
36
+ Popper.prototype._getBoundaries = function (
37
+ data,
38
+ padding,
39
+ boundariesElement
40
+ ) {
41
+ const boundaries = __getBoundaries.call(
42
+ this,
43
+ data,
44
+ padding,
45
+ boundariesElement
46
+ )
37
47
 
38
48
  if (this._options.boundariesElement === 'viewport') {
39
49
  const root = window
40
50
  const body = root.document.body
41
51
  const html = root.document.documentElement
42
- let width = Math.max(body.scrollWidth, body.offsetWidth, html.clientWidth, html.scrollWidth, html.offsetWidth)
52
+ let width = Math.max(
53
+ body.scrollWidth,
54
+ body.offsetWidth,
55
+ html.clientWidth,
56
+ html.scrollWidth,
57
+ html.offsetWidth
58
+ )
43
59
  let height = Math.max(
44
60
  body.scrollHeight,
45
61
  body.offsetHeight,
@@ -48,8 +64,12 @@ function repairPopper() {
48
64
  html.offsetHeight
49
65
  )
50
66
 
51
- boundaries.right = boundaries.right - root.document.documentElement.clientWidth + width
52
- boundaries.bottom = boundaries.bottom - root.document.documentElement.clientHeight + height
67
+ boundaries.right =
68
+ boundaries.right - root.document.documentElement.clientWidth + width
69
+ boundaries.bottom =
70
+ boundaries.bottom -
71
+ root.document.documentElement.clientHeight +
72
+ height
53
73
  }
54
74
  return boundaries
55
75
  }
@@ -96,12 +116,16 @@ export default function (ElementUI) {
96
116
  let label = column.label || ''
97
117
  let sortable = column.sortable ? 24 : 0
98
118
  let filters = column.filters ? 16 : 0
99
- column.minWidth = Math.max(80, label.length * 14 + 22 + sortable + filters)
119
+ column.minWidth = Math.max(
120
+ 80,
121
+ label.length * 14 + 22 + sortable + filters
122
+ )
100
123
  } else {
101
124
  column.minWidth = 80
102
125
  }
103
126
  }
104
- column.realWidth = column.width === undefined ? column.minWidth : column.width
127
+ column.realWidth =
128
+ column.width === undefined ? column.minWidth : column.width
105
129
  return column
106
130
  }
107
131
  })
@@ -145,7 +145,6 @@ export default {
145
145
  },
146
146
  set(value) {
147
147
  if (this.filteredValue) {
148
- console.log(this.filteredValue, 567)
149
148
  if (typeof value !== 'undefined' && value !== null) {
150
149
  this.filteredValue.splice(0, 1, value)
151
150
  } else {
@@ -13,7 +13,7 @@ export default function toJson(file, name) {
13
13
  })
14
14
  } else if (file instanceof ArrayBuffer) {
15
15
  try {
16
- const workbook = read(array, { type: 'array', cellDates: true })
16
+ const workbook = read(file, { type: 'array', cellDates: true })
17
17
  resolve(workbook)
18
18
  } catch (err) {
19
19
  reject(err)
@@ -1,9 +0,0 @@
1
- <template>
2
- <div>待完善</div>
3
- </template>
4
-
5
- <script>
6
- export default {
7
- name: 'FileImport'
8
- }
9
- </script>