n20-common-lib 1.3.29 → 1.3.32

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.29",
3
+ "version": "1.3.32",
4
4
  "private": false,
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -1,46 +1,22 @@
1
- const name = process.env.VUE_APP_NAME
1
+ import { addTab, closeTab, setTabName, refreshTab } from '../utils/handleTab.js'
2
2
 
3
3
  const PM = {
4
4
  namespaced: true,
5
5
  state: {
6
- data: {}
6
+ data: undefined
7
7
  },
8
8
  mutations: {
9
- set(state, data) {
10
- state.data = Object.assign({}, state.data, data)
9
+ addTab(state, opt) {
10
+ addTab(opt)
11
11
  },
12
- addTab(state, opt = {}) {
13
- window.postMessage({
14
- addTab: opt,
15
- targetName: 'main',
16
- originName: name
17
- })
12
+ closeTab(state, opt) {
13
+ closeTab(opt)
18
14
  },
19
- closeTab(state, opt = {}) {
20
- window.postMessage({
21
- closeTab: opt,
22
- targetName: 'main',
23
- originName: name
24
- })
15
+ setTabName(state, opt) {
16
+ setTabName(opt)
25
17
  },
26
- setTabName(state, opt = {}) {
27
- window.postMessage({
28
- setTabName: opt,
29
- targetName: 'main',
30
- originName: name
31
- })
32
- },
33
- refreshTab(state, opt = {}) {
34
- window.postMessage({
35
- refreshTab: opt,
36
- targetName: 'main',
37
- originName: name
38
- })
39
- }
40
- },
41
- getters: {
42
- get(state) {
43
- return state.data
18
+ refreshTab(state, opt) {
19
+ refreshTab(opt)
44
20
  }
45
21
  }
46
22
  }
@@ -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
  }
@@ -0,0 +1,52 @@
1
+ <template>
2
+ <i data-node="custom-el" style="display: none"></i>
3
+ </template>
4
+
5
+ <script>
6
+ // 触发自定义冒泡事假
7
+ // XXX:还差iframe的处理
8
+ export default {
9
+ props: {
10
+ dataCustom: {
11
+ type: Object,
12
+ default: undefined
13
+ },
14
+ dataEvent: {
15
+ type: String,
16
+ default: 'custom'
17
+ }
18
+ },
19
+ watch: {
20
+ dataCustom: {
21
+ handler(val) {
22
+ this.setData(val)
23
+ },
24
+ deep: true
25
+ }
26
+ },
27
+ mounted() {
28
+ this.setData(this.dataCustom)
29
+ },
30
+ methods: {
31
+ setData(obj) {
32
+ if (obj) {
33
+ this.$el.customData = JSON.parse(JSON.stringify(obj))
34
+ dispatchEvent(this.$el, this.dataEvent)
35
+ }
36
+ }
37
+ }
38
+ }
39
+
40
+ function dispatchEvent(el, type) {
41
+ var evName = '_on_' + type
42
+ var evEvent = undefined
43
+
44
+ if (!window[evName]) {
45
+ evEvent = document.createEvent('Event')
46
+ evEvent.initEvent(type, true, false)
47
+ window[evName] = evEvent
48
+ }
49
+
50
+ el.dispatchEvent(window[evName])
51
+ }
52
+ </script>
@@ -0,0 +1,186 @@
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-input
11
+ v-else-if="item.type === 'search'"
12
+ v-model="form[item.value]"
13
+ :clearable="item | clearableF"
14
+ style="width: 100%"
15
+ readonly
16
+ v-bind="item.props"
17
+ v-on="item.on"
18
+ >
19
+ <i
20
+ slot="suffix"
21
+ class="el-input__icon el-icon-zoom-in"
22
+ @click="
23
+ () => {
24
+ item.on && item.on.focus && item.on.focus()
25
+ }
26
+ "
27
+ ></i>
28
+ </el-input>
29
+ <el-select
30
+ v-else-if="item.type === 'select'"
31
+ v-model="form[item.value]"
32
+ :clearable="item | clearableF"
33
+ :multiple="item.multiple"
34
+ style="width: 100%"
35
+ v-bind="item.props"
36
+ v-on="item.on"
37
+ >
38
+ <template v-if="item.props && item.props.labelKey && item.props.valueKey">
39
+ <el-option
40
+ v-for="(c, i) in item.options"
41
+ :key="i"
42
+ :label="c[item.props.labelKey]"
43
+ :value="c[item.props.valueKey]"
44
+ :disabled="c.disabled"
45
+ />
46
+ </template>
47
+ <template v-else>
48
+ <el-option
49
+ v-for="c in item.options"
50
+ :key="c.value + '_' + c.label"
51
+ :label="c.label"
52
+ :value="c.value"
53
+ :disabled="c.disabled"
54
+ />
55
+ </template>
56
+ </el-select>
57
+ <inputNumber
58
+ v-else-if="item.type === 'number'"
59
+ v-model="form[item.value]"
60
+ style="width: 100%"
61
+ v-bind="item.props"
62
+ v-on="item.on"
63
+ />
64
+ <inputNumberRange
65
+ v-else-if="item.type === 'numberrange'"
66
+ :start-value.sync="form[item.startValue]"
67
+ :end-value.sync="form[item.endValue]"
68
+ style="width: 100%"
69
+ v-bind="item.props"
70
+ v-on="item.on"
71
+ />
72
+ <datePickerPor
73
+ v-else-if="item.type === 'date'"
74
+ v-model="form[item.value]"
75
+ type="date"
76
+ :clearable="item | clearableF"
77
+ style="width: 100%"
78
+ v-bind="item.props"
79
+ v-on="item.on"
80
+ />
81
+ <datePickerPor
82
+ v-else-if="item.type === 'daterange'"
83
+ type="daterange"
84
+ :start-date.sync="form[item.startDate]"
85
+ :end-date.sync="form[item.endDate]"
86
+ :clearable="item | clearableF"
87
+ style="width: 100%"
88
+ v-bind="item.props"
89
+ v-on="item.on"
90
+ />
91
+ <el-checkbox-group
92
+ v-else-if="item.type === 'checkbox'"
93
+ v-model="form[item.value]"
94
+ v-bind="item.props"
95
+ v-on="item.on"
96
+ >
97
+ <el-checkbox
98
+ v-for="c in item.options"
99
+ :key="c.value"
100
+ :label="c.value"
101
+ :disabled="c.disabled"
102
+ >{{ c.label }}</el-checkbox
103
+ >
104
+ </el-checkbox-group>
105
+ <el-radio-group
106
+ v-else-if="item.type === 'radio'"
107
+ v-model="form[item.value]"
108
+ v-bind="item.props"
109
+ v-on="item.on"
110
+ >
111
+ <el-radio
112
+ v-for="c in item.options"
113
+ :key="c.value"
114
+ :label="c.value"
115
+ :disabled="c.disabled"
116
+ >{{ c.label }}</el-radio
117
+ >
118
+ </el-radio-group>
119
+ </template>
120
+
121
+ <script>
122
+ import axios from '../../utils/axios'
123
+ import inputNumber from '../InputNumber/index.vue'
124
+ import inputNumberRange from '../InputNumber/numberRange.vue'
125
+ import datePickerPor from '../DatePicker/por.vue'
126
+ export default {
127
+ components: {
128
+ inputNumber,
129
+ inputNumberRange,
130
+ datePickerPor
131
+ },
132
+ filters: {
133
+ clearableF(item) {
134
+ if (item.props && item.props.clearable === false) {
135
+ return false
136
+ } else {
137
+ return true
138
+ }
139
+ }
140
+ },
141
+ props: {
142
+ form: {
143
+ type: Object,
144
+ default: undefined
145
+ },
146
+ item: {
147
+ type: Object,
148
+ default: undefined
149
+ }
150
+ },
151
+ created() {
152
+ if (this.item.reqOptions) {
153
+ this.getOptions()
154
+ }
155
+ },
156
+ methods: {
157
+ getOptions() {
158
+ let reqOptions = this.item.reqOptions
159
+ let url = reqOptions.url || ''
160
+ url = url.includes('?')
161
+ ? `${url}r=${Math.random()}`
162
+ : `${url}?r=${Math.random()}`
163
+
164
+ axios({
165
+ ...reqOptions,
166
+ url: url,
167
+ loading: false,
168
+ noMsg: true,
169
+ resList: undefined
170
+ }).then((res) => {
171
+ let resKeys = reqOptions.resList
172
+ ? reqOptions.resList.split('.')
173
+ : ['data', 'list']
174
+
175
+ let list = res
176
+ resKeys.forEach((key) => {
177
+ list = list[key]
178
+ })
179
+
180
+ this.$set(this.item, 'options', list)
181
+ })
182
+ }
183
+ }
184
+ }
185
+ </script>
186
+