|
@ -1,575 +1,218 @@
|
|
|
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="utf-8" %>
|
|
|
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
|
|
|
<script language="javascript">
|
|
|
|
|
|
$(function(){
|
|
|
//先选出 textarea 和 统计字数 dom 节点
|
|
|
var wordCount = $("#messageContent"),
|
|
|
textArea = wordCount.find("textarea"),
|
|
|
word = wordCount.find(".word");
|
|
|
//调用
|
|
|
statInputNum(textArea,word);
|
|
|
});
|
|
|
/*
|
|
|
* 剩余字数统计
|
|
|
* 注意 最大字数只需要在放数字的节点哪里直接写好即可 如:<var class="word">200</var>
|
|
|
*/
|
|
|
function statInputNum(textArea,numItem) {
|
|
|
var max = numItem.text(), curLength;
|
|
|
curLength = textArea.val().length;
|
|
|
numItem.text(max - curLength);
|
|
|
textArea.on('input propertychange', function () {
|
|
|
var _value = $(this).val().replace(/\n/gi,"");
|
|
|
numItem.text(_value.length);
|
|
|
});
|
|
|
}
|
|
|
</script>
|
|
|
<script>
|
|
|
(function ($, win) {
|
|
|
|
|
|
(function ($, win) {
|
|
|
$(function () {
|
|
|
/* ************************** 变量定义 ******************************** */
|
|
|
var Util = $.Util;
|
|
|
var notificationInfo = null;
|
|
|
var serviceLabelType = 1;
|
|
|
var healthLabelType = 2;
|
|
|
var dieaseLabelType = 3;
|
|
|
var province = 350000;
|
|
|
var city = 350200;
|
|
|
var isAuditor = ${isAuditor};
|
|
|
// 表单校验工具类
|
|
|
var templateName = $('#inp_templateName').val();
|
|
|
var scene = $('#inp_scene').val();
|
|
|
var type = $('#inp_mode').val();
|
|
|
var info = "";
|
|
|
var jValidation = $.jValidation;
|
|
|
/* *************************** 函数定义 ******************************* */
|
|
|
|
|
|
//页面初始化
|
|
|
function pageInit() {
|
|
|
notificationInfo.init();
|
|
|
info.init();
|
|
|
info.initForm();
|
|
|
}
|
|
|
//发送范围事件
|
|
|
$(":radio[name='scope']").click(function(){
|
|
|
var scope = $(this).val();
|
|
|
var scopeId = $("#scopeId").val();//修改时选中值
|
|
|
if(scope=="0"){
|
|
|
$("#scope_area").hide();
|
|
|
$("#scope_community").hide();
|
|
|
}else if(scope=="1"){//展示区
|
|
|
$.ajax({
|
|
|
url: ctx + "/common/districtAuthority",
|
|
|
method: "post",
|
|
|
dataType: "json",
|
|
|
data: {"type": 3, "code": city},
|
|
|
success: function (data) {
|
|
|
if(data.status=='200'){
|
|
|
var html = "";
|
|
|
if(scopeId){
|
|
|
var scopeIds = scopeId.split(",");
|
|
|
for(var i=0;i<data.list.length;i++){
|
|
|
var town = data.list[i];
|
|
|
if(scopeId.indexOf(town.code)<0){
|
|
|
html +="<input type='checkbox' name='scope_area' class='inpChkb' data-name='"+town.name+"' value='"+town.code+"' >"+town.name+" ";
|
|
|
}else{
|
|
|
html +="<input type='checkbox' checked='checked' name='scope_area' class='inpChkb' data-name='"+town.name+"' value='"+town.code+"' >"+town.name+" ";
|
|
|
}
|
|
|
}
|
|
|
}else{
|
|
|
for(var i=0;i<data.list.length;i++){
|
|
|
var town = data.list[i];
|
|
|
html +="<input type='checkbox' name='scope_area' class='inpChkb' data-name='"+town.name+"' value='"+town.code+"' >"+town.name+" ";
|
|
|
}
|
|
|
}
|
|
|
$(".scope_areaDiv").html(html);
|
|
|
}else{
|
|
|
$.Notice.error(data.msg);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
$("#scope_area").show();
|
|
|
$("#scope_community").hide();
|
|
|
}else if(scope=="2"){//展示社区
|
|
|
$.ajax({
|
|
|
url: ctx + "/admin/hos/community",
|
|
|
method: "post",
|
|
|
dataType: "json",
|
|
|
data: {"city": city},
|
|
|
success: function (data) {
|
|
|
if(data.status=='200'){
|
|
|
var communityAuthority = $("#communityAuthority").val();
|
|
|
var html = "";
|
|
|
var attrTown = "";
|
|
|
for(var i=0;i<data.list.length;i++){
|
|
|
var town = data.list[i];
|
|
|
attrTown += town.town+";";
|
|
|
var tn = town.town.split(":");
|
|
|
html +="<div class='m-form-group u-checkbox-wrap m-form-control' style='height: auto;line-height: 15px;'>";
|
|
|
if("2"==communityAuthority||scopeId.indexOf(tn[0])>=0){
|
|
|
html +="<input type='checkbox' name='"+tn[0]+"' checked='checked' class='inpChkb chkCommunity' data-name='"+town.town+"' data-area='"+tn[1]+"' value='"+tn[0]+"' >"+tn[1]+" ";
|
|
|
}else{
|
|
|
html +="<input type='checkbox' name='"+tn[0]+"' class='inpChkb chkCommunity' data-name='"+town.town+"' data-area='"+tn[1]+"' value='"+tn[0]+"' >"+tn[1]+" ";
|
|
|
}
|
|
|
for(var j=0;j<town.community.length;j++){
|
|
|
community = town.community[j];
|
|
|
if(j>0&&j%6==0){
|
|
|
html+="<br><span style='display: inline-block;width: 61px;'></span>";
|
|
|
}
|
|
|
var comName = community.name;
|
|
|
comName = comName.substring(3,comName.length);
|
|
|
if("2"==communityAuthority||scopeId.indexOf(community.code)>=0){
|
|
|
html +="<input type='checkbox' name='"+town.town+"' checked='checked' class='inpChkb' data-name='"+comName+"' value='"+community.code+"' ><span class='community'>"+comName+"</span> ";
|
|
|
}else{
|
|
|
html +="<input type='checkbox' name='"+town.town+"' class='inpChkb' data-name='"+comName+"' value='"+community.code+"' ><span class='community'>"+comName+"</span> ";
|
|
|
}
|
|
|
}
|
|
|
html +="</div>"
|
|
|
html +="<br>";
|
|
|
}
|
|
|
$(".scope_communityDiv").attr("attr-towns",attrTown);
|
|
|
$(".scope_communityDiv").html(html);
|
|
|
}else{
|
|
|
$.Notice.error(data.msg);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
$("#scope_area").hide();
|
|
|
$("#scope_community").show();
|
|
|
}
|
|
|
});
|
|
|
|
|
|
//选择区 全选/反选 社区
|
|
|
$(document).on("click",".chkCommunity",function () {
|
|
|
var name = $(this).attr("data-name");
|
|
|
$("[name = '"+name+"']:checkbox").prop("checked", $(this).is(':checked'));
|
|
|
});
|
|
|
|
|
|
//筛选条件
|
|
|
$(":radio[name='condition_type']").click(function(){
|
|
|
var condition_type = $(this).val();
|
|
|
if(condition_type=="0"){
|
|
|
$("#inpCondition").hide();
|
|
|
$("[name = 'condition']:checkbox").prop("checked",false);
|
|
|
$(".serverType").hide();
|
|
|
$(".health_situation").hide();
|
|
|
$(".diease").hide();
|
|
|
}else if(condition_type=="1"){
|
|
|
$("#inpCondition").show();
|
|
|
}
|
|
|
});
|
|
|
|
|
|
//标签事件
|
|
|
$(":checkbox[name='condition']").change(function () {
|
|
|
var chkValue = $(this).val();
|
|
|
var selClass = $(this).attr("data-class");
|
|
|
if($(this).is(':checked')){
|
|
|
$.ajax({
|
|
|
url: ctx + "/common/label/signPatientLabel",
|
|
|
method: "post",
|
|
|
dataType: "json",
|
|
|
data: {"labelType": chkValue},
|
|
|
success: function (data) {
|
|
|
if(data.status=='200'){
|
|
|
var html = "";
|
|
|
var name = selClass.substring(1,selClass.length);
|
|
|
for(var i=0;i<data.list.length;i++){
|
|
|
var patiemtLabel = data.list[i];
|
|
|
if(i>0&&i%6==0){
|
|
|
html+="<br>";
|
|
|
}
|
|
|
var selectId = "";
|
|
|
if("1"==chkValue){
|
|
|
selectId = $("#serverTypeId").val();
|
|
|
}
|
|
|
if("2"==chkValue){
|
|
|
selectId = $("#healthSituationId").val();
|
|
|
}
|
|
|
if("3"==chkValue){
|
|
|
selectId = $("#diseaseTypeId").val();
|
|
|
}
|
|
|
if(selectId&&selectId.indexOf(patiemtLabel.code)>=0){
|
|
|
html +="<input type='checkbox' name='"+name+"' checked='checked' class='inpChkb' data-name='"+patiemtLabel.name+"' value='"+patiemtLabel.code+"' >"+patiemtLabel.name+" ";
|
|
|
}else{
|
|
|
html +="<input type='checkbox' name='"+name+"' class='inpChkb' data-name='"+patiemtLabel.name+"' value='"+patiemtLabel.code+"' >"+patiemtLabel.name+" ";
|
|
|
}
|
|
|
}
|
|
|
$(selClass+"Div").html(html);
|
|
|
}else{
|
|
|
$.Notice.error(data.msg);
|
|
|
}
|
|
|
$(selClass).show();
|
|
|
}
|
|
|
});
|
|
|
}else{
|
|
|
$(selClass).hide();
|
|
|
}
|
|
|
});
|
|
|
/* *************************** 模块初始化 ***************************** */
|
|
|
notificationInfo = {
|
|
|
$form: $("#div_roles_info_form"),
|
|
|
$scope: $("input[name='scope']"),//发送范围
|
|
|
$scope_area: $("input[name='scope_area']"),//指定区
|
|
|
$scope_community: $("input[name='scope_community']"),//指定社区
|
|
|
$condition_type: $("input[name='condition_type']"),//筛选条件
|
|
|
$condition: $("input[name='condition']"),//筛选条件
|
|
|
$server: $("input[name='server']"),//服务类型
|
|
|
$health_situation: $("input[name='health_situation']"),//健康情况
|
|
|
$diease: $("input[name='diease']"),//疾病类型
|
|
|
$title: $("#title"),//消息标题
|
|
|
$content: $("#content"),//消息内容
|
|
|
$send_type_combo_select: $("#send_type_combo_select"),//发送方式
|
|
|
$send_time: $("#send_time"),//发送时间
|
|
|
$btnsave: $("#btn_save"),//保存按钮
|
|
|
$btncancle: $("#btn_cancel"),//结束按钮
|
|
|
info = {
|
|
|
//变量
|
|
|
$form: $("#div_template_info_form"),
|
|
|
$templateName: $('#inp_templateName'),
|
|
|
$scene: $('#inp_scene'),
|
|
|
$sceneDescription: $('#inp_sceneDescription'),
|
|
|
$first: $('#inp_first'),
|
|
|
$remark: $("#inp_remark"),
|
|
|
$value1:$("#inp_value1"),
|
|
|
$value2:$("#inp_value2"),
|
|
|
$value3:$("#inp_value3"),
|
|
|
$value4:$("#inp_value4"),
|
|
|
$value5:$("#inp_value5"),
|
|
|
$value6:$("#inp_value6"),
|
|
|
$value7:$("#inp_value7"),
|
|
|
$format:$("#inp_format"),
|
|
|
init: function () {
|
|
|
_this = this;
|
|
|
//范围权限控制
|
|
|
var cityAuthority = $("#cityAuthority").val();
|
|
|
var areaAuthority = $("#areaAuthority").val();
|
|
|
var communityAuthority = $("#communityAuthority").val();
|
|
|
if("0"==cityAuthority){
|
|
|
$("#cityScope").attr("disabled", false);
|
|
|
$("#cityScope").attr("disabled","disabled")
|
|
|
}
|
|
|
if("0"==areaAuthority){
|
|
|
$("#areaScope").attr("disabled", false);
|
|
|
$("#areaScope").attr("disabled", "disabled");
|
|
|
//input样式
|
|
|
this.$form.attrScan();
|
|
|
this.$templateName.ligerTextBox({width: 340});
|
|
|
this.$scene.ligerTextBox({width: 340});
|
|
|
this.$sceneDescription.ligerTextBox({width: 340});
|
|
|
this.$first.ligerTextBox({width: 340});
|
|
|
this.$remark.ligerTextBox({width: 340});
|
|
|
this.$value1.ligerTextBox({width: 340});
|
|
|
this.$value2.ligerTextBox({width: 340});
|
|
|
this.$value3.ligerTextBox({width: 340});
|
|
|
this.$value4.ligerTextBox({width: 340});
|
|
|
this.$value5.ligerTextBox({width: 340});
|
|
|
this.$value6.ligerTextBox({width: 340});
|
|
|
this.$value7.ligerTextBox({width: 340});
|
|
|
this.$format.ligerTextBox({width: 340,height:150});
|
|
|
},
|
|
|
initForm: function () {
|
|
|
this.bindEvents();
|
|
|
|
|
|
if (type == "view") {
|
|
|
//查看时只读属性不可更新数据
|
|
|
$('input').attr('readonly','readonly')
|
|
|
$(".essential").addClass("XXXtest");
|
|
|
$(".essential").removeClass("essential");
|
|
|
$("#btn_save_close").css("display", "none");
|
|
|
} else {
|
|
|
$(".XXXtest").addClass("essential");
|
|
|
$("#btn_save_close").css("display", "block");
|
|
|
if(type == "edit"){
|
|
|
$("#new_psw_div").css("display", "block");
|
|
|
$("#old_psw_div").css("display", "block");
|
|
|
}
|
|
|
}
|
|
|
if(type == 'new'){
|
|
|
$('#format_show').css("display", "none")
|
|
|
}
|
|
|
if("0"==communityAuthority){
|
|
|
$("#communityScope").attr("disabled", false);
|
|
|
$("#communityScope").attr("disabled", "disabled");
|
|
|
if(type == 'edit'){
|
|
|
$('#inp_templateName').attr('readonly','readonly')
|
|
|
$('#inp_scene').attr('readonly','readonly')
|
|
|
}
|
|
|
// if("2"==communityAuthority){
|
|
|
// $("#communityScope").attr("checked", true);
|
|
|
// }
|
|
|
this.$form.show();
|
|
|
},
|
|
|
|
|
|
this.$title.ligerTextBox({width: 240, validate: {required: true}});
|
|
|
//绑定事件
|
|
|
bindEvents: function () {
|
|
|
var validator = new jValidation.Validation(this.$form, {
|
|
|
immediate: true, onSubmit: false,
|
|
|
onElementValidateForAjax: function (elm) {
|
|
|
|
|
|
var sendTypeSelect = this.$send_type_combo_select.ligerComboBox({
|
|
|
with:180,
|
|
|
data: [
|
|
|
{ text: "立即发送", id: "0" },
|
|
|
// { text: "定时发送", id: "1" }//暂时只做立即发送(有审核权限-新增时立即发送,无权限-审核通过后立即发送)
|
|
|
],
|
|
|
valueField: 'id',
|
|
|
textField: 'text',
|
|
|
cancelable: false,
|
|
|
initIsTriggerEvent: false,
|
|
|
onSelected: function (newvalue){
|
|
|
if(newvalue=="0"){
|
|
|
$(".send_time").hide();
|
|
|
}else{
|
|
|
$(".send_time").show();
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
|
|
|
sendTypeSelect.setValue("0");
|
|
|
this.$content.ligerTextBox({width: 430, height: 150, validate: {required: true}});
|
|
|
this.$form.attrScan();
|
|
|
_this = this;
|
|
|
var self = this;
|
|
|
$("#btn_save").click(function () {
|
|
|
//保存按钮
|
|
|
var values = self.$form.Fields.getValues();
|
|
|
if (!validator.validate()) {
|
|
|
return;
|
|
|
}
|
|
|
if (type == "edit") {
|
|
|
update(values);
|
|
|
}else if(type == "new"){
|
|
|
save(values);
|
|
|
}
|
|
|
|
|
|
var noticeId = $("#noticeId").val();
|
|
|
var mode = $("#mode").val();//模式 (新增/修改/查看)
|
|
|
});
|
|
|
|
|
|
if (isNoEmpty(noticeId) && noticeId != 0) {
|
|
|
//id不为空时 :为修改页面,进行修改操作
|
|
|
//异步根据id获取消息信息
|
|
|
//查看模板信息
|
|
|
function getData(templateName,scene) {
|
|
|
// var dataModel = $.DataModel.init();
|
|
|
$.ajax({
|
|
|
url: ctx + "/admin/notification/notice",
|
|
|
url: ctx + "/admin/wechatTemplate/getTemplate",
|
|
|
async: false,
|
|
|
method: "post",
|
|
|
dataType: "json",
|
|
|
data: {id: noticeId},
|
|
|
success: function (result) {
|
|
|
if (result.status == '200') {
|
|
|
var notice = result.data;
|
|
|
var scope = notice.scope;
|
|
|
var scopeId = notice.scopeId;
|
|
|
$("#scopeId").val(scopeId);//范围
|
|
|
$(":radio[name='scope'][value='" + scope + "']").click();
|
|
|
|
|
|
var conditionType = notice.condition;//筛选条件
|
|
|
var diseaseTypeId = notice.diseaseTypeId;
|
|
|
var healthSituationId = notice.healthSituationId;
|
|
|
var serverTypeId = notice.serverTypeId;
|
|
|
$("#serverTypeId").val(serverTypeId);
|
|
|
$("#healthSituationId").val(healthSituationId);
|
|
|
$("#diseaseTypeId").val(diseaseTypeId);
|
|
|
$(":radio[name='condition_type'][value='" + conditionType + "']").click();
|
|
|
if(serverTypeId){
|
|
|
$(":checkbox[name='condition'][value='1']").click();
|
|
|
}
|
|
|
if(healthSituationId){
|
|
|
$(":checkbox[name='condition'][value='2']").click();
|
|
|
}
|
|
|
if(diseaseTypeId){
|
|
|
$(":checkbox[name='condition'][value='3']").click();
|
|
|
}
|
|
|
|
|
|
_this.$form.Fields.fillValues({
|
|
|
title: notice.title,
|
|
|
content: notice.content,
|
|
|
data: {
|
|
|
"templateName": templateName,
|
|
|
"scene":scene
|
|
|
},
|
|
|
success: function (data) {
|
|
|
if (data.status == 200) {
|
|
|
var data = data.data[0]
|
|
|
self.$form.Fields.fillValues({
|
|
|
templateName: data.templateName,
|
|
|
scene: data.scene,
|
|
|
sceneDescription: data.sceneDescription,
|
|
|
first: data.first,
|
|
|
remark: data.remark,
|
|
|
value1: data.keyword1,
|
|
|
value2: data.keyword2,
|
|
|
value3: data.keyword3,
|
|
|
value4: data.keyword4,
|
|
|
value5: data.keyword5,
|
|
|
value6: data.keyword6,
|
|
|
value7: data.keyword7,
|
|
|
format: data.format
|
|
|
});
|
|
|
$(".word").text(notice.content.length);
|
|
|
|
|
|
//发送方式
|
|
|
var sendType = notice.sendType;
|
|
|
if("1"==sendType){
|
|
|
var sendTime = notice.sendTime;
|
|
|
sendTime = sendTime.substring(0,16);
|
|
|
sendTypeSelect.setValue(sendType);
|
|
|
$("#send_time").ligerDateEditor({showTime: true,initValue: sendTime});
|
|
|
$(".send_time").show();
|
|
|
}
|
|
|
|
|
|
// parent.window.reloadMasterGrid(data.data);
|
|
|
// parent.window.closeUserInfoDialog();
|
|
|
} else {
|
|
|
$.Notice.error(result.msg);
|
|
|
$.Notice.error(data.msg);
|
|
|
}
|
|
|
},
|
|
|
error: function (data) {
|
|
|
$.Notice.error("系统异常,请联系管理员!");
|
|
|
}
|
|
|
});
|
|
|
}else{
|
|
|
this.$send_time.ligerDateEditor({showTime: true});
|
|
|
}
|
|
|
this.$form.show();
|
|
|
this.bindEvents();
|
|
|
},
|
|
|
bindEvents: function () {
|
|
|
var self = this;
|
|
|
var flag = false;
|
|
|
|
|
|
$("#btn_save").click(function () {
|
|
|
var values = self.$form.Fields.getValues();
|
|
|
if (values.id == '') {
|
|
|
values.id = 0;
|
|
|
}
|
|
|
|
|
|
values.city = city+"";
|
|
|
var s = self.$send_type_combo_select;
|
|
|
values.sendType = self.$send_type_combo_select.ligerComboBox().getValue();
|
|
|
values.sendTime = self.$send_time.val();
|
|
|
values.communityAuthority = $("#communityAuthority").val();
|
|
|
|
|
|
if (isEmpty(values.scope)) {
|
|
|
$.Notice.error("请选择发送范围!");
|
|
|
return false;
|
|
|
}
|
|
|
if(values.scope=="0"){
|
|
|
values.conditionDescription = "厦门市 全市";
|
|
|
}else if(values.scope=="1"){
|
|
|
var area = "";
|
|
|
var areaName = "";
|
|
|
$("input[name='scope_area']:checked").each(function(){
|
|
|
area+=$(this).val()+",";
|
|
|
areaName+=$(this).attr("data-name")+",";
|
|
|
});
|
|
|
if(area==""){
|
|
|
$.Notice.error("请至少选择一个区!");
|
|
|
return false;
|
|
|
}
|
|
|
areaName = areaName.substring(0,areaName.length-1);
|
|
|
area = area.substring(0,area.length-1);
|
|
|
values.town = area;
|
|
|
values.scopeId = area;
|
|
|
values.scopeContent = areaName;
|
|
|
values.conditionDescription = "厦门市 "+areaName;
|
|
|
}else if(values.scope=="2"){
|
|
|
var attrTowns = $(".scope_communityDiv").attr("attr-towns");
|
|
|
|
|
|
if(attrTowns.length==0){
|
|
|
$.Notice.error("请至少选择一个社区!");
|
|
|
return false;
|
|
|
}
|
|
|
var towns = attrTowns.split(";");
|
|
|
var selctCommunity = "";
|
|
|
var townCommunity = "";
|
|
|
var conditionDescription = "";
|
|
|
for(var i=0;i<towns.length;i++){
|
|
|
var townName = towns[i];
|
|
|
var strCom = "";
|
|
|
var strComName = "";
|
|
|
$("input[name='"+townName+"']:checked").each(function(){
|
|
|
strCom+=$(this).val()+",";
|
|
|
strComName+=$(this).attr("data-name")+",";
|
|
|
});
|
|
|
if(strCom.length>0){
|
|
|
//selctCommunity += strCom.substring(0,strCom.length-1);
|
|
|
selctCommunity += strCom;
|
|
|
townCommunity += townName.split(":")[0] +":"+strCom.substring(0,strCom.length-1)+";";
|
|
|
conditionDescription += townName.split(":")[1] +":"+strComName.substring(0,strComName.length-1)+";\n ";
|
|
|
}
|
|
|
}
|
|
|
if(selctCommunity.length==0){
|
|
|
$.Notice.error("请至少选择一个社区!");
|
|
|
return false;
|
|
|
}
|
|
|
values.community = selctCommunity.substring(0,selctCommunity.length-1);
|
|
|
//values.townCommunity = townCommunity;
|
|
|
values.scopeId = townCommunity.substring(0,townCommunity.length-1);
|
|
|
values.scopeContent = conditionDescription;
|
|
|
values.conditionDescription = "厦门市 "+ conditionDescription;
|
|
|
}
|
|
|
|
|
|
if (isEmpty(values.condition_type)) {
|
|
|
$.Notice.error("请选择筛选条件!");
|
|
|
return false;
|
|
|
}
|
|
|
if (values.condition_type=='0') {//全部居民
|
|
|
var condition = "0";
|
|
|
var conditionId = "";
|
|
|
values.condition = condition;
|
|
|
values.conditionId = conditionId;
|
|
|
}
|
|
|
if(values.condition_type=='1'){
|
|
|
var condition = "";
|
|
|
var conditionId = "";
|
|
|
$("input[name='condition']:checked").each(function(){
|
|
|
condition+=$(this).val()+",";
|
|
|
var conDetail = "";
|
|
|
var nameDetail = "";
|
|
|
var dataName = $(this).attr("data-name");
|
|
|
$("input[name='"+dataName+"']:checked").each(function(){
|
|
|
conDetail+=$(this).val()+",";
|
|
|
conditionId+=$(this).val()+",";
|
|
|
nameDetail+=$(this).attr("data-name")+",";
|
|
|
});
|
|
|
if(conDetail.length==0){
|
|
|
$.Notice.error("请至少选择一个"+$(this).attr("data-tip")+"!");
|
|
|
return false;
|
|
|
}
|
|
|
if(dataName=="serverType"){
|
|
|
values.serverTypeId = conDetail.substring(0,conDetail.length-1);
|
|
|
values.serverTypeContent = nameDetail.substring(0,nameDetail.length-1);
|
|
|
}else if(dataName=="health_situation"){
|
|
|
values.healthSituationId = conDetail.substring(0,conDetail.length-1);
|
|
|
values.healthSituationContent = nameDetail.substring(0,nameDetail.length-1);
|
|
|
}else if(dataName=="diease"){
|
|
|
values.diseaseTypeId = conDetail.substring(0,conDetail.length-1);
|
|
|
values.diseaseTypeContent= nameDetail.substring(0,nameDetail.length-1);
|
|
|
}
|
|
|
});
|
|
|
if(condition.length==0){
|
|
|
$.Notice.error("请至少选择一个设置条件!");
|
|
|
return false;
|
|
|
}
|
|
|
values.condition = condition;
|
|
|
values.conditionId = conditionId;
|
|
|
}
|
|
|
|
|
|
var validator = new jValidation.Validation(self.$form, {
|
|
|
immediate: true, onSubmit: false,
|
|
|
onElementValidate: function (result,elm) {
|
|
|
|
|
|
if (Util.isStrEquals($(elm).attr("id"), 'title')) {
|
|
|
if (isEmpty(values.title)) {
|
|
|
result.setResult(false);
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (Util.isStrEquals($(elm).attr("id"), 'content')) {
|
|
|
if (isEmpty(values.content)) {
|
|
|
result.setResult(false);
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (Util.isStrEquals($(elm).attr("id"), 'send_time')) {
|
|
|
if (values.sendType=="1"&&isEmpty(values.sendTime)) {
|
|
|
result.setResult(false);
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
});
|
|
|
validator.validate();
|
|
|
if (isEmpty(values.title)) {
|
|
|
$.Notice.error("通知标题不能为空!");
|
|
|
return false;
|
|
|
}
|
|
|
if (isEmpty(values.content)) {
|
|
|
$.Notice.error("通知内容不能为空!");
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
if(values.sendType=="1"&&isEmpty(values.sendTime)){
|
|
|
$.Notice.error("发送时间不能为空!");
|
|
|
return false;
|
|
|
}
|
|
|
var ddf = $.ligerDialog.open({
|
|
|
height: 100,
|
|
|
width: 300,
|
|
|
title: "提示",
|
|
|
isHidden: true,
|
|
|
target: "<div style='margin: 0 auto; width: 200px;' >是否确认提交消息通知?提交后无法变更</div>",
|
|
|
buttons: [
|
|
|
{
|
|
|
text: '立即提交', onclick: function (i, d) {
|
|
|
d.hide();
|
|
|
update(values);
|
|
|
}
|
|
|
},
|
|
|
{ text: '我在看看', onclick: function (i, d) { d.hide(); }}
|
|
|
]
|
|
|
});
|
|
|
// $.ajax({
|
|
|
// url: ctx + "/admin/notification/isNoticeAuditor",
|
|
|
// async: false,
|
|
|
// method: "post",
|
|
|
// dataType: "json",
|
|
|
// data: {},
|
|
|
// success: function (data) {
|
|
|
// if (data.status == 200) {
|
|
|
// var authority = data.authority;
|
|
|
//
|
|
|
// $.ligerDialog.open({
|
|
|
// height: 250,
|
|
|
// width: 300,
|
|
|
// title: "tishi",
|
|
|
// isHidden: true,
|
|
|
// target: "是否确认提交消息通知?提交后无法变更",
|
|
|
// buttons: [ { text: '立即提交', onclick: function (i, d) { update(values); }},
|
|
|
// { text: '我在看看', onclick: function (i, d) { d.hide(); }}
|
|
|
// ]
|
|
|
// });
|
|
|
// } else {
|
|
|
// $.Notice.error(data.msg);
|
|
|
// }
|
|
|
// }
|
|
|
// });
|
|
|
|
|
|
});
|
|
|
if(type == "edit" || type == "view"){
|
|
|
getData(templateName,scene);
|
|
|
}
|
|
|
//编辑模板信息
|
|
|
function update(values) {
|
|
|
var dataModel = $.DataModel.init();
|
|
|
var message = "保存中...";
|
|
|
var url = "update";
|
|
|
if (values.id == 0) {
|
|
|
url = "create";
|
|
|
}
|
|
|
var wattingDialog = $.Notice.waitting(message);
|
|
|
dataModel.updateRemote(ctx + "/admin/notification/" + url, {
|
|
|
data: {jsonData: JSON.stringify(values)},
|
|
|
// var dataModel = $.DataModel.init();
|
|
|
$.ajax({
|
|
|
url: ctx + "/admin/wechatTemplate/updateTemplate",
|
|
|
async: false,
|
|
|
method: "post",
|
|
|
dataType: "json",
|
|
|
data: {
|
|
|
"templateName": values.templateName,
|
|
|
"scene":values.scene,
|
|
|
"sceneDescription":values.sceneDescription,
|
|
|
"first":values.first,
|
|
|
"remark":values.remark,
|
|
|
"value1":values.value1,
|
|
|
"value2":values.value2,
|
|
|
"value3":values.value3,
|
|
|
"value4":values.value4,
|
|
|
"value5":values.value5,
|
|
|
"value6":values.value6,
|
|
|
"value7":values.value7
|
|
|
},
|
|
|
success: function (data) {
|
|
|
wattingDialog.close();
|
|
|
if (data.status == 200) {
|
|
|
parent.window.reloadMasterGrid(data.msg);
|
|
|
parent.window.closeInfoDialog();
|
|
|
parent.window.closeUserInfoDialog();
|
|
|
} else {
|
|
|
$.Notice.error(data.msg);
|
|
|
}
|
|
|
},
|
|
|
error: function (data) {
|
|
|
wattingDialog.close();
|
|
|
$.Notice.error("系统异常,请联系管理员!");
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
//新增模板信息
|
|
|
function save(values) {
|
|
|
// var dataModel = $.DataModel.init();
|
|
|
$.ajax({
|
|
|
url: ctx + "/admin/wechatTemplate/saveTemplate",
|
|
|
async: false,
|
|
|
method: "post",
|
|
|
dataType: "json",
|
|
|
data: {
|
|
|
"templateName": values.templateName,
|
|
|
"scene":values.scene,
|
|
|
"sceneDescription":values.sceneDescription,
|
|
|
"first":values.first,
|
|
|
"remark":values.remark,
|
|
|
"value1":values.value1,
|
|
|
"value2":values.value2,
|
|
|
"value3":values.value3,
|
|
|
"value4":values.value4,
|
|
|
"value5":values.value5,
|
|
|
"value6":values.value6,
|
|
|
"value7":values.value7
|
|
|
},
|
|
|
success: function (data) {
|
|
|
if (data.status == 200) {
|
|
|
parent.window.reloadMasterGrid(data.msg);
|
|
|
parent.window.closeUserInfoDialog();
|
|
|
} else {
|
|
|
$.Notice.error(data.msg);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
$("#btn_cancel").click(function () {
|
|
|
parent.window.closeInfoDialog();
|
|
|
parent.window.closeUserInfoDialog();
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
/* *************************** 页面初始化 **************************** */
|
|
|
}
|
|
|
pageInit();
|
|
|
})
|
|
|
})(jQuery, window);
|
|
|
});
|
|
|
})(jQuery, window)
|
|
|
</script>
|