|
|
function CheckFileExt(extstr, exg) {
|
|
|
var extstr = extstr.substring(extstr.lastIndexOf(".")).toLowerCase();
|
|
|
if (!extstr.match(exg)) {
|
|
|
return false;
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
function DateToStr(dt){
|
|
|
var str="";
|
|
|
if(dt.getFullYear){
|
|
|
var y,m,d;
|
|
|
y=formatNumber(dt.getFullYear(),'0000');
|
|
|
m=formatNumber((dt.getMonth()+1),'00'); //01-12
|
|
|
d=formatNumber(dt.getDate(),'00');
|
|
|
str= y+"-"+m+"-"+d;
|
|
|
}
|
|
|
return str;
|
|
|
}
|
|
|
|
|
|
function DateTimeToStr(dt){
|
|
|
var str="";
|
|
|
if(dt.getFullYear){
|
|
|
var y,m,d,h,mi,s;
|
|
|
y=formatNumber(dt.getFullYear(),'0000');
|
|
|
m=formatNumber((dt.getMonth()+1),'00'); //01-12
|
|
|
d=formatNumber(dt.getDate(),'00');
|
|
|
h=formatNumber(dt.getHours(),'00');
|
|
|
mi=formatNumber(dt.getMinutes(),'00');
|
|
|
s=formatNumber(dt.getSeconds(),'00');
|
|
|
str= y+"-"+m+"-"+d+" "+h+":"+mi+":"+s;
|
|
|
}
|
|
|
return str;
|
|
|
}
|
|
|
|
|
|
function StrToDate(str){
|
|
|
var arys= new Array();
|
|
|
arys=str.split('-');
|
|
|
var newDate=new Date(arys[0],arys[1]-1,arys[2]);
|
|
|
return newDate;
|
|
|
}
|
|
|
|
|
|
|
|
|
//重写fixed函数,令其四舍五入算法正常
|
|
|
Number.prototype.toFixed = function (len) {
|
|
|
var add = 0;
|
|
|
var s, temp;
|
|
|
var s1 = this + "";
|
|
|
var start = s1.indexOf(".");
|
|
|
if (start >= 0) {
|
|
|
s1 = s1 + "0";
|
|
|
if (s1.substr(start + len + 1, 1) >= 5) add = 1;
|
|
|
var temp = Math.pow(10, len);
|
|
|
s = Math.floor(this.mul(temp)) + add;
|
|
|
return s / temp;
|
|
|
} else return this;
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
数字格式化函数
|
|
|
|
|
|
“,” (半角的豆号) 如果有的话,看豆号到小数点(如果有的话)前有几位,则按几位划分整数部分
|
|
|
|
|
|
“0”(数字零) 如果该位上没有数字,就补0
|
|
|
“#”(井号) 如果该位上有数字就输出数字,没有则不输出
|
|
|
*/
|
|
|
function formatNumber(number,pattern){
|
|
|
var str = number.toString();
|
|
|
var strInt;
|
|
|
var strFloat;
|
|
|
var formatInt;
|
|
|
var formatFloat;
|
|
|
if(/\./g.test(pattern)){
|
|
|
formatInt = pattern.split('.')[0];
|
|
|
formatFloat = pattern.split('.')[1];
|
|
|
}else{
|
|
|
formatInt = pattern;
|
|
|
formatFloat = null;
|
|
|
}
|
|
|
|
|
|
if(/\./g.test(str)){
|
|
|
if(formatFloat!=null){
|
|
|
var tempFloat = Math.round(parseFloat('0.'+str.split('.')[1])*Math.pow(10,formatFloat.length))/Math.pow(10,formatFloat.length);
|
|
|
strInt = (Math.floor(number)+Math.floor(tempFloat)).toString();
|
|
|
strFloat = /\./g.test(tempFloat.toString())?tempFloat.toString().split('.')[1]:'0';
|
|
|
}else{
|
|
|
strInt = Math.round(number).toString();
|
|
|
strFloat = '0';
|
|
|
}
|
|
|
}else{
|
|
|
strInt = str;
|
|
|
strFloat = '0';
|
|
|
}
|
|
|
if(formatInt!=null){
|
|
|
var outputInt = '';
|
|
|
var zero = formatInt.match(/0*$/)[0].length;
|
|
|
var comma = null;
|
|
|
if(/,/g.test(formatInt)){
|
|
|
comma = formatInt.match(/,[^,]*/)[0].length-1;
|
|
|
}
|
|
|
var newReg = new RegExp('(\\d{'+comma+'})','g');
|
|
|
|
|
|
if(strInt.length<zero){
|
|
|
outputInt = new Array(zero+1).join('0')+strInt;
|
|
|
outputInt = outputInt.substr(outputInt.length-zero,zero)
|
|
|
}else{
|
|
|
outputInt = strInt;
|
|
|
}
|
|
|
|
|
|
var
|
|
|
outputInt = outputInt.substr(0,outputInt.length%comma)+outputInt.substring(outputInt.length%comma).replace(newReg,(comma!=null?',':'')+'$1')
|
|
|
outputInt = outputInt.replace(/^,/,'');
|
|
|
|
|
|
strInt = outputInt;
|
|
|
}
|
|
|
|
|
|
if(formatFloat!=null){
|
|
|
var outputFloat = '';
|
|
|
var zero = formatFloat.match(/^0*/)[0].length;
|
|
|
|
|
|
if(strFloat.length<zero){
|
|
|
outputFloat = strFloat+new Array(zero+1).join('0');
|
|
|
//outputFloat = outputFloat.substring(0,formatFloat.length);
|
|
|
var outputFloat1 = outputFloat.substring(0,zero);
|
|
|
var outputFloat2 = outputFloat.substring(zero,formatFloat.length);
|
|
|
outputFloat = outputFloat1+outputFloat2.replace(/0*$/,'');
|
|
|
}else{
|
|
|
outputFloat = strFloat.substring(0,formatFloat.length);
|
|
|
}
|
|
|
|
|
|
strFloat = outputFloat;
|
|
|
}else{
|
|
|
if(pattern!='' || (pattern=='' && strFloat=='0')){
|
|
|
strFloat = '';
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return strInt+(strFloat==''?'':'.'+strFloat);
|
|
|
}
|
|
|
|
|
|
|
|
|
function ConvertFormValue(formvalue){
|
|
|
|
|
|
var ResultObject = new Object();
|
|
|
var dt = formvalue; //字符串转化为日期
|
|
|
ResultObject= "\\/Date("+Date.UTC(dt.getFullYear(),dt.getMonth(),dt.getDate(),dt.getHours(),dt.getMinutes(),dt.getSeconds())+")\\/"; //转化为UTC日期
|
|
|
return ResultObject;
|
|
|
}
|
|
|
|
|
|
//用于转换日期格式
|
|
|
function WebPosDateTimeToStr(dt){
|
|
|
var str = "";
|
|
|
if(dt!=null)
|
|
|
{
|
|
|
var obj = eval("new " + dt.substr(1,dt.length-2));//.toString();
|
|
|
//str=Ext.util.Format.date(obj,'Y-m-d H:i:s');
|
|
|
str=DateTimeToStr(obj);
|
|
|
}
|
|
|
return str;
|
|
|
}
|
|
|
|
|
|
function WebPosDateToStr(dt){
|
|
|
var str = "";
|
|
|
if(dt!=null)
|
|
|
{
|
|
|
var obj = eval("new " + dt.substr(1,dt.length-2));
|
|
|
str=DateToStr(obj);
|
|
|
}
|
|
|
return str;
|
|
|
}
|
|
|
|
|
|
|
|
|
//用于添加SQL语句的函数
|
|
|
|
|
|
function getAndConSql(sql,valuestr,constr){
|
|
|
if (valuestr == '' || valuestr == null || valuestr== undefined)
|
|
|
{
|
|
|
return '';
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
if (sql == '') {
|
|
|
return constr;
|
|
|
}
|
|
|
else {
|
|
|
return ' and ' + constr;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
function getAndConSqlTwo(sql,constr){
|
|
|
if(sql=='')
|
|
|
{
|
|
|
return constr;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
return ' and ' + constr;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//此函数验证EditGrid并显示需要的错误
|
|
|
//The function returns false if there is an error else it returns true.
|
|
|
|
|
|
function validateEditorGridPanel(grid) {
|
|
|
//var grid = Ext.getCmp(gridId);
|
|
|
var rows = grid.store.data.length;
|
|
|
var columns = grid.columns;
|
|
|
var editingPlugin = grid.editingPlugin;
|
|
|
|
|
|
for (var row = 0; row < rows; row++) {
|
|
|
var record = grid.store.getAt(row);
|
|
|
for (var col = 0; col < columns.length; col++) {
|
|
|
var column = columns[col];
|
|
|
var cellEditor = column.getEditor(record); //grid.colModel.getCellEditor(col, row);
|
|
|
if (cellEditor != undefined) {
|
|
|
if (!cellEditor.isValid()) {
|
|
|
editingPlugin.startEditByPosition({ row: row, column: col });
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
|
|
|
//把表格中显示的记录转为Json数据(只转修改的)
|
|
|
function ConvertRecordsToJson(items) {
|
|
|
if (items.length == 0) {
|
|
|
return "";
|
|
|
}
|
|
|
var jsonData = "[";
|
|
|
for (var i = 0; i < items.length; i++) {
|
|
|
var record = items[i];
|
|
|
if (record.dirty) {
|
|
|
jsonData += Ext.JSON.encode(record.data) + ",";
|
|
|
}
|
|
|
}
|
|
|
if (jsonData != "[") {
|
|
|
jsonData = jsonData.substring(0, jsonData.length - 1) + "]";
|
|
|
} else
|
|
|
jsonData = "";
|
|
|
return jsonData;
|
|
|
}
|
|
|
|
|
|
//把表格中显示的记录转为Json数据
|
|
|
function ConvertRecordsToJsonAll(items)
|
|
|
{
|
|
|
if(items.length==0)
|
|
|
{
|
|
|
return "";
|
|
|
}
|
|
|
var jsonData = "[";
|
|
|
for(i=0;i<items.length;i++) {
|
|
|
var record = items[i];
|
|
|
jsonData += Ext.JSON.encode(record.data) + ",";
|
|
|
}
|
|
|
if(jsonData!="[")
|
|
|
{
|
|
|
jsonData = jsonData.substring(0,jsonData.length-1) + "]";
|
|
|
}
|
|
|
else
|
|
|
jsonData="";
|
|
|
return jsonData;
|
|
|
}
|
|
|
|
|
|
//把表格中显示的记录转为Json数据
|
|
|
function convertArraysToString(items)
|
|
|
{
|
|
|
if(items.length==0)
|
|
|
{
|
|
|
return "";
|
|
|
}
|
|
|
var jsonData = "";
|
|
|
for(i=0;i<items.length;i++) {
|
|
|
var record = items[i];
|
|
|
jsonData += Ext.JSON.encode(record) + ",";
|
|
|
}
|
|
|
jsonData = jsonData.substring(0,jsonData.length-1);
|
|
|
return jsonData;
|
|
|
}
|
|
|
|
|
|
function convertArraysToJson(items) {
|
|
|
if (items.length == 0) {
|
|
|
return "";
|
|
|
}
|
|
|
var jsonData = "[";
|
|
|
for (i = 0; i < items.length; i++) {
|
|
|
var record = items[i];
|
|
|
jsonData += Ext.JSON.encode(record) + ",";
|
|
|
}
|
|
|
jsonData = jsonData.substring(0, jsonData.length - 1);
|
|
|
jsonData += "]";
|
|
|
return jsonData;
|
|
|
}
|
|
|
|
|
|
|
|
|
function ConvertStringListToJson(List) {
|
|
|
if (List.length == 0) {
|
|
|
return "";
|
|
|
}
|
|
|
var jsonData = "[";
|
|
|
for (i = 0; i < List.length; i++) {
|
|
|
jsonData += Ext.JSON.encode(List[i]) + ",";
|
|
|
}
|
|
|
if (jsonData != "[") {
|
|
|
jsonData = jsonData.substring(0, jsonData.length - 1) + "]";
|
|
|
}
|
|
|
else
|
|
|
jsonData = "";
|
|
|
return jsonData;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//判断如果Form中的控件为ReadOnly那么则设置为disable
|
|
|
function setFormCmpDisable(form)
|
|
|
{
|
|
|
form.getForm().items.each(function(item){
|
|
|
if(item.readOnly)
|
|
|
item.disable();
|
|
|
});
|
|
|
}
|
|
|
//判断如果Form中的控件为ReadOnly那么则设置为enable
|
|
|
function setFormCmpEnable(form)
|
|
|
{
|
|
|
form.getForm().items.each(function(item){
|
|
|
if(item.readOnly)
|
|
|
item.enable();
|
|
|
});
|
|
|
}
|
|
|
|
|
|
/*这里开始时UrlEncode和UrlDecode函数*/
|
|
|
UrlEncode = function(str)
|
|
|
{
|
|
|
str = str.replace(/./g,function(sHex)
|
|
|
{
|
|
|
window.EnCodeStr = "";
|
|
|
window.sHex = sHex;
|
|
|
window.execScript('window.EnCodeStr=Hex(Asc(window.sHex))',"vbscript");
|
|
|
return window.EnCodeStr.replace(/../g,"%$&");
|
|
|
});
|
|
|
return str;
|
|
|
}
|
|
|
|
|
|
function trim(str){
|
|
|
for(var i = 0 ; i<str.length && str.charAt(i)==" " ; i++ ) ;
|
|
|
for(var j =str.length; j>0 && str.charAt(j-1)==" " ; j--) ;
|
|
|
if(i>j) return "";
|
|
|
return str.substring(i,j);
|
|
|
}
|
|
|
|
|
|
|
|
|
function ExportExcel(gridPanel, config) {
|
|
|
if (gridPanel) {
|
|
|
var tmpStore = gridPanel.getStore();
|
|
|
var tmpExportContent = '';
|
|
|
|
|
|
//以下处理分页grid数据导出的问题,从服务器中获取所有数据,需要考虑性能
|
|
|
var tmpParam = Ext.ux.clone(tmpStore.lastOptions); //此处克隆了原网格数据源的参数信息
|
|
|
|
|
|
if (tmpParam && tmpParam.params) {
|
|
|
delete (tmpParam.params[tmpStore.paramNames.start]); //删除分页参数
|
|
|
delete (tmpParam.params[tmpStore.paramNames.limit]);
|
|
|
}
|
|
|
var tmpAllStore = new Ext.data.GroupingStore({//重新定义一个数据源
|
|
|
proxy: tmpStore.proxy,
|
|
|
reader: tmpStore.reader
|
|
|
});
|
|
|
tmpAllStore.on('load', function (store) {
|
|
|
config.store = store;
|
|
|
tmpExportContent = gridPanel.getExcelXml(false, config); //此方法用到了一中的扩展
|
|
|
if (Ext.isIE || Ext.isSafari || Ext.isSafari2 || Ext.isSafari3) {//在这几种浏览器中才需要,IE8测试不能直接下载了
|
|
|
if (!Ext.fly('frmDummy')) {
|
|
|
var frm = document.createElement('form');
|
|
|
frm.id = 'frmDummy';
|
|
|
frm.name = id;
|
|
|
frm.className = 'x-hidden';
|
|
|
document.body.appendChild(frm);
|
|
|
}
|
|
|
Ext.Ajax.request({
|
|
|
//将生成的xml发送到服务器端,需特别注意这个页面的地址
|
|
|
url: '/CommMng/PubSys/ExportGrid',
|
|
|
method: 'POST',
|
|
|
form: Ext.fly('frmDummy'),
|
|
|
callback: function (o, s, r) {
|
|
|
//alert(r.responseText);
|
|
|
},
|
|
|
isUpload: true,
|
|
|
params: { ExportContent: tmpExportContent, ExportFile: gridPanel.id + '.xls' }
|
|
|
});
|
|
|
} else {
|
|
|
document.location = 'data:application/vnd.ms-excel;base64,' + Base64.encode(tmpExportContent);
|
|
|
}
|
|
|
});
|
|
|
tmpAllStore.load(tmpParam); //获取所有数据
|
|
|
}
|
|
|
};
|
|
|
|
|
|
function GridExportExcelPage(grid) {
|
|
|
var vExportContent = grid.getExcelXml();
|
|
|
if (Ext.isIE6 || Ext.isIE7 || Ext.isIE8 || Ext.isIE9 || Ext.isSafari || Ext.isSafari2 || Ext.isSafari3 || Ext.isChrome) {
|
|
|
if (!Ext.fly('frmDummy')) {
|
|
|
var frm = document.createElement('form');
|
|
|
frm.id = 'frmDummy';
|
|
|
frm.name = ''; //id;
|
|
|
frm.className = 'x-hidden';
|
|
|
document.body.appendChild(frm);
|
|
|
}
|
|
|
|
|
|
Ext.Ajax.request({
|
|
|
url: '/CommMng/PubSys/ExportGrid',
|
|
|
method: 'POST',
|
|
|
form: Ext.fly('frmDummy'),
|
|
|
callback: function (o, s, r) {
|
|
|
//alert(r.responseText);
|
|
|
|
|
|
},
|
|
|
isUpload: true,
|
|
|
params: {
|
|
|
ExportContent: Base64.encode(vExportContent),
|
|
|
ExportFile: '导出数据.xls'
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
|
|
|
|
document.location = 'data:application/vnd.ms-excel;base64,' + Base64.encode(vExportContent);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
function PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6) {
|
|
|
Ext.Msg.wait('正在准备打印数据, 请稍侯..');
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在准备打印数据...',
|
|
|
url: '/CommMng/Print/GetPrintInfo',
|
|
|
scope: this,
|
|
|
params: {
|
|
|
type: printType,
|
|
|
sql1: sql1,
|
|
|
sql2: sql2,
|
|
|
sql3: sql3,
|
|
|
sql4: sql4,
|
|
|
sql5: sql5,
|
|
|
sql6: sql6
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
Ext.MessageBox.hide();
|
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
|
if (jsonresult.Success) {
|
|
|
var printUrl = "print://?comp=" + jsonresult.CompanyID + "&type=" + printType + "&dbid=" + jsonresult.DbSourceID + "&uid=" + jsonresult.UserId; //alert(printUrl);
|
|
|
if (jsonresult.PrServer != NaN && jsonresult.PrServer != null && jsonresult.PrServer != "")
|
|
|
printUrl = "print://?comp=" + jsonresult.CompanyID + "&type=" + printType + "&dbid=" + jsonresult.DbSourceID + "&uid=" + jsonresult.UserId + "&PrServer=" + jsonresult.PrServer + "&dbStr=" + jsonresult.dbStr; //alert(printUrl);
|
|
|
|
|
|
window.location.href = window.location.href;
|
|
|
location.href = printUrl;
|
|
|
} else {
|
|
|
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
|
}
|
|
|
} else {
|
|
|
Ext.Msg.show({ title: '请重试',
|
|
|
msg: '服务器响应出错',
|
|
|
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
function GridExportExcel(gridPanel, config) {
|
|
|
if (!config) {
|
|
|
config = {
|
|
|
store: null, //因为后续可能需要处理分页,因此此处一般不直接传递GridPanel的数据源
|
|
|
title: '', //需要显示标题
|
|
|
limit: 4000
|
|
|
};
|
|
|
}
|
|
|
if (gridPanel) {
|
|
|
var tmpStore = gridPanel.getStore();
|
|
|
var vExportContent = '';
|
|
|
|
|
|
//以下处理分页grid数据导出的问题,从服务器中获取所有数据,需要考虑性能
|
|
|
var tmpParam = Ext.ux.constructor(tmpStore.lastOptions); //此处克隆了原网格数据源的参数信息
|
|
|
//alert(tmpParam.params[tmpStore.paramNames.limit]);
|
|
|
//此处作者原先为Ext.ux.clone(tmpStore.lastOptions)方法,但不好使
|
|
|
|
|
|
var tmpAllStore = new Ext.data.GroupingStore({//重新定义一个数据源
|
|
|
proxy: tmpStore.proxy,
|
|
|
reader: tmpStore.reader
|
|
|
});
|
|
|
tmpParam.params[tmpStore.paramNames.limit] = config.limit;
|
|
|
tmpAllStore.load(tmpParam); //获取所有数据
|
|
|
tmpAllStore.on('load', function (store) {
|
|
|
config.store = store;
|
|
|
vExportContent = gridPanel.getExcelXml(false, config); //此方法用到了一中的扩展
|
|
|
if (Ext.isIE6 || Ext.isIE7 || Ext.isIE8 || Ext.isSafari || Ext.isSafari2 || Ext.isSafari3) {
|
|
|
if (!Ext.fly('frmDummy')) {
|
|
|
var frm = document.createElement('form');
|
|
|
frm.id = 'frmDummy';
|
|
|
frm.name = id;
|
|
|
frm.className = 'x-hidden';
|
|
|
document.body.appendChild(frm);
|
|
|
}
|
|
|
|
|
|
Ext.Ajax.request({
|
|
|
url: '/PubSys/ExportGrid',
|
|
|
method: 'POST',
|
|
|
form: Ext.fly('frmDummy'),
|
|
|
callback: function (o, s, r) {
|
|
|
|
|
|
},
|
|
|
isUpload: true,
|
|
|
params: {
|
|
|
ExportContent: Base64.encode(vExportContent),
|
|
|
ExportFile: '导出数据.xls'
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
|
|
|
|
document.location = 'data:application/vnd.ms-excel;base64,' + Base64.encode(vExportContent);
|
|
|
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
|
|
|
|
|
|
Ext.define('WorkFlow_Step', {
|
|
|
extend: 'Ext.data.Model',
|
|
|
idProperty: 'id',
|
|
|
fields: [
|
|
|
{ name: 'GID', type: 'string' },
|
|
|
{ name: 'NAME', type: 'string' },
|
|
|
{ name: 'STEPNO', type: 'string' },
|
|
|
{ name: 'ISLAST', type: 'string' }
|
|
|
]
|
|
|
});
|
|
|
function GetWorkFlowStep(WorkflowID, USERID) {
|
|
|
var storeWorkFlow_Step = Ext.create('Ext.data.Store', {
|
|
|
model: 'WorkFlow_Stepmb',
|
|
|
remoteSort: false,
|
|
|
pruneModifiedRecords: true,
|
|
|
proxy: {
|
|
|
type: 'ajax',
|
|
|
url: '/OA/BasicDataRef/GetWorkFlowStep',
|
|
|
reader: {
|
|
|
id: 'GID',
|
|
|
root: 'data',
|
|
|
totalProperty: 'totalCount'
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
storeWorkFlow_Step.load({ params: { WorkflowID: WorkflowID, USERID: USERID} });
|
|
|
|
|
|
return storeWorkFlow_Step;
|
|
|
};
|
|
|
|
|
|
|
|
|
Ext.define('WorkFlow_Usingmb', {
|
|
|
extend: 'Ext.data.Model',
|
|
|
idProperty: 'id',
|
|
|
fields: [
|
|
|
{ name: 'BSNO', type: 'string' },
|
|
|
{ name: 'WORKFLOWID', type: 'string' },
|
|
|
{ name: 'STEPNO', type: 'string' },
|
|
|
{ name: 'REJECTOR_ID', type: 'string' },
|
|
|
{ name: 'REJECT_TIME', type: 'string' },
|
|
|
{ name: 'FINISHED', type: 'string' },
|
|
|
{ name: 'ISDELETE', type: 'string' },
|
|
|
{ name: 'DELETEUSER', type: 'string' },
|
|
|
{ name: 'DELETETIME', type: 'string' }
|
|
|
]
|
|
|
});
|
|
|
function GetWorkFlowCanDo(WorkflowID, StepNo, USERID) {
|
|
|
var storeWorkFlow_Using = Ext.create('Ext.data.Store', {
|
|
|
model: 'WorkFlow_Usingmb',
|
|
|
remoteSort: false,
|
|
|
pruneModifiedRecords: true,
|
|
|
proxy: {
|
|
|
type: 'ajax',
|
|
|
url: '/OA/BasicDataRef/GetWorkFlowState',
|
|
|
reader: {
|
|
|
id: 'BSNO',
|
|
|
root: 'data',
|
|
|
totalProperty: 'totalCount'
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
//WorkflowID, StepNo, USERID
|
|
|
this.storeWorkFlow_Using.load({ params: { WorkflowID: WorkflowID, StepNo: parseInt(StepNo), USERID: USERID} });
|
|
|
};
|
|
|
|
|
|
//除法函数,用来得到精确的除法结果
|
|
|
//说明:javascript的除法结果会有误差,在两个浮点数相除的时候会比较明显。这个函数返回较为精确的除法结果。
|
|
|
//调用:accDiv(arg1,arg2)
|
|
|
//返回值:arg1除以arg2的精确结果
|
|
|
function accDiv(arg1, arg2) {
|
|
|
var t1 = 0, t2 = 0, r1, r2;
|
|
|
try { t1 = arg1.toString().split(".")[1].length } catch (e) { }
|
|
|
try { t2 = arg2.toString().split(".")[1].length } catch (e) { }
|
|
|
with (Math) {
|
|
|
r1 = Number(arg1.toString().replace(".", ""))
|
|
|
r2 = Number(arg2.toString().replace(".", ""))
|
|
|
return (r1 / r2) * pow(10, t2 - t1);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//给Number类型增加一个div方法,调用起来更加方便。
|
|
|
Number.prototype.div = function (arg) {
|
|
|
return accDiv(this, arg);
|
|
|
}
|
|
|
|
|
|
//乘法函数,用来得到精确的乘法结果
|
|
|
//说明:javascript的乘法结果会有误差,在两个浮点数相乘的时候会比较明显。这个函数返回较为精确的乘法结果。
|
|
|
//调用:accMul(arg1,arg2)
|
|
|
//返回值:arg1乘以arg2的精确结果
|
|
|
function accMul(arg1, arg2) {
|
|
|
var m = 0, s1 = arg1.toString(), s2 = arg2.toString();
|
|
|
try { m += s1.split(".")[1].length } catch (e) { }
|
|
|
try { m += s2.split(".")[1].length } catch (e) { }
|
|
|
return Number(s1.replace(".", "")) * Number(s2.replace(".", "")) / Math.pow(10, m)
|
|
|
}
|
|
|
|
|
|
//给Number类型增加一个mul方法,调用起来更加方便。
|
|
|
Number.prototype.mul = function (arg) {
|
|
|
return accMul(arg, this);
|
|
|
}
|
|
|
|
|
|
//加法函数,用来得到精确的加法结果
|
|
|
//说明:javascript的加法结果会有误差,在两个浮点数相加的时候会比较明显。这个函数返回较为精确的加法结果。
|
|
|
//调用:accAdd(arg1,arg2)
|
|
|
//返回值:arg1加上arg2的精确结果
|
|
|
function accAdd(arg1, arg2) {
|
|
|
var r1, r2, m;
|
|
|
try { r1 = arg1.toString().split(".")[1].length } catch (e) { r1 = 0 }
|
|
|
try { r2 = arg2.toString().split(".")[1].length } catch (e) { r2 = 0 }
|
|
|
m = Math.pow(10, Math.max(r1, r2))
|
|
|
return accDiv((accMul(arg1 , m) + accMul(arg2 , m)) , m)
|
|
|
}
|
|
|
|
|
|
//给Number类型增加一个add方法,调用起来更加方便。
|
|
|
Number.prototype.add = function (arg) {
|
|
|
return accAdd(arg, this);
|
|
|
}
|
|
|
|
|
|
|
|
|
function Add(a, b, length) {
|
|
|
if ((typeof (length) == undefined) || (length == null)) {
|
|
|
length = 2;
|
|
|
}
|
|
|
var _r = parseFloat(a).add(parseFloat(b)).toFixed(parseInt(length));
|
|
|
return parseFloat(_r);
|
|
|
}
|
|
|
function Cut(a, b, length) {
|
|
|
if ((typeof (length) == undefined) || (length == null)) {
|
|
|
length = 2;
|
|
|
}
|
|
|
var _r = parseFloat(a).add(parseFloat(0) - parseFloat(b)).toFixed(parseInt(length));
|
|
|
return parseFloat(_r);
|
|
|
}
|
|
|
function Mul(a, b, length) {
|
|
|
if ((typeof (length) == undefined) || (length == null)) {
|
|
|
length = 2;
|
|
|
}
|
|
|
var _r = parseFloat(a).mul(parseFloat(b))
|
|
|
|
|
|
var _r2 = _r.toFixed(parseInt(length));
|
|
|
return parseFloat(_r2);
|
|
|
}
|
|
|
|
|
|
function Mul3(a, b, c, length) {
|
|
|
if ((typeof (length) == undefined) || (length == null)) {
|
|
|
length = 2;
|
|
|
}
|
|
|
var _r = (parseFloat(a).mul(parseFloat(b)).mul(parseFloat(c))).toFixed(parseInt(length));
|
|
|
return parseFloat(_r);
|
|
|
}
|
|
|
function Mul4(a, b, c, d, length) {
|
|
|
if ((typeof (length) == undefined) || (length == null)) {
|
|
|
length = 2;
|
|
|
}
|
|
|
var _r = (parseFloat(a).mul(parseFloat(b)).mul(parseFloat(c)).mul(parseFloat(d))).toFixed(parseInt(length));
|
|
|
return parseFloat(_r);
|
|
|
}
|
|
|
function Mul5(a, b, c, d, e, length) {
|
|
|
if ((typeof (length) == undefined) || (length == null)) {
|
|
|
length = 2;
|
|
|
}
|
|
|
var _r = (parseFloat(a).mul(parseFloat(b)).mul(parseFloat(c)).mul(parseFloat(d)).mul(parseFloat(e))).toFixed(parseInt(length));
|
|
|
return parseFloat(_r);
|
|
|
}
|
|
|
function Div(a, b, length) {
|
|
|
if ((typeof (length) == undefined) || (length == null)) {
|
|
|
length = 2;
|
|
|
}
|
|
|
var _r = parseFloat(a).div(parseFloat(b)).toFixed(parseInt(length));
|
|
|
return parseFloat(_r);
|
|
|
}
|
|
|
|
|
|
function newGuid() {
|
|
|
var guid = "";
|
|
|
for (var i = 1; i <= 32; i++) {
|
|
|
var n = Math.floor(Math.random() * 16.0).toString(16);
|
|
|
guid += n;
|
|
|
if ((i == 8) || (i == 12) || (i == 16) || (i == 20))
|
|
|
guid += "-";
|
|
|
}
|
|
|
return guid.toUpperCase();
|
|
|
}
|