relationList.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <template>
  2. <div>
  3. <search :placeholder="placeholder" @searchActive="searchActive"></search>
  4. <tableLayout :layout="tablecols" :data="list" :opwidth="200" :custom="true" :height="tableHieght">
  5. <template v-slot:customcol="scope">
  6. <div v-if="scope.column.columnname === 'isonsale' ">
  7. <span v-if="scope.column.data[scope.column.columnname] === 0"
  8. >下架
  9. </span>
  10. <span v-if="scope.column.data[scope.column.columnname] === 1"
  11. >上架
  12. </span>
  13. </div>
  14. <p v-else-if="scope.column.columnname === 'status'">
  15. <span style="color:#52C41A" v-if="scope.column.data[[scope.column.columnname]] == '审核'">{{scope.column.data[[scope.column.columnname]]}}</span>
  16. <span style="color:#000000" v-else-if="scope.column.data[[scope.column.columnname]] == '新建'">{{scope.column.data[[scope.column.columnname]]}}</span>
  17. </p>
  18. <p v-else>{{scope.column.data[scope.column.columnname]}}</p>
  19. </template>
  20. <template v-slot:opreation="scope">
  21. <div>
  22. <slot name="del" :data="scope.data"></slot>
  23. </div>
  24. </template>
  25. </tableLayout>
  26. <div style="margin-top:16px;text-align:right">
  27. <el-pagination
  28. background
  29. small
  30. @size-change="handleSizeChange"
  31. @current-change="handleCurrentChange"
  32. :current-page="currentPage"
  33. :page-size="params.content.pageSize"
  34. layout="total, prev, pager, next, jumper"
  35. :total="total">
  36. </el-pagination>
  37. </div>
  38. </div>
  39. </template>
  40. <script>
  41. import search from './search'
  42. export default {
  43. name: "relationList",
  44. props:["id"],
  45. data(){
  46. return {
  47. placeholder:'商品名称',
  48. tableHieght:420,
  49. list:[],
  50. tablecols:[],
  51. total:0,
  52. currentPage:0,
  53. params:{
  54. "id": "20220926102103",
  55. "version":1,
  56. "content": {
  57. "plm_technicalinfoid":this.id,
  58. "where":{
  59. "condition":"",
  60. "itemid":""
  61. }
  62. }
  63. }
  64. }
  65. },
  66. components:{
  67. search
  68. },
  69. mounted() {
  70. this.listData()
  71. },
  72. methods:{
  73. async listData(){
  74. const res = await this.$api.requested(this.params)
  75. this.list = res.data
  76. this.total = res.total
  77. this.currentPage = res.pageTotal
  78. console.log(res)
  79. },
  80. handleSizeChange(val) {
  81. // console.log(`每页 ${val} 条`);
  82. this.params.content.pageSize = val
  83. this.listData()
  84. },
  85. handleCurrentChange(val) {
  86. // console.log(`当前页: ${val}`);
  87. this.params.content.pageNumber = val
  88. this.listData()
  89. },
  90. searchActive(data){
  91. this.params.content.where.condition = data
  92. this.listData()
  93. }
  94. },
  95. created() {
  96. this.tablecols = this.tool.tabelCol(this.$route.name).relationProductTable.tablecols
  97. }
  98. }
  99. </script>
  100. <style scoped>
  101. </style>