فهرست منبع

Merge branch 'dev' of git.sagacloud.cn:web/ibms into dev

zhangyu 5 سال پیش
والد
کامیت
6b3f344e97

+ 10 - 8
src/components/relation/overview/CardList.vue

@@ -256,15 +256,17 @@
           // if (relation.RelManualType) {
           if (relation.RelationType) {
             this.values = {...this.values, optionTips, lastTime}
-            this.$refs.maintain.dialogManualOption = true //导出excel 弹窗
-            // this.$router.push({
-            //   path:"relationShip"
-            // })
+            // this.$refs.maintain.dialogManualOption = true //导出excel 弹窗
+            this.$router.push({
+              path:"relationShip"
+            })
             console.log(relation,'relation')
-          // localStorage.setItem('RelManualType',relation.RelManualType)
-          // localStorage.setItem('RelationTypeName',relation.RelationTypeName)
-          // localStorage.setItem('RelationType',relation.RelationType)
-          // localStorage.setItem('ZoneType',relation.ZoneType)
+          localStorage.setItem('RelManualType',relation.RelManualType)
+          localStorage.setItem('RelationTypeName',relation.RelationTypeName)
+          localStorage.setItem('RelationType',relation.RelationType)
+          localStorage.setItem('ZoneType',relation.ZoneType)
+          localStorage.setItem('MainObject',relation.MainObject)
+          localStorage.setItem('FromObject',relation.FromObject)
           } else {
             this.$message.warning("设计中")
             return false

+ 35 - 6
src/components/relation/relationShip/Modal/addRelationShip.vue

@@ -33,35 +33,39 @@
               v-for="item in optionsCode"
               :key="item.value"
               :label="item.label"
-              :value="item.value">
+              :value="item.value"
+            >
             </el-option>
           </el-select>
         </el-form-item>
         <el-row class="mb-20">
           <el-col :span="12">
             <p class="mb-20">{{values.mainObject}}
-              <span class="fw-bold color-AAA">(包括:XXXX类型,XXXX类型)限制条件</span>
+              <span class="fw-bold color-AAA">{{MainObject}}</span>
             </p>
             <el-form-item
               prop="main"
+              :error="mainError"
             >
               <el-input
                 v-model="ruleForm.main"
                 autocomplete="off"
                 :placeholder="values.pleaseEnterCode"
                 :disabled="disabled"
+
               />
             </el-form-item>
           </el-col>
           <el-col :span="12">
             <p class="mb-20">{{values.affiliatedObject}}
-              <span class="fw-bold color-AAA ">(包括:XXXX类型,XXXX类型)限制条件</span>
+              <span class="fw-bold color-AAA ">{{FromObject}}</span>
             </p>
             <el-form-item
               v-for="(item,index) in ruleForm.codeList"
               :key="index"
               :prop="`codeList.${index}.value`"
               :rules="rules.codeList"
+              :error="fromError"
             >
               <el-input
                 v-model="item.value"
@@ -107,6 +111,8 @@
 </template>
 
 <script>
+  import {relAdd} from "../../../../api/relation/api";
+
   export default {
     name: "addRelationShip",
     props: ['values'],
@@ -125,6 +131,8 @@
         callback()
       }
       return {
+        mainError:'',
+        fromError:'',
         addShipDialog: false,
         // disabled: true,
         optionsCode: [{
@@ -144,8 +152,9 @@
           label: '本地名称'
         }],
         codeValue: '',
+        MainObject: `(包括:${localStorage.getItem('MainObject')} )限制条件`,
+        FromObject: `(包括:${localStorage.getItem('FromObject')} )限制条件`,
         ruleForm: {
-          code: '',
           main: '',
           codeList: [{
             value: ''
@@ -173,8 +182,8 @@
       },
 
     },
+    watch:{},
     methods: {
-
       addCode() {
         this.ruleForm.codeList.push({
           value: '',
@@ -189,6 +198,7 @@
       },
       submitForm(formName) {
         this.$refs[formName].validate(valid => {
+          console.log(valid,'valid')
           if (valid) {
             let arr = []
             for(let item  of this.ruleForm.codeList) {
@@ -202,9 +212,28 @@
               RelType:localStorage.getItem('RelManualType'),
               Type:this.codeValue
             }
-            this.$emit('addShip',param)
             //清空添加value
+            let that = this
+            relAdd(param).then(res => {
+              if (res.data.Result === "failure") {
+                if(res.data.ErrorType == 1) {
+                  // this.mainError = res.data.Message
+                  this.$nextTick(()=>{this.mainError = res.data.Message})
+                } else if(res.data.ErrorType == 2) {
+                  this.$nextTick(()=>{this.fromError = res.data.Message})
+                } else {
+                  this.$message.error(res.data.Message);
+                }
 
+              } else if (res.data.Result === "success") {
+                this.$message.success(res.data.Message);
+                this.$emit('update')
+                that.addShipDialog = false
+                that.codeValue = ''
+                that.ruleForm.codeList = [{value:''}]
+                that.ruleForm.main = ''
+              }
+            })
 
           } else {
             console.log('error')

+ 36 - 19
src/views/relation/relationShip/index.vue

@@ -23,7 +23,7 @@
       <el-row>
         <el-col :span="12">
           <p class="border-left-8">主对象
-            <span>限制条件:对象类型的范围(包括:XXXX类型,XXXX类型)</span></p>
+            <span>{{MainObject}}</span></p>
           <label>所属建筑楼层:</label>
           <el-select disabled v-model="buildValue">
             <el-option
@@ -58,7 +58,7 @@
         </el-col>
         <el-col :span="12">
           <p class="border-left-8">从对象
-            <span>(包括:XXXX类型,XXXX类型)</span></p>
+            <span>{{FromObject}}</span></p>
           <label>所属建筑楼层:</label>
           <el-select disabled v-model="buildValue">
             <el-option
@@ -222,7 +222,7 @@
     <addRelationShip
       ref="addShipComponent"
       :values="values"
-      @addShip="addShip"
+      @update="update"
     />
     <editRelationShip
       ref="editShipComponent"
@@ -242,6 +242,8 @@
     name: "index",
     data() {
       return {
+        MainObject: `(限制条件:对象类型的范围(包括:${localStorage.getItem('MainObject')}类型)`,
+        FromObject: `(限制条件:对象类型的范围(包括:${localStorage.getItem('FromObject')}类型)`,
         pageSizes: [10, 20, 50, 100],
         pageSize: 50,
         currentPage: 1,
@@ -317,6 +319,7 @@
           }]
         }],
         tableData: [],
+
         loading: false,
         needMergeArr: ['Name', 'LocalId', 'LocalName', 'CADID','btn'],
         rowMergeArrs: {}
@@ -428,22 +431,31 @@
           console.log(res, '==object==')
         })
       },
-      addShip(index) {
-        let that = this
-        relAdd(index).then(res => {
-          if (res.data.Result === "failure") {
-            this.$message.error(res.data.Message);
-            return false
-          } else if (res.data.Result === "success") {
-            this.$message.success(res.data.Message);
-            this.init()
-            that.$refs.addShipComponent.addShipDialog = false
-            that.$refs.addShipComponent.codeValue = ''
-            that.$refs.addShipComponent.ruleForm.codeList = [{value:''}]
-            that.$refs.addShipComponent.ruleForm.main = ''
-          }
-        })
-      },
+  //     addShip(index) {
+  //       let that = this
+  //       relAdd(index).then(res => {
+  //         if (res.data.Result === "failure") {
+  //           if(res.data.ErrorType == 1) {
+  //             this.mainError = res.data.Message
+  //             debugger
+  //           } else if(res.data.ErrorType == 2) {
+  //
+  //           } else {
+  //             debugger
+  //             this.$message.error(res.data.Message);
+  //
+  //           }
+  //
+  //     } else if (res.data.Result === "success") {
+  //   this.$message.success(res.data.Message);
+  //   this.init()
+  //   that.$refs.addShipComponent.addShipDialog = false
+  //   that.$refs.addShipComponent.codeValue = ''
+  //   that.$refs.addShipComponent.ruleForm.codeList = [{value:''}]
+  //   that.$refs.addShipComponent.ruleForm.main = ''
+  // }
+  // })
+  //     },
       //分页更换size
       handleSizeChange(val) {
         this.currentPage = 1;
@@ -455,12 +467,17 @@
         this.currentPage = val;
         this.init()
       },
+      update() {
+        this.init()
+      },
       lookOver(index, row) {
+
         console.log(index, row)
 
         // this.$refs.editShipComponent.editShipDialog = true
       },
       deleteObject(index, row) {
+
         let param = {
           "FromId": row.Id,
           "RelType": localStorage.getItem('RelManualType'),