CreditLimit.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <template>
  2. <div class="app-container">
  3. <div class="filter-container right">
  4. <el-button
  5. v-if="!$route.meta.onlyView"
  6. class="filter-item"
  7. type="primary"
  8. icon="el-icon-plus"
  9. @click="addCreditLimit">
  10. Add Credit Limit
  11. </el-button>
  12. </div>
  13. <el-table
  14. v-loading="listLoading"
  15. :data="tableList"
  16. fit
  17. :row-class-name="({row})=>'read'+row.readStatus"
  18. style="width: 100%;">
  19. <!--el-table-column
  20. label="ID"
  21. align="center"
  22. class-name="fixed-width">
  23. <template slot-scope="{row}">
  24. <a class="link-detail" href="javascript:void(0);" @click="viewCreditLimit(row)">{{ row.groupCreditPk }}</a>
  25. </template>
  26. </el-table-column-->
  27. <el-table-column
  28. label="Group"
  29. align="center"
  30. min-width="120">
  31. <template slot-scope="{row}">{{ row.groupName }}</template>
  32. </el-table-column>
  33. <el-table-column
  34. label="Monthly Credit Limit"
  35. align="center"
  36. min-width="140">
  37. <template slot-scope="{row}">{{ row.creditLimitAmount }}</template>
  38. </el-table-column>
  39. <el-table-column
  40. label="Remaining Credit Limit"
  41. align="center"
  42. min-width="140">
  43. <template slot-scope="{row}">{{ row.creditLimitRemainingAmount }}</template>
  44. </el-table-column>
  45. <el-table-column
  46. label="Effective Date"
  47. align="center"
  48. min-width="120">
  49. <template slot-scope="{row}">{{ row.effectiveStartDate }}</template>
  50. </el-table-column>
  51. <el-table-column
  52. label="Status"
  53. align="center"
  54. min-width="100">
  55. <template slot-scope="{row}">{{ row.dataStatus }}</template>
  56. </el-table-column>
  57. <el-table-column
  58. label="Action"
  59. align="center"
  60. min-width="140">
  61. <template slot-scope="{row}">
  62. <TableAction
  63. :showEdit="!$route.meta.onlyView"
  64. :showView="$route.meta.onlyView"
  65. @edit="editLimit(row)"
  66. @delete="deleteLimit(row)"
  67. @view="viewCreditLimit(row)"/>
  68. </template>
  69. </el-table-column>
  70. </el-table>
  71. <div class="right">
  72. <Pagination
  73. v-show="total > 0"
  74. :total="total"
  75. :page.sync="listQuery.pageNo"
  76. :limit.sync="listQuery.pageSize"
  77. @pagination="handlePageChange" />
  78. </div>
  79. </div>
  80. </template>
  81. <script>
  82. import Pagination from '@/components/Pagination'
  83. import TableAction from '@/components/TableAction.vue'
  84. import limit from '../../http/api/limit.js'
  85. export default {
  86. components: { Pagination, TableAction },
  87. data() {
  88. return {
  89. listLoading: false,
  90. tableList: [],
  91. total: 0,
  92. listQuery: {
  93. pageNo: 1,
  94. pageSize: 10,
  95. pageVo: {
  96. criteria: ""
  97. }
  98. },
  99. }
  100. },
  101. created() {
  102. this.listLoading = true;
  103. this.getList();
  104. },
  105. methods: {
  106. handleFilter() {
  107. this.listLoading = true;
  108. this.listQuery.page = 1;
  109. this.getList();
  110. },
  111. handlePageChange() {
  112. this.listLoading = true;
  113. this.getList();
  114. },
  115. getList() {
  116. limit.getCreditLimitPages(this.listQuery).then(res => {
  117. this.listLoading = false;
  118. this.total = res.total;
  119. this.tableList = res.data
  120. }).catch(err => {
  121. this.listLoading = false;
  122. });
  123. },
  124. addCreditLimit() {
  125. this.$router.push({
  126. path: '/partnership-management/monthly-credit-management/add'
  127. });
  128. },
  129. editLimit(row) {
  130. //this.$store.commit('provider/SET_CreditLimit', row);
  131. this.$router.push({
  132. path: '/partnership-management/monthly-credit-management/edit/' + row.groupCreditPk
  133. });
  134. },
  135. viewCreditLimit(row) {
  136. this.$store.commit('provider/SET_CreditLimit', row);
  137. this.$router.push({
  138. path: '/partnership-management/monthly-credit-management/limit/' + row.groupCreditPk
  139. });
  140. },
  141. deleteLimit(row) {
  142. this.$confirm('Are you sure you want to delete this credit limit?', 'Delete', {
  143. confirmButtonText: 'OK',
  144. cancelButtonText: 'Cancel',
  145. type: 'warning'
  146. }).then(res => {
  147. this.handleDeleteLimit(row.groupCreditPk)
  148. })
  149. },
  150. handleDeleteLimit(id) {
  151. limit.deleteCreditLimit(id).then(res => {
  152. this.$message({
  153. message: 'Delete credit limit successfully',
  154. type: 'success'
  155. });
  156. this.listLoading = true;
  157. this.getList();
  158. }).catch(err => {
  159. this.$message({
  160. message: err,
  161. type: 'error'
  162. })
  163. })
  164. }
  165. }
  166. }
  167. </script>
  168. <style>
  169. .link-detail {
  170. text-decoration: underline;
  171. }
  172. </style>