Browse Source

解决冲突

haojianlong 5 years ago
parent
commit
6d9bedfcc3

+ 2 - 2
config/index.js

@@ -132,7 +132,7 @@ module.exports = {
         },
         '/pointconfig': {
             // 目标 API 地址
-            target: 'http://192.168.20.235:8080/',
+            target: 'http://192.168.20.236:8080/',
             // 如果要代理 websockets
             ws: true,
             // 将主机标头的原点更改为目标URL
@@ -156,7 +156,7 @@ module.exports = {
         },
         '/ScanBuilding': {
             // 目标 API 地址
-            target: 'http://192.168.20.235:8080/',
+            target: 'http://192.168.20.236:8080/',
             // 如果要代理 websockets
             ws: true,
             // 将主机标头的原点更改为目标URL

+ 23 - 0
src/api/relation/api.js

@@ -134,3 +134,26 @@ export function dictUpdate(param, success) {
   let url = '/api/equip-component/dict-custom/update'
   httpUtil.postJson(url, param, success)
 }
+
+// 查询关系数据
+export function relQuery(param,success) {
+  let url = '/api/datacenter/relation-manual-calc/rel-query'
+  httpUtil.postJson(url,param,success)
+}
+//添加关系数据
+export function relAdd(data) {
+  let userName = storage.get("user_name")
+  let ProjectId = localStorage.getItem("projectId")
+  return fetch({
+    method: 'POST',
+    url: `/api/datacenter/relation-manual-calc/rel-add`,
+    data,
+    headers: {'ProjectId': ProjectId, 'Comming': 'adm', 'Account': userName}
+  })
+}
+
+//删除关系
+export function relDelete(param, success) {
+  let url = '/api/datacenter/relation-manual-calc/rel-del'
+  httpUtil.postJson(url, param, success)
+}

+ 24 - 0
src/api/scan/request.js

@@ -2015,3 +2015,27 @@ export function handleZoneUpdateBd(param,success) {
   let url = `${baseUrl}/datacenter/object/zone/update-fl-bd`
   http.postJson(url,param,success)
 }
+
+
+//创建建筑信息
+export function objectCreateBuild(param, success) {
+  let url = `${baseUrl}/datacenter/object/building/create`
+  http.postJson(url, param, success)
+}
+
+//更新建筑信息
+export function objectUpdateBuild(param, success) {
+  let url = `${baseUrl}/datacenter/object/building/update`
+  http.postJson(url, param, success)
+}
+//查询建筑信息
+export function objectQueryBuild(param, success) {
+  let url = `${baseUrl}/datacenter/object/building/query`
+  http.postJson(url, param, success)
+}
+//根据id删除建筑信息
+export function objectDeleteBuild(param, success) {
+  let url = `${baseUrl}/datacenter/object/building/delete`
+  http.postJson(url, param, success)
+}
+

+ 6 - 15
src/components/business_space/business/handsontable.vue

@@ -433,27 +433,18 @@
       if (params.length < 1 || this.main > this.copyMain) {
         return
       }
-      // let param = {
-      //   data: [],
-      //   zone: this.zoneCode
-      // }
-      // params.map(item => {
-      //
-      //   if (item.RoomID)
-      //     param.data.push({ RoomID: item.RoomID })
-      //
-      // })
+      let param = []
+      params.map(item => {
+        if (item.RoomID)
+        param.push({ RoomID: item.RoomID })
+      })
       params.map(i => i.ObjectType = this.zoneParam.ZoneType ? this.zoneParam.ZoneType : i.ObjectType);
       this.$confirm("此操作将删除业务空间,是否继续?", "提示", {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         type: 'warning'
       }).then(() => {
-        // deleteZone(params, res => {
-        //   this.$message.success("删除成功!")
-        //   this.getData()
-        // })
-        handleZoneDelete(params, res => {
+        handleZoneDelete(param, res => {
           this.$message.success("删除成功!")
           this.getData()
         })

+ 3 - 6
src/components/business_space/dialogs/detailsDialog.vue

@@ -45,7 +45,7 @@
 </template>
 
 <script>
-    import { deleteZone } from "@/api/scan/request";
+    import { zoneCreate } from "@/api/scan/request";
     import equipTable from "@/components/business_space/table/equipTable";
     import addEquip from "@/components/business_space/table/addEquip";
     import {
@@ -151,11 +151,8 @@
                         type: "warning"
                     })
                     .then(() => {
-                        let param = {
-                            zone: this.activeTabType.code,
-                            data: [{RoomID: this.list.id}]
-                        }
-                        deleteZone(param, res => {
+                        let param = [{RoomID: this.list.id}];
+                        zoneCreate(param, res => {
                             if (res.Result == 'success') {
                                 this.$message({ type: "success",  message: "删除成功!" })
                                 this.$emit("del")

+ 2 - 2
src/components/business_space/dialogs/list/filesDialog.vue

@@ -57,9 +57,9 @@
       changeItem(file) {
         console.log(file)
         this.$emit("changeFile", file)
-      }
+      },
     },
   };
 </script>
 <style>
-</style>
+</style>

+ 23 - 7
src/components/business_space/lib/uploadFiles.vue

@@ -18,15 +18,18 @@
           drag
       >
         <el-button
-            size="small"
-            type="primary"
-            v-if="!readOnly"
+          size="small"
+          :type="isShow ===1 ? 'text':'primary'"
+          v-if="!readOnly"
         >点击上传</el-button>
-        <div
+        <span v-if="isShow !== 1 || isShow == undefined">
+          <div
             slot="tip"
             class="el-upload__tip"
             v-if="!readOnly"
-        >请上传文件</div>
+          >请上传文件</div>
+        </span>
+
       </el-upload>
       <div
           v-if="item && filesArr.length"
@@ -67,6 +70,12 @@
         type: [Number, String],
         default: 6
       },
+      isShow: {
+        type: Number
+      },
+      contextKey: {
+        type: [String, Object]
+      },
       defined: null
     },
     data() {
@@ -169,7 +178,14 @@
                     SystemId: 'dataPlatform'
                   }
                   vm.filesArr.push(fileObject);
-                  vm.$emit("change", vm.filesArr, vm.defined);
+
+                  if(vm.isShow === 1) {
+                    let oFile = {}
+                    oFile[vm.contextKey] = vm.filesArr
+                    vm.$emit("change", oFile, vm.defined);
+                  } else {
+                    vm.$emit("change", vm.filesArr, vm.defined);
+                  }
                 } else {
                   this.$message.error(res.data.ResultMsg)
                 }
@@ -224,4 +240,4 @@
       }
     }
   }
-</style>
+</style>

+ 76 - 53
src/components/business_space/lib/uploadImgsName.vue

@@ -47,63 +47,78 @@
   </div>
 </template>
 <script>
-import tools from "@/utils/scan/tools";
-import formInput from "@/components/business_space/lib/formInput"
-import detailsDialog from "@/components/business_space/lib/detailsDia"
+  import tools from "@/utils/scan/tools";
+  import formInput from "@/components/business_space/lib/formInput"
+  import detailsDialog from "@/components/business_space/lib/detailsDia"
 
-export default {
-  components: {
-    formInput,
-    detailsDialog
-  },
-  props: {
-    keysArr: {
-      type: [Array, String]
-    },
-    readOnly: {
-      type: Boolean,
-      default: false
-    },
-    max: {
-      type: [Number, String],
-      default: 6
+  export default {
+    components: {
+      formInput,
+      detailsDialog
     },
-    accept: {
-      type: String,
-      default: "image/*"
+    props: {
+      keysArr: {
+        type: [Array, String]
+      },
+      readOnly: {
+        type: Boolean,
+        default: false
+      },
+      max: {
+        type: [Number, String],
+        default: 6
+      },
+      accept: {
+        type: String,
+        default: "image/*"
+      },
+      type: {
+        type: String,
+        default: "image"
+      },
+      contextKey: {
+        type: [String, Object]
+      },
+      isShow: {
+        type: [Number, String]
+      },
+      defined: null,
+      videoPicArr: {
+        type: Array,
+        default: function () {
+          return []
+        }
+      }
     },
-    type: {
-      type: String,
-      default: "image"
+    data() {
+      return {
+        baseUrl: "",
+        imageGetUrl: "/image-service/common/image_get?systemId=dataPlatform",
+        imageUploadUrl: "/image-service/common/image_upload?systemId=dataPlatform&secret=9e0891a7a8c8e885&overwrite=true",
+        imagesArr: [],
+        iframeSrc: "",
+        dialog: {
+          details: false
+        }
+      };
     },
-    defined: null,
-    videoPicArr: {
-      type: Array,
-      default: function () {
-        return []
-      }
-    }
-  },
-  data() {
-    return {
-      baseUrl: "",
-      imageGetUrl: "/image-service/common/image_get?systemId=dataPlatform",
-      imageUploadUrl: "/image-service/common/image_upload?systemId=dataPlatform&secret=9e0891a7a8c8e885&overwrite=true",
-      imagesArr: [],
-      iframeSrc: "",
-      dialog: {
-        details: false
-      }
-    };
-  },
-  created() {
-    this.imageFalg();
-  },
-  methods: {
-    getName(name, index) {
-      this.imagesArr[index].Name = name
-      this.$emit("change", this.imagesArr, this.defined, this.videoPicArr);
+    created() {
+      this.imageFalg();
     },
+    methods: {
+      getName(name, index) {
+
+        this.imagesArr[index].Name = name
+        if (this.isShow === 1) {
+          let oFile = {}
+          oFile[this.contextKey] = this.imagesArr
+          this.$emit("change", oFile, this.defined, this.videoPicArr);
+
+        } else {
+          this.$emit("change", this.imagesArr, this.defined, this.videoPicArr);
+
+        }
+      },
     //判断是否为空
     imageFalg() {
       let type = typeof this.keysArr;
@@ -220,7 +235,15 @@ export default {
                     CreateTime
                   })
                 }
-                vm.$emit("change", vm.imagesArr, vm.defined, vm.videoPicArr);
+                if (vm.isShow === 1) {
+                  let oFile = {}
+                  oFile[vm.contextKey] = vm.imagesArr
+                  vm.$emit("change", oFile, vm.defined, vm.videoPicArr);
+                  console.log('oFile-',oFile)
+                } else {
+                  vm.$emit("change", vm.imagesArr, vm.defined, vm.videoPicArr);
+
+                }
               }
             }
           };

+ 13 - 14
src/components/data_admin/buildTask/taskStatistics.vue

@@ -35,19 +35,18 @@
 </template>
 
 <script>
-import { mapGetters } from "vuex"
-import { queryTaskCount, countAssetsTask } from "@/api/data_admin/buildTaskApi"
-export default {
-  components: {
-    
-  },
-  computed: {
-    ...mapGetters("layout", ["projectId", "secret", "userId" ]),
-    taskProgress(){
-      if(typeof this.alreadyCount == 'number' && typeof this.allCount == 'number'){
-        return Math.round(this.alreadyCount/this.allCount*100)
+  import {mapGetters} from "vuex"
+  import {countAssetsTask, queryTaskCount} from "@/api/data_admin/buildTaskApi"
+
+  export default {
+    components: {},
+    computed: {
+      ...mapGetters("layout", ["projectId", "secret", "userId"]),
+      taskProgress() {
+        if (typeof this.alreadyCount == 'number' && typeof this.allCount == 'number') {
+          return Math.round(this.alreadyCount / this.allCount * 100)
+        }
       }
-    }
   },
   data() {
     return {
@@ -124,7 +123,7 @@ export default {
           flex: 1;
           font-size: 15px;
           line-height: 35px;
-        } 
+        }
       }
     }
     .statistics-list{
@@ -157,4 +156,4 @@ export default {
     display: flex;
 		flex-direction: column;
   }
-</style>
+</style>

+ 1 - 3
src/components/ledger/cenote/elevationMap.vue

@@ -7,7 +7,7 @@
           <div class="saga-group" v-for="(winth, index) in groupWidth" :key="index" :style="`width: ${100*winth}px;`"></div>
         </div>
       </div>
-      <div class="saga-floor-item" v-for="floor in elevationData" :key="floor.FloorSequenceID">
+      <div class="saga-floor-item" v-for="floor in elevationData" :key="'FloorSequenceID'+floor.FloorSequenceID">
         <p class="saga-floorName">{{floor.FloorLocalName}}<i class="el-icon-right"></i></p>
         <div class="saga-spaceList">
           <div class="saga-group" v-for="(group, groupIndex) in floor.group" :key="floor.FloorSequenceID+'-'+groupIndex" :style="`width: ${100*groupWidth[groupIndex]}px;`">
@@ -254,7 +254,6 @@
 
 <style lang="less">
   .saga-elevation {
-    height: 100%;
     position: relative;
     .saga-center{
       position: absolute;
@@ -265,7 +264,6 @@
     }
     .saga-floor {
       display: flex;
-      height: 100%;
       box-sizing: border-box;
       flex-direction: column;
       justify-content: flex-end;

+ 277 - 39
src/components/ready/buildfloor/addBuild.vue

@@ -1,51 +1,289 @@
 <template>
-    <el-dialog
-        :title="buildTitle"
-        :visible.sync="buildDialogVis"
-        width="20%"
-        id="messageDialog"
+  <el-dialog
+    :title="buildTitle"
+    :visible.sync="buildDialogVis"
+    id="messageDialog"
+    width="55%"
+  >
+    <el-form
+      :inline="true"
+      :model="form"
+      label-width="135px"
+      :rules="rules"
+      ref="ruleForm"
     >
-    <div>
-      <label>建筑名称 : </label>
-        <el-input
-            placeholder="请输入建筑名称"
-            v-model="buildName"
-        />
-    </div>
+      <template v-for="(val,key) in buildMessage">
+        <h4>{{key}}</h4>
+
         <span
-            slot="footer"
-            class="dialog-footer"
+          :key="item.InfoPointCode"
+          v-for="item in val"
+          :class="[{'upload-file':item.InputMode == 'F2'}]"
         >
-      <el-button
-          size="small"
-          @click="buildDialogVis = false"
-      >取消</el-button>
-      <el-button
-          size="small"
-          type="primary"
-          @click="save"
-      >确认</el-button>
-    </span>
+        <el-form-item
+          :class="{FloorTypeSelect:item.InputMode == 'D1'||item.Unit}"
+          :label="item.InfoPointName"
+          :prop="item.InfoPointCode"
+          v-if="all||item.Visible"
+        >
+        <span v-if="item.InputMode == 'B1' || item.InputMode == 'B2'">
+            <el-input
+              v-model="form[item.Path]"
+              :placeholder="(item.InputMode === 'B1' && item.InfoPointCode==='BuildLocalID') ? '填写示例:F1、B1?':'' "
+            />
+           <div
+             v-if="item.InputMode === 'B1' && item.InfoPointCode==='BuildLocalID' && isShowTitle"
+             style="color: gray;font-size: 12px"
+           >用于楼层平面图切换</div>
+
+        </span>
+
+          <el-input type="number" v-else-if="item.InputMode == 'A1'||item.InputMode == 'A2'" v-model="form[item.Path]">
+            <template slot="append" v-if="item.Unit">{{item.Unit}}</template>
+          </el-input>
+          <el-select
+            placeholder="请选择"
+            v-else-if="item.InputMode == 'D1' || item.InputMode == 'E2'"
+            v-model="form[item.Path]"
+          >
+            <el-option :key="op.Code" :label="op.Name" :value="op.Code" v-for="op in item.options"></el-option>
+          </el-select>
+        <el-select
+          placeholder="请选择"
+          v-else-if="item.InputMode == 'D2'"
+          v-model="form[item.Path]"
+          multiple
+          collapse-tags
+        >
+
+            <el-option :key="op.Code" :label="op.Name" :value="op.Code" v-for="op in item.options"></el-option>
+          </el-select>
+           <el-date-picker
+             v-model="form[item.Path]"
+             type="daterange"
+             v-else-if="item.InputMode == 'C6'"
+             value-format="yyyy-MM-dd"
+             range-separator="至"
+             start-placeholder="开始日期"
+             end-placeholder="结束日期"
+           />
+             <el-cascader
+               v-else-if="item.InputMode == 'D1L'"
+               placeholder="请选择"
+               :options="item.options"
+               v-model="form[item.Path]"
+               :props="{ checkStrictly: true ,value: 'Code',label:'Name'}"
+               clearable
+             />
+          <el-input
+            v-else-if="item.InputMode == 'L'||item.InputMode == 'L1'||item.InputMode == 'L2'||item.InputMode == 'M'"
+            v-model="form[item.Path]">
+            <template slot="append" v-if="item.Unit">{{item.Unit}}</template>
+          </el-input>
+          <el-date-picker
+            placeholder="选择日期"
+            value-format="yyyy-MM-dd"
+            type="date" v-else-if="item.InputMode == 'C5'" v-model="form[item.Path]">
+          </el-date-picker>
+
+          <uploadImgs
+            :readOnly="false"
+            v-else-if="item.InputMode == 'F2'&& item.Path === 'BuildingInfo.BuildingType.Pic'"
+            v-model="form[item.Path]"
+            :keysArr="Array.isArray(buildData[item.Path]) ? buildData[item.Path]:[]"
+            :context-key="item.Path"
+            :isShow="1"
+            @change="changeItem"
+          />
+
+             <upload-files
+               v-model="form[item.Path]"
+               v-else-if="item.InputMode == 'F2'"
+               :readOnly="false"
+               :isShow="1"
+               :keys-arr="Array.isArray(buildData[item.Path]) ? buildData[item.Path]:[] "
+               :show-file-list="false"
+               :context-key="item.Path"
+               @change="changeItem"
+             />
+          <el-input disabled title="暂不支持" v-else v-model="form[item.Path]"></el-input>
+        </el-form-item>
+      </span>
+      </template>
+
+    </el-form>
+    <span
+      class="dialog-footer"
+      slot="footer"
+    >
+    <el-button @click="buildDialogVis = false">取 消</el-button>
+    <el-button @click="submitForm('ruleForm')" type="primary">确 定</el-button>
+  </span>
+    <el-dialog :visible.sync="dialogVisible">
+      <img width="100%" :src="dialogImageUrl" alt="">
+    </el-dialog>
   </el-dialog>
 </template>
 <script>
-export default {
-  data() {
-    return {
-      buildName: '',
-      buildDialogVis: false
+  import uploadFiles from "@/components/business_space/lib/uploadFiles";
+  import uploadImgs from "@/components/business_space/lib/uploadImgsName";
+
+  function flattenKeys(obj) {
+    let res = {}
+
+    function isObject(val) {
+      return typeof val === 'object' && !Array.isArray(val)
     }
-  },
-  props: {
-    buildTitle: {
-      default: "添加建筑"
+
+    function digKeys(prev, obj) {
+      Object.entries(obj).forEach(([key, value]) => {
+        const currentKey = prev ? `${prev}.${key}` : key
+        if (isObject(value)) {
+          digKeys(currentKey, value)
+        } else {
+          res[currentKey] = value
+        }
+      })
     }
-  },
-  methods: {
-    showDialog() {
-      this.buildDialogVis = true
+
+    digKeys('', obj)
+
+    return res
+  }
+
+  export default {
+    data() {
+      let validateId = (rule,value,callback) => {
+        if (!value) {
+          this.isShowTitle = false
+          return callback(new Error('请输入建筑本地编码'));
+        } else{
+          this.isShowTitle = true
+          callback()
+        }
+      }
+      return {
+        buildName: '',
+        keysArr: [], //保存临时的文件key
+        buildDialogVis: false,
+        form: {},
+        dialogImageUrl: '',
+        dialogVisible: false,
+        all: true,
+        rules: {
+          "BuildLocalID": [
+            // {"required": true, "message": "请输入建筑本地编码", "trigger": "blur"}
+            {validator:validateId,trigger:'blur'}
+          ],
+          "BuildLocalName": [
+            {"required": true, "message": "请输入建筑本地名称", "trigger": "blur"}
+          ]
+        },
+        buildData: {},
+        isShowTitle:true,
+      }
+    },
+    components: {uploadFiles, uploadImgs},
+    props: ['buildTitle', 'buildMessage', 'currentBuild'],
+    computed: {
+    },
+    mounted() {
+
+
     },
-    save() { }
+    methods: {
+      deepCopy(obj) {
+        return JSON.parse(JSON.stringify(obj))
+      },
+      showDialog(data) {
+        //获取信息
+        let buildData = data || {};  // string =>array key
+        buildData = flattenKeys(buildData);
+        for (let key in this.buildMessage) {
+          let arr = this.buildMessage[key];
+          if (Array.isArray(arr)) {
+            let list = arr.filter(i => i.InputMode == 'D2' || i.InputMode == 'C6');
+            list.forEach(j => {
+              if (buildData.hasOwnProperty(j.Path)) {
+                if (!Array.isArray(buildData[j.Path])) {
+                  buildData[j.Path] = buildData[j.Path].split(',');
+                }
+              }
+
+            })
+          }
+        }
+        this.buildData = buildData;
+        this.timeoutSetVal()
+        this.buildDialogVis = true
+      },
+
+      timeoutSetVal() {
+        let that = this
+        setTimeout(() => {
+          if (that.form) {
+            that.form = that.buildData
+          } else {
+            this.timeoutSetVal()
+          }
+        })
+      },
+      closeDialog() {
+        this.buildDialogVis = false
+      },
+      submitForm(formName) {
+        this.$refs[formName].validate((valid) => {
+          if (valid) {
+            console.log(this.form);
+            for (let key in this.buildMessage) {
+              let arr = this.buildMessage[key];
+              if (Array.isArray(arr)) {
+                let list = arr.filter(i => i.InputMode == 'D2' || i.InputMode == 'C6');
+                list.forEach(j => {
+                  if (this.form.hasOwnProperty(j.Path)) {
+                    if (Array.isArray(this.form[j.Path])) {
+                      this.form[j.Path] = this.form[j.Path].join(',');
+                    }
+                  }
+                })
+              }
+            }
+            this.$emit('handleBuild', this.form)
+
+          } else {
+            return false;
+          }
+        });
+      },
+      changeItem(val) {
+        console.log(val)
+        let _key = Object.keys(val)[0] + '';
+        this.form[_key] = val[_key];
+
+      },
+
+    }
   }
-}
 </script>
+<style lang="less" scoped>
+
+  #messageDialog {
+    /deep/ .el-date-editor.el-input, .el-date-editor.el-input__inner, /deep/ .el-select {
+      width: 200px;
+    }
+
+    /deep/ .FloorTypeSelect .el-form-item__content {
+      width: 200px;
+    }
+
+    /deep/ .el-dialog__body {
+      height: 420px;
+      overflow: auto;
+    }
+
+    .upload-file {
+      width: 100%;
+      display: block;
+    }
+  }
+</style>

+ 56 - 0
src/components/ready/buildfloor/uploadFile.vue

@@ -0,0 +1,56 @@
+<template>
+  <el-upload
+    :before-remove="beforeRemove"
+    :file-list="fileList"
+    :limit="3"
+    :on-exceed="handleExceed"
+    :on-preview="handlePreview"
+    :on-remove="handleRemove"
+    action="https://jsonplaceholder.typicode.com/posts/"
+    class="upload-demo"
+    multiple>
+    <p
+      class="el-form-item__label"
+      style="width: 125px"
+    >{{name}}:</p>
+    <el-button
+      size="small"
+      type="text"
+    >点击上传
+    </el-button>
+    <!--    <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div>-->
+  </el-upload>
+</template>
+
+<script>
+  export default {
+    name: "uploadFile",
+    props: ['name'],
+    data() {
+      return {
+        fileList: [
+          // {name: 'food.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'},
+          // {name: 'food2.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'}
+        ]
+      };
+    },
+    methods: {
+      handleRemove(file, fileList) {
+        console.log(file, fileList);
+      },
+      handlePreview(file) {
+        console.log(file);
+      },
+      handleExceed(files, fileList) {
+        this.$message.warning(`当前限制选择 3 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`);
+      },
+      beforeRemove(file, fileList) {
+        return this.$confirm(`确定移除 ${file.name}?`);
+      }
+    }
+  }
+</script>
+
+<style scoped>
+
+</style>

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

@@ -255,10 +255,14 @@
         if (Manual === 3) {
           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('RelationType',relation.RelationType)
+          localStorage.setItem('ZoneType',relation.ZoneType)
           } else {
             this.$message.warning("设计中")
             return false

+ 62 - 11
src/components/relation/relationShip/Modal/addRelationShip.vue

@@ -13,16 +13,29 @@
         class="demo-ruleForm"
       >
         <p class="mb-20 color-AAA">{{values.codeTip}}</p>
+<!--        <el-form-item-->
+<!--          :label="values.codeTitle"-->
+<!--          prop="code"-->
+<!--          class="mb-20"-->
+<!--        >-->
+<!--          <el-input-->
+<!--            v-model="ruleForm.code"-->
+<!--            autocomplete="off"-->
+<!--            :placeholder="values.pleaseEnter"-->
+<!--          />-->
+<!--        </el-form-item>-->
         <el-form-item
           :label="values.codeTitle"
-          prop="code"
           class="mb-20"
         >
-          <el-input
-            v-model="ruleForm.code"
-            autocomplete="off"
-            :placeholder="values.pleaseEnter"
-          />
+          <el-select v-model="codeValue" placeholder="请选择">
+            <el-option
+              v-for="item in optionsCode"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value">
+            </el-option>
+          </el-select>
         </el-form-item>
         <el-row class="mb-20">
           <el-col :span="12">
@@ -101,7 +114,6 @@
       var checkCode = (rule, value, callback) => {
         //TODO
         callback()
-        this.disabled = false
       }
       var checkMain = (rule, value, callback) => {
         //TODO
@@ -113,7 +125,24 @@
       }
       return {
         addShipDialog: false,
-        disabled: true,
+        // disabled: true,
+        optionsCode: [{
+          value: 'cadId',
+          label: 'CADID图纸编码'
+        }, {
+          value: 'name',
+          label: '设备名称'
+        }, {
+          value: 'id',
+          label: '设备ID'
+        }, {
+          value: 'localId',
+          label: '本地编码'
+        }, {
+          value: 'localName',
+          label: '本地名称'
+        }],
+        codeValue: '',
         ruleForm: {
           code: '',
           main: '',
@@ -137,7 +166,14 @@
         }
       }
     },
+    computed:{
+      disabled() {
+        return this.codeValue === '' ? 'disabled':false
+      },
+
+    },
     methods: {
+
       addCode() {
         this.ruleForm.codeList.push({
           value: '',
@@ -153,14 +189,29 @@
       submitForm(formName) {
         this.$refs[formName].validate(valid => {
           if (valid) {
-            this.addShipDialog = false
-            console.log('success')
+            let arr = []
+            for(let item  of this.ruleForm.codeList) {
+              if(item.value) {
+                arr = arr.concat(item.value)
+              }
+            }
+            let param = {
+              FromContent:arr,
+              MainContent:this.ruleForm.main,
+              RelType:localStorage.getItem('RelManualType'),
+              Type:this.codeValue
+            }
+            this.$emit('addShip',param)
+            //清空添加value
+
+
           } else {
             console.log('error')
             return false
           }
         })
-      }
+      },
+
     }
   }
 </script>

+ 13 - 13
src/components/relation/relationShip/Modal/exportExcel.vue

@@ -122,24 +122,24 @@
       },
       dataId() {
         return {
-          // relType: this.ManualMaintenance.RelationType || '',
-          // zoneType: this.ManualMaintenance.ZoneType || '',
-          // projectId: this.projectId
+          relType: localStorage.getItem('RelationType') || '',
+          zoneType: localStorage.getItem('ZoneType') || '',
+          projectId: this.projectId
         }
       },
     },
     methods: {
       downloadProject(str) {
-        // let relType = this.ManualMaintenance.RelationType ? `?relType=${this.ManualMaintenance.RelationType}` : ''
-        // let zoneType = this.ManualMaintenance.ZoneType ? `&zoneType=${this.ManualMaintenance.ZoneType}` : ''
-        // let url;
-        // if (str === 'excel') {
-        //   relType = this.ManualMaintenance.RelationType ? `&relType=${this.ManualMaintenance.RelationType}` : ''
-        //   url = `/api/datacenter/graphic/export?code=对象ID${relType}${zoneType}`
-        // } else {
-        //   url = `/api/datacenter/graphic/report-downloads${relType}${zoneType}`
-        // }
-        // return url
+        let relType = localStorage.getItem('RelationType') ? `?relType=${localStorage.getItem('RelationType')}` : '';
+        let zoneType = localStorage.getItem('ZoneType') ? `&zoneType=${localStorage.getItem('ZoneType')}` : '';
+        let url;
+        if (str === 'excel') {
+          relType = localStorage.getItem('RelationType') ? `&relType=${localStorage.getItem('RelationType')}` : '';
+          url = `/api/datacenter/graphic/export?code=对象ID${relType}${zoneType}`
+        } else {
+          url = `/api/datacenter/graphic/report-downloads${relType}${zoneType}`
+        }
+        return url
       },
       progress(event, file, fileList) {
         // console.log(event.file, fileList)

+ 6 - 4
src/utils/buildfloor/tools.js

@@ -2,7 +2,7 @@ const tools = {}
 
 /**
  * @param arr [a,b,c]
- * 
+ *
  * val value
  */
 function returnNewObj(data, arr, val) {
@@ -48,11 +48,13 @@ tools.formatData = (data) => {
   return newData
 }
 
+
+
 /**
  * @param data {a:{b:{c:{}}}}
- * 
+ *
  * @returns a.b.c
- * 
+ *
  */
 tools.desFormatData = (data) => {
   let newData = {}
@@ -69,4 +71,4 @@ tools.desFormatData = (data) => {
   return newData
 }
 
-export default tools
+export default tools

+ 5 - 8
src/views/data_admin/buildGraphy/createPointZone.vue

@@ -45,7 +45,7 @@
 
 <script>
 import locationPointMsg from '@/views/data_admin/buildGraphy/locationPointMsg'
-import { queryDictionaryHead, getDataDictionary, createZone } from '@/api/scan/request';
+import { queryDictionaryHead, getDataDictionary, zoneCreate } from '@/api/scan/request';
 import { mapGetters } from 'vuex'
 import zoneInput from '@/components/data_admin/zoneInput'
 export default {
@@ -87,10 +87,7 @@ export default {
     //创建
     createZ() {
       let param = {
-        zone: '',
-        data: {
-          content: []
-        }
+        Content: []
       }
       let zObj = this.$refs.zoneInput.getFormData();
       zObj.Pic = this.$refs.pointMsg.choImg.concat();
@@ -101,13 +98,13 @@ export default {
         Type: item.Type
       }))
       if (this.RoomLocalName && this.buildFloor.length && this.space) {
+        zObj.ObjectType = this.space;
         zObj.RoomLocalName = this.RoomLocalName;
         zObj.RoomLocalID = this.RoomLocalID;
         zObj.BuildingId = this.buildFloor[0];
         zObj.FloorId = this.buildFloor[1];
-        param.zone = this.space;
-        param.data.content = [zObj];
-        createZone(param, res => {
+        param.Content = [zObj];
+        zoneCreate(param, res => {
           this.$message.success("创建成功");
           this.$refs.pointMsg.clearImg();
           this.RoomLocalName = ''

+ 3 - 8
src/views/ledger/spacelist/spaceDetail/index.vue

@@ -31,7 +31,7 @@
 
 <script>
 import { mapGetters } from "vuex"
-import { searchZoneQuery, deleteZone } from '@/api/scan/request'
+import { searchZoneQuery, zoneCreate } from '@/api/scan/request'
 import eqToSpaceTable from '@/components/business_space/newTables/eqToSpaceTable'
 import syInSpaceTable from '@/components/business_space/newTables/syInSpaceTable'
 export default {
@@ -96,13 +96,8 @@ export default {
         cancelButtonText: '取消',
         type: 'warning'
       }).then(() => {
-        let pa = {
-          data: [{
-            RoomID: this.spaceDetails.RoomID
-          }],
-          zone: this.params.zone
-        }
-        deleteZone(pa, res => {
+        let pa = [{RoomID: this.spaceDetails.RoomID}]
+        zoneCreate(pa, res => {
           this.$message.success('删除成功')
           this.goBack()
         })

+ 391 - 248
src/views/ready/buildfloor/index.vue

@@ -4,28 +4,41 @@
       <div class="l-list">
         <div class="action-box">
           <div>
-            <el-button size="small" type="default" icon="el-icon-plus" @click="addBuild" />
-            <el-button size="small" type="default" icon="el-icon-minus" @click="delBuild" />
-            <el-button size="small" type="default" icon="el-icon-edit-outline" @click="editBuild" />
+            <el-button @click="addBuild" icon="el-icon-plus" size="small" type="default"/>
+
+            <el-popover
+              placement="top"
+              width="160"
+              v-model="visible">
+              <p>确定删除吗?</p>
+              <div style="text-align: right; margin: 0">
+                <el-button size="mini" type="text" @click="visible = false">取消</el-button>
+                <el-button type="primary" size="mini" @click="delBuild">确定</el-button>
+              </div>
+              <el-button slot="reference" icon="el-icon-minus" size="small" type="default"/>
+            </el-popover>
+            <el-button @click="editBuild" icon="el-icon-edit-outline" size="small" type="default"/>
           </div>
         </div>
         <h4>建筑</h4>
         <div class="build-list">
-          <div v-for="(item,index) in buildList" :key="item.BuildID" :class="{'floor-item':true,active:item.active}" @click="changeBuild(index)">
+          <div :class="{'floor-item':true,active:item.active}" :key="item.BuildID" @click="changeBuild(index)"
+               v-for="(item,index) in buildList">
             <span>
               {{item.BuildLocalName || item.BuildName}}
-              <el-badge v-if="item.Count>0" class="mark" :value="item.Count" />
+              <el-badge :value="item.Count" class="mark" v-if="item.Count>0"/>
             </span>
           </div>
         </div>
       </div>
       <div class="r-table">
         <div class="action-box">
-          <el-button size="small" type="default" @click="addFloor">添加楼层
+          <el-button @click="addFloor" size="small" type="default">添加楼层
           </el-button>
         </div>
         <div class="table-box">
-          <el-table :data="tableData" style="width: 100%" height="100%" v-loading="loading" :header-cell-style="headerStyle">
+          <el-table :data="tableData" :header-cell-style="headerStyle" height="100%" style="width: 100%"
+                    v-loading="loading">
             <el-table-column label="楼层本地名">
               <template slot-scope="scope">{{scope.row.FloorLocalName||scope.row.FloorName}}</template>
             </el-table-column>
@@ -34,35 +47,38 @@
             </el-table-column>
             <el-table-column label="楼层信息">
               <template slot-scope="scope">
-                <el-button size="mini" @click="editFloorData(scope.row)" plain icon="el-icon-edit-outline"></el-button>
+                <el-button @click="editFloorData(scope.row)" icon="el-icon-edit-outline" plain size="mini"></el-button>
               </template>
             </el-table-column>
-            <el-table-column prop="Datasource" label="平面图">
+            <el-table-column label="平面图" prop="Datasource">
               <template slot-scope="scope">
-                <p v-if="scope.row.Sign>0" @click="checkDrawImg(scope.row,2)">
+                <p @click="checkDrawImg(scope.row,2)" v-if="scope.row.Sign>0">
                   <el-badge is-dot>
-                    <i class="iconfont icon-floorplan" />
-                  </el-badge>平面图重复
+                    <i class="iconfont icon-floorplan"/>
+                  </el-badge>
+                  平面图重复
                 </p>
-                <p v-else-if="scope.row.StructureInfo?scope.row.StructureInfo.FloorMap:false" @click="checkDrawImg(scope.row,1)">
-                  <i class="iconfont icon-floorplan" />
+                <p @click="checkDrawImg(scope.row,1)"
+                   v-else-if="scope.row.StructureInfo?scope.row.StructureInfo.FloorMap:false">
+                  <i class="iconfont icon-floorplan"/>
                   查看平面图
                 </p>
-                <p v-else @click="checkDrawImg(scope.row,3)">
-                  <i class="iconfont icon-nopicture" />
+                <p @click="checkDrawImg(scope.row,3)" v-else>
+                  <i class="iconfont icon-nopicture"/>
                   暂无平面图
                 </p>
               </template>
             </el-table-column>
-            <el-table-column prop="SubTypeName" label="楼层贯通关系">
+            <el-table-column label="楼层贯通关系" prop="SubTypeName">
               <template slot-scope="scope">
-                <span style="margin-right:20px">{{scope.row.FloorThroughList?scope.row.FloorThroughList.length:0}}</span>
-                <el-button size="mini" @click="changeConnection(scope.row)" plain icon="el-icon-edit-outline" />
+                <span
+                  style="margin-right:20px">{{scope.row.FloorThroughList?scope.row.FloorThroughList.length:0}}</span>
+                <el-button @click="changeConnection(scope.row)" icon="el-icon-edit-outline" plain size="mini"/>
               </template>
             </el-table-column>
-            <el-table-column prop="action" label="操作">
+            <el-table-column label="操作" prop="action">
               <template slot-scope="scope">
-                <el-button size="mini" @click="handleDelete(scope.row)" type="danger" plain icon="el-icon-delete" />
+                <el-button @click="handleDelete(scope.row)" icon="el-icon-delete" plain size="mini" type="danger"/>
               </template>
             </el-table-column>
           </el-table>
@@ -70,279 +86,406 @@
       </div>
     </el-row>
     <!-- 添加-修改楼层 -->
-    <addFloor :title="floorTitle" ref="addFloorDialog" :curBuildId="curBuildId" :curFloorId="curFloorId" @refresh="refresh" />
-    <!-- 添加-修改建筑 -->
-    <addBuild :title="buildTitle" ref="addBuildDialog" />
+    <addFloor :curBuildId="curBuildId" :curFloorId="curFloorId" :title="floorTitle" @refresh="refresh"
+              ref="addFloorDialog"/>
+    <!-- 添加-修改建筑 :currentType="currentType"-->
+    <addBuild
+      :buildTitle="buildTitle"
+      ref="addBuildDialog"
+      :buildMessage="buildMessage"
+      @handleBuild="handleBuild"
+    />
     <!-- 删除建筑-删除楼层 -->
-    <el-dialog title="提示" :visible.sync="delDialogVis" width="20%" @close="handleClose" id="messageDialog">
+    <el-dialog :visible.sync="delDialogVis" @close="handleClose" id="messageDialog" title="提示" width="20%">
       <div>确定要删除该{{delText}}?</div>
-      <span slot="footer" class="dialog-footer">
-        <el-button size="small" @click="delDialogVis=false">取消</el-button>
-        <el-button size="small" type="primary" @click="confirmDel">确认</el-button>
+      <span class="dialog-footer" slot="footer">
+        <el-button @click="delDialogVis=false" size="small">取消</el-button>
+        <el-button @click="confirmDel" size="small" type="primary">确认</el-button>
       </span>
     </el-dialog>
     <!-- 添加贯通关系弹窗 -->
-    <addConnectivity ref="addConnectivity" @refresh="refresh" />
+    <addConnectivity @refresh="refresh" ref="addConnectivity"/>
     <!-- 查看图片弹窗 -->
-    <checkGraphy ref="checkGraphy" @refresh="refresh" :alreadyRelatedModel='alreadyRelatedModel'></checkGraphy>
+    <checkGraphy :alreadyRelatedModel='alreadyRelatedModel' @refresh="refresh" ref="checkGraphy"></checkGraphy>
   </div>
 
 </template>
 
 <script>
-import addFloor from "@/views/ready/buildfloor/addFloor/index";
-import addBuild from "@/components/ready/buildfloor/addBuild";
-import { mapGetters, mapActions } from "vuex";
-import addConnectivity from "@/components/ready/buildfloor/addConnectivity";
-import checkGraphy from "./drawGraphy/checkGraphy"; //查看图片
-import { buildingQueryAndCount, floorQueryAndSign, manageDeleteFloor } from "@/api/scan/request";
-export default {
-  components: {
-    addFloor,
-    addBuild,
-    addConnectivity,
-    checkGraphy
-  },
-  data() {
-    return {
-      repetitionGraphyVisible: false, // 替换平面图弹窗
-      floorTitle: "添加楼层",
-      buildTitle: "添加建筑",
-      delDialogVis: false,
-      delText: "建筑",
-      headerStyle: {
-        backgroundColor: "#d9d9d9",
-        color: "#2b2b2b",
-        lineHeight: "30px"
-      },
-      buildList: [],
-      tableData: [],
-      page: {
-        pageSize: 500,
-        pageSizes: [10, 20, 50, 100],
-        pageNumber: 1,
-        total: 0
-      },
-      loading: false, //列表loading
-      curBuildId: "", //当前选中的建筑id
-      curFloorId: "", //当前选中的楼层id
-      modelId: "",
-      alreadyRelatedModel: []
-    };
-  },
-  computed: {
-    ...mapGetters("layout", ["projectId"])
-  },
-  mounted() { },
-  created() {
-    this.init();
-  },
-  methods: {
-    init() {
-      let bdParam = {
-        Orders: "BuildLocalName asc",
-        PageNumber: 1,
-        PageSize: 500
-      };
-      buildingQueryAndCount(bdParam, res => {
-        this.buildList = res.Content;
-        if (this.buildList.length) {
-          this.changeBuild(0);
-        }
-      });
-    },
-    //change build
-    changeBuild(index) {
-      this.buildList.map(item => {
-        item.active = false;
-        return item;
-      });
-      this.buildList[index].active = true;
-      this.curBuildId = this.buildList[index].BuildID;
-      this.getFloorTableData();
-      this.$forceUpdate();
-    },
-    //add build
-    addBuild() {
-      this.$message.warning("开发中...");
-      return;
-      this.$refs.addBuildDialog.showDialog();
-    },
-    //delete build
-    delBuild() {
-      this.$message.warning("开发中...");
-      return;
-      this.delText = "建筑";
-      this.delDialogVis = true;
-    },
-    //edit build
-    editBuild() {
-      this.$message.warning("开发中...");
-      return;
+  import addFloor from "@/views/ready/buildfloor/addFloor/index";
+  import addBuild from "@/components/ready/buildfloor/addBuild";
+  import {mapGetters} from "vuex";
+  import addConnectivity from "@/components/ready/buildfloor/addConnectivity";
+  import checkGraphy from "./drawGraphy/checkGraphy"; //查看图片
+  import tools from "@/utils/buildfloor/tools";
+  import {
+    buildingQueryAndCount,
+    floorQueryAndSign,
+    getDataDictionary,
+    manageDeleteFloor,
+    objectCreateBuild,
+    objectDeleteBuild,
+    objectQueryBuild,
+    objectUpdateBuild
+  } from "@/api/scan/request";
+
+  export default {
+    components: {
+      addFloor,
+      addBuild,
+      addConnectivity,
+      checkGraphy
     },
-    //delete floor
-    handleDelete(floor) {
-      this.delText = "楼层";
-      this.delDialogVis = true;
-      this.curFloorId = floor.FloorID;
+    data() {
+      return {
+        repetitionGraphyVisible: false, // 替换平面图弹窗
+        floorTitle: "添加楼层",
+        buildTitle: "添加建筑",
+        delDialogVis: false,
+        delText: "建筑",
+        headerStyle: {
+          backgroundColor: "#d9d9d9",
+          color: "#2b2b2b",
+          lineHeight: "30px"
+        },
+        buildList: [],
+        tableData: [],
+        page: {
+          pageSize: 500,
+          pageSizes: [10, 20, 50, 100],
+          pageNumber: 1,
+          total: 0
+        },
+        loading: false, //列表loading
+        curBuildId: "", //当前选中的建筑id
+        curFloorId: "", //当前选中的楼层id
+        modelId: "",
+        alreadyRelatedModel: [],
+        // currentType: 'add'
+        buildMessage: {},
+        visible: false,
+      };
     },
-    //确认删除弹窗关闭
-    handleClose() { },
-    addFloor() {
-      this.curFloorId = "";
-      this.$refs.addFloorDialog.showDialog();
+    computed: {
+      ...mapGetters("layout", ["projectId"])
     },
-    // 获取列表
-    getFloorTableData() {
-      let floorParam = {
-        Cascade: [{ Name: "floorThroughList" }],
-        Orders: "FloorSequenceID desc",
-        PageNumber: this.page.pageNumber,
-        PageSize: this.page.pageSize,
-        Filters: `BuildID='${this.curBuildId}'`
-      };
-      floorQueryAndSign(floorParam, res => {
-        this.tableData = res.Content;
-        this.page.total = res.Total;
-        this.alreadyRelatedModel = res.Content.map(t => {
-          return t.ModelId
-        }).filter(t => t);
-      });
+    mounted() {
     },
-    // 创建楼层成功-修改关系成功
-    refresh() {
-      this.getFloorTableData();
+    created() {
+      this.init();
+      this.handleBuildQuery()
+      this.handleSearchBuildKey()
     },
-    // 确认删除(删除建筑-楼层公用)
-    confirmDel() {
-      if (this.delText == "楼层") {
-        let delParam = [{ FloorID: this.curFloorId }];
-        manageDeleteFloor(delParam, res => {
+    methods: {
+      init() {
+        let bdParam = {
+          Orders: "BuildLocalName asc",
+          PageNumber: 1,
+          PageSize: 500
+        };
+        buildingQueryAndCount(bdParam, res => {
+          this.buildList = res.Content;
+          if (this.buildList.length) {
+            this.changeBuild(0);
+          }
+        });
+      },
+      //change build
+      changeBuild(index) {
+        this.buildList.map(item => {
+          item.active = false;
+          return item;
+        });
+        this.buildList[index].active = true;
+        this.curBuildId = this.buildList[index].BuildID;
+        this.getFloorTableData();
+        this.$forceUpdate();
+      },
+      //add build
+      addBuild() {
+        // this.$message.warning("开发中...");
+        // return;
+        this.buildTitle = '添加建筑';
+        this.$refs.addBuildDialog.showDialog();
+        this.handleSearchBuildKey()
+      },
+      handleSearchBuildKey() {
+        let params = {
+          projectId: this.projectId,
+          data: {
+            Orders: "sort asc,InfoPointCode asc",
+            PageNumber: 1,
+            PageSize: 50
+          },
+          type: 'Building'
+        };
+        getDataDictionary(params, res => {
+          // let list = res.Content.map(item => {
+          //   if (item.InputMode === 'D1' && item.DataSource != undefined) {
+          //     item.options = JSON.parse(item.DataSource)
+          //   }
+          //   return item
+          // })
+          let first = {}
+          //一级循环出来一级标签
+          res.Content.map(item => {
+            if ((item.InputMode === 'D1' || item.InputMode === 'D2'  || item.InputMode === 'E2'|| item.InputMode === 'D1L') && item.DataSource != undefined) {
+              item.options = JSON.parse(item.DataSource)
+            }
+            if (first[item.FirstName] && first[item.FirstName].length) {
+            } else {
+              first[item.FirstName] = []
+            }
+            first[item.FirstName].push({
+              InfoPointName: item.InfoPointName,
+              InfoPointCode: item.InfoPointCode,
+              Visible: item.Visible,
+              UnDisabled: item.UnDisabled,
+              SecondName: item.SecondName ? item.SecondName : "",
+              Path: item.Path,
+              InputMode: item.InputMode,
+              options: item.options,
+              Unit: item.Unit
+            })
+          })
+          this.buildMessage = first
+
+        })
+      },
+      //delete build ,根据id删除建筑信息
+      delBuild() {
+        // this.$message.warning("开发中...");
+        // return;
+
+        let param = [{BuildId: this.curBuildId}];
+        objectDeleteBuild(param, res => {
+          setTimeout(() => {
+            this.handleBuildQuery()
+            this.init()
+          })
+          this.visible = false
           this.$message.success("删除成功");
-          this.delDialogVis = false;
-          this.getFloorTableData();
+        })
+      },
+      //edit build
+      editBuild() {
+        this.buildTitle = '编辑建筑';
+        this.handleSearchBuildKey()
+        let list = this.currentBuildList.filter(i => i.BuildID === this.curBuildId)
+        let obj = {}
+        for (let i = 0; i < list.length; i++) {
+          obj = list[i]
+        }
+
+
+
+        this.$refs.addBuildDialog.showDialog(obj);
+
+      },
+      handleFile(val,name) {
+      },
+      // handleBuild 获取建筑信息
+      handleBuild(val) {
+        let newform = tools.formatData(val)
+        let Param = {
+          Content: [newform]
+        }
+        if (newform.BuildID) {
+          objectUpdateBuild(Param, res => {
+            this.$message.success('更新成功')
+            this.$refs.addBuildDialog.closeDialog()
+          })
+        } else {
+          objectCreateBuild(Param, res => {
+            this.$message.success('创建成功')
+            this.$refs.addBuildDialog.closeDialog()
+          })
+        }
+        setTimeout(() => {
+          this.handleBuildQuery()
+          this.init()
+        })
+      },
+      //delete floor
+      handleDelete(floor) {
+        this.delText = "楼层";
+        this.delDialogVis = true;
+        this.curFloorId = floor.FloorID;
+      },
+      //确认删除弹窗关闭
+      handleClose() {
+      },
+      addFloor() {
+        this.curFloorId = "";
+        this.$refs.addFloorDialog.showDialog();
+      },
+      // 获取列表
+      getFloorTableData() {
+        let floorParam = {
+          Cascade: [{Name: "floorThroughList"}],
+          Orders: "FloorSequenceID desc",
+          PageNumber: this.page.pageNumber,
+          PageSize: this.page.pageSize,
+          Filters: `BuildID='${this.curBuildId}'`
+        };
+        floorQueryAndSign(floorParam, res => {
+          this.tableData = res.Content;
+          this.page.total = res.Total;
+          this.alreadyRelatedModel = res.Content.map(t => {
+            return t.ModelId
+          }).filter(t => t);
         });
-      } else {
-        //todo
-      }
-    },
-    // 修改楼层信息
-    editFloorData(floor) {
-      this.floorTitle = "编辑楼层信息";
-      this.curFloorId = floor.FloorID;
-      this.$refs.addFloorDialog.showDialog(floor);
-    },
-    // 修改楼层贯通关系
-    changeConnection(row) {
-      this.$refs.addConnectivity.showDialog();
-      this.$refs.addConnectivity.floor = row;
+      },
+      // 创建楼层成功-修改关系成功
+      refresh() {
+        this.getFloorTableData();
+      },
+      // 确认删除(删除建筑-楼层公用)
+      confirmDel() {
+        if (this.delText == "楼层") {
+          let delParam = [{FloorID: this.curFloorId}];
+          manageDeleteFloor(delParam, res => {
+            this.$message.success("删除成功");
+            this.delDialogVis = false;
+            this.getFloorTableData();
+          });
+        } else {
+          //todo
+        }
+      },
+      // 修改楼层信息
+      editFloorData(floor) {
+        this.floorTitle = "编辑楼层信息";
+        this.curFloorId = floor.FloorID;
+        this.$refs.addFloorDialog.showDialog(floor);
+      },
+      // 修改楼层贯通关系
+      changeConnection(row) {
+        this.$refs.addConnectivity.showDialog();
+        this.$refs.addConnectivity.floor = row;
+      },
+      // 查看平面图
+      checkDrawImg(row, index) {
+        if (3 == index) {
+          this.$refs.checkGraphy.showDialog(row);
+          this.modelId = "";
+        } else {
+          this.modelId = row.ModelId;
+          let pa = {modelId: this.modelId, FloorID: row.FloorID, BuildID: row.BuildID};
+          this.$router.push({name: "repetitionGraphy", query: pa});
+        }
+      },
+      //  查询建筑信息
+      handleBuildQuery() {
+        let param = {
+          projectId: this.projectId,
+          Orders: "BuildLocalName asc",
+          PageNumber: 1,
+          PageSize: 500
+        };
+        objectQueryBuild(param, res => {
+
+          this.currentBuildList = res.Content
+        });
+      },
+
     },
-    // 查看平面图
-    checkDrawImg(row, index) {
-      if (3 == index) {
-        this.$refs.checkGraphy.showDialog(row)
-        this.modelId = "";
-      } else {
-        this.modelId = row.ModelId;
-        let pa = { modelId: this.modelId, FloorID: row.FloorID, BuildID: row.BuildID }
-        this.$router.push({ name: "repetitionGraphy", query: pa });
+    watch: {
+      projectId() {
+        this.init();
       }
     }
-  },
-  watch: {
-    projectId() {
-      this.init();
-    }
-  }
-};
+  };
 </script>
 <style lang="less" scoped>
-#bd-fl-manage {
-  overflow: hidden;
-  height: 100%;
-  position: relative;
-
-  .el-row {
+  #bd-fl-manage {
+    overflow: hidden;
     height: 100%;
+    position: relative;
 
-    .el-col-4 {
-      width: 17%;
-    }
-    .el-col-20 {
-      width: 82%;
-    }
-    & > div {
-      float: left;
+    .el-row {
       height: 100%;
-      overflow: hidden;
-      background-color: #fff;
-      box-sizing: border-box;
-      border: 1px solid #dfe6ec;
 
-      .action-box {
-        padding: 10px;
+      .el-col-4 {
+        width: 17%;
+      }
 
-        .el-button--small {
-          padding: 10px 11px;
-        }
+      .el-col-20 {
+        width: 82%;
       }
-    }
 
-    .l-list {
-      width: 17%;
-      overflow-y: auto;
+      & > div {
+        float: left;
+        height: 100%;
+        overflow: hidden;
+        background-color: #fff;
+        box-sizing: border-box;
+        border: 1px solid #dfe6ec;
+
+        .action-box {
+          padding: 10px;
 
-      h4 {
-        padding-left: 10px;
-        border-top: 1px solid #d9d9d9;
-        border-bottom: 1px solid #d9d9d9;
-        background: #d9d9d9;
-        color: #2b2b2b;
-        line-height: 44px;
+          .el-button--small {
+            padding: 10px 11px;
+          }
+        }
       }
 
-      .build-list {
-        line-height: 48px;
+      .l-list {
+        width: 17%;
+        overflow-y: auto;
+
+        h4 {
+          padding-left: 10px;
+          border-top: 1px solid #d9d9d9;
+          border-bottom: 1px solid #d9d9d9;
+          background: #d9d9d9;
+          color: #2b2b2b;
+          line-height: 44px;
+        }
+
+        .build-list {
+          line-height: 48px;
 
-        .floor-item {
-          white-space: nowrap;
-          overflow: hidden;
-          text-overflow: ellipsis;
+          .floor-item {
+            white-space: nowrap;
+            overflow: hidden;
+            text-overflow: ellipsis;
 
-          span {
-            margin-left: 10px;
+            span {
+              margin-left: 10px;
+            }
           }
-        }
 
-        .floor-item.active,
-        .floor-item:hover {
-          background-color: #f5f7fa;
-          color: #000;
+          .floor-item.active,
+          .floor-item:hover {
+            background-color: #f5f7fa;
+            color: #000;
+          }
         }
       }
-    }
 
-    .r-table {
-      width: 82%;
-      margin-left: 1%;
+      .r-table {
+        width: 82%;
+        margin-left: 1%;
 
-      .table-box {
-        height: calc(100% - 54px);
-        margin-bottom: 8px;
+        .table-box {
+          height: calc(100% - 54px);
+          margin-bottom: 8px;
 
-        .iconfont {
-          vertical-align: middle;
-        }
+          .iconfont {
+            vertical-align: middle;
+          }
 
-        /deep/ .el-badge__content.is-fixed {
-          transform: translateY(-6%) translateX(-100%);
-        }
+          /deep/ .el-badge__content.is-fixed {
+            transform: translateY(-6%) translateX(-100%);
+          }
 
-        p {
-          cursor: pointer;
+          p {
+            cursor: pointer;
+          }
         }
       }
     }
   }
-}
 </style>

+ 211 - 145
src/views/relation/relationShip/index.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="relation-ship">
+  <div class="relation-ship" v-loading="loading">
     <section style="margin-top: 20px">
       <el-button
         style="padding: 10px"
@@ -25,12 +25,13 @@
           <p class="border-left-8">主对象
             <span>限制条件:对象类型的范围(包括:XXXX类型,XXXX类型)</span></p>
           <label>所属建筑楼层:</label>
-          <el-select v-model="buildValue">
+          <el-select disabled v-model="buildValue">
             <el-option
               v-for="item in options"
               :key="item.value"
               :label="item.label"
               :value="item.value"
+
             />
           </el-select>
           <label>类型:</label>
@@ -39,16 +40,17 @@
             :props="props"
             collapse-tags
             clearable
+            disabled
           />
           <el-input
             placeholder="请输入"
-            v-model="deviceName"
-            @keyup.enter.native="queryTable"
+            @keyup.enter.native="queryTable(1)"
+            v-model="mainValue"
           >
             <i
               slot="suffix"
               class="el-input__icon el-icon-search cursor"
-              @click="queryTable"
+              @click="queryTable(1)"
             />
           </el-input>
         </el-col>
@@ -56,12 +58,13 @@
           <p class="border-left-8">从对象
             <span>(包括:XXXX类型,XXXX类型)</span></p>
           <label>所属建筑楼层:</label>
-          <el-select v-model="buildValue">
+          <el-select disabled v-model="buildValue">
             <el-option
               v-for="item in options"
               :key="item.value"
               :label="item.label"
               :value="item.value"
+
             />
           </el-select>
           <label>类型:</label>
@@ -70,16 +73,17 @@
             :props="props"
             collapse-tags
             clearable
+            disabled
           />
           <el-input
             placeholder="请输入"
-            v-model="deviceName"
-            @keyup.enter.native="queryTable"
+            @keyup.enter.native="queryTable(2)"
+            v-model="formValue"
           >
             <i
               slot="suffix"
               class="el-input__icon el-icon-search cursor"
-              @click="queryTable"
+              @click="queryTable(2)"
             />
           </el-input>
         </el-col>
@@ -87,6 +91,8 @@
 
     </section>
     <section class="table-list">
+      <!--              :span-method="objectSpanMethod"
+      -->
       <el-table
         :data="tableData"
         :span-method="objectSpanMethod"
@@ -96,32 +102,33 @@
         class="table"
       >
         <el-table-column
-          prop="id"
+          prop="Name"
           label="全局名称"
           width="180"
           align="center"
         >
         </el-table-column>
         <el-table-column
-          prop="name"
+          prop="LocalId"
           label="本地编码"
           align="center"
         >
         </el-table-column>
         <el-table-column
-          prop="amount1"
+          prop="LocalName"
           label="本地名称"
           align="center"
         >
         </el-table-column>
         <el-table-column
-          prop="amount2"
+          prop="CADID"
           label="CADID"
           align="center"
         >
         </el-table-column>
         <el-table-column
           label="对象详情"
+          prop="btn"
           align="center"
         >
           <template slot-scope="scope">
@@ -133,26 +140,26 @@
           </template>
         </el-table-column>
         <el-table-column
-          prop="ids"
+          prop="cName"
           label="全局名称"
           width="180"
           align="center"
         >
         </el-table-column>
         <el-table-column
-          prop="names"
+          prop="cLocalId"
           align="center"
           label="本地编码"
         >
         </el-table-column>
         <el-table-column
-          prop="amount11"
+          prop="cLocalName"
           label="本地名称"
           align="center"
         >
         </el-table-column>
         <el-table-column
-          prop="amount22"
+          prop="cCADID"
           label="CADID"
           align="center"
         >
@@ -174,15 +181,30 @@
           align="center"
         >
           <template slot-scope="scope">
-            <el-button
-              size="mini"
-              icon="el-icon-edit-outline"
-              @click="lookOver(scope.$index, scope.row)">
-            </el-button>
+            <!--            <el-button-->
+            <!--              size="mini"-->
+            <!--              icon="el-icon-delete"-->
+            <!--              @click="deleteObject(scope.$index, scope.row)">-->
+            <!--            </el-button>-->
+            <el-popconfirm
+              title="确定删除吗?"
+              @onConfirm="deleteObject(scope.$index, scope.row)"
+            >
+              <el-button slot="reference" size="mini" icon="el-icon-delete"/>
+            </el-popconfirm>
           </template>
         </el-table-column>
       </el-table>
     </section>
+    <!-- 分页 -->
+<!--    <el-pagination-->
+<!--      @size-change="handleSizeChange"-->
+<!--      @current-change="handleCurrentChange"-->
+<!--      :current-page="currentPage"-->
+<!--      :page-sizes="pageSizes"-->
+<!--      :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper" :total="total"-->
+<!--      style="float:right;margin-top:10px;padding:2px 5px;">-->
+<!--    </el-pagination>-->
     <exportExcel
       ref="export"
       :values="values"
@@ -190,6 +212,7 @@
     <addRelationShip
       ref="addShipComponent"
       :values="values"
+      @addShip="addShip"
     />
     <editRelationShip
       ref="editShipComponent"
@@ -199,15 +222,20 @@
 </template>
 
 <script>
-  import {mapActions, mapGetters, mapState} from 'vuex'
+  import {mapGetters} from 'vuex'
   import exportExcel from "../../../components/relation/relationShip/Modal/exportExcel";
   import addRelationShip from "../../../components/relation/relationShip/Modal/addRelationShip";
   import editRelationShip from "../../../components/relation/relationShip/Modal/editRelationShip";
+  import {relAdd, relDelete, relQuery} from "../../../api/relation/api";
 
   export default {
     name: "index",
     data() {
       return {
+        pageSizes: [10, 20, 50, 100],
+        pageSize: 50,
+        currentPage: 1,
+        total: 0,
         values: {
           relation_maintenance: '关系维护',
           optionTips: '请下载最新最新 xxxx 数据进行手动维护', //请下载最新最新 xxxx 数据进行手动维护
@@ -232,6 +260,8 @@
           cancel: '取消',
           delete: '删除关系'
         },
+        mainValue: '',
+        formValue: '',
         options: [
           {
             value: 'all',
@@ -276,92 +306,12 @@
             label: '新疆维吾尔族自治区',
           }]
         }],
-        deviceName: "",
-        tableData: [
-          {
-            id: '12987122',
-            name: '王小虎',
-            amount1: '234',
-            amount2: '3.2',
-            amount3: 10,
-            ids: '12987122',
-            names: '王小虎',
-            amount11: '234',
-            amount22: '3.2',
-          }, {
-            id: '12987122',
-            name: '王小虎',
-            amount1: '234',
-            amount2: '3.2',
-            amount3: 10,
-            ids: '12987122',
-            names: '王小虎',
-            amount11: '234',
-            amount22: '3.2',
-          }, {
-            id: '12987122',
-            name: '王小虎',
-            amount1: '234',
-            amount2: '3.2',
-            amount3: 10,
-            ids: '12987122',
-            names: '王小虎',
-            amount11: '234',
-            amount22: '3.2',
-          }, {
-            id: '12987122',
-            name: '王小虎',
-            amount1: '234',
-            amount2: '3.2',
-            amount3: 10,
-            ids: '12987122',
-            names: '王小虎',
-            amount11: '234',
-            amount22: '3.2',
-          }, {
-            id: '12987122',
-            name: '王小虎',
-            amount1: '234',
-            amount2: '3.2',
-            amount3: 10,
-            ids: '12987122',
-            names: '王小虎',
-            amount11: '234',
-            amount22: '3.2',
-          }, {
-            id: '129871225',
-            name: '王小虎',
-            amount1: '621',
-            amount2: '2.2',
-            amount3: 17,
-            ids: '12987125',
-            names: '王小虎',
-            amount11: '621',
-            amount22: '2.2',
-          },
-          {
-            id: '129871225',
-            name: '王小虎',
-            amount1: '621',
-            amount2: '2.2',
-            amount3: 17,
-            ids: '12987124',
-            names: '小虎',
-            amount11: '324',
-            amount22: '1.9',
-          }, {
-            id: '1298712w25',
-            name: '小虎',
-            amount1: '621',
-            amount2: '2.2',
-            amount3: 17,
-            ids: '12987125',
-            names: '小虎',
-            amount11: '621',
-            amount22: '2.2',
-          }],
-        spanArr: [], // 一个空的数组,用于存放每一行记录的合并数
-        pos: 0, // spanArr 的索引
+        tableData: [],
+        loading: false,
+        needMergeArr: ['Name', 'LocalId', 'LocalName', 'CADID','btn'],
+        rowMergeArrs: {}
+        // needMergeArr: ['name', 'id'], // 有合并项的列
+        // rowMergeArrs: {}, // 包含需要一个或多个合并项信息的对象
       }
     },
     components: {exportExcel, addRelationShip, editRelationShip},
@@ -377,28 +327,139 @@
           label: '设备控制关系',
         },
       ])
+      this.init()
+    },
+    watch: {
+      projectId() {
+        this.init()
+      }
+    },
+    computed: {
+      ...mapGetters('layout', ["projectId"])
     },
     mounted() {
-      this.getSpanArr(this.tableData)
+      // this.getSpanArr(this.tableData)
+
+
     },
     methods: {
+      deepCopy(obj) {
+        return JSON.parse(JSON.stringify(obj))
+      },
+      init() {
+        this.loading = true
+        let data = {
+          projectId: this.projectId,
+          ObjectType: 1,
+          RelType: localStorage.getItem('RelManualType'),
+          PageSize: this.pageSize,
+          PageNumber: this.currentPage
+        };
+        relQuery(data, res => {
+          this.filterTable(res)
+          // this.total = res.Total
+          this.loading = false
+        })
+      },
+      filterTable(list) {
+        let arr = []
+        if(list.Content.length) {
+          list.Content.forEach(i => {
+            i.ObjectInfo && i.ObjectInfo.forEach(j => {
+              arr.push({
+                Name: i.Name,
+                LocalName: i.LocalName,
+                LocalId: i.LocalId,
+                CADID: i.CADID,
+                cName: j.Name,
+                cLocalName: j.LocalName,
+                cLocalId: j.LocalId,
+                cCADID: j.CADID,
+                Id: i.Id,
+                cId: j.Id
+              })
+            })
+          })
+          this.tableData = this.deepCopy(arr)
+          this.rowMergeArrs = this.rowMergeHandle(this.needMergeArr, this.tableData); // 处理数据
+        } else {
+          this.tableData = []
+        }
+
+
+      },
       back() {
         this.$router.go(-1)
       },
+
       addBtn() {
         this.$refs.addShipComponent.addShipDialog = true
       },
       excel() {
         this.$refs.export.dialogExport = true
       },
-      queryTable() {
+      queryTable(i) {
+        let param = {}, RelType = localStorage.getItem('RelManualType');
+        if (i === 1) {
+          param = {
+            ObjectType: 1,
+            RelType,
+            Vague: this.mainValue
+          }
+        } else {
+          param = {
+            ObjectType: 2,
+            RelType,
+            Vague: this.formValue
+          }
+        }
+        relQuery(param, res => {
+          this.filterTable(res)
+          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 = ''
+          }
+        })
+      },
+      //分页更换size
+      handleSizeChange(val) {
+        this.currentPage = 1;
+        this.pageSize = val;
+        this.init()
+      },
+      //分页更换页
+      handleCurrentChange(val) {
+        this.currentPage = val;
+        this.init()
       },
-
       lookOver(index, row) {
         console.log(index, row)
-        this.$refs.editShipComponent.editShipDialog = true
-      },
 
+        // this.$refs.editShipComponent.editShipDialog = true
+      },
+      deleteObject(index, row) {
+        let param = {
+          "FromId": row.Id,
+          "RelType": localStorage.getItem('RelManualType'),
+          "ToId": row.cId
+        }
+        relDelete(param, res => {
+          this.init()
+        })
+      },
       cellStyle({row, column, rowIndex, columnIndex}) {
         if (column.label === '全局名称') {
           return {
@@ -408,40 +469,45 @@
           }
         }
       },
-      getSpanArr(data) {
-        for (let i = 0; i < data.length; i++) {
-          if (i === 0) {
-            this.spanArr.push(1);
-            this.pos = 0;
-
-          } else {
-            if (
-              data[i].id === data[i - 1].id &&
-              data[i].name === data[i - 1].name &&
-              data[i].amount2 === data[i - 1].amount2 &&
-              data[i].amount1 === data[i - 1].amount1
 
-            ) {
-              this.spanArr[this.pos] += 1;
-              this.spanArr.push(0);
-            } else {
-              this.spanArr.push(1);
-              this.pos = i;
-            }
-          }
-        }
-      },
       objectSpanMethod({row, column, rowIndex, columnIndex}) {
-        if (columnIndex === 1 || columnIndex === 2 || columnIndex === 3) {
-          const _row = this.spanArr[rowIndex];
-          const _col = _row > 0 ? 1 : 0;
-          return {
-            rowspan: _row,
-            colspan: _col
-          };
-        }
-
+        if (column.property === 'Name') return this.mergeAction('Name', rowIndex, column);
+        if (column.property === 'LocalId' && row.LocalId != undefined) return this.mergeAction('LocalId', rowIndex, column);
+        if (column.property === 'LocalName' && row.LocalName != undefined) return this.mergeAction('LocalName', rowIndex, column);
+        if (column.property === 'CADID' && row.CADID != undefined) return this.mergeAction('CADID', rowIndex, column);
+        if (column.property === 'btn') return this.mergeAction('Name', rowIndex, column);
+      },
+      mergeAction(val, rowIndex, colData) {
+        let _row = this.rowMergeArrs[val].rowArr[rowIndex];
+        let _col = _row > 0 ? 1 : 0;
+        return [_row, _col];
       },
+      rowMergeHandle(arr, data) {
+        if (!Array.isArray(arr) && !arr.length) return false;
+        if (!Array.isArray(data) && !data.length) return false;
+        let needMerge = {};
+        arr.forEach(i => {
+          needMerge[i] = {
+            rowArr: [],
+            rowMergeNum: 0
+          };
+          data.forEach((item, index) => {
+            if (index === 0) {
+              needMerge[i].rowArr.push(1);
+              needMerge[i].rowMergeNum = 0;
+            } else {
+              if (item[i] === data[index - 1][i]) {
+                needMerge[i].rowArr[needMerge[i].rowMergeNum] += 1;
+                needMerge[i].rowArr.push(0);
+              } else {
+                needMerge[i].rowArr.push(1);
+                needMerge[i].rowMergeNum = index;
+              }
+            }
+          });
+        });
+        return needMerge;
+      }
     }
   }
 </script>