n20-common-lib 1.3.35 → 1.3.38

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 (41) hide show
  1. package/package.json +2 -2
  2. package/src/assets/css/_coreLib.scss +0 -1
  3. package/src/assets/css/alert.scss +2 -5
  4. package/src/assets/css/cl-form-item.scss +24 -10
  5. package/src/assets/css/el-button.scss +2 -1
  6. package/src/assets/css/normalize.scss +125 -5
  7. package/src/components/Anchor/AnchorItem.vue +1 -1
  8. package/src/components/Button/button-group.vue +0 -6
  9. package/src/components/DatePicker/index.vue +6 -0
  10. package/src/components/DatePicker/por.vue +2 -0
  11. package/src/components/ECharts/index.vue +0 -1
  12. package/src/components/FileImport/_index.vue +2 -194
  13. package/src/components/FileImport/index.vue +174 -2
  14. package/src/components/Filters/indexO.vue +14 -12
  15. package/src/components/FlowStep/index.vue +50 -27
  16. package/src/components/InputNumber/index.vue +6 -1
  17. package/src/components/InputNumber/numberRange.vue +17 -2
  18. package/src/components/LoginTemporary/index.vue +43 -32
  19. package/src/components/MoreTab/index.vue +1 -4
  20. package/src/components/PageHeader/index.vue +1 -1
  21. package/src/components/SecondaryTab/index.vue +0 -1
  22. package/src/components/SelectLazy/index.vue +2 -2
  23. package/src/components/Sifting/index.vue +1 -2
  24. package/src/components/Step/index.vue +0 -1
  25. package/src/components/TertiaryTab/index.vue +0 -1
  26. package/src/directives/VClickOutside/index.js +4 -4
  27. package/src/directives/VRuleKey/index.js +194 -0
  28. package/src/index.js +2 -0
  29. package/src/utils/repairElementUI.js +51 -1
  30. package/src/utils/tableheaderFilterpanel.vue +249 -0
  31. package/style/index.css +3 -3
  32. package/style/index.css.map +1 -1
  33. package/theme/blue.css +3 -3
  34. package/theme/green.css +3 -3
  35. package/theme/lightBlue.css +3 -3
  36. package/theme/orange.css +3 -3
  37. package/theme/purple.css +3 -3
  38. package/theme/red.css +3 -3
  39. package/theme/yellow.css +3 -3
  40. package/src/components/Search/index.vue +0 -485
  41. package/src/components/Search/style.scss +0 -93
@@ -7,6 +7,7 @@
7
7
  :value="value"
8
8
  :clearable="clearable"
9
9
  v-on="$listeners"
10
+ @change="changeFn"
10
11
  />
11
12
  </template>
12
13
 
@@ -22,6 +23,11 @@ export default {
22
23
  type: Boolean,
23
24
  default: true
24
25
  }
26
+ },
27
+ methods: {
28
+ changeFn(val) {
29
+ this.$emit('change', val)
30
+ }
25
31
  }
26
32
  }
27
33
  </script>
@@ -159,8 +159,10 @@ export default {
159
159
  if (this.type === 'daterange' || this.type === 'monthrange') {
160
160
  this.$emit('update:start-date', val ? val[0] : null)
161
161
  this.$emit('update:end-date', val ? val[1] : null)
162
+ this.$emit('change', val)
162
163
  } else {
163
164
  this.$emit('input', val)
165
+ this.$emit('change', val)
164
166
  }
165
167
  }
166
168
  }
@@ -165,4 +165,3 @@ export default {
165
165
  }
166
166
  }
167
167
  </script>
168
-
@@ -1,201 +1,9 @@
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>
8
- <el-dropdown-menu slot="dropdown">
9
- <el-dropdown-item command="a">导入数据</el-dropdown-item>
10
- <el-dropdown-item command="b">模板下载</el-dropdown-item>
11
- </el-dropdown-menu>
12
- </el-dropdown>
2
+ <div>待完善</div>
13
3
  </template>
14
4
 
15
5
  <script>
