supplier-invoice-list.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. <template>
  2. <div class="supplier-invoice-list">
  3. <template v-if="!detailVisible">
  4. <el-form :inline="true" :model="dataForm" @keyup.enter.native="search()">
  5. <el-form-item label="发票号">
  6. <el-input v-model="dataForm.invoiceNumber" placeholder="发票号" clearable/>
  7. </el-form-item>
  8. <el-form-item label="开票日期">
  9. <el-date-picker
  10. v-model="dataForm.createTime"
  11. type="date"
  12. value-format="yyyy-MM-dd">
  13. </el-date-picker>
  14. </el-form-item>
  15. <el-form-item>
  16. <el-button @click="search()">查询</el-button>
  17. </el-form-item>
  18. </el-form>
  19. <el-table
  20. :data="dataList"
  21. border
  22. v-loading="dataListLoading"
  23. style="width: 100%;">
  24. <el-table-column
  25. label="序号"
  26. type="index"
  27. width="50"
  28. align="center">
  29. </el-table-column>
  30. <el-table-column
  31. prop="code"
  32. header-align="center"
  33. align="center"
  34. min-width="120"
  35. :show-tooltip-when-overflow="true"
  36. label="发票编码">
  37. </el-table-column>
  38. <el-table-column
  39. prop="type"
  40. :formatter="typeFormat"
  41. header-align="center"
  42. align="center"
  43. label="发票类型">
  44. </el-table-column>
  45. <el-table-column
  46. prop="createTime"
  47. header-align="center"
  48. align="center"
  49. min-width="120"
  50. label="开票日期">
  51. </el-table-column>
  52. <el-table-column
  53. prop="typeCode"
  54. header-align="center"
  55. align="center"
  56. min-width="120"
  57. label="发票类别代码">
  58. </el-table-column>
  59. <el-table-column
  60. prop="invoiceNumber"
  61. header-align="center"
  62. align="center"
  63. min-width="120"
  64. label="发票号">
  65. </el-table-column>
  66. <el-table-column
  67. prop="creatorName"
  68. header-align="center"
  69. align="center"
  70. min-width="120"
  71. label="开票人">
  72. </el-table-column>
  73. <el-table-column
  74. prop="invoiceAmount"
  75. header-align="center"
  76. align="center"
  77. min-width="120"
  78. label="发票金额">
  79. </el-table-column>
  80. <el-table-column
  81. prop="notes"
  82. header-align="center"
  83. align="center"
  84. min-width="180"
  85. :show-tooltip-when-overflow="true"
  86. label="备注">
  87. </el-table-column>
  88. <el-table-column
  89. fixed="right"
  90. header-align="center"
  91. align="center"
  92. width="150"
  93. label="操作">
  94. <template slot-scope="scope">
  95. <el-button v-if="true" type="text" size="small" @click="detailHandle(scope.row.purchaseInvoiceId)">详情</el-button>
  96. </template>
  97. </el-table-column>
  98. </el-table>
  99. <el-pagination
  100. @size-change="sizeChangeHandle"
  101. @current-change="currentChangeHandle"
  102. :current-page="pageIndex"
  103. :page-sizes="[10, 20, 50, 100]"
  104. :page-size="pageSize"
  105. :total="totalPage"
  106. layout="total, sizes, prev, pager, next, jumper">
  107. </el-pagination>
  108. </template>
  109. <!-- 弹窗, 新增 / 修改 -->
  110. <!-- <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @onChose="onClose"/> -->
  111. <detail v-if="detailVisible" ref="detail" @onChose="onClose"/>
  112. </div>
  113. </template>
  114. <script>
  115. import { getSupplierInvoiceInfo } from '@/api/finance'
  116. import Detail from './purchase-invoice-detail'
  117. export default {
  118. name: 'supplier-invoice-list',
  119. components: {
  120. Detail
  121. },
  122. props: {
  123. supplierId: {
  124. type: [Number, String],
  125. default: 0
  126. }
  127. },
  128. data () {
  129. return {
  130. detailVisible: false,
  131. addOrUpdateVisible: false,
  132. dataForm: {
  133. contractNumber: ''
  134. },
  135. options: [],
  136. dataList: [],
  137. pageIndex: 1,
  138. pageSize: 10,
  139. totalPage: 0,
  140. dataListLoading: false,
  141. dataListSelections: [],
  142. typeState: [ // 发票类型映射关系
  143. {
  144. code: '1',
  145. value: '增值税专用发票'
  146. },
  147. {
  148. code: '2',
  149. value: '增值税普通发票'
  150. },
  151. {
  152. code: '3',
  153. value: '形式发票'
  154. }
  155. ]
  156. }
  157. },
  158. created () {
  159. this.getDataList()
  160. },
  161. methods: {
  162. onClose () {
  163. console.log(3333)
  164. this.addOrUpdateVisible = false
  165. this.detailVisible = false
  166. this.$emit('changeDetailShow', false)
  167. },
  168. // 查询
  169. search () {
  170. this.pageIndex = 1
  171. this.getDataList()
  172. },
  173. // 获取数据列表
  174. getDataList () {
  175. this.dataListLoading = true
  176. let params = {
  177. 'current': this.pageIndex,
  178. 'size': this.pageSize,
  179. 'supplierId': this.supplierId,
  180. 'invoiceNumber': this.dataForm.invoiceNumber,
  181. 'createTime': this.dataForm.createTime
  182. }
  183. getSupplierInvoiceInfo(params).then(({data}) => {
  184. if (data && data.code === '200') {
  185. this.dataList = data.data.records
  186. this.totalPage = Number(data.data.total)
  187. } else {
  188. this.dataList = []
  189. this.totalPage = 0
  190. }
  191. this.dataListLoading = false
  192. })
  193. },
  194. // 每页数
  195. sizeChangeHandle (val) {
  196. this.pageSize = val
  197. this.pageIndex = 1
  198. this.getDataList()
  199. },
  200. // 当前页
  201. currentChangeHandle (val) {
  202. this.pageIndex = val
  203. this.getDataList()
  204. },
  205. // 多选
  206. selectionChangeHandle (val) {
  207. this.dataListSelections = val
  208. },
  209. // 转换属性“级别”
  210. typeFormat (row) {
  211. for (let i = 0; i < this.typeState.length; i++) {
  212. if (this.typeState[i].code === String(row.type)) {
  213. return this.typeState[i].value
  214. }
  215. }
  216. },
  217. detailHandle (id) {
  218. this.detailVisible = true
  219. this.$nextTick(() => {
  220. this.$refs.detail.init(id)
  221. })
  222. },
  223. // 新增/修改
  224. addOrUpdateHandle (id, customerAccount, disable) {
  225. console.log(customerAccount)
  226. this.addOrUpdateVisible = true
  227. this.$nextTick(() => {
  228. this.$refs.addOrUpdate.init(id, customerAccount, this.customerId, disable)
  229. })
  230. this.$emit('changeDetailShow', true)
  231. }
  232. }
  233. }
  234. </script>
  235. <style scoped>
  236. </style>