n20-common-lib 1.3.28 → 1.3.31

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.28",
3
+ "version": "1.3.31",
4
4
  "private": false,
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -1,10 +1,7 @@
1
1
  .el-button--primary,
2
2
  .el-button--default,
3
3
  .el-button--default.is-plain,
4
- .el-button--warning.is-plain,
5
- .el-button--mini,
6
- .el-button--mini.is-plain,
7
- .el-button--danger.is-plain {
4
+ .el-button--warning.is-plain {
8
5
  min-width: 72px;
9
6
  }
10
7
 
@@ -86,12 +86,3 @@
86
86
  .el-table .descending .sort-caret.descending {
87
87
  color: $--color-primary;
88
88
  }
89
-
90
- .el-table {
91
- .cell {
92
- .el-dropdown-link.n20-icon-moren {
93
- color: $--color-primary;
94
- }
95
- }
96
-
97
- }
@@ -1,36 +1,32 @@
1
1
  <template>
2
- <div class="n20-subticket-interval">
3
- <div class="input-child-range" :class="{ 'is-disabled': disabled }">
4
- <div class="flex">
5
- <div class="from">
6
- <el-input
7
- ref="input_left"
8
- v-model="value1"
9
- :disabled="disabled"
10
- placeholder="子票区间起"
11
- @blur="handleBlurleft"
12
- @focus="handleFocusLeft"
13
- @input="handleInputleft"
14
- @change="handleInputChangeLeft"
15
- />
16
- </div>
17
- <div class="center">
18
- <span> - </span>
19
- </div>
20
- <div class="to">
21
- <el-input
22
- ref="input_right"
23
- v-model="value2"
24
- :disabled="disabled"
25
- placeholder="子票区间止"
26
- @blur="handleBlurRight"
27
- @focus="handleFocusRight"
28
- @input="handleInputRight"
29
- @change="handleInputChangeRight"
30
- />
31
- </div>
32
- </div>
33
- </div>
2
+ <div
3
+ class="n20-subticket-interval flex-box"
4
+ :class="{ 'is-disabled': disabled, 'is-focus': focus }"
5
+ :disabled="disabled"
6
+ >
7
+ <el-input
8
+ ref="input_left"
9
+ v-model="value1"
10
+ class="from flex-item"
11
+ :disabled="disabled"
12
+ placeholder="子票区间起"
13
+ @blur="handleBlurleft"
14
+ @focus="handleFocusLeft"
15
+ @input="handleInputleft"
16
+ @change="handleInputChangeLeft"
17
+ />
18
+ <div class="center">-</div>
19
+ <el-input
20
+ ref="input_right"
21
+ v-model="value2"
22
+ class="to flex-item"
23
+ :disabled="disabled"
24
+ placeholder="子票区间止"
25
+ @blur="handleBlurRight"
26
+ @focus="handleFocusRight"
27
+ @input="handleInputRight"
28
+ @change="handleInputChangeRight"
29
+ />
34
30
  </div>
35
31
  </template>
36
32
 
@@ -39,14 +35,16 @@ export default {
39
35
  name: 'ChildRange',
40
36
  props: {
41
37
  // 初始化范围
42
- value: { required: true },
43
-
38
+ value: {
39
+ required: true,
40
+ type: Array,
41
+ default: () => []
42
+ },
44
43
  // 是否禁用
45
44
  disabled: {
46
45
  type: Boolean,
47
46
  default: false
48
47
  },
49
-
50
48
  // 精度参数
51
49
  precision: {
52
50
  type: Number,
@@ -59,7 +57,8 @@ export default {
59
57
  data() {
60
58
  return {
61
59
  value1: null,
62
- value2: null
60
+ value2: null,
61
+ focus: false
63
62
  }
64
63
  },
65
64
  watch: {
@@ -84,18 +83,22 @@ export default {
84
83
  },
85
84
 
86
85
  handleBlurleft(event) {
86
+ this.focus = false
87
87
  this.$emit('blurleft', event)
88
88
  },
89
89
 
90
90
  handleFocusLeft(event) {
91
+ this.focus = true
91
92
  this.$emit('focusleft', event)
92
93
  },
93
94
 
94
95
  handleBlurRight(event) {
96
+ this.focus = false
95
97
  this.$emit('blurright', event)
96
98
  },
97
99
 
98
100
  handleFocusRight(event) {
101
+ this.focus = true
99
102
  this.$emit('focusright', event)
100
103
  },
101
104
 
@@ -163,4 +166,4 @@ export default {
163
166
  }
164
167
  }
165
168
  }
166
- </script>
169
+ </script>
@@ -1,34 +1,34 @@
1
1
  .n20-subticket-interval {
2
- .input-child-range {
3
- background-color: #fff;
4
- border: 1px solid #dcdfe6;
5
- border-radius: 4px;
6
- // 取消element原有的input框样式
7
- ::v-deep .el-input--small .el-input__inner {
8
- border: 0px;
9
- margin: 0;
10
- padding: 0 5px;
11
- background-color: transparent;
12
- }
13
- ::v-deep .el-input__inner:focus {
14
- box-shadow: none;
15
- }
2
+ background-color: $--color-white;
3
+ border: 1px solid $--border-color-base;
4
+ border-radius: $--border-radius-base;
5
+ // 取消element原有的input框样式
6
+ .el-input {
7
+ margin: -1px;
16
8
  }
17
- .flex {
18
- display: flex;
19
- flex-direction: row;
20
- width: 100%;
21
- justify-content: center;
22
- align-items: center;
23
- .center {
24
- color: #cccccc;
25
- margin: 0 1px;
26
- }
9
+ .el-input__inner,
10
+ .el-input__inner:hover {
11
+ border-color: transparent !important;
12
+ background-color: transparent !important;
13
+ box-shadow: none;
27
14
  }
28
- .is-disabled {
29
- background-color: #eef0f6;
30
- border-color: #e4e7ed;
31
- color: #c0c4cc;
15
+ &:not([disabled]):hover {
16
+ border-color: $--color-primary;
17
+ }
18
+
19
+ &:focus,
20
+ &.is-focus {
21
+ border-color: $--color-primary;
22
+ box-shadow: 0 0 2px $--color-primary;
23
+ }
24
+ .center {
25
+ margin: -1px 2px;
26
+ color: $--color-text-placeholder;
27
+ }
28
+ &.is-disabled {
29
+ background-color: $--background-color-base;
30
+ border-color: $--border-color-light;
31
+ color: $--color-info-light;
32
32
  cursor: not-allowed;
33
33
  }
34
34
  }
@@ -55,8 +55,10 @@ export default {
55
55
  pgsVal: 0,
56
56
  status: undefined, //init progress success error
57
57
  timer: undefined,
58
- elapsedTimeout: 0,
59
- waitPopV: false
58
+
59
+ waitPopV: false,
60
+ waitTimer: undefined,
61
+ waitClass: ''
60
62
  }
61
63
  },
62
64
  computed: {
@@ -70,13 +72,17 @@ export default {
70
72
  },
71
73
  methods: {
72
74
  export() {
75
+ clearTimeout(this.timer)
76
+ clearTimeout(this.waitTimer)
77
+
73
78
  this.pgsVal = 0
74
79
  this.status = 'init'
75
- clearTimeout(this.timer)
76
- this.elapsedTimeout = 0
80
+ this.pgsV = true
81
+
82
+ this.waitClass = 'ex-waitime-' + Date.now()
77
83
  this.waitPopV = false
84
+ this.waitPop()
78
85
 
79
- this.pgsV = true
80
86
  this.exportReq()
81
87
  },
82
88
  // 导出请求
@@ -92,6 +98,7 @@ export default {
92
98
  this.$emit('export-pgs', (pgs, error) => {
93
99
  if (error) {
94
100
  this.status = 'error'
101
+ this.closeWaitPop()
95
102
  console.error('导出失败')
96
103
  return
97
104
  }
@@ -101,24 +108,22 @@ export default {
101
108
  this.status = 'progress'
102
109
 
103
110
  clearTimeout(this.timer)
104
- this.timer = setTimeout(() => {
105
- this.elapsedTimeout = this.elapsedTimeout + this.stepTime
106
- this.exportPgs()
107
- }, this.stepTime)
111
+ this.timer = setTimeout(this.exportPgs, this.stepTime)
108
112
  } else {
109
113
  this.pgsVal = parseInt(pgs)
110
114
  this.status = 'success'
111
115
 
112
116
  this.exportRes()
113
117
  }
114
- this.waitPop()
115
118
  })
116
119
  },
117
120
  // 导出响应
118
121
  exportRes() {
119
122
  this.$emit('export-res', (data, error) => {
123
+ clearTimeout(this.waitTimer)
120
124
  if (error) {
121
125
  this.status = 'error'
126
+ this.closeWaitPop()
122
127
  console.error('导出失败')
123
128
  return
124
129
  }
@@ -126,12 +131,11 @@ export default {
126
131
  this.status = 'success'
127
132
  this.pgsVal = 100
128
133
 
134
+ this.closeWaitPop()
129
135
  downloadBlob(data, this.fileName)
130
- this.pgsV = false
131
- let confirmBtn = document.querySelector(
132
- '.ex-waitime-msg .el-button--primary'
133
- )
134
- confirmBtn && confirmBtn.click()
136
+ setTimeout(() => {
137
+ this.pgsV = false
138
+ }, 500)
135
139
  })
136
140
  },
137
141
  // 导出取消
@@ -156,22 +160,31 @@ export default {
156
160
  },
157
161
  // 时间太长提示
158
162
  waitPop() {
159
- if (!this.waitPopV && this.elapsedTimeout > this.waitTime) {
160
- this.waitPopV = true
161
-
162
- this.$msgboxPor({
163
- title: '提示',
164
- message: '您的数据导出时间可能会比较长,是否继续导出?',
165
- type: 'warning',
166
- customClass: 'question ex-waitime-msg',
167
- confirmButtonText: '继续导出',
168
- cancelButtonText: '取消'
169
- }).catch(() => {
170
- clearTimeout(this.timer)
171
- this.pgsV = false
172
- this.$emit('export-cancel')
173
- })
174
- }
163
+ clearTimeout(this.waitTimer)
164
+ this.waitTimer = setTimeout(() => {
165
+ if (!this.waitPopV) {
166
+ this.waitPopV = true
167
+ this.$msgboxPor({
168
+ title: '提示',
169
+ message: '您的数据导出时间可能会比较长,是否继续导出?',
170
+ type: 'warning',
171
+ customClass: `question ${this.waitClass}`,
172
+ confirmButtonText: '继续导出',
173
+ cancelButtonText: '取消'
174
+ }).catch(() => {
175
+ clearTimeout(this.timer)
176
+ this.pgsV = false
177
+ this.$emit('export-cancel')
178
+ })
179
+ }
180
+ }, this.waitTime)
181
+ },
182
+ closeWaitPop() {
183
+ clearTimeout(this.waitTimer)
184
+ let confirmBtn = document.querySelector(
185
+ `.${this.waitClass} .el-button--primary`
186
+ )
187
+ confirmBtn && confirmBtn.click()
175
188
  }
176
189
  }
177
190
  }
@@ -167,7 +167,11 @@
167
167
  :disabled="!row[keys.type]"
168
168
  :accept="row[keys.type] | acceptFilter(typeOptions, fileAccept)"
169
169
  :size="row[keys.type] | sizeFilter(typeOptions, fileSize)"
170
- :http-request="uploadHttpRequest"
170
+ :http-request="
171
+ uploadHttpRequest
172
+ ? (options) => uploadHttpRequest(options, row)
173
+ : undefined
174
+ "
171
175
  :before-upload="(file) => beforeUploadFn(file, row)"
172
176
  :on-progress="(event) => onProgressFn(event, row)"
173
177
  :on-success="
@@ -0,0 +1,133 @@
1
+ <template>
2
+ <el-input
3
+ v-if="item.type === 'text' || item.type === undefined"
4
+ v-model="form[item.value]"
5
+ :clearable="item | clearableF"
6
+ style="width: 100%"
7
+ v-bind="item.props"
8
+ v-on="item.on"
9
+ />
10
+ <el-select
11
+ v-else-if="item.type === 'select'"
12
+ v-model="form[item.value]"
13
+ :clearable="item | clearableF"
14
+ :multiple="item.multiple"
15
+ style="width: 100%"
16
+ v-bind="item.props"
17
+ v-on="item.on"
18
+ >
19
+ <template v-if="item.props && item.props.labelKey && item.props.valueKey">
20
+ <el-option
21
+ v-for="(c, i) in item.options"
22
+ :key="i"
23
+ :label="c[item.props.labelKey]"
24
+ :value="c[item.props.valueKey]"
25
+ :disabled="c.disabled"
26
+ />
27
+ </template>
28
+ <template v-else>
29
+ <el-option
30
+ v-for="c in item.options"
31
+ :key="c.value + '_' + c.label"
32
+ :label="c.label"
33
+ :value="c.value"
34
+ :disabled="c.disabled"
35
+ />
36
+ </template>
37
+ </el-select>
38
+ <inputNumber
39
+ v-else-if="item.type === 'number'"
40
+ v-model="form[item.value]"
41
+ style="width: 100%"
42
+ v-bind="item.props"
43
+ v-on="item.on"
44
+ />
45
+ <inputNumberRange
46
+ v-else-if="item.type === 'numberrange'"
47
+ :start-value.sync="form[item.startValue]"
48
+ :end-value.sync="form[item.endValue]"
49
+ style="width: 100%"
50
+ v-bind="item.props"
51
+ v-on="item.on"
52
+ />
53
+ <datePickerPor
54
+ v-else-if="item.type === 'date'"
55
+ v-model="form[item.value]"
56
+ type="date"
57
+ :clearable="item | clearableF"
58
+ style="width: 100%"
59
+ v-bind="item.props"
60
+ v-on="item.on"
61
+ />
62
+ <datePickerPor
63
+ v-else-if="item.type === 'daterange'"
64
+ type="daterange"
65
+ :start-date.sync="form[item.startDate]"
66
+ :end-date.sync="form[item.endDate]"
67
+ :clearable="item | clearableF"
68
+ style="width: 100%"
69
+ v-bind="item.props"
70
+ v-on="item.on"
71
+ />
72
+ <el-checkbox-group
73
+ v-else-if="item.type === 'checkbox'"
74
+ v-model="form[item.value]"
75
+ v-bind="item.props"
76
+ v-on="item.on"
77
+ >
78
+ <el-checkbox
79
+ v-for="c in item.options"
80
+ :key="c.value"
81
+ :label="c.value"
82
+ :disabled="c.disabled"
83
+ >{{ c.label }}</el-checkbox
84
+ >
85
+ </el-checkbox-group>
86
+ <el-radio-group
87
+ v-else-if="item.type === 'radio'"
88
+ v-model="form[item.value]"
89
+ v-bind="item.props"
90
+ v-on="item.on"
91
+ >
92
+ <el-radio
93
+ v-for="c in item.options"
94
+ :key="c.value"
95
+ :label="c.value"
96
+ :disabled="c.disabled"
97
+ >{{ c.label }}</el-radio
98
+ >
99
+ </el-radio-group>
100
+ </template>
101
+
102
+ <script>
103
+ import inputNumber from '../InputNumber/index.vue'
104
+ import inputNumberRange from '../InputNumber/numberRange.vue'
105
+ import datePickerPor from '../DatePicker/por.vue'
106
+ export default {
107
+ components: {
108
+ inputNumber,
109
+ inputNumberRange,
110
+ datePickerPor
111
+ },
112
+ filters: {
113
+ clearableF(item) {
114
+ if (item.props && item.props.clearable === false) {
115
+ return false
116
+ } else {
117
+ return true
118
+ }
119
+ }
120
+ },
121
+ props: {
122
+ form: {
123
+ type: Object,
124
+ default: undefined
125
+ },
126
+ item: {
127
+ type: Object,
128
+ default: undefined
129
+ }
130
+ }
131
+ }
132
+ </script>
133
+