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

表格组件修改

上级 4e831e2e
......@@ -20,7 +20,7 @@ layui.config({
version: skyeyeVersion
}).extend({
window: 'js/winui.window'
}).define(['window', 'jquery', 'winui', 'dragula', 'tagEditor'].concat(dsFormUtil.mastHaveImport), function (exports) {
}).define(['window', 'jquery', 'winui', 'dragula', 'tagEditor', 'table'].concat(dsFormUtil.mastHaveImport), function (exports) {
winui.renderColor();
var index = parent.layer.getFrameIndex(window.name);
var $ = layui.$;
......
......@@ -202,7 +202,7 @@ layui.config({
</div>`,
};
// 详情类布局才展示的组件属性
var detailsPageAttr = ['attrKeyBox', 'titleBox', 'widthBox'];
var detailsPageAttr = ['attrKeyBox', 'titleBox', 'widthBox', 'tableAttrBox'];
// 加载组件关联的属性
$.each(html, function (key, value) {
......@@ -303,7 +303,7 @@ layui.config({
$("body").on("click", "#attrTransformTableListConfig", function() {
parent.temData = $("#attrTransformTableListConfig").parent().attr('data');
parent._openNewWindows({
url: "../../tpl/dsFormPage/editPageContentIsTable.html?attrKey=" + $("#attrKey").val() + '&className=' + parent.className,
url: "../../tpl/dsFormPage/editPageContentIsTable.html?attrKey=" + $("#attrKey").val() + '&className=' + parent.className + '&pageType=' + pageType,
title: '表格属性配置',
pageId: "editPageContentIsTable",
area: ['90vw', '90vh'],
......
......@@ -23,6 +23,7 @@ layui.config({
var parentAttrKey = GetUrlParam("attrKey");
var parentClassName = GetUrlParam("className");
var pageType = GetUrlParam("pageType");
var params = {
className: parentClassName,
attrKey: parentAttrKey
......@@ -46,81 +47,141 @@ layui.config({
{id: "detail", name: "文本"}
];
var cols = [[
{ type: 'checkbox', align: 'center' },
{ field: 'test', title: '', align: 'left', width: 40, templet: function (d) {return '<i class="fa fa-arrows drag-row" />';}},
{ field: 'attrKey', title: '属性<i class="red">*</i>', align: 'left', width: 150, templet: function (d) {
var _html = `<select lay-filter="tableSelect" lay-search="" id="attrKey${d.id}" cus-id="${d.id}" win-verify="required"><option value="">全部</option>`;
$.each(childAttr, function (i, item) {
if (item.attrKey == d.attrKey) {
_html += `<option value="${item.attrKey}" selected="selected">${item.name}</option>`;
} else {
_html += `<option value="${item.attrKey}">${item.name}</option>`;
}
});
_html += `</select>`;
return _html;
}},
{ field: 'name', title: '显示名称<i class="red">*</i>', align: 'left', width: 120, templet: function (d) {
return `<input type="text" id="name${d.id}" placeholder="请填写显示名称" cus-id="${d.id}" win-verify="required" class="layui-input tableInput" ` +
`value="` + (isNull(d.name) ? "" : d.name) + `"/>`;
}},
{ field: 'align', title: '对齐方式<i class="red">*</i>', align: 'left', width: 120, templet: function (d) {
var _html = `<select lay-filter="tableSelect" lay-search="" id="align${d.id}" cus-id="${d.id}" win-verify="required"><option value="">全部</option>`;
$.each(alignmentData.rows, function (i, item) {
if (item.id == d.align) {
_html += `<option value="${item.id}" selected="selected">${item.name}</option>`;
} else {
_html += `<option value="${item.id}">${item.name}</option>`;
var cols;
if (pageType == 'details') {
cols = [[
{ type: 'checkbox', align: 'center' },
{ field: 'test', title: '', align: 'left', width: 40, templet: function (d) {return '<i class="fa fa-arrows drag-row" />';}},
{ field: 'attrKey', title: '属性<i class="red">*</i>', align: 'left', width: 150, templet: function (d) {
var _html = `<select lay-filter="tableSelect" lay-search="" id="attrKey${d.id}" cus-id="${d.id}" win-verify="required"><option value="">全部</option>`;
$.each(childAttr, function (i, item) {
if (item.attrKey == d.attrKey) {
_html += `<option value="${item.attrKey}" selected="selected">${item.name}</option>`;
} else {
_html += `<option value="${item.attrKey}">${item.name}</option>`;
}
});
_html += `</select>`;
return _html;
}},
{ field: 'name', title: '显示名称<i class="red">*</i>', align: 'left', width: 120, templet: function (d) {
return `<input type="text" id="name${d.id}" placeholder="请填写显示名称" cus-id="${d.id}" win-verify="required" class="layui-input tableInput" ` +
`value="` + (isNull(d.name) ? "" : d.name) + `"/>`;
}},
{ field: 'align', title: '对齐方式<i class="red">*</i>', align: 'left', width: 120, templet: function (d) {
var _html = `<select lay-filter="tableSelect" lay-search="" id="align${d.id}" cus-id="${d.id}" win-verify="required"><option value="">全部</option>`;
$.each(alignmentData.rows, function (i, item) {
if (item.id == d.align) {
_html += `<option value="${item.id}" selected="selected">${item.name}</option>`;
} else {
_html += `<option value="${item.id}">${item.name}</option>`;
}
});
_html += `</select>`;
return _html;
}},
{ field: 'width', title: '宽度<i class="red">*</i>', align: 'left', width: 120, templet: function (d) {
return `<input type="text" id="width${d.id}" placeholder="请填写宽度" cus-id="${d.id}" class="layui-input tableInput" win-verify="required|number" ` +
`value="` + (isNull(d.width) ? "" : d.width) + `"/>`;
}},
{ field: 'showType', title: '显示方式<i class="red">*</i>', align: 'left', width: 120, templet: function (d) {
var _html = `<select lay-filter="tableSelect" lay-search="" id="showType${d.id}" cus-id="${d.id}" win-verify="required"><option value="">全部</option>`;
$.each(showType, function (i, item) {
if (item.id == d.showType) {
_html += `<option value="${item.id}" selected="selected">${item.name}</option>`;
} else {
_html += `<option value="${item.id}">${item.name}</option>`;
}
});
_html += `</select>`;
return _html;
}},
{ field: 'dataFrom', title: '数据源', align: 'left', width: 200, templet: function (d) {
var disabledClass = d.showType == showType[2].id ? '' : 'layui-btn-disabled';
var btnName = '选择数据源';
if (!isNull(d.dataType)) {
btnName = '更换数据源';
}
});
_html += `</select>`;
return _html;
}},
{ field: 'layFilter', title: '表单监听Filter', align: 'left', width: 120, templet: function (d) {
return `<input type="text" id="layFilter${d.id}" placeholder="表单监听Filter" cus-id="${d.id}" class="layui-input tableInput" ` +
`value="` + (isNull(d.layFilter) ? "" : d.layFilter) + `"/>`;
}},
{ field: 'width', title: '宽度<i class="red">*</i>', align: 'left', width: 120, templet: function (d) {
return `<input type="text" id="width${d.id}" placeholder="请填写宽度" cus-id="${d.id}" class="layui-input tableInput" win-verify="required|number" ` +
`value="` + (isNull(d.width) ? "" : d.width) + `"/>`;
}},
{ field: 'showType', title: '显示方式<i class="red">*</i>', align: 'left', width: 120, templet: function (d) {
var _html = `<select lay-filter="tableSelect" lay-search="" id="showType${d.id}" cus-id="${d.id}" win-verify="required"><option value="">全部</option>`;
$.each(showType, function (i, item) {
if (item.id == d.showType) {
_html += `<option value="${item.id}" selected="selected">${item.name}</option>`;
} else {
_html += `<option value="${item.id}">${item.name}</option>`;
return `<button id="dataFrom${d.id}" type="button" cus-id="${d.id}" class="chooseDataFrom ${disabledClass}">${btnName}</button>`;
}}
]];
} else {
cols = [[
{ type: 'checkbox', align: 'center' },
{ field: 'test', title: '', align: 'left', width: 40, templet: function (d) {return '<i class="fa fa-arrows drag-row" />';}},
{ field: 'attrKey', title: '属性<i class="red">*</i>', align: 'left', width: 150, templet: function (d) {
var _html = `<select lay-filter="tableSelect" lay-search="" id="attrKey${d.id}" cus-id="${d.id}" win-verify="required"><option value="">全部</option>`;
$.each(childAttr, function (i, item) {
if (item.attrKey == d.attrKey) {
_html += `<option value="${item.attrKey}" selected="selected">${item.name}</option>`;
} else {
_html += `<option value="${item.attrKey}">${item.name}</option>`;
}
});
_html += `</select>`;
return _html;
}},
{ field: 'name', title: '显示名称<i class="red">*</i>', align: 'left', width: 120, templet: function (d) {
return `<input type="text" id="name${d.id}" placeholder="请填写显示名称" cus-id="${d.id}" win-verify="required" class="layui-input tableInput" ` +
`value="` + (isNull(d.name) ? "" : d.name) + `"/>`;
}},
{ field: 'align', title: '对齐方式<i class="red">*</i>', align: 'left', width: 120, templet: function (d) {
var _html = `<select lay-filter="tableSelect" lay-search="" id="align${d.id}" cus-id="${d.id}" win-verify="required"><option value="">全部</option>`;
$.each(alignmentData.rows, function (i, item) {
if (item.id == d.align) {
_html += `<option value="${item.id}" selected="selected">${item.name}</option>`;
} else {
_html += `<option value="${item.id}">${item.name}</option>`;
}
});
_html += `</select>`;
return _html;
}},
{ field: 'layFilter', title: '表单监听Filter', align: 'left', width: 120, templet: function (d) {
return `<input type="text" id="layFilter${d.id}" placeholder="表单监听Filter" cus-id="${d.id}" class="layui-input tableInput" ` +
`value="` + (isNull(d.layFilter) ? "" : d.layFilter) + `"/>`;
}},
{ field: 'width', title: '宽度<i class="red">*</i>', align: 'left', width: 120, templet: function (d) {
return `<input type="text" id="width${d.id}" placeholder="请填写宽度" cus-id="${d.id}" class="layui-input tableInput" win-verify="required|number" ` +
`value="` + (isNull(d.width) ? "" : d.width) + `"/>`;
}},
{ field: 'showType', title: '显示方式<i class="red">*</i>', align: 'left', width: 120, templet: function (d) {
var _html = `<select lay-filter="tableSelect" lay-search="" id="showType${d.id}" cus-id="${d.id}" win-verify="required"><option value="">全部</option>`;
$.each(showType, function (i, item) {
if (item.id == d.showType) {
_html += `<option value="${item.id}" selected="selected">${item.name}</option>`;
} else {
_html += `<option value="${item.id}">${item.name}</option>`;
}
});
_html += `</select>`;
return _html;
}},
{ field: 'require', title: '限制条件', align: 'left', width: 200, templet: function (d) {
return `<div id="require${d.id}" cus-id="${d.id}"></div>`;
}},
{ field: 'dataFrom', title: '数据源', align: 'left', width: 200, templet: function (d) {
var disabledClass = d.showType == showType[2].id ? '' : 'layui-btn-disabled';
var btnName = '选择数据源';
if (!isNull(d.dataType)) {
btnName = '更换数据源';
}
});
_html += `</select>`;
return _html;
}},
{ field: 'require', title: '限制条件', align: 'left', width: 200, templet: function (d) {
return `<div id="require${d.id}" cus-id="${d.id}"></div>`;
}},
{ field: 'dataFrom', title: '数据源', align: 'left', width: 200, templet: function (d) {
var disabledClass = d.showType == showType[2].id ? '' : 'layui-btn-disabled';
var btnName = '选择数据源';
if (!isNull(d.dataType)) {
btnName = '更换数据源';
}
return `<button id="dataFrom${d.id}" type="button" cus-id="${d.id}" class="chooseDataFrom ${disabledClass}">${btnName}</button>`;
}},
{ field: 'value', title: '默认值', align: 'left', width: 120, templet: function (d) {
return `<input type="text" id="value${d.id}" placeholder="默认值" cus-id="${d.id}" class="layui-input tableInput" ` +
`value="` + (isNull(d.value) ? "" : d.value) + `"/>`;
}},
{ field: 'className', title: 'class属性', align: 'left', width: 120, templet: function (d) {
return `<input type="text" id="className${d.id}" placeholder="class属性" cus-id="${d.id}" class="layui-input tableInput" ` +
`value="` + (isNull(d.className) ? "" : d.className) + `"/>`;
}},
{ field: 'iconClassName', title: 'ICON的class属性', align: 'left', width: 150, templet: function (d) {
return `<input type="text" id="iconClassName${d.id}" placeholder="ICON的class属性" cus-id="${d.id}" class="layui-input tableInput" ` +
`value="` + (isNull(d.iconClassName) ? "" : d.iconClassName) + `"/>`;
}},
]]
return `<button id="dataFrom${d.id}" type="button" cus-id="${d.id}" class="chooseDataFrom ${disabledClass}">${btnName}</button>`;
}},
{ field: 'value', title: '默认值', align: 'left', width: 120, templet: function (d) {
return `<input type="text" id="value${d.id}" placeholder="默认值" cus-id="${d.id}" class="layui-input tableInput" ` +
`value="` + (isNull(d.value) ? "" : d.value) + `"/>`;
}},
{ field: 'className', title: 'class属性', align: 'left', width: 120, templet: function (d) {
return `<input type="text" id="className${d.id}" placeholder="class属性" cus-id="${d.id}" class="layui-input tableInput" ` +
`value="` + (isNull(d.className) ? "" : d.className) + `"/>`;
}},
{ field: 'iconClassName', title: 'ICON的class属性', align: 'left', width: 150, templet: function (d) {
return `<input type="text" id="iconClassName${d.id}" placeholder="ICON的class属性" cus-id="${d.id}" class="layui-input tableInput" ` +
`value="` + (isNull(d.iconClassName) ? "" : d.iconClassName) + `"/>`;
}},
]];
}
table.render({
id: 'messageTable',
......
......@@ -7,7 +7,7 @@ layui.config({
version: skyeyeVersion
}).extend({
window: 'js/winui.window'
}).define(['window', 'jquery'], function (exports) {
}).define(['window', 'jquery', 'table'], function (exports) {
winui.renderColor();
var $ = layui.$;
var pageId = GetUrlParam("pageId");
......
......@@ -113,7 +113,7 @@
background-color: #eaeaf6 !important;
}
.center-box-form .layui-form {
.center-box-form>.layui-form {
float: left;
margin-top: 10px;
position: absolute;
......
......@@ -66,7 +66,7 @@ layui.config({
} else if (layEvent === 'edit') { //编辑
edit(data);
} else if (layEvent === 'subApproval') { //提交审核
erpOrderUtil.submitOrderMation(data.id, serviceClassName, data.submitType, serviceClassName, function() {
erpOrderUtil.submitOrderMation(data.id, serviceClassName, function() {
loadTable();
});
} else if (layEvent === 'turnPurchase') { //转采购入库单
......@@ -111,7 +111,7 @@ layui.config({
function details(data) {
rowId = data.id;
_openNewWindows({
url: "../../tpl/purchaseOrder/purchaseOrderDetails.html",
url: systemCommonUtil.getUrl('FP2023042000003&id=' + data.id, null),
title: systemLanguage["com.skyeye.detailsPageTitle"][languageType],
pageId: "purchaseOrderDetails",
area: ['90vw', '90vh'],
......
......@@ -118,33 +118,25 @@ var erpOrderUtil = {
* @param submitType 单据提交类型 1.走工作流提交 2.直接提交
* @param actKey 该地址为 sysServiceMation.json的key
*/
submitOrderMation: function (id, serviceClassName, submitType, actKey, callback) {
submitOrderMation: function (id, serviceClassName, callback) {
layer.confirm('确认要提交吗?', { icon: 3, title: '提交操作' }, function (index) {
layer.close(index);
if (submitType == 1) {
activitiUtil.startProcess(actKey, null, function (approvalId) {
erpOrderUtil.submitOrderMationToData(id, serviceClassName, approvalId, callback);
});
} else {
erpOrderUtil.submitOrderMationToData(id, serviceClassName, "", callback);
}
activitiUtil.startProcess(serviceClassName, null, function (approvalId) {
var params = {
rowId: id,
serviceClassName: serviceClassName,
approvalId: approvalId
};
AjaxPostUtil.request({url: sysMainMation.erpBasePath + "erpcommon006", params: params, method: "PUT", type: 'json', callback: function(json) {
winui.window.msg("提交成功。", {icon: 1, time: 2000});
if (typeof (callback) == "function") {
callback();
}
}});
});
});
},
submitOrderMationToData: function (id, serviceClassName, approvalId, callback) {
var params = {
rowId: id,
serviceClassName: serviceClassName,
approvalId: approvalId
};
AjaxPostUtil.request({url: sysMainMation.erpBasePath + "erpcommon006", params: params, method: "PUT", type: 'json', callback: function(json) {
winui.window.msg("提交成功。", {icon: 1, time: 2000});
if (typeof (callback) == "function") {
callback();
}
}});
},
/**
* 撤销订单信息
*
......
......@@ -387,7 +387,9 @@ var dsFormUtil = {
$("#" + boxId).append(str);
if (showType == 5) { // 表格展示
dsFormTableUtil.intStaticTable("messageTable" + content.orderBy, value, content.attrTransformTableList);
var result = dsFormUtil.resetTableValue(value, content.attrTransformTableList);
console.log(result)
dsFormTableUtil.intStaticTable("messageTable" + content.orderBy, result, content.attrTransformTableList);
} else if (showType == 6) { // 凭证展示
var boxId = "showVoucher" + content.orderBy;
// 初始化凭证
......@@ -398,6 +400,29 @@ var dsFormUtil = {
return content;
},
resetTableValue: function (data, attrTransformTableList) {
if (isNull(data)) {
return [];
}
var result = [];
$.each(data, function (i, itemVal) {
var map = {};
$.each(itemVal, function (key, val) {
var attrTransformTable = getInPoingArr(attrTransformTableList, 'attrKey', key);
if (!isNull(attrTransformTable) &&
(attrTransformTable.showType == 'chooseInput' || attrTransformTable.showType == 'select')) {
var transKey = dsFormUtil.getKeyIdToMation(key);
var itemData = itemVal[transKey];
map[key] = itemData.name;
} else {
map[key] = val;
}
});
result.push(map);
});
return result;
},
checkLoadHandlebar: false,
loadHandlebar: function () {
dsFormUtil.checkLoadHandlebar = true;
......@@ -663,10 +688,14 @@ var dsFormTableUtil = {
var table = layui.table;
table.render({
id: id,
elem: id,
elem: `#${id}`,
data: data,
even: false,
page: false,
cols: dsFormUtil.getTableHead({}, tableColumnList)
limit: 1000,
cols: dsFormTableUtil.getTableHead({
serialNumColumn: true
}, tableColumnList)
});
},
......@@ -762,10 +791,13 @@ var dsFormTableUtil = {
fixed: 'left'
});
}
if (isNull(tableColumnList)) {
return [header];
}
$.each(tableColumnList, function (i, item) {
var field = {
field: item.attrKey,
title: item.label,
title: item.label || item.name,
align: item.align,
width: item.width,
fixed: isNull(item.fixed) ? '' : item.fixed,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册