提交 e4dbbfb3 编写于 作者: Skyeye云's avatar Skyeye云

属性信息修改

上级 a7eda96d
......@@ -50,6 +50,10 @@ layui.config({
}
return '';
}},
{ field: 'showType', title: '显示类型', align: 'left', width: 120, templet: function (d) {
var showType = dsFormUtil.getShowType(d);
return skyeyeClassEnumUtil.getEnumDataNameByCodeAndKey("dsFormShowType", 'id', showType, 'name');
}},
{ field: 'required', title: '限制条件', align: 'left', width: 140 },
{ field: 'modelAttribute', title: '是否模型属性', align: 'center', width: 100, templet: function (d) {
if (d.modelAttribute) {
......
......@@ -68,6 +68,9 @@ layui.config({
// 如果不是入参属性,则不能设置特定的一些值
if (!json.bean.whetherInputParams) {
$('.inputParams').hide();
skyeyeClassEnumUtil.showEnumDataListByClassName("dsFormShowType", 'select', "showType", json.bean.showType, form);
} else {
$('.propertyParams').hide();
}
var id = isNull(json.bean.id) ? '' : json.bean.id;
......@@ -83,6 +86,7 @@ layui.config({
minLength: $("#minLength").val(),
maxLength: $("#maxLength").val(),
remark: $("#remark").val(),
showType: isNull($("#showType").val()) ? "" : $("#showType").val(),
id: id
};
......
......@@ -16,30 +16,40 @@ layui.config({
var rowNum = 1;
$("#tableBox").hide();
var attrMap = {};
AjaxPostUtil.request({url: reqBasePath + "queryAttrDefinitionList", params: {className: parent.objectId}, type: 'json', method: "POST", callback: function (json) {
$("#attrKey").html(getDataUseHandlebars(`<option value="">全部</option>{{#each rows}}<option value="{{attrKey}}">{{name}}</option>{{/each}}`, json));
var str = '<option value="">请选择</option>';
$.each(json.rows, function (i, item) {
if (isNull(item.attrDefinitionCustom) || (isNull(item.attrDefinitionCustom.dsFormComponent) && isNull(item.showType))) {
str += `<option value="{{attrKey}}" disabled="">{{name}}</option>`;
} else {
attrMap[item.attrKey] = item;
str += `<option value="{{attrKey}}">{{name}}</option>`;
}
});
$("#attrKey").html(str);
}, async: false});
skyeyeClassEnumUtil.showEnumDataListByClassName("dsFormShowType", 'select', "showType", '', form);
skyeyeClassEnumUtil.showEnumDataListByClassName("widthScale", 'select', "proportion", '', form);
var alignmentData = skyeyeClassEnumUtil.getEnumDataListByClassName("alignment");
form.on('select(attrKey)', function(data) {
buildTable();
});
form.on('select(showType)', function(data) {
var value = data.value;
if (value == 5) {
$("#tableBox").show();
} else {
if (isNull($("#attrKey").val())) {
$("#tableBox").hide();
} else {
buildTable();
}
buildTable();
});
function getShowType(attrKey) {
var attr = attrMap[attrKey];
return dsFormUtil.getShowType(attr);
}
function buildTable() {
if ($("#showType").val() == 5 && !isNull($("#attrKey").val())) {
var showType = getShowType($("#attrKey").val());
if (showType == 5) {
tableDataList = new Array();
var params = {
className: parent.objectId,
......@@ -113,6 +123,7 @@ layui.config({
} else {
tableDataList = new Array();
table.reloadData("messageTable", {data: tableDataList});
$("#tableBox").hide();
}
}
......@@ -141,7 +152,8 @@ layui.config({
form.render();
form.on('submit(formAddBean)', function (data) {
if (winui.verifyForm(data.elem)) {
if ($("#showType").val() == 5) {
var showType = getShowType($("#attrKey").val());
if (showType == 5) {
if (table.cache.messageTable.length == 0) {
winui.window.msg('请选择表格属性.', {icon: 2, time: 2000});
return false;
......@@ -162,7 +174,6 @@ layui.config({
className: parent.objectId,
attrKey: $("#attrKey").val(),
orderBy: $("#orderBy").val(),
showType: $("#showType").val(),
attrTransformTableList: JSON.stringify(tableDataList),
proportion: $("#proportion").val(),
actFlowId: parent.$("#actFlowId").val(),
......
......@@ -15,19 +15,29 @@ layui.config({
var tableDataList = new Array();
var alignmentData;
var rowNum = 1;
var attrMap = {};
AjaxPostUtil.request({url: reqBasePath + "queryAttrTransformById", params: {id: parent.rowId}, type: 'json', method: "GET", callback: function (json) {
$("#showForm").html(getDataUseHandlebars($("#beanTemplate").html(), json));
AjaxPostUtil.request({url: reqBasePath + "queryAttrDefinitionList", params: {className: parent.objectId}, type: 'json', method: "POST", callback: function (data) {
$("#attrKey").html(getDataUseHandlebars(`<option value="">全部</option>{{#each rows}}<option value="{{attrKey}}">{{name}}</option>{{/each}}`, data));
var str = '<option value="">请选择</option>';
$.each(data.rows, function (i, item) {
if (isNull(item.attrDefinitionCustom) || (isNull(item.attrDefinitionCustom.dsFormComponent) && isNull(item.showType))) {
str += `<option value="{{attrKey}}" disabled="">{{name}}</option>`;
} else {
attrMap[item.attrKey] = item;
str += `<option value="{{attrKey}}">{{name}}</option>`;
}
});
$("#attrKey").html(str);
$("#attrKey").val(json.bean.attrKey);
}, async: false});
skyeyeClassEnumUtil.showEnumDataListByClassName("dsFormShowType", 'select', "showType", json.bean.showType, form);
skyeyeClassEnumUtil.showEnumDataListByClassName("widthScale", 'select', "proportion", json.bean.proportion, form);
alignmentData = skyeyeClassEnumUtil.getEnumDataListByClassName("alignment");
if (json.bean.showType == 5) {
var showType = getShowType($("#attrKey").val());
if (showType == 5) {
$("#tableBox").show();
$.each(json.bean.attrTransformTableList, function(j, item) {
item.id = rowNum;
......@@ -43,7 +53,8 @@ layui.config({
form.render();
form.on('submit(formEditBean)', function (data) {
if (winui.verifyForm(data.elem)) {
if ($("#showType").val() == 5) {
var showType = getShowType($("#attrKey").val());
if (showType == 5) {
if (table.cache.messageTable.length == 0) {
winui.window.msg('请选择表格属性.', {icon: 2, time: 2000});
return false;
......@@ -64,7 +75,6 @@ layui.config({
className: parent.objectId,
attrKey: $("#attrKey").val(),
orderBy: $("#orderBy").val(),
showType: $("#showType").val(),
attrTransformTableList: JSON.stringify(tableDataList),
proportion: $("#proportion").val(),
actFlowId: parent.$("#actFlowId").val(),
......@@ -80,22 +90,22 @@ layui.config({
}, async: false});
form.on('select(attrKey)', function(data) {
tableDataList = new Array();
buildTable();
});
form.on('select(showType)', function(data) {
var value = data.value;
if (value == 5) {
$("#tableBox").show();
} else {
if (isNull($("#attrKey").val())) {
$("#tableBox").hide();
} else {
tableDataList = new Array();
buildTable();
}
tableDataList = new Array();
buildTable();
});
function getShowType(attrKey) {
var attr = attrMap[attrKey];
return dsFormUtil.getShowType(attr);
}
function buildTable() {
if ($("#showType").val() == 5 && !isNull($("#attrKey").val())) {
var showType = getShowType($("#attrKey").val());
if (showType == 5) {
var params = {
className: parent.objectId,
attrKey: $("#attrKey").val()
......@@ -166,7 +176,9 @@ layui.config({
}
});
} else {
tableDataList = new Array();
table.reloadData("messageTable", {data: tableDataList});
$("#tableBox").hide();
}
}
......
......@@ -42,9 +42,6 @@ layui.config({
{ field: 'proportion', title: '宽度比例', align: 'left', width: 120, templet: function (d) {
return skyeyeClassEnumUtil.getEnumDataNameByCodeAndKey("widthScale", 'id', d.proportion, 'name');
}},
{ field: 'showType', title: '显示类型', align: 'left', width: 120, templet: function (d) {
return skyeyeClassEnumUtil.getEnumDataNameByCodeAndKey("dsFormShowType", 'id', d.showType, 'name');
}},
{ field: 'orderBy', title: '排序', align: 'left', width: 100 },
{ field: 'createName', title: systemLanguage["com.skyeye.createName"][languageType], width: 120 },
{ field: 'createTime', title: systemLanguage["com.skyeye.createTime"][languageType], align: 'center', width: 150 },
......
......@@ -63,6 +63,16 @@
</div>
</div>
</div>
<div class="propertyParams">
<div class="layui-form-item layui-col-xs6">
<label class="layui-form-label">显示类型</label>
<div class="layui-input-block">
<select lay-filter="showType" lay-search="" id="showType">
</select>
</div>
</div>
</div>
<div class="layui-form-item layui-col-xs12">
<label class="layui-form-label">备注</label>
<div class="layui-input-block">
......
......@@ -52,14 +52,6 @@
<div class="layui-form-mid layui-word-aux">序号越大越往后。</div>
</div>
</div>
<div class="layui-form-item layui-col-xs6">
<label class="layui-form-label">显示类型<i class="red">*</i></label>
<div class="layui-input-block">
<select lay-filter="showType" lay-search="" id="showType" win-verify="required">
</select>
</div>
</div>
<div class="layui-form-item layui-col-xs12" id="tableBox">
<label class="layui-form-label">表格属性<i class="red">*</i></label>
<div class="layui-input-block">
......
......@@ -58,14 +58,6 @@
<div class="layui-form-mid layui-word-aux">序号越大越往后</div>
</div>
</div>
<div class="layui-form-item layui-col-xs6">
<label class="layui-form-label">显示类型<i class="red">*</i></label>
<div class="layui-input-block">
<select lay-filter="showType" lay-search="" id="showType" win-verify="required">
</select>
</div>
</div>
<div class="layui-form-item layui-col-xs12" id="tableBox">
<label class="layui-form-label">表格属性<i class="red">*</i></label>
<div class="layui-input-block">
......
......@@ -126,13 +126,7 @@ var dsFormUtil = {
// 关联数据
content = dsFormUtil.getContentLinkedData(content);
}
if (!isNull(content.attrDefinition)) {
if (!isNull(content.attrDefinition.attrDefinitionCustom)) {
content.title = content.attrDefinition.attrDefinitionCustom.name;
} else {
content.title = content.attrDefinition.name;
}
}
content.title = dsFormUtil.getLable(content.attrDefinition);
var jsonStr = {bean: content};
var html = getDataUseHandlebars('{{#bean}}' + component.htmlContent + '{{/bean}}', jsonStr);
......@@ -142,6 +136,17 @@ var dsFormUtil = {
return content;
},
getLable: function (attr) {
if (!isNull(attr)) {
if (!isNull(attr.attrDefinitionCustom)) {
return attr.attrDefinitionCustom.name;
} else {
return attr.name;
}
}
return '';
},
getContentLinkedData: function (content) {
var json = {};
if (isNull(content.attrDefinition) || isNull(content.attrDefinition.attrDefinitionCustom)) {
......@@ -375,26 +380,28 @@ var dsFormUtil = {
*/
initSequenceDataDetails: function (customBoxId, rows) {
$.each(rows, function (i, item) {
item.label = dsFormUtil.getLable(item.attrDefinition);
var jsonStr = {
bean: item
};
if (item.showType == 4) { // 图片展示
var showType = dsFormUtil.getShowType(item.attrDefinition);
if (showType == 4) { // 图片展示
var photoValue = [];
if (!isNull(jsonStr.bean.displayValue)) {
photoValue = item.displayValue.split(",");
}
var rows = [];
$.each(photoValue, function(j, row){
$.each(photoValue, function(j, row) {
rows.push({photoValue: row});
});
jsonStr.bean.photo = rows;
}
// 加载html
var str = getDataUseHandlebars(dsFormUtil.showType[item.showType], jsonStr);
var str = getDataUseHandlebars(dsFormUtil.showType[showType], jsonStr);
$("#" + customBoxId).append(str);
if (item.showType == 5) { // 表格展示
if (showType == 5) { // 表格展示
var table = layui.table;
table.render({
id: "messageTable" + item.orderBy,
......@@ -403,7 +410,7 @@ var dsFormUtil = {
page: false,
cols: dsFormUtil.getTableHead(item.attrTransformTableList)
});
} else if (item.showType == 6) { // 凭证展示
} else if (showType == 6) { // 凭证展示
var boxId = "showVoucher" + item.orderBy;
// 初始化凭证
voucherUtil.initDataDetails(boxId, item.value);
......@@ -411,6 +418,17 @@ var dsFormUtil = {
});
},
getShowType: function (attr) {
if (!isNull(attr.attrDefinitionCustom)) {
if (!isNull(attr.attrDefinitionCustom.dsFormComponent)) {
return attr.attrDefinitionCustom.dsFormComponent.showType;
} else {
return attr.attrDefinitionCustom.showType;
}
}
return null;
},
getTableHead: function (attrTransformTableList) {
var header = [];
$.each(attrTransformTableList, function (i, item) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册