Browse Source

普通报销相关修改:新增默认赋值上一次选择项目;流程描述项目名称去重

chenjun 1 year ago
parent
commit
00e423c3f0

+ 5 - 1
zjugis-business/src/main/java/com/zjugis/business/flow/commoncost/event/CommonCostEvent.java

@@ -95,9 +95,13 @@ public class CommonCostEvent extends BaseController {
                 commonCostService.updateCommonCost(CommonCostConvert.INSTANCE.convert(entity));
                 List<CommonCostDetailDO> detailList = commonCostDetailService.getListByCommonCostId(entity.getId());
                 StringBuilder projectName = new StringBuilder();
+                Set<String> projectNameList = new HashSet<>();
                 detailList.forEach(x -> {
                     Project project = projectService.selectById(x.getProjectId());
-                    projectName.append(project.getXmmc());
+                    projectNameList.add(project.getXmmc());
+                });
+                projectNameList.forEach(name -> {
+                    projectName.append(name);
                     projectName.append(";");
                 });
                 projectName.setLength(projectName.length() - 1);

+ 10 - 0
zjugis-business/src/main/resources/templates/CommonCost/js/agentIndex.js

@@ -7,6 +7,8 @@
     let detailProjectIndex = 0;
     let previousAmount = z.ui.input("[name='createReqVO$totalAmount']").getValue();
     let costTypeJSON = JSON.parse(document.querySelector('#costTypeJSON').value)
+    let lastProjectId = '';
+    let lastProjectName = '';
     window.onload = function (ex) {
         let timeObject = document.querySelector('#detailList')
         let arrays = JSON.parse(timeObject.value)
@@ -172,6 +174,12 @@
             z.ui.selecttree("[name='costType[" + i + "]']").setValue(isTimes[i].costType)
             $("[name='CommonCostDetailDO[" + i + "]$costType']").val(isTimes[i].costType);
         }
+        if(!(!lastProjectId || lastProjectId.trim() === '')){
+            $("[name='CommonCostDetailDO[" + i + "]$projectId']").val(lastProjectId);
+        }
+        if(!(!lastProjectName || lastProjectName.trim() === '')){
+            z.ui.input("[name='CommonCostDetailDO[" + i + "]$projectName']").setValue(lastProjectName);
+        }
         if (!(!isTimes[i].projectId || isTimes[i].projectId.trim() === '')) {
             $("[name='CommonCostDetailDO[" + i + "]$projectId']").val(isTimes[i].projectId);
         }
@@ -221,6 +229,8 @@
                     z.ui.alertWarning(`项目不能为空!`)
                     return false;
                 }
+                lastProjectId = $("[name='CommonCostDetailDO[" + i + "]$projectId']").val();
+                lastProjectName = z.ui.input("[name='CommonCostDetailDO[" + i + "]$projectName']").getValue();
                 if(!z.ui.date("[name='CommonCostDetailDO[" + i + "]$costDate']").getValue()){
                     z.ui.alertWarning(`发生日期不能为空!`)
                     return false;

+ 10 - 0
zjugis-business/src/main/resources/templates/CommonCost/js/index.js

@@ -7,6 +7,8 @@
     let detailProjectIndex = 0;
     let previousAmount = z.ui.input("[name='createReqVO$totalAmount']").getValue();
     let costTypeJSON = JSON.parse(document.querySelector('#costTypeJSON').value)
+    let lastProjectId = '';
+    let lastProjectName = '';
     window.onload = function (ex) {
         let timeObject = document.querySelector('#detailList')
         let arrays = JSON.parse(timeObject.value)
@@ -172,6 +174,12 @@
             z.ui.selecttree("[name='costType[" + i + "]']").setValue(isTimes[i].costType)
             $("[name='CommonCostDetailDO[" + i + "]$costType']").val(isTimes[i].costType);
         }
+        if(!(!lastProjectId || lastProjectId.trim() === '')){
+            $("[name='CommonCostDetailDO[" + i + "]$projectId']").val(lastProjectId);
+        }
+        if(!(!lastProjectName || lastProjectName.trim() === '')){
+            z.ui.input("[name='CommonCostDetailDO[" + i + "]$projectName']").setValue(lastProjectName);
+        }
         if (!(!isTimes[i].projectId || isTimes[i].projectId.trim() === '')) {
             $("[name='CommonCostDetailDO[" + i + "]$projectId']").val(isTimes[i].projectId);
         }
@@ -221,6 +229,8 @@
                     z.ui.alertWarning(`项目不能为空!`)
                     return false;
                 }
+                lastProjectId = $("[name='CommonCostDetailDO[" + i + "]$projectId']").val();
+                lastProjectName = z.ui.input("[name='CommonCostDetailDO[" + i + "]$projectName']").getValue();
                 if(!z.ui.date("[name='CommonCostDetailDO[" + i + "]$costDate']").getValue()){
                     z.ui.alertWarning(`发生日期不能为空!`)
                     return false;