增加仓库和客户配置开关(完成1阶段)

This commit is contained in:
季圣华
2019-08-04 00:54:53 +08:00
parent d1c720b27f
commit 63e20b12ca
9 changed files with 342 additions and 38 deletions

View File

@@ -73,6 +73,39 @@
}
}
/**
* 获取公司信息
*/
function getSystemConfig() {
var info = null;
$.ajax({
type:"get",
url: "/systemConfig/list",
dataType: "json",
data: ({
currentPage: 1,
pageSize: 100
}),
async: false,
success: function (res) {
if (res && res.code === 200) {
if(res.data && res.data.page) {
var array = res.data.page.rows;
if(array.length > 0) {
info = array[0];
}
}
}
},
//此处添加错误处理
error:function() {
$.messager.alert('查询失败','查询系统配置信息异常,请稍后再试!','error');
return;
}
});
return info;
}
/**
* js生成唯一ID值 32位值随机值
* @returns 生成的字符串

View File

@@ -6,35 +6,11 @@ function CreateFormPage(strPrintName, printDatagrid) {
var getMonth= $("#searchMonth").val();
var listTitle = $("#tablePanel").prev().text();
listTitle = listTitle.replace("列表","");
var config = getSystemConfig();
var companyName = "";
//加载公司信息
$.ajax({
type:"get",
url: "/systemConfig/list",
dataType: "json",
data: ({
currentPage: 1,
pageSize: 100
}),
async: false,
success: function (res) {
if (res && res.code === 200) {
if(res.data && res.data.page) {
var array = res.data.page.rows;
if(array.length > 0) {
var info = array[0];
companyName = info.companyName;
}
}
}
},
//此处添加错误处理
error:function() {
$.messager.alert('查询失败','查询系统配置信息异常,请稍后再试!','error');
return;
}
});
if(config) {
companyName = config.companyName;
}
var tableString = '<div class="div-title">' + companyName + "-" + listTitle + '\n</div>';
if(beginDate && endDate) {
tableString+='\n<div class="div-time">日期:' + beginDate + ' 至 ' + endDate + ' \n</div>';

View File

@@ -70,6 +70,14 @@
<label id="companyPostCodeLabel">公司邮编&nbsp;&nbsp;</label>
<input name="companyPostCode" id="companyPostCode" style="width: 220px;height: 20px"/>
</div>
<div class="fitem" style="padding:5px">
<label id="depotFlagLabel">仓库开关&nbsp;&nbsp;</label>
<input name="depotFlag" id="depotFlag" type="checkbox" style="width: 220px;height: 20px"/>
</div>
<div class="fitem" style="padding:5px">
<label id="customerFlagLabel">客户开关&nbsp;&nbsp;</label>
<input name="customerFlag" id="customerFlag" type="checkbox" style="width: 220px;height: 20px"/>
</div>
</form>
</div>
<div id="dlg-buttons">
@@ -86,6 +94,16 @@
//初始化表格数据
function initTableData() {
function parseFlag(value) {
var flagName = "";
if (value =="1") {
flagName = "<span style='color:green'>启用</span>";
}
else {
flagName = "<span style='color:red'>关闭</span>";
}
return flagName;
}
$('#tableData').datagrid({
height: heightInfo,
nowrap: false,
@@ -108,11 +126,24 @@
{title: '公司电话', field: 'companyTel', width: 120, align: "center"},
{title: '公司传真', field: 'companyFax', width: 120, align: "center"},
{title: '公司邮编', field: 'companyPostCode', width: 80, align: "center"},
{
title: '仓库开关', field: 'depotFlag', width: 80, align: "center",
formatter: function (value) {
return parseFlag(value);
}
},
{
title: '客户开关', field: 'customerFlag', width: 80, align: "center",
formatter: function (value) {
return parseFlag(value);
}
},
{
title: '操作', field: 'op', width: 160, formatter: function (value, rec) {
var str = '';
var rowInfo = rec.id + 'AaBb' + rec.companyName + 'AaBb' + rec.companyContacts + 'AaBb' + rec.companyAddress
+ 'AaBb' + rec.companyTel + 'AaBb' + rec.companyFax + 'AaBb' + rec.companyPostCode;
+ 'AaBb' + rec.companyTel + 'AaBb' + rec.companyFax + 'AaBb' + rec.companyPostCode
+ 'AaBb' + rec.depotFlag + 'AaBb' + rec.customerFlag;
str += '<img src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editSystemConfig(\'' + rowInfo + '\');"/>&nbsp;<a onclick="editSystemConfig(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">编辑</a>&nbsp;&nbsp;';
str += '<img src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteSystemConfig(' + rec.id + ');"/>&nbsp;<a onclick="deleteSystemConfig(' + rec.id + ');" style="text-decoration:none;color:black;" href="javascript:void(0)">删除</a>&nbsp;&nbsp;';
return str;
@@ -298,12 +329,15 @@
$("#companyName").val("").focus();
return;
}
var infoObj = $("#systemConfigFM").serializeObject();
infoObj.depotFlag = $("#depotFlag").is(':checked')?"1":"0";
infoObj.customerFlag = $("#customerFlag").is(':checked')?"1":"0";
$.ajax({
url: url,
type: "post",
dataType: "json",
data: {
info: JSON.stringify($("#systemConfigFM").serializeObject())
info: JSON.stringify(infoObj)
},
success: function(res) {
if(res && res.code === 200) {
@@ -339,6 +373,8 @@
systemConfigId = systemConfigInfo[0];
//焦点在名称输入框==定焦在输入文字后面
$("#companyName").val("").focus().val(systemConfigInfo[1]);
$("#depotFlag").attr("checked", systemConfigInfo[7] == '1' ? true : false);
$("#customerFlag").attr("checked", systemConfigInfo[8] == '1' ? true : false);
url = '/systemConfig/update?id=' + systemConfigInfo[0];
}

View File

@@ -113,11 +113,27 @@
<script type="text/javascript">
//初始化界面
$(function () {
initConfig();
initTableData();
ininPager();
browserFit();
});
//初始化配置
function initConfig() {
$("#btnSetDepart").hide();
$("#btnSetCustomer").hide();
var config = getSystemConfig();
if(config) {
if(config.depotFlag == "1") {
$("#btnSetDepart").show();
}
if(config.customerFlag == "1") {
$("#btnSetCustomer").show();
}
}
}
//浏览器适配
function browserFit() {
if (getOs() == 'MSIE') {
@@ -172,8 +188,8 @@
{title: '部门', field: 'orgAbr', width: 115, align: "center"},
{title: '电子邮箱', field: 'email', width: 150, align: "center"},
{title: '电话号码', field: 'phonenum', width: 150, align: "center"},
{title: '用户排序', field: 'userBlngOrgaDsplSeq', width: 50, align: "center"},
{title: '描述', field: 'description', width: 150},
{title: '用户排序', field: 'userBlngOrgaDsplSeq', width: 60, align: "center"},
{title: '描述', field: 'description', width: 130},
{field: 'orgaId',hidden:true, width: 10},
{
title: '操作', field: 'isystem', width: 150, formatter: function (value, rec) {