提交 ed181b25 编写于 作者: M megagao

修改了与其他模块同名的js方法,消除bug

上级 f6a0dced
......@@ -72,7 +72,7 @@
<input type="hidden" name="customParams"/>
</form>
<div style="padding:5px">
<a href="javascript:void(0)" class="easyui-linkbutton" onclick="submitForm()">提交</a>
<a href="javascript:void(0)" class="easyui-linkbutton" onclick="submitCustomAddForm()">提交</a>
<a href="javascript:void(0)" class="easyui-linkbutton" onclick="clearForm()">重置</a>
</div>
</div>
......@@ -87,7 +87,7 @@
customAddEditor = KindEditor.create("#customAddForm [name=note]", TT.kingEditorParams);
});
//提交表单
function submitForm(){
function submitCustomAddForm(){
//有效性验证
if(!$('#customAddForm').form('validate')){
$.messager.alert('提示','表单还未填写完成!');
......@@ -101,6 +101,8 @@
if(data.status == 200){
$.messager.alert('提示','新增客户成功!');
clearForm();
}else{
$.messager.alert('提示',data.msg);
}
});
}
......
......@@ -6,12 +6,11 @@
<form id="customEditForm" class="customForm" method="post">
<input type="hidden" name="customId"/>
<table cellpadding="5">
<tr>
<tr>
<td>客户名称:</td>
<td>
<input class="easyui-textbox" type="text" name="customName" data-options="required:true"></input>
</td>
</tr>
<tr>
<td>客户全称:</td>
......@@ -67,7 +66,7 @@
</table>
</form>
<div style="padding:5px">
<a href="javascript:void(0)" class="easyui-linkbutton" onclick="submitForm()">提交</a>
<a href="javascript:void(0)" class="easyui-linkbutton" onclick="submitCustomEditForm()">提交</a>
</div>
</div>
<script type="text/javascript">
......@@ -77,20 +76,28 @@
customEditEditor = TAOTAO.createEditor("#customEditForm [name=note]");
});
function submitForm(){
if(!$('#customEditForm').form('validate')){
$.messager.alert('提示','表单还未填写完成!');
return ;
}
//同步文本框中的备注
customEditEditor.sync();
$.post("custom/update_all",$("#customEditForm").serialize(), function(data){
if(data.status == 200){
$.messager.alert('提示','修改客户成功!','info',function(){
$("#customEditWindow").window('close');
$("#customList").datagrid("reload");
});
}
});
function submitCustomEditForm(){
$.get("custom/edit_judge",'',function(data){
if(data.msg != null){
$.messager.alert('提示', data.msg);
}else{
if(!$('#customEditForm').form('validate')){
$.messager.alert('提示','表单还未填写完成!');
return ;
}
//同步文本框中的备注
customEditEditor.sync();
$.post("custom/update_all",$("#customEditForm").serialize(), function(data){
if(data.status == 200){
$.messager.alert('提示','修改客户成功!','info',function(){
$("#customEditWindow").window('close');
$("#customList").datagrid("reload");
$("#customInfoWindow").window('close');
});
}
});
}
});
}
</script>
......@@ -7,16 +7,16 @@
<thead>
<tr>
<th data-options="field:'ck',checkbox:true"></th>
<th data-options="field:'customId',width:100">客户编号</th>
<th data-options="field:'customName',width:100">客户名称</th>
<th data-options="field:'fullName',width:200">客户全称</th>
<th data-options="field:'address',width:100">地址</th>
<th data-options="field:'fax',width:100,align:'right'">传真</th>
<th data-options="field:'email',width:100,align:'right'">邮箱</th>
<th data-options="field:'customId',width:100,align:'center'">客户编号</th>
<th data-options="field:'customName',width:100,align:'center'">客户名称</th>
<th data-options="field:'fullName',width:200,align:'center'">客户全称</th>
<th data-options="field:'address',width:200,align:'center'">地址</th>
<th data-options="field:'fax',width:100,align:'center'">传真</th>
<th data-options="field:'email',width:100,align:'center'">邮箱</th>
<th data-options="field:'ownerName',width:60,align:'center'">经理姓名</th>
<th data-options="field:'ownerTel',width:100,align:'center'">联系电话</th>
<th data-options="field:'status',width:60,align:'center',formatter:TAOTAO.formatCustomStatus">客户状态</th>
<th data-options="field:'note',width:130,align:'center', formatter:formatNote">备注</th>
<th data-options="field:'note',width:130,align:'center', formatter:formatCustomNote">备注</th>
</tr>
</thead>
</table>
......@@ -24,8 +24,8 @@
</div>
<div id="customAddWindow" class="easyui-window" title="添加客户" data-options="modal:true,closed:true,resizable:true,iconCls:'icon-save',href:'custom/add'" style="width:65%;height:80%;padding:10px;">
</div>
<div id="noteDialog" class="easyui-dialog" title="备注" data-options="modal:true,closed:true,resizable:true,iconCls:'icon-save'" style="width:55%;height:80%;padding:10px;">
<form id="noteForm" class="itemForm" method="post">
<div id="customNoteDialog" class="easyui-dialog" title="备注" data-options="modal:true,closed:true,resizable:true,iconCls:'icon-save'" style="width:55%;height:80%;padding:10px;">
<form id="customNoteForm" class="itemForm" method="post">
<input type="hidden" name="customId"/>
<table cellpadding="5" >
<tr>
......@@ -37,56 +37,56 @@
</table>
</form>
<div style="padding:5px">
<a href="javascript:void(0)" class="easyui-linkbutton" onclick="updateNote()">保存</a>
<a href="javascript:void(0)" class="easyui-linkbutton" onclick="updateCustomNote()">保存</a>
</div>
</div>
<script>
var noteEditor ;
var customNoteEditor ;
//根据index拿到该行值
function onClickRow(index) {
function onCustomClickRow(index) {
var rows = $('#customList').datagrid('getRows');
return rows[index];
}
//格式化客户介绍
function formatNote(value, row, index){
function formatCustomNote(value, row, index){
if(value !=null && value != ''){
return "<a href=javascript:openNote("+index+")>"+"客户介绍"+"</a>";
return "<a href=javascript:openCustomNote("+index+")>"+"客户介绍"+"</a>";
}else{
return "";
}
}
function openNote(index){
function openCustomNote(index){
var row = onClickRow(index);
$("#noteDialog").dialog({
var row = onCustomClickRow(index);
$("#customNoteDialog").dialog({
onOpen :function(){
$("#noteForm [name=customId]").val(row.customId);
noteEditor = TAOTAO.createEditor("#noteForm [name=note]");
noteEditor.html(row.note);
$("#customNoteForm [name=customId]").val(row.customId);
customNoteEditor = TAOTAO.createEditor("#customNoteForm [name=note]");
customNoteEditor.html(row.note);
},
onBeforeClose: function (event, ui) {
// 关闭Dialog前移除编辑器
KindEditor.remove("#noteForm [name=note]");
KindEditor.remove("#customNoteForm [name=note]");
}
}).dialog("open");
};
function updateNote(){
function updateCustomNote(){
$.get("custom/edit_judge",'',function(data){
if(data.msg != null){
$.messager.alert('提示', data.msg);
}else{
noteEditor.sync();
$.post("custom/update_note",$("#noteForm").serialize(), function(data){
customNoteEditor.sync();
$.post("custom/update_note",$("#customNoteForm").serialize(), function(data){
if(data.status == 200){
$("#noteDialog").dialog("close");
$("#customNoteDialog").dialog("close");
$("#customList").datagrid("reload");
$.messager.alert("操作提示", "更新客户介绍成功!");
}else{
......@@ -97,7 +97,7 @@
});
}
function getSelectionsIds(){
function getCustomSelectionsIds(){
var customList = $("#customList");
var sels = customList.datagrid("getSelections");
var ids = [];
......@@ -129,7 +129,7 @@
if(data.msg != null){
$.messager.alert('提示', data.msg);
}else{
var ids = getSelectionsIds();
var ids = getCustomSelectionsIds();
if(ids.length == 0){
$.messager.alert('提示','必须选择一个客户才能编辑!');
......@@ -145,8 +145,7 @@
//回显数据
var data = $("#customList").datagrid("getSelections")[0];
$("#customEditForm").form("load", data);
noteEditor.html(data.note);
customNoteEditor.html(data.note);
}
}).window("open");
}
......@@ -160,7 +159,7 @@
if(data.msg != null){
$.messager.alert('提示', data.msg);
}else{
var ids = getSelectionsIds();
var ids = getCustomSelectionsIds();
if(ids.length == 0){
$.messager.alert('提示','未选中客户!');
return ;
......@@ -181,28 +180,6 @@
});
}
},'-',{
text:'下架',
iconCls:'icon-remove',
handler:function(){
var ids = getSelectionsIds();
if(ids.length == 0){
$.messager.alert('提示','未选中客户!');
return ;
}
$.messager.confirm('确认','确定下架ID为 '+ids+' 的客户吗?',function(r){
if (r){
var params = {"ids":ids};
$.post("/rest/custom/instock",params, function(data){
if(data.status == 200){
$.messager.alert('提示','下架客户成功!',undefined,function(){
$("#customList").datagrid("reload");
});
}
});
}
});
}
},{
text:'刷新',
iconCls:'icon-reload',
handler:function(){
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册