xt-element-ui 2.0.1 → 2.0.2

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/index.umd.js CHANGED
@@ -129136,16 +129136,16 @@ xt_button.install = function (Vue) {
129136
129136
 
129137
129137
  /* harmony default export */ var components_xt_button = (xt_button);
129138
129138
 
129139
- // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"267e1ec1-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--5!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/xt-input/index.vue?vue&type=template&id=69bd5491
129140
- var xt_inputvue_type_template_id_69bd5491_render = function render(){var _vm=this,_c=_vm._self._c;return _c('div',{staticClass:"xt-input",class:[
129139
+ // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"267e1ec1-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--5!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/xt-input/index.vue?vue&type=template&id=6c337ae4
129140
+ var xt_inputvue_type_template_id_6c337ae4_render = function render(){var _vm=this,_c=_vm._self._c;return _c('div',{staticClass:"xt-input",class:[
129141
129141
  _vm.size ? 'xt-input--' + _vm.size : '',
129142
129142
  { 'is-disabled': _vm.disabled }
129143
- ]},[_c('el-input',{style:(_vm.inputStyle),attrs:{"value":_vm.value,"placeholder":_vm.placeholder,"type":_vm.type,"size":_vm.size,"disabled":_vm.disabled,"readonly":_vm.readonly},on:{"input":function($event){return _vm.$emit('input', $event)},"change":function($event){return _vm.$emit('change', $event)},"focus":function($event){return _vm.$emit('focus', $event)},"blur":function($event){return _vm.$emit('blur', $event)}}})],1)
129143
+ ]},[_c('el-input',{style:(_vm.inputStyle),attrs:{"value":_vm.displayValue,"placeholder":_vm.placeholder,"type":_vm.isNumberType ? 'text' : _vm.type,"size":_vm.size,"disabled":_vm.disabled,"readonly":_vm.readonly},on:{"input":_vm.handleInput,"change":_vm.handleChange,"focus":_vm.handleFocus,"blur":_vm.handleBlur}})],1)
129144
129144
  }
129145
- var xt_inputvue_type_template_id_69bd5491_staticRenderFns = []
129145
+ var xt_inputvue_type_template_id_6c337ae4_staticRenderFns = []
129146
129146
 
129147
129147
 
129148
- // CONCATENATED MODULE: ./src/components/xt-input/index.vue?vue&type=template&id=69bd5491
129148
+ // CONCATENATED MODULE: ./src/components/xt-input/index.vue?vue&type=template&id=6c337ae4
129149
129149
 
129150
129150
  // CONCATENATED MODULE: ./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/xt-input/index.vue?vue&type=script&lang=js
129151
129151
 
@@ -129178,7 +129178,22 @@ var xt_inputvue_type_template_id_69bd5491_staticRenderFns = []
129178
129178
  default: ''
129179
129179
  }
129180
129180
  },
