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.

321 lines
12 KiB
Plaintext

11 months ago

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>词汇选择</title>
<link href="../Scripts/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="../Scripts/bootstrap/css/font-awesome.css" rel="stylesheet" type="text/css" />
<link href="../Scripts/bootstrap/bootstrap-table/src/bootstrap-table.css" rel="stylesheet" type="text/css" />
<script src="../Scripts/jquery-1.11.0.min.js" type="text/javascript"></script>
<script src="../Scripts/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="../Scripts/bootstrap/bootstrap-table/src/bootstrap-table.js" type="text/javascript"></script>
<script src="../Scripts/bootstrap/bootstrap-table/src/locale/bootstrap-table-zh-CN.js" type="text/javascript"></script>
<script src="../Scripts/CommonUnite.js" type="text/javascript"></script>
<!--<script src="../../Scripts/jquery/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>-->
<script src="../Scripts/QueryString.js" type="text/javascript"></script>
<script src="../Scripts/config.js" type="text/javascript"></script>
<script language="JavaScript" src="../Comm/JScript.js" type="text/javascript"></script>
<script type="text/javascript" src="../Comm/Gener.js"></script>
<style type="text/css">
.bs-checkbox {
width: 20px
}
.nav-tabs > li.active > a, .nav-tabs > li.active > a:hover, .nav-tabs > li.active > a:focus {
color: #555;
cursor: default;
background-color: #fff;
border-right: 1px solid #ddd;
border-bottom-color: transparent;
}
button {
background: #fff;
color: #000;
border: 1px solid #ccc !important;
border-radius: 3px;
margin: 5px 3px 5px 3px;
padding: 4px 15px;
}
.fixed-table-body{
overflow-x:hidden;
}
button:hover {
background: #f5f5f5;
color: #000;
}
</style>
<script type="text/javascript">
// AttrKey =WorkCheck, FlowBBS, WorkReturn
var attrKey = GetQueryString("AttrKey");
if (attrKey == null || attrKey == '')
attrKey = "WorkCheck";
var elementID = GetQueryString("ElementID");
var webUser = new WebUser();
$(function () {
$('#myModal').modal('hide');
LoadGridData(1, 10);
});
function GetSearchData() {
var handler = new HttpHandler("BP.WF.HttpHandler.WF_WorkOpt");
handler.AddPara("AttrKey", attrKey);
var ens = handler.DoMethodReturnJSON("UsefulExpresFlow_Init");
//ens.RetrieveAll();
var dataInfo = {}
var mainData = [];
//获得数据
$.each(ens, function (i, item) {
if (item != "")
mainData.push({ "MYPK": item.MyPK, "CURVALUE": item.Vals });
})
dataInfo.rows = mainData;
dataInfo.total = mainData.length;
return dataInfo;
}
function LoadGridData() {
$("#newsGrid").html("");
$('#newsGrid').bootstrapTable('load', []);
var data = GetSearchData();
$('#newsGrid').bootstrapTable({
columns: [
{
checkbox: true, width: 1,
cellStyle: { css: { "width": "1px" } }
},
{ field: 'CURVALUE', title: '', align: 'left' }
],
idField: 'MYPK',
selectOnCheck: false,
clickToSelect: true,
checkOnSelect: true,
singleSelect: false,
data: data,
width: 'auto',
height: 'auto',
striped: true,
showHeader: false,
showFooter: false,
sidePagination: 'server',//在服务器分页
});
$('#newsGrid').bootstrapTable('load', data);
}
var insEdit = true;
//添加数据
function btnOpenWindow() {
insEdit = true;
$('#TextArea').val('');
$('#myModal').modal('show');
$('#TextArea').focus();
}
function AddWorks() {
var params;
var isPass = true;
if (insEdit) {//添加
var text = $('#TextArea').val();
text = replaceTrim(text);
if (text == "") {
alert("请输入数据");
$('#TextArea').val('');
$('#TextArea').focus();
return;
}
var ens = new Entities("BP.Sys.FastInputs");
ens.Retrieve("AttrKey", attrKey, "FK_Emp", webUser.No);
for (var i = 0; i < ens.length; i++) {
var en = ens[i];
if (en.Vals == text) {
alert("此用语已经存在!");
isPass = false;
$('#myModal').modal('hide');
return;
}
}
if (isPass) {
var en = new Entity("BP.Sys.FastInput")
en.EnsName = "Flow";
en.CfgKey = "Flow";
en.AttrKey = attrKey;
en.FK_Emp = webUser.No;
en.Vals = text;
en.Insert();
}
$('#myModal').modal('hide');
LoadGridData();
} else {//编辑
var text = $('#TextArea').val();
var mypk = $('#MyPK').val();
text = replaceTrim(text);
//没有输入数据
if (text == "") {
alert("请输入数据");
$('#TextArea').val('');
$('#TextArea').focus();
return;
}
//输入数据没有改变
if (text == againText) {
// alert("数据没有任何改变哦");
// return;
}
var en = new Entity("BP.Sys.FastInput", mypk)
en.Vals = text;
en.Update();
$('#myModal').modal('hide');
LoadGridData();
}
}
var againText;
var defValPK;
//编辑词汇
function btnEdit() {
insEdit = false;
var rows = $('#newsGrid').bootstrapTable('getAllSelections');
if (rows.length == 1) {
againText = rows[0].CURVALUE;
defValPK = rows[0].MYPK;
$('#TextArea').val(rows[0].CURVALUE);
$('#MyPK').val(defValPK);
$('#myModal').modal('show');
$('#TextArea').focus();
}
else {
alert("请选择一条数据");
}
}
//字符的操作
function replaceTrim(val) {//去除空格
val = val.replace(/[ ]/g, "");
val = val.replace(/<\/?.+?>/g, "");
val = val.replace(/[\r\n]/g, "");
return val;
}
//删除
function btnDelete() {
var rows = $('#newsGrid').bootstrapTable('getAllSelections');
if (rows.length >= 1) {
if (confirm('确定要删除这' + rows.length + '条数据吗?') == false)
return;
$.each(rows, function (i, item) {
var en = new Entity("BP.Sys.FastInput", item.MYPK);
en.Delete();
});
LoadGridData();
}
else {
alert("请选择要删除的数据");
}
}
//关闭主窗体
function btnClose() {
var index = parent.layer.getFrameIndex(window.name); //获取当前窗口的name
parent.layer.close(index);
}
//返回数据
function btnOk() {
var rows = $('#newsGrid').bootstrapTable('getAllSelections');
if (rows.length == 0) {
alert("请选择数据");
return;
}
var str = '';
$.each(rows, function (n, value) {
str += value.CURVALUE + ",";
});
str = str.substr(0, str.length - 1);
str = str.replace(/{/g, "");
str = str.replace(/}/g, "");
str = str.replace(/\[/g, "【");
str = str.replace(/\]/g, "】");
str = str.replace(/\"/g, "”");
str = str.replace(/\'/g, "");
if (str == '') {
alert("1.没有选中项<br />2.选中的文件不包含任何数据!");
return;
}
parent.$("#" + elementID).val(str);
var index = parent.layer.getFrameIndex(window.name); //获取当前窗口的name
parent.layer.close(index);
//window.parent.ChangeWorkCheck(elementID, str);
}
</script>
</head>
<body>
<div style=" border: 1px solid #ddd;">
<!--button按钮-->
<div>
<div id="tools" style="text-align: left; float: left;margin:3px 5px">
<button type="button" id="btnAdd" onclick='btnOpenWindow()'><img src="../Img/Btn/addDT.png" width="22" height="22" />添加数据 </button>
<button type="button" id="btnEdit" onclick='btnEdit()'><img src="../Img/Btn/Edit.png" width="18" height="18" /> 编辑</button>
<button type="button" id="btnDel" onclick='btnDelete()'><img src="../Img/Btn/Delete.png" /> 删除</button>
</div>
</div>
<!--table页面-->
<div style="padding: 5px;">
<table id="newsGrid" fit="true"></table>
</div>
<!-- 显示分页信息 -->
<div style="text-align: left;">
<ul class="pagination" id="page_nav"></ul>
<ul class="pagination controls" id="page_info"></ul>
<div style="clear: both;">
</div>
</div>
<div>
<div style="float: right; margin:3px 5px">
<button type="button" onclick='btnOk()' id='btnOk'><img src="../Img/Btn/Confirm.png" /> 确定</button>
<button type="button" onclick='btnClose()' id='btnClose'><img src="../Img/Btn/cancel_dafalut.png" /> 取消</button>
</div>
</div>
</div>
<!--bootstrap弹出页面-->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title" id="myModalLabel">请输入</h4>
</div>
<div class="modal-body">
<input type="hidden" id="MyPK" name="MyPK" value="" />
<textarea id="TextArea" cols="20" rows="2" style="width: 90%; height: 100px; margin-top: 5px; overflow: hidden;"></textarea>
</div>
<div class="modal-footer">
<button type="button" data-dismiss="modal"><img src="../Img/Btn/cancel_dafalut.png" /> 取消</button>
<button type="button" onclick="AddWorks()"><img src="../Img/Btn/Save.png" /> 保存</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal -->
</div>
</body>
</html>