16
- import XLSX from 'xlsx'
17
- import axios from '../../utils/axios'
18
6
  export default {
19
- name: 'FileImport',
20
- props: {
21
- title: {
22
- type: String,
23
- default: function () {
24
- return '文件导入'
25
- }
26
- },
27
- tips: {
28
- type: Array,
29
- default: () => {
30
- return []
31
- }
32
- },
33
- templateUrl: {
34
- type: String,
35
- default: ''
36
- },
37
- downConfig: {
38
- type: Object,
39
- default() {
40
- return {
41
- isFrontDown: true,
42
- fileName: '下载.xlsx'
43
- }
44
- }
45
- },
46
- footerHandlers: {
47
- type: Object,
48
- default: function () {
49
- return {
50
- // cancel: {
51
- // text: '取消'
52
- // },
53
- // confirm: {
54
- // text: '导入'
55
- // }
56
- }
57
- }
58
- },
59
- beforeUpload: Function, // eslint-disable-line
60
- callback: {
61
- type: Function,
62
- default: () => {}
63
- },
64
- handleConfirm: {
65
- type: Function,
66
- default: () => {}
67
- },
68
- reset: {
69
- type: Boolean,
70
- default: false
71
- }
72
- },
73
- data() {
74
- return {
75
- excelData: {
76
- tableHeader: [],
77
- tableData: []
78
- },
79
-
80
- analysisText: 'analysis',
81
- fileName: '',
82
- statisticsFlag: false,
83
- columnsListTemp: [],
84
- errorListTemp: [],
85
- successFlag: false,
86
- confirmDisabledFlag: true
87
- }
88
- },
89
- methods: {
90
- handleCommand(val) {
91
- if (val == 'a') {
92
- this.seletFile()
93
- } else if (val == 'b') {
94
- this.downloadTemplate()
95
- }
96
- },
97
- seletFile() {
98
- let input = document.createElement('input')
99
- let self = this
100
- input.type = 'file'
101
- input.accept = '.xlsx, .xls, .csv'
102
- input.addEventListener('change', function (event) {
103
- const files = event.target.files
104
- const rawFile = files[0] // only use files[0]
105
- console.log('导入的文件:', rawFile)
106
- self.fileName = rawFile.name
107
- if (!rawFile) return
108
- self.upload(rawFile)
109
- this.value = null // fix can't select the same excel
110
- })
111
- input.click()
112
- },
113
- /* 上传文件 */
114
- upload(rawFile) {
115
- if (!this.beforeUpload) {
116
- this.readerData(rawFile)
117
- return
118
- }
119
- const before = this.beforeUpload(rawFile)
120
- if (before) {
121
- this.readerData(rawFile)
122
- }
123
- },
124
- /*解析传入的表格 */
125
- readerData(rawFile) {
126
- return new Promise((resolve) => {
127
- const reader = new FileReader()
128
- reader.onload = (e) => {
129
- const data = e.target.result
130
- const workbook = XLSX.read(data, {
131
- type: 'array',
132
- cellDates: true
133
- })
134
- const firstSheetName = workbook.SheetNames[0]
135
- const worksheet = workbook.Sheets[firstSheetName]
136
- const header = this.getHeaderRow(worksheet)
137
- const results = XLSX.utils.sheet_to_json(worksheet)
138
-
139
- this.generateData({ header, results })
140
- resolve()
141
- }
142
- reader.readAsArrayBuffer(rawFile)
143
- })
144
- },
145
- generateData({ header, results }) {
146
- this.excelData.tableHeader = header
147
- this.excelData.tableData = results
148
- this.callback && this.callback(this.excelData)
149
- },
150
- getHeaderRow(sheet) {
151
- console.log(sheet)
152
- const headers = []
153
- const range = XLSX.utils.decode_range(sheet['!ref'])
154
- let C
155
- const R = range.s.r
156
- /* start in the first row */
157
- for (C = range.s.c; C <= range.e.c; ++C) {
158
- /* walk every column in the range */
159
- const cell = sheet[XLSX.utils.encode_cell({ c: C, r: R })]
160
- /* find the cell in the first row */
161
- let hdr = 'UNKNOWN ' + C // <-- replace with your desired default
162
- if (cell && cell.t) hdr = XLSX.utils.format_cell(cell)
163
- headers.push(hdr)
164
- }
165
- return headers
166
- },
167
- // 下载文件
168
- downloadTemplate() {
169
- // 前端下载
170
- if (this.downConfig.isFrontDown) {
171
- const aEl = document.createElement('a')
172
- aEl.setAttribute('href', this.templateUrl)
173
- aEl.target = '_blank'
174
- // aEl.download = this.templateUrl
175
- aEl.click()
176
- } else {
177
- axios({
178
- url: this.templateUrl,
179
- method: 'get',
180
- responseType: 'blob'
181
- }).then((res) => {
182
- const content = res
183
- const blob = new Blob([content])
184
- if ('download' in document.createElement('a')) {
185
- const link = document.createElement('a')
186
- link.download = this.downConfig.fileName
187
- link.style.display = 'none'
188
- link.href = URL.createObjectURL(blob)
189
- document.body.appendChild(link)
190
- link.click()
191
- URL.revokeObjectURL(link.href)
192
- document.body.removeChild(link)
193
- } else {
194
- navigator.msSaveBlob(blob, this.downConfig.fileName)
195
- }
196
- })
197
- }
198
- }
199
- }
7
+ name: 'FileImport'
200
8
  }
201
9
  </script>
@@ -1,9 +1,181 @@
1
1
  <template>
