BillingAccount.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. <template>
  2. <div class="app-container">
  3. <div class="filter-container">
  4. <div class="filter-view">
  5. <el-select
  6. class="filter-input"
  7. placeholder="Account Type"
  8. clearable
  9. @change="onClickSearch"
  10. v-model="filters.pageVo.accountType">
  11. <el-option
  12. v-for="(item,index) in options.types"
  13. :key="index"
  14. :label="item"
  15. :value="item"/>
  16. </el-select>
  17. <el-input
  18. v-model="filters.pageVo.criteria"
  19. placeholder="Entity Name, POC Name, POC Email"
  20. prefix-icon="el-icon-search"
  21. style="max-width: 300px;"
  22. @change="onClickSearch"
  23. @keyup.enter.native="onClickSearch"
  24. clearable/>
  25. </div>
  26. </div>
  27. <el-table
  28. v-loading="table.loading"
  29. :data="table.list">
  30. <el-table-column
  31. align="center"
  32. label="Entity Name"
  33. prop="entityName"
  34. min-width="150"/>
  35. <el-table-column
  36. align="center"
  37. label="Account Type"
  38. prop="accountType"
  39. min-width="150"/>
  40. <el-table-column
  41. align="center"
  42. label="POC Name"
  43. prop="pocName"
  44. min-width="150"/>
  45. <el-table-column
  46. align="center"
  47. label="POC Email"
  48. prop="pocEmail"
  49. min-width="150"/>
  50. <el-table-column
  51. align="center"
  52. label="Effective Date"
  53. prop="effectiveDate"
  54. min-width="150"/>
  55. <el-table-column
  56. align="center"
  57. label="Billing Date"
  58. prop="billingDate"
  59. min-width="150"/>
  60. <el-table-column
  61. align="center"
  62. label="Update Date Time"
  63. prop="updateDateTime"
  64. min-width="150"/>
  65. <el-table-column
  66. align="center"
  67. label="Status"
  68. prop="status"
  69. min-width="120"/>
  70. <el-table-column
  71. align="center"
  72. label="Action"
  73. min-width="80"
  74. v-if="!$route.meta.onlyView">
  75. <template v-slot="{ row }">
  76. <el-dropdown
  77. class="action-dropdown"
  78. @command="(v) => handleCommand(v, row)"
  79. v-if="row.status != 'Inactive'">
  80. <i class="el-icon-more icon-action"></i>
  81. <el-dropdown-menu slot="dropdown">
  82. <el-dropdown-item
  83. command="onClickEdit">
  84. Edit
  85. </el-dropdown-item>
  86. <el-dropdown-item
  87. command="assignGroups"
  88. v-if="row.accountType == 'Corporate'">
  89. Assign Groups
  90. </el-dropdown-item>
  91. <el-dropdown-item
  92. command="assignSites"
  93. v-else>
  94. Assign Sites
  95. </el-dropdown-item>
  96. <el-dropdown-item
  97. command="onClickDelete">
  98. Delete
  99. </el-dropdown-item>
  100. </el-dropdown-menu>
  101. </el-dropdown>
  102. </template>
  103. </el-table-column>
  104. </el-table>
  105. <div class="right">
  106. <pagination
  107. v-show="table.total > 0"
  108. :total="table.total"
  109. :page.sync="filters.pageNo"
  110. :limit.sync="filters.pageSize"
  111. @pagination="getTableData" />
  112. </div>
  113. <Assignment
  114. v-bind="assign"
  115. @hide="hideAssiment"/>
  116. </div>
  117. </template>
  118. <script>
  119. import financial from '@/http/api/financial';
  120. import Assignment from './assignment.vue'
  121. import Pagination from '@/components/Pagination'
  122. export default {
  123. data() {
  124. return {
  125. filters: {
  126. pageNo: 1,
  127. pageSize: 10,
  128. pageVo: {
  129. criteria: "",
  130. accountType: ""
  131. }
  132. },
  133. table: {
  134. list: [],
  135. total: 0,
  136. loading: false
  137. },
  138. options: {
  139. types: []
  140. },
  141. assign: {
  142. item: {},
  143. visible: false,
  144. isGroup: false
  145. }
  146. };
  147. },
  148. components: { Pagination, Assignment },
  149. created() {
  150. this.getAccountTypeOptions();
  151. this.onClickSearch();
  152. },
  153. methods: {
  154. onClickSearch() {
  155. this.filters.pageNo = 1
  156. this.getTableData()
  157. },
  158. getAccountTypeOptions() {
  159. financial.getBillingAccountTypes().then(res => {
  160. if (res.data) {
  161. this.options.types = res.data
  162. }
  163. }).catch(err => {
  164. this.$message({
  165. message: error,
  166. type: 'error'
  167. })
  168. })
  169. },
  170. getTableData() {
  171. this.table.loading = true;
  172. financial.getBillingAccountPages(this.filters).then(res => {
  173. if (res.data && res.total) {
  174. this.table.total = res.total;
  175. this.table.list = res.data;
  176. } else {
  177. this.table.total = 0;
  178. this.table.list = [];
  179. }
  180. }).catch(err => {
  181. this.$message({
  182. type: 'error',
  183. message: err
  184. })
  185. this.table.total = 0;
  186. this.table.list = [];
  187. }).finally(() => {
  188. this.table.loading = false;
  189. })
  190. },
  191. handleCommand(cb, item) {
  192. this[cb](item)
  193. },
  194. onClickAdd() {
  195. this.$router.push({
  196. path: "/financial-management/billing-account-add"
  197. })
  198. },
  199. onClickEdit(row) {
  200. this.$router.push({
  201. path: "/financial-management/billing-account-edit/" + row.entityId
  202. })
  203. },
  204. onClickDelete(row) {
  205. this.$confirm('Are you sure you want to delete this item?', 'Set Inactive', {
  206. confirmButtonText: 'OK',
  207. cancelButtonText: 'Cancel',
  208. type: 'warning'
  209. }).then(res => {
  210. this.deleteEntity(row.entityId);
  211. })
  212. },
  213. assignSites(row) {
  214. this.assign.item = row;
  215. this.assign.isGroup = false;
  216. this.assign.visible = true;
  217. },
  218. assignGroups(row) {
  219. this.assign.item = row;
  220. this.assign.isGroup = true;
  221. this.assign.visible = true;
  222. },
  223. hideAssiment(e) {
  224. this.assign.item = {};
  225. this.assign.visible = false;
  226. this.assign.isGroup = false;
  227. if (e) {
  228. this.getTableData();
  229. }
  230. },
  231. deleteEntity(id) {
  232. this.loading = true;
  233. financial.deleteBillingAccount(id).then(res => {
  234. this.$message({
  235. type: 'success',
  236. message: "Set inactive success."
  237. })
  238. this.getTableData()
  239. }).catch(err => {
  240. this.$message({
  241. type: 'error',
  242. message: err
  243. })
  244. this.loading = false;
  245. })
  246. }
  247. }
  248. }
  249. </script>
  250. <style scoped>
  251. </style>