jwyu 6 月之前
父节点
当前提交
c58b4f7225

+ 4 - 0
src/api/modules/BIBoard.js

@@ -27,6 +27,10 @@ export default{
   editBoard:params=>{
     return http.post('/bi_dashborad/edit',params)
   },
+  // 删除看板
+  deleteBoard:params=>{
+    return http.post('/bi_dashborad/delete',params)
+  },
   // 看板元素拖动
   moveBoardElement:params=>{
     return http.post('/bi_dashborad/detail/move',params)

+ 11 - 27
src/views/BI_manage/components/BoardContent.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="BI-board-content">
-    <div class="BI-board-list">
+    <div class="BI-board-list" :style="{height:renderHeight}">
       <table-no-data v-if="value.length===0" style="flex:1"/>
       <div
         class="BI-board-item-box"
@@ -48,11 +48,15 @@ export default {
     boardInfo:{},//看板详情数据
     canDrag: {//能否拖动
       type: Boolean,
-      default: true
+      default: false
     },
     canDelete:{//能否删除
       type: Boolean,
       default: false
+    },
+    renderHeight:{
+      type:String,
+      default:"calc(100vh - 300px)"
     }
   },
   data() {
@@ -78,31 +82,11 @@ export default {
     async drop(index) {
       if (this.draggedIndex === null) return
       // Swap the two items
-      const temp = this.value[this.draggedIndex];
-      const fromEl=this.value[this.draggedIndex]
-      const toEl=this.value[index]
-      const params={
-        BiDashboardId:this.boardInfo.BiDashboardId,
-        BiDashboardDetailId:fromEl.BiDashboardDetailId,
-        Sort:this.draggedIndex+1,
-        OtherDetailId:toEl.BiDashboardDetailId,
-        OtherSort:index+1
-      }
-      try {
-        const res=await apiBiBoard.moveBoardElement(params)
-        if(res.Ret!==200){
-          this.draggedIndex=null
-          return
-        }
-        this.$set(this.value, this.draggedIndex, this.value[index]);
-        this.$set(this.value, index, temp);
-        this.draggedIndex = null;
-        this.$emit('input',this.value)
-        this.$emit('change',this.value)
-      } catch (error) {
-        this.draggedIndex=null
-      }
-      
+      this.$set(this.value, this.draggedIndex, this.value[index]);
+      this.$set(this.value, index, temp);
+      this.draggedIndex = null;
+      this.$emit('input',this.value)
+      this.$emit('change',this.value)
     },
   }
 };

+ 1 - 1
src/views/BI_manage/editBoard.vue

@@ -18,7 +18,7 @@
       </div>
     </div>
     <!-- 看板内容模块 -->
-    <BIBoardContent v-model="boardDataList" :canDelete="true" />
+    <BIBoardContent v-model="boardDataList" :canDelete="true" :canDrag="true" />
 
     <!-- 选择图表 -->
     <SelectChart

+ 31 - 6
src/views/BI_manage/index.vue

@@ -43,7 +43,7 @@
         >
       </div>
     </div>
-    <div class="opt-box">
+    <div class="opt-box" >
       <!-- 我的看板  -->
       <el-select
         v-model="selectBoardId"
@@ -72,16 +72,16 @@
         v-if="navType === 3"
       ></el-cascader>
 
-      <div class="right-opt-box">
+      <div class="right-opt-box" v-if="boardInfo">
         <el-button
           v-if="navType === 1&&permissionBtn.isShowBtn('BIBoardPermission','BIBoard_setcommon')"
           type="text"
           @click="showSetCommon = true"
           >设置公共</el-button
         >
-        <el-button type="text" @click="showSetShare = true" v-if="navType !== 3&&permissionBtn.isShowBtn('BIBoardPermission','BIBoard_setshare')">设置共享</el-button>
+        <el-button type="text" @click="showSetShare = true" v-if="navType !== 3&&permissionBtn.isShowBtn('BIBoardPermission','BIBoard_setshare')&&currentBoardIsSelf">设置共享</el-button>
         <el-button type="text" @click="handleGoEdit" v-if="navType !== 3&&permissionBtn.isShowBtn('BIBoardPermission','BIBoard_edit')">编辑</el-button>
-        <el-button type="text" style="color: #f00" v-if="navType !== 3&&permissionBtn.isShowBtn('BIBoardPermission','BIBoard_delete')&&currentBoardIsSelf">删除</el-button>
+        <el-button type="text" style="color: #f00" v-if="navType !== 3&&permissionBtn.isShowBtn('BIBoardPermission','BIBoard_delete')&&currentBoardIsSelf" @click="handleDeleteBoard">删除</el-button>
       </div>
     </div>
     <!-- 看板内容模块 -->
@@ -119,7 +119,7 @@ export default {
       boardInfo: null,//看板详情数据
       boardDataList: [],//看板数据
 
-      selectBoardId: 0,//当前选择的看板id
+      selectBoardId: '',//当前选择的看板id
       myBoardList: [],
       shareBoardList: [],
       commonBoardList: [],
@@ -147,6 +147,31 @@ export default {
       })
     },
 
+    // 删除看板
+    async handleDeleteBoard(){
+      await this.$confirm('删除后不可恢复,是否确认删除?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      })
+      const res=await apiBiBoard.deleteBoard({
+        BiDashboardId:this.boardInfo.BiDashboardId
+      })
+      if(res.Ret!==200) return
+      this.$message.success('删除成功')
+      this.selectBoardId =''
+      this.boardDataList = []
+      this.boardDetail = null
+      if (this.navType === 1) {
+        this.getMyBoardList()
+        return
+      }
+      if (this.navType === 2) {
+        this.getShareBoardList()
+        return
+      }
+    },
+
     // 获取看板详情
     async getBoardDetail() {
       const res = await apiBiBoard.boardDetail({ DashboardId: this.selectBoardId })
@@ -238,7 +263,7 @@ export default {
       if (this.navType === e) return
       this.navType = e
 
-      this.selectBoardId = 0
+      this.selectBoardId = ''
       this.boardDataList = []
       this.boardDetail = null
       if (this.navType === 1) {