salesHistory.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <template>
  2. <div class="container normal-panel">
  3. <!-- 表格搜索 -->
  4. <div class="flex-align-center search-panel normal-margin">
  5. <el-input style="width:200px;margin-right:16px" size="small" placeholder="单号" @keyup.native.enter="listData(null,1)" @clear="listData(null,1)" v-model="params.content.where.condition" prefix-icon="el-icon-search" clearable></el-input>
  6. <time-select @clearSelect="clearTime" @timeChange="timeChange"></time-select>
  7. </div>
  8. <!-- 表格主题 -->
  9. <tableLayout v-if="tablecols && list" :layout="tablecols" :data="list" :opwidth="200" :custom="true" :fixedName="'operation'" height="300px" @rowClick="rowClick">
  10. <template v-slot:customcol="scope">
  11. <div v-if="scope.column.columnname === 'baseonproject'">
  12. <span>{{scope.column.data.baseonproject === 1?'按项目及产品预测':'按产品预测'}}</span>
  13. </div>
  14. <div v-else-if="scope.column.columnname == 'periodtype'">
  15. <span>
  16. {{scope.column.data.periodpoint | timer(scope.column.data[scope.column.columnname])}}
  17. </span>
  18. </div>
  19. <p v-else>{{scope.column.data[scope.column.columnname]}}</p>
  20. </template>
  21. <template v-slot:opreation="scope">
  22. <slot name="detail" :data="scope.data"></slot>
  23. <slot name="edit" :data="scope.data"></slot>
  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 TimeSelect from '@/SManagement/submitedit_one/components/TimeSelect'
  42. export default {
  43. props:['mainData'],
  44. components:{
  45. TimeSelect
  46. },
  47. data () {
  48. return {
  49. params:{
  50. "id": 20220908134403,
  51. "version": 1,
  52. "content": {
  53. "nocache": true,
  54. "sa_salesforecastmodelid": "",
  55. "where": {
  56. "begindate": "",
  57. "enddate": "",
  58. "condition":""
  59. }
  60. }
  61. },
  62. tablecols:[],
  63. list:[],
  64. total:0,
  65. currentPage:0,
  66. }
  67. },
  68. filters: {
  69. timer (val, type) {
  70. if (type == '月') {
  71. return '每月' + val.substr(1, val.length - 2) + '日'
  72. } else {
  73. return '每周' + val.substr(1, val.length - 2)
  74. }
  75. }
  76. },
  77. methods:{
  78. async listData (sa_salesforecastmodelid,pageNumber) {
  79. this.params.content.pageNumber = pageNumber
  80. this.params.content.sa_salesforecastmodelid = this.mainData.sa_salesforecastmodelid
  81. const res = await this.$api.requested(this.params)
  82. this.list = res.data
  83. this.total = res.total
  84. this.currentPage = res.pageNumber
  85. },
  86. handleSizeChange(val) {
  87. // console.log(`每页 ${val} 条`);
  88. this.params.content.pageSize = val
  89. this.listData(null,this.params.content.pageNumber)
  90. },
  91. handleCurrentChange(val) {
  92. // console.log(`当前页: ${val}`);
  93. this.params.content.pageNumber = val
  94. this.listData(null,val)
  95. },
  96. /* 时间赛选改变 */
  97. timeChange (time) {
  98. this.params.content.where.begindate = time[0]
  99. this.params.content.where.enddate = time[1]
  100. this.listData()
  101. },
  102. /* 清除时间赛选 */
  103. clearTime () {
  104. this.params.content.where.begindate = ''
  105. this.params.content.where.enddate = ''
  106. this.listData()
  107. },
  108. rowClick (row) {
  109. this.$emit('tableRowClick',row)
  110. },
  111. },
  112. mounted () {
  113. this.listData()
  114. this.tablecols = this.tool.tabelCol(this.$route.name)['salesHistoryTable'].tablecols
  115. },
  116. created () {
  117. }
  118. }
  119. </script>
  120. <style>
  121. </style>
  122. <style scoped>
  123. .search-panel p{
  124. width:40px;
  125. font-size:14px
  126. }
  127. </style>