project.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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. "content": {
  66. "pageNumber":1,
  67. "pageSize":20,
  68. "sa_salesforecastbillid":this.$route.query.id,
  69. "where":{
  70. "condition":""
  71. }
  72. }
  73. },
  74. act_row:{},
  75. list:[],
  76. currentPage:0,
  77. total:0,
  78. checkDateOut:false,
  79. }
  80. },
  81. methods:{
  82. async listData () {
  83. console.log(this.$route.query.id)
  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. console.log(res,"项目")
  89. this.$emit('queryProduct',res.data[0].sa_projectid)
  90. },
  91. async deleteProject (row) {
  92. const res = await this.$api.requested({
  93. "id": 20220906155103,
  94. "version":1,
  95. "content": {
  96. "sa_salesforecastid":0,
  97. "sa_projectid":row.sa_projectid,
  98. "sa_salesforecastbillid":this.$route.query.id
  99. }
  100. })
  101. this.tool.showMessage(res,()=>{
  102. this.listData()
  103. })
  104. },
  105. handleSizeChange(val) {
  106. // console.log(`每页 ${val} 条`);
  107. this.param.content.pageSize = val
  108. this.listData()
  109. },
  110. handleCurrentChange(val) {
  111. // console.log(`当前页: ${val}`);
  112. this.param.content.pageNumber = val
  113. this.listData()
  114. },
  115. rowClick (row) {
  116. this.act_row = row
  117. this.$emit('queryProduct',row.sa_projectid)
  118. }
  119. },
  120. watch:{
  121. mainData (val) {
  122. let date = new Date(this.mainData.periodend)
  123. let now = Date.now()
  124. if (date.getTime() < now) {
  125. console.log('已过期')
  126. this.checkDateOut = false
  127. } else {
  128. console.log('未过期')
  129. this.checkDateOut = true
  130. }
  131. }
  132. },
  133. mounted () {
  134. this.listData()
  135. }
  136. }
  137. </script>
  138. <style>
  139. </style>