|
|
|
@ -28,7 +28,7 @@
|
|
|
|
image: '',
|
|
|
|
image: '',
|
|
|
|
eventsType: 'click',
|
|
|
|
eventsType: 'click',
|
|
|
|
eventsAction: '',
|
|
|
|
eventsAction: '',
|
|
|
|
defaultFocus: false,
|
|
|
|
defaultFocus: '0',
|
|
|
|
leftId: '',
|
|
|
|
leftId: '',
|
|
|
|
rightId: '',
|
|
|
|
rightId: '',
|
|
|
|
upId: '',
|
|
|
|
upId: '',
|
|
|
|
@ -51,7 +51,7 @@
|
|
|
|
fontWeight: 'normal',
|
|
|
|
fontWeight: 'normal',
|
|
|
|
eventsType: 'click',
|
|
|
|
eventsType: 'click',
|
|
|
|
eventsAction: '',
|
|
|
|
eventsAction: '',
|
|
|
|
defaultFocus: false,
|
|
|
|
defaultFocus: '0',
|
|
|
|
leftId: '',
|
|
|
|
leftId: '',
|
|
|
|
rightId: '',
|
|
|
|
rightId: '',
|
|
|
|
upId: '',
|
|
|
|
upId: '',
|
|
|
|
@ -453,6 +453,18 @@
|
|
|
|
if (!value) return;
|
|
|
|
if (!value) return;
|
|
|
|
el.find('span').css('font-weight', value);
|
|
|
|
el.find('span').css('font-weight', value);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
defaultFocus: function (el, value, component) {
|
|
|
|
|
|
|
|
if (value != '1') {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// 默认聚焦一个画布只能存在一个true
|
|
|
|
|
|
|
|
let childrens = currentScreen === 'welcome' ? welcome.grid.engine.nodes : main.grid.engine.nodes;
|
|
|
|
|
|
|
|
childrens.forEach((item) => {
|
|
|
|
|
|
|
|
if (item.id !== component.id) {
|
|
|
|
|
|
|
|
item.defaultFocus = '0';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
|
|
|
focusedStyle_background: function (el, value, component) {
|
|
|
|
focusedStyle_background: function (el, value, component) {
|
|
|
|
initColorPicker('focusedStyle_background', component);
|
|
|
|
initColorPicker('focusedStyle_background', component);
|
|
|
|
if (!value) return;
|
|
|
|
if (!value) return;
|
|
|
|
@ -499,7 +511,7 @@
|
|
|
|
// 定义映射关系:元素ID -> 事件类型 -> 组件属性
|
|
|
|
// 定义映射关系:元素ID -> 事件类型 -> 组件属性
|
|
|
|
const elementMappings = {
|
|
|
|
const elementMappings = {
|
|
|
|
name: { event: 'blur', property: 'name' },
|
|
|
|
name: { event: 'blur', property: 'name' },
|
|
|
|
childrenType: { event: 'blur', property: 'childrenType' },
|
|
|
|
childrenType: { event: 'change', property: 'childrenType' },
|
|
|
|
background: { event: 'blur', property: 'background' },
|
|
|
|
background: { event: 'blur', property: 'background' },
|
|
|
|
image: { event: 'change', property: 'image' },
|
|
|
|
image: { event: 'change', property: 'image' },
|
|
|
|
fontSize: { event: 'blur', property: 'fontSize' },
|
|
|
|
fontSize: { event: 'blur', property: 'fontSize' },
|
|
|
|
@ -507,7 +519,7 @@
|
|
|
|
text: { event: 'blur', property: 'text' },
|
|
|
|
text: { event: 'blur', property: 'text' },
|
|
|
|
fontWeight: { event: 'blur', property: 'fontWeight' },
|
|
|
|
fontWeight: { event: 'blur', property: 'fontWeight' },
|
|
|
|
eventsType: { event: 'change', property: 'eventsType' },
|
|
|
|
eventsType: { event: 'change', property: 'eventsType' },
|
|
|
|
eventsAction: { event: 'blur', property: 'eventsAction' },
|
|
|
|
eventsAction: { event: 'change', property: 'eventsAction' },
|
|
|
|
defaultFocus: { event: 'change', property: 'defaultFocus' },
|
|
|
|
defaultFocus: { event: 'change', property: 'defaultFocus' },
|
|
|
|
leftId: { event: 'change', property: 'leftId' },
|
|
|
|
leftId: { event: 'change', property: 'leftId' },
|
|
|
|
rightId: { event: 'change', property: 'rightId' },
|
|
|
|
rightId: { event: 'change', property: 'rightId' },
|
|
|
|
@ -570,6 +582,24 @@
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 抽取校验函数
|
|
|
|
|
|
|
|
function validateDefaultFocus(children) {
|
|
|
|
|
|
|
|
const { default_focus_tip } = userLangConfig[locale].user;
|
|
|
|
|
|
|
|
if (children.length) {
|
|
|
|
|
|
|
|
let hasDefaultFocus = false;
|
|
|
|
|
|
|
|
children.forEach((item) => {
|
|
|
|
|
|
|
|
if (item.defaultFocus == '1') {
|
|
|
|
|
|
|
|
hasDefaultFocus = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
if (!hasDefaultFocus) {
|
|
|
|
|
|
|
|
layer.msg(`${default_focus_tip}`);
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 保存时判断是否满足条件可保存
|
|
|
|
// 保存时判断是否满足条件可保存
|
|
|
|
var canSave = function () {
|
|
|
|
var canSave = function () {
|
|
|
|
const { please_input, template_name } = userLangConfig[locale].user;
|
|
|
|
const { please_input, template_name } = userLangConfig[locale].user;
|
|
|
|
@ -577,6 +607,16 @@
|
|
|
|
layer.msg(`${please_input}${template_name}`);
|
|
|
|
layer.msg(`${please_input}${template_name}`);
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const welcomeChildrens = welcome.grid.save();
|
|
|
|
|
|
|
|
const mainChildrens = main.grid.save();
|
|
|
|
|
|
|
|
if (!validateDefaultFocus(welcomeChildrens)) {
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!validateDefaultFocus(mainChildrens)) {
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
@ -630,7 +670,7 @@
|
|
|
|
background: currentComponent.background,
|
|
|
|
background: currentComponent.background,
|
|
|
|
eventsType: currentComponent.eventsType,
|
|
|
|
eventsType: currentComponent.eventsType,
|
|
|
|
eventsAction: currentComponent.eventsAction,
|
|
|
|
eventsAction: currentComponent.eventsAction,
|
|
|
|
defaultFocus: false,
|
|
|
|
defaultFocus: '0',
|
|
|
|
leftId: currentComponent.leftId,
|
|
|
|
leftId: currentComponent.leftId,
|
|
|
|
rightId: currentComponent.rightId,
|
|
|
|
rightId: currentComponent.rightId,
|
|
|
|
upId: currentComponent.upId,
|
|
|
|
upId: currentComponent.upId,
|
|
|
|
@ -706,6 +746,7 @@
|
|
|
|
item.hCopy = item.h;
|
|
|
|
item.hCopy = item.h;
|
|
|
|
item.h = item.h * cellHeight * 2;
|
|
|
|
item.h = item.h * cellHeight * 2;
|
|
|
|
item.fontSize = item.fontSize ? parseInt(item.fontSize) : item.fontSize;
|
|
|
|
item.fontSize = item.fontSize ? parseInt(item.fontSize) : item.fontSize;
|
|
|
|
|
|
|
|
item.defaultFocus = item.defaultFocus == '1' ? true : false;
|
|
|
|
|
|
|
|
|
|
|
|
// 调用辅助函数处理带下划线的数据
|
|
|
|
// 调用辅助函数处理带下划线的数据
|
|
|
|
Object.assign(item, transformUnderscoreData(item)); // 将转换后的属性合并回item
|
|
|
|
Object.assign(item, transformUnderscoreData(item)); // 将转换后的属性合并回item
|
|
|
|
@ -719,13 +760,14 @@
|
|
|
|
item.y = item.yCopy;
|
|
|
|
item.y = item.yCopy;
|
|
|
|
item.w = item.wCopy;
|
|
|
|
item.w = item.wCopy;
|
|
|
|
item.h = item.hCopy;
|
|
|
|
item.h = item.hCopy;
|
|
|
|
|
|
|
|
item.defaultFocus = item.defaultFocus == true ? '1' : '0';
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var i18n = function () {
|
|
|
|
var i18n = function () {
|
|
|
|
return new Promise((resolve) => {
|
|
|
|
return new Promise((resolve) => {
|
|
|
|
requestFN({ url: 'getLanguage', hasPreFix: false }, function (data) {
|
|
|
|
requestFN({ url: '/getLanguage', hasPreFix: false }, function (data) {
|
|
|
|
data.language = 'zh_CN';
|
|
|
|
data.language = 'zh_CN';
|
|
|
|
locale = data.language;
|
|
|
|
locale = data.language;
|
|
|
|
// 设置语言
|
|
|
|
// 设置语言
|
|
|
|
@ -747,15 +789,63 @@
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var getImageData = function () {
|
|
|
|
var getImageData = function () {
|
|
|
|
requestFN({ url: 'listResourceByType', data: { type: 'image' } }, function () {});
|
|
|
|
requestFN({ url: 'listResourceByType', data: { type: 'image' } }, function (data) {
|
|
|
|
|
|
|
|
let el = $('#image');
|
|
|
|
|
|
|
|
let componentsHtml = [{ value: '', text: el.find('option').eq(0).text() }];
|
|
|
|
|
|
|
|
data.map((item) => {
|
|
|
|
|
|
|
|
componentsHtml.push({ value: api.baseUrl + item.path, text: `${item.name}` });
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
el.empty();
|
|
|
|
|
|
|
|
componentsHtml.forEach((item) => {
|
|
|
|
|
|
|
|
el.append(
|
|
|
|
|
|
|
|
$('<option>', {
|
|
|
|
|
|
|
|
value: item.value,
|
|
|
|
|
|
|
|
text: item.text,
|
|
|
|
|
|
|
|
selected: item.selected || false,
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var getMenuData = function () {
|
|
|
|
var getMenuData = function () {
|
|
|
|
requestFN({ url: 'listResourceByType', data: { type: 'menu' } }, function () {});
|
|
|
|
requestFN({ url: 'listResourceByType', data: { type: 'menu' } }, function (data) {
|
|
|
|
|
|
|
|
let el = $('#eventsAction');
|
|
|
|
|
|
|
|
let componentsHtml = [{ value: '', text: el.find('option').eq(0).text() }];
|
|
|
|
|
|
|
|
data.map((item) => {
|
|
|
|
|
|
|
|
componentsHtml.push({ value: item.name, text: `${item.name}` });
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
el.empty();
|
|
|
|
|
|
|
|
componentsHtml.forEach((item) => {
|
|
|
|
|
|
|
|
el.append(
|
|
|
|
|
|
|
|
$('<option>', {
|
|
|
|
|
|
|
|
value: item.value,
|
|
|
|
|
|
|
|
text: item.text,
|
|
|
|
|
|
|
|
selected: item.selected || false,
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var getComponentData = function () {
|
|
|
|
var getComponentData = function () {
|
|
|
|
requestFN({ url: 'listResourceByType', data: { type: 'component' } }, function () {});
|
|
|
|
requestFN({ url: 'listResourceByType', data: { type: 'component' } }, function (data) {
|
|
|
|
|
|
|
|
let el = $('#childrenType');
|
|
|
|
|
|
|
|
let componentsHtml = [{ value: '', text: el.find('option').eq(0).text() }];
|
|
|
|
|
|
|
|
data.map((item) => {
|
|
|
|
|
|
|
|
componentsHtml.push({ value: item.name, text: `${item.name}` });
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
el.empty();
|
|
|
|
|
|
|
|
componentsHtml.forEach((item) => {
|
|
|
|
|
|
|
|
el.append(
|
|
|
|
|
|
|
|
$('<option>', {
|
|
|
|
|
|
|
|
value: item.value,
|
|
|
|
|
|
|
|
text: item.text,
|
|
|
|
|
|
|
|
selected: item.selected || false,
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// 获取单个参数
|
|
|
|
// 获取单个参数
|
|
|
|
|