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.common.js
CHANGED
|
@@ -129127,16 +129127,16 @@ xt_button.install = function (Vue) {
|
|
|
129127
129127
|
|
|
129128
129128
|
/* harmony default export */ var components_xt_button = (xt_button);
|
|
129129
129129
|
|
|
129130
|
-
// 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=
|
|
129131
|
-
var
|
|
129130
|
+
// 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
|
|
129131
|
+
var xt_inputvue_type_template_id_6c337ae4_render = function render(){var _vm=this,_c=_vm._self._c;return _c('div',{staticClass:"xt-input",class:[
|
|
129132
129132
|
_vm.size ? 'xt-input--' + _vm.size : '',
|
|
129133
129133
|
{ 'is-disabled': _vm.disabled }
|
|
129134
|
-
]},[_c('el-input',{style:(_vm.inputStyle),attrs:{"value":_vm.
|
|
129134
|
+
]},[_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)
|
|
129135
129135
|
}
|
|
129136
|
-
var
|
|
129136
|
+
var xt_inputvue_type_template_id_6c337ae4_staticRenderFns = []
|
|
129137
129137
|
|
|
129138
129138
|
|
|
129139
|
-
// CONCATENATED MODULE: ./src/components/xt-input/index.vue?vue&type=template&id=
|
|
129139
|
+
// CONCATENATED MODULE: ./src/components/xt-input/index.vue?vue&type=template&id=6c337ae4
|
|
129140
129140
|
|
|
129141
129141
|
// 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
|
|
129142
129142
|
|
|
@@ -129169,7 +129169,22 @@ var xt_inputvue_type_template_id_69bd5491_staticRenderFns = []
|
|
|
129169
129169
|
default: ''
|
|
129170
129170
|
}
|
|
129171
129171
|
},
|
|
129172
|
+
data() {
|
|
129173
|
+
return {
|
|
129174
|
+
currentStr: '',
|
|
129175
|
+
isFocused: false
|
|
129176
|
+
}
|
|
129177
|
+
},
|
|
129172
129178
|
computed: {
|
|
129179
|
+
isNumberType() {
|
|
129180
|
+
return this.type === 'number'
|
|
129181
|
+
},
|
|
129182
|
+
displayValue() {
|
|
129183
|
+
if (this.isNumberType) {
|
|
129184
|
+
return this.currentStr
|
|
129185
|
+
}
|
|
129186
|
+
return this.value
|
|
129187
|
+
},
|
|
129173
129188
|
inputStyle() {
|
|
129174
129189
|
if (this.color) {
|
|
129175
129190
|
return {
|
|
@@ -129178,6 +129193,71 @@ var xt_inputvue_type_template_id_69bd5491_staticRenderFns = []
|
|
|
129178
129193
|
}
|
|
129179
129194
|
return {}
|
|
129180
129195
|
}
|
|
129196
|
+
},
|
|
129197
|
+
watch: {
|
|
129198
|
+
value: {
|
|
129199
|
+
immediate: true,
|
|
129200
|
+
handler(val) {
|
|
129201
|
+
if (this.isNumberType && !this.isFocused) {
|
|
129202
|
+
this.currentStr = val === null || val === undefined || val === '' ? '' : String(val)
|
|
129203
|
+
}
|
|
129204
|
+
}
|
|
129205
|
+
}
|
|
129206
|
+
},
|
|
129207
|
+
methods: {
|
|
129208
|
+
isValidNumber(str) {
|
|
129209
|
+
return /^[+-]?\d*\.?\d*$/.test(str)
|
|
129210
|
+
},
|
|
129211
|
+
handleInput(val) {
|
|
129212
|
+
if (this.isNumberType) {
|
|
129213
|
+
if (this.isValidNumber(val)) {
|
|
129214
|
+
this.currentStr = val
|
|
129215
|
+
const num = this.parseToNumber(val)
|
|
129216
|
+
if (num !== undefined) {
|
|
129217
|
+
this.$emit('input', num)
|
|
129218
|
+
}
|
|
129219
|
+
}
|
|
129220
|
+
} else {
|
|
129221
|
+
this.$emit('input', val)
|
|
129222
|
+
}
|
|
129223
|
+
},
|
|
129224
|
+
handleChange(val) {
|
|
129225
|
+
if (this.isNumberType) {
|
|
129226
|
+
const num = this.parseToNumber(val)
|
|
129227
|
+
this.$emit('change', num)
|
|
129228
|
+
} else {
|
|
129229
|
+
this.$emit('change', val)
|
|
129230
|
+
}
|
|
129231
|
+
},
|
|
129232
|
+
handleFocus(e) {
|
|
129233
|
+
this.isFocused = true
|
|
129234
|
+
this.$emit('focus', e)
|
|
129235
|
+
},
|
|
129236
|
+
handleBlur(e) {
|
|
129237
|
+
this.isFocused = false
|
|
129238
|
+
if (this.isNumberType) {
|
|
129239
|
+
const num = this.parseToNumber(this.currentStr)
|
|
129240
|
+
this.$emit('blur', num, e)
|
|
129241
|
+
if (num !== undefined) {
|
|
129242
|
+
this.currentStr = String(num)
|
|
129243
|
+
this.$emit('input', num)
|
|
129244
|
+
} else {
|
|
129245
|
+
if (this.currentStr !== '') {
|
|
129246
|
+
this.currentStr = ''
|
|
129247
|
+
this.$emit('input', undefined)
|
|
129248
|
+
}
|
|
129249
|
+
}
|
|
129250
|
+
} else {
|
|
129251
|
+
this.$emit('blur', e)
|
|
129252
|
+
}
|
|
129253
|
+
},
|
|
129254
|
+
parseToNumber(str) {
|
|
129255
|
+
if (!str || str === '+' || str === '-' || str === '.' || str === '+.' || str === '-.' || str === '-.') {
|
|
129256
|
+
return undefined
|
|
129257
|
+
}
|
|
129258
|
+
const num = parseFloat(str)
|
|
129259
|
+
return isNaN(num) ? undefined : num
|
|
129260
|
+
}
|
|
129181
129261
|
}
|
|
129182
129262
|
});
|
|
129183
129263
|
|
|
@@ -129193,8 +129273,8 @@ var xt_inputvue_type_template_id_69bd5491_staticRenderFns = []
|
|
|
129193
129273
|
|
|
129194
129274
|
var xt_input_component = normalizeComponent(
|
|
129195
129275
|
components_xt_inputvue_type_script_lang_js,
|
|
129196
|
-
|
|
129197
|
-
|
|
129276
|
+
xt_inputvue_type_template_id_6c337ae4_render,
|
|
129277
|
+
xt_inputvue_type_template_id_6c337ae4_staticRenderFns,
|
|
129198
129278
|
false,
|
|
129199
129279
|
null,
|
|
129200
129280
|
null,
|
|
@@ -130447,21 +130527,21 @@ xt_time.install = function (Vue) {
|
|
|
130447
130527
|
/* harmony default export */ var components_xt_time = (xt_time);
|
|
130448
130528
|
|
|
130449
130529
|
|
|
130450
|
-
// 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=
|
|
130451
|
-
var
|
|
130530
|
+
// 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
|
|
130531
|
+
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()])
|
|
130452
130532
|
}
|
|
130453
|
-
var
|
|
130533
|
+
var xt_step_pricevue_type_template_id_10c6e331_staticRenderFns = []
|
|
130454
130534
|
|
|
130455
130535
|
|
|
130456
|
-
// CONCATENATED MODULE: ./src/components/xt-step-price/index.vue?vue&type=template&id=
|
|
130536
|
+
// CONCATENATED MODULE: ./src/components/xt-step-price/index.vue?vue&type=template&id=10c6e331
|
|
130457
130537
|
|
|
130458
|
-
// 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=
|
|
130459
|
-
var
|
|
130538
|
+
// 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
|
|
130539
|
+
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)
|
|
130460
130540
|
}
|
|
130461
|
-
var
|
|
130541
|
+
var xt_step_price_itemvue_type_template_id_579d80c1_staticRenderFns = []
|
|
130462
130542
|
|
|
130463
130543
|
|
|
130464
|
-
// CONCATENATED MODULE: ./src/components/xt-step-price-item/index.vue?vue&type=template&id=
|
|
130544
|
+
// CONCATENATED MODULE: ./src/components/xt-step-price-item/index.vue?vue&type=template&id=579d80c1
|
|
130465
130545
|
|
|
130466
130546
|
// 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
|
|
130467
130547
|
|
|
@@ -130474,6 +130554,7 @@ var xt_step_price_itemvue_type_template_id_8baafa30_staticRenderFns = []
|
|
|
130474
130554
|
required: true,
|
|
130475
130555
|
default: () => ({ min: 0, max: null, price: 0 })
|
|
130476
130556
|
},
|
|
130557
|
+
stepName: { type: String, default: '阶梯' },
|
|
130477
130558
|
index: { type: Number, default: 0 },
|
|
130478
130559
|
isFirst: { type: Boolean, default: false },
|
|
130479
130560
|
isLast: { type: Boolean, default: false },
|
|
@@ -130593,13 +130674,23 @@ var xt_step_price_itemvue_type_template_id_8baafa30_staticRenderFns = []
|
|
|
130593
130674
|
},
|
|
130594
130675
|
|
|
130595
130676
|
onPriceBlur() {
|
|
130596
|
-
|
|
130677
|
+
const rawVal = this.priceInput
|
|
130678
|
+
if (rawVal === null || rawVal === undefined || rawVal === '' || isNaN(rawVal)) {
|
|
130679
|
+
this.priceInput = ''
|
|
130680
|
+
this.emitChange({ [this.keyPrice]: '' })
|
|
130681
|
+
return
|
|
130682
|
+
}
|
|
130683
|
+
let v = this.safeNumber(rawVal, 0)
|
|
130597
130684
|
if (v < 0) v = 0
|
|
130598
130685
|
v = Number(v.toFixed(this.precision))
|
|
130599
130686
|
this.priceInput = v
|
|
130600
130687
|
this.emitChange({ [this.keyPrice]: v })
|
|
130601
130688
|
},
|
|
130602
130689
|
|
|
130690
|
+
onBlur(e) {
|
|
130691
|
+
this.$emit('blur', e)
|
|
130692
|
+
},
|
|
130693
|
+
|
|
130603
130694
|
onDelete() {
|
|
130604
130695
|
this.$emit('delete', this.index)
|
|
130605
130696
|
}
|
|
@@ -130618,8 +130709,8 @@ var xt_step_price_itemvue_type_template_id_8baafa30_staticRenderFns = []
|
|
|
130618
130709
|
|
|
130619
130710
|
var xt_step_price_item_component = normalizeComponent(
|
|
130620
130711
|
components_xt_step_price_itemvue_type_script_lang_js,
|
|
130621
|
-
|
|
130622
|
-
|
|
130712
|
+
xt_step_price_itemvue_type_template_id_579d80c1_render,
|
|
130713
|
+
xt_step_price_itemvue_type_template_id_579d80c1_staticRenderFns,
|
|
130623
130714
|
false,
|
|
130624
130715
|
null,
|
|
130625
130716
|
null,
|
|
@@ -130637,6 +130728,12 @@ var xt_step_price_item_component = normalizeComponent(
|
|
|
130637
130728
|
|
|
130638
130729
|
components: { XtStepPriceItem: xt_step_price_item },
|
|
130639
130730
|
|
|
130731
|
+
inject: {
|
|
130732
|
+
elFormItem: {
|
|
130733
|
+
default: ''
|
|
130734
|
+
}
|
|
130735
|
+
},
|
|
130736
|
+
|
|
130640
130737
|
computed: {
|
|
130641
130738
|
keyMin() { return (this.fieldKeys && this.fieldKeys.min) || 'min' },
|
|
130642
130739
|
keyMax() { return (this.fieldKeys && this.fieldKeys.max) || 'max' },
|
|
@@ -130654,6 +130751,7 @@ var xt_step_price_item_component = normalizeComponent(
|
|
|
130654
130751
|
},
|
|
130655
130752
|
title: { type: String, default: '' },
|
|
130656
130753
|
unit: { type: String, default: '元' },
|
|
130754
|
+
stepName: { type: String, default: '阶梯' },
|
|
130657
130755
|
precision: { type: Number, default: 2 },
|
|
130658
130756
|
// 左括号:默认 '[',传空字符串则不显示
|
|
130659
130757
|
leftBracket: { type: String, default: '[' },
|
|
@@ -130703,11 +130801,14 @@ var xt_step_price_item_component = normalizeComponent(
|
|
|
130703
130801
|
|
|
130704
130802
|
cloneItems(items) {
|
|
130705
130803
|
if (!Array.isArray(items)) return []
|
|
130706
|
-
return items.map((it) =>
|
|
130707
|
-
|
|
130708
|
-
|
|
130709
|
-
|
|
130710
|
-
|
|
130804
|
+
return items.map((it) => {
|
|
130805
|
+
const price = (it && it[this.keyPrice])
|
|
130806
|
+
return {
|
|
130807
|
+
[this.keyMin]: this.safeNumber(it && it[this.keyMin], 0),
|
|
130808
|
+
[this.keyMax]: (it && it[this.keyMax] == null) || (it && it[this.keyMax] === '') ? null : this.safeNumber(it[this.keyMax], null),
|
|
130809
|
+
[this.keyPrice]: (price === null || price === undefined || price === '') ? '' : this.safeNumber(price, 0)
|
|
130810
|
+
}
|
|
130811
|
+
})
|
|
130711
130812
|
},
|
|
130712
130813
|
|
|
130713
130814
|
normalize(items) {
|
|
@@ -130738,7 +130839,8 @@ var xt_step_price_item_component = normalizeComponent(
|
|
|
130738
130839
|
} else {
|
|
130739
130840
|
cur[this.keyMax] = null
|
|
130740
130841
|
}
|
|
130741
|
-
|
|
130842
|
+
const price = cur[this.keyPrice]
|
|
130843
|
+
cur[this.keyPrice] = (price === null || price === undefined || price === '') ? '' : this.safeNumber(price, 0)
|
|
130742
130844
|
}
|
|
130743
130845
|
},
|
|
130744
130846
|
|
|
@@ -130747,15 +130849,118 @@ var xt_step_price_item_component = normalizeComponent(
|
|
|
130747
130849
|
const cloned = this.cloneItems(this.localItems)
|
|
130748
130850
|
this.$emit('input', cloned)
|
|
130749
130851
|
this.$emit('change', cloned)
|
|
130852
|
+
this.dispatchFormEvent('el.form.change', cloned)
|
|
130853
|
+
},
|
|
130854
|
+
|
|
130855
|
+
dispatchFormEvent(eventName, value) {
|
|
130856
|
+
if (this.elFormItem) {
|
|
130857
|
+
this.elFormItem.$emit(eventName, value)
|
|
130858
|
+
}
|
|
130859
|
+
},
|
|
130860
|
+
|
|
130861
|
+
onFieldBlur() {
|
|
130862
|
+
this.dispatchFormEvent('el.form.blur', this.localItems)
|
|
130863
|
+
},
|
|
130864
|
+
|
|
130865
|
+
validate(callback) {
|
|
130866
|
+
const list = this.localItems
|
|
130867
|
+
if (!Array.isArray(list) || list.length === 0) {
|
|
130868
|
+
callback && callback(false, [{ field: 'stepPrice', message: `请配置${this.stepName}`, type: 'error' }])
|
|
130869
|
+
return false
|
|
130870
|
+
}
|
|
130871
|
+
|
|
130872
|
+
const errors = []
|
|
130873
|
+
for (let i = 0; i < list.length; i++) {
|
|
130874
|
+
const item = list[i]
|
|
130875
|
+
const rawPrice = item[this.keyPrice]
|
|
130876
|
+
const rawMin = item[this.keyMin]
|
|
130877
|
+
const rawMax = item[this.keyMax]
|
|
130878
|
+
const price = this.safeNumber(rawPrice, 0)
|
|
130879
|
+
const min = this.safeNumber(rawMin, 0)
|
|
130880
|
+
|
|
130881
|
+
if (rawPrice === null || rawPrice === undefined || rawPrice === '') {
|
|
130882
|
+
errors.push({
|
|
130883
|
+
field: `stepPrice[${i}].price`,
|
|
130884
|
+
message: `第${i + 1}${this.stepName}价格不能为空`,
|
|
130885
|
+
type: 'error'
|
|
130886
|
+
})
|
|
130887
|
+
} else if (price < 0) {
|
|
130888
|
+
errors.push({
|
|
130889
|
+
field: `stepPrice[${i}].price`,
|
|
130890
|
+
message: `第${i + 1}${this.stepName}价格不能为负数`,
|
|
130891
|
+
type: 'error'
|
|
130892
|
+
})
|
|
130893
|
+
}
|
|
130894
|
+
|
|
130895
|
+
if (rawMin === null || rawMin === undefined || rawMin === '') {
|
|
130896
|
+
errors.push({
|
|
130897
|
+
field: `stepPrice[${i}].min`,
|
|
130898
|
+
message: `第${i + 1}${this.stepName}下限不能为空`,
|
|
130899
|
+
type: 'error'
|
|
130900
|
+
})
|
|
130901
|
+
} else if (min < 0) {
|
|
130902
|
+
errors.push({
|
|
130903
|
+
field: `stepPrice[${i}].min`,
|
|
130904
|
+
message: `第${i + 1}${this.stepName}下限不能为负数`,
|
|
130905
|
+
type: 'error'
|
|
130906
|
+
})
|
|
130907
|
+
}
|
|
130908
|
+
|
|
130909
|
+
if (!this.isLast(i)) {
|
|
130910
|
+
if (rawMax === null || rawMax === undefined || rawMax === '') {
|
|
130911
|
+
errors.push({
|
|
130912
|
+
field: `stepPrice[${i}].max`,
|
|
130913
|
+
message: `第${i + 1}${this.stepName}上限不能为空`,
|
|
130914
|
+
type: 'error'
|
|
130915
|
+
})
|
|
130916
|
+
} else if (this.safeNumber(rawMax, 0) <= min) {
|
|
130917
|
+
errors.push({
|
|
130918
|
+
field: `stepPrice[${i}].max`,
|
|
130919
|
+
message: `第${i + 1}${this.stepName}上限必须大于下限`,
|
|
130920
|
+
type: 'error'
|
|
130921
|
+
})
|
|
130922
|
+
}
|
|
130923
|
+
}
|
|
130924
|
+
|
|
130925
|
+
if (i > 0) {
|
|
130926
|
+
const prev = list[i - 1]
|
|
130927
|
+
const prevMax = prev[this.keyMax]
|
|
130928
|
+
if (prevMax !== null && this.safeNumber(prevMax, 0) !== min) {
|
|
130929
|
+
errors.push({
|
|
130930
|
+
field: `stepPrice[${i}].min`,
|
|
130931
|
+
message: `第${i + 1}${this.stepName}下限必须等于上一${this.stepName}上限`,
|
|
130932
|
+
type: 'error'
|
|
130933
|
+
})
|
|
130934
|
+
}
|
|
130935
|
+
}
|
|
130936
|
+
}
|
|
130937
|
+
|
|
130938
|
+
if (errors.length > 0) {
|
|
130939
|
+
callback && callback(false, errors)
|
|
130940
|
+
return false
|
|
130941
|
+
}
|
|
130942
|
+
|
|
130943
|
+
callback && callback(true)
|
|
130944
|
+
return true
|
|
130945
|
+
},
|
|
130946
|
+
|
|
130947
|
+
isLast(idx) {
|
|
130948
|
+
return idx === this.localItems.length - 1
|
|
130750
130949
|
},
|
|
130751
130950
|
|
|
130752
130951
|
onItemInput(val, idx) {
|
|
130753
130952
|
const cur = this.localItems[idx]
|
|
130754
130953
|
if (!cur) return
|
|
130755
130954
|
if (val && val[this.keyPrice] !== undefined) {
|
|
130756
|
-
|
|
130757
|
-
p
|
|
130758
|
-
|
|
130955
|
+
const p = val[this.keyPrice]
|
|
130956
|
+
if (p === null || p === undefined || p === '') {
|
|
130957
|
+
cur[this.keyPrice] = ''
|
|
130958
|
+
} else {
|
|
130959
|
+
let num = this.safeNumber(p, 0)
|
|
130960
|
+
num = Number(num.toFixed(this.precision))
|
|
130961
|
+
cur[this.keyPrice] = num
|
|
130962
|
+
}
|
|
130963
|
+
this.emit()
|
|
130759
130964
|
}
|
|
130760
130965
|
},
|
|
130761
130966
|
|
|
@@ -130810,15 +131015,8 @@ var xt_step_price_item_component = normalizeComponent(
|
|
|
130810
131015
|
const newMin = this.safeNumber(last[this.keyMin], 0)
|
|
130811
131016
|
const newMax = newMin + stepVal
|
|
130812
131017
|
|
|
130813
|
-
// 新条 price
|
|
130814
|
-
|
|
130815
|
-
let newPrice = 10
|
|
130816
|
-
if (prev) {
|
|
130817
|
-
newPrice = this.safeNumber(prev[this.keyPrice], 10)
|
|
130818
|
-
} else {
|
|
130819
|
-
const lastPrice = this.safeNumber(last[this.keyPrice], 0)
|
|
130820
|
-
newPrice = lastPrice > 0 ? lastPrice : 10
|
|
130821
|
-
}
|
|
131018
|
+
// 新条 price:使用默认值,由用户自行填写
|
|
131019
|
+
let newPrice = 0
|
|
130822
131020
|
|
|
130823
131021
|
const newArr = [
|
|
130824
131022
|
...list.slice(0, -1),
|
|
@@ -130870,8 +131068,8 @@ var xt_step_price_item_component = normalizeComponent(
|
|
|
130870
131068
|
|
|
130871
131069
|
var xt_step_price_component = normalizeComponent(
|
|
130872
131070
|
components_xt_step_pricevue_type_script_lang_js,
|
|
130873
|
-
|
|
130874
|
-
|
|
131071
|
+
xt_step_pricevue_type_template_id_10c6e331_render,
|
|
131072
|
+
xt_step_pricevue_type_template_id_10c6e331_staticRenderFns,
|
|
130875
131073
|
false,
|
|
130876
131074
|
null,
|
|
130877
131075
|
null,
|