project.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <template>
  2. <div>
  3. <div class="flex-align-center flex-between mt-10">
  4. <el-input style="width:200px" prefix-icon="el-icon-search" size="small" placeholder="搜索项目名称" v-model="param.content.where.condition" @keyup.native.enter="listData(param.content.pageNumber = 1)" @clear="listData(param.content.pageNumber = 1)" clearable></el-input>
  5. <addProject v-if="checkDateOut && tool.checkAuth($route.name,'projectProductListManage')" :mainData="mainData" @onSuccess="listData(param.content.pageNumber = 1)"></addProject>
  6. </div>
  7. <el-table
  8. :data="list"
  9. style="width: 100%"
  10. size="mini"
  11. border
  12. @row-click="rowClick">
  13. <el-table-column
  14. prop="projectnum"
  15. label="项目编号">
  16. </el-table-column>
  17. <el-table-column
  18. prop="projectname"
  19. label="项目名称">
  20. </el-table-column>
  21. <el-table-column
  22. prop="projecttype"
  23. label="项目类型">
  24. </el-table-column>
  25. <el-table-column
  26. prop="sumprojectamount"
  27. label="金额">
  28. </el-table-column>
  29. <el-table-column
  30. label="操作"
  31. width="150">
  32. <template slot-scope="scope">
  33. <addProduct v-if="checkDateOut && tool.checkAuth($route.name,'projectProductListManage')" class="inline-16" :id="scope.row.sa_projectid" :mainData="mainData" @onSuccess="rowClick(act_row)"></addProduct>
  34. <el-button size="small" type="text" :disabled="!checkDateOut" @click="deleteProject(scope.row)">删 除{{scope.row.sa_salesforecastid}}</el-button>
  35. </template>
  36. </el-table-column>
  37. </el-table>
  38. <div class="container normal-panel flex-align-center flex-between">
  39. <p v-if="list[0]">金额合计:{{list[0].sumamount}}</p>
  40. <el-pagination
  41. background
  42. @size-change="handleSizeChange"
  43. @current-change="handleCurrentChange"
  44. :current-page="currentPage"
  45. :page-sizes="[20, 50, 100, 200]"
  46. layout="total,sizes, prev, pager, next, jumper"
  47. :total="total">
  48. </el-pagination>
  49. </div>
  50. </div>
  51. </template>
  52. <script>
  53. import addProject from '@/template/salesForecastUseProject/index.vue'
  54. import addProduct from '@/template/salesForecastUseProject/addProduct.vue'
  55. export default {
  56. props:['mainData'],
  57. components:{
  58. addProject,
  59. addProduct
  60. },
  61. data () {
  62. return {
  63. param:{
  64. "id": 20220916115203,
  65. "version":1,
  66. "content": {
  67. "pageNumber":1,
  68. "pageSize":20,
  69. "sa_salesforecastbillid":this.$route.query.id,
  70. "where":{
  71. "condition":""
  72. }
  73. }
  74. },
  75. act_row:null,
  76. list:[],
  77. currentPage:0,
  78. total:0,
  79. checkDateOut:false,
  80. }
  81. },
  82. methods:{
  83. async listData () {
  84. const res = await this.$api.requested(this.param)
  85. this.list = res.data
  86. this.total = res.total
  87. this.currentPage = res.pageNumber
  88. this.$emit('queryProduct',this.act_row?this.act_row:res.data[0].sa_projectid)
  89. },
  90. async deleteProject (row) {
  91. const res = await this.$api.requested({
  92. "id": 20220906155103,
  93. "version":1,
  94. "content": {
  95. "sa_salesforecastid":0,
  96. "sa_projectid":row.sa_projectid,
  97. "sa_salesforecastbillid":this.$route.query.id
  98. }
  99. })
  100. this.tool.showMessage(res,()=>{
  101. this.listData()
  102. })
  103. },
  104. handleSizeChange(val) {
  105. // console.log(`每页 ${val} 条`);
  106. this.param.content.pageSize = val
  107. this.listData()
  108. },
  109. handleCurrentChange(val) {
  110. // console.log(`当前页: ${val}`);
  111. this.param.content.pageNumber = val
  112. this.listData()
  113. },
  114. rowClick (row) {
  115. this.act_row = row
  116. this.$emit('queryProduct',row.sa_projectid)
  117. }
  118. },
  119. watch:{
  120. mainData (val) {
  121. let date = new Date(this.mainData.periodend)
  122. let now = Date.now()
  123. if (date.getTime() < now) {
  124. console.log('已过期')
  125. this.checkDateOut = false
  126. } else {
  127. console.log('未过期')
  128. this.checkDateOut = true
  129. }
  130. }
  131. },
  132. mounted () {
  133. this.listData()
  134. }
  135. }
  136. </script>
  137. <style>
  138. </style>