Browse Source

编号生成

ljy121 1 year ago
parent
commit
954bb60d6d

+ 23 - 8
zjugis-business/src/main/resources/templates/FlowContract/js/apply.js

@@ -26,21 +26,36 @@
 
 
     function bindGenerateSerial(){
     function bindGenerateSerial(){
         $("#generateSerial").on("click",function(){
         $("#generateSerial").on("click",function(){
-            var genFlag = true;
             var serial = $("[name='contract$contractNumber'] input").val();
             var serial = $("[name='contract$contractNumber'] input").val();
+            var projectTypeCode = $("[name=projectTypeCode]").val();
+            var xzqh = $("[name=xzqh]").val();
+            var params = {"projectType": projectTypeCode,"xzqh": xzqh};
+            var postdata = {"name": '合同编号',"params": params}
             if(serial) {
             if(serial) {
                 z.ui.confirm("confirm").init({
                 z.ui.confirm("confirm").init({
                     content: '已有编号[' +serial + '],重新生成会覆盖原有编号,是否继续?',
                     content: '已有编号[' +serial + '],重新生成会覆盖原有编号,是否继续?',
+                    onConfirm: function() {
+                        z.ui.ajax({
+                            type: "post",
+                            contentType: "application/json",
+                            url: "/common/generate-serial-number",
+                            data: JSON.stringify(postdata),
+                            success: function (res) {
+                                if(res && res.code === 0){
+                                    $("[name='contract$contractNumber'] input").val(res.data)
+                                } else {
+                                    z.ui.alertWarning(res.msg);
+                                }
+                            },
+                            error: function (res) {
+                            }
+                        })
+                    },
                     onCancel: function () {
                     onCancel: function () {
-                        genFlag = false;
+
                     }
                     }
                 })
                 })
-            }
-            var projectTypeCode = $("[name=projectTypeCode]").val();
-            var xzqh = $("[name=xzqh]").val();
-            var params = {"projectType": projectTypeCode,"xzqh": xzqh};
-            var postdata = {"name": '合同编号',"params": params}
-            if(genFlag){
+            } else {
                 z.ui.ajax({
                 z.ui.ajax({
                     type: "post",
                     type: "post",
                     contentType: "application/json",
                     contentType: "application/json",

+ 19 - 6
zjugis-business/src/main/resources/templates/FlowContractInvoice/js/apply.js

@@ -69,19 +69,32 @@
 
 
     function bindGenerateSerial(){
     function bindGenerateSerial(){
         $("#generateSerial").on("click",function(){
         $("#generateSerial").on("click",function(){
-            var genFlag = true;
             var serial = $("[name='contractInvoice$invoiceNumber'] input").val();
             var serial = $("[name='contractInvoice$invoiceNumber'] input").val();
+            var postdata = {"name": '开票单号'};
             if(serial) {
             if(serial) {
                 z.ui.confirm("confirm").init({
                 z.ui.confirm("confirm").init({
                     content: '已有编号[' +serial + '],重新生成会覆盖原有编号,是否继续?',
                     content: '已有编号[' +serial + '],重新生成会覆盖原有编号,是否继续?',
+                    onConfirm: function() {
+                        z.ui.ajax({
+                            type: "post",
+                            contentType: "application/json",
+                            url: "/common/generate-serial-number",
+                            data: JSON.stringify(postdata),
+                            success: function (res) {
+                                if(res && res.code === 0){
+                                    $("[name='contractInvoice$invoiceNumber'] input").val(res.data)
+                                } else {
+                                    z.ui.alertWarning(res.msg);
+                                }
+                            },
+                            error: function () {
+                            }
+                        })
+                    },
                     onCancel: function () {
                     onCancel: function () {
-                        genFlag = false;
                     }
                     }
                 })
                 })
-            }
-
-            var postdata = {"name": '开票单号'}
-            if(genFlag){
+            } else {
                 z.ui.ajax({
                 z.ui.ajax({
                     type: "post",
                     type: "post",
                     contentType: "application/json",
                     contentType: "application/json",

+ 15 - 23
zjugis-business/src/main/resources/templates/FlowContractSub/js/outsourcingApply.js

@@ -20,17 +20,14 @@
 
 
     function bindGenerateSerial(){
     function bindGenerateSerial(){
         $("#generateSerial").on("click",function(){
         $("#generateSerial").on("click",function(){
-            var genFlag = true;
             var serial = $("[name='contractSub$contractNumber'] input").val();
             var serial = $("[name='contractSub$contractNumber'] input").val();
+            var postdata = {"name": '外包合同编号'}
             if(serial) {
             if(serial) {
                 z.ui.confirm("confirm").init({
                 z.ui.confirm("confirm").init({
                     content: '已有编号[' +serial + '],重新生成会覆盖原有编号,是否继续?',
                     content: '已有编号[' +serial + '],重新生成会覆盖原有编号,是否继续?',
                     onCancel: function () {
                     onCancel: function () {
-                        genFlag = false;
                     },
                     },
                     onConfirm: function () {
                     onConfirm: function () {
-                        var postdata = {"name": '外包合同编号'}
-                        if(genFlag){
                             z.ui.ajax({
                             z.ui.ajax({
                                 type: "post",
                                 type: "post",
                                 contentType: "application/json",
                                 contentType: "application/json",
@@ -46,29 +43,24 @@
                                 error: function () {
                                 error: function () {
                                 }
                                 }
                             })
                             })
-                        }
                     }
                     }
                 })
                 })
             }else{
             }else{
-                var params = {"projectType": 'WB',"xzqh": ''};
-                var postdata = {"name": '外包合同编号',"params": params}
-                if(genFlag){
-                    z.ui.ajax({
-                        type: "post",
-                        contentType: "application/json",
-                        url: "/common/generate-serial-number",
-                        data: JSON.stringify(postdata),
-                        success: function (res) {
-                            if(res && res.code === 0){
-                                $("[name='contractSub$contractNumber'] input").val(res.data)
-                            } else {
-                                z.ui.alertWarning(res.msg);
-                            }
-                        },
-                        error: function () {
+                z.ui.ajax({
+                    type: "post",
+                    contentType: "application/json",
+                    url: "/common/generate-serial-number",
+                    data: JSON.stringify(postdata),
+                    success: function (res) {
+                        if(res && res.code === 0){
+                            $("[name='contractSub$contractNumber'] input").val(res.data)
+                        } else {
+                            z.ui.alertWarning(res.msg);
                         }
                         }
-                    })
-                }
+                    },
+                    error: function () {
+                    }
+                })
             }
             }
 
 
         })
         })

+ 29 - 37
zjugis-business/src/main/resources/templates/FlowContractSub/js/subcontractApply.js

@@ -20,55 +20,47 @@
 
 
     function bindGenerateSerial(){
     function bindGenerateSerial(){
         $("#generateSerial").on("click",function(){
         $("#generateSerial").on("click",function(){
-            var genFlag = true;
             var serial = $("[name='contractSub$contractNumber'] input").val();
             var serial = $("[name='contractSub$contractNumber'] input").val();
+            var postdata = {"name": '分包合同编号'}
             if(serial) {
             if(serial) {
                 z.ui.confirm("confirm").init({
                 z.ui.confirm("confirm").init({
                     content: '已有编号[' +serial + '],重新生成会覆盖原有编号,是否继续?',
                     content: '已有编号[' +serial + '],重新生成会覆盖原有编号,是否继续?',
                     onCancel: function () {
                     onCancel: function () {
-                        genFlag = false;
                     },
                     },
                     onConfirm: function () {
                     onConfirm: function () {
-                        var postdata = {"name": '分包合同编号'}
-                        if(genFlag){
-                            z.ui.ajax({
-                                type: "post",
-                                contentType: "application/json",
-                                url: "/common/generate-serial-number",
-                                data: JSON.stringify(postdata),
-                                success: function (res) {
-                                    if(res && res.code === 0){
-                                        $("[name='contractSub$contractNumber'] input").val(res.data)
-                                    } else {
-                                        z.ui.alertWarning(res.msg);
-                                    }
-                                },
-                                error: function () {
+                        z.ui.ajax({
+                            type: "post",
+                            contentType: "application/json",
+                            url: "/common/generate-serial-number",
+                            data: JSON.stringify(postdata),
+                            success: function (res) {
+                                if(res && res.code === 0){
+                                    $("[name='contractSub$contractNumber'] input").val(res.data)
+                                } else {
+                                    z.ui.alertWarning(res.msg);
                                 }
                                 }
-                            })
-                        }
+                            },
+                            error: function () {
+                            }
+                        })
                     }
                     }
                 })
                 })
             }else{
             }else{
-                var params = {"projectType": 'FB',"xzqh": ''};
-                var postdata = {"name": '分包合同编号',"params": params}
-                if(genFlag){
-                    z.ui.ajax({
-                        type: "post",
-                        contentType: "application/json",
-                        url: "/common/generate-serial-number",
-                        data: JSON.stringify(postdata),
-                        success: function (res) {
-                            if(res && res.code === 0){
-                                $("[name='contractSub$contractNumber'] input").val(res.data)
-                            } else {
-                                z.ui.alertWarning(res.msg);
-                            }
-                        },
-                        error: function () {
+                z.ui.ajax({
+                    type: "post",
+                    contentType: "application/json",
+                    url: "/common/generate-serial-number",
+                    data: JSON.stringify(postdata),
+                    success: function (res) {
+                        if(res && res.code === 0){
+                            $("[name='contractSub$contractNumber'] input").val(res.data)
+                        } else {
+                            z.ui.alertWarning(res.msg);
                         }
                         }
-                    })
-                }
+                    },
+                    error: function () {
+                    }
+                })
             }
             }
 
 
         })
         })

+ 20 - 5
zjugis-business/src/main/resources/templates/FlowProject/js/apply.js

@@ -33,19 +33,34 @@
            z.ui.alertWarning("请选择责任部门!");
            z.ui.alertWarning("请选择责任部门!");
            return;
            return;
          }
          }
-         var genFlag = true;
          var xmbh = $("[name='project$xmbh'] input").val();
          var xmbh = $("[name='project$xmbh'] input").val();
+         var postdata = {"name": '立项项目编号',
+          "deptId": zrbmId}
          if(xmbh) {
          if(xmbh) {
            z.ui.confirm("confirm").init({
            z.ui.confirm("confirm").init({
              content: '已有编号[' +xmbh + '],重新生成会覆盖原有编号,是否继续?',
              content: '已有编号[' +xmbh + '],重新生成会覆盖原有编号,是否继续?',
+             onConfirm: function() {
+               z.ui.ajax({
+                 type: "post",
+                 contentType: "application/json",
+                 url: "/common/generate-serial-number",
+                 data: JSON.stringify(postdata),
+                 success: function (res) {
+                   if(res && res.code === 0){
+                     $("[name='project$xmbh'] input").val(res.data)
+                   } else {
+                     z.ui.alertWarning(res.msg);
+                   }
+                 },
+                 error: function () {
+                 }
+               })
+             },
              onCancel: function () {
              onCancel: function () {
                genFlag = false;
                genFlag = false;
              }
              }
            })
            })
-         }
-        var postdata = {"name": '立项项目编号',
-            "deptId": zrbmId}
-         if(genFlag){
+         } else {
            z.ui.ajax({
            z.ui.ajax({
              type: "post",
              type: "post",
              contentType: "application/json",
              contentType: "application/json",