invoiceTable.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <template>
  2. <div>
  3. <el-table
  4. ref="table"
  5. :data="list"
  6. style="width: 100%"
  7. border
  8. size="mini"
  9. highlight-current-row
  10. @selection-change="onSelection"
  11. @row-click="activeRow">
  12. <el-table-column
  13. type="selection"
  14. align="center">
  15. </el-table-column>
  16. <el-table-column
  17. prop="sa_invoicebillid"
  18. label="发票ID"
  19. width="180">
  20. </el-table-column>
  21. <el-table-column
  22. prop="sumtaxincludedamount"
  23. label="发票金额"
  24. width="180">
  25. </el-table-column>
  26. <el-table-column
  27. prop="invoiceserialnum"
  28. label="发票流水号">
  29. </el-table-column>
  30. <el-table-column
  31. prop="invoicecode"
  32. label="发票代码">
  33. </el-table-column>
  34. <el-table-column
  35. prop="invoiceno"
  36. label="发票号码">
  37. </el-table-column>
  38. <el-table-column
  39. prop="remarks"
  40. label="反馈消息">
  41. </el-table-column>
  42. <el-table-column
  43. prop="status"
  44. label="发票状态">
  45. </el-table-column>
  46. <el-table-column
  47. fixed="right"
  48. label="操作"
  49. width="90">
  50. <template slot-scope="scope">
  51. <el-button v-if="tool.checkAuth($route.name,'editBlueInvioce')" @click="editRow(scope.row)" type="text" size="mini" :disabled="status !== '新建'">编 辑</el-button>
  52. <el-button v-if="tool.checkAuth($route.name,'editBlueInvioce')" @click="deleteRow(scope.row)" type="text" size="mini" :disabled="status !== '新建'">删 除</el-button>
  53. </template>
  54. </el-table-column>
  55. </el-table>
  56. <div class="container" style="text-align:right">
  57. <el-pagination
  58. background
  59. small
  60. @size-change="handleSizeChange"
  61. @current-change="handleCurrentChange"
  62. :current-page="currentPage"
  63. :page-sizes="[20, 50, 100, 200]"
  64. layout="total,sizes, prev, pager, next, jumper"
  65. :total="total">
  66. </el-pagination>
  67. </div>
  68. <el-dialog title="编辑发票" :visible.sync="dialogFormVisible" width="500px" append-to-body>
  69. <el-form :model="form" size="small" label-position="right" label-width="100px">
  70. <el-form-item label="备注">
  71. <el-input v-model="form.remarks" autocomplete="off" type="textarea" :autosize="{minRows:3}" placeholder="请输入备注"></el-input>
  72. </el-form-item>
  73. </el-form>
  74. <div slot="footer" class="dialog-footer">
  75. <el-button @click="dialogFormVisible = false" size="small">取 消</el-button>
  76. <el-button type="primary" @click="submit" size="small">确 定</el-button>
  77. </div>
  78. </el-dialog>
  79. </div>
  80. </template>
  81. <script>
  82. export default {
  83. props:['status'],
  84. data () {
  85. return {
  86. dialogFormVisible:false,
  87. form:{},
  88. param:{
  89. "id": "20221223153403",
  90. "pageNumber":1,
  91. "pageSize":20,
  92. "content": {
  93. "sa_invoiceapplyid":this.$route.query.id,
  94. "where":{
  95. "rb":1
  96. }
  97. }
  98. },
  99. list:[],
  100. total:0,
  101. currentPage:0,
  102. }
  103. },
  104. methods:{
  105. async listData () {
  106. const res = await this.$api.requested(this.param)
  107. this.list = res.data
  108. this.total = res.total
  109. this.currentPage = res.pageNumber
  110. if (res.data.length > 0) {
  111. this.activeRow(res.data[0])
  112. this.$refs.table.setCurrentRow(this.list[0])
  113. }
  114. },
  115. handleSizeChange(val) {
  116. // console.log(`每页 ${val} 条`);
  117. this.param.content.pageSize = val
  118. this.listData()
  119. },
  120. handleCurrentChange(val) {
  121. // console.log(`当前页: ${val}`);
  122. this.param.content.pageNumber = val
  123. this.listData()
  124. },
  125. activeRow (row) {
  126. this.$emit('activeRow',row)
  127. },
  128. onSelection (selection) {
  129. this.$emit('selection',selection)
  130. },
  131. async deleteRow (row) {
  132. const res = await this.$api.requested({
  133. "id": "20221223160103",
  134. "content": {
  135. "sa_invoicebillids":[row.sa_invoicebillid]
  136. }
  137. })
  138. this.tool.showMessage(res,()=>{
  139. this.listData()
  140. })
  141. },
  142. editRow (row) {
  143. this.form = Object.assign({},this.form,row)
  144. this.dialogFormVisible = true
  145. },
  146. async submit () {
  147. const res = await this.$api.requested({
  148. "id": "20221223154403",
  149. "content": {
  150. "sa_invoicebillid":this.form.sa_invoicebillid,
  151. "remarks":this.form.remarks
  152. }
  153. })
  154. this.tool.showMessage(res,()=>{
  155. this.listData()
  156. this.dialogFormVisible = false
  157. })
  158. }
  159. },
  160. mounted () {
  161. this.listData()
  162. }
  163. }
  164. </script>
  165. <style>
  166. </style>