yangyj 2 лет назад
Родитель
Сommit
1c315d819d
4 измененных файлов с 31 добавлено и 18 удалено
  1. 8 6
      src/api/formula/formula.js
  2. 11 6
      src/views/formula/edit.vue
  3. 10 4
      src/views/manager/wbsinfo/edit.vue
  4. 2 2
      vue.config.js

+ 8 - 6
src/api/formula/formula.js

@@ -10,23 +10,24 @@ export const getTypeMap = (params) => {
   })
 }
 
-export const saveFormula = ({formula,remark,wbsId,elementId,scale,number,map}) => {
+export const saveFormula = ({formula,remark,nodeId,elementId,scale,number,map,scope}) => {
   return request({
     url: '/api/blade-manager/formula/save',
     method: 'post',
     data: {
       formula,
       remark,
-      wbsId,
+      nodeId,
       elementId,
       scale,
       number,
-      map
+      map,
+      scope
     }
   })
 }
 
-export const updateFormula = ({id,formula,remark,wbsId,elementId,scale,number,map}) => {
+export const updateFormula = ({id,formula,remark,nodeId,elementId,scale,number,map,scope}) => {
   return request({
     url: '/api/blade-manager/formula/update',
     method: 'post',
@@ -34,11 +35,12 @@ export const updateFormula = ({id,formula,remark,wbsId,elementId,scale,number,ma
       id,
       formula,
       remark,
-      wbsId,
+      nodeId,
       elementId,
       scale,
       number,
-      map
+      map,
+      scope
     }
   })
 }

+ 11 - 6
src/views/formula/edit.vue

@@ -360,6 +360,10 @@ export default {
       type:String,
       default:''
     },
+    globaltype:{
+      type:Number,
+      default:10
+    },
     nodeid:{
       type:String,
       default:''
@@ -485,7 +489,6 @@ export default {
       this.getProjectList();
       this.geTreeData();
       await this.getTypeMap();
-
       this.formulaStringToArray();
     },
 
@@ -1055,11 +1058,12 @@ export default {
           id:this.formulaid,
           formula:obj.text,
           remark:'',
-          wbsId:this.wbsid,
+          nodeId:this.nodeid,
           elementId:this.eleid,
           scale:this.isRetain?this.retainNum:'',
           number:number,
-          map:JSON.stringify(obj.eleMap)
+          map:JSON.stringify(obj.eleMap),
+          scope:this.globaltype
         }).then(()=>{
           this.$message({
             type: "success",
@@ -1070,11 +1074,12 @@ export default {
         saveFormula({
           formula:obj.text,
           remark:'',
-          wbsId:this.wbsid,
+          nodeId:this.nodeid,
           elementId:this.eleid,
           scale:this.isRetain?this.retainNum:'',
           number:number,
-          map:JSON.stringify(obj.eleMap)
+          map:JSON.stringify(obj.eleMap),
+          scope:this.globaltype
         }).then((res)=>{
           if(res.data.data){
             this.formulaid = res.data.data;
@@ -1090,7 +1095,7 @@ export default {
 
     //把公式文本还原数组
     async formulaStringToArray(){
-      let detail = (await formulaDetail({elementId:this.eleid})).data.data;
+      let detail = (await formulaDetail({elementId:this.eleid,scope:this.globaltype,nodeId:this.wbsid})).data.data;
       console.log(detail);
       if(detail.id){
         this.formulaid = detail.id;

+ 10 - 4
src/views/manager/wbsinfo/edit.vue

@@ -1258,9 +1258,14 @@
         >
           <template slot-scope="scope">
             <el-link
+              :type="scope.row.globalFormula == 1?'warning':'primary'"
+              @click="toFormulaEdit(scope.row,1)"
+            >全局公式</el-link>
+            <el-link
+              class="mg-l-10"
               :type="scope.row.isSaveFormula == 1?'warning':'primary'"
-              @click="toFormulaEdit(scope.row)"
-            >公式配置</el-link>
+              @click="toFormulaEdit(scope.row,10)"
+            >节点公式</el-link>
             <el-link
               class="mg-l-10"
               type="danger"
@@ -1627,7 +1632,7 @@
     </el-dialog>
 
     <el-dialog title="" :visible.sync="formulaCompVisible" fullscreen append-to-body class="full-dialog">
-      <FormulaEdit :wbsid="id" :nodeid="curTreeData.id" :eleid="formulaCurRow.id" @hideDialog="formulaCompVisible = false" v-if="formulaCompVisible"></FormulaEdit>
+      <FormulaEdit :wbsid="id" :nodeid="curTreeData.id" :eleid="formulaCurRow.id" :globaltype="formulaCurRow.globaltype" @hideDialog="formulaCompVisible = false" v-if="formulaCompVisible"></FormulaEdit>
     </el-dialog>
 
   </basic-container>
@@ -2496,7 +2501,7 @@ export default {
       }
     },
 
-    toFormulaEdit (row) {
+    toFormulaEdit (row,type) {
       // this.$router.push({
       //   path: '/formula/edit',
       //   query: {
@@ -2508,6 +2513,7 @@ export default {
       //this.editEleFormulaVisible = false;
 
       this.formulaCurRow = row;
+      this.formulaCurRow.globaltype = type;
       this.formulaCompVisible = true;
     },
 

+ 2 - 2
vue.config.js

@@ -27,8 +27,8 @@ module.exports = {
             '/api': {
                 //本地服务接口地址
                 // target: 'http://192.168.3.64',
-                target: 'http://47.110.251.215:8090',
-                // target: 'http://192.168.31.121',
+                // target: 'http://47.110.251.215:8090',
+                 target: 'http://192.168.1.179',
                 // target: 'http://192.168.0.108',
                 // target: 'http://192.168.31.96',
                 //远程演示服务地址,可用于直接启动项目