增加仓库和客户配置开关(全部完成)

This commit is contained in:
季圣华
2019-08-04 23:11:44 +08:00
parent 7401e36242
commit a658fd5d4b
11 changed files with 131 additions and 57 deletions

View File

@@ -217,28 +217,27 @@
//初始化页面选项卡
function initSelectInfo_depot(){
var options = "";
if(depotList !=null)
{
if(depotList !=null) {
options = "";
for(var i = 0 ;i < depotList.length;i++)
{
var depot = depotList[i];
if(userdepot!=null)
{
if(userdepot.indexOf("["+depot.id+"]")!=-1)
{
if(depot.isDefault){
defDepotId = depot.id;
}
options += '<option value="' + depot.id + '">' + depot.name + '</option>';
depotString = depotString + depot.id + ",";
}
}
if(depot.type === 1){
for(var i = 0 ;i < depotList.length;i++) {
var depot = depotList[i];
if(depot.isDefault){
defDepotId = depot.id;
}
var config = getSystemConfig();
if(config && config.depotFlag == "1") {
if(userdepot!=null) {
if(userdepot.indexOf("["+depot.id+"]")!=-1) {
options += '<option value="' + depot.id + '">' + depot.name + '</option>';
depotString = depotString + depot.id + ",";
}
}
} else {
depotString = depotString + depot.id + ",";
}
if(depot.type === 1){
depotString = depotString + depot.id + ",";
}
}
depotString = depotString.substring(1, depotString.length-1);
$("#ProjectId").empty().append(options);

View File

@@ -72,11 +72,11 @@
</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"/>
<input name="depotFlag" id="depotFlag" type="checkbox" style="width: 220px;height: 20px" title="勾选后需要到用户列表配置权限"/>
</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"/>
<input name="customerFlag" id="customerFlag" type="checkbox" style="width: 220px;height: 20px" title="勾选后需要到用户列表配置权限"/>
</div>
</form>
</div>

View File

@@ -154,17 +154,21 @@
//初始化页面选项卡
function initSelectInfo_depot() {
var options = "";
if (depotList != null) {
options = "";
for (var i = 0; i < depotList.length; i++) {
var depot = depotList[i];
if (userdepot != null) {
if (userdepot.indexOf("[" + depot.id + "]") != -1) {
options += '<option value="' + depot.id + '">' + depot.name + '</option>';
depotString = depotString + depot.id + ",";
var config = getSystemConfig();
if(config && config.depotFlag == "1") {
if (userdepot != null) {
if (userdepot.indexOf("[" + depot.id + "]") != -1) {
options += '<option value="' + depot.id + '">' + depot.name + '</option>';
depotString = depotString + depot.id + ",";
}
}
} else {
options += '<option value="' + depot.id + '">' + depot.name + '</option>';
depotString = depotString + depot.id + ",";
}
}
depotString = depotString.substring(0, depotString.length - 1);

View File

@@ -153,17 +153,21 @@
//初始化页面选项卡
function initSelectInfo_depot() {
var options = "";
if (depotList != null) {
options = "";
for (var i = 0; i < depotList.length; i++) {
var depot = depotList[i];
if (userdepot != null) {
if (userdepot.indexOf("[" + depot.id + "]") != -1) {
options += '<option value="' + depot.id + '">' + depot.name + '</option>';
depotString = depotString + depot.id + ",";
var config = getSystemConfig();
if(config && config.depotFlag == "1") {
if (userdepot != null) {
if (userdepot.indexOf("[" + depot.id + "]") != -1) {
options += '<option value="' + depot.id + '">' + depot.name + '</option>';
depotString = depotString + depot.id + ",";
}
}
} else {
options += '<option value="' + depot.id + '">' + depot.name + '</option>';
depotString = depotString + depot.id + ",";
}
}
depotString = depotString.substring(0, depotString.length - 1);

View File

@@ -145,16 +145,19 @@
//初始化页面选项卡
function initSelectInfo_depot() {
var options = "";
if (depotList != null) {
options = "";
for (var i = 0; i < depotList.length; i++) {
var depot = depotList[i];
if (userdepot != null) {
if (userdepot.indexOf("[" + depot.id + "]") != -1) {
options += '<option value="' + depot.id + '">' + depot.name + '</option>';
var config = getSystemConfig();
if(config && config.depotFlag == "1") {
if (userdepot != null) {
if (userdepot.indexOf("[" + depot.id + "]") != -1) {
options += '<option value="' + depot.id + '">' + depot.name + '</option>';
}
}
} else {
options += '<option value="' + depot.id + '">' + depot.name + '</option>';
}
}
$("#searchProjectId").empty().append(options);

View File

@@ -154,17 +154,21 @@
//初始化页面选项卡
function initSelectInfo_depot() {
var options = "";
if (depotList != null) {
options = "";
for (var i = 0; i < depotList.length; i++) {
var depot = depotList[i];
if (userdepot != null) {
if (userdepot.indexOf("[" + depot.id + "]") != -1) {
options += '<option value="' + depot.id + '">' + depot.name + '</option>';
depotString = depotString + depot.id + ",";
var config = getSystemConfig();
if(config && config.depotFlag == "1") {
if (userdepot != null) {
if (userdepot.indexOf("[" + depot.id + "]") != -1) {
options += '<option value="' + depot.id + '">' + depot.name + '</option>';
depotString = depotString + depot.id + ",";
}
}
} else {
options += '<option value="' + depot.id + '">' + depot.name + '</option>';
depotString = depotString + depot.id + ",";
}
}
depotString = depotString.substring(0, depotString.length - 1);

View File

@@ -153,17 +153,21 @@
//初始化页面选项卡
function initSelectInfo_depot() {
var options = "";
if (depotList != null) {
options = "";
for (var i = 0; i < depotList.length; i++) {
var depot = depotList[i];
if (userdepot != null) {
if (userdepot.indexOf("[" + depot.id + "]") != -1) {
options += '<option value="' + depot.id + '">' + depot.name + '</option>';
depotString = depotString + depot.id + ",";
var config = getSystemConfig();
if(config && config.depotFlag == "1") {
if (userdepot != null) {
if (userdepot.indexOf("[" + depot.id + "]") != -1) {
options += '<option value="' + depot.id + '">' + depot.name + '</option>';
depotString = depotString + depot.id + ",";
}
}
} else {
options += '<option value="' + depot.id + '">' + depot.name + '</option>';
depotString = depotString + depot.id + ",";
}
}
depotString = depotString.substring(0, depotString.length - 1);

View File

@@ -139,16 +139,19 @@
//初始化页面选项卡
function initSelectInfo_depot() {
var options = "";
if (depotList != null) {
options = "";
for (var i = 0; i < depotList.length; i++) {
var depot = depotList[i];
if (userdepot != null) {
if (userdepot.indexOf("[" + depot.id + "]") != -1) {
options += '<option value="' + depot.id + '">' + depot.name + '</option>';
var config = getSystemConfig();
if(config && config.depotFlag == "1") {
if (userdepot != null) {
if (userdepot.indexOf("[" + depot.id + "]") != -1) {
options += '<option value="' + depot.id + '">' + depot.name + '</option>';
}
}
} else {
options += '<option value="' + depot.id + '">' + depot.name + '</option>';
}
}
$("#searchProjectId").empty().append(options);

View File

@@ -12,6 +12,7 @@ import com.jsh.erp.datasource.entities.Depot;
import com.jsh.erp.datasource.entities.DepotEx;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.service.depot.DepotService;
import com.jsh.erp.service.systemConfig.SystemConfigService;
import com.jsh.erp.service.userBusiness.UserBusinessService;
import com.jsh.erp.utils.*;
import org.slf4j.Logger;
@@ -40,6 +41,9 @@ public class DepotController {
@Resource
private UserBusinessService userBusinessService;
@Resource
private SystemConfigService systemConfigService;
@GetMapping(value = "/getAllList")
public BaseResponseInfo getAllList(HttpServletRequest request) throws Exception{
BaseResponseInfo res = new BaseResponseInfo();
@@ -102,6 +106,14 @@ public class DepotController {
return arr;
}
/**
* 获取用户拥有权限的仓库列表
* @param type
* @param keyId
* @param request
* @return
* @throws Exception
*/
@RequestMapping(value = "/findDepotByUserId")
public JSONArray findDepotByUserId(@RequestParam("UBType") String type, @RequestParam("UBKeyId") String keyId,
HttpServletRequest request) throws Exception{
@@ -110,6 +122,7 @@ public class DepotController {
List<Depot> dataList = depotService.findUserDepot();
//开始拼接json数据
if (null != dataList) {
boolean depotFlag = systemConfigService.getDepotFlag();
for (Depot depot : dataList) {
JSONObject item = new JSONObject();
//勾选判断1
@@ -119,7 +132,7 @@ public class DepotController {
} catch (DataAccessException e) {
logger.error(">>>>>>>>>>>>>>>>>查询用户对应的仓库:类型" + type + " KeyId为 " + keyId + " 存在异常!");
}
if (flag == true) {
if (!depotFlag || flag) {
item.put("id", depot.getId());
item.put("depotName", depot.getName());
arr.add(item);

View File

@@ -7,6 +7,7 @@ import com.jsh.erp.constants.ExceptionConstants;
import com.jsh.erp.datasource.entities.Supplier;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.service.supplier.SupplierService;
import com.jsh.erp.service.systemConfig.SystemConfigService;
import com.jsh.erp.service.user.UserService;
import com.jsh.erp.service.userBusiness.UserBusinessService;
import com.jsh.erp.utils.*;
@@ -44,6 +45,10 @@ public class SupplierController {
@Resource
private UserBusinessService userBusinessService;
@Resource
private SystemConfigService systemConfigService;
@Resource
private UserService userService;
@@ -81,6 +86,7 @@ public class SupplierController {
List<Supplier> supplierList = supplierService.findBySelectCus();
JSONArray dataArray = new JSONArray();
if (null != supplierList) {
boolean depotFlag = systemConfigService.getDepotFlag();
for (Supplier supplier : supplierList) {
JSONObject item = new JSONObject();
//勾选判断1
@@ -90,7 +96,7 @@ public class SupplierController {
} catch (DataAccessException e) {
logger.error(">>>>>>>>>>>>>>>>>查询用户对应的客户:存在异常!");
}
if (flag == true) {
if (!depotFlag || flag) {
item.put("id", supplier.getId());
item.put("supplier", supplier.getSupplier()); //客户名称
dataArray.add(item);

View File

@@ -187,4 +187,38 @@ public class SystemConfigService {
}
return result;
}
/**
* 获取仓库开关
* @return
* @throws Exception
*/
public boolean getDepotFlag() throws Exception {
boolean depotFlag = false;
List<SystemConfig> list = getSystemConfig();
if(list.size()>0) {
String flag = list.get(0).getDepotFlag();
if(("1").equals(flag)) {
depotFlag = true;
}
}
return depotFlag;
}
/**
* 获取客户开关
* @return
* @throws Exception
*/
public boolean getCustomerFlag() throws Exception {
boolean customerFlag = false;
List<SystemConfig> list = getSystemConfig();
if(list.size()>0) {
String flag = list.get(0).getCustomerFlag();
if(("1").equals(flag)) {
customerFlag = true;
}
}
return customerFlag;
}
}