2
- <div>待完善</div>
2
+ <el-dropdown
3
+ trigger="click"
4
+ placement="bottom-start"
5
+ @command="handleCommand"
6
+ >
7
+ <el-button size="mini" type="primary"> 导入 </el-button>
8
+ <el-dropdown-menu slot="dropdown">
9
+ <el-dropdown-item command="a">导入数据</el-dropdown-item>
10
+ <el-dropdown-item command="b">模板下载</el-dropdown-item>
11
+ </el-dropdown-menu>
12
+ </el-dropdown>
3
13
  </template>
4
14
 
5
15
  <script>
16
+ import XLSX from 'xlsx'
17
+ import axios from '../../utils/axios'
6
18
  export default {
7
- name: 'FileImport'
19
+ name: 'FileImport',
20
+ props: {
21
+ templateUrl: {
22
+ type: String,
23
+ default: ''
24
+ },
25
+ downConfig: {
26
+ type: Object,
27
+ default() {
28
+ return {
29
+ isFrontDown: true,
30
+ fileName: '下载.xlsx'
31
+ }
32
+ }
33
+ },
34
+ footerHandlers: {
35
+ type: Object,
36
+ default: function () {
37
+ return {
38
+ // cancel: {
39
+ // text: '取消'
40
+ // },
41
+ // confirm: {
42
+ // text: '导入'
43
+ // }
44
+ }
45
+ }
46
+ },
47
+ beforeUpload: Function, // eslint-disable-line
48
+ callback: {
49
+ type: Function,
50
+ default: () => {}
51
+ }
52
+ },
53
+ data() {
54
+ 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
67
+ }
68
+ },
69
+ methods: {
70
+ handleCommand(val) {
71
+ if (val === 'a') {
72
+ this.seletFile()
73
+ } else if (val === 'b') {
74
+ this.downloadTemplate()
75
+ }
76
+ },
77
+ seletFile() {
78
+ let input = document.createElement('input')
79
+ let self = this
80
+ 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
90
+ })
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
+
119
+ this.generateData({ header, results })
120
+ resolve()
121
+ }
122
+ reader.readAsArrayBuffer(rawFile)
123
+ })
124
+ },
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
+ }
176
+ })
177
+ }
178
+ }
179
+ }
8
180
  }
9
181
  </script>
@@ -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>
@@ -129,10 +129,13 @@ export default {
129
129
  },
130
130
  blurFn() {
131
131
  this.showStr = true
132
+ this.$emit('blur', this.value)
132
133
  },
133
134
  changeFn(val) {
134
135
  if (!val && val !== 0) {
135
- return this.$emit('input', val)
136
+ this.$emit('input', val)
137
+ this.$emit('change', val)
138
+ return
136
139
  }
137
140
 
138
141
  switch (this.type) {
@@ -148,6 +151,7 @@ export default {
148
151
  this.$nextTick(() => {
149
152
  this.valueNum = nVar
150
153
  this.$emit('input', nVar)
154
+ this.$emit('change', nVar)
151
155
  })
152
156
  }
153
157
  break
@@ -162,6 +166,7 @@ export default {
162
166
  this.$nextTick(() => {
163
167
  this.valueNum = nVar
164
168
  this.$emit('input', nVar)
169
+ this.$emit('change', nVar)
165
170
  })
166
171
  }
167
172
  break
@@ -6,7 +6,8 @@
6
6
  :max="endValue || endValue === 0 ? endValue : $attrs.max"
7
7
  :type="type"
8
8
  style="width: calc(50% - 8px)"
9
- @input="(val) => $emit('update:start-value', val)"
9
+ @input="startChange"
10
+ @blur="blurFn"
10
11
  />
11
12
  <span class="numbre-range text-c" style="display: inline-block; width: 16px"
12
13
  >-</span
@@ -17,7 +18,8 @@
17
18
  :min="startValue || startValue === 0 ? startValue : $attrs.min"
18
19
  :type="type"
19
20
  style="width: calc(50% - 8px)"
20
- @input="(val) => $emit('update:end-value', val)"
21
+ @input="endChange"
22
+ @blur="blurFn"
21
23
  />
22
24
  </div>
23
25
  </template>
@@ -42,6 +44,19 @@ export default {
42
44
  type: String,
43
45
  default: 'money'
44
46
  }
47
+ },
48
+ methods: {
49
+ startChange(val) {
50
+ this.$emit('update:start-value', val)
51
+ this.$emit('change', [this.startValue, this.endValue])
52
+ },
53
+ endChange(val) {
54
+ this.$emit('update:end-value', val)
55
+ this.$emit('change', [this.startValue, this.endValue])
56
+ },
57
+ blurFn() {
58
+ this.$emit('blur', [this.startValue, this.endValue])
59
+ }
45
60
  }
46
61
  }
47
62
  </script>