Browse Source

测试多层级单选下拉树,增加无效值边框标红

master
linyang3 3 years ago
parent
commit
6ef395d4de
  1. 22
      dist/bundle.js
  2. 24
      src/modules/tree/main.js

22
dist/bundle.js vendored

@ -281,7 +281,7 @@
// 给多层级单选树增加设置错误值时标红状态
BI.config("bi.multilayer_single_tree_combo", function (config) {
var ERROR_CLASS = 'combo-error';
var ERROR_CLASS = "combo-error";
/**
* 判断是否是有效值
@ -290,7 +290,7 @@
* @returns {Boolean}
*/
function isValueValid (options, value) {
value = value || options.value || '';
value = value || options.value || "";
if (Array.isArray(value)) {
value = value[0];
}
@ -308,9 +308,9 @@
if (BI.contains(itemIds, value)) {
return true;
} else {
return false;
}
return false;
}
/**
@ -386,7 +386,7 @@
return BI.Models.getModel("dec.amiba.test.tree.model");
},
props: {
baseCls: 'fine-test-tree',
baseCls: "fine-test-tree"
},
watch: {
items: function (items) {
@ -416,17 +416,17 @@
// 测试修改value
setTimeout(function () {
console.log('setValue');
self.treeRef.setValue('不存在的值');
console.log("setValue");
self.treeRef.setValue("");
}, 3000);
},
items: [
{
type: 'bi.label',
textAlign: 'left',
text: '叶子节点单选'
type: "bi.label",
textAlign: "left",
text: "叶子节点单选"
},
{
type: "bi.multilayer_single_tree_combo",
@ -439,7 +439,7 @@
width: 250,
value: self.model.value,
listeners: [{
eventName: 'EVENT_CHANGE',
eventName: "EVENT_CHANGE",
action: function () {
self.model.value = self.treeRef.getValue()[0];
}

24
src/modules/tree/main.js

@ -2,7 +2,7 @@
// 给多层级单选树增加设置错误值时标红状态
BI.config("bi.multilayer_single_tree_combo", function (config) {
var ERROR_CLASS = 'combo-error';
var ERROR_CLASS = "combo-error";
/**
* 判断是否是有效值
@ -11,10 +11,12 @@
* @returns {Boolean}
*/
function isValueValid (options, value) {
value = value || options.value || '';
value = value || options.value;
if (Array.isArray(value)) {
value = value[0];
}
value = value || null;
var items = options.items || [];
var itemIds = [];
@ -29,9 +31,9 @@
if (BI.contains(itemIds, value)) {
return true;
} else {
return false;
}
return false;
}
/**
@ -107,7 +109,7 @@
return BI.Models.getModel("dec.amiba.test.tree.model");
},
props: {
baseCls: 'fine-test-tree',
baseCls: "fine-test-tree"
},
watch: {
items: function (items) {
@ -137,17 +139,17 @@
// 测试修改value
setTimeout(function () {
console.log('setValue');
self.treeRef.setValue('不存在的值');
console.log("setValue");
self.treeRef.setValue("");
}, 3000);
},
items: [
{
type: 'bi.label',
textAlign: 'left',
text: '叶子节点单选'
type: "bi.label",
textAlign: "left",
text: "叶子节点单选"
},
{
type: "bi.multilayer_single_tree_combo",
@ -160,7 +162,7 @@
width: 250,
value: self.model.value,
listeners: [{
eventName: 'EVENT_CHANGE',
eventName: "EVENT_CHANGE",
action: function () {
self.model.value = self.treeRef.getValue()[0];
}

Loading…
Cancel
Save