123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196 |
- var compId = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
- var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getDeptids();
- var userId = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
- var g;
- var classes={"list":[
- {value:"1",key:"国际标准",suggest:""},
- {value:"2",key:"国家标准",suggest:""},
- {value:"3",key:"行业标准",suggest:""},
- {value:"4",key:"企业标准",suggest:""}]};
-
- function initGrid(data){
-
- g = $("#maingrid").quiGrid({
- columns: [
- { display: '分类', name: 'CLASSES_242', align: 'center', width: "10%" ,
- editor: { type: 'select',data:classes,selWidth:150 },render:function (item){
- for (var i = 0; i < classes["list"].length; i++)
- {
- if (classes["list"][i]['value'] == item.CLASSES_242)
- return classes["list"][i]['key'];
- }
- return item.CLASSES_242;
- }
- },
- { display: '发文单位', name: 'DISPATCH_UNIT_242', align: 'center', width: "15%" ,editor: { type: 'text'}},
- // { display: '主办部门', name: 'AUSPICE_DEPT_242', align: 'center', width: "10%" ,editor: { type: 'text'}},
- { display: '标准名称', name: 'STANDARD_NAME_242', align: 'center', width: "15%",editor: { type: 'text'} },
- { display: '标准代号', name: 'STANDARD_CODE_242', align: 'center', width: "15%" ,editor: { type: 'text'}},
- { display: '印发日期', name: 'PRINT_DATE_242', align: 'center', width: "15%" ,editor: { type: 'date',dateFmt:'yyyy-MM-dd'}},
- { display: '实施日期', name: 'IMPLEMENT_DATE_242', align: 'center' , width: "15%" ,editor: { type: 'date',dateFmt:'yyyy-MM-dd'}},
- { display: '简要说明', name: 'DESCRIPTION_242', align: 'center', width: "15%" ,editor: { type: 'text',maxlength:300}}
- ],
- data:data,
- sortName : '',
- sortOrder : '',
- rownumbers:true,
- checkbox:true,
- // height: '100%',
- width:"100%",
- usePager : false,
- enabledEdit: true, //编辑用
- percentWidthMode:true,
- //顶部图标按钮栏
- toolbar:{
- items:[
-
- {text: '批量保存', click: saveAll, iconClass: 'icon_add'},
- { line : true }
- ]
- }
- });
- //监听页面显示的下拉框
- $("select[name=rp]").bind("change",function(){
- $(parent.document.body).find("#frmright").height($(window.document.body).height()+30);
- });
- //下拉框高度自适应
- $(parent.document.body).find("#frmright").height($(window.document.body).height()+30);
- }
-
- function saveAll(){
-
- var PatternsDict=/^(\d{4})-(0\d{1}|1[0-2])-(0\d{1}|[12]\d{1}|3[01])$/;//日期验证
- var PatternsDict1= new RegExp("[%@~!%#$*&',;=?$\x22]+");//特殊字符验证
-
- var rows=g.getSelectedRows();
- var rowsLength = rows.length;
- if (rowsLength == 0) {
- top.Dialog.alert("请选中要导入的信息!");
- return;
- }
- var json=JSON.stringify(rows);
-
- var myobj=eval(json);
- for(var i=0;i<myobj.length;i++){
- var CLASSES_242 = myobj[i].CLASSES_242;//分类
- var DISPATCH_UNIT_242 = myobj[i].DISPATCH_UNIT_242;//发文单位
- // var AUSPICE_DEPT_242 = myobj[i].AUSPICE_DEPT_242;//主办部门
- var STANDARD_NAME_242 = myobj[i].STANDARD_NAME_242;//标准名称
- var STANDARD_CODE_242 = myobj[i].STANDARD_CODE_242;//标准代号
- var PRINT_DATE_242 = myobj[i].PRINT_DATE_242;//印发日期
- var IMPLEMENT_DATE_242 = myobj[i].IMPLEMENT_DATE_242;//实施日期
- var DESCRIPTION_242 = myobj[i].DESCRIPTION_242;//简要说明
- var fff =1;
- fff = fff+i;
-
- if(CLASSES_242.length==0){
- top.Dialog.alert("第"+ fff + "行的分类不能为空,请检查!");
- return;
- }
-
- if(DISPATCH_UNIT_242.length==0){
- top.Dialog.alert("第"+ fff + "行的发文单位不能为空,请检查!");
- return;
- }else if(DISPATCH_UNIT_242.length>20){
- top.Dialog.alert("第"+fff + "行的发文单位长度超长,请检查!(20个汉字以内)");
- return;
- }else if(PatternsDict1.test(DISPATCH_UNIT_242)){
- top.Dialog.alert("第"+ fff + "行的发文单位输入不合法,请检查!(20个汉字以内)");
- return;
- }
- // if(AUSPICE_DEPT_242.length>20){
- // top.Dialog.alert("第"+fff + "行的主办部门长度超长,请检查!(20个汉字以内)");
- // return;
- // }else if(PatternsDict1.test(AUSPICE_DEPT_242)){
- // top.Dialog.alert("第"+ fff + "行的主办部门输入不合法,请检查!(20个汉字以内)");
- // return;
- // }
- if(STANDARD_NAME_242.length==0){
- top.Dialog.alert("第"+ fff + "行的标准名称不能为空,请检查!");
- return;
- }else if(STANDARD_NAME_242.length>20){
- top.Dialog.alert("第"+fff + "行的标准名称长度超长,请检查!(20个汉字以内)");
- return;
- }else if(PatternsDict1.test(STANDARD_NAME_242)){
- top.Dialog.alert("第"+ fff + "行的标准名称输入不合法,请检查!(20个汉字以内)");
- return;
- }
- if(STANDARD_CODE_242.length==0){
- top.Dialog.alert("第"+ fff + "行的标准代号不能为空,请检查!");
- return;
- }else if(STANDARD_CODE_242.length>20){
- top.Dialog.alert("第"+fff + "行的标准代号长度超长,请检查!(20个字符以内)");
- return;
- }
-
- if(PRINT_DATE_242.length==0){
- top.Dialog.alert("第"+ fff + "行的印发日期不能为空,请检查!");
- return;
- }
- if(PatternsDict.test(PRINT_DATE_242)){
-
- }else{
- top.Dialog.alert("第"+ fff + "行的印发日期不合法,请检查!");
- return;
- }
- if(IMPLEMENT_DATE_242.length==0){
- top.Dialog.alert("第"+ fff + "行的实施日期不能为空,请检查!");
- return;
- }
- if(PatternsDict.test(IMPLEMENT_DATE_242)){
-
- }else{
- top.Dialog.alert("第"+fff + "行的实施日期不合法,请检查!");
- return;
- }
-
- if(DESCRIPTION_242.length>300){
- top.Dialog.alert("第"+fff + "行的简要说明长度超长,请检查!(长度不要超过300个中文)");
- return;
- }
- }
-
-
- var url = $.pathname() + "/ws/StandardExcel/StandardExcelToDBTableTool/standardToDb";
-
- var params = {
- classId : '242',
- compid:compId,
- deptId:deptId,
- userId:userId,
- json:json
- };
- $.ajax({
- url : url,
- type : 'post',
- timeout : 15000,
- data : params,
- dataType : 'json',
- success : function(data) {
- $.messager.alert('保存成功');
- window.location.href="standard.jsp";
- },
- error : function(e) {
- $.messager.alert('系统提示信息', '访问服务失败!', 'error');
- }
- });
- }
-
- //下模板
- function xiazai(){
- window.open("/nwyj/excels/standardguohangguobiao.xls");
- }
- //返回
- function goBack() {
- window.location.href="standard.jsp";
- }
- $.messager = top.Dialog;
|