Browse Source

项目特征可编辑

zhangweicheng 5 năm trước cách đây
mục cha
commit
d342dbbab6

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

@@ -483,8 +483,10 @@
                                           <div class="resize-x main-data-bottom ovf-hidden" id="tzrgResize" style="display: none"></div>
                                           <div class="item_spread main-data-bottom ovf-hidden " id="tzSubDiv" style="width: 99%;">
                                               <div class="tab-content">
-                                                  <div class="tab-pane" id="xmtz_tab" style="margin-top:-2px">
-                                                      <div class="main-data-bottom" id="tzCharacterText" >
+                                                  <div class="tab-pane" id="xmtz_tab" style="padding:10px">
+                                                     <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>
                                                   </div>

+ 2 - 2
web/building_saas/main/js/controllers/material_controller.js

@@ -221,11 +221,11 @@ let MaterialController = {
         let parent = selected.parent;
         if(eleID != 'itemCharacterText'){//如果是清单精灵里显示的,parent就是本身
             parent = selected
+            $("#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(text == "") {//为空的时候不显示
             $("#replaceM").hide();

+ 37 - 17
web/building_saas/main/js/views/sub_view.js

@@ -138,8 +138,10 @@ let subObj = {
         this.initItemWidth();
     },
     //初始化清单精灵和项目特征文本两个区域的宽度,改变窗口大小时调用此方法,实时刷新
-    initTZItemWidth:function (eleID){
-        let tabID = eleID == "linkQDZY"?"qdzy":"qdjl";
+    initTZItemWidth:function (){
+        let tabID = "";
+        if($('#qdzy').is(':visible')) tabID = "qdzy";
+        if($('#qdjl').is(':visible')) tabID = "qdjl";
         //总宽度
         let totalWidth = $('#subItems').width();
         //人材机和项目特征文本比例
@@ -181,18 +183,17 @@ let subObj = {
         };
         return jl_sideResizeEles;
     },
-    initQDSubTab:function (eleID) {
-        if(!($('#'+eleID).hasClass('active'))){
-            return;
-        }
-        if(this.showQDSubTab == true){
-            $("#tzSubDiv").show();
-            $("#tzrgResize").show();
-        } else {
-            $("#tzSubDiv").hide();
-            $("#tzrgResize").hide();
-        }
-        this.initTZItemWidth(eleID);
+    initQDSubTab:function () {
+   
+      if(!($('#linkQDJL').hasClass('active') || $('#linkQDZY').hasClass('active')))   return;
+      if(this.showQDSubTab == true){
+          $("#tzSubDiv").show();
+          $("#tzrgResize").show();
+      } else {
+          $("#tzSubDiv").hide();
+          $("#tzrgResize").hide();
+      }
+      this.initTZItemWidth();
     },
     showGljSubTabData:function () {
         this.initGljSubTab();
@@ -205,8 +206,8 @@ let subObj = {
             this.firstOpen = false;
         }
     },
-    showQDSubTabData:function (eleID) {
-        this.initQDSubTab(eleID);
+    showQDSubTabData:function () {
+        this.initQDSubTab();
         MaterialController.showItemCharacterText(null,"tzCharacterText");
         if (gljOprObj.activeTab !== gljOprObj.preActiveTab) {   //提供焦点变换性能 2019年4月12日
             refreshSubSpread();
@@ -803,7 +804,7 @@ $('#linkGLJ').on('shown.bs.tab', function () {
 });
 
 $('.linkQDJL').on('shown.bs.tab', function () {
-    subObj.showQDSubTabData(this.id);
+    subObj.showQDSubTabData();
     if(!subObj.inited) {
         $("#tz_toogle").click();
         subObj.inited = true;
@@ -906,6 +907,25 @@ $('.gljSubTab ul li a').on('shown.bs.tab', function () {
     zmhs_obj.showDatas();
 });
 
+//显示格式
+$('#tzCharacterText').blur(async function () {
+  let billID = $("#xmtz_billID").val();
+  let htmlString = $(this).html();
+  let value = htmlString.replace(/<br>/g,"\n");
+  value = value.replace(/&nbsp;/g," ");
+  let billNode = projectObj.project.mainTree.getNodeByID(billID);
+  if(billNode && value == billNode.data.itemCharacterText) return;
+  let datas = [{
+    type:'bills',
+    data:{
+        ID:billID,
+        itemCharacterText:value
+    }
+  }]
+  await projectObj.project.syncUpdateNodesAndRefresh(datas);
+
+});
+
 function closeTab(elem) {
     setTimeout(function () {
         $(elem).removeClass("show");