editLengend.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. /**
  2. *@author:Guoxiaohuan
  3. *@date:2020.05.27
  4. *@info:图例编辑状态
  5. */
  6. <template>
  7. <div class='view'>
  8. <div class='legend-tab2' v-if='tableData.length>0'>
  9. <div class='legend-table2-box'>
  10. <div class='legend-table2' v-if='tbData1.length>0'>
  11. <el-table ref='multipleTable' height='430px' :data='tbData1' tooltip-effect='dark' @selection-change='handleSelectionChange'>
  12. <el-table-column prop='project' label='项目' width='100'></el-table-column>
  13. <el-table-column prop='num' label='数量'>
  14. <template slot-scope='{row}'>
  15. <div style='width:50px'>
  16. <el-input v-model='row.num' size='mini'></el-input>
  17. </div>
  18. </template>
  19. </el-table-column>
  20. <el-table-column prop='type' label='单位' width='60'></el-table-column>
  21. <el-table-column prop='lege' label='图例'>
  22. <template slot-scope='scope'>{{ scope.row.lege }}</template>
  23. </el-table-column>
  24. </el-table>
  25. </div>
  26. <!-- <div class='legend-table2' v-if='tbData2.length>0'>
  27. <el-table ref='multipleTable' height='430px' :data='tbData2' tooltip-effect='dark' @selection-change='handleSelectionChange'>
  28. <el-table-column prop='project' label='项目' width='100'></el-table-column>
  29. <el-table-column prop='num' label='数量'>
  30. <template slot-scope='{row}'>
  31. <div style='width:50px'>
  32. <el-input v-model='row.num' size='mini'></el-input>
  33. </div>
  34. </template>
  35. </el-table-column>
  36. <el-table-column prop='type' label='单位' width='60'></el-table-column>
  37. <el-table-column prop='lege' label='图例'>
  38. <template slot-scope='scope'>{{ scope.row.lege }}</template>
  39. </el-table-column>
  40. </el-table>
  41. </div>-->
  42. <!-- <div class='legend-table2' v-if='tbData3.length>0'>
  43. <el-table ref='multipleTable' height='430px' :data='tbData3' tooltip-effect='dark' @selection-change='handleSelectionChange'>
  44. <el-table-column prop='project' label='项目' width='100'></el-table-column>
  45. <el-table-column prop='num' label='数量'>
  46. <template slot-scope='{row}'>
  47. <div style='width:50px'>
  48. <el-input v-model='row.num' size='mini'></el-input>
  49. </div>
  50. </template>
  51. </el-table-column>
  52. <el-table-column prop='type' label='单位' width='60'></el-table-column>
  53. <el-table-column prop='lege' label='图例'>
  54. <template slot-scope='scope'>{{ scope.row.lege }}</template>
  55. </el-table-column>
  56. </el-table>
  57. </div>-->
  58. </div>
  59. <div class='swich'>
  60. <el-switch v-model='value'></el-switch>
  61. <span>隐藏数量为0的项目</span>
  62. </div>
  63. <div class='legendFoot'>
  64. <el-button size='mini' @click='cancel'>取消</el-button>
  65. <el-button size='mini' type='primary'>保存</el-button>
  66. </div>
  67. </div>
  68. </div>
  69. </template>
  70. <script>
  71. export default {
  72. props: ['tableData'],
  73. data() {
  74. return {
  75. value: false,
  76. showT: false,
  77. tbData1: [],
  78. tbData2: [],
  79. tbData3: []
  80. }
  81. },
  82. methods: {
  83. handleSelectionChange(val) {
  84. this.multipleSelection = val
  85. },
  86. cancel() {
  87. this.$emit('cance')
  88. },
  89. init() {
  90. this.tbData1 = []
  91. this.tbData2 = []
  92. this.tbData3 = []
  93. if (this.tableData.length > 0) {
  94. this.tbData1 = this.tableData
  95. // 以下不要动 不要删
  96. // let len = this.tableData.length
  97. // if (len <= 10) {
  98. // this.tbData1 = this.tableData
  99. // } else if (len > 10 && len <= 20) {
  100. // this.tbData1 = this.tableData.slice(0, 10)
  101. // this.tbData2 = this.tableData.slice(10, len)
  102. // } else if (len > 10 && len <= 30) {
  103. // this.tbData1 = this.tableData.slice(0, 10)
  104. // this.tbData2 = this.tableData.slice(10, 20)
  105. // this.tbData3 = this.tableData.slice(20, len)
  106. // } else {
  107. // this.tbData1 = this.tableData.slice(0, parseInt(len / 3))
  108. // this.tbData2 = this.tableData.slice(parseInt(len / 3), parseInt(len / 3) * 2)
  109. // this.tbData3 = this.tableData.slice(parseInt(len / 3) * 2, len)
  110. // }
  111. }
  112. }
  113. },
  114. mounted() {
  115. this.init()
  116. }
  117. }
  118. </script>
  119. <style lang="less" scoped>
  120. .view {
  121. position: relative;
  122. .legend-tab2 {
  123. position: absolute;
  124. top: -44px;
  125. right: 44px;
  126. // width: 1046px;
  127. height: 535px;
  128. min-width: 350px;
  129. width: auto;
  130. background: rgba(255, 255, 255, 1);
  131. box-shadow: 0px 2px 8px 0px rgba(31, 36, 41, 0.06);
  132. border-radius: 2px;
  133. border: 1px solid rgba(228, 229, 231, 1);
  134. .legend-table2-box {
  135. display: flex;
  136. justify-content: flex-end;
  137. .legend-table2 {
  138. padding: 16px 10px;
  139. height: 430px;
  140. width: 345px;
  141. }
  142. }
  143. }
  144. .swich {
  145. position: absolute;
  146. right: 16px;
  147. bottom: 56px;
  148. span {
  149. margin-left: 8px;
  150. }
  151. }
  152. .legendFoot {
  153. position: absolute;
  154. right: 16px;
  155. bottom: 12px;
  156. }
  157. }
  158. </style>
  159. <style lang="less">
  160. .view {
  161. .el-input--mini .el-input__inner {
  162. width: 50px;
  163. }
  164. .el-input__inner {
  165. padding: 0 5px;
  166. }
  167. .legend-container .el-table td,
  168. .legend-container .el-table th {
  169. padding: 4px 0 !important;
  170. }
  171. }
  172. </style>