129181
+ data() {
129182
+ return {
129183
+ currentStr: '',
129184
+ isFocused: false
129185
+ }
129186
+ },
129181
129187
  computed: {
129188
+ isNumberType() {
129189
+ return this.type === 'number'
129190
+ },
129191
+ displayValue() {
129192
+ if (this.isNumberType) {
129193
+ return this.currentStr
129194
+ }
129195
+ return this.value
129196
+ },
129182
129197
  inputStyle() {
129183
129198
  if (this.color) {
129184
129199
  return {
@@ -129187,6 +129202,71 @@ var xt_inputvue_type_template_id_69bd5491_staticRenderFns = []
129187
129202
  }
129188
129203
  return {}
129189
129204
  }
129205
+ },
129206
+ watch: {
129207
+ value: {
129208
+ immediate: true,
129209
+ handler(val) {
129210
+ if (this.isNumberType && !this.isFocused) {
129211
+ this.currentStr = val === null || val === undefined || val === '' ? '' : String(val)
129212
+ }
129213
+ }
129214
+ }
129215
+ },
129216
+ methods: {
129217
+ isValidNumber(str) {
129218
+ return /^[+-]?\d*\.?\d*$/.test(str)
129219
+ },
129220
+ handleInput(val) {
129221
+ if (this.isNumberType) {
129222
+ if (this.isValidNumber(val)) {
129223
+ this.currentStr = val
129224
+ const num = this.parseToNumber(val)
129225
+ if (num !== undefined) {
129226
+ this.$emit('input', num)
129227
+ }
129228
+ }
129229
+ } else {
129230
+ this.$emit('input', val)
129231
+ }
129232
+ },
129233
+ handleChange(val) {
129234
+ if (this.isNumberType) {
129235
+ const num = this.parseToNumber(val)
129236
+ this.$emit('change', num)
129237
+ } else {
129238
+ this.$emit('change', val)
129239
+ }
129240
+ },
129241
+ handleFocus(e) {
129242
+ this.isFocused = true
129243
+ this.$emit('focus', e)
129244
+ },
129245
+ handleBlur(e) {
129246
+ this.isFocused = false
129247
+ if (this.isNumberType) {
129248
+ const num = this.parseToNumber(this.currentStr)
129249
+ this.$emit('blur', num, e)
129250
+ if (num !== undefined) {
129251
+ this.currentStr = String(num)
129252
+ this.$emit('input', num)
129253
+ } else {
129254
+ if (this.currentStr !== '') {
129255
+ this.currentStr = ''
129256
+ this.$emit('input', undefined)
129257
+ }
129258
+ }
129259
+ } else {
129260
+ this.$emit('blur', e)
129261
+ }
129262
+ },
129263
+ parseToNumber(str) {
129264
+ if (!str || str === '+' || str === '-' || str === '.' || str === '+.' || str === '-.' || str === '-.') {
129265
+ return undefined
129266
+ }
129267
+ const num = parseFloat(str)
129268
+ return isNaN(num) ? undefined : num
129269
+ }
129190
129270
  }
129191
129271
  });
129192
129272
 
@@ -129202,8 +129282,8 @@ var xt_inputvue_type_template_id_69bd5491_staticRenderFns = []
129202
129282
 
