index.vue 5.5 KB

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