123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716 |
- //身份证号********格式化
- function idCardNoFmt(idCardNo) {
- if(idCardNo){
- var no = idCardNo;
- if(idCardNo.length==18){
- no = idCardNo.substr(0,18);
- var reg = /^(\d{6})\d{8}([0-9Xx]{4})$/;
- no = no.replace(reg, "$1********$2");
- return no;
- }else{
-
- return idCardNo;
- }
- }else{
- return idCardNo;
- }
- }
- //传入字段名,获取数据,并添加空值
- function addDefaultValue(value){
- var theArray = getListData(value);
- var temp = {
- id:"",
- text:"全部"
- };
- theArray.push(temp);
- return theArray;
- }
- //传入字段名,获取数据,并添加空值
- function addDefaultFilterValue(value){
- var theArray = getListData(value);
- var temp = {
- id:"",
- text:"全部"
- };
- theArray.push(temp);
- var temp1 = {
- id:"9999",
- text:"待受理",
- selected:true//设置默认值
- };
- theArray.unshift(temp1);//放到数组第一个
- return theArray;
- }
- //格式化时间
- function dateboxEtr() {
- return {
- type : 'datebox',
- options : {
- editable : false,
- required : true,
- panelHeight : 'auto'
- }
- };
- }
- //按照一定格式得到系统当前时间
- function getNowFormatDate() {
- var date = new Date();
- var currentTime = date.Format("yyyy-MM-dd hh:mm:ss");
- return currentTime;
- }
- Date.prototype.Format = function(format){
- var o = {
- "M+" : this.getMonth()+1, //month
- "d+" : this.getDate(), //day
- "h+" : this.getHours(), //hour
- "m+" : this.getMinutes(), //minute
- "s+" : this.getSeconds(), //second
- "q+" : Math.floor((this.getMonth()+3)/3), //quarter
- "S" : this.getMilliseconds() //millisecond
- };
- if(/(y+)/.test(format)) {
- format = format.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length));
- }
- for(var k in o) {
- if(new RegExp("("+ k +")").test(format)) {
- format = format.replace(RegExp.$1, RegExp.$1.length==1 ? o[k] : ("00"+ o[k]).substr((""+ o[k]).length));
- }
- }
- return format;
- };
- /**
- * 格式化时间字符串
- * 20160329100310格式化为2016-03-29 10:03:10
- * 20160329格式化为2016-03-29
- * @param value
- * @returns
- */
- function timeFmt(value) {
- if(!value) {
- return value;
- }
- if (isNaN(value.toString().substring(0,1))){
- return value;
- }
-
- var fmtTime="";
- var time = value.toString();
- time=time.replace(/\-/g, "").replace(/\s+/g, "").replace(/\:/g, "");
- var year=time.substring(0,4);
- var month=time.substring(4,6);
- var day=time.substring(6,8);
- var hour=time.substring(8,10);
- var minute=time.substring(10,12);
- var second=time.substring(12,14);
- if(year && month && day) {
- fmtTime = fmtTime + year + "-" + month + "-" + day;
- }
- if(hour && minute && second) {
- fmtTime = fmtTime + " " + hour + ":" + minute + ":" + second;
- }
- return fmtTime;
- }
- /**
- * ajax 通信工具类(协议用到)
- *
- * @param transCode 交易码
- * @param servletName servlet名称
- * @param proNames proName字段
- * @param params 参数
- * @param fun_success
- * @param fun_error
- * @param isLoginOut
- */
- function syncAjaxCall2(transCode,servletName,proNames,params,fun_success, fun_error, isLoginOut) {
- if (params == null) {
- params = {};
- }
- __mask++;
- if (__mask >= 0) {
- showLoading(1);
- }
- url = sysWebAppName + servletName + '?transCode=' + transCode
- + '&clientToken=' + $.__token+'&proNames=' + proNames +'&channelNo=service';
- $
- .ajax({
- url : encodeURI(url),
- data : encodeURI(params || ''),
- type : "POST",
- contentType : "application/x-www-form-urlencoded; charset=utf-8",
- dataType : "text",
- timeout : ajaxTimeout,
- success : function(data) {
- data = $.parseJSON(data);
- __mask--;
- if (data == null)
- return;
- if (__mask == 0) {
- showLoading(-1);
- }
- if (data.returnCode == 'EB8000006') {
- if (isLoginOut) {
- fun_success && fun_success(data);
- } else {
- if (__login > 0)
- return;
- $.messager
- .confirm(
- '用户异常提示',
- '用户异常,是否重新登录。',
- function(r) {
- if (r) {
- $(
- ".leftcurtain",
- window.parent.document)
- .stop().animate({
- width : '50%'
- }, 1500);
- $(
- ".rightcurtain",
- window.parent.document)
- .stop().animate({
- width : '51%'
- }, 1500);
- $(
- ".login",
- window.parent.document)
- .show();
- $(
- ".login",
- window.parent.document)
- .find(
- "input[type=password]")
- .val("");
- $(
- ".login",
- window.parent.document)
- .find(
- "input[type=text]")
- .val("");
- parent.changeImage();
- __login--;
- } else {
- __login--;
- }
- });
- __login++;
- }
- } else {
-
- if (data.returnCode == successCode || data.success) {
- fun_success && fun_success(data);
- } else {
- if (fun_error) {
- fun_error && fun_error(data);
- }
- }
- }
- },
- error : function(XMLHttpRequest, textStatus, errorThrown) {
- __mask--;
- if (__mask == 0) {
- showLoading(-1);
- }
- if (fun_error) {
- fun_error
- && fun_error(XMLHttpRequest, textStatus,
- errorThrown);
- }
- }
- });
- }
- //添加远程数据
- function comboBoxChannel2(channelList,id,text) {
- return {
- type : 'combobox',
- options : {
- editable : false,
- required : true,
- data : channelList,
- valueField : id,
- textField : text,
- panelHeight : 'auto'
- }
- };
- }
- //获取当前登录用户的userId
- function getUserId() {
- return $.mapData.get("myUserId");
- }
- //获取当前登录用户的昵称
- function getNickName() {
- return $.mapData.get("myNickName");
- }
- // 获取人员列表
- function getUserList() {
- var userList=[]; //人员列表数据
- var userListTmp=[]; //人员列表数据
- //以下不直接返回List,不需要isList=1参数,直接加载使用,以下方式可以检测通讯故障
- crudAjaxCall('HS1001','rows=-1&proNames=userid&orderBy=userid',function(data){
- if(data){
- userListTmp = data.rows;
- if(userListTmp){
- for(var i=0; i < userListTmp.length;i++) {
- var tmp = {};
- var obj = {
- "id":userListTmp[i].userid,
- "text":userListTmp[i].username
- }
- userList.push(obj);
- }
- }
- }
- });
- return userList;
- }
- /**
- * ajax 通信工具类(异步)
- *
- * @param transCode 交易码
- * @param servletName servlet名称
- * @param proNames proName字段
- * @param params 参数
- * @param fun_success
- * @param fun_error
- * @param isLoginOut
- */
- function syncAjaxCallOfService(transCode,servletName,params,fun_success, fun_error, isLoginOut) {
- if (params == null) {
- params = {};
- }
- __mask++;
- if (__mask >= 0) {
- showLoading(1);
- }
- url = sysWebAppName + servletName + '?transCode=' + transCode
- + '&clientToken=' + $.__token +'&channelNo=service';
- $
- .ajax({
- url : encodeURI(url),
- data : encodeURI(params || ''),
- type : "POST",
- contentType : "application/x-www-form-urlencoded; charset=utf-8",
- dataType : "text",
- timeout : ajaxTimeout,
- success : function(data) {
- data = $.parseJSON(data);
- __mask--;
- if (data == null)
- return;
- if (__mask == 0) {
- showLoading(-1);
- }
- if (data.returnCode == 'EB8000006') {
- if (isLoginOut) {
- fun_success && fun_success(data);
- } else {
- if (__login > 0)
- return;
- $.messager
- .confirm(
- '用户异常提示',
- '用户异常,是否重新登录。',
- function(r) {
- if (r) {
- $(
- ".leftcurtain",
- window.parent.document)
- .stop().animate({
- width : '50%'
- }, 1500);
- $(
- ".rightcurtain",
- window.parent.document)
- .stop().animate({
- width : '51%'
- }, 1500);
- $(
- ".login",
- window.parent.document)
- .show();
- $(
- ".login",
- window.parent.document)
- .find(
- "input[type=password]")
- .val("");
- $(
- ".login",
- window.parent.document)
- .find(
- "input[type=text]")
- .val("");
- parent.changeImage();
- __login--;
- } else {
- __login--;
- }
- });
- __login++;
- }
- } else {
-
- if (data.returnCode == undefined || data.returnCode == successCode || data.success) {
- fun_success && fun_success(data);
- } else {
- if (fun_error) {
- fun_error && fun_error(data);
- }
- }
- }
- },
- error : function(XMLHttpRequest, textStatus, errorThrown) {
- __mask--;
- if (__mask == 0) {
- showLoading(-1);
- }
- if (fun_error) {
- fun_error
- && fun_error(XMLHttpRequest, textStatus,
- errorThrown);
- }
- }
- });
- }
- /**
- * ajax 通信工具类(同步)
- *
- * @param transCode 交易码
- * @param servletName servlet名称
- * @param proNames proName字段
- * @param params 参数
- * @param fun_success
- * @param fun_error
- * @param isLoginOut
- */
- function syncAjaxCallOfService2(transCode,servletName,params,fun_success, fun_error, isLoginOut) {
- if (params == null) {
- params = {};
- }
- __mask++;
- if (__mask >= 0) {
- showLoading(1);
- }
- url = sysWebAppName + servletName + '?transCode=' + transCode
- + '&clientToken=' + $.__token +'&channelNo=service';
- $
- .ajax({
- url : encodeURI(url),
- data : encodeURI(params || ''),
- type : "POST",
- contentType : "application/x-www-form-urlencoded; charset=utf-8",
- dataType : "text",
- async : false,
- success : function(data) {
- data = $.parseJSON(data);
- __mask--;
- if (data == null)
- return;
- if (__mask == 0) {
- showLoading(-1);
- }
- if (data.returnCode == 'EB8000006') {
- if (isLoginOut) {
- fun_success && fun_success(data);
- } else {
- if (__login > 0)
- return;
- $.messager
- .confirm(
- '用户异常提示',
- '用户异常,是否重新登录。',
- function(r) {
- if (r) {
- $(
- ".leftcurtain",
- window.parent.document)
- .stop().animate({
- width : '50%'
- }, 1500);
- $(
- ".rightcurtain",
- window.parent.document)
- .stop().animate({
- width : '51%'
- }, 1500);
- $(
- ".login",
- window.parent.document)
- .show();
- $(
- ".login",
- window.parent.document)
- .find(
- "input[type=password]")
- .val("");
- $(
- ".login",
- window.parent.document)
- .find(
- "input[type=text]")
- .val("");
- parent.changeImage();
- __login--;
- } else {
- __login--;
- }
- });
- __login++;
- }
- } else {
-
- if (data.returnCode == undefined || data.returnCode == successCode || data.success) {
- fun_success && fun_success(data);
- } else {
- if (fun_error) {
- fun_error && fun_error(data);
- }
- }
- }
- },
- error : function(XMLHttpRequest, textStatus, errorThrown) {
- __mask--;
- if (__mask == 0) {
- showLoading(-1);
- }
- if (fun_error) {
- fun_error
- && fun_error(XMLHttpRequest, textStatus,
- errorThrown);
- }
- }
- });
- }
- //提交表单
- function ajaxFormUpload(formId, transCode, fun_success, fun_error) {
- var url = sysWebAppName + 'TransServlet?transCode=' + transCode + '' + '&clientToken=' + $.__token + '&channelNo=service';
- var form = new FormData(document.getElementById(formId));
- $.ajax({
- type:"post",
- data:form,
- processData:false,
- contentType:false,
- url : encodeURI(url),
- timeout : ajaxTimeout,
- async : false,
- traditional : false,
- cache : false,
- ajaxSubmit : function() {
- return true;
- },
- success : function(result) {
- var data = (new Function("return " + result))();
- if (data.returnCode == 'EB8000006') {
- $.messager.confirm('用户异常提示', '用户异常,是否重新登录。',
- function(r) {
- if (r) {
- $(".leftcurtain",
- window.parent.document).stop()
- .animate({
- width : '50%'
- }, 1500);
- $(".rightcurtain",
- window.parent.document).stop()
- .animate({
- width : '51%'
- }, 1500);
- $(".login", window.parent.document)
- .show("slow").find(
- "input[type=password]")
- .val("");
- parent.changeImage();
- }
- });
- } else {
- if (data.returnCode == successCode) {
- fun_success && fun_success(data);
- } else {
- if (fun_error) {
- fun_error && fun_error(data);
- }
- }
- }
- },
- onLoadError : function() {
- $.messager.alert('系统错误', '网络或系统忙提交失败,请重试!', 'error');
- }
- });
- }
- //带毫秒的数 转成 yyyy-MM-dd HH:mm:ss.ms -->去掉毫秒
- function time2noms(value){
- if(value == '' || value == "" || value == undefined){
- return '暂无';
- }
- var theIndex = value.indexOf('.');
- if(theIndex != -1){
- return value.substring(0,theIndex);
- }else{
- return value;
- }
- }
- //格式化插件地址
- function formatAddr(value){
- var addrFrist = value.substr(0,(value.indexOf(',') - 1));
- var addrLast = value.substr(value.indexOf(',')+1);
- var fullAddr = addrFrist.replace(/ /g,'')+addrLast;
- return fullAddr;
- }
-
- function getDeptList() {
- return $.mapData.get("deptList");
- }
-
- function getDeptList2Select() {
- var deptList = getDeptList();
- var single = {
- id:"",
- text:"全部"
- };
- var result = [];
- result.push(single);
- for(var i=0;i<deptList.length;i++){
- var temp = {
- id:deptList[i].deptcode,
- text:deptList[i].deptname
- };
- result.push(temp);
- }
- return result;
- }
- function getValueByKey(keyType,key){
- //var deptList = getDeptList();
- var keyList = $.mapData.get(keyType);
- for(var i=0;i<keyList.length;i++){
- if(keyList[i] == key){
- return keyList[i];
- }
- }
- return key;
- }
- //版权证相关方法
- function getOwnerShipStandardArray(ownershipDetails,dataType){
-
- var strs= new Array(); //定义一数组
- var result = [];
- var obj = undefined;
- var isUse = false;
-
- var stdData = $.mapData.get(dataType);
- //var oriStr = this.ccaInfo.statusofownershipdetails;
- var oriStr = ownershipDetails;
- if(oriStr != undefined){
- strs=oriStr.split(","); //字符分割
-
- for ( var key in stdData) {
- for (var i=0;i<strs.length ;i++ ) {
- if(strs[i] ==key){
- obj = {
- "flag" : 1,
- "text" : stdData[key]
- };
- result.push(obj);
- isUse = true;
- break;
- }
- }
- if(!isUse){
- obj = {
- "flag" : 0,
- "text" : stdData[key]
- };
- result.push(obj);
- }
- isUse = false;
- }
- }
- return result;
- }
- //版权证 获取几个需要按顺序展示的标准数据
- function sortedStdData(){
- var command = 'userId=tourist&pageSize=-1&orderBy=CODE_TYPE,CODE_ORDER';
- command = command+'&channelNo=service';
- syncAjaxCall('HS0001',command,function(data){
- var d = data.record;
- var _stdDataTmp = undefined;
- var tempStr = 'ccacreativenature,ccaacquisitionofrights,ccarightownership,ccaType';
- for(index in d){
- if(tempStr.indexOf(d[index].codeType) != -1){
- if(_stdDataTmp == undefined) {
- _stdDataTmp = {};
- var tmp_list = new Array();
- var _tmp = {};
- //_tmp[1] = '否'
- _tmp[d[index].codeValue] = d[index].codeDesc;
- tmp_list.push(_tmp);
- _stdDataTmp[d[index].codeType] = tmp_list;
- } else {
- var codeType = d[index].codeType;
- if(_stdDataTmp[codeType] == null || _stdDataTmp[codeType] == undefined) {
- var _tmp = {};
- var tmp_list = new Array();
- _tmp[d[index].codeValue] = d[index].codeDesc;
- tmp_list.push(_tmp);
- _stdDataTmp[d[index].codeType] = tmp_list;
- } else {
- var _tmp = {};
- _tmp[d[index].codeValue] = d[index].codeDesc;
- _stdDataTmp[codeType].push(_tmp);
- }
- }
- }
- }
- sortStdData=_stdDataTmp;
- },function() {
- });
- }
- //版权证 获取几个需要按顺序展示的标准数据
- function getSortedListData(codetype) {
- var data = [];
- var stdData = sortStdData[codetype];
- if(stdData != null && stdData.length > 0){
- for ( var i = 0; i < stdData.length; i++) {
- for ( var key in stdData[i]) {
- var obj = {
- "codeValue" : key,
- "codeDesc" : stdData[i][key]
- };
- data.push(obj);
- }
- }
- }
- return data;
- };
- //处理2010-12-19 或者 2010-10-19 22:22:222形式的时间,转化成2010年10月19日
- function timeFmtZh(value){
- if(value != undefined && value != '' && value.indexOf("-") != -1){
- //截取时间
- temp = value.substr(0,10);
- var tempArray = temp.split("-");
- if(tempArray.length == 3){
- return tempArray[0]+"年"+tempArray[1]+"月"+tempArray[2]+"日";
- }else{
- return value;
- }
- }
- return value;
- };
|