list.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <template>
  2. <div>
  3. <!-- <add class="normal-margin" :data="data" @insertSuccess="onSuccess" style="float: left;"></add>
  4. <div style="width: 20%;float: left;margin-left: 2%">
  5. <el-input
  6. placeholder="请输入内容"
  7. v-model="search"
  8. clearable
  9. @clear="clearData()"
  10. size="mini"
  11. @keyup.enter.native="queryClick()">
  12. <i slot="prefix" class="el-icon-search" @click="queryClick()"></i>
  13. </el-input>
  14. </div>-->
  15. <tableLayout :layout="tablecols" :data="list" :opwidth="200" :custom="true" :height="tableHieght" >
  16. <template v-slot:customcol="scope">
  17. <p>{{scope.column.data[scope.column.columnname]}}</p>
  18. </template>
  19. <template v-slot:opreation="scope">
  20. <!-- <edit v-if="tool.checkAuth($route.name,'update')" :data="scope.data" @updateSuccess="onSuccess"></edit>
  21. <toVoid v-if="tool.checkAuth($route.name,'toVoid')" :data="scope.data" @toVoidSuccess="onSuccess"></toVoid>-->
  22. </template>
  23. </tableLayout>
  24. <div style="margin-top:16px;text-align:right">
  25. <el-pagination
  26. background
  27. small
  28. @size-change="handleSizeChange"
  29. @current-change="handleCurrentChange"
  30. :current-page="currentPage"
  31. :page-size="params.content.pageSize"
  32. layout="total, prev, pager, next, jumper"
  33. :total="total">
  34. </el-pagination>
  35. </div>
  36. </div>
  37. </template>
  38. <script>
  39. import add from './modules/add'
  40. import edit from './modules/edit'
  41. import toVoid from './modules/toVoid'
  42. import {mapGetters} from 'vuex'
  43. export default {
  44. name: "list",
  45. props:["data"],
  46. data(){
  47. return {
  48. tableHieght:"600px",
  49. tablecols:[],
  50. list:[],
  51. total:0,
  52. currentPage:0,
  53. search:"",
  54. params:{
  55. "id": "20221022165503",
  56. "content": {
  57. "sys_enterpriseid": "",
  58. "pageNumber": 1,
  59. "pageSize": 20,
  60. "where": {
  61. "condition": "",
  62. "workaddress":0
  63. }
  64. }
  65. }
  66. }
  67. },
  68. components:{
  69. add,edit,toVoid
  70. },
  71. computed:{
  72. ...mapGetters({
  73. dataToForm:'dataToForm'
  74. })
  75. },
  76. methods:{
  77. async listData(){
  78. this.params.content.sys_enterpriseid = this.data.sys_enterpriseid
  79. const res = await this.$api.requested(this.params)
  80. this.list = res.data
  81. this.total = res.total
  82. this.currentPage = res.pageTotal
  83. },
  84. handleSizeChange(val) {
  85. // console.log(`每页 ${val} 条`);
  86. this.params.content.pageSize = val
  87. this.listData(data)
  88. },
  89. handleCurrentChange(val) {
  90. // console.log(`当前页: ${val}`);
  91. this.params.content.pageNumber = val
  92. this.listData(data)
  93. },
  94. onSuccess(){
  95. this.listData()
  96. },
  97. clearData(){
  98. this.search = ""
  99. },
  100. queryClick(){
  101. this.params.content.where.condition = this.search
  102. this.listData()
  103. }
  104. },
  105. mounted() {
  106. this.listData()
  107. },
  108. created() {
  109. this.tablecols = this.tool.tabelCol(this.$route.name).contactsTable.tablecols
  110. },
  111. watch:{
  112. "dataToForm":function (val){
  113. console.log(val)
  114. }
  115. }
  116. }
  117. </script>
  118. <style scoped>
  119. /deep/.el-input__prefix {
  120. display: flex;
  121. align-items: center;
  122. }
  123. </style>