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.

271 lines
10 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 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">
var webUser = new WebUser();
var ens = null;
$(function () {
//获得存储的数据.
var webUser = new WebUser();
ens = new Entities("BP.Sys.FastInputs");
ens = ens.DoMethodReturnJSON("InitData_Flow");
var html = "<ul>";
for (var i = 0; i < ens.length; i++) {
var en = ens[i];
html += "<li><input type=check id='CB_" + en.MyPK + "' /> <input type=text id='TB_" + en.MyPK + "' value='" + en.Vals + "'><li>";
}
html += "</ul>";
});
function Save() {
for (var i = 0; i < ens.length; i++) {
var en = ens[i];
var val = $("#TB_" + en.MyPK).val();
if (val != en.Vals) {
var en1 = new Entiy("BP.Sys.FastInput", en);
en1.Vals = val;
en1.Update();
}
}
}
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 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="btnEdit" onclick='BtnOK()'><img src="../Img/Btn/Confirm.png" width="18" height="18" /> 选取</button>
<button type="button" id="btnEdit" onclick='Save()'><img src="../Img/Btn/Edit.png" width="18" height="18" /> 保存</button>
<button type="button" id="btnEdit" onclick='btnClose()'><img src="../Img/Btn/cancel_dafalut.png" width="18" height="18" /> 取消</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>