Commit 74a45113 authored by 刘学辉's avatar 刘学辉

物料/产品主数据修改,选择业务部门自动增加选择审批人员

parent 7fc7713f
...@@ -99,6 +99,32 @@ function initializate() { ...@@ -99,6 +99,32 @@ function initializate() {
// } // }
// }); // });
var dictUsage=dictUsages.split(";");
$('input[name="businessUsage"]').change(function () {
//alert($(this).is(':checked'));
if ($(this).is(':checked')) {
console.log($(this).val()); // 输出选中的值
debugger
var name="",deptCode="";
for (var u=0;u<dictUsage.length;u++){
if ($(this).val()==dictUsage[u].split(",")[0]){
name=dictUsage[u].split(",")[1];
deptCode=dictUsage[u].split(",")[0];
break;
}
}
gridManager.addRow({ deptName: name, deptCode: deptCode,userName: "" });
} else {
let datas=gridManager.getData();
var selval=$(this).val();
for (var i=0;i<datas.length;i++) {
if (datas[i].deptCode==selval){
gridManager.deleteRow(i);
}
}
}
});
} }
...@@ -127,6 +153,7 @@ function loadGrid() { ...@@ -127,6 +153,7 @@ function loadGrid() {
// let a=(dept.length+1)*37.5; // let a=(dept.length+1)*37.5;
gridManager = UICtrl.grid("#businessPersonnelListGrid", { gridManager = UICtrl.grid("#businessPersonnelListGrid", {
columns: [ columns: [
{display: "部门代码", name: "deptCode", width: 0, minWidth: 10, type: "string", align: "left",hide: true},
{display: "部门", name: "deptName", width: 200, minWidth: 60, type: "string", align: "left"}, {display: "部门", name: "deptName", width: 200, minWidth: 60, type: "string", align: "left"},
{display: "部门人员", name: "userName", width: 280,disable: true, minWidth: 60, type: "string", align: "left", {display: "部门人员", name: "userName", width: 280,disable: true, minWidth: 60, type: "string", align: "left",
editor: { editor: {
......
...@@ -4,6 +4,9 @@ ...@@ -4,6 +4,9 @@
<html> <html>
<head> <head>
<script>
var dictUsages ="${dictUsages}";
</script>
<x:base include="layout,dialog,grid,tree,combox,commonTree,date"/> <x:base include="layout,dialog,grid,tree,combox,commonTree,date"/>
<x:script src='/biz/topsun/sap/nonProdApply/nonProdApplyNext.js'/> <x:script src='/biz/topsun/sap/nonProdApply/nonProdApplyNext.js'/>
</head> </head>
......
...@@ -140,6 +140,9 @@ public class NonProdApplyDeptApplicationImpl extends BaseApplication implements ...@@ -140,6 +140,9 @@ public class NonProdApplyDeptApplicationImpl extends BaseApplication implements
try { try {
deptStaffList = objectMapper.readValue(deptStaffJSON, new TypeReference<List<Map<String, String>>>() { deptStaffList = objectMapper.readValue(deptStaffJSON, new TypeReference<List<Map<String, String>>>() {
}); });
if (deptStaffList.size()<1){
throw new RuntimeException("未选择对应的分发人员!");
}
} catch (JsonProcessingException e) { } catch (JsonProcessingException e) {
throw new RuntimeException("JSON转换失败:" + e); throw new RuntimeException("JSON转换失败:" + e);
} }
...@@ -205,17 +208,21 @@ public class NonProdApplyDeptApplicationImpl extends BaseApplication implements ...@@ -205,17 +208,21 @@ public class NonProdApplyDeptApplicationImpl extends BaseApplication implements
*/ */
@Override @Override
public void distributeSapNonProdApplyDept(SDO sdo) { public void distributeSapNonProdApplyDept(SDO sdo) {
//将状态为保存未分发的全部修改为分发未完成
Map<String, Object> map = this.saveSapNonProdApplyDept(sdo);
//获取分发的部门与人员信息 //获取分发的部门与人员信息
ObjectMapper objectMapper = new ObjectMapper(); ObjectMapper objectMapper = new ObjectMapper();
String deptStaffJSON = sdo.getString("deptStaff"); String deptStaffJSON = sdo.getString("deptStaff");
List<Map<String, String>> deptStaffList = null; List<Map<String, String>> deptStaffList = null;
try { try {
deptStaffList = objectMapper.readValue(deptStaffJSON, new TypeReference<List<Map<String, String>>>() {}); deptStaffList = objectMapper.readValue(deptStaffJSON, new TypeReference<List<Map<String, String>>>() {});
if (deptStaffList.size()<1){
throw new RuntimeException("未选择对应的分发人员!");
}
} catch (JsonProcessingException e) { } catch (JsonProcessingException e) {
throw new RuntimeException("JSON转换失败:"+e); throw new RuntimeException("JSON转换失败:"+e);
} }
//将状态为保存未分发的全部修改为分发未完成
Map<String, Object> map = this.saveSapNonProdApplyDept(sdo);
//保存分发任务 //保存分发任务
// saveDeptStaff(deptStaffList,map.get("applyDeptId").toString()); // saveDeptStaff(deptStaffList,map.get("applyDeptId").toString());
......
...@@ -60,14 +60,21 @@ public class NonProdApplyNextController extends CommonController { ...@@ -60,14 +60,21 @@ public class NonProdApplyNextController extends CommonController {
nonProdApplyBaseInfo.setApplyType("0"); nonProdApplyBaseInfo.setApplyType("0");
this.putAttribute("applyType", "0"); this.putAttribute("applyType", "0");
SapNonProdApplyDept nonProdApplyDept = nonProdApplyDeptApplication.getNonProdApplyDeptByBaseInfoId(id); SapNonProdApplyDept nonProdApplyDept = nonProdApplyDeptApplication.getNonProdApplyDeptByBaseInfoId(id);
Map <String,String>dictMapUsage=DictUtil.getDictionary("serviceusage");
String dictMapUsages="";
for (Map.Entry<String, String> entry: dictMapUsage.entrySet()) {
// String key = entry.getKey().toUpperCase();
dictMapUsages+=entry.getKey().toUpperCase()+","+entry.getValue()+";";
}
this.putAttribute("dictUsages",dictMapUsages);
if (nonProdApplyBaseInfo.getMaintenanceType().equals("modify")){ if (nonProdApplyBaseInfo.getMaintenanceType().equals("modify")){
nonProdApplyBaseInfo.setApplyType("1"); nonProdApplyBaseInfo.setApplyType("1");
this.putAttribute("applyType", "1"); this.putAttribute("applyType", "1");
} if (nonProdApplyBaseInfo.getMaintenanceType().equals("extend")){ } if (nonProdApplyBaseInfo.getMaintenanceType().equals("extend")){
nonProdApplyBaseInfo.setApplyType("2"); nonProdApplyBaseInfo.setApplyType("2");
this.putAttribute("applyType", "2"); this.putAttribute("applyType", "2");
Map <String,String>dictMapUsage=DictUtil.getDictionary("serviceusage");
NonProdApplyBaseInfo sourceNonProdApplyBaseInfo=nonProdApplyApplication.loadNonProdApplyBaseInfoById(nonProdApplyBaseInfo.getSourceId()); // NonProdApplyBaseInfo sourceNonProdApplyBaseInfo=nonProdApplyApplication.loadNonProdApplyBaseInfoById(nonProdApplyBaseInfo.getSourceId());
String usedBusiness=nonProdApplyApplication.getChangeBusinessUsage(id,"扩展"); String usedBusiness=nonProdApplyApplication.getChangeBusinessUsage(id,"扩展");
//去掉当前的 //去掉当前的
usedBusiness=usedBusiness.replaceAll(nonProdApplyBaseInfo.getBusinessUsage(),""); usedBusiness=usedBusiness.replaceAll(nonProdApplyBaseInfo.getBusinessUsage(),"");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment