소스 검색

接口调试

zhangyu 5 년 전
부모
커밋
49877f7bcf

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

@@ -1285,8 +1285,30 @@ export function unshaftInEq(param, success) {
     let url = `${baseUrl}/equip-component/shaft/unshaft-in-eq?shaftId=${param.shaftId}`;
     http.postJson(url, data, success)
 }
+//查询没有和当前竖井贯通的其它竖井
+export function unshaftThroughShaft(param, success) {
+    let data = param.data
+    let url = `${baseUrl}/equip-component/shaft/unshaft-through-shaft?shaftId=${param.shaftId}`;
+    http.postJson(url, data, success)
+}
+//查询没有和当前竖井绑定的系统
+export function unshaftInSys(param, success) {
+    let data = param.data
+    let url = `${baseUrl}/equip-component/shaft/unshaft-in-sys?shaftId=${param.shaftId}`;
+    http.postJson(url, data, success)
+}
 //设备所在的竖井,竖井一对多,此方不会覆盖以前的记录,累计添加
 export function linkEqSh(param, success) {
     let url = `${baseUrl}/datacenter/eq-in-sh/link-eq-sh`;
     http.postJson(url, param, success)
+}
+//竖井的贯通,竖井一对多,此方法不会覆盖以前的记录
+export function linkShaft(param, success) {
+    let url = `${baseUrl}/datacenter/sh-through-sh/link-shaft`;
+    http.postJson(url, param, success)
+}
+//系统所在的竖井,竖井一对多,累计添加,此方法不会覆盖以前记录
+export function linkSySh(param, success) {
+    let url = `${baseUrl}/datacenter/sy-in-sh/link-sy-sh`;
+    http.postJson(url, param, success)
 }

+ 65 - 75
src/components/ledger/cenote/dialog/addCenoteDialog.vue

@@ -2,32 +2,30 @@
   <el-dialog :title="title" :visible.sync="dialogVisible" width="900px" id="addEqDialog">
     <el-row class="filters">
       <el-col :span="9">
-        <el-input placeholder="输入设备名称或设备本地编码查询进行查询" v-model="keycode" clearable @keyup.enter.native="getTableData">
+        <el-input placeholder="输入竖井名称或竖井本地编码查询进行查询" v-model="keycode" clearable @keyup.enter.native="getTableData">
           <i slot="suffix" class="el-input__icon el-icon-search" @click="getTableData"></i>
         </el-input>
       </el-col>
       <el-col :span="15">
-        <cenote-type @change="changeFloor"></cenote-type>
-        <!-- <el-cascader @change="getTableData" v-model="floor" :options="options" :props="props"></el-cascader> -->
-        <el-checkbox style="margin-left:10px;" @change="getTableData" :checked="showType" label="只显示在当前业务空间中的设备"></el-checkbox>
+        <cenote-type @change="changeCenote"></cenote-type>
       </el-col>
     </el-row>
     <div class="table-box">
-      <el-table :data="tableData" style="width: 100%" height="100%" v-loading="loading" :header-cell-style="headerStyle" ref="multipleTable"
+      <el-table :data="tableData" style="width: 100%" height="350" v-loading="loading" :header-cell-style="headerStyle" ref="multipleTable"
         @selection-change="handleSelectionChange">
+        <el-table-column  type="selection" width="55"></el-table-column>
         <el-table-column :label="`${inSpaceType}名称`" show-overflow-tooltip min-width="100">
           <template slot-scope="scope">
             <div>
-              {{scope.row.EquipLocalName||scope.row.EquipName||''}}
+              {{scope.row.ShaftLocalName||scope.row.ShaftName||''}}
             </div>
           </template>
         </el-table-column>
-        <el-table-column prop="EquipLocalID" :label="`${inSpaceType}本地编码`" show-overflow-tooltip min-width="100"></el-table-column>
-        <el-table-column prop="EquipLocalID" :label="`${inSpaceType}类`" show-overflow-tooltip min-width="100"></el-table-column>
-        <el-table-column prop="EquipLocalID" label="已关联其他业务空间" show-overflow-tooltip min-width="100"></el-table-column>
+        <el-table-column prop="ShaftLocalID" :label="`${inSpaceType}本地编码`" show-overflow-tooltip min-width="100"></el-table-column>
+        <el-table-column prop="StructureInfo.ShaftFuncType" :label="`${inSpaceType}类`" show-overflow-tooltip min-width="100"></el-table-column>
         <el-table-column prop="action" label="操作" min-width="100">
           <template slot-scope="scope">
