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.

720 lines
32 KiB
Plaintext

11 months ago
<!DOCTYPE html>
<html>
<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">
<title>实体列表</title>
<!--jquery-->
<script src="../Scripts/jquery-1.11.0.min.js" type="text/javascript"></script>
<!--公共JS-->
<script src="../Scripts/QueryString.js" type="text/javascript"></script>
<script src="../Scripts/config.js" type="text/javascript"></script>
<script src="../Comm/Gener.js" type="text/javascript"></script>
<link href="../Scripts/layui/layui/css/layui.css" rel="stylesheet" />
<link href="../Scripts/layui/style/admin.css" rel="stylesheet" />
<script src="../Scripts/layui/layui/layui.js" type="text/javascript"></script>
<script src="../Scripts/layui/LayuiDialog.js" type="text/javascript"></script>
<script src="Search.js" type="text/javascript"></script>
<script src="../../DataUser/JSLibData/SearchSelf.js"></script>
<script src="../CCForm/MapExt2021.js"></script>
<script src="../Scripts/xss.js"></script>
<style id="theme-data"></style>
<style type="text/css">
xm-select > .xm-body .xm-toolbar {
padding: 0 5px;
}
.layui-tab-title .layui-this:after {
border: 0;
}
.layui-form-label-search {
float: left;
display: block;
min-width: 40px;
font-weight: 400;
line-height: 20px;
text-align: right;
padding: 9px 5px;
}
/* .layui-table-cell {
height: 28px;
line-height: 28px;
padding: 0 15px;
position: relative;
box-sizing: border-box;
}*/
.layui-tab-title li {
margin-top: 3px;
}
.layui-input-span {
padding: 3px 10px;
border: 1px solid #eee;
}
.layui-date-span {
width: 54px;
height: 18px;
font-family: MicrosoftYaHei;
color: rgba(0, 0, 0, 0.85);
line-height: 18px;
}
.layui-form-label {
color: #808080
}
.label-content {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
display: revert !important;
}
.layui-a-this {
line-height: 30px;
height: 30px;
padding: 0px 10px;
}
.dateChoose .layui-tab-title {
border: 0px;
}
.dateChoose .layui-tab-title li {
height: 30px;
line-height: 30px;
border: 0px;
padding: 0px;
}
.dateChoose .layui-tab-content {
padding: 5px 0px;
}
.dateChoose .layui-tab-content a {
display: inline-block;
height: 30px;
line-height: 30px;
margin-top: 3px;
padding: 0px 10px;
}
.dateChoose .layui-tab-content a.layui-a-this:hover {
color: #eeeeee
}
</style>
</head>
<body>
<div class="layui-fluid">
<div class="layui-row layui-col-space30">
<!-- 内容主体区域 -->
<div class="layui-col-md12" style="padding:10px">
<div class="layui-card">
<div class="layui-card-body">
<div id="view"></div>
<table class="layui-hide" id="lay_table_dict" lay-filter="dict"></table>
<div id="page"></div>
</div>
</div>
</div>
</div>
</div>
<script id="toolbar" type="text/html">
<div class="layui-form">
<div class="layui-form-item">
{{# layui.each(d.inputSearch, function(index, item){ }}
<div class="layui-inline">
<label class="layui-form-label-search">{{item.label}}</label>
<div class="layui-input-inline">
<input type="text" class="layui-input" id="TB_{{=item.key}}" name="TB_{{=item.key}}" value="{{item.value}}" />
</div>
</div>
{{# }); }}
{{# layui.each(d.dateSearch, function(index, item){ }}
<div class="layui-inline">
<label class="layui-form-label-search">{{item.dtFromLabel}}</label>
<div class="layui-input-inline">
<i class="input-icon layui-icon layui-icon-date"></i>
<input type="text" class="layui-input ccdate" data-info="{{=item.dtType}}" id="TB_{{=item.dtFromKey}}" name="TB_{{=item.dtFromKey}}" value="{{=item.dtFromValue}}" style="padding-left: 40px;" />
</div>
<label class="layui-form-label-search" style="width:10px">到</label>
<div class="layui-input-inline">
<i class="input-icon layui-icon layui-icon-date"></i>
<input type="text" class="layui-input ccdate" data-info="{{=item.dtType}}" id="TB_{{=item.dtToKey}}" name="TB_{{=item.dtToKey}}" value="{{=item.dtToValue}}" style="padding-left: 40px;" />
</div>
</div>
{{# }); }}
{{# layui.each(d.selectSearch, function(index, item){ }}
<div class="layui-inline">
<label class="layui-form-label-search">{{item.label}}</label>
{{# if(item.showWay==0 && item.isRadioSelect==0){ }}
<div class="layui-input-inline">
<div id="XmlSelect_{{=item.key}}" name="XmlSelect_{{=item.key}}"></div>
</div>
{{# } }}
{{# if(item.showWay==1){ }}
<div class="layui-tab" style="width:auto">
<input type="hidden" id="DDL_{{=item.key}}" />
<ul class="layui-tab-title" id="Tab_{{=item.key}}" style="margin-left:110px;border:0">
{{# layui.each(item.operations, function(k, opt){ }}
<li class="layui-input-span {{# if(opt.value==item.value){}} layui-this{{# } }}" id="{{item.key}}_{{opt.value}}" onclick="SearchBySelect('{{item.key}}','{{opt.value}}')">{{opt.name}}</li>
{{# }); }}
</ul>
</div>
{{# } }}
{{# if(item.showWay==2 ||(item.showWay==0 && item.isRadioSelect==1)){ }}
<div class="layui-input-inline">
<select class="layui-input" id="DDL_{{=item.key}}" name="DDL_{{=item.key}}" data-info="{{item.ShowWay}}" lay-filter="{{=item.key}}" value="{{item.value}}">
{{# layui.each(item.operations, function(k, opt){ }}
<option value="{{opt.value}}" selected="{{=opt.selected}}">{{opt.name}}</option>
{{# }); }}
</select>
</div>
{{# } }}
</div>
{{# }); }}
{{# if(d.dateTabSearch.key!=undefined){}}
<div class="layui-form-item">
<div class="layui-tab dateChoose">
<div class="layui-inline">
<label class="layui-form-label">类别</label>
<ul class="layui-tab-title">
<li class="layui-this" onclick="SearchByDate('month')">月报</li>
<li onclick="SearchByDate('jidu')">季报</li>
<li onclick="SearchByDate('year')">年报</li>
</ul>
</div>
<div class="layui-tab-content">
<div class="layui-tab-item layui-show">
<div class="layui-inline">
<label class="layui-form-label">年度</label>
{{# layui.each(d.dateTabSearch.Year,function(year_idx,year){ }}
<a href="javascript:void(0)" name="{{year}}" class="layui-year {{# if(d.dateTabSearch.value[0]==year){}}layui-a-this{{# } }}" onclick="SearchByDate('month','{{year}}','year',this)" style="margin-right:5px">{{year}}</a>
{{# }); }}
</div>
<div class="layui-inline">
<label class="layui-form-label">月份</label>
{{# layui.each(d.dateTabSearch.Month,function(month_idx,month){ }}
<a href="javascript:void(0)" class="{{# if(d.dateTabSearch.value[1]==month){}}layui-a-this{{# } }}" onclick="SearchByDate('month','{{month}}','month',this)" style="margin-right:5px">{{month}}</a>
{{# }); }}
</div>
</div>
<div class="layui-tab-item">
<div class="layui-inline">
<label class="layui-form-label">年度</label>
{{# layui.each(d.dateTabSearch.Year,function(year_idx,year){ }}
<a href="javascript:void(0)" name="{{year}}" class="layui-year {{# if(d.dateTabSearch.value[0]==year){}}layui-a-this{{# } }}" onclick="SearchByDate('jidu','{{year}}','year',this)" style="margin-right:5px">{{year}}</a>
{{# }); }}
</div>
<div class="layui-inline">
<label class="layui-form-label">季度</label>
{{# layui.each(d.dateTabSearch.JiDu,function(JiDu_idx,jidu){ }}
<a href="javascript:void(0)" class="{{# if(d.dateTabSearch.value[2]==jidu){}}layui-a-this{{# } }}" onclick="SearchByDate('jidu','{{jidu}}','jidu',this)" style="margin-right:5px">{{jidu}}</a>
{{# }); }}
</div>
</div>
<div class="layui-tab-item">
<div class="layui-inline">
<label class="layui-form-label">年度</label>
{{# layui.each(d.dateTabSearch.Year,function(year_idx,year){ }}
<a href="javascript:void(0)" name="{{year}}" class="layui-year {{# if(d.dateTabSearch.value[0]==year){}}layui-a-this{{# } }}" onclick="SearchByDate('year','{{year}}','year',this)" style="margin-right:5px">{{year}}</a>
{{# }); }}
</div>
</div>
</div>
</div>
</div>
{{# } }}
<div class="layui-inline">
<div class="layui-btn-container" style="padding-left: 10px;">
{{# layui.each(d.btns, function(index, item){ }}
<button type="button" style="min-width:50px" class="layui-btn layui-btn-sm" data-type="{{=item.type}}" data-no="{{=item.no}}" data-source="{{=item.source}}">{{item.label}}</button>
{{# }); }}
</div>
</div>
</div>
</div>
</script>
<script>
var frmID = GetQueryString("FrmID");
var ur = null;
var webUser = new WebUser();
var pageIdx = 1;
var pageSize = 10;
var orderBy = "";
var orderWay = "DESC";
var isHaveDelOper = false;
var isHaveSeachOper = false;
var frmDict = new Entity("BP.CCBill.FrmDict", frmID);
var mapData = frmDict;
var listShowWay = mapData.GetPara("ListShowWay");
listShowWay = listShowWay == null || listShowWay == undefined || listShowWay == "" ? "0" : listShowWay;
if (listShowWay != "0") {
SetHref(GetHrefUrl().replace("SearchDict.htm", "SearchTree.htm"));
}
layui.use(['table', 'laytpl', 'form', 'laydate'], function () {
var table = layui.table,
laytpl = layui.laytpl,
form = layui.form,
laydate = layui.laydate;
document.title = frmDict.Name;
//初始化用户查询信息
//当前用户查询信息.
ur = new Entity("BP.Sys.UserRegedit");
ur.MyPK = webUser.No + frmID + "_SearchAttrs";
ur.RetrieveFromDBSources();
//渲染查询条件
var getTpl = document.getElementById("toolbar").innerHTML
, view = document.getElementById('view');
laytpl(getTpl).render(InitToolBar(), function (html) {
view.innerHTML = html;
});
$.each(searchData["selectSearch"], function (i, item) {
if (item.showWay == 0 && item.isRadioSelect == 0) {
xmSelect.render({
el: "#XmlSelect_" + item.key,
autoRow: true,
radio: false,
clickClose: false,
model: { label: { type: 'text' } },
data: item.operations,
toolbar: {
show: true,
list: ['ALL', 'CLEAR', {
name: '确定',
icon: 'layui-icon layui-icon-ok',
key: "#XmlSelect_" + item.key,
method(event) {
//$("xm-select").css("border-color", "");
//$(".xm-icon-expand").removeClass("xm-icon-expand");
//$(".xm-body").addClass("dis");
$(this.key).find("xm-select").click();
}
}]
},
});
}
else
$("#DDL_" + item.key).val(item.value);
})
if ($(".layui-tab-title").length == 1) {
var lis = $(".layui-tab-title li");
var width = 0;
$.each(lis, function (i, item) {
width += item.offsetWidth;
})
//设置宽度
$(".layui-tab-title").css("width", width + "px");
}
form.render();
if (mapExts != null && mapExts != undefined && mapExts.length > 0) {
mapExts.forEach(function (mapExt) {
if (mapExt.ExtType == "ActiveDDLSearchCond") {
form.on('select(' + mapExt.AttrOfOper + ')', function (element) {
var ddlParent = $("#DDL_" + mapExt.AttrOfOper);
var showWay = ddlParent.attr("data-info");
var ddlChild = $("#DDL_" + mapExt.AttrsOfActive);
if (ddlParent.length == 1 && ddlChild.length == 1)
DDLAnsc(element.value, "DDL_" + mapExt.AttrsOfActive, mapExt, showWay);
});
var ddlParent = $("#DDL_" + mapExt.AttrOfOper);
var showWay = ddlParent.attr("data-info");
var ddlChild = $("#DDL_" + mapExt.AttrsOfActive);
if (ddlParent.length == 1 && ddlChild.length == 1)
DDLAnsc(ddlParent.val(), "DDL_" + mapExt.AttrsOfActive, mapExt, showWay);
}
})
}
if ($(".ccdate").length > 0) {
$.each($(".ccdate"), function (i, item) {
laydate.render({
elem: '#' + item.id //指定元素
, type: $(item).attr("data-info")
});
})
}
//获取列
var cols = GetColoums(frmDict.GetPara("MultiTitle1"), frmDict.GetPara("MultiTitle"), frmDict.ColorSet, frmDict.SortColumns, parseInt(frmDict.RowOpenModel), frmDict.Name, 2,true);
if (searchData.dateTabSearch.key != undefined)
SearchByDate("month", "1月", "month", null);
var tableData = SearchData();
//渲染table
//主页面数据
var vtable = table.render({
elem: '#lay_table_dict',
id: 'lay_table_dict',
data: tableData,
title: '数据表',
limit: Number.MAX_VALUE,
height: $(document).height() - $("#view").height() - 110,
cellMinWidth: 120,
cols: cols,
page: false,
done: function (res, curr, count) {
//遍历表格每行代码
var rowColorSet = frmDict.RowColorSet;
if (rowColorSet != null && rowColorSet != undefined && rowColorSet != "") {
$("table tbody tr").each(function (i, item) {
var color = res.data[i][rowColorSet];
if (color != null && color != undefined && color != "")
$(this).css("background", color);
})
}
}
});
renderLaypage();
//触发行双击事件
table.on('rowDouble(dict)', function (obj) {
var row = obj.data;
var pkval = row["OID"];
var rowstr = JSON.stringify(row);
rowstr = encodeURIComponent(rowstr);
OpenIt(pkval, 2, row["BillState"], rowstr);
});
table.on('sort(dict)', function (obj) { //注sort 是工具条事件名test 是 table 原始容器的属性 lay-filter="对应的值"
orderBy = obj.field; //当前排序的字段名
orderWay = obj.type;//当前排序类型desc降序、asc升序、null空对象默认排序
//尽管我们的 table 自带排序功能,但并没有请求服务端。
//有些时候,你可能需要根据当前排序的字段,重新向服务端发送请求,从而实现服务端排序,如:
tableData = SearchData();
table.reload('lay_table_dict', tableData);
});
//工具栏的操作
$('#view .layui-btn').on('click', function () {
var type = $(this).data('type');
switch (type) {
case "Search":
Search();
break;
case "New"://新增
var frmID = GetQueryString("FrmID");
var handler = new HttpHandler("BP.CCBill.WF_CCBill");
handler.AddUrlData();
var data = handler.DoMethodReturnString("MyDict_CreateBlankDictID");
if (data.indexOf('err@') == 0) {
alert(data);
return;
}
OpenIt(data, 2, 0, null, true);
break;
case "Delete"://删除数据
var checkStatus = table.checkStatus(vtable.config.id);
if (checkStatus.data.length == 0) {
layer.alert("请选择删除的行");
return;
}
layer.confirm('确定要删除选择的数据吗?', function (index) {
var workid = "";
for (var i = 0; i < checkStatus.data.length; i++) {
workid += "'" + checkStatus.data[i]["OID"] + "',";
}
workid = workid.substring(0, workid.length - 1);
var handler = new HttpHandler("BP.CCBill.WF_CCBill");
handler.AddPara("FrmID", GetQueryString("FrmID"));
handler.AddPara("WorkIDs", workid);
var data = handler.DoMethodReturnString("MyDict_Deletes");
if (data.indexOf('err@') == 0) {
layer.alert(data);
return;
}
pageIdx = 1;
tableData = SearchData();
table.reload('lay_table_dict', { data: tableData });
renderLaypage();
layui.laypage.render();
layer.close(index);
});
break;
case "ImpExcel"://导入
var url = "./Opt/Imp.htm?FrmID=" + GetQueryString("FrmID") + "&EntityType=2";
OpenLayuiDialog(url, "导入模板数据", window.innerWidth / 2, 0, null, true);
break;
case "ExpExcel"://导出
if (plant != 'CCFlow')
downLoadExcel(basePath + "/WF/Export/Search_Exp?type=dict&FrmID=" + GetQueryString("FrmID"));
else {
var handler = new HttpHandler("BP.CCBill.WF_CCBill");
handler.AddPara("FrmID", GetQueryString("FrmID"));
//查询集合
var data = handler.DoMethodReturnString("Search_Exp");
if (data.indexOf("err@") != -1) {
layer.alert(data);
return;
}
window.open(data);
}
break;
case "Group"://跳转到分组页面
url = "Group.htm?FrmID=" + GetQueryString("FrmID");
SetHref(url);
break;
case "Link"://链接
var no = $(this).data('no');
var source = $(this).data('source');
OpenLink(no, source);
break;
case "Func"://方法
var no = $(this).data('no');
var source = $(this).data('source');
OpenFunc(no, source);
break;
case "Bill"://方法
var no = $(this).data('no');
var source = $(this).data('source');
OpenBill(no, source);
break;
case "FlowEntityBatchStart":
var no = $(this).data('no');
var source = $(this).data('source');
OpenFlow(no, source);
break;
case "FlowNewEntity":
var no = $(this).data('no');
var source = $(this).data('source');
OpenFlowEntity(no, source);
break;
default:
layer.alert(type + "的方法还没有解析");
break;
}
});
});
function renderLaypage() {
//执行一个laypage实例
layui.laypage.render({
elem: 'page' //注意,这里的 page 是 ID不用加 # 号
, count: ur.GetPara("RecCount") //数据总数,从服务端得到
, limits: [5, 10, 15, 20, 25]
, layout: ['prev', 'page', 'next', 'limit', 'skip', 'count']
, jump: function (obj, first) {
if (!first) {
pageIdx = obj.curr;
pageSize = obj.limit;
//刷新数据
var tableData = SearchData();
layui.table.reload('lay_table_dict', { data: tableData });
}
}
});
$('#page').css('text-align', 'right'); // 分页右对齐
$('.layui-table-page').css('text-align', 'right'); //
}
/**
* 初始化查询条件按钮功能
*/
var searchData = {};
var mapExts;
function InitToolBar() {
var handler = new HttpHandler("BP.CCBill.WF_CCBill");
handler.AddPara("FrmID", frmID);
var data = handler.DoMethodReturnString("Search_ToolBar");
if (data.indexOf('err@') == 0) {
layer.alert(data);
console.log(data);
return;
}
var data = JSON.parse(data);
//单据表单属性
var mapData = data.Sys_MapData;
var attrs = data.Attrs;
var atPara = mapData[0].AtPara;
mapExts = data.Sys_MapExt;
var inputSearch = [];
var dateTabSearch = {};
var dateSearch = [];
var selectSearch = [];
var btns = [];
var stringSearchKeys = GetPara(atPara, "StringSearchKeys");
//时间查询展示方式 0 时间从到、 1 table表格查询模式
var dateShowType = GetPara(atPara, "DTShowWay");
dateShowType = dateShowType == null || dateShowType == undefined || dateShowType == "" ? "0" : dateShowType;
if (dateShowType == "1" && GetPara(atPara, "DTSearchWay") != "0") {
var beginDate = GetPara(atPara, "DateShowYear");
var date = new Date(beginDate);
var year = date.getFullYear();
var currYear = new Date().getFullYear();
var years = [];
for (currYear; currYear >= year; currYear--)
years.push(currYear);
if (years.length == 0)
years.push(currYear);
//需要展示开始时间
dateTabSearch = {
key: "Date",
DTSearchKey: GetPara(atPara, "DTSearchKey"),
Year: years,
Month: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"],
JiDu: ["一季度", "二季度", "三季度", "四季度"],
value: ["2021", "1月", "一季度"]
}
}
searchData["dateTabSearch"] = dateTabSearch;
if (stringSearchKeys != null && stringSearchKeys != undefined && stringSearchKeys != "") {
var strs = stringSearchKeys.split("*");
var fieldV = ""
$.each(strs, function (i, str) {
if (str != "") {
var item = str.split(",");
fieldV = ur.GetPara(item[0]);
if (fieldV == null || fieldV == undefined)
fieldV = "";
if (item.length == 2) {
inputSearch.push({
key: item[0],
label: item[1],
value: fieldV
})
}
}
});
} else if (GetPara(atPara, "IsSearchKey") == "1") {
var keyLabel = GetPara(atPara, "DTSearchLabel");
inputSearch.push({
key: "Key",
label: "关键字",
value: ur.SearchKey
})
}
searchData["inputSearch"] = inputSearch;
if (dateShowType == "0" && GetPara(atPara, "DTSearchWay") != "0") {
var dtFrom = GetPara(atPara, "DTSearchLabel");
if (dtFrom == undefined)
dtFrom = '日期从';
dateSearch.push({
dtFromKey: 'DTFrom',
dtToKey: 'DTTo',
dtFromLabel: dtFrom,
dtFromValue: ur.DTFrom,
dtToValue: ur.DTTo,
dtType: GetPara(atPara, "DTSearchWay") == "1" ? "date" : "datetime"
})
}
searchData["dateSearch"] = dateSearch;
//格式为: @WFSta=0@FK_Dept=02
var json = AtParaToJson(ur.Vals);
var ddlShowWays = GetPara(atPara, "DDLShowWays");
ddlShowWays = ddlShowWays == null || ddlShowWays == undefined || ddlShowWays == "" ? "" : ddlShowWays;
ddlShowWays = ddlShowWays.replace(/[*]/g, "@");
ddlShowWays = AtParaToJson(ddlShowWays);
for (var i = 0; i < attrs.length; i++) {
var attr = attrs[i];
var val = json[attr.Field];
val = val == null || val == undefined || val == "" || val == "null" ? "all" : val;
/**selectSearch.push({
key: attr.Field,
label: attr.Name,
value: val,
showWay: ddlShowWays[attr.Field], //0下拉 1平铺
operations: []
});*/
selectSearch = InitDDLOperation(data, attr, val, ddlShowWays, selectSearch);
}
searchData["selectSearch"] = selectSearch;
//获得当前的集合.
var frms = data["Frm_Method"];
var colls = data["Frm_Collection"];
if (frms && frms.length > 0) {
$.each(frms, function (index, frm) {
btns.push({
label: frm.Name,
type: frm.MethodModel,
no: frm.No,
source: "Method"
})
});
isHaveSeachOper = true;
}
/**$.each(menus, function (index, menus) {
btns.push({
label: menus.Name,
type: menus.MenuModel,
no: menus.No,
source: "Menu"
})
})**/
if (colls && colls.length > 0) {
$.each(colls, function (index, coll) {
if (isHaveSeachOper == false && coll.MethodModel != "FlowNewEntity")
isHaveSeachOper = true;
btns.push({
label: coll.Name,
type: coll.MethodModel,
no: coll.No,
source: "Collection"
})
});
}
searchData["btns"] = btns;
return searchData;
}
</script>
<script>
$(function () {
var theme = filterXSS(localStorage.getItem("themeColorInfo"));
if (theme == null || theme == undefined || theme == "")
return;
theme = JSON.parse(theme);
var styleScope = document.getElementById("theme-data");
var html = styleScope.innerHTML;
html += "\n .layui-btn{\n background-color:" + theme.selectedMenu + ";\n}\n .layui-laypage .layui-laypage-curr .layui-laypage-em{\n background-color:" + theme.selectedMenu + ";\n}";
html += "\n .layui-laypage input:focus,.layui-laypage select:focus{\n border-color:" + theme.selectedMenu + " !important\n}";
html += "\n .layui-form-select dl dd.layui-this{\n background-color:" + theme.selectedMenu + " !important;\n}";
html += "\n .layui-tab-title .layui-this{\n background-color:" + theme.selectedMenu + " !important;\n} \n .layui-tab-title>.layui-this{\n color:#fff;\n} \n .layui-tab-title li {border: 1px solid " + theme.selectedMenu + ";}";
html += "\n .layui-a-this{\n background-color:" + theme.selectedMenu + ";\n color: #fff;\n}";
html = filterXSS(html);
var styleScope = document.getElementById("theme-data");
styleScope.innerHTML = html;
})
</script>
</body>
</html>