129203
129283
  var xt_input_component = normalizeComponent(
129204
129284
  components_xt_inputvue_type_script_lang_js,
129205
- xt_inputvue_type_template_id_69bd5491_render,
129206
- xt_inputvue_type_template_id_69bd5491_staticRenderFns,
129285
+ xt_inputvue_type_template_id_6c337ae4_render,
129286
+ xt_inputvue_type_template_id_6c337ae4_staticRenderFns,
129207
129287
  false,
129208
129288
  null,
129209
129289
  null,
@@ -130456,21 +130536,21 @@ xt_time.install = function (Vue) {
130456
130536
  /* harmony default export */ var components_xt_time = (xt_time);
130457
130537
 
130458
130538
 
130459
- // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"267e1ec1-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--5!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/xt-step-price/index.vue?vue&type=template&id=f2b8f37c
130460
- var xt_step_pricevue_type_template_id_f2b8f37c_render = function render(){var _vm=this,_c=_vm._self._c;return _c('div',{staticClass:"xt-step-price",class:{ 'is-disabled': _vm.disabled }},[(_vm.title || _vm.$slots.header)?_c('div',{staticClass:"xt-step-price__header"},[(_vm.title)?_c('xt-text',{attrs:{"bold":"","size":"medium"}},[_vm._v(_vm._s(_vm.title))]):_vm._e(),_vm._t("header"),(!_vm.disabled && !_vm.isLimitReached)?_c('xt-button',{attrs:{"type":"primary","size":"small","icon":"el-icon-plus","plain":""},on:{"click":_vm.onAdd}},[_vm._v("新增档位")]):_vm._e(),(_vm.isLimitReached)?_c('xt-text',{attrs:{"size":"small","type-color":"info"}},[_vm._v("已达上限("+_vm._s(_vm.localItems.length)+"/"+_vm._s(_vm.limit)+")")]):_vm._e()],2):_vm._e(),_c('div',{staticClass:"xt-step-price__list"},_vm._l((_vm.localItems),function(item,idx){return _c('XtStepPriceItem',{key:idx,attrs:{"value":item,"index":idx,"is-first":idx === 0,"is-last":idx === _vm.localItems.length - 1,"items-length":_vm.localItems.length,"removable":idx !== 0,"min-locked":idx !== 0 ? true : false,"unit":_vm.unit,"precision":_vm.precision,"step":_vm.step,"left-bracket":_vm.leftBracket,"right-bracket":_vm.rightBracket,"field-keys":_vm.fieldKeys,"disabled":_vm.disabled},on:{"input":(val) => _vm.onItemInput(val, idx),"max-change":_vm.onMaxChange,"min-change":_vm.onMinChange,"delete":_vm.onDelete}})}),1),(_vm.localItems.length === 0)?_c('div',{staticClass:"xt-step-price__empty"},[_c('span',[_vm._v("暂无数据,点击右上角「新增档位」开始配置")])]):_vm._e(),(_vm.tip || _vm.$slots.tip)?_c('div',{staticClass:"xt-step-price__tip"},[_vm._t("tip",function(){return [_c('xt-text',{attrs:{"size":"small","type-color":"warning"}},[_vm._v(_vm._s(_vm.tip))])]})],2):_vm._e()])
130539
+ // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"267e1ec1-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--5!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/xt-step-price/index.vue?vue&type=template&id=10c6e331
130540
+ var xt_step_pricevue_type_template_id_10c6e331_render = function render(){var _vm=this,_c=_vm._self._c;return _c('div',{staticClass:"xt-step-price",class:{ 'is-disabled': _vm.disabled }},[(_vm.title || _vm.$slots.header)?_c('div',{staticClass:"xt-step-price__header"},[(_vm.title)?_c('xt-text',{attrs:{"bold":"","size":"medium"}},[_vm._v(_vm._s(_vm.title))]):_vm._e(),_vm._t("header"),(!_vm.disabled && !_vm.isLimitReached)?_c('xt-button',{attrs:{"type":"primary","size":"small","icon":"el-icon-plus","plain":""},on:{"click":_vm.onAdd}},[_vm._v("新增"+_vm._s(_vm.stepName))]):_vm._e(),(_vm.isLimitReached)?_c('xt-text',{attrs:{"size":"small","type-color":"info"}},[_vm._v("已达上限("+_vm._s(_vm.localItems.length)+"/"+_vm._s(_vm.limit)+")")]):_vm._e()],2):_vm._e(),_c('div',{staticClass:"xt-step-price__list"},_vm._l((_vm.localItems),function(item,idx){return _c('XtStepPriceItem',{key:idx,attrs:{"value":item,"index":idx,"is-first":idx === 0,"is-last":idx === _vm.localItems.length - 1,"items-length":_vm.localItems.length,"removable":idx !== 0,"min-locked":idx !== 0 ? true : false,"unit":_vm.unit,"precision":_vm.precision,"step-name":_vm.stepName,"step":_vm.step,"left-bracket":_vm.leftBracket,"right-bracket":_vm.rightBracket,"field-keys":_vm.fieldKeys,"disabled":_vm.disabled},on:{"input":(val) => _vm.onItemInput(val, idx),"max-change":_vm.onMaxChange,"min-change":_vm.onMinChange,"delete":_vm.onDelete,"blur":_vm.onFieldBlur}})}),1),(_vm.localItems.length === 0)?_c('div',{staticClass:"xt-step-price__empty"},[_c('span',[_vm._v("暂无数据,点击右上角「新增"+_vm._s(_vm.stepName)+"」开始配置")])]):_vm._e(),(_vm.tip || _vm.$slots.tip)?_c('div',{staticClass:"xt-step-price__tip"},[_vm._t("tip",function(){return [_c('xt-text',{attrs:{"size":"small","type-color":"warning"}},[_vm._v(_vm._s(_vm.tip))])]})],2):_vm._e()])
130461
130541
  }
130462
- var xt_step_pricevue_type_template_id_f2b8f37c_staticRenderFns = []
130542
+ var xt_step_pricevue_type_template_id_10c6e331_staticRenderFns = []
130463
130543
 
130464
130544
 
130465
- // CONCATENATED MODULE: ./src/components/xt-step-price/index.vue?vue&type=template&id=f2b8f37c
130545
+ // CONCATENATED MODULE: ./src/components/xt-step-price/index.vue?vue&type=template&id=10c6e331
130466
130546
 
130467
- // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"267e1ec1-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--5!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/xt-step-price-item/index.vue?vue&type=template&id=8baafa30
130468
- var xt_step_price_itemvue_type_template_id_8baafa30_render = function render(){var _vm=this,_c=_vm._self._c;return _c('div',{staticClass:"xt-step-price-item"},[_c('div',{staticClass:"xt-step-price-item__range"},[_c('span',{staticClass:"xt-step-price-item__bracket"},[_vm._v(_vm._s(_vm.finalLeftBracket))]),(_vm.itemsLength > 1)?_c('span',{staticClass:"xt-step-price-item__name"},[_vm._v("第"+_vm._s(_vm.index + 1)+"档")]):_vm._e(),_c('span',{staticClass:"xt-step-price-item__bracket"},[_vm._v(_vm._s(_vm.finalRightBracket))]),_c('xt-input',{staticClass:"xt-step-price-item__input",attrs:{"disabled":_vm.disabled || _vm.minLocked,"size":"small","placeholder":"下限"},on:{"blur":_vm.onMinBlur},model:{value:(_vm.minInput),callback:function ($$v) {_vm.minInput=_vm._n($$v)},expression:"minInput"}}),_c('span',{staticClass:"xt-step-price-item__comma"},[_vm._v("-")]),(!_vm.isLast)?_c('xt-input',{staticClass:"xt-step-price-item__input",attrs:{"disabled":_vm.disabled,"size":"small","placeholder":"上限"},on:{"blur":_vm.onMaxBlur},model:{value:(_vm.maxInput),callback:function ($$v) {_vm.maxInput=_vm._n($$v)},expression:"maxInput"}}):_c('span',{staticClass:"xt-step-price-item__infinity"},[_vm._v("+∞")])],1),_c('div',{staticClass:"xt-step-price-item__price"},[_c('xt-input',{staticClass:"xt-step-price-item__input xt-step-price-item__input--price",attrs:{"disabled":_vm.disabled,"size":"small","placeholder":"价格"},on:{"blur":_vm.onPriceBlur},model:{value:(_vm.priceInput),callback:function ($$v) {_vm.priceInput=_vm._n($$v)},expression:"priceInput"}}),_c('span',{staticClass:"xt-step-price-item__unit"},[_vm._v(_vm._s(_vm.unit))])],1),(!_vm.disabled && _vm.removable && _vm.itemsLength > 1)?_c('xt-button',{staticClass:"xt-step-price-item__delete",attrs:{"text":"","icon":"el-icon-delete"},on:{"click":_vm.onDelete}}):_vm._e()],1)
130547
+ // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"267e1ec1-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--5!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/xt-step-price-item/index.vue?vue&type=template&id=579d80c1
130548
+ var xt_step_price_itemvue_type_template_id_579d80c1_render = function render(){var _vm=this,_c=_vm._self._c;return _c('div',{staticClass:"xt-step-price-item"},[_c('div',{staticClass:"xt-step-price-item__range"},[_c('span',{staticClass:"xt-step-price-item__bracket"},[_vm._v(_vm._s(_vm.finalLeftBracket))]),(_vm.itemsLength > 1)?_c('span',{staticClass:"xt-step-price-item__name"},[_vm._v("第"+_vm._s(_vm.index + 1)+_vm._s(_vm.stepName))]):_vm._e(),_c('span',{staticClass:"xt-step-price-item__bracket"},[_vm._v(_vm._s(_vm.finalRightBracket))]),_c('xt-input',{staticClass:"xt-step-price-item__input",attrs:{"disabled":_vm.disabled || _vm.minLocked,"size":"small","placeholder":"下限"},on:{"blur":(e) => { _vm.onMinBlur(); _vm.onBlur(e) }},model:{value:(_vm.minInput),callback:function ($$v) {_vm.minInput=_vm._n($$v)},expression:"minInput"}}),_c('span',{staticClass:"xt-step-price-item__comma"},[_vm._v("-")]),(!_vm.isLast)?_c('xt-input',{staticClass:"xt-step-price-item__input",attrs:{"type":"number","disabled":_vm.disabled,"size":"small","placeholder":"上限"},on:{"blur":(e) => { _vm.onMaxBlur(); _vm.onBlur(e) }},model:{value:(_vm.maxInput),callback:function ($$v) {_vm.maxInput=_vm._n($$v)},expression:"maxInput"}}):_c('span',{staticClass:"xt-step-price-item__infinity"},[_vm._v("+∞")])],1),_c('div',{staticClass:"xt-step-price-item__price"},[_c('xt-input',{staticClass:"xt-step-price-item__input xt-step-price-item__input--price",attrs:{"type":"number","disabled":_vm.disabled,"size":"small","placeholder":"价格"},on:{"blur":(e) => { _vm.onPriceBlur(); _vm.onBlur(e) }},model:{value:(_vm.priceInput),callback:function ($$v) {_vm.priceInput=_vm._n($$v)},expression:"priceInput"}}),_c('span',{staticClass:"xt-step-price-item__unit"},[_vm._v(_vm._s(_vm.unit))])],1),(!_vm.disabled && _vm.removable && _vm.itemsLength > 1)?_c('xt-button',{staticClass:"xt-step-price-item__delete",attrs:{"text":"","icon":"el-icon-delete"},on:{"click":_vm.onDelete}}):_vm._e()],1)
130469
130549
  }
130470
- var xt_step_price_itemvue_type_template_id_8baafa30_staticRenderFns = []
130550
+ var xt_step_price_itemvue_type_template_id_579d80c1_staticRenderFns = []
130471
130551
 
130472
130552
 
130473
- // CONCATENATED MODULE: ./src/components/xt-step-price-item/index.vue?vue&type=template&id=8baafa30
130553
+ // CONCATENATED MODULE: ./src/components/xt-step-price-item/index.vue?vue&type=template&id=579d80c1
130474
130554
 
130475
130555
  // CONCATENATED MODULE: ./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/xt-step-price-item/index.vue?vue&type=script&lang=js
130476
130556
 
@@ -130483,6 +130563,7 @@ var xt_step_price_itemvue_type_template_id_8baafa30_staticRenderFns = []
130483
130563
  required: true,
130484
130564
  default: () => ({ min: 0, max: null, price: 0 })
130485
130565
  },
130566
+ stepName: { type: String, default: '阶梯' },
130486
130567
  index: { type: Number, default: 0 },
130487
130568
  isFirst: { type: Boolean, default: false },
130488
130569
  isLast: { type: Boolean, default: false },
@@ -130602,13 +130683,23 @@ var xt_step_price_itemvue_type_template_id_8baafa30_staticRenderFns = []
130602
130683
  },
130603
130684
 
130604
130685
  onPriceBlur() {
130605
- let v = this.safeNumber(this.priceInput, 0)
130686
+ const rawVal = this.priceInput
130687
+ if (rawVal === null || rawVal === undefined || rawVal === '' || isNaN(rawVal)) {
130688
+ this.priceInput = ''
130689
+ this.emitChange({ [this.keyPrice]: '' })
130690
+ return
130691
+ }
130692
+ let v = this.safeNumber(rawVal, 0)
130606
130693
  if (v < 0) v = 0
130607
130694
  v = Number(v.toFixed(this.precision))
130608
130695
  this.priceInput = v
130609
130696
  this.emitChange({ [this.keyPrice]: v })
130610
130697
  },
130611
130698
 
130699
+ onBlur(e) {
130700
+ this.$emit('blur', e)
130701
+ },
130702
+
130612
130703
  onDelete() {
130613
130704
  this.$emit('delete', this.index)
130614
130705
  }
@@ -130627,8 +130718,8 @@ var xt_step_price_itemvue_type_template_id_8baafa30_staticRenderFns = []
130627
130718
 
130628
130719
  var xt_step_price_item_component = normalizeComponent(
130629
130720
  components_xt_step_price_itemvue_type_script_lang_js,
130630
- xt_step_price_itemvue_type_template_id_8baafa30_render,
130631
- xt_step_price_itemvue_type_template_id_8baafa30_staticRenderFns,
130721
+ xt_step_price_itemvue_type_template_id_579d80c1_render,
130722
+ xt_step_price_itemvue_type_template_id_579d80c1_staticRenderFns,
130632
130723
  false,
130633
130724
  null,
130634
130725
  null,
@@ -130646,6 +130737,12 @@ var xt_step_price_item_component = normalizeComponent(
130646
130737
 
130647
130738
  components: { XtStepPriceItem: xt_step_price_item },
130648
130739
 
130740
+ inject: {
130741
+ elFormItem: {
130742
+ default: ''
130743
+ }
130744
+ },
130745
+
130649
130746
  computed: {
130650
130747
  keyMin() { return (this.fieldKeys && this.fieldKeys.min) || 'min' },
130651
130748
  keyMax() { return (this.fieldKeys && this.fieldKeys.max) || 'max' },
@@ -130663,6 +130760,7 @@ var xt_step_price_item_component = normalizeComponent(
130663
130760
  },
130664
130761
  title: { type: String, default: '' },
130665
130762
  unit: { type: String, default: '元' },
130763
+ stepName: { type: String, default: '阶梯' },
130666
130764
  precision: { type: Number, default: 2 },
130667
130765
  // 左括号:默认 '[',传空字符串则不显示
130668
130766
  leftBracket: { type: String, default: '[' },
@@ -130712,11 +130810,14 @@ var xt_step_price_item_component = normalizeComponent(
130712
130810
 
130713
130811
  cloneItems(items) {
130714
130812
  if (!Array.isArray(items)) return []
130715
- return items.map((it) => ({
130716
- [this.keyMin]: this.safeNumber(it && it[this.keyMin], 0),
130717
- [this.keyMax]: (it && it[this.keyMax] == null) || (it && it[this.keyMax] === '') ? null : this.safeNumber(it[this.keyMax], null),
130718
- [this.keyPrice]: this.safeNumber(it && it[this.keyPrice], 0)
130719
- }))
130813
+ return items.map((it) => {
130814
+ const price = (it && it[this.keyPrice])
130815
+ return {
130816
+ [this.keyMin]: this.safeNumber(it && it[this.keyMin], 0),
130817
+ [this.keyMax]: (it && it[this.keyMax] == null) || (it && it[this.keyMax] === '') ? null : this.safeNumber(it[this.keyMax], null),
130818
+ [this.keyPrice]: (price === null || price === undefined || price === '') ? '' : this.safeNumber(price, 0)
130819
+ }
130820
+ })
130720
130821
  },
130721
130822
 
130722
130823
  normalize(items) {
@@ -130747,7 +130848,8 @@ var xt_step_price_item_component = normalizeComponent(
130747
130848
  } else {
130748
130849
  cur[this.keyMax] = null
130749
130850
  }
130750
- cur[this.keyPrice] = this.safeNumber(cur[this.keyPrice], 0)
130851
+ const price = cur[this.keyPrice]
130852
+ cur[this.keyPrice] = (price === null || price === undefined || price === '') ? '' : this.safeNumber(price, 0)
130751
130853
  }
130752
130854
  },
130753
130855
 
@@ -130756,15 +130858,118 @@ var xt_step_price_item_component = normalizeComponent(
130756
130858
  const cloned = this.cloneItems(this.localItems)
130757
130859
  this.$emit('input', cloned)
130758
130860
  this.$emit('change', cloned)
130861
+ this.dispatchFormEvent('el.form.change', cloned)
130862
+ },
130863
+
130864
+ dispatchFormEvent(eventName, value) {
130865
+ if (this.elFormItem) {
130866
+ this.elFormItem.$emit(eventName, value)
130867
+ }
130868
+ },
130869
+
130870
+ onFieldBlur() {
130871
+ this.dispatchFormEvent('el.form.blur', this.localItems)
130872
+ },
130873
+
130874
+ validate(callback) {
130875
+ const list = this.localItems
130876
+ if (!Array.isArray(list) || list.length === 0) {
130877
+ callback && callback(false, [{ field: 'stepPrice', message: `请配置${this.stepName}`, type: 'error' }])
130878
+ return false
130879
+ }
130880
+
130881
+ const errors = []
130882
+ for (let i = 0; i < list.length; i++) {
130883
+ const item = list[i]
130884
+ const rawPrice = item[this.keyPrice]
130885
+ const rawMin = item[this.keyMin]
130886
+ const rawMax = item[this.keyMax]
130887
+ const price = this.safeNumber(rawPrice, 0)
130888
+ const min = this.safeNumber(rawMin, 0)
130889
+
130890
+ if (rawPrice === null || rawPrice === undefined || rawPrice === '') {
130891
+ errors.push({
130892
+ field: `stepPrice[${i}].price`,
130893
+ message: `第${i + 1}${this.stepName}价格不能为空`,
130894
+ type: 'error'
130895
+ })
130896
+ } else if (price < 0) {
130897
+ errors.push({
130898
+ field: `stepPrice[${i}].price`,
130899
+ message: `第${i + 1}${this.stepName}价格不能为负数`,
130900
+ type: 'error'
130901
+ })
130902
+ }
130903
+
130904
+ if (rawMin === null || rawMin === undefined || rawMin === '') {
130905
+ errors.push({
130906
+ field: `stepPrice[${i}].min`,
130907
+ message: `第${i + 1}${this.stepName}下限不能为空`,
130908
+ type: 'error'
130909
+ })
130910
+ } else if (min < 0) {
130911
+ errors.push({
130912
+ field: `stepPrice[${i}].min`,
130913
+ message: `第${i + 1}${this.stepName}下限不能为负数`,
130914
+ type: 'error'
130915
+ })
130916
+ }
130917
+
130918
+ if (!this.isLast(i)) {
130919
+ if (rawMax === null || rawMax === undefined || rawMax === '') {
130920
+ errors.push({
130921
+ field: `stepPrice[${i}].max`,
130922
+ message: `第${i + 1}${this.stepName}上限不能为空`,
130923
+ type: 'error'
130924
+ })
130925
+ } else if (this.safeNumber(rawMax, 0) <= min) {
130926
+ errors.push({
130927
+ field: `stepPrice[${i}].max`,
130928
+ message: `第${i + 1}${this.stepName}上限必须大于下限`,
130929
+ type: 'error'
130930
+ })
130931
+ }
130932
+ }
130933
+
130934
+ if (i > 0) {
130935
+ const prev = list[i - 1]
130936
+ const prevMax = prev[this.keyMax]
130937
+ if (prevMax !== null && this.safeNumber(prevMax, 0) !== min) {
130938
+ errors.push({
130939
+ field: `stepPrice[${i}].min`,
130940
+ message: `第${i + 1}${this.stepName}下限必须等于上一${this.stepName}上限`,
130941
+ type: 'error'
130942
+ })
130943
+ }
130944
+ }
130945
+ }
130946
+
130947
+ if (errors.length > 0) {
130948
+ callback && callback(false, errors)
130949
+ return false
130950
+ }
130951
+
130952
+ callback && callback(true)
130953
+ return true
130954
+ },
130955
+
130956
+ isLast(idx) {
130957
+ return idx === this.localItems.length - 1
130759
130958
  },
130760
130959
 
130761
130960
  onItemInput(val, idx) {
130762
130961
  const cur = this.localItems[idx]
130763
130962
  if (!cur) return
130764
130963
  if (val && val[this.keyPrice] !== undefined) {
130765
- let p = this.safeNumber(val[this.keyPrice], 0)
130766
- p = Number(p.toFixed(this.precision))
130767
- cur[this.keyPrice] = p
130964
+ const p = val[this.keyPrice]
130965
+ if (p === null || p === undefined || p === '') {
130966
+ cur[this.keyPrice] = ''
130967
+ } else {
130968
+ let num = this.safeNumber(p, 0)
130969
+ num = Number(num.toFixed(this.precision))
130970
+ cur[this.keyPrice] = num
130971
+ }
130972
+ this.emit()
130768
130973
  }
130769
130974
  },
130770
130975
 
@@ -130819,15 +131024,8 @@ var xt_step_price_item_component = normalizeComponent(
130819
131024
  const newMin = this.safeNumber(last[this.keyMin], 0)
130820
131025
  const newMax = newMin + stepVal
130821
131026
 
130822
- // 新条 price:优先继承「倒数第二条」的 price,其次用末条 price(>0 时),否则默认 10
130823
- const prev = list[list.length - 2]
130824
- let newPrice = 10
130825
- if (prev) {
130826
- newPrice = this.safeNumber(prev[this.keyPrice], 10)
130827
- } else {
130828
- const lastPrice = this.safeNumber(last[this.keyPrice], 0)
130829
- newPrice = lastPrice > 0 ? lastPrice : 10
130830
- }
131027
+ // 新条 price:使用默认值,由用户自行填写
131028
+ let newPrice = 0
130831
131029
 
130832
131030
  const newArr = [
130833
131031
  ...list.slice(0, -1),
@@ -130879,8 +131077,8 @@ var xt_step_price_item_component = normalizeComponent(
130879
131077
 
130880
131078
  var xt_step_price_component = normalizeComponent(
130881
131079
  components_xt_step_pricevue_type_script_lang_js,
130882
- xt_step_pricevue_type_template_id_f2b8f37c_render,
130883
- xt_step_pricevue_type_template_id_f2b8f37c_staticRenderFns,
131080
+ xt_step_pricevue_type_template_id_10c6e331_render,
131081
+ xt_step_pricevue_type_template_id_10c6e331_staticRenderFns,
130884
131082
  false,
130885
131083
  null,
130886
131084
  null,