index.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. <template>
  2. <div class="container">
  3. <div class="tool-bar">
  4. <div>
  5. <span class="title-name">仪表盘标题</span>
  6. <span>解释信息</span>
  7. </div>
  8. <div style="position:absolute;top:170px;right:100px;z-index:1">
  9. <el-button class="miniSuccess" @click="control_edit()">编辑</el-button>
  10. <el-button class="successBorder" @click="handleLinkChart">
  11. 添加图表
  12. </el-button>
  13. </div>
  14. </div>
  15. <div>
  16. <draggable v-model="boardList" group="itxst" animation="300" :group="{name: 'dashboard',pull: true}" @start="onStart" @end="onEnd">
  17. <transition-group>
  18. <el-card class="box-card board-card" key="1" v-for="item in boardList">
  19. <div slot="header" class="clearfix">
  20. <span>{{item.title}}</span>
  21. <div style="float: right; padding: 3px 0;display:inline-block;">
  22. <i class="el-icon-edit" style="color:#009C69;cursor:pointer;" />
  23. <i class="el-icon-delete" style="color:#009C69;cursor:pointer;" />
  24. </div>
  25. </div>
  26. <div class="text item">
  27. 图表内容
  28. </div>
  29. </el-card>
  30. </transition-group>
  31. </draggable>
  32. </div>
  33. </div>
  34. </template>
  35. <script>
  36. import draggable from 'vuedraggable'
  37. import { GetDataByName } from '@/api/common'
  38. import Cookies from 'js-cookie'
  39. export default {
  40. name: 'Addboard2',
  41. components: { draggable },
  42. data() {
  43. return {
  44. isRoleEdit: [],
  45. boardList: [
  46. {title:'图标1'},
  47. {title:'图标2'},
  48. {title:'图标3'},
  49. ],
  50. isEdit: 'view',
  51. dashboardList: [],
  52. currentDashboard: undefined,
  53. editDialogVisible: false,
  54. dbObj: {},
  55. loading: false,
  56. isCollapse: false,
  57. did: undefined,
  58. isTitle: '2',
  59. editBtn: false,
  60. control_btn: '编辑',
  61. control_btn_l: false,
  62. }
  63. },
  64. created() {
  65. // console.log('this.$route.params.id', this.$route.params.id)
  66. // const isEdit = this.$route.params.isEdit
  67. // this.isEdit = isEdit
  68. this.getList()
  69. },
  70. methods: {
  71. onStart(){
  72. console.log(2222)
  73. },
  74. onEnd(){
  75. console.log(this.boardList)
  76. },
  77. getList() {
  78. this.loading = true
  79. // if (this.$route.params.id) {
  80. // this.did = this.$route.params.id
  81. // } else {
  82. // this.did = this.did
  83. // }
  84. },
  85. handleLinkChart() {
  86. var send_data = {
  87. name: 'getChartListV2',
  88. page: 1,
  89. offset: 1,
  90. pagecount: 10,
  91. returntype: 'Map',
  92. parammaps: {
  93. pastureid: Cookies.get('pastureid'),
  94. empid: Cookies.get('employeid')
  95. }
  96. }
  97. GetDataByName(send_data).then(response => {
  98. console.log('table数据', response.data.list)
  99. if (response.data.list !== null) {
  100. this.myChartList = response.data.list
  101. this.showChartList = true
  102. } else {
  103. this.myChartList = []
  104. this.showChartList = true
  105. }
  106. })
  107. },
  108. }
  109. }
  110. </script>
  111. <style scoped>
  112. .board{
  113. width:300px;height:300px;border:1px soild #333;display:inline-block;background: #2ed1f9;padding: 5px 5px;margin-right: 15px;margin-bottom: 15px;
  114. }
  115. .tool-bar {
  116. display: block; border-top: none;
  117. height: 45px;
  118. line-height: 45px;
  119. color: #303133;
  120. padding: 0 10px;
  121. position: relative;
  122. }
  123. .title-name {
  124. font-size: 12px;
  125. font-weight: 600;
  126. color: #909399;
  127. margin-left: 0;
  128. }
  129. /* span {
  130. color: #c0c4cc;
  131. font-size: 12px;
  132. margin-left: 10px;
  133. }
  134. .text {
  135. font-size: 14px;
  136. }
  137. .item {
  138. margin-bottom: 18px;
  139. } */
  140. .clearfix:before,
  141. .clearfix:after {
  142. display: table;
  143. content: "";
  144. }
  145. .clearfix:after {
  146. clear: both
  147. }
  148. .board-card {
  149. width: 250px;min-height: 100%;
  150. padding: 20px 10px;
  151. display: inline-block;
  152. margin: 0px 0px 20px 20px;
  153. }
  154. </style>
  155. <style lang="scss" scoped>
  156. </style>