index.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. <template>
  2. <div class="BI-page">
  3. <div class="top-nav-box">
  4. <div class="nav-btns">
  5. <el-button
  6. class="nav-btn"
  7. type="primary"
  8. :plain="navType !== 1"
  9. @click="handleNavTypeChange(1)"
  10. >我的看板</el-button
  11. >
  12. <el-button
  13. class="nav-btn"
  14. type="primary"
  15. :plain="navType !== 2"
  16. @click="handleNavTypeChange(2)"
  17. >共享看板</el-button
  18. >
  19. <el-button
  20. class="nav-btn"
  21. type="primary"
  22. :plain="navType !== 3"
  23. @click="handleNavTypeChange(3)"
  24. >公共看板</el-button
  25. >
  26. </div>
  27. <!-- 添加看板 -->
  28. <div class="right-btn-box" v-if="navType === 1">
  29. <el-button
  30. type="primary"
  31. @click="$router.push('/editBIBoard')"
  32. v-permission="permissionBtn.BIBoardPermission.BIBoard_add"
  33. >添加看板</el-button
  34. >
  35. </div>
  36. <!-- 设置公共看板分类 -->
  37. <div class="right-btn-box" v-if="navType === 3">
  38. <el-button
  39. type="primary"
  40. @click="showCommonClassify = true"
  41. v-permission="permissionBtn.BIBoardPermission.BIBoard_addclassify"
  42. >设置公共看板分类</el-button
  43. >
  44. </div>
  45. </div>
  46. <div class="opt-box">
  47. <!-- 我的看板 -->
  48. <el-select
  49. v-model="selectBoardId"
  50. placeholder="请选择看板"
  51. v-if="navType === 1"
  52. >
  53. <el-option
  54. v-for="item in myBoardList"
  55. :key="item.BiDashboardId"
  56. :value="item.BiDashboardId"
  57. :label="item.BiDashboardName"
  58. ></el-option>
  59. </el-select>
  60. <!-- 共享看板 -->
  61. <el-cascader
  62. v-model="selectBoardId"
  63. :props="{ emitPath: false }"
  64. :options="shareBoardList"
  65. v-if="navType === 2"
  66. ></el-cascader>
  67. <!-- 公共看板 -->
  68. <el-cascader
  69. v-model="selectBoardId"
  70. :props="{ emitPath: false }"
  71. :options="commonBoardList"
  72. v-if="navType === 3"
  73. ></el-cascader>
  74. <div class="right-opt-box">
  75. <el-button
  76. v-if="navType === 1&&permissionBtn.isShowBtn('BIBoardPermission','BIBoard_setcommon')"
  77. type="text"
  78. @click="showSetCommon = true"
  79. >设置公共</el-button
  80. >
  81. <el-button type="text" @click="showSetShare = true">设置共享</el-button>
  82. <el-button type="text" @click="handleGoEdit">编辑</el-button>
  83. <el-button type="text" style="color: #f00">删除</el-button>
  84. </div>
  85. </div>
  86. <!-- 看板内容模块 -->
  87. <BIBoardContent v-model="boardDataList" :canDrag="false" />
  88. <!-- 设置共享 -->
  89. <set-share v-model="showSetShare" />
  90. <!-- 设置公共 -->
  91. <SetCommon v-model="showSetCommon" />
  92. <!-- 公共看板分类 -->
  93. <CommonClassify v-model="showCommonClassify" />
  94. </div>
  95. </template>
  96. <script>
  97. import apiBiBoard from '@/api/modules/BIBoard.js'
  98. import BIBoardContent from './components/BoardContent.vue'
  99. import CommonClassify from './components/CommonClassify.vue'
  100. import SetCommon from './components/SetCommon.vue'
  101. import SetShare from './components/SetShare.vue'
  102. export default {
  103. components: { BIBoardContent, SetShare, SetCommon, CommonClassify },
  104. data() {
  105. return {
  106. navType: 1,//
  107. boardInfo: null,//看板详情数据
  108. boardDataList: [],//看板数据
  109. selectBoardId: 0,//当前选择的看板id
  110. myBoardList: [],
  111. shareBoardList: [],
  112. commonBoardList: [],
  113. showSetShare: false,
  114. showSetCommon: false,
  115. showCommonClassify: false,
  116. }
  117. },
  118. watch: {
  119. selectBoardId(n) {
  120. n && this.getBoardDetail()
  121. }
  122. },
  123. created() {
  124. this.getMyBoardList()
  125. },
  126. methods: {
  127. handleGoEdit() {
  128. this.$router.push({
  129. path: "/editBIBoard",
  130. query: {
  131. id: this.selectBoardId
  132. }
  133. })
  134. },
  135. // 获取看板详情
  136. async getBoardDetail() {
  137. const res = await apiBiBoard.boardDetail({ DashboardId: this.selectBoardId })
  138. if (res.Ret === 200) {
  139. this.boardInfo = res.Data
  140. this.boardDataList = res.Data.List || []
  141. console.log(this.permissionBtn);
  142. }
  143. },
  144. // 我的看板列表
  145. async getMyBoardList() {
  146. const res = await apiBiBoard.myBoardList()
  147. if (res.Ret === 200) {
  148. this.myBoardList = res.Data || []
  149. if (this.myBoardList.length > 0) {
  150. this.selectBoardId = this.myBoardList[0].BiDashboardId
  151. }
  152. }
  153. },
  154. // 共享看板列表
  155. async getShareBoardList() {
  156. const res = await apiBiBoard.shareBoardList()
  157. if (res.Ret === 200) {
  158. const myArr = res.Data.MyList || []
  159. const otherArr = res.Data.OtherList || []
  160. const temarr = [...myArr, ...otherArr]
  161. this.shareBoardList = [
  162. {
  163. label: '我共享的',
  164. value: 'my_share',
  165. children: myArr.map(item => {
  166. return {
  167. label: item.BiDashboardName,
  168. value: item.BiDashboardId
  169. }
  170. })
  171. },
  172. {
  173. label: '共享给我的',
  174. value: 'other_share',
  175. children: otherArr.map(item => {
  176. return {
  177. label: item.BiDashboardName,
  178. value: item.BiDashboardId
  179. }
  180. })
  181. }
  182. ]
  183. if (temarr.length > 0) {
  184. this.selectBoardId = temarr[0].BiDashboardId
  185. }
  186. }
  187. },
  188. // 公共看板列表
  189. async getCommonBoardList() {
  190. const res = await apiBiBoard.commonBoardList()
  191. if (res.Ret === 200) {
  192. this.commonBoardList = res.Data || []
  193. if (this.commonBoardList.length > 0) {
  194. this.selectBoardId = this.commonBoardList[0].BiDashboardId
  195. }
  196. }
  197. },
  198. handleNavTypeChange(e) {
  199. if (this.navType === e) return
  200. this.navType = e
  201. this.selectBoardId = 0
  202. this.boardDataList = []
  203. this.boardDetail = null
  204. if (this.navType === 1) {
  205. this.getMyBoardList()
  206. return
  207. }
  208. if (this.navType === 2) {
  209. this.getShareBoardList()
  210. return
  211. }
  212. if (this.navType === 3) {
  213. this.getCommonBoardList()
  214. return
  215. }
  216. }
  217. },
  218. }
  219. </script>
  220. <style lang="scss" scoped>
  221. .BI-page {
  222. $border-color: #c8cdd9;
  223. background-color: #fff;
  224. border: 1px solid $border-color;
  225. .top-nav-box {
  226. padding: 14px 20px;
  227. border-bottom: 1px solid $border-color;
  228. position: relative;
  229. .nav-btns {
  230. position: relative;
  231. bottom: -15px;
  232. .nav-btn {
  233. border-bottom: none;
  234. border-bottom-left-radius: 0;
  235. border-bottom-right-radius: 0;
  236. }
  237. }
  238. .right-btn-box {
  239. position: absolute;
  240. right: 20px;
  241. top: 14px;
  242. border-left: 1px solid $border-color;
  243. padding-left: 10px;
  244. }
  245. }
  246. .opt-box {
  247. padding: 14px 20px;
  248. border-bottom: 1px solid $border-color;
  249. .right-opt-box {
  250. float: right;
  251. }
  252. }
  253. }
  254. </style>
  255. <!-- 1+3+1+1+2+3+2=13 (后台) -->