supplier.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. <!-- 供应商账款 -->
  2. <template>
  3. <div class="customer">
  4. <template v-if="!detailVisible">
  5. <el-form :inline="true" :model="dataForm" @keyup.enter.native="search()">
  6. <el-form-item label="供应商名称">
  7. <el-input v-model="dataForm.supplierName" placeholder="供应商名称" clearable/>
  8. </el-form-item>
  9. <el-form-item label="客户级别">
  10. <el-select
  11. v-model="dataForm.level"
  12. remote
  13. clearable
  14. placeholder="请选择">
  15. <el-option
  16. v-for="item in options"
  17. :key="item.code"
  18. :label="item.value"
  19. :value="item.code">
  20. </el-option>
  21. </el-select>
  22. </el-form-item>
  23. <el-form-item>
  24. <el-button @click="search()">查询</el-button>
  25. </el-form-item>
  26. </el-form>
  27. <el-table
  28. :data="dataList"
  29. border
  30. v-loading="dataListLoading"
  31. style="width: 100%;">
  32. <el-table-column
  33. label="序号"
  34. type="index"
  35. width="50"
  36. align="center">
  37. </el-table-column>
  38. <el-table-column
  39. prop="supplierName"
  40. header-align="center"
  41. align="center"
  42. min-width="120"
  43. :show-tooltip-when-overflow="true"
  44. label="供应商名称">
  45. </el-table-column>
  46. <el-table-column
  47. prop="level"
  48. :formatter="levelFormat"
  49. header-align="center"
  50. align="center"
  51. label="级别">
  52. </el-table-column>
  53. <el-table-column
  54. prop="contact"
  55. header-align="center"
  56. align="center"
  57. min-width="120"
  58. label="对接业务员">
  59. </el-table-column>
  60. <el-table-column
  61. prop="paidAmount"
  62. header-align="center"
  63. align="center"
  64. min-width="120"
  65. label="已付金额">
  66. </el-table-column>
  67. <el-table-column
  68. prop="notPaidAmount"
  69. header-align="center"
  70. align="center"
  71. width="200"
  72. :show-tooltip-when-overflow="true"
  73. label="待付金额">
  74. </el-table-column>
  75. <el-table-column
  76. prop="invoicedAmount"
  77. header-align="center"
  78. align="center"
  79. label="已开票金额">
  80. </el-table-column>
  81. <el-table-column
  82. prop="notes"
  83. header-align="center"
  84. align="center"
  85. min-width="180"
  86. :show-tooltip-when-overflow="true"
  87. label="备注">
  88. </el-table-column>
  89. <el-table-column
  90. fixed="right"
  91. header-align="center"
  92. align="center"
  93. width="150"
  94. label="操作">
  95. <template slot-scope="scope">
  96. <el-button v-if="isAuth('fin:supplier:info')" type="text" size="small" @click="detailHandle(scope.row.supplierId)">详情</el-button>
  97. </template>
  98. </el-table-column>
  99. </el-table>
  100. <el-pagination
  101. @size-change="sizeChangeHandle"
  102. @current-change="currentChangeHandle"
  103. :current-page="pageIndex"
  104. :page-sizes="[10, 20, 50, 100]"
  105. :page-size="pageSize"
  106. :total="totalPage"
  107. layout="total, sizes, prev, pager, next, jumper">
  108. </el-pagination>
  109. </template>
  110. <!-- 弹窗, 新增 / 修改 -->
  111. <supplier-detail v-if="detailVisible" ref="detail" @onChose="onChose"/>
  112. </div>
  113. </template>
  114. <script>
  115. import supplierDetail from './supplier-detail'
  116. import { getLevel } from '@/api/cus'
  117. import { getSupplierList } from '@/api/finance'
  118. export default {
  119. name: 'supplier',
  120. components: {
  121. supplierDetail
  122. },
  123. data () {
  124. return {
  125. detailVisible: false,
  126. dataForm: {
  127. supplierName: '',
  128. level: ''
  129. },
  130. options: [],
  131. dataList: [],
  132. pageIndex: 1,
  133. pageSize: 10,
  134. totalPage: 0,
  135. dataListLoading: false,
  136. dataListSelections: []
  137. }
  138. },
  139. created () {
  140. this.getLevel()
  141. this.getDataList()
  142. },
  143. methods: {
  144. onChose () {
  145. this.addOrUpdateVisible = false
  146. this.detailVisible = false
  147. },
  148. // 查询
  149. search () {
  150. this.pageIndex = 1
  151. this.getDataList()
  152. },
  153. getLevel () {
  154. getLevel().then(({data}) => {
  155. if (data && data.code === '200') {
  156. this.options = data.data
  157. }
  158. })
  159. },
  160. // 获取数据列表
  161. getDataList () {
  162. this.dataListLoading = true
  163. let params = {
  164. 'current': this.pageIndex,
  165. 'size': this.pageSize,
  166. 'supplierName': this.dataForm.supplierName,
  167. 'level': this.dataForm.level
  168. }
  169. getSupplierList(params).then(({data}) => {
  170. if (data && data.code === '200') {
  171. this.dataList = data.data.records
  172. this.totalPage = Number(data.data.total)
  173. } else {
  174. this.dataList = []
  175. this.totalPage = 0
  176. }
  177. this.dataListLoading = false
  178. })
  179. },
  180. // 每页数
  181. sizeChangeHandle (val) {
  182. this.pageSize = val
  183. this.pageIndex = 1
  184. this.getDataList()
  185. },
  186. // 当前页
  187. currentChangeHandle (val) {
  188. this.pageIndex = val
  189. this.getDataList()
  190. },
  191. // 多选
  192. selectionChangeHandle (val) {
  193. this.dataListSelections = val
  194. },
  195. // 转换属性“级别”
  196. levelFormat (row) {
  197. for (let i = 0; i < this.options.length; i++) {
  198. if (this.options[i].code === row.level) {
  199. return this.options[i].value
  200. }
  201. }
  202. },
  203. detailHandle (id) {
  204. this.detailVisible = true
  205. this.$nextTick(() => {
  206. this.$refs.detail.init(id)
  207. })
  208. }
  209. }
  210. }
  211. </script>
  212. <style scoped>
  213. </style>