设备维保调整字段和操作逻辑,预计开始时间,结束时间调整
This commit is contained in:
@@ -64,6 +64,10 @@ export default {
|
||||
type: Number,
|
||||
default: 6,
|
||||
validator: (value) => value > 0
|
||||
},
|
||||
inputFormatter: {
|
||||
type: Function,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
data() {
|
||||
@@ -132,10 +136,11 @@ export default {
|
||||
* @param {object} item - 选中的项 {value: 'xxx'}
|
||||
*/
|
||||
handleSelect(item) {
|
||||
this.cacheInputValue(item.value);
|
||||
this.inputValue = item.value;
|
||||
const v = this.formatValue(item.value);
|
||||
this.cacheInputValue(v);
|
||||
this.inputValue = v;
|
||||
// 触发自定义事件,通知父组件选中结果
|
||||
this.$emit('input', item.value);
|
||||
this.$emit('input', v);
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -144,13 +149,22 @@ export default {
|
||||
*/
|
||||
handleInputChange(value) {
|
||||
if (value && value.trim() !== '') {
|
||||
this.cacheInputValue(value.trim());
|
||||
const v = this.formatValue(value.trim());
|
||||
this.cacheInputValue(v);
|
||||
// 触发自定义事件,通知父组件输入结果
|
||||
this.$emit('input', value.trim());
|
||||
this.$emit('input', v);
|
||||
} else {
|
||||
this.$emit('input', '');
|
||||
}
|
||||
},
|
||||
formatValue(value) {
|
||||
const v = value === null || value === undefined ? '' : String(value);
|
||||
if (!v.trim()) return '';
|
||||
if (typeof this.inputFormatter === 'function') {
|
||||
return this.inputFormatter(v);
|
||||
}
|
||||
return v.trim();
|
||||
},
|
||||
|
||||
/**
|
||||
* 缓存输入值到localStorage
|
||||
@@ -196,4 +210,4 @@ export default {
|
||||
.inline-input {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user