瀏覽代碼

项目特征编辑问题

zhangweicheng 5 年之前
父節點
當前提交
557d7d73a8

+ 5 - 0
web/building_saas/css/custom.css

@@ -462,4 +462,9 @@ input.text-right{
     .middle-modal-height {
     .middle-modal-height {
         height: 350px;
         height: 350px;
     }
     }
+}
+.textarea-inherit {
+  width: 100%;
+  overflow: auto;
+  word-break: break-all;
 }
 }

+ 4 - 4
web/building_saas/main/html/main.html

@@ -485,10 +485,10 @@
                                               <div class="tab-content">
                                               <div class="tab-content">
                                                   <div class="tab-pane" id="xmtz_tab" style="padding:10px">
                                                   <div class="tab-pane" id="xmtz_tab" style="padding:10px">
                                                      <input id="xmtz_billID" type="hidden">
                                                      <input id="xmtz_billID" type="hidden">
-                                                     <!-- <textarea class="form-control" name="" id="" style="width: 90% ; height:90%;"></textarea> -->
-                                                      <div class="main-data-bottom" tabindex="0"  hidefocus="true"  contenteditable="true" id="tzCharacterText" >
-                                                          项目特征 内容
-                                                      </div>
+                                                     <textarea v-model="body" :placeholder="placeholder" class="textarea-inherit" id="tzCharacterText" autoHeight="true"></textarea>
+                                                      <!-- <div class="main-data-bottom" tabindex="0"  hidefocus="true"  contenteditable="plaintext-only" id="tzCharacterText" >
+                                                          项目特征 内容  这种方式谷歌不兼容
+                                                      </div> -->
                                                   </div>
                                                   </div>
                                               </div>
                                               </div>
                                           </div>
                                           </div>

+ 12 - 5
web/building_saas/main/js/controllers/material_controller.js

@@ -223,10 +223,17 @@ let MaterialController = {
             parent = selected
             parent = selected
             $("#xmtz_billID").val(selected.data.ID);
             $("#xmtz_billID").val(selected.data.ID);
         }
         }
-        if(selected&&parent){
-            text = parent.data.itemCharacterText?parent.data.itemCharacterText.replace(/\n/g,"<br>"):"";
-            text = text.replace(/\s/g,"&nbsp;");
-        }
+        if(selected&&parent) text = parent.data.itemCharacterText;
+        
+        if(eleID != 'itemCharacterText'){
+          $("#"+eleID).val(text);
+        }else{
+          text = parent.data.itemCharacterText?parent.data.itemCharacterText.replace(/\n/g,"<br>"):"";
+          text = text.replace(/\s/g,"&nbsp;");
+          $("#"+eleID).html(text);
+        }  
+      
+
        /* if(text == "") {//为空的时候不显示
        /* if(text == "") {//为空的时候不显示
             $("#replaceM").hide();
             $("#replaceM").hide();
             $("#subSpread").removeClass("ration_glj_spread");
             $("#subSpread").removeClass("ration_glj_spread");
@@ -235,7 +242,7 @@ let MaterialController = {
         }*/
         }*/
         //$('#replaceM').css('margin-top',0);
         //$('#replaceM').css('margin-top',0);
         //this.toggleItemInit();
         //this.toggleItemInit();
-        $("#"+eleID).html(text);
+       
     },
     },
     //初始化人材机和项目特征文本两个区域的宽度,改变窗口大小时调用此方法,实时刷新
     //初始化人材机和项目特征文本两个区域的宽度,改变窗口大小时调用此方法,实时刷新
     initItemWidth: function () {
     initItemWidth: function () {

+ 2 - 0
web/building_saas/main/js/main.js

@@ -36,6 +36,7 @@ $(function () {
         projectObj.mainSpread.refresh();
         projectObj.mainSpread.refresh();
         refreshSubSpread();
         refreshSubSpread();
         $('#comments').find('textarea').height($('#comments').height() - 25);
         $('#comments').find('textarea').height($('#comments').height() - 25);
+        $("#tzCharacterText").height($("#tzSubDiv").height()-30);
     });
     });
     const projectId = scUrlUtil.GetQueryString('project');
     const projectId = scUrlUtil.GetQueryString('project');
     // 绑定点击事件
     // 绑定点击事件
@@ -80,6 +81,7 @@ function loadMainSize() {//加载造价书页面各高度
     SlideResize.loadVerticalHeight(mainResizeEles.eleObj.module, mainResizeEles.eleObj, mainResizeEles.limit, function () {
     SlideResize.loadVerticalHeight(mainResizeEles.eleObj.module, mainResizeEles.eleObj, mainResizeEles.limit, function () {
         refreshSubSpread();
         refreshSubSpread();
         zmhs_obj.refresh();
         zmhs_obj.refresh();
+        $("#tzCharacterText").height($("#tzSubDiv").height()-30);
     });
     });
 }
 }
 
 

+ 15 - 14
web/building_saas/main/js/views/sub_view.js

@@ -910,20 +910,21 @@ $('.gljSubTab ul li a').on('shown.bs.tab', function () {
 //显示格式
 //显示格式
 $('#tzCharacterText').blur(async function () {
 $('#tzCharacterText').blur(async function () {
   let billID = $("#xmtz_billID").val();
   let billID = $("#xmtz_billID").val();
-  let htmlString = $(this).html();
-  let value = htmlString.replace(/&nbsp;/g," ");
-  if(value.indexOf("<div>")!= -1){
-      let preString = value.substring(0,value.indexOf("<div>"));
-      let arrayText =[];
-      let divArray = value.match(/<div>(.*?)<\/div>/g);
-      for(let d of divArray){
-          t = d.match(/<div>(\S*)<\/div>/)[1];
-          if(t == "<br>") t="";
-          arrayText.push(t)
-      }
-      value = preString +"\n"+ arrayText.join("\n");
-  }
-  value = value.replace(/<br>/g,"\n");
+  let value = $(this).val();
+  //let htmlString = $(this).html();
+  // let value = htmlString.replace(/&nbsp;/g," ");
+  // if(value.indexOf("<div>")!= -1){
+  //     let preString = value.substring(0,value.indexOf("<div>"));
+  //     let arrayText =[];
+  //     let divArray = value.match(/<div>(.*?)<\/div>/g);
+  //     for(let d of divArray){
+  //         t = d.match(/<div>(\S*)<\/div>/)[1];
+  //         if(t == "<br>") t="";
+  //         arrayText.push(t)
+  //     }
+  //     value = preString +"\n"+ arrayText.join("\n");
+  // } 
+  // value = value.replace(/<br>/g,"\n");
 
 
   let billNode = projectObj.project.mainTree.getNodeByID(billID);
   let billNode = projectObj.project.mainTree.getNodeByID(billID);
   if(billNode && value == billNode.data.itemCharacterText) return;
   if(billNode && value == billNode.data.itemCharacterText) return;