123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242 |
- var userId=top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
- var dept_name = top.com.sinosoft.lz.system.user.LoginInfo.getDeptnames();
- var comp_name = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_names();
- var loadparams = {
- "listId" : '778',
- "condition" : " MSG_MODEL_USER='"+userId+"' and is_del='0' and msg_model_dept ='"+dept_name+"' and msg_model_comp='"+comp_name+"'",
- direction : 'desc', // 排序方式
- sort : 'MSG_MODEL_TIME'
-
- };
- var g;
- var option;
- var options;
- //初始化列表
- function initComplete(){
-
- option = {
- columns: [
- {display : '范本类型',name : 'MSG_MODEL_TYPE_778_SHOW', align : 'center',width : '10%',showTitle:true},
- {display : '范本主题',name : 'MSG_MODEL_TITLE_778', align : 'center',width : '10%',showTitle:true},
- {display : '范本内容',name : 'MSG_MODEL_CONTENT_778', align : 'center',width : '22%',showTitle:true},
- {display : '应用范围',name : 'MSG_MODEL_RANGE_778_SHOW', align : 'center',width : '10%',showTitle:true},
- {display : '创建部门',name : 'MSG_MODEL_DEPT_778', align : 'center',width : '10%',showTitle:true},
- {display : '创建单位',name : 'MSG_MODEL_COMP_778', align : 'center',width : '13%',showTitle:true},
- {display : '创建人员',name : 'REAL_NAME_778', align : 'center',width : '10%',showTitle:true},
- {display : '创建时间',name : 'MSG_MODEL_TIME_778', align : 'center',width : '15%',showTitle:true}
- ],
- rownumbers : true,
- checkbox : true,
- pageSize : 5,
- percentWidthMode : true
- };
- //var roleCons = roleButtonArr();
- var toolBars = {
- items: [
- { text: '新增', click: 'onAdd', iconClass: 'add1_tem', disabled: false,id:"10501" },
- { text: '删除', click: 'onDelete', iconClass: 'delete_tem', disabled: false ,id:"10502" },
- { text: '修改', click: 'onEdit', iconClass: 'update_tem', disabled: false ,id:"10503" }
-
- ]
- // roleCons:roleCons
- };
- options={
- url :$.pathname() + '/ws/crud/CRUDService/queryQui',
- params:loadparams,
-
- width:"100%",
- gridOptions:option,
- paperOpration:{showInput:"true"},
- toolBarOptions:toolBars
- };
-
- g=gridAndSingleRecode=$("#maingrid").quickgridAndSingleRecode(options);
-
-
-
- }
-
- //查询
- function searchHandler(){
- var MSG_MODEL_TITLE = $('#MSG_MODEL_TITLE_919').val().trim();
- var condition=" MSG_MODEL_USER='"+userId+"' and is_del='0' and msg_model_dept ='"+dept_name+"' and msg_model_comp='"+comp_name+"'";
- if(MSG_MODEL_TITLE!=""&&MSG_MODEL_TITLE!="请输入范本主题"){
- condition+="AND MSG_MODEL_TITLE LIKE '%"+MSG_MODEL_TITLE+"%'";
- }
- var searchCondition = getSelectCon(conditionData);
- g.setOptions({//重置加载列表的参数
- params : {
- "listId" :'778' ,
- "condition" : searchCondition.condition+condition,
- direction : 'desc', // 排序方式
- sort : 'MSG_MODEL_TIME'
- }
- });
- g.rend();
- var text = $(".l-grid-body2").text();
- if(text==""){
- $(".l-grid-body2 table").css("width","100%");
- $(".l-grid-body2 tbody").append($('<tr style="text-align:center;"><td colspan="6"><div style="height:50px;line-height:50px;font-size:14px;">此列表暂无数据!</div></td></tr>'));
- }
- }
- //查询表单验证
- function findMsg() {
- var valid = $("#searchQueryForm").validationEngine({
- returnIsValid : true,
- });
- if(valid==true){
- searchHandler();
- }else{
- top.Dialog.alert("搜索框内容输入不正确,请检查");
- }
- }
-
- //修改
- function onEdit(){
- var rows = g.getSelectedRows();
- if(rows.length==0){
- top.Dialog.alert("请选择一条记录");
- return;
- }
- if(rows.length>1){
- top.Dialog.alert("只能选择一条记录");
- return;
- }
- if(userId!=rows[0].MSG_MODEL_USER_778){
- top.Dialog.alert("不可修改其他人填写的模版");
- return;
- }
-
- var comp = rows[0].MSG_MODEL_COMP_778;
- var fd_id = rows[0].FD_OBJECTID_778;
- var type = rows[0].MSG_MODEL_TYPE_778;
- var title = rows[0].MSG_MODEL_TITLE_778;
- var content = rows[0].MSG_MODEL_CONTENT_778;
- $("#content").val(content);
- var range = rows[0].MSG_MODEL_RANGE_778;
- var dept = rows[0].MSG_MODEL_DEPT_778;
- var people = rows[0].REAL_NAME_778;
- var diag = new top.Dialog();
- diag.Title = "修改范本";
- diag.URL = encodeURI($.pathname() + '/page/system/sms/msg_model_update1.html?'+fd_id+"?"+type+"?"+title+"?"+range+"?"+dept+"?"+people+"?"+comp+"?"+content);
- diag.Width = 900;
- diag.Height = 320;
- /* diag.Top = "80%";*/
- diag.Left = "50%";
- diag.ID = "addFanBen";
- /* diag.Top = "80%";*/
- diag.Left = "50%";
- diag.ShowOkButton=false;// 不显示确认按钮
- diag.ButtonAlign = 'center';
-
-
- diag.show();
-
- diag.addButton("edit","修改",function(){
- diag.innerFrame.contentWindow. save();
- shuaxin();
- g.rend();
-
-
- });
- }
-
-
-
-
- //新增
- function onAdd(){
- var diag = new top.Dialog();
- diag.Title = "新增范本";
- diag.URL = $.pathname() + '/page/system/sms/msg_model_update1.html';
- diag.Width = 900;
- diag.Height = 320;
- /* diag.Top = "80%";*/
- diag.Left = "50%";
- diag.ID = "addFanBen";
- diag.ShowOkButton=false;
- diag.ButtonAlign = 'center';
- diag.show();
- diag.addButton("add","新增",function(){
- diag.innerFrame.contentWindow. save();
- shuaxin();
- g.rend();
- });
- }
-
- function shuaxin(){
-
- g.rend();
- }
- //删除
- function onDelete(){
- var rows = g.getSelectedRows();
- var rowsLength = rows.length;
-
- if (rowsLength == 0) {
- top.Dialog.alert("请选中要删除的记录!");
- return;
- }
- var ids = "";
- //var user_id="";
- //alert(rows[0].FD_OBJECTID_778);
- for ( var i = 0; i < rowsLength; i++) {
- if(userId!=rows[i].MSG_MODEL_USER_778){
- top.Dialog.alert("不可删除其他人的模版记录");
- return;
- }else{
-
- ids += rows[i].FD_OBJECTID_778 + ";";
- }
- }
-
- top.Dialog.confirm("确定要删除吗?|删除", function() {
- // 删除记录
- $.post($.pathname() +"/ws/sendsms/SendSmsService/delMsg/", {
- fd_id : ids,
- stat:"MODEL"
- }, function(result) {
- if (result.Msg.sucsess == true) {
- $.messager.alert("删除成功",null,null,null,1);
- // 刷新表格数据
- g.rend();
- } else {
- top.Dialog.alert("删除失败!");
- }
- }, "json");
-
- });
- }
-
- $.messager=top.Dialog;
- //刷新表格 表单提交的回调
- function afterFormSubmit(){
- g.rend();
- }
-
- ///返回短信管理
- function goback(){
- window.parent.document.getElementById("frmright").setAttribute("src", "/nwyj/page/system/sms/msg_manage.html");
- }
-
- window.onload = function (){
- $(".selectbox").attr("readonly","readonly");
- };
- //查询
- function check(event){
- if(event.keyCode==13){
- findMsg();
- }
- }
-
- $("#searchButt").live("click",function(){
- findMsg();
- });
|