|
@ -6,54 +6,59 @@
|
|
var Util = $.Util;
|
|
var Util = $.Util;
|
|
var templateName = $('#inp_templateName').val();
|
|
var templateName = $('#inp_templateName').val();
|
|
var scene = $('#inp_scene').val();
|
|
var scene = $('#inp_scene').val();
|
|
|
|
var type = $('#inp_mode').val();
|
|
var info = "";
|
|
var info = "";
|
|
var jValidation = $.jValidation;
|
|
var jValidation = $.jValidation;
|
|
|
|
|
|
//页面初始化
|
|
//页面初始化
|
|
function pageInit() {
|
|
function pageInit() {
|
|
|
|
info.init();
|
|
info.initForm();
|
|
info.initForm();
|
|
}
|
|
}
|
|
|
|
|
|
info = {
|
|
info = {
|
|
//变量
|
|
//变量
|
|
$form: $("#div_template_info_form"),
|
|
$form: $("#div_template_info_form"),
|
|
$code: $('#inp_code'),
|
|
|
|
$name: $('#inp_name'),
|
|
|
|
$sex: $('#inp_sex'),
|
|
|
|
$idcard: $('#inp_idcard'),
|
|
|
|
$mobile: $('#inp_mobile'),
|
|
|
|
$hospital: $("#inp_hospital"),
|
|
|
|
$hospitalName:$("#inp_hospital_name"),
|
|
|
|
|
|
$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 () {
|
|
init: function () {
|
|
//input样式
|
|
//input样式
|
|
this.$form.attrScan();
|
|
this.$form.attrScan();
|
|
this.$code.ligerTextBox({width: 240});
|
|
|
|
this.$name.ligerTextBox({width: 240});
|
|
|
|
this.$sex.ligerTextBox({width: 240});
|
|
|
|
this.$idcard.ligerTextBox({width: 240});
|
|
|
|
this.$mobile.ligerTextBox({width: 240});
|
|
|
|
this.$hospital.ligerTextBox({width: 240});
|
|
|
|
this.$hospitalName.ligerComboBox({
|
|
|
|
width: 240,
|
|
|
|
initIsTriggerEvent: false,
|
|
|
|
valueField: 'typeId',
|
|
|
|
onSelected: function(id,name){
|
|
|
|
$("#inp_hospital").val(id);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
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 () {
|
|
initForm: function () {
|
|
_this = this;
|
|
|
|
this.bindEvents();
|
|
this.bindEvents();
|
|
|
|
|
|
if (type == "view") {
|
|
if (type == "view") {
|
|
//查看时只读属性不可更新数据
|
|
//查看时只读属性不可更新数据
|
|
_this.$form.addClass("m-form-readonly"); //表单只读
|
|
|
|
|
|
$('input').attr('readonly','readonly')
|
|
$(".essential").addClass("XXXtest");
|
|
$(".essential").addClass("XXXtest");
|
|
$(".essential").removeClass("essential");
|
|
$(".essential").removeClass("essential");
|
|
$("#btn_save_close").css("display", "none");
|
|
$("#btn_save_close").css("display", "none");
|
|
} else {
|
|
} else {
|
|
this.$form.removeClass("m-form-readonly");
|
|
|
|
$(".XXXtest").addClass("essential");
|
|
$(".XXXtest").addClass("essential");
|
|
$("#btn_save_close").css("display", "block");
|
|
$("#btn_save_close").css("display", "block");
|
|
if(type == "edit"){
|
|
if(type == "edit"){
|
|
@ -61,6 +66,13 @@
|
|
$("#old_psw_div").css("display", "block");
|
|
$("#old_psw_div").css("display", "block");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if(type == 'new'){
|
|
|
|
$('#format_show').css("display", "none")
|
|
|
|
}
|
|
|
|
if(type == 'edit'){
|
|
|
|
$('#inp_templateName').attr('readonly','readonly')
|
|
|
|
$('#inp_scene').attr('readonly','readonly')
|
|
|
|
}
|
|
this.$form.show();
|
|
this.$form.show();
|
|
},
|
|
},
|
|
|
|
|
|
@ -75,43 +87,82 @@
|
|
|
|
|
|
var self = this;
|
|
var self = this;
|
|
$("#btn_save").click(function () {
|
|
$("#btn_save").click(function () {
|
|
|
|
//保存按钮
|
|
var values = self.$form.Fields.getValues();
|
|
var values = self.$form.Fields.getValues();
|
|
if (!validator.validate()) {
|
|
if (!validator.validate()) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
update(values);
|
|
|
|
|
|
if (type == "edit") {
|
|
|
|
update(values);
|
|
|
|
}else if(type == "new"){
|
|
|
|
save(values);
|
|
|
|
}
|
|
|
|
|
|
});
|
|
});
|
|
|
|
|
|
//查看模板信息
|
|
//查看模板信息
|
|
function get(values) {
|
|
|
|
var dataModel = $.DataModel.init();
|
|
|
|
|
|
function getData(templateName,scene) {
|
|
|
|
// var dataModel = $.DataModel.init();
|
|
$.ajax({
|
|
$.ajax({
|
|
url: ctx + "/admin/wechatTemplate/updateTemplate",
|
|
|
|
|
|
url: ctx + "/admin/wechatTemplate/getTemplate",
|
|
async: false,
|
|
async: false,
|
|
method: "post",
|
|
method: "post",
|
|
dataType: "json",
|
|
dataType: "json",
|
|
data: {"templateName": templateName,"scene":scene},
|
|
|
|
|
|
data: {
|
|
|
|
"templateName": templateName,
|
|
|
|
"scene":scene
|
|
|
|
},
|
|
success: function (data) {
|
|
success: function (data) {
|
|
if (data.status == 200) {
|
|
if (data.status == 200) {
|
|
alert(data.toString());
|
|
|
|
parent.window.reloadMasterGrid(data.msg);
|
|
|
|
parent.window.closeUserInfoDialog();
|
|
|
|
|
|
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
|
|
|
|
});
|
|
|
|
// parent.window.reloadMasterGrid(data.data);
|
|
|
|
// parent.window.closeUserInfoDialog();
|
|
} else {
|
|
} else {
|
|
$.Notice.error(data.msg);
|
|
$.Notice.error(data.msg);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if(type == "edit" || type == "view"){
|
|
|
|
getData(templateName,scene);
|
|
|
|
}
|
|
//编辑模板信息
|
|
//编辑模板信息
|
|
function update(values) {
|
|
function update(values) {
|
|
var dataModel = $.DataModel.init();
|
|
|
|
|
|
// var dataModel = $.DataModel.init();
|
|
$.ajax({
|
|
$.ajax({
|
|
url: ctx + "/admin/wechatTemplate/updateTemplate",
|
|
url: ctx + "/admin/wechatTemplate/updateTemplate",
|
|
async: false,
|
|
async: false,
|
|
method: "post",
|
|
method: "post",
|
|
dataType: "json",
|
|
dataType: "json",
|
|
data: {"doc": doc,"oldHospital":hospital,"hospital": $("#inp_hospital").val()},
|
|
|
|
|
|
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) {
|
|
success: function (data) {
|
|
if (data.status == 200) {
|
|
if (data.status == 200) {
|
|
parent.window.reloadMasterGrid(data.msg);
|
|
parent.window.reloadMasterGrid(data.msg);
|
|
@ -125,13 +176,26 @@
|
|
|
|
|
|
//新增模板信息
|
|
//新增模板信息
|
|
function save(values) {
|
|
function save(values) {
|
|
var dataModel = $.DataModel.init();
|
|
|
|
|
|
// var dataModel = $.DataModel.init();
|
|
$.ajax({
|
|
$.ajax({
|
|
url: ctx + "/admin/wechatTemplate/saveTemplate",
|
|
url: ctx + "/admin/wechatTemplate/saveTemplate",
|
|
async: false,
|
|
async: false,
|
|
method: "post",
|
|
method: "post",
|
|
dataType: "json",
|
|
dataType: "json",
|
|
data: {"doc": doc,"oldHospital":hospital,"hospital": $("#inp_hospital").val()},
|
|
|
|
|
|
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) {
|
|
success: function (data) {
|
|
if (data.status == 200) {
|
|
if (data.status == 200) {
|
|
parent.window.reloadMasterGrid(data.msg);
|
|
parent.window.reloadMasterGrid(data.msg);
|