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.
DS7/DSWeb/SoftMng/Viewsjs/ProjectManagement/index_source_by_zxb_24d7a12...

1025 lines
41 KiB
JavaScript

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.

//分页选中的项
var _selections = [];
//分页选中主键集合
var _selections_id = [];
//定义下拉框集合 (用于 format 和 构造页面)
//客户名称
var companyIDOption = [{ '': '请选择...' }];
//处理情况
var statusOption = [{ '': '请选择...' }, { '0': '新建' }, { '1': '提交' }, { '2': '审核通过' }, { '3': '实施' }, { '4': '验收' }, { '5': '确认完成' }];
//默认列配置项
var columnsDefault = [
{
field: 'checkbox',
checkbox: true
}, {
title: '序号',
field: 'rownumber',
width: 50,
formatter: function (value, row, index) {
return index + 1;
}
}, {
field: 'BSNO',
title: '项目编号',
sortable: true
}, {
field: 'BSSTATUS',
title: '状态',
formatter: function (value, row, index) {
if (value == '5') {
return '<span style="color:green;">' + CommonJson.GetOptionValue(value, statusOption) + '</span>';
} else {
return CommonJson.GetOptionValue(value, statusOption);
}
}
}, {
field: 'PROJECTNAME',
title: '项目名称'
}, {
field: 'CUSTOMERNAME',
title: '客户名称',
formatter: function (value, row, index) {
return CommonJson.GetSelect2Value(value);
},
sortable: true
}, {
field: 'PROJECTDATE',
title: '开始日期',
width: 150,
formatter: function (value, row, index) {
return CommonJson.GetDate(value).format('yyyy-mm-dd hh:ii');
}
}, {
field: 'PLANDATE',
title: '计划完成日期',
width: 150,
formatter: function (value, row, index) {
return CommonJson.GetDate(value).format('yyyy-mm-dd hh:ii');
}
}, {
field: 'PROJECTDETAIL',
title: '项目描述'
}, {
field: 'MANAGEBY',
title: '项目负责人'
}, {
field: 'AUDITBY',
title: '审核人'
}, {
field: 'AUDITTIME',
title: '审核时间',
width: 150,
formatter: function (value, row, index) {
return CommonJson.GetDate(value).format('yyyy-mm-dd hh:ii');
}
}, {
field: 'AUDITRESULT',
title: '审核备注'
}, {
field: 'MODIFYBY',
title: '修改人'
}, {
field: 'MODIFYSTTIME',
title: '修改开始时间',
width: 150,
formatter: function (value, row, index) {
return CommonJson.GetDate(value).format('yyyy-mm-dd hh:ii');
}
}, {
field: 'MODIFYEDTIME',
title: '修改结束时间',
width: 150,
formatter: function (value, row, index) {
return CommonJson.GetDate(value).format('yyyy-mm-dd hh:ii');
}
}, {
field: 'MODIFYDETAIL',
title: '修改说明',
width: 180
}, {
field: 'REMARKS',
title: '备注',
width: 180
}, {
field: 'INPUTBY',
title: '录入人'
}, {
field: 'INPUTTIME',
title: '录入时间',
width: 150,
formatter: function (value, row, index) {
return CommonJson.GetDate(value).format('yyyy-mm-dd hh:ii');
}
}, {
field: 'OVERBY',
title: '确认人'
}, {
field: 'OVERTIME',
title: '确认时间',
width: 150,
formatter: function (value, row, index) {
return CommonJson.GetDate(value).format('yyyy-mm-dd hh:ii');
}
}
];
//个人自定义列配置项
var columnsCustom = columnsDefault.concat();
//初始化 - 表格
$("#table_1").bootstrapTable({
url: '/SoftMng/ProjectManagement/GetList', //请求后台的URL*
method: 'post', //请求方式(*
contentType: "application/x-www-form-urlencoded",
toolbar: '#toolbar_1', //工具按钮用哪个容器
striped: true, //是否显示行间隔色
//cache: false, //是否使用缓存默认为true所以一般情况下需要设置一下这个属性*
pagination: true, //是否显示分页(*
sortable: true, //是否启用排序
//toolbarAlign:"right",
sortName: "INPUTTIME",
sortOrder: "desc", //排序方式
undefinedText: "--",
queryParams: QueryParams, //额外传递参数(*
sidePagination: "server", //分页方式client客户端分页server服务端分页*
pageNumber: 1, //初始化加载第一页,默认第一页
pageSize: 10, //每页的记录行数(*
pageList: [10, 20, 50, 100, "All"], //可供选择的每页的行数(*
//search: true, //是否显示表格搜索(客户端搜索)
onlyInfoPagination: false,
//searchText:"",
//searchOnEnterKey: true,
strictSearch: true,
//showPaginationSwitch:true,
showColumns: true, //是否显示的列控制按钮
showRefresh: true, //是否显示刷新按钮
clickToSelect: true, //是否启用点击选中行
height: 580, //表格高度
uniqueId: "GID", //每一行的唯一标识,一般为主键列
//showToggle: true, //是否显示详细视图和列表视图的切换按钮
cardView: false, //是否显示详细视图
maintainSelected: true, //设置为 true 在点击分页按钮或搜索按钮时将记住checkbox的选择项
rowStyle: function (row, index) {
return { classes: "col-point" };
},
/**
* 双击某行
* @param row 点击行的数据
* @param $element tr 元素
* @param field 点击列的 field 名称
*/
onDblClickRow: function (row, $element, field) {
InitLayer('修改', 'lan', row);
},
//formatSearch: function() {
// return "提问人 | 问题描述";
//},
onLoadSuccess: function (data) {
$(".btn-toolbar > .btn-group > label.btn > .badge").each(function (i) {
$(this).text('(' + data.groupTotal[i] + ')');
});
//反选
$("#table_1").bootstrapTable("checkBy", { field: 'GID', values: _selections_id });
//绑定右键菜单
var menuAdd = new BootstrapMenu('.fixed-table-body:has(#table_1)',
{
actions: [{
name: '新增',
iconClass: 'icon-plus-sign-alt',
onClick: function () {
InitLayer('新增', 'molv');
}
}]
});
var menuAll = new BootstrapMenu('#table_1 > tbody > tr.col-point',
{
fetchElementData: function ($rowElem) {
var uniqueid = $rowElem.attr("data-uniqueid");
var row = $("#table_1").bootstrapTable('getRowByUniqueId', uniqueid);
return row;
},
actionsGroups: [
['add', 'update'], ['reply'], ['remark']
],
actions: {
add: {
name: '新增',
iconClass: 'icon-plus-sign-alt',
onClick: function () {
InitLayer('新增', 'molv');
}
},
update: {
name: '修改',
iconClass: 'icon-edit',
onClick: function (row) {
InitLayer('修改', 'lan', row);
}
},
reply: {
name: '回复',
iconClass: 'icon-comment-alt',
onClick: function (row) {
InitSubTable(row.BSNO);
}
},
remark: {
name: '添加备忘',
iconClass: 'icon-comment-alt',
onClick: function (row) {
InitRemarkLayer(row.GID, 'lan', row);
}
}
}
});
},
onLoadError: function (status, res) {
if (status !== 0) layer.msg(res.responseText);
},
onReorderColumn: function (headerFields) {
CommonAjax.Post("/SoftMng/JsonHandler/SetCustomHead",
{
NodeName: "op_softproject_Table_Columns_Config",
UserCode: _codeName,
UserConfig: encodeURIComponent(JSON.stringify(headerFields))
},
function (res) {
if (res.success)
refreshColumns(false);
else
layer.msg(res.message);
});
},
columns: columnsDefault
});
refreshColumns(true);
//刷新列项
function refreshColumns(isDefault) {
CommonAjax.Post("/SoftMng/JsonHandler/GetCustomHead",
{
NodeName: "op_softproject_Table_Columns_Config",
UserCode: _codeName
},
function (res) {
if (res.exist) {
res = eval(decodeURIComponent(res.data));
res.forEach(eachHandler);
$("#table_1").bootstrapTable('refreshOptions', { columns: columnsCustom });
}
else if (!isDefault) {
$("#table_1").bootstrapTable('refreshOptions', { columns: columnsDefault });
}
});
}
//数组遍历
function eachHandler(item, index) {
var obj = columnsCustom.filter(
function (current) {
return current.field === item;
})[0];
var startindex = columnsCustom.indexOf(obj);
columnsCustom.splice(startindex, 1);
columnsCustom.push(obj);
}
/**
* 添加 - 额外参数
* @param params 参数
*/
function QueryParams(params) {
var advSearch = $("[role='search'] button.mark").hasClass("active");
var extParams = {
limit: params.limit, //页面大小
startIndex: params.offset, //开始索引索引从0开始
sortOrder: params.order,//排序方式descasc
sortName: params.sort,//排序字段
search: $("[role='search'] [name='search").val(),//搜索框的值
status: $(".btn-toolbar [name='status']:checked").val(),
character: $("[role='search'] [name='character']:checked").val()
};
return extParams;
}
/**
* 展开 - 子表
* @param index 父表当前行的行索引
* @param row 父表当前行的Json数据对象
* @param $detail 当前行下创建新行的td对象
*/
function InitSubTable(bsno) {
layer.open({
type: 1,
title: "回复列表 - " + bsno,
skin: 'layui-layer-molv',
area: ['70%', '60%'],
anim: 2,//从最底部往上滑入
content: BuildSubList(),
btn: ["返回"],
success: function (layero, index) {
$("#subTable_1").bootstrapTable({
url: '/SoftMng/Customer/GetDetailList',
method: 'post',
contentType: "application/x-www-form-urlencoded",
toolbar: '#toolbar_2', //工具按钮用哪个容器
queryParams: { parentId: bsno },
//clickToSelect: true,
striped: true, //是否显示行间隔色
uniqueId: "id",
sortable: true, //是否启用排序
sortName: "replyDate",
sortOrder: "desc", //排序方式
undefinedText: "--",
sidePagination: "server",
responseHandler: function (res) { //加载服务器数据之前的处理程序,可以用来格式化数据
return res.rows;
},
/**
* 双击某行
* @param row 点击行的数据
* @param $element tr 元素
* @param field 点击列的 field 名称
*/
onLoadSuccess: function () {
//移除事件绑定
$("#toolbar_2>button").off();
//新增 - 绑定
$("#toolbar_2>button:eq(0)").on("click",
function () {
InitSubLayer(bsno, '新增', 'molv');
});
//修改 - 绑定
$("#toolbar_2>button:eq(1)").on("click",
function () {
var selectItems = $("#subTable_1").bootstrapTable('getSelections');
switch (selectItems.length) {
case 0:
layer.msg("请选择一项来修改");
break;
case 1:
InitSubLayer(bsno, '修改', 'lan', selectItems[0]);
break;
default:
layer.msg("只能选择一项进行修改");
break;
}
});
//删除 - 绑定
$("#toolbar_2>button:eq(2)").on("click",
function () {
BatchDelete('#subTable_1', '/SoftMng/Customer/DeleteDetail', 'id');
});
},
columns: [
{
checkbox: true
}, {
title: '序号',
width: 50,
formatter: function (value, row, index) {
return index + 1;
}
}, {
field: 'replyMsg',
title: '回复',
width: 180
}, {
field: 'attachMent',
title: '附件',
width: 180,
formatter: function (value, row, index) {
return CommonJson.GetFileValue(value);
}
}, {
field: 'replyUser',
title: '回复人'
}, {
field: 'replyDate',
title: '回复时间',
width: 150,
formatter: function (value, row, index) {
return CommonJson.GetDate(value).format('yyyy-mm-dd hh:ii');
}
}
]
});
}
});
}
/**
* 弹出 - 客户提问弹出层
* @param action 动作
* @param skin 皮肤
* @param model 实体
*/
function InitLayer(action, skin, model) {
layer.open({
type: 1,
title: action + " - 项目管理" + (model == null ? "" : " - " + model.BSNO),
skin: 'layui-layer-' + skin,
area: ['95%', '85%'],
content: BuildItem(model),
btn: ["提交", "取消"],
yes: function (index, layero) {
if ($(".needs-validation").valid()) {
FileInput.Uploaded("fileinput_1", "attachMent", function () {
Save(index, layero, '/SoftMng/ProjectManagement/Save', '#table_1');
});
}
},
success: function (layero, index) {
$('.select2').select2({
tags: false,//在搜索时即便没有搜索到相关内容,也会把你输入的内容当成一个可选项
language: "zh-CN",
placeholder: '请选择...',
allowClear: true,
ajax: {
url: "/SoftMng/Customer/GetInfoClientList",
dataType: "json",
delay: 250,
data: function (params) {
return {
query: params.term,
pageSize: 20,
pageIndex: params.page * 20 || 0
}
},
processResults: function (res, params) {
params.page = params.page || 0;
return {
results: res.data,
pagination: {
more: params.page * 20 < res.total
}
};
},
minimumInputLength: 1,//最少需要输入多少字才进行查询
escapeMarkup: function (markup) { return markup; }, // 自定义格式化防止xss注入
cache: true
}
});
if (model == null)//默认值绑定
$(layero).find("#BSSTATUS").find("option[value='0']").prop("selected", true);
Validation.Initial();//初始化验证
$(layero).find('.date4:not(.hide-picker)').datetimepicker({
todayHighlight: true,
autoclose: true,
todayBtn: true,
clearBtn: true,
language: "zh-CN",
pickerPosition: "bottom-left",
bootcssVer: 4
});//初始化时间控件
FileInput.Initial('fileinput_1', 'attachMent', true, model == null ? null : CommonJson.GetInitFile(model.attachMent));//初始化附件上传
CommonJson.SetModel(layero, model);//反填值
//客户下拉框绑定事件
$(layero).find('#companyID').on("change",
function () {
CommonAjax.Post("/SoftMng/Customer/GetInfoClient", { gid: eval('(' + this.value + ')').Key }, function (res) {
$(layero).find("#actionType").val(res.actionType);
$(layero).find("#dirMaster").val(res.dirModel.USERID);
$(layero).find("#dirPhone").val(res.dirModel.OFFICEPHONE);
$(layero).find("#dirEmail").val(res.dirModel.EMAIL1);
$(layero).find("#dirQQ").val(res.dirModel.QQ);
$(layero).find("#proMaster").val(res.proModel.USERID);
$(layero).find("#proPhone").val(res.proModel.OFFICEPHONE);
$(layero).find("#proEmail").val(res.proModel.EMAIL1);
$(layero).find("#proQQ").val(res.proModel.QQ);
//默认配置项
$(layero).find("#custManager").val("李进举");
$(layero).find("#telephone").val("0532-68628157");
$(layero).find("#email").val("CS002@dongshengsoft.com");
});
});
//移除日期绑定
$(".input-group-append .icon-remove").parent("button").on("click",
function () {
$(this).parents(".input-group-append").siblings(".date4").val("");
});
//移除日期绑定
$(".input-group-append .icon-ok").parent("button").on("click",
function () {
$(this).parents(".input-group-append").siblings(".date4").val(new Date().format("yyyy-mm-dd hh:ii"));
});
if (model != null) {
//切换tab时隐藏、显示提交按钮
$('#tabEditProject a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
if (e.target.id == "tabProject") {
$("a.layui-layer-btn0").show();
} else {
$("a.layui-layer-btn0").hide();
}
})
$('#tableRemarkList').bootstrapTable({
url: '/ProjectManagement/GetRemarkList?search=' + model.GID, //请求后台的URL*
method: 'post', //请求方式(*
contentType: "application/x-www-form-urlencoded",
//toolbar: '#toolbar_1', //工具按钮用哪个容器
striped: true, //是否显示行间隔色
//cache: false, //是否使用缓存默认为true所以一般情况下需要设置一下这个属性*
pagination: true, //是否显示分页(*
sortable: true, //是否启用排序
//toolbarAlign:"right",
sortName: "inputtime",
sortOrder: "desc", //排序方式
undefinedText: "--",
queryParams: QueryParams2, //额外传递参数(*
sidePagination: "server", //分页方式client客户端分页server服务端分页*
pageNumber: 1, //初始化加载第一页,默认第一页
pageSize: 10, //每页的记录行数(*
pageList: [10, 20, 50, 100, "All"], //可供选择的每页的行数(*
//search: true, //是否显示表格搜索(客户端搜索)
onlyInfoPagination: false,
//searchText:"",
//searchOnEnterKey: true,
strictSearch: true,
//showPaginationSwitch:true,
showColumns: false, //是否显示的列控制按钮
showRefresh: true, //是否显示刷新按钮
clickToSelect: false, //是否启用点击选中行
height: 450, //表格高度
uniqueId: "id", //每一行的唯一标识,一般为主键列
//showToggle: true, //是否显示详细视图和列表视图的切换按钮
cardView: false, //是否显示详细视图
maintainSelected: true, //设置为 true 在点击分页按钮或搜索按钮时将记住checkbox的选择项
rowStyle: function (row, index) {
if (row.status === 0)
return { classes: "col-point yellow" };
return { classes: "col-point" };
},
onLoadSuccess: function (data) {
},
onLoadError: function (status, res) {
if (status !== 0) layer.msg(res.responseText);
},
onReorderColumn: function (headerFields) {
},
columns: [
{
title: '序号',
field: 'rownumber',
width: 50,
formatter: function (value, row, index) {
return index + 1;
}
}, {
field: 'CONTENT',
title: '备忘内容',
align: 'left'
}, {
field: 'INPUTBY',
title: '备忘人',
width: 50
}, {
field: 'INPUTTIME',
title: '备忘时间',
width: 50,
formatter: function (value, row, index) {
return CommonJson.GetDate(value).format('yyyy-mm-dd hh:ii');
},
sortable: true
}
]
});
}
//$('#tableRemarkList').bootstrapTable('load');
}
});
}
/**
* 弹出 - 回复弹出层
* @param bsno 反馈编号
* @param action 动作
* @param skin 皮肤
* @param model 实体
*/
function InitSubLayer(bsno, action, skin, model) {
layer.open({
type: 1,
title: action + " - 回复",
skin: 'layui-layer-' + skin,
area: ['480px', '380px'],
anim: 2,//从最底部往上滑入
content: BuildSubItem(),
btn: ["提交", "取消"],
yes: function (index, layero) {//提交
if ($(".needs-validation").valid()) {
FileInput.Uploaded("fileinput_1", "attachMent", function () {
Save(index, layero, '/SoftMng/Customer/SaveDetail', '#subTable_1');
});
}
},
success: function (layero, index) {//获取数据
Validation.Initial();
$(layero).find("#BSNO").val(bsno);
FileInput.Initial('fileinput_1', 'attachMent', true, model == null ? null : CommonJson.GetInitFile(model.attachMent));
CommonJson.SetModel(model);
}
});
}
/**
* 弹出 - 备忘弹出层
* @param bsno 反馈编号
* @param action 动作
* @param skin 皮肤
* @param model 实体
*/
function InitRemarkLayer(projectId, skin, model) {
layer.open({
type: 1,
title: "添加备忘",
skin: 'layui-layer-' + skin,
area: ['480px', '300px'],
anim: 2,//从最底部往上滑入
content: BuildRemarkItem(),
btn: ["提交", "取消"],
yes: function (index, layero) {//提交
if ($(".needs-validation").valid()) {
Save(index, layero, '/SoftMng/ProjectManagement/SaveRemark', '#subTable_1');
}
},
success: function (layero, index) {//获取数据
Validation.Initial();
$(layero).find("#projectId").val(projectId);
CommonJson.SetModel(model);
}
});
}
/**
* 构造 - 弹出层
* */
function BuildItem(model) {
var startTag = function (label, num, classes) {
return ''.concat('<div class="col-sm-' + (num == null ? 3 : num) + ' ' + (classes == null ? "" : classes) + '"><div class="input-group">',
label == null ? '' : '<div class="input-group-prepend"><div class="input-group-text">' + label + '</div></div>');
}
var inputTag = function (name, attr, classes) {
return ''.concat('<input type="text" class="form-control ' + classes + '" id="' + name + '" name="' + name + '" aria-describedby="' + name + '" ' + attr + ' />');
}
var selectTag = function (name, arr, attr, classes) {
var str = '<select class="custom-select ' + (classes == null ? "" : classes) + '" id="' + name + '" name="' + name + '" ' + (attr == null ? "" : attr) + '>';
for (var i = 0; i < arr.length; i++)
for (var p in arr[i]) if (arr[i].hasOwnProperty(p))
str = str.concat('<option value="' + p + '">' + arr[i][p] + '</option>');
return str.concat('</select>');
}
var endTag = '</div></div>';
var tabTagStart = '';
var tabTagEnd = '';
if (model != null) {
var height = $(window).height() * 0.7;
tabTagStart = '<div id="tabEditProject"><ul class="nav nav-tabs" role="tablist" id="projectInfoTab">';
tabTagStart += '<li class="nav-item"><a class="nav-link active" id="tabProject" data-toggle="tab" href="#tcProject" role="tab" aria-controls="tcProject" aria-selected="true">项目信息</a></li>';
tabTagStart += '<li class="nav-item"><a class="nav-link" id="tabDevBills" data-toggle="tab" href="#tcDevBills" role="tab" aria-controls="tcDevBills" aria-selected="false">开发工单</a></li>';
tabTagStart += '<li class="nav-item"><a class="nav-link" id="tabCustBills" data-toggle="tab" href="#tcCustBills" role="tab" aria-controls="tcCustBills" aria-selected="false">客服工单</a></li>';
tabTagStart += '<li class="nav-item"><a class="nav-link" id="tabRemarks" data-toggle="tab" href="#tcRemarks" role="tab" aria-controls="tcRemarks" aria-selected="false">备忘列表</a></li>';
tabTagStart += '</ul>';
tabTagStart += '<div class="tab-content" style="height:' + height + 'px;">';
tabTagStart += '<div class="tab-pane fade show active" id="tcProject" role="tabpanel" aria-labelledby="tabProject" style="width:100%;height:100%;">';
tabTagEnd = '</div>';
//开发工单
var tableDevBill = '<iframe src="/SoftMng/MsSoftRequire?projectId=' + model.GID + '" width="100%" height="100%"></iframe>';
tabTagEnd += '<div class="tab-pane fade show" id="tcDevBills" role="tabpanel" aria-labelledby="tabDevBills" style="width:100%;height:100%;">';
tabTagEnd += tableDevBill;
tabTagEnd += '</div>';
//客服工单
var tableCustBill = '<iframe src="/SoftMng/customer?projectId=' + model.GID + '" width="100%" height="100%"></iframe>'
tabTagEnd += '<div class="tab-pane fade show" id="tcCustBills" role="tabpanel" aria-labelledby="tabCustBills" style="width:100%;height:100%;">';
tabTagEnd += tableCustBill;
tabTagEnd += '</div>';
//备忘列表
var tableRemarks = '<table class="table table-striped table-fixed table-resize" data-reorderable-columns="true" id="tableRemarkList"></table>';
tabTagEnd += '<div class="tab-pane fade show" id="tcRemarks" role="tabpanel" aria-labelledby="tabRemarks">';
tabTagEnd += tableRemarks;
tabTagEnd += '</div>';
tabTagEnd += '</div></div>';
}
return tabTagStart + ''.concat(
'<div class="container"><form enctype="multipart/form-data" class="needs-validation"><input type="hidden" name="GID" id="identityKey"><input type="hidden" name="BSNO" id="BSNO">',
'<div class="form-group row">',
startTag("项目名称") + inputTag('PROJECTNAME', '', 'required') + endTag,
startTag("客户名称") + selectTag('CUSTOMERNAME', companyIDOption, 'size', 'required select2') + endTag,
'</div>',
'<div class="form-group row" style="float:left;width:50%">',
startTag("项目描述", 12, "form-group no-r-padding"),
'<textarea class="form-control" id="PROJECTDETAIL" name="PROJECTDETAIL" aria-describedby="PROJECTDETAIL" rows="3"></textarea>',
endTag,
'</div>',
'<div class="form-group row" style="float:right;width:50%">',
startTag("项目状态", 12, "form-group no-l-padding") + selectTag('BSSTATUS', statusOption, 'size', 'required') + endTag,
startTag("项目负责人", 12, "form-group no-l-padding") + inputTag('MANAGEBY') + endTag,
'</div>',
'<div class="form-group row" style="float:left;width:50%">',
startTag("项目开始日期", 12, "form-group no-r-padding") + inputTag('PROJECTDATE', 'readonly', 'date4 col-point') + endTag,
startTag("项目完成日期", 12, "form-group no-r-padding") + inputTag('PLANDATE', 'readonly', 'date4 col-point') + endTag,
'</div>',
'<div class="form-group row" style="float:right;width:50%">',
startTag("项目备注", 12, "form-group no-l-padding"),
'<textarea class="form-control" id="REMARKS" name="REMARKS" aria-describedby="REMARKS" rows="3"></textarea>',
endTag,
'</div>',
'<div class="form-group row" style="float:left;width:50%">',
startTag("审核人", 12, "form-group no-r-padding") + inputTag('AUDITBY') + endTag,
startTag("审核时间", 12, "form-group no-r-padding") + inputTag('AUDITTIME', 'readonly', 'date4 col-point') + endTag,
'</div>',
'<div class="form-group row" style="float:right;width:50%">',
startTag("审核备注", 12, "form-group no-l-padding"),
'<textarea class="form-control" id="AUDITRESULT" name="AUDITRESULT" aria-describedby="PROJECTDETAIL" rows="3"></textarea>',
endTag,
'</div>',
'<div class="form-group row" style="clear:both">',
startTag("录入人") + inputTag('INPUTBY') + endTag,
startTag("录入时间") + inputTag('INPUTTIME', 'readonly', 'date4 col-point') + endTag,
startTag("确认人") + inputTag('OVERBY') + endTag,
startTag("确认时间") + inputTag('OVERTIME', 'readonly', 'date4 col-point') + endTag,
'</div>',
'</form></div>') + tabTagEnd;
}
/**
* 构造 - 回复弹出层
* */
function BuildSubItem() {
var startTag = function (label) {
return ''.concat('<div class="form-group row"><div class="col-sm-12"><div class="input-group">',
label == null
? ''
: '<div class="input-group-prepend"><div class="input-group-text">' + label + '</div></div>');
}
var inputTag = function (name, phd, attr, classes) {
return ''.concat('<input type="text" class="form-control ' + classes + '" id="' + name + '" name="' + name + '" aria-describedby="' + name + '" placeholder="' + phd + '" ' + attr + ' />');
}
var endTag = '</div></div></div>';
return ''.concat('<div class="container"><form enctype="multipart/form-data" class="needs-validation">',
'<input type="hidden" name="id" id="identityKey">',
startTag("反馈编号") + inputTag('BSNO', '系统自动生成', 'readonly') + endTag,
startTag("回复"),
'<textarea class="form-control required" id="replyMsg" name="replyMsg" aria-describedby="replyMsg" rows="3"></textarea>',
endTag,
'<div class="form-group row">',
'<div class="col-sm-12"><div class="file-group">',
'<input type="file" class="custom-file-input file4" name="fileinput_1" id="fileinput_1" multiple>',
'<input type="hidden" id="attachMent" name="attachMent">',
'</div></div>',
'</div>',
'</form></div>');
}
/**
* 构造 - 回复列表
* */
function BuildSubList() {
return ''.concat('<div class="container">',
'<div class="btn-group" role="group" aria-label="工具条" id="toolbar_2">',
'<button type="button" class="btn btn-secondary molv">新增</button>',
'<button type="button" class="btn btn-secondary molan">修改</button>',
//'<button type="button" class="btn btn-danger">删除</button>',
'</div>',
'<div class="table-responsive"><table class="table table-striped table-fixed" id="subTable_1"></table></div>',
'</div>');
}
/**
* 构造 - 添加备忘弹出层
* */
function BuildRemarkItem() {
var startTag = function (label) {
return ''.concat('<div class="form-group row"><div class="col-sm-12"><div class="input-group">',
label == null
? ''
: '<div class="input-group-prepend"><div class="input-group-text">' + label + '</div></div>');
}
var endTag = '</div></div></div>';
return ''.concat('<div class="container"><form method="POST" class="needs-validation">',
'<input type="hidden" name="projectId" id="projectId">',
startTag("备忘内容"),
'<textarea class="form-control required" id="remarkContent" name="content" aria-describedby="replyMsg" rows="8"></textarea>',
endTag,
'</form></div>');
}
/**
* 保存 - Form 表单
* @param index 弹出层Id
* @param layero 弹出层元素
* @param url 请求路径
* @param tabId Jquery选择器
*/
function Save(index, layero, url, tabId) {
CommonAjax.MtpPost(url,
$(layero).find("form")[0],
function (res) {
layer.close(index);//关闭弹窗
layer.msg(res.message);
if (res.success) $(tabId).bootstrapTable('refresh', { silent: true });//刷新主表
});
}
/**
* 删除 - 批量
* @param tabId Jquery选择器
* @param url 请求路径
* @param key 主键名称
*/
function BatchDelete(tabId, url, key) {
var deleteItems = $(tabId).bootstrapTable('getSelections');
var jsonStr = "";
for (var i in deleteItems)
if (deleteItems.hasOwnProperty(i)) {
if (i !== "0") jsonStr = jsonStr.concat(",");
jsonStr = jsonStr.concat("'" + deleteItems[i][key] + "'");
}
if (deleteItems.length > 0) {
layer.confirm("确定删除所选吗?",
{ skin: 'layui-layer-molv', icon: 7 },
function () {
//删除主表
CommonAjax.Post(url,
{
ids: jsonStr
},
function (res) {
layer.msg(res.message);
if (res.success) $(tabId).bootstrapTable('refresh', { silent: true });
});
});
} else {
layer.msg("请至少选择一项");
}
}
/**
* 更改状态
* @param res 对象
*/
function responseHandler(res) {
$.each(res.rows, function (i, row) {
row.state = $.inArray(row.GID, _selections_id) !== -1;
});
return res;
}
//新增 - 绑定
$(".btn-toolbar > .btn-group > [data-method='add']").on("click",
function () {
InitLayer('新增', 'molv');
});
//修改 - 绑定
$(".btn-toolbar > .btn-group > [data-method='update']").on("click",
function () {
var selectItems = $("#table_1").bootstrapTable('getSelections');
switch (selectItems.length) {
case 0:
layer.msg("请选择一项来修改");
break;
case 1:
InitLayer('修改', 'lan', selectItems[0]);
break;
default:
layer.msg("只能选择一项进行修改");
break;
}
});
//删除 - 绑定
$(".btn-toolbar > .btn-group > [data-method='del']").on("click",
function () {
BatchDelete('#table_1', '/SoftMng/Customer/Delete', 'id');
});
//状态 - 绑定
$(".btn-toolbar > [data-toggle='buttons']").on("click", "label.btn",
function () {
setTimeout(function () {
$("#table_1").bootstrapTable('refresh', { silent: true });
}, 0);
});
//高级查询时间控件
$("[role='search'] .date4").datetimepicker({
format: 'yyyy-mm-dd',
todayHighlight: true,
autoclose: true,
todayBtn: true,
clearBtn: true,
minView: 2,
language: "zh-CN",
pickerPosition: "bottom-left",
bootcssVer: 4
}).on('changeDate', function (ev) {
var value = ev.currentTarget.value;
switch (ev.currentTarget.name) {
case "s-beginDate_1"://开始日期
$("[role='search'] [name='s-beginDate_2']").datetimepicker('setStartDate', value);
break;
case "s-beginDate_2"://结束日期
$("[role='search'] [name='s-beginDate_1']").datetimepicker('setEndDate', value);
break;
}
});
//隐藏重置按钮
$("[role='search'] button:has(.icon-undo)").hide();
//重置高级查询条件
$("[role='search'] button:has(.icon-undo)").on("click",
function () {
$("[role='search'] .form-group").find("input,textarea").val("");
$("[role='search'] button.mark").removeClass("active");//先取消激活
$("#table_1").bootstrapTable('refresh', { silent: true });
$(this).hide();
});
//基本查询执行
$("[role='search'] [name='search']").on("keyup",
function (e) {
if (e.keyCode == 13) $("#table_1").bootstrapTable('refresh', { silent: true });
});
$("[role='search'] button.mark").on("click",
function () {
$("#table_1").bootstrapTable('refresh', { silent: true });
});
//高级查询执行
$("[role='search'] button.action").on("click",
function () {
$("[role='search'] button.mark").addClass("active");//先激活
$("#table_1").bootstrapTable('refresh', { silent: true });
$("[role='search'] button:has(.icon-undo)").show();
});
//恢复默认配置
$("[role='menu'] button:has(.icon-home)").on("click",
function () {
layer.confirm("确定要恢复默认配置吗?<br/>个人配置的列数据将丢失!", {
skin: "layui-layer-molv",
icon: 7
}, function () {
CommonAjax.Post("/SoftMng/JsonHandler/DelCustomHead",
{
NodeName: "op_softproject_Table_Columns_Config",
UserCode: _codeName
},
function (res) {
layer.closeAll('dialog');
if (res.success)
refreshColumns(false);
else
layer.msg("已恢复默认");
});
});
});
//当前角色切换
$('[role="search"] [name="character"]').on("click",
function () {
setTimeout(function () {
$("#table_1").bootstrapTable('refresh', { silent: true });
}, 0);
});
//服务器分页记住选中项
$('#table_1').on('check.bs.table check-all.bs.table ' +
'uncheck.bs.table uncheck-all.bs.table', function (e, rows) {
var ids = $.map(!$.isArray(rows) ? [rows] : rows,
function (row) {
return row.GID;
}),
items = $.map(!$.isArray(rows) ? [rows] : rows,
function (row) {
return row;
}),
func = $.inArray(e.type, ['check', 'check-all']) > -1 ? 'union' : 'difference';
_selections_id = _[func](_selections_id, ids);
_selections = _[func](_selections, items);
});
//浏览器窗口大小调整 - 绑定
window.onresize = function () {
$('#table_1').bootstrapTable('resetView');
}
//提示框初始化
SiteComponents.ToolTip();
function QueryParams2(params) {
var extParams = {
limit: params.limit, //页面大小
startIndex: params.offset, //开始索引索引从0开始
sortOrder: params.order,//排序方式descasc
sortName: params.sort//排序字段
};
return extParams;
}