Quellcode durchsuchen

合同变更-主委托方禁止删除, 项目登记-界面微调,项目变更-禁止删除朱委托方

user4 vor 5 Jahren
Ursprung
Commit
298bbf9b97

+ 46 - 9
src/main/webapp/webpage/modules/projectrecord/projectRecordsAlterForm.jsp

@@ -6,14 +6,20 @@
     <meta name="decorator" content="default"/>
     <script type="text/javascript" src="${ctxStatic}/helloweba_editable-select/jquery.editable-select.min.js"></script>
     <link rel='stylesheet' type="text/css" href="${ctxStatic}/helloweba_editable-select/jquery.editable-select.min.css"/>
+    <style>
+        td input{
+            margin-left:-10px !important;
+            height: 42px !important;
+        }
+    </style>
     <script type="text/javascript">
         var validateForm;
         function doSubmit(i){//回调函数,在编辑和保存动作时,供openDialog调用提交表单。
             if(validateForm.form()){
-                if($(".trIdAdds").length==0){
-                    top.layer.alert('请至少上传一个项目计划表或者实施方案文档!', {icon: 0});
-                    return;
-                }
+                // if($(".trIdAdds").length==0){
+                //     top.layer.alert('请至少上传一个项目计划表或者实施方案文档!', {icon: 0});
+                //     return;
+                // }
                 if($("#workClientLinkmanList tr").length==0){
                     top.layer.alert('请至少选择一个委托方联系人!', {icon: 0});
                     return;
@@ -64,6 +70,13 @@
                 $("#div1").hide();
                 $("#div3").hide();
                 $("#ext1").iCheck("check");
+                //无合同,将第一个委托方设置为主委托方
+                setTimeout(function () {
+                    const ClientName = $("#workClientLinkmanList").find("tr").eq(0).find("td").eq(1).children("input").val().trim();
+                    $("#contractClientName").val(ClientName);
+                    const clientId = $("#workClientLinkmanList").find("tr").eq(0).find("td").eq(0).children("input").val().trim();
+                    $("#contractClientId").val(clientId);
+                },100);
             } else {
                 $("#ext").iCheck("check");
             }
@@ -107,6 +120,8 @@
                     $("#linkmanId").val(data.workClinetInfoIds);
 
                     var newClientId  = data.client.id;
+                    // console.log("old::"+clientId);
+                    // console.log("new::"+newClientId);
                     if (clientId != newClientId){
                         $("#workClientLinkmanList tr").remove();
                         setLinkMan(newClientId);
@@ -141,13 +156,30 @@
         }
 
         function setValuee(obj){
-            for(var i=0;i<obj.length;i++){
-                var idArr = $("#workClientLinkmanList tr:visible .clientId");
-                if(obj[i].id!=''&&!hasInArr(obj[i].id,idArr)){
-                    addRow("#workClientLinkmanList",workClientLinkmanRowIdx,workClientLinkmanTpl,obj[i]);
-                    workClientLinkmanRowIdx=workClientLinkmanRowIdx+1;
+            var successRows = 0;
+            ss= $("#workClientLinkmanList tr").length;
+            for (var i = 0; i < obj.length; i++) {
+                //没有重复的客户id,就可以插入
+                var canInsert = true;
+                for (var j = 0; j < ss; j++) {
+                    var cid = $("#workClientLinkmanList" + j + "_id").val();
+                    if(cid === obj[i].id){
+                        canInsert = false;
+                        // console.log("重复!!");
+                        break;
+                    }
+                }
+                if(canInsert===true){
+                    var idArr = $("#workClientLinkmanList tr:visible .clientId");
+                    if (obj[i].id !== '' && !hasInArr(obj[i].id, idArr)) {
+                        addRow("#workClientLinkmanList", workClientLinkmanRowIdx, workClientLinkmanTpl, obj[i]);
+                        workClientLinkmanRowIdx = workClientLinkmanRowIdx + 1;
+                        successRows++;
+                    }
                 }
             }
+            // console.log("success==="+successRows);
+            // console.log("clientCount==="+clientCount);
         }
         function hasInArr(id,idArr) {
             for(var i=0;i<idArr.length;i++){
@@ -215,6 +247,11 @@
         function delRow(obj, prefix){
             var id = $(prefix+"_id");
             var delFlag = $(prefix+"_delFlag");
+            const clientId = $("#contractClientId").val();
+            if(id.val() === clientId){
+                parent.layer.msg('主委托方不允许删除',{icon:5});
+                return;
+            }
             $(obj).parent().parent().remove();
         }
 

+ 7 - 3
src/main/webapp/webpage/modules/projectrecord/projectRecordsForm.jsp

@@ -15,6 +15,10 @@
         .layui-layer-dialog{
             background: red;
         }
+        td input{
+            margin-left:-10px !important;
+            height: 42px !important;
+        }
     </style>
     <script type="text/javascript">
         var validateForm;
@@ -156,15 +160,15 @@
         }
         function setValuee(obj){
             var successRows = 0;
-            clientCount = $("#workClientInfoList tr").length+clientCount;
+            ss = $("#workClientLinkmanList tr").length;
             for (var i = 0; i < obj.length; i++) {
                 //没有重复的客户id,就可以插入
                 var canInsert = true;
-                for (var j = 0; j < clientCount; j++) {
+                for (var j = 0; j < ss; j++) {
                     var cid = $("#workClientLinkmanList" + j + "_id").val();
                     if(cid == obj[i].id){
                         canInsert = false;
-                        console.log("重复!!");
+                        // console.log("重复!!");
                         break;
                     }
                 }

+ 39 - 16
src/main/webapp/webpage/modules/workcontractinfo/workContractInfoAlterForm.jsp

@@ -135,7 +135,7 @@
             var clientId = $("#clientId").val();
             console.log(id.val()+"-----------"+clientId);
             if(id.val() == clientId){
-                parent.layer.msg('主委托方不允许删除');
+                parent.layer.msg('主委托方不允许删除',{icon:5});
                 return;
 			}
             if (id.val() == "") {
@@ -313,8 +313,8 @@
                         $("#clientId").val(d.id);
                         $("#clientName").val(d.name);
                         addRow('#workClientInfoList', workClientInfoListRowIdx, workClientInfoListTpl);workClientInfoListRowIdx = workClientInfoListRowIdx + 1;
-                        console.log("---------"+data.companyType+"---------"+data.companyIndustry+"---------"+data.areaName);
-                        console.log("---------"+workClientInfoListRowIdx+"---------"+workClientInfoListTpl);
+                        // console.log("---------"+data.companyType+"---------"+data.companyIndustry+"---------"+data.areaName);
+                        // console.log("---------"+workClientInfoListRowIdx+"---------"+workClientInfoListTpl);
                         var row = workClientInfoListRowIdx - 1 ;
                         $("#"+"workClientInfoList"+row+"_id").val(d.id);
                         $("#"+"workClientInfoList"+row+"_name").val(d.name);
@@ -353,8 +353,8 @@
                             return false;
                         }
                         addRow('#workClientInfoList', workClientInfoListRowIdx, workClientInfoListTpl);workClientInfoListRowIdx = workClientInfoListRowIdx + 1;
-                        console.log("---------"+data.companyType+"---------"+data.companyIndustry+"---------"+data.areaName);
-                        console.log("---------"+workClientInfoListRowIdx+"---------"+workClientInfoListTpl);
+                        // console.log("---------"+data.companyType+"---------"+data.companyIndustry+"---------"+data.areaName);
+                        // console.log("---------"+workClientInfoListRowIdx+"---------"+workClientInfoListTpl);
                         var row = workClientInfoListRowIdx - 1 ;
                         $("#"+"workClientInfoList"+row+"_id").val(d.id);
                         $("#"+"workClientInfoList"+row+"_name").val(d.name);
@@ -394,8 +394,8 @@
                     var size = $("#workClientInfoList tr").length+count;
                     if(size == 0){
                         addRow('#workClientInfoList', workClientInfoListRowIdx, workClientInfoListTpl);workClientInfoListRowIdx = workClientInfoListRowIdx + 1;
-                        console.log("---------"+data.companyType+"---------"+data.companyIndustry+"---------"+data.areaName);
-                        console.log("---------"+workClientInfoListRowIdx+"---------"+workClientInfoListTpl);
+                        // console.log("---------"+data.companyType+"---------"+data.companyIndustry+"---------"+data.areaName);
+                        // console.log("---------"+workClientInfoListRowIdx+"---------"+workClientInfoListTpl);
                         var row = workClientInfoListRowIdx - 1 ;
                         $("#"+"workClientInfoList"+row+"_id").val(d.id);
                         $("#"+"workClientInfoList"+row+"_name").val(d.name);
@@ -419,8 +419,8 @@
                         if(num == 'alone'){
                             addRow('#workClientInfoList', workClientInfoListRowIdx, workClientInfoListTpl);
                             workClientInfoListRowIdx = workClientInfoListRowIdx + 1;
-                            console.log("---------" + data.companyType + "---------" + data.companyIndustry + "---------" + data.areaName);
-                            console.log("---------" + workClientInfoListRowIdx + "---------" + workClientInfoListTpl);
+                            // console.log("---------" + data.companyType + "---------" + data.companyIndustry + "---------" + data.areaName);
+                            // console.log("---------" + workClientInfoListRowIdx + "---------" + workClientInfoListTpl);
                             var row = workClientInfoListRowIdx - 1;
                             $("#" + "workClientInfoList" + row + "_id").val(d.id);
                             $("#" + "workClientInfoList" + row + "_name").val(d.name);
@@ -767,14 +767,37 @@
                     </c:if>
                     </tbody>
                 </table>
+                <script type="text/template" id="workClientInfoListTpl">//<!--
+                    <tr id="workClientInfoList{{idx}}">
+                        <td class="hide">
+                            <input id="workClientInfoList{{idx}}_id" name="workClientInfoList[{{idx}}].id" type="hidden" value="{{row.id}}" class="clientInfoId"/>
+                            <input id="workClientInfoList{{idx}}_delFlag" name="workClientInfoList[{{idx}}].delFlag" type="hidden" value="0"/>
+                        </td>
+                        <td>
+                            <input id="workClientInfoList{{idx}}_name" name="workClientInfoList[{{idx}}].name" type="text" value="{{row.name}}"  readonly="true"  class="form-control required"/>
+                         </td>
+                         <td>
+                            <input id="workClientInfoList{{idx}}_companyType" name="workClientInfoList[{{idx}}].companyType" type="text" value="{{row.companyType}}" readonly="true"   class="form-control required"/>
+                         </td>
+                        <td>
+                            <input id="workClientInfoList{{idx}}_companyIndustry"  name="workClientInfoList[{{idx}}].companyIndustry" type="text" value="{{row.companyIndustry}}"  readonly="true"  class="form-control required"/>
+                        </td>
+                        <td>
+                            <input id="workClientInfoList{{idx}}_area" name="workClientInfoList[{{idx}}].area.name" type="text" value="{{row.area.name}}"  readonly="true"   class="form-control required"/>
+                        </td>
+                        <td class="text-center op-td" id="workClientInfoList{{idx}}_td">
+                            {{#delBtn}}<span class="op-btn op-btn-delete" onclick="delRow(this, '#workClientInfoList{{idx}}')" title="删除"><i class="glyphicon glyphicon-remove"></i>&nbsp;删除</span>{{/delBtn}}
+                        </td>
+                    </tr>//-->
+                </script>
+                <script type="text/javascript">
+                    var workClientInfoListRowIdx = 0,
+                        workClientInfoListTpl = $("#workClientInfoListTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g, "");
+                    if ($("#id").val() || $("#aId").val()) {
+                        workClientInfoListRowIdx = ${fn:length(workContractInfo.workClientInfoList)};
+                    }
 
-					<script type="text/javascript">
-                        var workClientInfoListRowIdx = 0, workClientInfoListTpl = $("#workClientInfoListTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
-                        if($("#id").val()||$("#aId").val()){
-                            workClientInfoListRowIdx = ${fn:length(workContractInfo.workClientInfoList)};
-                        }
-
-					</script>
+                </script>
 
 				</div>
         </div>