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
@@ -52,6 +52,7 @@
52
52
  <script>
53
53
  import getJsonc from '../../assets/getJsonc'
54
54
  import realUrl from '../../assets/realUrl'
55
+ import axios from '../../utils/axios'
55
56
 
56
57
  import loginForm from './form.vue'
57
58
  import retrievePw from './retrievePw.vue'
@@ -84,46 +85,56 @@ export default {
84
85
  operateType: 'login'
85
86
  }
86
87
  },
87
- async created() {
88
+ created() {
88
89
  this.removeStorage()
89
- await this.init()
90
- this.setConfig()
90
+ this.init()
91
91
  },
92
92
  methods: {
93
- async init() {
94
- const { data } = await this.$axios.get(`/bems/1.0/sysSetting/list`)
95
- if (data) {
96
- this.getdata(data)
97
- this.getLogoImag()
98
- }
93
+ init() {
94
+ axios
95
+ .get(`/bems/1.0/sysSetting/list`, null, {
96
+ loading: false,
97
+ noMsg: true
98
+ })
99
+ .then(({ data }) => {
100
+ this.getdata(data)
101
+ })
102
+ .finally(() => {
103
+ this.setConfig()
104
+ })
105
+
106
+ this.getLogoImag()
99
107
  },
100
108
  async getLogoImag() {
101
- const login = await this.$axios.get(
102
- `/bems/1.0/attach/LOGIN_BACKGROUND_IMAGE`,
103
- {},
104
- { config: { responseType: 'arraybuffer' } }
105
- )
106
- this.BgImage = window.URL.createObjectURL(new Blob([login]))
107
- const company = await this.$axios.get(
108
- `/bems/1.0/attach/COMPANY_LOGOE`,
109
- {},
110
- {
111
- config: { responseType: 'arraybuffer' }
112
- }
113
- )
114
- this.LogoImage = window.URL.createObjectURL(new Blob([company]))
109
+ axios
110
+ .get(`/bems/1.0/attach/LOGIN_BACKGROUND_IMAGE`, null, {
111
+ responseType: 'blob',
112
+ loading: false,
113
+ noMsg: true
114
+ })
115
+ .then((blob) => {
116
+ this.BgImage = window.URL.createObjectURL(blob)
117
+ })
118
+ axios
119
+ .get(`/bems/1.0/attach/COMPANY_LOGOE`, null, {
120
+ responseType: 'blob',
121
+ loading: false,
122
+ noMsg: true
123
+ })
124
+ .then((blob) => {
125
+ this.LogoImage = window.URL.createObjectURL(blob)
126
+ })
115
127
  },
116
128
  getdata(list) {
117
- for (const i of list) {
118
- if (i.pmName == 'LOGIN_MODE') {
119
- this.LOGIN_MODE = i.pmValue.split(',')
120
- console.log(this.LOGIN_MODE)
121
- } else if (i.pmName == 'MAIN_PAGE_TEXT') {
122
- this.MAIN_PAGE_TEXT = i.pmValue
123
- } else if (i.pmName == 'SYSTEM_NAME') {
124
- this.SYSTEM_NAME = i.pmValue
129
+ list.forEach((item) => {
130
+ if (item.pmName === 'LOGIN_MODE') {
131
+ this.LOGIN_MODE = item.pmValue.split(',')
132
+ } else if (item.pmName === 'MAIN_PAGE_TEXT') {
133
+ this.MAIN_PAGE_TEXT = item.pmValue
134
+ } else if (item.pmName === 'SYSTEM_NAME') {
135
+ this.SYSTEM_NAME = item.pmValue
125
136
  }
126
- }
137
+ })
127
138
  },
128
139
  setConfig() {
129
140
  getJsonc('/server-config.jsonc').then(({ _layoutData = {} }) => {
@@ -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>
@@ -33,4 +33,4 @@ export default {
33
33
  }
34
34
  }
35
35
  }
36
- </script>
36
+ </script>
@@ -1,4 +1,3 @@
1
-
2
1
  <template>
3
2
  <el-tabs
4
3
  :value="init"
@@ -63,6 +63,7 @@ export default {
63
63
  methods: {
64
64
  change(val) {
65
65
  this.$emit('input', val)
66
+ this.$emit('change', val)
66
67
  },
67
68
  lazyGet() {
68
69
  this.$emit('scroll-bottom')
@@ -71,5 +72,4 @@ export default {
71
72
  }
72
73
  </script>
73
74
 
74
- <style>
75
- </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"
@@ -5,13 +5,13 @@ directive.install = (Vue) => {
5
5
  bind: function (el, binding, node) {
6
6
  el.clickOutsideEvent = function (event) {
7
7
  if (!(el === event.target || el.contains(event.target))) {
8
- node.context[binding.expression](event)
8
+ binding.value(event)
9
9
  }
10
10
  }
11
- document.body.addEventListener('click', el.clickOutsideEvent)
11
+ document.body.addEventListener('click', el.clickOutsideEvent, binding.arg === 'capture')
12
12
  },
13
- unbind: function (el) {
14
- document.body.removeEventListener('click', el.clickOutsideEvent)
13
+ unbind: function (el, binding) {
14
+ document.body.removeEventListener('click', el.clickOutsideEvent, binding.arg === 'capture')
15
15
  }
16
16
  })
17
17
  }
@@ -0,0 +1,194 @@
1
+ const VD = '_v-rule-key_validate_'
2
+
3
+ function getRules(rules, evType) {
4
+ if (rules) {
5
+ let _rules = []
6
+ if (Array.isArray(rules)) {
7
+ _rules = rules
8
+ } else if (typeof rules === 'object') {
9
+ _rules.push(rules)
10
+ }
11
+ if (evType === 'submit') {
12
+ return _rules
13
+ } else {
14
+ return _rules.filter((r) => r.trigger.includes(evType))
15
+ }
16
+ } else {
17
+ return []
18
+ }
19
+ }
20
+
21
+ function validateRoule(rule, value) {
22
+ return new Promise(function (resolve, reject) {
23
+ if (rule.required) {
24
+ if (value === undefined || value === null || value === '' || (Array.isArray(value) && value.length === 0)) {
25
+ reject(rule.message)
26
+ return
27
+ }
28
+ }
29
+ if (rule.type === 'string') {
30
+ if (typeof value !== 'string') {
31
+ reject(rule.message)
32
+ return
33
+ }
34
+ }
35
+ if (rule.type === 'number') {
36
+ if (typeof value !== 'number') {
37
+ reject(rule.message)
38
+ return
39
+ }
40
+ }
41
+ if (rule.type === 'boolean') {
42
+ if (typeof value !== 'boolean') {
43
+ reject(rule.message)
44
+ return
45
+ }
46
+ }
47
+ if (rule.type === 'array') {
48
+ if (!(Array.isArray(value) && value.length > 0)) {
49
+ reject(rule.message)
50
+ return
51
+ }
52
+ }
53
+ if (rule.type === 'date') {
54
+ if (new Date(value).toString() === 'Invalid Date') {
55
+ reject(rule.message)
56
+ return
57
+ }
58
+ }
59
+ if (rule.min !== undefined || rule.max !== undefined) {
60
+ if (value === undefined || value === null) {
61
+ reject(rule.message)
62
+ return
63
+ } else {
64
+ let _v = value.toString()
65
+ if (_v.length < rule.min || _v.length > rule.max) {
66
+ reject(rule.message)
67
+ return
68
+ }
69
+ }
70
+ }
71
+ if (rule.regexp) {
72
+ if (new RegExp(rule.regexp).test(value)) {
73
+ reject(rule.message)
74
+ return
75
+ }
76
+ }
77
+ if (!rule.validator) {
78
+ resolve()
79
+ return
80
+ }
81
+ if (rule.validator) {
82
+ rule.validator(rule, value, (err) => {
83
+ if (err === undefined || err === false) {
84
+ resolve()
85
+ return
86
+ } else {
87
+ reject(err === true ? rule.message : err)
88
+ }
89
+ })
90
+ }
91
+ })
92
+ }
93
+
94
+ function showErr(el, err = '', rErr) {
95
+ el.classList.add('rule-key__is-error')
96
+
97
+ if (rErr) {
98
+ let msgEl = el.querySelector('.rule-key__error_msg')
99
+ if (!msgEl) {
100
+ let msgEl = document.createElement('div')
101
+ msgEl.classList.add('rule-key__error_msg')
102
+ msgEl.innerText = err.toString()
103
+ el.appendChild(msgEl)
104
+ } else if (msgEl) {
105
+ msgEl.innerText = err.toString()
106
+ }
107
+ }
108
+ }
109
+ function hideErr(el, rErr) {
110
+ el.classList.remove('rule-key__is-error')
111
+
112
+ if (rErr) {
113
+ let msgEl = el.querySelector('.rule-key__error_msg')
114
+ if (msgEl) {
115
+ el.removeChild(msgEl)
116
+ }
117
+ }
118
+ }
119
+
120
+ const directive = {}
121
+ directive.install = (Vue) => {
122
+ Vue.directive('rule-key', {
123
+ bind(el, binding, node) {
124
+ let _this = node.child
125
+
126
+ let ruleForm = _this.$attrs['rule-form'] || _this.$attrs['ruleForm']
127
+ ruleForm && el.classList.add(ruleForm)
128
+
129
+ let rErr = _this.$attrs['rule-error-hide'] || _this.$attrs['ruleErrorHide']
130
+ rErr = rErr !== 'true' && rErr !== true
131
+
132
+ el[VD] = (val, type) => {
133
+ let _val = _this[binding.value || 'value']
134
+ let _rules = getRules(_this.$attrs['rules'], type)
135
+ if (_rules.length > 0) {
136
+ return Promise.all(_rules.map((rule) => validateRoule(rule, _val)))
137
+ .then(() => {
138
+ hideErr(el, rErr)
139
+ })
140
+ .catch((err) => {
141
+ showErr(el, err, rErr)
142
+ })
143
+ } else {
144
+ return Promise.resolve()
145
+ }
146
+ }
147
+
148
+ _this.$on('change', () => {
149
+ setTimeout(() => el[VD](undefined, 'change'))
150
+ })
151
+ // el.addEventListener('change', () => {
152
+ // el[VD](undefined, 'change')
153
+ // })
154
+
155
+ _this.$on('blur', () => {
156
+ setTimeout(() => el[VD](undefined, 'blur'))
157
+ })
158
+ // el.addEventListener('blur', () => {
159
+ // el[VD](undefined, 'blur')
160
+ // })
161
+ }
162
+ })
163
+ }
164
+
165
+ function rulesValidateForm(query, fn) {
166
+ let nodeList = document.querySelectorAll('.' + query)
167
+ if (nodeList.length) {
168
+ let validateList = []
169
+ nodeList.forEach((el) => {
170
+ typeof el[VD] === 'function' && validateList.push(el[VD](undefined, 'submit'))
171
+ })
172
+ return Promise.all(validateList)
173
+ .then(() => {
174
+ fn && fn(true)
175
+ })
176
+ .catch(() => {
177
+ fn && fn(false)
178
+ })
179
+ } else {
180
+ fn && fn(true)
181
+ return Promise.resolve()
182
+ }
183
+ }
184
+ function rulesValidateFormClear(query) {
185
+ let nodeList = document.querySelectorAll('.' + query)
186
+ nodeList.forEach((el) => {
187
+ hideErr(el, true)
188
+ })
189
+ }
190
+
191
+ window.rulesValidateForm = rulesValidateForm
192
+ window.rulesValidateFormClear = rulesValidateFormClear
193
+
194
+ export default directive
package/src/index.js CHANGED
@@ -67,6 +67,7 @@ import DialogO from './components/Dialog/indexO.vue'
67
67
  import VTitle from './directives/VTitle/index.js'
68
68
  import VDrag from './directives/VDrag/index.js'
69
69
  import VMove from './directives/VMove/index.js'
70
+ import VRuleKey from './directives/VRuleKey/index.js'
70
71
  import VClickOutside from './directives/VClickOutside/index.js'
71
72
  import VHas from './directives/VHas/index.js'
72
73
 
@@ -165,6 +166,7 @@ const install = function (Vue, opts = { prefix: 'Cl', i18nConfig: {} }) {
165
166
  Vue.use(VTitle)
166
167
  Vue.use(VDrag)
167
168
  Vue.use(VMove)
169
+ Vue.use(VRuleKey)
168
170
  Vue.use(VClickOutside)
169
171
  Vue.use(VHas)
170
172
 
@@ -1,6 +1,19 @@
1
1
  /* 对ElementUI硬优化 */
2
2
  import Popper from 'element-ui/lib/utils/popper.js'
3
3
 
4
+ import Vue from 'vue'
5
+ import FilterPanel from './tableheaderFilterpanel.vue'
6
+
7
+ function hasClass(el, cls) {
8
+ if (!el || !cls) return false
9
+ if (cls.indexOf(' ') !== -1) throw new Error('className should not contain space.')
10
+ if (el.classList) {
11
+ return el.classList.contains(cls)
12
+ } else {
13
+ return (' ' + el.className + ' ').indexOf(' ' + cls + ' ') > -1
14
+ }
15
+ }
16
+
4
17
  function setPropsDefault(component, props) {
5
18
  let c_props = component.props
6
19
  Object.keys(props).forEach((key) => {
@@ -69,7 +82,7 @@ export default function (ElementUI) {
69
82
  default: true
70
83
  }
71
84
  })
72
-
85
+ // 设置表头最小宽度,保证表头不换行
73
86
  setMethodsDefault(ElementUI.TableColumn, {
74
87
  setColumnWidth(column) {
75
88
  if (this.realWidth) {
@@ -92,4 +105,41 @@ export default function (ElementUI) {
92
105
  return column
93
106
  }
94
107
  })
108
+
109
+ // 美化表头搜索
110
+ if (ElementUI.Table.components.TableHeader) {
111
+ setMethodsDefault(ElementUI.Table.components.TableHeader, {
112
+ handleFilterClick(event, column) {
113
+ event.stopPropagation()
114
+ const target = event.target
115
+ let cell = target.tagName === 'TH' ? target : target.parentNode
116
+ if (hasClass(cell, 'noclick')) return
117
+ cell = cell.querySelector('.el-table__column-filter-trigger') || cell
118
+ const table = this.$parent
119
+
120
+ let filterPanel = this.filterPanels[column.id]
121
+
122
+ if (filterPanel && column.filterOpened) {
123
+ filterPanel.showPopper = false
124
+ return
125
+ }
126
+
127
+ if (!filterPanel) {
128
+ filterPanel = new Vue(FilterPanel)
129
+ this.filterPanels[column.id] = filterPanel
130
+ if (column.filterPlacement) {
131
+ filterPanel.placement = column.filterPlacement
132
+ }
133
+ filterPanel.table = table
134
+ filterPanel.cell = cell
135
+ filterPanel.column = column
136
+ !this.$isServer && filterPanel.$mount(document.createElement('div'))
137
+ }
138
+
139
+ setTimeout(() => {
140
+ filterPanel.showPopper = true
141
+ }, 16)
142
+ }
143
+ })
144
+ }
95
145
  }