You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
278 lines
12 KiB
278 lines
12 KiB
<#import "../master.ftl" as master>
|
|
<@master.layout>
|
|
|
|
<style>
|
|
#fm label {
|
|
width: 100px;
|
|
}
|
|
</style>
|
|
|
|
<div class="page-header">
|
|
<h3>Customer Info</h3>
|
|
</div>
|
|
|
|
<table id="dg" class="easyui-datagrid" style="width:100%;height:460px;display: none;"
|
|
data-options="pagination: true, showFooter: true, singleSelect:true, fitColumns:true , url:'/base/searchEmailConfig',method:'get',pageSize:20,toolbar:'#tb'">
|
|
<thead>
|
|
<tr>
|
|
<th data-options="field:'customerNo',width:100,editor:'textbox'">Customer No</th>
|
|
<th data-options="field:'customerName',width:100,editor:'textbox'">Customer Name.</th>
|
|
<th data-options="field:'ftpPath',width:100,editor:'textbox'">FTP Path</th>
|
|
<th data-options="field:'emailFlag',width:100,editor:'textbox'">Email Send</th>
|
|
<th data-options="field:'emailTitle',width:100,editor:'textbox'">Email Title</th>
|
|
<th data-options="field:'emailAddress',width:100,editor:'textbox'">Email Address of Receiver</th>
|
|
<th data-options="field:'emailCcAddress',width:100,editor:'textbox'">Email Address of CC</th>
|
|
<th data-options="field:'id',width:50,align:'center',formatter:formatAction">Actions</th>
|
|
</tr>
|
|
</thead>
|
|
</table>
|
|
|
|
<div id="tb" style="padding:10px 5px;display: none;">
|
|
<div>
|
|
<a href="#nowhere" id="queryLink" class="easyui-linkbutton" iconCls="icon-search">Search</a>
|
|
|
|
<a href="javascript:void(0)" id="tbAdd" class="easyui-linkbutton" iconCls="icon-add" onclick="newBase()">New Customer</a>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="dlg" class="easyui-dialog" style="width:500px;display: none;"
|
|
closed="true" buttons="#dlg-buttons">
|
|
<form id="fm" method="post" novalidate style="margin:0;padding:20px 20px">
|
|
<div style="margin-bottom:10px">
|
|
<input id="customerNo" name="baseDesc" class="easyui-textbox" required="true"
|
|
label="Customer No:" style="width:100%">
|
|
</div>
|
|
<div style="margin-bottom:10px">
|
|
<input id="customerName" name="baseData" class="easyui-textbox" required="true"
|
|
label="Customer Name:" style="width:100%">
|
|
</div>
|
|
<div style="margin-bottom:10px">
|
|
<input id="ftpPath" name="baseData" class="easyui-textbox" required="true"
|
|
label="FTP Path:" style="width:100%">
|
|
</div>
|
|
<div style="margin-bottom:10px">
|
|
<input id="emailFlag" name="baseData" class="easyui-textbox"
|
|
label="Email Send:" style="width:100%">
|
|
</div>
|
|
<div style="margin-bottom:10px">
|
|
<input id="emailTitle" name="baseData" class="easyui-textbox"
|
|
label="Email Title:" style="width:100%">
|
|
</div>
|
|
<div style="margin-bottom:10px">
|
|
<input id="emailAddress" name="baseData" class="easyui-textbox"
|
|
label="Email Address of Receiver:" style="width:100%">
|
|
</div>
|
|
<div style="margin-bottom:10px">
|
|
<input id="emailCcAddress" name="baseData" class="easyui-textbox"
|
|
label="Email Address of CC:" style="width:100%">
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<div id="dlg-buttons" style="display: none;">
|
|
<a href="javascript:void(0)" class="easyui-linkbutton c6" iconCls="icon-ok" onclick="saveBase()" style="width:90px">Save</a>
|
|
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg').dialog('close')" style="width:90px">Cancel</a>
|
|
</div>
|
|
|
|
|
|
|
|
<div id="dlgU" class="easyui-dialog" style="width:500px;display: none;"
|
|
closed="true" buttons="#dlgU-buttons">
|
|
<form id="fmU" method="post" novalidate style="margin:0;padding:20px 20px">
|
|
<div style="margin-bottom:10px">
|
|
<input id="customerNoU" name="baseDesc" class="easyui-textbox" required="true" disabled
|
|
label="Customer No:" style="width:100%">
|
|
</div>
|
|
<div style="margin-bottom:10px">
|
|
<input id="customerNameU" name="baseData" class="easyui-textbox" required="true"
|
|
label="Customer Name:" style="width:100%">
|
|
</div>
|
|
<div style="margin-bottom:10px">
|
|
<input id="ftpPathU" name="baseData" class="easyui-textbox" required="true"
|
|
label="FTP Path:" style="width:100%">
|
|
</div>
|
|
<div style="margin-bottom:10px">
|
|
<input id="emailFlagU" name="baseData" class="easyui-textbox"
|
|
label="Email Send:" style="width:100%">
|
|
</div>
|
|
<div style="margin-bottom:10px">
|
|
<input id="emailTitleU" name="baseData" class="easyui-textbox"
|
|
label="Email Title:" style="width:100%">
|
|
</div>
|
|
<div style="margin-bottom:10px">
|
|
<input id="emailAddressU" name="baseData" class="easyui-textbox"
|
|
label="Email Address of Receiver:" style="width:100%">
|
|
</div>
|
|
<div style="margin-bottom:10px">
|
|
<input id="emailCcAddressU" name="baseData" class="easyui-textbox"
|
|
label="Email Address of CC:" style="width:100%">
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<div id="dlgU-buttons" style="display: none;">
|
|
<a href="javascript:void(0)" class="easyui-linkbutton c6" iconCls="icon-ok" onclick="updateBaseConfigDo()" style="width:90px">Save</a>
|
|
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlgU').dialog('close')" style="width:90px">Cancel</a>
|
|
</div>
|
|
<script>
|
|
var currentRow;
|
|
|
|
function formatAction(value, row){
|
|
var action = "";
|
|
action+= "<a href='javascript:updateBaseConfig()'>Edit</a>"
|
|
<#if currentUser.isAdmin >
|
|
action+= " | <a href='javascript:delBaseConfig(\"" + row.customerNo + "\")'>Delete</a>"
|
|
</#if>
|
|
return action;
|
|
|
|
}
|
|
|
|
function delBaseConfig(customerNo){
|
|
$.messager.confirm('Confirm','Are you sure to delete this record ?',function(r){
|
|
if (r){
|
|
$.post('/base/delBaseConfig',{'customerNo': customerNo},function(result){
|
|
if (result.success){
|
|
$('#dg').datagrid('reload'); // reload the user data
|
|
$.messager.alert('info',result.msg, 'info');
|
|
} else {
|
|
$.messager.alert('error',result.msg, 'error');
|
|
}
|
|
},'json');
|
|
}
|
|
});
|
|
}
|
|
|
|
$(window).resize(function () {
|
|
$("#dg").datagrid({"height": $(window).height() - $(".datagrid").offset().top - 20});
|
|
});
|
|
|
|
$(function () {
|
|
$(window).resize();
|
|
|
|
});
|
|
function updateBaseConfig(){
|
|
let row=$('#dg').datagrid('getSelected');
|
|
$('#dlgU').dialog('open').dialog('center').dialog('setTitle','Edit');
|
|
$('#dlgU').form('clear');
|
|
$('#customerNoU').textbox("setValue", row.customerNo);
|
|
$('#customerNameU').textbox("setValue", row.customerName);
|
|
$('#ftpPathU').textbox("setValue", row.ftpPath);
|
|
$('#emailFlagU').textbox("setValue", row.emailFlag);
|
|
$('#emailTitleU').textbox("setValue", row.emailTitle);
|
|
$('#emailAddressU').textbox("setValue", row.emailAddress);
|
|
$('#emailCcAddressU').textbox("setValue", row.emailCcAddress);
|
|
}
|
|
function newBase(){
|
|
$('#dlg').dialog('open').dialog('center').dialog('setTitle','New');
|
|
$('#dlg').form('clear');
|
|
}
|
|
function saveBase(){
|
|
let customerNo=$('#customerNo').val();
|
|
let customerName=$('#customerName').val();
|
|
let ftpPath=$('#ftpPath').val();
|
|
let emailFlag=$('#emailFlag').val();
|
|
let emailTitle=$('#emailTitle').val();
|
|
let emailAddress=$('#emailAddress').val();
|
|
let emailCcAddress=$('#emailCcAddress').val();
|
|
if(customerNo==null||customerNo==''){
|
|
layer.msg("Please input Customer No!");
|
|
return false;
|
|
}
|
|
if(customerName==null||customerName==''){
|
|
layer.msg("Please input Customer Name!");
|
|
return false;
|
|
}
|
|
if(ftpPath==null||ftpPath==''){
|
|
layer.msg("Please input FTP Path!");
|
|
return false;
|
|
}
|
|
let inData={
|
|
"customerNo": customerNo,
|
|
"customerName": customerName,
|
|
"ftpPath": ftpPath,
|
|
"emailFlag": emailFlag,
|
|
"emailTitle": emailTitle,
|
|
"emailAddress": emailAddress,
|
|
"emailCcAddress": emailCcAddress,
|
|
}
|
|
$.ajax({
|
|
url: "/base/saveBaseConfig",
|
|
contentType: 'application/json',
|
|
type:"POST",
|
|
data:JSON.stringify(inData),
|
|
dataType:"JSON",
|
|
success: function (data) {
|
|
if(data.code=="200"){
|
|
$('#dlg').dialog('close');
|
|
$('#dg').datagrid('reload');
|
|
$.messager.alert("Info",data.msg,"Info",);
|
|
}else{
|
|
$.messager.alert("Error",data.msg,"Error",);
|
|
}
|
|
}
|
|
})
|
|
|
|
}
|
|
|
|
function updateBaseConfigDo(){
|
|
let customerNo=$('#customerNoU').val();
|
|
let customerName=$('#customerNameU').val();
|
|
let ftpPath=$('#ftpPathU').val();
|
|
let emailFlag=$('#emailFlagU').val();
|
|
let emailTitle=$('#emailTitleU').val();
|
|
let emailAddress=$('#emailAddressU').val();
|
|
let emailCcAddress=$('#emailCcAddressU').val();
|
|
if(customerName==null||customerName==''){
|
|
layer.msg("Please input Customer Name!");
|
|
return false;
|
|
}
|
|
if(ftpPath==null||ftpPath==''){
|
|
layer.msg("Please input FTP Path!");
|
|
return false;
|
|
}
|
|
let inData={
|
|
"customerNo": customerNo,
|
|
"customerName": customerName,
|
|
"ftpPath": ftpPath,
|
|
"emailFlag": emailFlag,
|
|
"emailTitle": emailTitle,
|
|
"emailAddress": emailAddress,
|
|
"emailCcAddress": emailCcAddress,
|
|
}
|
|
$.ajax({
|
|
url: "/base/updateBaseConfig",
|
|
contentType: 'application/json',
|
|
type:"POST",
|
|
data:JSON.stringify(inData),
|
|
dataType:"JSON",
|
|
success: function (data) {
|
|
if(data.code=="200"){
|
|
$('#dlgU').dialog('close');
|
|
$('#dg').datagrid('reload');
|
|
$.messager.alert("Info",data.msg,"Info",);
|
|
}else{
|
|
$.messager.alert("Error",data.msg,"Error",);
|
|
}
|
|
}
|
|
})
|
|
|
|
}
|
|
|
|
|
|
$("#queryLink").click(function(){
|
|
var dg = $('#dg').datagrid({
|
|
queryParams: {}
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//导出
|
|
|
|
</script>
|
|
|
|
|
|
</@master.layout>
|
|
|