Bläddra i källkod

引入自定义对话框。

chenshilong 7 år sedan
förälder
incheckning
93d770b871

+ 2 - 2
web/building_saas/main/html/calc_program_manage.html

@@ -26,12 +26,12 @@
         </div>
     </div>
 
-    <script>
+<!--    <script>
         !function loadHintBox(){
             $("body").append('<div id = "hintBox_container"></div>');
             $("#hintBox_container").load("../../../../public/scHintBox.html");
         }();
-    </script>
+    </script>-->
 </body>
 
 

+ 7 - 0
web/building_saas/main/html/main.html

@@ -1187,6 +1187,13 @@
            // autoFlashHeight();
         </script>
 
+        <script>
+            !function loadHintBox(){
+                $("body").append('<div id = "hintBox_container"></div>');
+                $("#hintBox_container").load("../../../../public/scHintBox.html");
+            }();
+        </script>
+
         <SCRIPT type="text/javascript">
             <!--
 //            var zNodes =[

+ 9 - 8
web/building_saas/main/js/models/calc_program.js

@@ -755,7 +755,7 @@ let analyzer = {
         let expr = me.standard(dispExpr);
         let invalidChars = /[^0-9\u4e00-\u9fa5\+\-\*\/\(\)\.\[\]FL%]/g;
         if (invalidChars.test(expr)){
-            alert('表达式中含有无效的字符!');
+            hintBox.infoBox('系数提示','表达式中含有无效的字符!',1);
             return false;
         };
 
@@ -764,26 +764,26 @@ let analyzer = {
         let pattBase = new RegExp(/\[[\u4E00-\u9FA5]+\]/gi);
         let arrBase = expr.match(pattBase);
         if (arrCn && !arrBase){
-            alert('定额基数必须用中括号[]括起来!');
+            hintBox.infoBox('系统提示', '定额基数必须用中括号[]括起来!', 1);
             return false;
         };
         if (arrCn && arrBase && (arrCn.length != arrBase.length)){
             for (let cn of arrCn){
                 let tempBase = `[${cn}]`;
                   if (!arrBase.includes(tempBase)){
-                      alert(`定额基数“${cn}”必须用中括号[]括起来!`);
+                      hintBox.infoBox('系统提示', `定额基数“${cn}”必须用中括号[]括起来!`, 1);
                       return false;
                   }
             };
             // 这里要加一个保险。因为上面的 for 循环在“主材费 + [主材费]” 情况下有Bug
-            alert('定额基数必须用中括号[]括起来!');
+            hintBox.infoBox('系统提示', '定额基数必须用中括号[]括起来!', 1);
             return false;
         };
         if (arrBase){
             for (let base of arrBase){
                 let baseName = base.slice(1, -1);
                 if (!rationCalcBases[baseName]){
-                    alert('定额基数 [' + baseName + '] 末定义!');
+                    hintBox.infoBox('系统提示', '定额基数 [' + baseName + '] 末定义!', 1);
                     return false;
                 }
             };
@@ -793,14 +793,15 @@ let analyzer = {
         for (let F of arrF){
             let num = F.slice(1);
             if (num > template.calcItems.length){
-                alert('表达式中 “F'+ num +'” 行号引用错误!');
+                let s = hintBox.font('F'+num);
+                hintBox.infoBox('系统提示', `表达式中 “${s}” 行号引用错误!`, 1);
                 return false;
             };
         };
 
         let expression = me.getExpression(expr, template);
         if (me.isCycleCalc(expression, itemID, template)){
-            alert('表达式中有循环计算!');
+            hintBox.infoBox('系统提示', '表达式中有循环计算!', 1);
             return false;
         }
 
@@ -973,7 +974,7 @@ let executeObj = {
             return calcTools.marketPriceToBase(me.treeNode, baseName)
         else{
             if (!rationCalcBases[baseName]){
-                alert('定额基数“' + baseName + '”末定义,计算错误。 (模板 ' + me.template.ID + ',规则 ' + me.tempCalcItem.ID +')');
+                hintBox.infoBox('系统提示', '定额基数“' + baseName + '”末定义,计算错误。 (模板 ' + me.template.ID + ',规则 ' + me.tempCalcItem.ID +')', 1);
                 return 0;
             }
             else