swordpass-ui 1.0.4 → 1.0.6
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/lib/sword-vue-ui.common.js +14 -12
- package/package.json +1 -1
- package/packages/Input/src/main.vue +408 -403
- package/packages/Text/src/main.vue +44 -44
|
@@ -13665,18 +13665,20 @@ var mixins_form = __webpack_require__("e49c");
|
|
|
13665
13665
|
|
|
13666
13666
|
this.enterMorph();
|
|
13667
13667
|
},
|
|
13668
|
-
beforeDestroy
|
|
13669
|
-
|
|
13670
|
-
|
|
13671
|
-
|
|
13672
|
-
|
|
13673
|
-
|
|
13674
|
-
|
|
13675
|
-
|
|
13676
|
-
|
|
13677
|
-
watcher.cb
|
|
13678
|
-
|
|
13679
|
-
|
|
13668
|
+
beforeDestroy() {
|
|
13669
|
+
// if (
|
|
13670
|
+
// this.type == 'number' &&
|
|
13671
|
+
// (this.filtercurrency || this.filterthousandBit || this.showCompanys)
|
|
13672
|
+
// ) {
|
|
13673
|
+
// window.removeEventListener('click', this.clickOther)
|
|
13674
|
+
// }
|
|
13675
|
+
let that = this;
|
|
13676
|
+
let watcher = that._watchers && that._watchers.find(m => m.expression == 'inputVal');
|
|
13677
|
+
if (watcher && watcher.cb) {
|
|
13678
|
+
// 单行文本销毁时,触发一次change事件,更新计算公式
|
|
13679
|
+
watcher.cb('0', that.inputVal, true);
|
|
13680
|
+
}
|
|
13681
|
+
},
|
|
13680
13682
|
destroyed: function destroyed() {
|
|
13681
13683
|
this.unwatchAry && this.unwatchAry.forEach(function (unwatch) {
|
|
13682
13684
|
unwatch.call();
|
package/package.json
CHANGED
|
@@ -107,446 +107,451 @@
|
|
|
107
107
|
</div>
|
|
108
108
|
</template>
|
|
109
109
|
<script>
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
110
|
+
import utils from '@/utils.js'
|
|
111
|
+
import FormMath from '@/math.js'
|
|
112
|
+
import ClFieldTail from '../../FieldTail/index'
|
|
113
|
+
import permission from '@/mixins/permission.js'
|
|
114
|
+
import inputName from '@/mixins/inputName.js'
|
|
115
|
+
import form from '@/mixins/form.js'
|
|
116
116
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
},
|
|
129
|
-
width: [String, Number],
|
|
130
|
-
clearable: {
|
|
131
|
-
type: Boolean,
|
|
132
|
-
default: true,
|
|
133
|
-
},
|
|
134
|
-
showPassword: {
|
|
135
|
-
type: Boolean,
|
|
136
|
-
default: false,
|
|
137
|
-
},
|
|
138
|
-
mathExp: String,
|
|
139
|
-
type: {
|
|
140
|
-
type: String,
|
|
141
|
-
default: 'text',
|
|
142
|
-
},
|
|
143
|
-
ctrlType: {
|
|
144
|
-
type: String,
|
|
145
|
-
default: '',
|
|
146
|
-
},
|
|
147
|
-
dateCalcExp: Object,
|
|
148
|
-
readonly: {
|
|
149
|
-
type: Boolean,
|
|
150
|
-
default: false,
|
|
151
|
-
},
|
|
152
|
-
disabled: {
|
|
153
|
-
type: Boolean,
|
|
154
|
-
default: false,
|
|
155
|
-
},
|
|
156
|
-
min: Number,
|
|
157
|
-
max: Number,
|
|
158
|
-
step: {
|
|
159
|
-
type: Number,
|
|
160
|
-
default: 1,
|
|
161
|
-
},
|
|
162
|
-
stepStrictly: {
|
|
163
|
-
type: Boolean,
|
|
164
|
-
default: false,
|
|
165
|
-
},
|
|
166
|
-
precision: Number,
|
|
167
|
-
cols: {
|
|
168
|
-
type: Number,
|
|
169
|
-
default: 60,
|
|
170
|
-
},
|
|
171
|
-
rows: {
|
|
172
|
-
type: Number,
|
|
173
|
-
default: 2,
|
|
174
|
-
},
|
|
175
|
-
autosize: {
|
|
176
|
-
type: [Boolean, Object],
|
|
177
|
-
default: false,
|
|
178
|
-
},
|
|
179
|
-
prefixIcon: String,
|
|
180
|
-
suffixIcon: String,
|
|
181
|
-
tabindex: String,
|
|
182
|
-
minlength: {
|
|
183
|
-
type: Number,
|
|
184
|
-
},
|
|
185
|
-
maxlength: {
|
|
186
|
-
type: Number,
|
|
187
|
-
},
|
|
188
|
-
showWordLimit: {
|
|
189
|
-
type: Boolean,
|
|
190
|
-
default: false,
|
|
191
|
-
},
|
|
192
|
-
format: {
|
|
193
|
-
type: Function,
|
|
194
|
-
},
|
|
195
|
-
formatWhenReadonly: {
|
|
196
|
-
type: Boolean,
|
|
197
|
-
default: true,
|
|
198
|
-
},
|
|
199
|
-
filterthousandBit: {
|
|
200
|
-
type: Boolean,
|
|
201
|
-
default: false,
|
|
202
|
-
},
|
|
203
|
-
filtercurrency: {
|
|
204
|
-
type: Boolean,
|
|
205
|
-
default: false,
|
|
206
|
-
},
|
|
207
|
-
configAttributes: Object,
|
|
208
|
-
company: String,
|
|
209
|
-
},
|
|
210
|
-
data() {
|
|
211
|
-
return {
|
|
212
|
-
unwatchAry: [],
|
|
213
|
-
morphing: false,
|
|
214
|
-
tempInputVal: null,
|
|
215
|
-
isFocus: false,
|
|
216
|
-
exhibitText: '',
|
|
217
|
-
isNumber: true,
|
|
218
|
-
}
|
|
117
|
+
export default {
|
|
118
|
+
name: 'ClInput',
|
|
119
|
+
components: {
|
|
120
|
+
ClFieldTail,
|
|
121
|
+
},
|
|
122
|
+
mixins: [permission, inputName, form],
|
|
123
|
+
props: {
|
|
124
|
+
value: [String, Number],
|
|
125
|
+
controlsPosition: {
|
|
126
|
+
type: String,
|
|
127
|
+
default: 'right',
|
|
219
128
|
},
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
},
|
|
129
|
+
width: [String, Number],
|
|
130
|
+
clearable: {
|
|
131
|
+
type: Boolean,
|
|
132
|
+
default: true,
|
|
133
|
+
},
|
|
134
|
+
showPassword: {
|
|
135
|
+
type: Boolean,
|
|
136
|
+
default: false,
|
|
137
|
+
},
|
|
138
|
+
mathExp: String,
|
|
139
|
+
type: {
|
|
140
|
+
type: String,
|
|
141
|
+
default: 'text',
|
|
142
|
+
},
|
|
143
|
+
ctrlType: {
|
|
144
|
+
type: String,
|
|
145
|
+
default: '',
|
|
146
|
+
},
|
|
147
|
+
dateCalcExp: Object,
|
|
148
|
+
readonly: {
|
|
149
|
+
type: Boolean,
|
|
150
|
+
default: false,
|
|
151
|
+
},
|
|
152
|
+
disabled: {
|
|
153
|
+
type: Boolean,
|
|
154
|
+
default: false,
|
|
155
|
+
},
|
|
156
|
+
min: Number,
|
|
157
|
+
max: Number,
|
|
158
|
+
step: {
|
|
159
|
+
type: Number,
|
|
160
|
+
default: 1,
|
|
161
|
+
},
|
|
162
|
+
stepStrictly: {
|
|
163
|
+
type: Boolean,
|
|
164
|
+
default: false,
|
|
257
165
|
},
|
|
258
|
-
|
|
259
|
-
|
|
166
|
+
precision: Number,
|
|
167
|
+
cols: {
|
|
168
|
+
type: Number,
|
|
169
|
+
default: 60,
|
|
170
|
+
},
|
|
171
|
+
rows: {
|
|
172
|
+
type: Number,
|
|
173
|
+
default: 2,
|
|
174
|
+
},
|
|
175
|
+
autosize: {
|
|
176
|
+
type: [Boolean, Object],
|
|
177
|
+
default: false,
|
|
178
|
+
},
|
|
179
|
+
prefixIcon: String,
|
|
180
|
+
suffixIcon: String,
|
|
181
|
+
tabindex: String,
|
|
182
|
+
minlength: {
|
|
183
|
+
type: Number,
|
|
184
|
+
},
|
|
185
|
+
maxlength: {
|
|
186
|
+
type: Number,
|
|
187
|
+
},
|
|
188
|
+
showWordLimit: {
|
|
189
|
+
type: Boolean,
|
|
190
|
+
default: false,
|
|
191
|
+
},
|
|
192
|
+
format: {
|
|
193
|
+
type: Function,
|
|
194
|
+
},
|
|
195
|
+
formatWhenReadonly: {
|
|
196
|
+
type: Boolean,
|
|
197
|
+
default: true,
|
|
198
|
+
},
|
|
199
|
+
filterthousandBit: {
|
|
200
|
+
type: Boolean,
|
|
201
|
+
default: false,
|
|
202
|
+
},
|
|
203
|
+
filtercurrency: {
|
|
204
|
+
type: Boolean,
|
|
205
|
+
default: false,
|
|
206
|
+
},
|
|
207
|
+
configAttributes: Object,
|
|
208
|
+
company: String,
|
|
209
|
+
},
|
|
210
|
+
data() {
|
|
211
|
+
return {
|
|
212
|
+
unwatchAry: [],
|
|
213
|
+
morphing: false,
|
|
214
|
+
tempInputVal: null,
|
|
215
|
+
isFocus: false,
|
|
216
|
+
exhibitText: '',
|
|
217
|
+
isNumber: true,
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
computed: {
|
|
221
|
+
inputVal: {
|
|
222
|
+
get() {
|
|
223
|
+
// input为number时 输入框获取焦点时 自动清空输入框默认内容 简化用户操作
|
|
224
|
+
if (this.isFocus && this.type === 'number' && this.value === 0) {
|
|
225
|
+
return undefined
|
|
226
|
+
}
|
|
260
227
|
if (this.morphing && this.tempInputVal !== null) {
|
|
261
|
-
this.
|
|
228
|
+
return this.tempInputVal
|
|
229
|
+
}
|
|
230
|
+
if (utils.isEmpty(this.value)) {
|
|
231
|
+
return ''
|
|
262
232
|
}
|
|
233
|
+
return this.value
|
|
263
234
|
},
|
|
264
|
-
|
|
265
|
-
if (
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
this.formatWhenReadonly ? this.enterMorph() : this.exitMorph()
|
|
269
|
-
} else {
|
|
270
|
-
this.enterMorph()
|
|
271
|
-
}
|
|
235
|
+
set(val) {
|
|
236
|
+
if (this.isFocus && this.type === 'number' && val === undefined) {
|
|
237
|
+
this.$emit('input', 0)
|
|
238
|
+
return
|
|
272
239
|
}
|
|
240
|
+
// 格式化显示时不更新到value属性上
|
|
241
|
+
!this.morphing && this.$emit('input', val)
|
|
273
242
|
},
|
|
274
243
|
},
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
244
|
+
colsVal: function () {
|
|
245
|
+
return this.type == 'textarea' ? this.cols : null
|
|
246
|
+
},
|
|
247
|
+
rowsVal: function () {
|
|
248
|
+
return this.type == 'textarea' ? this.rows : null
|
|
249
|
+
},
|
|
250
|
+
inputWidth: function () {
|
|
251
|
+
return this.width
|
|
252
|
+
? typeof this.width == 'string'
|
|
253
|
+
? { width: this.width }
|
|
254
|
+
: { width: `${this.width}px` }
|
|
255
|
+
: null
|
|
256
|
+
},
|
|
257
|
+
},
|
|
258
|
+
watch: {
|
|
259
|
+
value: function () {
|
|
260
|
+
if (this.morphing && this.tempInputVal !== null) {
|
|
261
|
+
this.enterMorph()
|
|
262
|
+
}
|
|
263
|
+
},
|
|
264
|
+
inputWriteable: function (newVal, oldVal) {
|
|
265
|
+
if (newVal != oldVal) {
|
|
266
|
+
if (!newVal) {
|
|
267
|
+
// 只读时是否保持格式化显示
|
|
268
|
+
this.formatWhenReadonly ? this.enterMorph() : this.exitMorph()
|
|
269
|
+
} else {
|
|
270
|
+
this.enterMorph()
|
|
287
271
|
}
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
},
|
|
275
|
+
mounted() {
|
|
276
|
+
const _me = this
|
|
277
|
+
const exp = this.mathExp
|
|
278
|
+
const formVm = utils.getOnlineFormInstance(_me)
|
|
279
|
+
//初始化流水号配置
|
|
280
|
+
this.initIdentity(_me, formVm)
|
|
281
|
+
|
|
282
|
+
// 数学运算表达式
|
|
283
|
+
if (exp) {
|
|
284
|
+
let elAttr = this.$vnode.data.model.expression
|
|
285
|
+
if (this.modelExpression) {
|
|
286
|
+
elAttr = this.modelExpression
|
|
287
|
+
}
|
|
288
|
+
const fields = FormMath.parseFuncexpField(exp)
|
|
289
|
+
formVm.$on(elAttr, function (args) {
|
|
290
|
+
if (args.hasOwnProperty('index')) {
|
|
291
|
+
const { subScopeEl, index } = utils.getSubScopeElAndIndex(_me.$el)
|
|
292
|
+
if (subScopeEl != null && index === null) {
|
|
293
|
+
throw '要计算子表行数据的输入框不在包含data-subname属性的元素中.'
|
|
300
294
|
}
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
if (formVm.watchMap.has(ele)) {
|
|
304
|
-
let ary = formVm.watchMap.get(ele)
|
|
305
|
-
ary.push({ target: elAttr, exp })
|
|
306
|
-
formVm.watchMap.set(ele, ary.unique('target'))
|
|
307
|
-
} else {
|
|
308
|
-
formVm.watchMap.set(ele, [{ target: elAttr, exp }])
|
|
295
|
+
if (index == args.index) {
|
|
296
|
+
_me.$emit('input', args.result)
|
|
309
297
|
}
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
// 日期计算表达式
|
|
313
|
-
if (this.dateCalcExp) {
|
|
314
|
-
// 计算日期间隔
|
|
315
|
-
let handleDateCalc = function(startVal, endVal) {
|
|
316
|
-
_me.$emit(
|
|
317
|
-
'input',
|
|
318
|
-
utils.dateCalc(startVal, endVal, _me.dateCalcExp.diffType)
|
|
319
|
-
)
|
|
298
|
+
} else {
|
|
299
|
+
_me.$emit('input', args.result)
|
|
320
300
|
}
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
if (
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
)
|
|
328
|
-
const endScope = utils.getSubInputScopeByModelExpression(
|
|
329
|
-
subScopeEl,
|
|
330
|
-
this.dateCalcExp.end
|
|
331
|
-
)
|
|
332
|
-
// 对于子表中某行的日期计算,需要找到日期控件对应的vm实例
|
|
333
|
-
startScope.$watch(
|
|
334
|
-
'inputVal',
|
|
335
|
-
function(newVal, oldVal) {
|
|
336
|
-
if (newVal !== oldVal) {
|
|
337
|
-
handleDateCalc(startScope.value, endScope.value)
|
|
338
|
-
}
|
|
339
|
-
},
|
|
340
|
-
{ immediate: false }
|
|
341
|
-
)
|
|
342
|
-
endScope.$watch(
|
|
343
|
-
'inputVal',
|
|
344
|
-
function(newVal, oldVal) {
|
|
345
|
-
if (newVal !== oldVal) {
|
|
346
|
-
handleDateCalc(startScope.value, endScope.value)
|
|
347
|
-
}
|
|
348
|
-
},
|
|
349
|
-
{ immediate: false }
|
|
350
|
-
)
|
|
301
|
+
})
|
|
302
|
+
fields.forEach((ele) => {
|
|
303
|
+
if (formVm.watchMap.has(ele)) {
|
|
304
|
+
let ary = formVm.watchMap.get(ele)
|
|
305
|
+
ary.push({ target: elAttr, exp })
|
|
306
|
+
formVm.watchMap.set(ele, ary.unique('target'))
|
|
351
307
|
} else {
|
|
352
|
-
|
|
308
|
+
formVm.watchMap.set(ele, [{ target: elAttr, exp }])
|
|
309
|
+
}
|
|
310
|
+
})
|
|
311
|
+
}
|
|
312
|
+
// 日期计算表达式
|
|
313
|
+
if (this.dateCalcExp) {
|
|
314
|
+
// 计算日期间隔
|
|
315
|
+
let handleDateCalc = function (startVal, endVal) {
|
|
316
|
+
_me.$emit(
|
|
317
|
+
'input',
|
|
318
|
+
utils.dateCalc(startVal, endVal, _me.dateCalcExp.diffType)
|
|
319
|
+
)
|
|
320
|
+
}
|
|
321
|
+
// 获取是否在子表中每一行进行日期计算
|
|
322
|
+
const { subScopeEl, index } = utils.getSubScopeElAndIndex(_me.$el)
|
|
323
|
+
if (subScopeEl) {
|
|
324
|
+
const startScope = utils.getSubInputScopeByModelExpression(
|
|
325
|
+
subScopeEl,
|
|
326
|
+
this.dateCalcExp.start
|
|
327
|
+
)
|
|
328
|
+
const endScope = utils.getSubInputScopeByModelExpression(
|
|
329
|
+
subScopeEl,
|
|
330
|
+
this.dateCalcExp.end
|
|
331
|
+
)
|
|
332
|
+
// 对于子表中某行的日期计算,需要找到日期控件对应的vm实例
|
|
333
|
+
startScope.$watch(
|
|
334
|
+
'inputVal',
|
|
335
|
+
function (newVal, oldVal) {
|
|
353
336
|
if (newVal !== oldVal) {
|
|
354
|
-
|
|
355
|
-
formVm,
|
|
356
|
-
_me.dateCalcExp.start,
|
|
357
|
-
index
|
|
358
|
-
)
|
|
359
|
-
let endVal = utils.getValueByPath(
|
|
360
|
-
formVm,
|
|
361
|
-
_me.dateCalcExp.end,
|
|
362
|
-
index
|
|
363
|
-
)
|
|
364
|
-
handleDateCalc(startVal, endVal)
|
|
337
|
+
handleDateCalc(startScope.value, endScope.value)
|
|
365
338
|
}
|
|
339
|
+
},
|
|
340
|
+
{ immediate: false }
|
|
341
|
+
)
|
|
342
|
+
endScope.$watch(
|
|
343
|
+
'inputVal',
|
|
344
|
+
function (newVal, oldVal) {
|
|
345
|
+
if (newVal !== oldVal) {
|
|
346
|
+
handleDateCalc(startScope.value, endScope.value)
|
|
347
|
+
}
|
|
348
|
+
},
|
|
349
|
+
{ immediate: false }
|
|
350
|
+
)
|
|
351
|
+
} else {
|
|
352
|
+
let cb = function (newVal, oldVal) {
|
|
353
|
+
if (newVal !== oldVal) {
|
|
354
|
+
let startVal = utils.getValueByPath(
|
|
355
|
+
formVm,
|
|
356
|
+
_me.dateCalcExp.start,
|
|
357
|
+
index
|
|
358
|
+
)
|
|
359
|
+
let endVal = utils.getValueByPath(
|
|
360
|
+
formVm,
|
|
361
|
+
_me.dateCalcExp.end,
|
|
362
|
+
index
|
|
363
|
+
)
|
|
364
|
+
handleDateCalc(startVal, endVal)
|
|
366
365
|
}
|
|
367
|
-
// 主表中的日期计算,在表单上通过v-model的表达式来监控值变更
|
|
368
|
-
formVm.$watch(this.dateCalcExp.start, cb, { immediate: true })
|
|
369
|
-
formVm.$watch(this.dateCalcExp.end, cb, { immediate: true })
|
|
370
366
|
}
|
|
367
|
+
// 主表中的日期计算,在表单上通过v-model的表达式来监控值变更
|
|
368
|
+
formVm.$watch(this.dateCalcExp.start, cb, { immediate: true })
|
|
369
|
+
formVm.$watch(this.dateCalcExp.end, cb, { immediate: true })
|
|
371
370
|
}
|
|
371
|
+
}
|
|
372
|
+
this.enterMorph()
|
|
373
|
+
},
|
|
374
|
+
beforeDestroy() {
|
|
375
|
+
// if (
|
|
376
|
+
// this.type == 'number' &&
|
|
377
|
+
// (this.filtercurrency || this.filterthousandBit || this.showCompanys)
|
|
378
|
+
// ) {
|
|
379
|
+
// window.removeEventListener('click', this.clickOther)
|
|
380
|
+
// }
|
|
381
|
+
let that = this
|
|
382
|
+
let watcher =
|
|
383
|
+
that._watchers && that._watchers.find((m) => m.expression == 'inputVal')
|
|
384
|
+
if (watcher && watcher.cb) {
|
|
385
|
+
// 单行文本销毁时,触发一次change事件,更新计算公式
|
|
386
|
+
watcher.cb('0', that.inputVal, true)
|
|
387
|
+
}
|
|
388
|
+
},
|
|
389
|
+
destroyed() {
|
|
390
|
+
this.unwatchAry &&
|
|
391
|
+
this.unwatchAry.forEach((unwatch) => {
|
|
392
|
+
unwatch.call()
|
|
393
|
+
})
|
|
394
|
+
},
|
|
395
|
+
methods: {
|
|
396
|
+
handleBlur(event) {
|
|
397
|
+
this.isFocus = false
|
|
372
398
|
this.enterMorph()
|
|
399
|
+
this.$emit('blur', event)
|
|
373
400
|
},
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
// 单行文本销毁时,触发一次change事件,更新计算公式
|
|
379
|
-
watcher.cb('0', that.inputVal, true)
|
|
380
|
-
}
|
|
401
|
+
handleFocus(event) {
|
|
402
|
+
this.isFocus = true
|
|
403
|
+
this.exitMorph()
|
|
404
|
+
this.$emit('focus', event)
|
|
381
405
|
},
|
|
382
|
-
|
|
383
|
-
this
|
|
384
|
-
this.unwatchAry.forEach((unwatch) => {
|
|
385
|
-
unwatch.call()
|
|
386
|
-
})
|
|
406
|
+
handleChange(val) {
|
|
407
|
+
this.$emit('change', val)
|
|
387
408
|
},
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
this
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
// 货币和数字时也格式化
|
|
412
|
-
if (
|
|
413
|
-
this.morphing ||
|
|
414
|
-
(this.type != 'text' &&
|
|
415
|
-
this.ctrlType !== 'currency' &&
|
|
416
|
-
this.ctrlType !== 'number')
|
|
417
|
-
) {
|
|
418
|
-
return
|
|
419
|
-
}
|
|
420
|
-
// 优先处理设定了format方法的情况
|
|
421
|
-
if (this.format) {
|
|
422
|
-
const result = this.format(this.value)
|
|
423
|
-
if (result && result.constructor == Promise) {
|
|
424
|
-
result.then((resp) => {
|
|
425
|
-
this.morphing = true
|
|
426
|
-
this.tempInputVal = resp
|
|
427
|
-
})
|
|
428
|
-
} else if (result != null && result != undefined) {
|
|
409
|
+
handleInput(val) {
|
|
410
|
+
this.$emit('input', val)
|
|
411
|
+
},
|
|
412
|
+
handleClear() {
|
|
413
|
+
this.$emit('clear')
|
|
414
|
+
},
|
|
415
|
+
// 进入格式显示模式
|
|
416
|
+
enterMorph() {
|
|
417
|
+
// 只在text类型时格式化
|
|
418
|
+
// 货币和数字时也格式化
|
|
419
|
+
if (
|
|
420
|
+
this.morphing ||
|
|
421
|
+
(this.type != 'text' &&
|
|
422
|
+
this.ctrlType !== 'currency' &&
|
|
423
|
+
this.ctrlType !== 'number')
|
|
424
|
+
) {
|
|
425
|
+
return
|
|
426
|
+
}
|
|
427
|
+
// 优先处理设定了format方法的情况
|
|
428
|
+
if (this.format) {
|
|
429
|
+
const result = this.format(this.value)
|
|
430
|
+
if (result && result.constructor == Promise) {
|
|
431
|
+
result.then((resp) => {
|
|
429
432
|
this.morphing = true
|
|
430
|
-
this.tempInputVal =
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
// 其次人民币大写
|
|
434
|
-
else if (this.filtercurrency) {
|
|
433
|
+
this.tempInputVal = resp
|
|
434
|
+
})
|
|
435
|
+
} else if (result != null && result != undefined) {
|
|
435
436
|
this.morphing = true
|
|
436
|
-
|
|
437
|
-
this.exhibitText = FormMath.convertCurrency(this.value)
|
|
438
|
-
this.isNumber = false
|
|
439
|
-
} else {
|
|
440
|
-
this.tempInputVal = FormMath.convertCurrency(this.value)
|
|
441
|
-
}
|
|
437
|
+
this.tempInputVal = result
|
|
442
438
|
}
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
439
|
+
}
|
|
440
|
+
// 其次人民币大写
|
|
441
|
+
else if (this.filtercurrency) {
|
|
442
|
+
this.morphing = true
|
|
443
|
+
if (this.ctrlType === 'currency' || this.ctrlType === 'number') {
|
|
444
|
+
this.exhibitText = FormMath.convertCurrency(this.value)
|
|
445
|
+
this.isNumber = false
|
|
446
|
+
} else {
|
|
447
|
+
this.tempInputVal = FormMath.convertCurrency(this.value)
|
|
452
448
|
}
|
|
453
|
-
}
|
|
454
|
-
//
|
|
455
|
-
|
|
456
|
-
this.morphing =
|
|
457
|
-
this.
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
449
|
+
}
|
|
450
|
+
// 最后千分位
|
|
451
|
+
else if (this.filterthousandBit) {
|
|
452
|
+
this.morphing = true
|
|
453
|
+
if (this.ctrlType === 'currency' || this.ctrlType === 'number') {
|
|
454
|
+
this.exhibitText = utils.thousandBit(this.value)
|
|
455
|
+
this.isNumber = false
|
|
456
|
+
} else {
|
|
457
|
+
this.tempInputVal = utils.thousandBit(this.value)
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
},
|
|
461
|
+
// 退出格式化显示模式
|
|
462
|
+
exitMorph() {
|
|
463
|
+
this.morphing = false
|
|
464
|
+
this.tempInputVal = null
|
|
465
|
+
},
|
|
466
|
+
initIdentity(_me, pInst) {
|
|
467
|
+
//检查流水号
|
|
468
|
+
if (this.configAttributes) {
|
|
469
|
+
this.isEdit = !this.configAttributes.isInputEdit
|
|
470
|
+
//判断是否绑定流水号
|
|
471
|
+
if (this.configAttributes.bindIdentityAlias) {
|
|
472
|
+
this.isEdit = false
|
|
473
|
+
if (this.value) return
|
|
474
|
+
var alias = this.configAttributes.bindIdentityAlias
|
|
475
|
+
this.$requestConfig.getNextIdByAlias(alias).then((res) => {
|
|
476
|
+
if (res.state) {
|
|
477
|
+
this.$emit('input', res.value)
|
|
478
|
+
if (res.value) {
|
|
479
|
+
var match = /(\{(.*)\}).*$/.exec(res.value)
|
|
480
|
+
//判断流水号中是否表达式如{kjbt.csfjsc}
|
|
481
|
+
if (match) {
|
|
482
|
+
this.$emit('input', res.value.replace(match[1], ''))
|
|
483
|
+
// data 数据所在的 VueComponent
|
|
484
|
+
const runtimePInst = utils.getRuntimeTemplateOnlineForm(this)
|
|
485
|
+
if (runtimePInst && match[2]) {
|
|
486
|
+
runtimePInst.$watch(
|
|
487
|
+
`data.${match[2]}`,
|
|
488
|
+
(newVal, oldVal) => {
|
|
489
|
+
if (newVal != oldVal) {
|
|
490
|
+
if (this.modelName === `data.${match[2]}`) {
|
|
491
|
+
this.$message.error(
|
|
492
|
+
'流水号生成规则字段不能绑定流水号显示字段'
|
|
493
|
+
)
|
|
494
|
+
} else {
|
|
495
|
+
this.$emit(
|
|
496
|
+
'input',
|
|
497
|
+
res.value.replace(match[1], newVal)
|
|
498
|
+
)
|
|
495
499
|
}
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
+
}
|
|
501
|
+
},
|
|
502
|
+
{ immediate: true }
|
|
503
|
+
)
|
|
500
504
|
}
|
|
501
505
|
}
|
|
502
|
-
} else {
|
|
503
|
-
this.$message.error(res.message)
|
|
504
506
|
}
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
pInst.$watch(
|
|
509
|
-
'identityMap',
|
|
510
|
-
function(newVal, oldVal) {
|
|
511
|
-
if (newVal && newVal !== oldVal) {
|
|
512
|
-
for (const key in newVal) {
|
|
513
|
-
if (_me.modelName == key) {
|
|
514
|
-
let item = newVal[key]
|
|
515
|
-
utils.setValueByPath(
|
|
516
|
-
pInst,
|
|
517
|
-
item.key,
|
|
518
|
-
item.value.replace(item.expression, _me.value)
|
|
519
|
-
)
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
},
|
|
524
|
-
{ immediate: true }
|
|
525
|
-
)
|
|
507
|
+
} else {
|
|
508
|
+
this.$message.error(res.message)
|
|
509
|
+
}
|
|
526
510
|
})
|
|
527
511
|
}
|
|
528
|
-
|
|
512
|
+
_me.$watch('inputVal', function () {
|
|
513
|
+
pInst.$watch(
|
|
514
|
+
'identityMap',
|
|
515
|
+
function (newVal, oldVal) {
|
|
516
|
+
if (newVal && newVal !== oldVal) {
|
|
517
|
+
for (const key in newVal) {
|
|
518
|
+
if (_me.modelName == key) {
|
|
519
|
+
let item = newVal[key]
|
|
520
|
+
utils.setValueByPath(
|
|
521
|
+
pInst,
|
|
522
|
+
item.key,
|
|
523
|
+
item.value.replace(item.expression, _me.value)
|
|
524
|
+
)
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
},
|
|
529
|
+
{ immediate: true }
|
|
530
|
+
)
|
|
531
|
+
})
|
|
532
|
+
}
|
|
529
533
|
},
|
|
530
|
-
}
|
|
534
|
+
},
|
|
535
|
+
}
|
|
531
536
|
</script>
|
|
532
537
|
<style lang="scss" scoped>
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
538
|
+
div[aria-invalid='true'] ::v-deep .el-input__inner,
|
|
539
|
+
div[aria-invalid='true'] ::v-deep .el-input__inner:focus {
|
|
540
|
+
border-color: #f56c6c;
|
|
541
|
+
}
|
|
537
542
|
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
}
|
|
543
|
+
div[aria-invalid='true'] ::v-deep .el-textarea__inner,
|
|
544
|
+
div[aria-invalid='true'] ::v-deep .el-textarea__inner:focus {
|
|
545
|
+
border-color: #f56c6c;
|
|
546
|
+
}
|
|
547
|
+
.inputs {
|
|
548
|
+
::v-deep {
|
|
549
|
+
.el-input-number {
|
|
550
|
+
width: calc(100% - 30px);
|
|
547
551
|
}
|
|
548
552
|
}
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
553
|
+
}
|
|
554
|
+
.exhibit {
|
|
555
|
+
width: calc(100% - 30px);
|
|
556
|
+
}
|
|
552
557
|
</style>
|
|
@@ -5,53 +5,53 @@
|
|
|
5
5
|
</div>
|
|
6
6
|
</template>
|
|
7
7
|
<script>
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
},
|
|
18
|
-
fontSize: {
|
|
19
|
-
type: String,
|
|
20
|
-
default: '12px',
|
|
21
|
-
},
|
|
22
|
-
fontWeight: {
|
|
23
|
-
type: String,
|
|
24
|
-
default: '400',
|
|
25
|
-
},
|
|
26
|
-
paddingTop: String,
|
|
27
|
-
paddingBottom: String,
|
|
28
|
-
paddingLeft: String,
|
|
29
|
-
paddingRight: String,
|
|
30
|
-
textAlign: {
|
|
31
|
-
type: String,
|
|
32
|
-
default: 'center',
|
|
33
|
-
validator: (val) => {
|
|
34
|
-
return ['left', 'center', 'right'].indexOf(val) > -1
|
|
35
|
-
},
|
|
36
|
-
},
|
|
8
|
+
import permission from '@/mixins/permission.js'
|
|
9
|
+
export default {
|
|
10
|
+
name: 'ClText',
|
|
11
|
+
mixins: [permission],
|
|
12
|
+
props: {
|
|
13
|
+
textValue: String,
|
|
14
|
+
color: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: '#666',
|
|
37
17
|
},
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
18
|
+
fontSize: {
|
|
19
|
+
type: String,
|
|
20
|
+
default: '12px',
|
|
21
|
+
},
|
|
22
|
+
fontWeight: {
|
|
23
|
+
type: String,
|
|
24
|
+
default: '400',
|
|
25
|
+
},
|
|
26
|
+
paddingTop: String,
|
|
27
|
+
paddingBottom: String,
|
|
28
|
+
paddingLeft: String,
|
|
29
|
+
paddingRight: String,
|
|
30
|
+
textAlign: {
|
|
31
|
+
type: String,
|
|
32
|
+
default: 'center',
|
|
33
|
+
validator: (val) => {
|
|
34
|
+
return ['left', 'center', 'right'].indexOf(val) > -1
|
|
50
35
|
},
|
|
51
36
|
},
|
|
52
|
-
}
|
|
37
|
+
},
|
|
38
|
+
computed: {
|
|
39
|
+
textStyle() {
|
|
40
|
+
return {
|
|
41
|
+
color: this.color,
|
|
42
|
+
fontSize: this.fontSize,
|
|
43
|
+
textAlign: this.textAlign,
|
|
44
|
+
fontWeight: this.fontWeight,
|
|
45
|
+
paddingTop: this.paddingTop,
|
|
46
|
+
paddingBottom: this.paddingBottom,
|
|
47
|
+
paddingLeft: this.paddingLeft,
|
|
48
|
+
paddingRight: this.paddingRight,
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
}
|
|
53
53
|
</script>
|
|
54
54
|
<style lang="scss" scoped>
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
.cl-text {
|
|
56
|
+
}
|
|
57
57
|
</style>
|