-            <el-button size="mini" @click="toDetail(scope.$index, scope.row)" type="danger" plain icon="el-icon-delete"></el-button>
+            <el-button size="mini" @click="toDetail(scope.$index, scope.row)" plain>查看详情</el-button>
           </template>
         </el-table-column>
       </el-table>
@@ -44,14 +42,7 @@
 </template>
 
 <script>
-// import {
-//   getSpaceEquip,
-//   buildingQuery, //数据中心-建筑查询
-//   notEqInSpaceQuery, //没有和当前空间绑定的设备
-//   notEqForSpaceQuery, //未服务当前空间的设备
-//   eqInSpaceCreate, //设备所在业务空间--创建关系
-//   eqForSpaceCreate, //设备服务业务空间--创建关系
-// } from "@/api/scan/request";
+import { unshaftThroughShaft, queryShaftType, linkShaft } from "@/api/scan/request";
 import cenoteType from "@/components/ledger/lib/cenoteType";
 import { mapGetters } from "vuex";
 export default {
@@ -63,20 +54,14 @@ export default {
   },
   data() {
     return {
-      title: "添加设备",
+      title: "添加连通的其他竖井",
       keycode: '', //输入查询条件
-      options: [], //建筑楼层级联
-      floor: [], // 选中的建筑楼层
-      showType: false, //是否只显示在当前业务空间中的设备
-      inSpaceType: '设备',
+      cenoteType: '', // 选中的竖井类型
+      shaftType: {}, //全部竖井类型
+      inSpaceType: '竖井',
       dialogVisible: false,
       tableData: [],
       loading: false,
-      headerStyle: {
-        backgroundColor: '#e1e4e5',
-        color: '#2b2b2b',
-        lineHeight: '30px'
-      }, // 列表样式
       selections: [], // 选中项
       page: {
         pageSize: 50,
@@ -84,78 +69,80 @@ export default {
         pageNumber: 1,
         total: 0
       },
-      props: { //自定义字段
-        value: "BuildID",
-        label: "BuildLocalName",
-        children: "Floor"
-      },
+      headerStyle: {
+        backgroundColor: '#e1e4e5',
+        color: '#2b2b2b',
+        lineHeight: '30px'
+      } // 列表样式
     };
   },
   props: {
     type: String, //选中的tab页
     params: Object //查看的竖井关系信息
   },
-  created() {
-    // this.getBuilding();
+  created() { 
+    queryShaftType(res => {
+      res.Content.forEach(item => {
+        this.shaftType[item.Code] = item.Name
+      })
+    })
   },
   methods: {
-    // 获取项目下建筑
-    getBuilding() {
-      let pa = {
-        Cascade: [{ name: 'floor', Orders: 'SequenceId desc' }],
-        Orders: "BuildLocalName asc",
-      }
-      buildingQuery(pa, res => {
-        this.options = res.Content.map(t => {
-          if (t.Floor) {
-            t.Floor = t.Floor.map(item => {
-              item.BuildID = item.FloorID;
-              item.BuildLocalName = item.FloorLocalName;
-              return item;
-            })
-          } else {
-            t.Floor = []
-          }
-          t.Floor.unshift({ BuildID: 'isNull', BuildLocalName: '未明确楼层' })
-          return t;
-        })
-      })
+    //修改建筑楼层
+    changeCenote(value) {
+      this.cenoteType = value.Id
     },
     // 显示弹窗
     showDialog() {
-      this.dialogVisible = true;
-      this.getTableData();
+      this.dialogVisible = true
+      this.page.pageNumber = 1
+      this.getTableData()
     },
     getTableData() {
-      let pa = {
+      let params = {
         data: {
-          Filters:`BuildingId="${this.floor[0]}";FloorId="${this.floor[1]}"`,
+          // Cascade: [{Name: 'shaftList'}],
+          Filters: this.cenoteType? `ProjectId='${this.projectId}';structureInfo.ShaftFuncType='${this.cenoteType}'`: `ProjectId='${this.projectId}'`,
+          Orders: "createTime desc, ShaftID asc",
           PageNumber: this.page.pageNumber,
           PageSize: this.page.pageSize,
         },
-        type: this.zone,
-        spaceId: this.spaceId
+        shaftId: this.params.ShaftID
       }
       if(this.keycode!=''){
-        pa.data.Filters += `;EquipName contain "${this.keycode}" or EquipLocalName contain "${this.keycode}" or EquipLocalID contain "${this.keycode}"`
+        params.data.Filters += `;ShaftName contain '${this.keycode}' or ShaftLocalName contain '${this.keycode}' or ShaftLocalID contain '${this.keycode}'`
       }
-      if (this.type == "equipment") {
-        notEqInSpaceQuery(pa, res => {
-          this.tableData = res.Content;
-          this.page.total = res.Total;
-        })
-      } else {
-        notEqForSpaceQuery(pa, res => {
-          this.tableData = res.Content;
-          this.page.total = res.Total;
+      unshaftThroughShaft(params, res => {
+        this.tableData = res.Content
+        this.tableData.forEach(item => {
+          if(item.StructureInfo && item.StructureInfo.ShaftFuncType){
+            item.StructureInfo.ShaftFuncType = this.shaftType[item.StructureInfo.ShaftFuncType]
+          }
         })
-      }
+        this.page.total = res.Total
+      })
     },
     //选中项修改
     handleSelectionChange(val) {
       this.selections = val;
     },
-    savaRelation() { },
+    savaRelation() {
+      if(this.selections.length){
+        let params = {
+          ShaftId: this.params.ShaftID,
+          ShaftOtherIdList: this.selections.map(item => {
+            return item.ShaftID
+          })
+        }
+        linkShaft(params, res => {
+          this.dialogVisible = false
+          this.$message.success('关联成功!')
+          this.$emit('refresh')
+        })
+      }else {
+        this.$message('请选择要关联的设备')
+      }
+    },
     //改变pagesize
     handleSizeChange(pageSize) {
       this.page.pageSize = pageSize;
@@ -182,7 +169,10 @@ export default {
     }
   }
   .table-box {
-    height: 350px;
+    height: 370px;
+    .fr{
+      margin-top: 10px;
+    }
   }
 }
 </style>

+ 2 - 4
src/components/ledger/cenote/dialog/addEquipDialog.vue

@@ -26,7 +26,7 @@
         <el-table-column prop="ShaftListName" label="已关联其他竖井" show-overflow-tooltip min-width="100" max-width="200"></el-table-column>
         <el-table-column prop="action" label="操作" min-width="100">
           <template slot-scope="scope">
-            <el-button size="mini" @click="toDetail(scope.$index, scope.row)" plain>设备详情</el-button>
+            <el-button size="mini" @click="toDetail(scope.$index, scope.row)" plain>查看详情</el-button>
           </template>
         </el-table-column>
       </el-table>
@@ -80,9 +80,7 @@ export default {
     type: String, //选中的tab页
     params: Object //查看的竖井关系信息
   },
-  created() {
-    // this.getBuilding();
-  },
+  created() { },
   methods: {
     //修改建筑楼层
     changeFloor(value) {

+ 88 - 50
src/components/ledger/cenote/dialog/addSystemDialog.vue

@@ -1,23 +1,29 @@
 <template>
-  <el-dialog :title="title" :visible.sync="dialogVisible" width="800px" id="addSyDialog">
+  <el-dialog :title="title" :visible.sync="dialogVisible" width="900px" id="addEqDialog">
     <div class="table-box">
-      <el-table :data="tableData" style="width: 100%" height="100%" v-loading="loading" :header-cell-style="headerStyle" ref="multipleTable"
+      <el-table :data="tableData" style="width: 100%" height="350" v-loading="loading" :header-cell-style="headerStyle" ref="multipleTable"
         @selection-change="handleSelectionChange">
-        <el-table-column type="selection" width="55"></el-table-column>
+        <el-table-column  type="selection" width="55"></el-table-column>
         <el-table-column :label="`${inSpaceType}名称`" show-overflow-tooltip min-width="100">
           <template slot-scope="scope">
             <div>
-              {{scope.row.SysLocalName||scope.row.SysName||''}}
+              {{scope.row.LocalName||scope.row.Name||''}}
             </div>
           </template>
         </el-table-column>
-        <el-table-column prop="SysLocalID" :label="`${inSpaceType}本地编码`" show-overflow-tooltip min-width="100"></el-table-column>
+        <el-table-column prop="LocalId" :label="`${inSpaceType}本地编码`" show-overflow-tooltip min-width="100"></el-table-column>
+        <el-table-column prop="CategoryNames.CategoryName" :label="`${inSpaceType}类`" show-overflow-tooltip min-width="100"></el-table-column>
+        <el-table-column prop="ShaftListName" label="已关联其他竖井" show-overflow-tooltip min-width="100" max-width="200"></el-table-column>
         <el-table-column prop="action" label="操作" min-width="100">
           <template slot-scope="scope">
-            <el-button size="mini" @click="toDetail(scope.$index, scope.row)" type="danger" plain icon="el-icon-delete"></el-button>
+            <el-button size="mini" @click="toDetail(scope.$index, scope.row)" plain>查看详情</el-button>
           </template>
         </el-table-column>
       </el-table>
+      <!-- 分页 -->
+      <el-pagination class="fr" v-show="tableData && tableData.length" @size-change="handleSizeChange" @current-change="handleCurrentChange"
+        :current-page="page.pageNumber" :page-sizes="page.pageSizes" :page-size="page.pageSize" layout="total, sizes, prev, pager, next, jumper"
+        :total="page.total"></el-pagination>
     </div>
     <span slot="footer" class="dialog-footer">
       <el-button size="small" @click="dialogVisible = false">取 消</el-button>
@@ -26,84 +32,116 @@
   </el-dialog>
 </template>
 
-
 <script>
-// import {
-//   notSyInSpaceQuery, //没有和当前空间绑定的系统
-//   syInSpaceCreate, //系统所在业务空间--创建关系
-// } from "@/api/scan/request";
+import { unshaftInSys, linkSySh } from "@/api/scan/request";
+import floorCascader from "@/components/ledger/lib/floorCascader";
+import { mapGetters } from "vuex";
 export default {
+  components: {
+    floorCascader
+  },
+  computed: {
+    ...mapGetters("layout", ["projectId"])
+  },
   data() {
     return {
-      title: '添加空间内的系统',
+      title: "添加竖井内的系统",
       inSpaceType: '系统',
       dialogVisible: false,
       tableData: [],
       loading: false,
+      selections: [], // 选中项
+      page: {
+        pageSize: 50,
+        pageSizes: [10, 20, 50, 100],
+        pageNumber: 1,
+        total: 0
+      },
       headerStyle: {
         backgroundColor: '#e1e4e5',
         color: '#2b2b2b',
         lineHeight: '30px'
-      }, // 列表样式
-      selections: [], // 选中项
-    }
+      } // 列表样式
+    };
   },
   props: {
     type: String, //选中的tab页
     params: Object //查看的竖井关系信息
   },
+  created() { },
   methods: {
-    // 显示
+    // 显示弹窗
     showDialog() {
-      this.dialogVisible = true;
-      this.getTableData();
-    },
-    // 选中项修改
-    handleSelectionChange(val) {
-      this.selections = val;
+      this.dialogVisible = true
+      this.page.pageNumber = 1
+      this.getTableData()
     },
-    // 确认
-    savaRelation() {
-      let pa = {
+    getTableData() {
+      let params = {
         data: {
-          SpaceId: this.spaceId,
-          SysIdList: []
+          Cascade: [{ Name: 'categoryNames' }],
+          Orders: "createTime desc, Id desc",
+          PageNumber: this.page.pageNumber,
+          PageSize: this.page.pageSize,
         },
-        type: this.zone
+        shaftId: this.params.ShaftID
       }
-      this.selections.map(t => {
-        pa.data.SysIdList.push(t.SysID)
-      })
-      syInSpaceCreate(pa, res => {
-        this.$message.success('关联成功');
-        this.$emit('refresh');
-        this.dialogVisible = false;
+      unshaftInSys(params, res => {
+        this.tableData = res.Content
+        this.page.total = res.Total
       })
     },
-    // 获取表格数据
-    getTableData() {
-      let pa = {
-        data: {
-          PageSize: 200,
-        },
-        type: this.zone,
-        spaceId: this.spaceId
+    //选中项修改
+    handleSelectionChange(val) {
+      this.selections = val;
+    },
+    savaRelation() {
+      if(this.selections.length){
+        let params = {
+          ShaftId: this.params.ShaftID,
+          EquipIdList: this.selections.map(item => {
+            return item.EquipID
+          })
+        }
+        linkSySh(params, res => {
+          this.dialogVisible = false
+          this.$message.success('关联成功!')
+          this.$emit('refresh')
+        })
+      }else {
+        this.$message('请选择要关联的设备')
       }
-      notSyInSpaceQuery(pa, res => {
-        this.tableData = res.Content;
-      })
+    },
+    //改变pagesize
+    handleSizeChange(pageSize) {
+      this.page.pageSize = pageSize;
+      this.getTableData();
+    },
+    //改变pageno
+    handleCurrentChange(pageNo) {
+      this.page.pageNumber = pageNo;
+      this.getTableData();
     },
     // 查看详情
     toDetail() {
       this.$message('开发中')
     }
-  }
-}
+  },
+};
 </script>
 <style lang="less" scoped>
-#addSyDialog {
+#addEqDialog {
+  .filters {
+    margin-bottom: 10px;
+    /deep/ .el-input__inner {
+      vertical-align: baseline;
+    }
+  }
   .table-box {
-    height: 350px;
+    height: 370px;
+    .fr{
+      margin-top: 10px;
+    }
   }
 }
 </style>