index.vue 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <template>
  2. <div>
  3. <el-table ref="tables" :row-class-name="tableClassName" v-loading="loading" highlight-current-row :data="data" :header-cell-style="{background:'#EEEEEE',color:'#333'}" size="mini" :height="height" @row-click="rowClick" style="width:100%" @selection-change="handleSelectionChange" border>
  4. <el-table-column
  5. type="selection"
  6. width="55" @handleSelectionChange="handleSelectionChange" v-if="checkbox" :selectable="isCheck">
  7. </el-table-column>
  8. <el-table-column :show-overflow-tooltip="col.title == '来源' || col.title == '地址' || col.title == '备注'" v-for="col in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :width="col.width">
  9. <template slot-scope="scope">
  10. <!-- 自定义表格显示内容 -->
  11. <slot v-if="custom" name="customcol" :column="{data:scope.row,columnname:col.columnname}"></slot>
  12. <!-- 否则就是默认 -->
  13. <span v-else>{{scope.row[col.columnname]}}</span>
  14. <!-- 操作结构内容 -->
  15. <slot v-if="col.columnname === 'operation'" name="opreation" :data="scope.row"></slot>
  16. </template>
  17. </el-table-column>
  18. </el-table>
  19. </div>
  20. </template>
  21. <script>
  22. import {mapGetters} from "vuex"
  23. export default {
  24. /*
  25. layout:表结构数据;
  26. data:表渲染数据;
  27. custom:是否启用自定义结构;
  28. opwidth:操作列宽度
  29. */
  30. props:['layout','data','custom','height','checkbox'],
  31. data () {
  32. return {
  33. list:[],
  34. }
  35. },
  36. computed:{
  37. ...mapGetters({
  38. loading:'loading'
  39. })
  40. },
  41. methods:{
  42. rowClick (row) {
  43. this.$emit('rowClick',row)
  44. },
  45. tableClassName ({row,rowIndex}) {
  46. row.index = rowIndex
  47. },
  48. handleSelectionChange(val) {
  49. this.$emit('checkboxCallBack',val)
  50. },
  51. isCheck(row,rowIndex) {
  52. if (!row.status) return true
  53. if(row.status == '待跟进' || row.status == '跟进中' || row.projectnum) {
  54. return true
  55. } else {
  56. return false
  57. }
  58. }
  59. },
  60. mounted () {
  61. // this.listData()
  62. }
  63. }
  64. </script>
  65. <style>
  66. </style>