You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1290 lines
54 KiB
Plaintext

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!DOCTYPE html>
<html lang="cn">
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link href="../Comm/fonts/font-icons.min.css" rel="stylesheet" />
<title>正在加载请稍候...</title>
<script src="../Scripts/jquery-1.11.0.min.js" type="text/javascript"></script>
<!--表单样式-->
<link href="../Admin/CSS/FoolFrmBody.css" rel="stylesheet" />
<link href="../../DataUser/Style/FoolFrmStyle/Default.css" rel="stylesheet" />
<!-- layui -->
<link rel="stylesheet" type="text/css" href="../../WF/Portal/icons/font-icons.min.css">
<link rel="stylesheet" type="text/css" href="../../WF/Portal/icons/icons.css">
<link rel="stylesheet" type="text/css" href="../../WF/Portal/layui/css/layui.css">
<link rel="stylesheet" type="text/css" href="../../WF/Portal/layui/css/customer.css">
<link href="../Scripts/layui/layui/css/layui.css" rel="stylesheet" />
<link href="../Scripts/layui/style/admin.css" rel="stylesheet" />
<link href="../Scripts/layui/layui/css/autocomplete.css" rel="stylesheet" />
<script src="../Scripts/layui/LayuiDialog.js" type="text/javascript"></script>
<script src="../Scripts/jquery-form.js" type="text/javascript"></script>
<!--通用的JS-->
<script src="../Scripts/config.js" type="text/javascript"></script>
<script src="../Comm/Gener.js" type="text/javascript"></script>
<script src="../Scripts/QueryString.js" type="text/javascript"></script>
<script src="./JS/tinymce/tinymce.min.js"></script>
<script src="JS/jquery.mousewheel.min.js"></script>
<script src="ChapterFrmGener.js"></script>
<script src="../Scripts/Tools/jsPdf.debug.js"></script>
<script src="../Scripts/Tools/html2canvas.js"></script>
<script src="../../WF/CCForm/FrmFool.js"></script>
<script src="../../WF/CCForm/FrmEnd.js"></script>
<script src="../Comm/JScript.js"></script>
<script src="../../WF/Portal/layui/layui.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
var frmID = null;
var oid = null;
var key = null;
var logInde;
var eleDom = null;
var eleOneDom = null;
let OId = null;
var nodeRates = null;
var Tree = null;
var groupFields = null;
var attrs = null;
var treeClick = null;
var isReadonly = 0; //是否只读?
var mainTable;//表单数据
var pageData = {};
var form = layui.form;
layui.use(['tree', 'jquery', 'laypage', 'form'], function () {
var tree = layui.tree, $ = layui.jquery;
var name = null;
var treelist = null;
var Tip = null;
var Tree_set = null;
//页面启动函数.
$(function () {
isReadonly = GetQueryString("IsReadonly");
if (isReadonly == null) {
isReadonly = 0;
pageData.IsReadonly = 0;
}
frmID = GetQueryString("FrmID");
if (frmID == null)
frmID = GetQueryString("FK_MapData");
if (frmID == null)
frmID = "Frm_ZhangJieBiaoDAN";
oid = GetQueryString("OID");
if (oid == null)
oid = GetQueryString("WorkID");
if (oid == null)
oid = GetQueryString("PKVal");
if (oid == null)
oid = 100;
var handler = new HttpHandler("BP.WF.HttpHandler.WF_CCForm");
handler.AddPara("FrmID", frmID);
handler.AddPara("OID", oid);
var data = handler.DoMethodReturnJSON("ChapterFrm_Init");
console.log(data)
groupFields = data["GroupFields"];//章.
attrs = data["Sys_MapAttr"];//节.
mainTable = data["MainTable"][0];
var group = [];
//形成数据.
for (var i = 0; i < groupFields.length; i++) {
var gf = groupFields[i];
if (gf.ParentOID == null || gf.ParentOID == undefined || gf.ParentOID == "") {
gf.children = [];
var list = {
title: gf.Lab,
id: gf.OID,
field: gf.Lab,
children: gf.children,
attrChildren: [],
spread: true,
checked: false,
...gf
}
for (var j = 0; j < groupFields.length; j++) {
var jie = groupFields[j];
if (jie.ParentOID == list.OID.toString()) {
jie.children = [];
jie.attrChildren = [];
var jieList = {
title: jie.Lab,
id: jie.OID,
field: jie.Lab,
children: jie.children,
attrChildren: [],
spread: true,
checked: false,
...jie
}
var n = 0;
for (var idx = 0; idx < attrs.length; idx++) {
var attr = attrs[idx];
if (attr.MyDataType != 1 && list.CtrlType == "")
continue;
if (attr.KeyOfEn.indexOf("Ath") > -1)
continue;
if (attr.UIVisible == 0)
continue;
var clist = {
title: attr.Name,
id: attr.KeyOfEn,
field: attr.Name,
checked: false,
Snumber: '',
...attr
}
if (attr.UIContralType == 1) {//如果是下拉框,存储下拉列表值
if (attr.MyDataType == 2)
clist.DDLlist = $.grep(data['Sys_Enum'], function (item, index) {
return item.EnumKey == attr.KeyOfEn;
});
else if (attr.MyDataType == 1)
clist.DDLlist = data[attr.KeyOfEn];
}
else if (attr.UIContralType == 3 && attr.MyDataType == 2) {
clist.DDLlist = $.grep(data['Sys_Enum'], function (item, index) {
return item.EnumKey == attr.KeyOfEn;
});
}
if (clist.GroupID == jieList.OID.toString()) {
if (jieList.CtrlType != "Attr")
jieList.children.push(clist)
else if (jieList.CtrlType == "Attr") {
jieList.attrChildren.push(clist);
}
n = n + 1
clist.Snumber = n;
}
}
list.children.push(jieList);
}
}
var m = 0;
for (var k = 0; k < attrs.length; k++) {
var attr = attrs[k];
if (attr.MyDataType != 1 && list.CtrlType == "")
continue;
if (attr.KeyOfEn.indexOf("Ath") > -1)
continue;
if (attr.UIVisible == 0)
continue;
var clist = {
title: attr.Name,
id: attr.KeyOfEn,
field: attr.Name,
checked: false,
Snumber: '',
...attr
}
if (attr.UIContralType == 1) {//如果是下拉框,存储下拉列表值
if (attr.MyDataType == 2)
clist.DDLlist = $.grep(data['Sys_Enum'], function (item, index) {
return item.EnumKey == attr.KeyOfEn;
});
else if (attr.MyDataType == 1)
clist.DDLlist = data[attr.KeyOfEn];
}
else if (attr.UIContralType == 3 && attr.MyDataType == 2) {
clist.DDLlist = $.grep(data['Sys_Enum'], function (item, index) {
return item.EnumKey == attr.KeyOfEn;
});
}
if (clist.GroupID == list.OID.toString()) {
if (list.CtrlType != "Attr")
list.children.push(clist)
else if (list.CtrlType == "Attr") {
list.attrChildren.push(clist);
}
m = m + 1
clist.Snumber = m;
}
}
group.push(list);
}
}
console.log(group)
function tinyInit() {
tinymce.init({
selector: '#mytextarea',
language: 'zh-Hans',
plugins: [
'advlist', 'saveBtn',
'lists', 'image', 'charmap', 'searchreplace', 'visualblocks',
'table',
],
statusbar: false,
branding: false,
image_advtab: false,
image_description: false,
image_dimensions: false,
toolbar: 'undo redo | formatpainter casechange blocks | bold italic backcolor | ' +
'alignleft aligncenter alignright alignjustify | ' +
'bullist numlist checklist outdent indent | removeformat | saveBtn ',
images_upload_handler: function (blobInfo) {
try {
var handler = new HttpHandler("BP.WF.HttpHandler.WF_Comm_Sys");
handler.AddPara("Files", blobInfo.blob());
handler.AddPara("FrmID", frmID)
handler.AddPara("OID", oid)
var data = handler.DoMethodReturnJSON("RichUploadFile");
var serverPath = window.location.origin + "/" + data.data
return Promise.resolve(serverPath)
} catch (e) {
return Promise.reject(e)
}
},
paste_data_images: true,
init_instance_callback: function (editor) {
editor.on('ExecCommand', function (e) {
if (e.command === "mceInsertContent") {
// handleWordPaste()
// console.log(e)
if (e.value.content.includes("file:///")) {
layer.msg("检测到本地文件,请右键图片替换")
}
}
});
var sdata = ChapterFrmShow(key);
editor.setContent(sdata);
},
});
}
function IniAttr(group) {
var handler = new HttpHandler("BP.WF.HttpHandler.WF_CCForm");
handler.AddPara("FK_MapData", frmID);
handler.AddPara("OID", GetQueryString("WorkID"));
var result = handler.DoMethodReturnString("ChapterFrm_AttrInit");
if (result.indexOf('err@') == -1) {
data.MainTable[0] = JSON.parse(result);
}
var attrhtm = "";
attrhtm += '<div id="Group_' + group.OID + '">';
attrhtm += InitMapAttr(data, 4, group.OID);
attrhtm += '</div>';
$("#divCCForm").html(attrhtm);
//装载表单数据与修改表单元素风格.
LoadFrmDataAndChangeEleStyle(data);
//渲染表单
form.render();
form.render('checkbox');
//解析表单的扩展功能
AfterBindEn_DealMapExt(data);
$.each($(".ccdate"), function (i, item) {
var format = $(item).attr("data-info");
var type = $(item).attr("data-type");
if (format.indexOf("HH") != -1) {
layui.laydate.render({
elem: '#' + item.id,
format: $(item).attr("data-info"), //可任意组合
type: type,
trigger: 'click',
ready: function (date) {
var now = new Date();
var mm = "";
if (now.getMinutes() < 10)
mm = "0" + now.getMinutes();
else
mm = now.getMinutes();
var ss = "";
if (now.getSeconds() < 10)
ss = "0" + now.getSeconds();
else
ss = now.getSeconds();
this.dateTime.hours = now.getHours();
this.dateTime.minutes = mm;
this.dateTime.seconds = ss;
},
change: function (value, date, endDate) {
$('.laydate-btns-confirm').click();
},
done: function (value, date, endDate) {
var data = $(this.elem).data();
$(this.elem).val(value);
if (data && data.ReqDay != null && data.ReqDay != undefined)
ReqDays(data.ReqDay);
}
});
} else {
layui.laydate.render({
elem: '#' + item.id,
format: $(item).attr("data-info"), //可任意组合
type: type,
done: function (value, date, endDate) {
var data = $(this.elem).data();
$(this.elem).val(value);
if (data && data.ReqDay != null && data.ReqDay != undefined)
ReqDays(data.ReqDay);
}
});
}
})
$("#toIframe").hide();
$("#textRea").hide();
$("#divCCForm").show();
$("#welcome").hide();
}
function iframeFun(id, url, OId, item,checked) {
console.log(item);
console.log(url);
var myframe = document.getElementById(id).contentWindow;
if (myframe.Save != undefined) {
myframe.Save();
//if (checked)
//CheckGroupFieldStr(OId, item);
}
if (myframe.SaveAll != undefined) {
myframe.SaveAll();
//if (checked)
//CheckGroupFieldStr(OId, item);
}
$("#toIframe").show();
$("#toIframe").attr("src", url);
$("#textRea").hide();
$("#divCCForm").hide();
}
// tree 点击事件
treeClick = (obj) => {
$("#welcome").hide();
$("#textRea").hide();
$('.layui-tree-set').removeClass("tree-txt-active");
if (!obj.data.children) {
tinyInit();
$("#toIframe").hide();
$("#divCCForm").hide();
$("#textRea").show();
if (name !== obj.data.Name) {
Tip = obj.data.Tip;
name = obj.data.Name;
$("#Title").html(name);
getContent(obj.data.KeyOfEn);
eleDom = $(obj.elem[0]).find(".rate");
}
$(obj.elem[0]).addClass("tree-txt-active");
Savetab(OId, eleOneDom)
} else {
$("#welcome").hide();
getContent(key);
Save();
var url = '';
//如果点击章.
if (obj.data.CtrlType == "Dtl") {
url = Ele_Dtl_Chapter(obj.data.CtrlID);
}
if (obj.data.CtrlType == "Attr") {
IniAttr(obj.data);
}
if (obj.data.CtrlType == "Ath") {
url = basePath + "/WF/CCForm/Ath.htm?1=1&AthPK=" + obj.data.CtrlID + "&OID=" + oid + "&FK_MapData=" + frmID + "&FK_Node=" + GetQueryString("FK_Node");
}
if (obj.data.CtrlType == "ChapterFrmLinkFrm") {
url = basePath + "/WF/CCForm/Frm.htm?1=1&FrmID=" + obj.data.CtrlID + "&OID=" + oid + "&FK_MapData=" + obj.data.CtrlID + "&FK_Node=" + GetQueryString("FK_Node");
}
if (obj.data.CtrlType == "ChapterFrmSelfUrl") {
if (obj.data.CtrlID.indexOf('http') == 0)
url = obj.data.CtrlID + "&OID=" + oid + "&FK_MapData=" + frmID + "&FK_Node=" + GetQueryString("FK_Node");
else
url = basePath + "" + obj.data.CtrlID + "&OID=" + oid + "&FK_MapData=" + frmID + "&FK_Node=" + GetQueryString("FK_Node");
}
if (obj.data.CtrlType == '') {
return;
}
eleOneDom = obj.elem;
OId = obj.data.OID;
var logChecked;//是否检查打勾
if (obj.data.CtrlType != "Attr") {
console.log(obj.data.CtrlType, obj.data.children.length);
if ((obj.data.CtrlType == "" || obj.data.CtrlType == null) && obj.data.children.length == 0) {
logChecked = false;
} else {
logChecked = true;
}
iframeFun("toIframe", url, OId, eleOneDom, logChecked);
} else {
//CheckGroupFieldStr(OId, eleOneDom);
}
$('.layui-tree-set').removeClass("tree-txt-active");
$(obj.elem[0]).addClass("tree-txt-active");
}
}
Tree = tree.render({
elem: '#test1',
data: group,
id: 'treeId',
click: function (obj) {
treeClick(obj)
}
});
// 判断第一项是否有子集 并选中状态 跳转iframe页面
function treeSet() {
treelist = document.querySelectorAll('.layui-tree-pack >.layui-tree-set');
treelist.forEach((item, index) => {
db.push({
"attrKey": item.dataset.id,
"vals": '',
});
})
Tree_set = document.querySelectorAll('.layui-tree>.layui-tree-set');
Tree_set.forEach((item, index) => {
$(item).attr("title", group[index].title);
$(item).attr("id", "Pnode" + group[index].OID);
var main = $(item).find('.layui-tree-pack ');
var h = `<i class="icon-check rate"></i>`;
$(item).find(".layui-tree-main").append(h);
//替换 tree icon
if (item.childNodes.length == 1) {
var sclass = $(item).find('.layui-tree-iconClick');
$(sclass).empty();
if (group[index].CtrlType == "Dtl") {
// let i = `<i class="icon-notebook"></i>`
let i = `<i class="icon-folder"></i>`
$(sclass).html(i);
}
if (group[index].CtrlType == "Attr") {
// let i = `<i class="icon-notebook"></i>`
let i = `<i class="icon-folder"></i>`
$(sclass).html(i);
}
if (group[index].CtrlType == "Ath") {
let i = `<i class="icon-paper-clip"></i>`
$(sclass).html(i);
}
if (group[index].CtrlType == "ChapterFrmLinkFrm") {
let i = `<i class="icon-folder"></i>`
$(sclass).html(i);
}
if (group[index].CtrlType == "ChapterFrmSelfUrl") {
let i = `<i class="icon-folder"></i>`
$(sclass).html(i);
}
} else {
var sclass = $(item).find('.layui-tree-iconClick');
$(sclass).empty();
$(sclass).removeClass("layui-tree-icon")
let i = `<i class="icon-folder"></i>`
$(sclass).html(i);
}
//下方是选取第一个元素,待实现
//默认第一个选中
/*
if (index == 0) {
var firstShow = group[index];//第一个显示的内容
console.log('一级目录1',group[index]);
if (group[index].children && group[index].children.length > 0) {
firstShow = group[index].children[0];
console.log('二级目录1', group[index].children[0]);
if (group[index].children[0].children && group[index].children[0].children.length > 0) {
firstShow = group[index].children[0].children[0];
console.log('二级目录1', group[index].children[0].children[0]);
}
}
console.log('第一个显示的内容:', firstShow);
var firstShowDom;//第一个显示的元素
if ($(item).find('.layui-tree-pack>.layui-tree-set').length > 0) {
firstShowDom = item;//第一个显示的元素
console.log('一级元素', $(firstShowDom).attr('data-id'));
var levelFirst = item;
if ($(levelFirst).find('.layui-tree-pack>.layui-tree-set').length > 0) {
firstShowDom = $(levelFirst).find('.layui-tree-pack>.layui-tree-set')[0];
console.log('二级元素', $(firstShowDom).attr('data-id'));
var levelTow = $(levelFirst).find('.layui-tree-pack>.layui-tree-set')[0];
//if ($(levelTow).find('.layui-tree-pack>.layui-tree-set').length > 0) {
// firstShowDom = $(levelTow).find('.layui-tree-pack>.layui-tree-set')[0];
// console.log('三级元素', $(firstShowDom).attr('data-id'));
//}
}
}
console.log('第一个显示的元素:', $(firstShowDom).attr('data-id'));
if ($(firstShowDom).find('.layui-tree-pack>.layui-tree-set').length == 0) {
alert();
$('.layui-tree-set').removeClass("tree-txt-active");
$(firstShowDom).addClass("tree-txt-active");
var url = '';
//如果点击章.
if (firstShow.CtrlType == "Dtl") {
url = Ele_Dtl_Chapter(firstShow.CtrlID);
}
if (firstShow.CtrlType == "Attr") {
alert('第一个显示填报合同');
IniAttr(firstShow);
}
if (firstShow.CtrlType == "Ath") {
url = basePath + "/WF/CCForm/Ath.htm?1=1&AthPK=" + firstShow.CtrlID + "&OID=" + oid + "&FK_MapData=" + frmID + "&FK_Node=" + GetQueryString("FK_Node");
}
if (firstShow.CtrlType == "ChapterFrmLinkFrm") {
url = basePath + "/WF/CCForm/Frm.htm?1=1&FrmID=" + firstShow.CtrlID + "&OID=" + oid + "&FK_MapData=" + firstShow.CtrlID + "&FK_Node=" + GetQueryString("FK_Node");
}
if (firstShow.CtrlType == "ChapterFrmSelfUrl") {
if (firstShow.CtrlID.indexOf('http') == 0)
url = firstShow.CtrlID + "&OID=" + oid + "&FK_MapData=" + frmID + "&FK_Node=" + GetQueryString("FK_Node");
else
url = basePath + "" + firstShow.CtrlID + "&OID=" + oid + "&FK_MapData=" + frmID + "&FK_Node=" + GetQueryString("FK_Node");
}
if (firstShow.CtrlType == '') {
return;
}
eleOneDom = firstShowDom;
OId = firstShow.OID;
if (firstShow.CtrlType != "Attr")
iframeFun("toIframe", url, OId, eleOneDom);
} else {
alert('第一个显示文本内容');
firstShowDom.checked = true;
firstShowDom.children[index].checked = true;
key = firstShow.KeyOfEn;
tinyInit();
treelist[index].classList.add("tree-txt-active");
name = firstShow.Name;
$("#Title").html(name)
getContent(treelist[index].dataset.id);
Tip = firstShow.Tip;
eleDom = $(treelist[index]).find(".rate");
}
}*/
})
showType(group, Tree_set)
}
treeSet();
$("#tips").click(function () {
openDialog(Tip, key);
})
//IsAtPara(attrs, treelist);
//IsAtParaKey(group, Tree_set);
var isShows = true;
$("#menu").toggle();
$("#menuShow").click(function () {
$("#menu").toggle();
if (isShows) {
$("#scrollDiv").addClass("Card_body")
isShows = false
} else {
$("#scrollDiv").removeClass("Card_body")
isShows = true
}
})
$("#scrollDiv").on("mousewheel", function (event, delta) {
console.log(event)
console.log(delta)
event.preventDefault();
if (delta > 0) {
tabChange("up")
} else {
tabChange("down")
}
return false;
});
//监听滚动条事件
ArcScorll("#toIframe")
//setTimeout(ArcScorll('#mytextarea_ifr'), 3000)
});
function showType(group, Tree_set) {
//console.log(Tree_set)
let n = 0;
group.forEach((item, index) => {
if (item.ShowType == 2) {
n = n + 1;
const Id = Tree_set[index].dataset.id;
console.log($(`#Pnode${Id}`))
$(`#Pnode${Id}`).hide()
}
})
if (n == group.length) {
$("#menuShow").hide()
}
}
// 解析
function analysis(Tip) {
let tipArr = Tip.split("@");
let tempul = `<ul class="tipsul">
${tipArr.map(item => {
if (item.includes('###')) {
return `<li class="m-1"><h3>${item.split("###").join('')}</h3></li>`
} else if (item.includes(')')) {
return `<li class="m-1"><small>${item.split("###").join('')}</small></li>`
} else {
return `<li class="m-1">${item.split("###").join('')}</li>`
}
}).join('')}
</ul>`
Tip = tempul;
return Tip;
}
tinymce.PluginManager.add('saveBtn', function (editor, url) {
// 注册一个保存按钮名称
editor.ui.registry.addButton("saveBtn", {
text: '保存',
icon: 'save',
onAction: function () {
var vals = tinymce.activeEditor.getContent();
if (key == undefined || key == '') {
layer.msg('请先选择子节点', { icon: 6 });
return;
} else {
ChapterFrmSave(key, vals)
}
}
})
});
tinymce.PluginManager.add('helpBtn', function (editor, url) {
editor.ui.registry.addButton('helpBtn', {
text: '提示',
icon: 'help',
onAction: function () {
openDialog(editor);
}
});
});
var keylist = [];
function IsAtPara(attrs, list) {
attrs.forEach(item => {
if (item.AtPara != null && item.AtPara != "") {
if (item.AtPara.includes('@IsStar')) {
keylist.push(item.KeyOfEn);
}
}
})
showRate(list)
}
function showRate(list) {
list.forEach(item => {
var keyId = $(item).data("id");
if (keylist.includes(keyId)) {
var rate = $(item).find(".rate");
$(rate).show()
}
})
}
var Kylist = [];
function IsAtParaKey(attr, list) {
attr.forEach(item => {
if (item.AtPara != null) {
if (item.AtPara.includes('@IsStar')) {
Kylist.push(item.title);
}
}
})
keyshowRate(list)
}
function keyshowRate(list) {
list.forEach(item => {
var title = item.title;
if (Kylist.includes(title)) {
if (item.children.length == 1) {
var rate = $(item).find(".rate");
$(rate).show()
} else {
var rate = $(item.children[0]).find(".rate");
$(rate).show()
}
}
})
}
function openDialog(tip, keyOfEn) {
if (tip == null || tip == '') {
var mypk = "FieldNameLink_" + frmID + "_" + keyOfEn;
var mapExt = new Entity("BP.Sys.MapExt");
mapExt.MyPK = mypk;
var i = mapExt.RetrieveFromDBSources();
if (i == 0) {
alert('没有设置帮助.');
return;
}
tip = TransbrString(mapExt.Doc);
var tips = `<div style="padding:30px">${tip}</div>`;
layer.open({
type: 1,
title: '填报提示',
area: ['1000px', '400px'],
shade: 0.4,
content: tips,
})
} else {
tip = analysis(tip);
var tips = `${tip}`;
layer.open({
type: 1,
title: '填报提示',
area: ['500px', '300px'],
shade: 0.4,
content: tips,
})
}
}
//获得从表的url.
function Ele_Dtl(frmID) {
var frmDtl = new Entity("BP.Sys.MapDtl", frmID);
var src = "";
var href = GetHrefUrl();
var urlParam = href.substring(href.indexOf('?') + 1, href.length);
urlParam = urlParam.replace('&DoType=', '&DoTypeDel=xx');
var ensName = frmDtl.No;
if (ensName == undefined) {
layer.alert('系统错误,请找管理员联系');
return;
}
var currentURL = GetHrefUrl();
var baseUrl = "./";
if (currentURL.indexOf("AdminFrm.htm") != -1)
baseUrl = "../../CCForm/";
if (currentURL.indexOf("MyBill.htm") != -1 || currentURL.indexOf("MyDict.htm") != -1)
baseUrl = "../CCForm/";
if (currentURL.indexOf("FrmGener.htm") != -1 || currentURL.indexOf("FrmDBVer.htm") != -1 || currentURL.indexOf("DtlFrm.htm") != -1)
baseUrl = "./";
//表格模式
if (frmDtl.ListShowModel == "0")
src = baseUrl + "Dtl2017.htm?1=1";
if (frmDtl.ListShowModel == "1")
src = baseUrl + "DtlCard.htm?1=1";
if (frmDtl.ListShowModel == "2") {
if (frmDtl.UrlDtl == null || frmDtl.UrlDtl == undefined || frmDtl.UrlDtl == "")
return "从表" + frmDtl.Name + "没有设置URL,请在" + frmDtl.FK_MapData + "_Self.js中解析";
src = basePath + "/" + frmDtl.UrlDtl;
if (src.indexOf("?") == -1)
src += "?1=1";
}
src += "&IsShowVerBtn=1&EnsName=" + frmDtl.No + "&RefPKVal=" + oid + "&FK_MapData=" + frmID + "&IsReadonly=" + (isReadonly == true ? 1 : 0) + "&" + urlParam + "&Version=1&FrmType=0";
return src;
}
var currData = null;
function ChapterFrmShow(attrKey) {
if (attrKey == null || attrKey == "") {
//alert("字段值为空.");
return;
}
var handler = new HttpHandler("BP.WF.HttpHandler.WF_CCForm");
handler.AddPara("FrmID", frmID);
handler.AddPara("OID", oid);
handler.AddPara("KeyOfEn", attrKey);
var data = handler.DoMethodReturnString("ChapterFrm_InitOneField");
// tinymce.activeEditor.setContent(data)
currData = data; //记录当前的变量.
return data;
}
/**
* 节的数据保存..
* @param attrKey
* @param vals
*/
function ChapterFrmSave(attrKey, vals) {
if (attrKey == null || attrKey == "") {
return;
}
//if (vals == currData) return;
var oldVal = getOldVal(attrKey);
//判断内存的值是否更新
var oldvals = TransferString(oldVal.vals);
if (Object.is(vals, oldvals))
return; //数据没有变化.
var loading = layer.msg('正在保存中', { icon: 16, shade: 0.3 });
var handler = new HttpHandler("BP.WF.HttpHandler.WF_CCForm");
handler.AddPara("FrmID", frmID);
handler.AddPara("OID", oid);
handler.AddPara("KeyOfEn", attrKey);
handler.AddPara("Vals", vals);
const data = handler.DoMethodReturnString("ChapterFrm_SaveOneField");
if (data.indexOf('err@') == 0) {
alert(data);
return;
}
console.log(data);
if (data == "1") {
$(eleDom).show(); //显示star.
} else {
$(eleDom).hide(); //隐藏star.
}
layer.close(loading);
// 更新内存的值.
changeDBval(vals, attrKey);
//设置父级star.
SetParentStar(attrKey);
}
function SetParentStar(attrKey) {
var groupID = null;
for (var i = 0; i < attrs.length; i++) {
var attr = attrs[i];
if (attr.KeyOfEn == attrKey) {
groupID = attr.GroupID;
break;
}
}
var PraEle = $(`#Pnode${groupID}>.layui-tree-entry`);
var raEle = $(PraEle).find(".rate");
var pack = $(`#Pnode${groupID}>.layui-tree-pack`);
nodeRates = $(pack).find(".rate");
//获得节点集合.
var isHaveBlank = false;
var listnode = [];
for (var i = 0; i < nodeRates.length; i++) {
var BleaStr = nodeRates[i].style.display == "inline";
if (BleaStr) {
listnode.push(nodeRates[i])
}
}
if (listnode.length !== nodeRates.length) {
isHaveBlank = true;
}
//给父节点加star.
if (isHaveBlank == false) {
$(raEle).show();
} else {
$(raEle).hide();
}
}
$('#View').click(function () {
if (key == undefined || key == '') {
layer.msg('请先选择子节点', { icon: 6 });
return;
} else {
var url = "ChapterFrmView.htm?FrmID=" + frmID + "&OID=" + oid + "&attrKey=" + key;
// WinOpenFull(url);
OpenLayuiDialog(url, '', '1200', '', '', false)
}
})
$('#Exp').click(function () {
var url = "ChapterFrmExp.htm?FrmID=" + frmID + "&OID=" + oid + "&attrKey=" + key;
// WinOpenFull(url);
OpenLayuiDialog(url, '', '1200', '', '', false);
layer.load(0, {
shade: [0.6, '#fff'],
content: '下载中...',
success: function (layero) {
layero.find('.layui-layer-content').css({
'padding-top': '35px',
'text-align': 'center',
'z-index': '19891016'
});
}
});
})
function getContent(KeyOfEn) {
//var cdata = ChapterFrmShow(KeyOfEn);
//changeDBval(cdata, KeyOfEn);
//var Cdata = tinymce.activeEditor.getContent();
//ChapterFrmSave(key, Cdata);
//key = KeyOfEn;
//var Data = ChapterFrmShow(key);
//tinymce.activeEditor.setContent(Data);
var cdata = ChapterFrmShow(KeyOfEn);
changeDBval(cdata, KeyOfEn);
var Cdata = '';
if (tinymce.activeEditor !== null) {
Cdata = tinymce.activeEditor.getContent();
}
ChapterFrmSave(key, Cdata);
key = KeyOfEn;
var Data = ChapterFrmShow(key);
if (tinymce.activeEditor !== null) {
tinymce.activeEditor.setContent(Data);
}
// setTimeout(ArcScorll('#mytextarea_ifr'), 3000)
}
//保存当前打开的最后一个章节方法
function Savetab(OId, eleOneDom) {
var iframe = $("#toIframe");
//IFrame的内容
if (iframe.is(":hidden") == true) {
var myframe = iframe[0].contentWindow;
if (myframe && myframe.Save != undefined && typeof (myframe.Save) == "function") {
var flag = myframe.Save();
CheckGroupFieldStr(OId, eleOneDom)
if (flag == false)
return false;
}
if (myframe && myframe.SaveAll != undefined && typeof (myframe.SaveAll) == "function") {
myframe.SaveAll();
CheckGroupFieldStr(OId, eleOneDom)
return true;
}
}
return true;
}
});
function SaveAttr() {
var groupDiv = $('#divCCForm div[id^=Group_]');
if (groupDiv.length == 0)
return true;
var groupId = groupDiv[0].id.replace("Group_", "");
var loading = layer.msg('正在保存中', { icon: 16, shade: 0.3 });
if (checkBlanks() == false && isSend == false) {
//layer.alert("检查必填项出现错误,边框变红颜色的是否填写完整?");
return false;
}
if (CheckReg() == false && isSend == false) {
layer.alert("保存错误:请检查字段边框变红颜色的是否填写完整?");
return false;
}
var handler = new HttpHandler("BP.WF.HttpHandler.WF_CCForm");
handler.AddPara("OID", pageData.OID);
var params = getTreeFormData(true, true);
handler.AddUrlData();
handler.AddJson(params);
handler.AddPara("GroupID", groupId);
var data = handler.DoMethodReturnString("ChapterFrm_SaveAttr");
layer.close(loading);
if (data.indexOf('err@') == 0) {
layer.alert(data);
return false;
}
return true;
}
//保存当前打开的最后一个章节
function Save() {
var textA = $("#textRea");
var iframe = $("#toIframe");
var ccForm = $("#divCCForm");
//保存富文本框的内容
if (textA.is(":hidden") == false) {
var cdata = tinymce.activeEditor.getContent();
if (key == null || key == "") {
return;
}
var handler = new HttpHandler("BP.WF.HttpHandler.WF_CCForm");
handler.AddPara("FrmID", frmID);
handler.AddPara("OID", oid);
handler.AddPara("KeyOfEn", key);
handler.AddPara("Vals", cdata);
handler.DoMethodReturnString("ChapterFrm_SaveOneField");
return;
}
//IFrame的内容
if (iframe.is(":hidden") == false) {
var myframe = iframe[0].contentWindow;
if (myframe && myframe.Save != undefined && typeof (myframe.Save) == "function") {
var flag = myframe.Save();
if (flag == false)
return false;
}
if (myframe && myframe.SaveAll != undefined && typeof (myframe.SaveAll) == "function") {
myframe.SaveAll();
return true;
}
}
if (ccForm.is(":hidden") == false) {
return SaveAttr();
}
return true;
}
//打开设置弹窗
function openSetting() {
var url = 'ChapterSetting.htm?FrmID=' + frmID + '&OID=' + oid;
OpenLayuiDialog(url, '设置', 1000, 100, "auto", true, true, true,modalOkFunc);
}
//弹窗确认函数
function modalOkFunc() {
var showGroupRes = document.getElementById('layui-layer-iframe1').contentWindow.showGroupRes;
var showAttrRes = document.getElementById('layui-layer-iframe1').contentWindow.showAttrRes;
console.log(showGroupRes.join(','), showAttrRes.join(','));
var en = new Entity(frmID, oid);
if (showGroupRes.length != 0)
en.SetPara("ShowGroup", showGroupRes.join(','));
if (showAttrRes.length != 0)
en.SetPara("ShowAttrs", showAttrRes.join(','));
en.Update();
}
</script>
<style type="text/css">
html, body {
height: 100%;
}
.app {
height: 100%;
width: 100%;
display: flex;
}
.border_1 {
border: 1px solid #ccc;
height: 100%;
}
.padding-5 {
padding: 10px;
}
.tree-txt-active {
background: #dcdcdc;
}
.layui-tree-entry .layui-tree-txt {
font-weight: 600;
}
.layui-tree-pack .layui-tree-txt {
font-weight: 300;
}
.layui-tab-title {
text-align: center
}
.layui-tab-content {
padding: 0;
}
.h-100 {
height: 100vh;
overflow: auto;
}
#textRea {
height: 100%;
}
#toIframe {
display: none;
width: 100%;
border: none;
height: 100vh !important;
}
.tipsul {
padding: 20px;
}
.tipsul h3 {
font-weight: bold !important;
margin-bottom: 5px !important;
}
.tipsul li {
font-size: 18px;
}
.tipsul small {
font-size: 16px !important;
margin-left: 20px !important;
}
.labelTitle {
height: 40px;
text-align: center;
padding-right: 28px;
line-height: 40px;
background: #fff;
}
.labelTitle #Title {
font-size: 18px;
font-weight: bold;
}
.layui-right {
float: right;
margin-top: 5px;
}
.layui-row {
/*height: 100vh;*/
}
.tox-tinymce {
height: calc(100% - 40px) !important;
}
::-webkit-scrollbar-thumb {
border-radius: 10px;
-webkit-box-shadow: inset 0 0 6px #999;
background-color: #999;
}
::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 6px #ddd;
border-radius: 10px;
background-color: #F5F5F5;
}
::-webkit-scrollbar {
width: 4px;
height: 0px;
background-color: #F5F5F5;
}
.rate {
color: green;
font-size: 12px;
display: none;
margin-left: 5px;
}
#menu {
display: none;
width: 30%;
}
#scrollDiv {
width: 100%
}
.Card_body {
width: 70%;
}
.welcome {
height: calc(100% - 120px);
background-color: white;
display: flex;
justify-content: center;
align-items: flex-start;
color: #2396e5;
font-size:30px;
}
</style>
</head>
<body>
<div class="layui-row app">
<div id="menu" data-anim="layui-anim-downbit" style="background-color:white;">
<div class="layui-tab layui-tab-brief" lay-filter="docTabBrief">
<div class="layui-tab-content">
<div class="layui-tab-item layui-show">
<!--demo-tree demo-tree-box-->
<div id="test1" class="" style="height: calc(100vh - 30px); overflow-x: auto "></div>
</div>
</div>
</div>
</div>
<div class="h-100" id="scrollDiv" style="overflow-y:hidden">
<div class="layui-tab-title" style="display:flex;justify-content:end;background:#fff">
<div id="elemPage"></div>
<button class="layui-btn layui-btn-primary layui-btn-sm" id="menuShow">目录</button>
<button class="layui-btn layui-btn-primary layui-btn-sm" id="setting" onclick="openSetting()">设置</button>
<button class="layui-btn layui-btn-sm" id="tips">填报提示</button>
<!--<button class="layui-btn layui-btn-primary layui-btn-sm" onclick="tabChange('up')">上一节</button>-->
<!--<button class="layui-btn layui-btn-primary layui-btn-sm" onclick="tabChange('down')">下一节</button>-->
</div>
<div class="layui-form" id="textRea">
<!--<div class="labelTitle">
<span id="Title"></span>
<button class="layui-right layui-btn layui-btn-sm" id="tips">填报提示</button>
</div>-->
<div id="welcome" class="welcome">
<div>
<img src="../../DataUser/ICON/ccbpm.png" width="240"/>
<div>欢迎使用章节表单</div>
</div>
</div>
<textarea id="mytextarea"></textarea>
</div>
<div class="layui-form">
<iframe id="toIframe" frameborder="0" style="width:100%;height:100%"></iframe>
</div>
<!--Attr表单内部信息-->
<div class="layui-fluid fluid">
<div class="layui-row layui-col-space15" id="ContentDiv">
<!-- 内容主体区域 -->
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-body">
<form id="divCCForm" class="layui-form">
<!--加载表单的信息-->
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>