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.
@@ -13665,18 +13665,20 @@ var mixins_form = __webpack_require__("e49c");
13665
13665
 
13666
13666
  this.enterMorph();
13667
13667
  },
13668
- beforeDestroy: function beforeDestroy() {
13669
- var that = this;
13670
-
13671
- var watcher = that._watchers.find(function (m) {
13672
- return m.expression == 'inputVal';
13673
- });
13674
-
13675
- if (watcher && watcher.cb) {
13676
- // 单行文本销毁时,触发一次change事件,更新计算公式
13677
- watcher.cb('0', that.inputVal, true);
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swordpass-ui",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "author": "sword",
5
5
  "private": false,
6
6
  "scripts": {
@@ -107,446 +107,451 @@
107
107
  </div>
108
108
  </template>
109
109
  <script>
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'
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
- 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',
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
- computed: {
221
- inputVal: {
222
- get() {
223
- // input为number时 输入框获取焦点时 自动清空输入框默认内容 简化用户操作
224
- if (this.isFocus && this.type === 'number' && this.value === 0) {
225
- return undefined
226
- }
227
- if (this.morphing && this.tempInputVal !== null) {
228
- return this.tempInputVal
229
- }
230
- if (utils.isEmpty(this.value)) {
231
- return ''
232
- }
233
- return this.value
234
- },
235
- set(val) {
236
- if (this.isFocus && this.type === 'number' && val === undefined) {
237
- this.$emit('input', 0)
238
- return
239
- }
240
- // 格式化显示时不更新到value属性上
241
- !this.morphing && this.$emit('input', val)
242
- },
243
- },
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
- },
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
- watch: {
259
- value: function() {
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.enterMorph()
228
+ return this.tempInputVal
229
+ }
230
+ if (utils.isEmpty(this.value)) {
231
+ return ''
262
232
  }
233
+ return this.value
263
234
  },
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()
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
- 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
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
- 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属性的元素中.'
294
- }
295
- if (index == args.index) {
296
- _me.$emit('input', args.result)
297
- }
298
- } else {
299
- _me.$emit('input', args.result)
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
- 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'))
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
- 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) {
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
- let cb = function(newVal, oldVal) {
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
- 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)
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
- beforeDestroy() {
375
- let that = this
376
- let watcher = that._watchers.find((m) => m.expression == 'inputVal')
377
- if (watcher && watcher.cb) {
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
- destroyed() {
383
- this.unwatchAry &&
384
- this.unwatchAry.forEach((unwatch) => {
385
- unwatch.call()
386
- })
406
+ handleChange(val) {
407
+ this.$emit('change', val)
387
408
  },
388
- methods: {
389
- handleBlur(event) {
390
- this.isFocus = false
391
- this.enterMorph()
392
- this.$emit('blur', event)
393
- },
394
- handleFocus(event) {
395
- this.isFocus = true
396
- this.exitMorph()
397
- this.$emit('focus', event)
398
- },
399
- handleChange(val) {
400
- this.$emit('change', val)
401
- },
402
- handleInput(val) {
403
- this.$emit('input', val)
404
- },
405
- handleClear() {
406
- this.$emit('clear')
407
- },
408
- // 进入格式显示模式
409
- enterMorph() {
410
- // 只在text类型时格式化
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 = result
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
- if (this.ctrlType === 'currency' || this.ctrlType === 'number') {
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
- else if (this.filterthousandBit) {
445
- this.morphing = true
446
- if (this.ctrlType === 'currency' || this.ctrlType === 'number') {
447
- this.exhibitText = utils.thousandBit(this.value)
448
- this.isNumber = false
449
- } else {
450
- this.tempInputVal = utils.thousandBit(this.value)
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
- exitMorph() {
456
- this.morphing = false
457
- this.tempInputVal = null
458
- },
459
- initIdentity(_me, pInst) {
460
- //检查流水号
461
- if (this.configAttributes) {
462
- this.isEdit = !this.configAttributes.isInputEdit
463
- //判断是否绑定流水号
464
- if (this.configAttributes.bindIdentityAlias) {
465
- this.isEdit = false
466
- if (this.value) return
467
- var alias = this.configAttributes.bindIdentityAlias
468
- this.$requestConfig.getNextIdByAlias(alias).then((res) => {
469
- if (res.state) {
470
- this.$emit('input', res.value)
471
- if (res.value) {
472
- var match = /(\{(.*)\}).*$/.exec(res.value)
473
- //判断流水号中是否表达式如{kjbt.csfjsc}
474
- if (match) {
475
- this.$emit('input', res.value.replace(match[1], ''))
476
- // data 数据所在的 VueComponent
477
- const runtimePInst = utils.getRuntimeTemplateOnlineForm(
478
- this
479
- )
480
- if (runtimePInst && match[2]) {
481
- runtimePInst.$watch(
482
- `data.${match[2]}`,
483
- (newVal, oldVal) => {
484
- if (newVal != oldVal) {
485
- if (this.modelName === `data.${match[2]}`) {
486
- this.$message.error(
487
- '流水号生成规则字段不能绑定流水号显示字段'
488
- )
489
- } else {
490
- this.$emit(
491
- 'input',
492
- res.value.replace(match[1], newVal)
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
- { immediate: true }
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
- _me.$watch('inputVal', function() {
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
- div[aria-invalid='true'] ::v-deep .el-input__inner,
534
- div[aria-invalid='true'] ::v-deep .el-input__inner:focus {
535
- border-color: #f56c6c;
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
- div[aria-invalid='true'] ::v-deep .el-textarea__inner,
539
- div[aria-invalid='true'] ::v-deep .el-textarea__inner:focus {
540
- border-color: #f56c6c;
541
- }
542
- .inputs {
543
- ::v-deep {
544
- .el-input-number {
545
- width: calc(100% - 30px);
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
- .exhibit {
550
- width: calc(100% - 30px);
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
- 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',
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
- 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
- }
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
- .cl-text {
56
- }
55
+ .cl-text {
56
+ }
57
57
  </style>