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

动态展示工作流属性参数完成

上级 974ba13d
...@@ -8,99 +8,23 @@ layui.config({ ...@@ -8,99 +8,23 @@ layui.config({
winui.renderColor(); winui.renderColor();
var $ = layui.$, var $ = layui.$,
form = layui.form, form = layui.form,
table = layui.table,
flow = layui.flow; flow = layui.flow;
//流程详情
var processInstanceId = parent.processInstanceId; var processInstanceId = parent.processInstanceId;
var taskType = parent.taskType;
// 时间线审批历史列表模板
$("#activitiTitle").html(taskType);
//时间线审批历史列表模板
var timeTreeApprovalHistory = $("#timeTreeApprovalHistory").html(); var timeTreeApprovalHistory = $("#timeTreeApprovalHistory").html();
var textTemplate = $("#textTemplate").html(),//文本展示
enclosureTemplate = $("#enclosureTemplate").html(),//附件展示
eichTextTemplate = $("#eichTextTemplate").html(),//富文本展示
picTemplate = $("#picTemplate").html(),//图片展示
tableTemplate = $("#tableTemplate").html(),//表格展示
voucherTemplate = $("#voucherTemplate").html();//凭证展示
AjaxPostUtil.request({url: flowableBasePath + "queryBusinessData", params: {processInstanceId: processInstanceId}, type: 'json', method: 'POST', callback: function(json) { AjaxPostUtil.request({url: flowableBasePath + "queryBusinessData", params: {processInstanceId: processInstanceId}, type: 'json', method: 'POST', callback: function(json) {
console.log(json); // 加载业务数据
dsFormUtil.initSequenceDataDetails('showForm', json.rows); dsFormUtil.initSequenceDataDetails('showForm', json.rows);
var jsonStr = "";//实体json对象 // 加载流程图片
var str = "";
$.each(j.rows, function(i, item) {
//如果展示文本不为空,则展示展示文本
if (!isNull(item.text))
item.value = item.text;
jsonStr = {
bean: item
};
if(item.showType == 1){//文本展示
str = getDataUseHandlebars(textTemplate, jsonStr);
} else if (item.showType == 2){//附件展示
str = getDataUseHandlebars(enclosureTemplate, jsonStr);
} else if (item.showType == 3){//富文本展示
str = getDataUseHandlebars(eichTextTemplate, jsonStr);
} else if (item.showType == 4){//图片展示
var photoValue = [];
if (!isNull(jsonStr.bean.value)){
photoValue = item.value.split(",");
}
var rows = [];
$.each(photoValue, function(j, row){
rows.push({photoValue: row});
});
jsonStr.bean.photo = rows;
str = getDataUseHandlebars(picTemplate, jsonStr);
} else if (item.showType == 5){//表格展示
str = getDataUseHandlebars(tableTemplate, jsonStr);
var tableId = "messageTable" + item.orderBy;//表格id
var tableBoxId = "showTable" + item.orderBy;//表格外部div盒子id
$("#showForm").append(str);
$("#" + tableBoxId).html('<table id="' + tableId + '" lay-filter="' + tableId + '"></table>');
if(typeof item.headerTitle == 'object'){
item.headerTitle = JSON.stringify(item.headerTitle);
}
table.render({
id: tableId,
elem: "#" + tableId,
data: $.extend(true, [], getValJson(item.value, '', '')),
page: false,
cols: getValJson(item.headerTitle, '[', ']')
});
str = "";
} else if (item.showType == 6){//凭证展示
str = getDataUseHandlebars(voucherTemplate, jsonStr);
$("#showForm").append(str);
var boxId = "showVoucher" + item.orderBy;
// 初始化凭证
voucherUtil.initDataDetails(boxId, item.value);
str = "";
}else {
str = "";
}
$("#showForm").append(str);
});
//加载流程图片
$("#processInstanceIdImg").attr("src", fileBasePath + 'images/upload/activiti/' + processInstanceId + ".png?cdnversion=" + Math.ceil(new Date()/3600000)); $("#processInstanceIdImg").attr("src", fileBasePath + 'images/upload/activiti/' + processInstanceId + ".png?cdnversion=" + Math.ceil(new Date()/3600000));
//加载审批历史 // 加载审批历史
inboxTimeTreeApprovalHistory(); inboxTimeTreeApprovalHistory();
matchingLanguage(); matchingLanguage();
}}); }});
function getValJson(val, startPrefix, endPrefix){ // 加载审批历史
if(typeof val == 'string'){
val = startPrefix + val + endPrefix;
return JSON.parse(val);
}
return val;
}
// 加载时间线审批历史
function inboxTimeTreeApprovalHistory(){ function inboxTimeTreeApprovalHistory(){
flow.load({ flow.load({
elem: '#timeTreeApprovalHistoryList', elem: '#timeTreeApprovalHistoryList',
......
...@@ -48,7 +48,6 @@ layui.config({ ...@@ -48,7 +48,6 @@ layui.config({
winui.window.msg('请选择表格属性.', {icon: 2, time: 2000}); winui.window.msg('请选择表格属性.', {icon: 2, time: 2000});
return false; return false;
} }
console.log(tableDataList)
$.each(tableDataList, function (i, item) { $.each(tableDataList, function (i, item) {
item.id = null; item.id = null;
item.className = childServiceClassName; item.className = childServiceClassName;
......
...@@ -322,21 +322,14 @@ var dsFormUtil = { ...@@ -322,21 +322,14 @@ var dsFormUtil = {
$("#" + customBoxId).append(str); $("#" + customBoxId).append(str);
if (item.showType == 5) { // 表格展示 if (item.showType == 5) { // 表格展示
var _js = `<script> var table = layui.table;
layui.define(["jquery", 'table'], function(exports) { table.render({
var jQuery = layui.jquery, id: "messageTable" + item.orderBy,
table = layui.table; elem: "#messageTable" + item.orderBy,
table.render({ data: item.displayValue,
id: "messageTable${item.orderBy}", page: false,
elem: "#messageTable${item.orderBy}", cols: dsFormUtil.getTableHead(item.attrTransformTableList)
data: ` + JSON.stringify(item.displayValue) + `, });
page: false,
cols: ` + JSON.stringify(dsFormUtil.getTableHead(item.attrTransformTableList)) + `
});
});
</script>`;
console.log(_js)
$("#" + customBoxId).append(_js);
} else if (item.showType == 6) { // 凭证展示 } else if (item.showType == 6) { // 凭证展示
var boxId = "showVoucher" + item.orderBy; var boxId = "showVoucher" + item.orderBy;
// 初始化凭证 // 初始化凭证
...@@ -352,10 +345,11 @@ var dsFormUtil = { ...@@ -352,10 +345,11 @@ var dsFormUtil = {
field: item.attrKey, field: item.attrKey,
title: item.label, title: item.label,
align: item.align, align: item.align,
width: item.width width: item.width,
templet: null
}; };
if (!isNull(item.templet)) { if (!isNull(item.templet)) {
field['templet'] = item.templet; field['templet'] = eval('(' + item.templet + ')');
} }
header.push(field); header.push(field);
}); });
......
/*时间树,插件:flow*/
@charset "utf-8"; @charset "utf-8";
* { * {
margin: 0; margin: 0;
...@@ -10,10 +11,6 @@ img { ...@@ -10,10 +11,6 @@ img {
border: 0 border: 0
} }
body {
font: 12px/180% Arial, Helvetica, sans-serif, "新宋体"
}
.demo { .demo {
width: 100%; width: 100%;
margin: 15px auto 0; margin: 15px auto 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册