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.

225 lines
7.4 KiB
Plaintext

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>字号管理</title>
<meta charset="UTF-8" />
<base target="_self" />
<script src="../../Scripts/jquery-1.7.2.min.js" type="text/javascript"></script>
<script src="../../" type="text/javascript"></script>
<script src="../../Scripts/config.js" type="text/javascript"></script>
<script src="../../Comm/Gener.js" type="text/javascript"></script>
<link href="../../../DataUser/Style/ccbpm.css" rel="stylesheet" />
<script type="text/javascript">
var frmID = GetQueryString("FrmID");
var oid = GetQueryString("OID");
$(function () {
var myDate = new Date();
var currentyear = myDate.getFullYear();
var lastyear = currentyear - 1;
$("#DDL_Year").append("<option value='" + currentyear + "'>" + currentyear + "</option>");
$("#DDL_Year").append("<option value='" + lastyear + "'>" + lastyear + "</option>");
var handler = new HttpHandler("BP.WF.HttpHandler.WF_CCFormr_Components");
handler.AddUrlData();
var data = handler.DoMethodReturnString("DocWord_Init");
if (data.indexOf('err@') == 0) {
alert(data); //如果是异常,就提提示.
return;
}
data = JSON.parse(data);
data = data[0];
//获得第一行数据. DocWordKey字的外键,DocWordName字的名称,DocWordYear年度,DocWordLSH流水号,DocWord字号
//比如:DocWordKey=001, DocWordName=鲁法字,DocWordYear=2019,DocWordLSH=001,DocWord=鲁法字2019-001
// alert(data.DocWordKey);
//绑定数据.
BindIt(data);
});
//展现数据.
function BindIt(data) {
//1. 查询出来代字.
var flowno = GetQueryString("FK_Flow");
var recwordflows = new Entities("BP.DOC.WD.RecwordFlows");
recwordflows.Retrieve("FK_Flow", flowno)
if (recwordflows.length == 0) {
alert("没有为该流程配置收文文号,请先配置");
return;
}
var ensName = "BP.DOC.WD.Recwords";
var words = new Entities(ensName);
var f = "";
for (var i = 0; i < recwordflows.length; i++) {
var recwordflow = recwordflows[i];
if (i==0) {
f += "'" + recwordflow.FK_Recword + "'";
}
f += ",'" + recwordflow.FK_Recword + "'";
}
words.RetrieveCond("No", "In","("+f+")");
if (words.length == 0) {
alert('没有配置字号,无法生成编号.');
return;
}
GenerBindDDL("DDL_WordKey", words, "No", "Name", data.DocWordKey);//绑定到文本框.
//2. 返回年度. 绑定年度. 年度仅仅是,当前与上一年两个选项. 此处已经使用Date()年份
// GenerBindDDL("DDL_Year", words, "No", "Name", data.DocWordYear);//绑定到文本框.
//3. 绑定序列号编号.
$("#TB_LSH").val(data.DocWordLSH);
}
///下拉框变化后.
function DocWordReceive_ReGenerDocWord() {
var handler = new HttpHandler("BP.WF.HttpHandler.WF_CCFormr_Components");
handler.AddFormData();
handler.AddUrlData(); //增加参数数据
var data = handler.DoMethodReturnString("DocWord_ReGenerDocWord");
$("#TB_LSH").val(data);
////让其重新绑定.
//BindIt(data);
}
//字变化的时候.
function WhenDDL_Word() {
DocWordReceive_ReGenerDocWord();
}
//年度变化的时候.
function WhenDDL_ND() {
DocWordReceive_ReGenerDocWord();
}
function NewNum() {
var pro = promptGener("请输入新编号", '');
if (pro == undefined)
return;
$("#TB_LSH").val(pro);
Save();
}
function AutoNum() {
DocWordReceive_ReGenerDocWord();
alert('生成成功.');
return;
}
function SelecBlankNum() {
var handler = new HttpHandler("BP.WF.HttpHandler.WF_CCFormr_Components");
handler.AddFormData();
var text = $("#DDL_WordKey option:selected").text();//获取字号select的text
handler.AddUrlData(); //增加参数数据
handler.AddPara("DocWordName", text);
var data = handler.DoMethodReturnString("DocWordReceive_GenerBlankNum");
if (data.indexOf('err@') == 0) {
alert(data);
return;
}
//选择一个空闲的编号.
if (data == "0" || data == "") {
alert('无空白的编号');
return;
}
data = "001,005,5,6,9";
var html = "<ul>";
for (var i = 0; i < data.length; i++) {
html += "<li><a href=\"javascript:SelectIt('" + i + "');\" >" + i + "</a></li>";
}
html += "</ul>";
$("#list").html(html);
}
function SelectIt(num) {
$("#TB_LSH").val(num);
Save();
}
///保存的时候.
function Save() {
var handler = new HttpHandler("BP.WF.HttpHandler.WF_CCFormr_Components");
handler.AddFormData();
var text = $("#DDL_WordKey option:selected").text();//获取字号select的text
handler.AddUrlData(); //增加参数数据
handler.AddPara("DocWordName", text);
var data = handler.DoMethodReturnString("DocWord_Save");
if (data.indexOf('err@') == 0) {
alert(data);
return;
}
// alert("保存成功");
window.parent.ChangeDocWordReceive(data);
}
function Close() {
window.parent.CloseBootstrapDialog();
}
</script>
</head>
<body>
<form id="cc">
<table style="width:100%;">
<tr>
<td> 字 </td>
<td> <select id="DDL_WordKey" name="DDL_WordKey" onchange="DocWordReceive_ReGenerDocWord()"></select> </td>
<td> 年度 </td>
<td>
<select id="DDL_Year" name="DDL_Year" onchange="DocWordReceive_ReGenerDocWord()">
</select>
</td>
<td>流水号</td>
<td> <input type="text" id="TB_LSH" name="TB_LSH" /> </td>
</tr>
<tr>
<td colspan="6">
<!--<input type="button" value="自动生成编号" onclick="AutoNum();" />
<input type="button" value="自定义编号" onclick="NewNum();" />-->
<!--<input type="button" value="选择空闲编号" onclick="SelecBlankNum();" />-->
<input type="button" value="保存并关闭" onclick="Save();" />
<!--<input type="button" value="关闭" onclick="Close();" />-->
</td>
</tr>
<tr>
<td colspan="6">
<div id="list"></div>
</td>
</tr>
</table>
</form>
</body>
</html>