zhangweicheng 6 лет назад
Родитель
Сommit
1de6cdcfab

+ 11 - 0
modules/pm/controllers/pm_controller.js

@@ -646,4 +646,15 @@ module.exports = {
             callback(req, res, 1, err, null);
         }
     },
+    changeFile:async function(req,res){
+        try{
+            let data = JSON.parse(req.body.data);
+            console.log(data);
+           // let summaryInfo = await pm_facade.getSummaryInfo(data.projectIDs);
+            callback(req, res, 0, 'success', []);
+        }
+        catch (err){
+            callback(req, res, 1, err, null);
+        }
+    }
 };

+ 5 - 0
modules/pm/facade/pm_facade.js

@@ -59,6 +59,7 @@ module.exports={
     isShare: isShare,
     getShareInfo: getShareInfo,
     prepareInitialData: prepareInitialData,
+    changeFile:changeFile
 };
 
 //拷贝例题项目
@@ -961,3 +962,7 @@ async function copyCompleGljSection(userId, compilationId) {
         await compleGljSectionModel.insertMany(insertDatas);
     }
 }
+
+async function changeFile(datas,from,type){//from:feeRate或单价文件,type从单前建设项目还是从其它建设项目中复制
+
+}

+ 1 - 0
modules/pm/routes/pm_route.js

@@ -60,6 +60,7 @@ module.exports = function (app) {
     pmRouter.post('/getProjectShareInfo', pmController.projectShareInfo);
     pmRouter.post('/share', pmController.share);
     pmRouter.post('/receiveProjects', pmController.receiveProjects);
+    pmRouter.post('/changeFile', pmController.changeFile);
 
     app.use('/pm/api', pmRouter);
 };

+ 1 - 0
web/building_saas/main/js/views/project_glj_view.js

@@ -1234,6 +1234,7 @@ $(function () {
             changeUnitPriceId = $("#self-file").val();
             if(!changeUnitPriceId){
                 alert('单价文件不可为空');
+                return;
             }
             submitFileChange(changeUnitPriceId,type);
         } else {

+ 1 - 2
web/building_saas/pm/html/project-management.html

@@ -671,7 +671,7 @@
                                 <select class="form-control" id="otherFileOptions">
                                     <option>10.9建筑例题内测单价文件</option><!--建设项目下单价文件-->
                                 </select>
-                                <span class="form-text text-muted">你选择的单价文件将复制一份至新项目,不会影响原建设项目的单价文件。</span>
+                                <span class="form-text text-muted">你选择的文件将复制一份至新项目,不会影响原建设项目的文件。</span>
                             </div>
                         </div>
 
@@ -901,6 +901,5 @@
     let engineeringList = '<%- engineeringList %>';
     let compilationData = '<%- compilationData %>';
     compilationData = JSON.parse(compilationData.replace(/[\s\r\n]/g, ""));//去掉空格字符
-    document.styleSheets[0].insertRule('body {background-color: red}, 0');
 </script>
 </html>

+ 21 - 4
web/building_saas/pm/js/pm_newMain.js

@@ -1226,18 +1226,35 @@ const projTreeObj = {
             }
         }
     },
-    confirmFileChange : function(){
-        let selectProjects =[];
+    confirmFileChange :async function(){
+        let selectProjects =[],fileID=null,from = $("#mr_from").val();
         for(let i of this.replaceTree.items){
             if(i.data.selected === 1) selectProjects.push(i)
         }
-        console.log(selectProjects);
         if(selectProjects.length > 0){
+            let type = parseInt($("input[name='select_from']:checked").val());//0 从当前建设项目,1从其它建设项目中复制
+            if(type == 0){
+                fileID = $("#currentOptions").val();
+            }else {
+                fileID = $("#otherFileOptions").val();
+            }
+            if(fileID == null || fileID == undefined|| fileID ==""){
+                alert("请选择替换文件")
+            }
+            await projTreeObj.postChangeFile({projects:selectProjects,fileID:fileID,type:type,from:from});
 
-        }
 
 
+        }
     },
+    postChangeFile:async function(data){
+       let result = await ajaxPost("/pm/api/changeFile",data);
+        console.log(result);
+    },
+    checkFileName:async function (fileID,name,type) {
+        let node = this.tree.selected;
+    },
+
     insert: function (data, parent, next) {
         let preNode = this.tree.items[this.preSelection.row];
         let node = this.tree.addNodeData(data, parent, next);