Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

userDefinedGroupsPage.vue 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <template>
  2. <!-- eslint-disable max-len -->
  3. <div>
  4. <section class="intro-single">
  5. <div class="container">
  6. <div class="row">
  7. <div class="col-md-12 col-lg-8">
  8. <div class="title-single-box">
  9. <h2 class="title-single">User Defined Groups List</h2>
  10. </div>
  11. </div>
  12. </div>
  13. </div>
  14. </section>
  15. <div class="container">
  16. <button type="button" @click="New()" class="btn btn-b-n" style="width: 85px; height:40px;">New</button>
  17. <table class="table table-bordered">
  18. <thead>
  19. <tr>
  20. <th>Description</th>
  21. <th>Property Type</th>
  22. <th>Order</th>
  23. <th></th>
  24. <th></th>
  25. </tr>
  26. </thead>
  27. <tbody>
  28. <tr v-for="(item, i) in userDefinedGroups" :key="i">
  29. <td>{{item.description}}</td>
  30. <td v-if="item.usageType === 0">Residential</td>
  31. <td v-else-if="item.usageType === 1">Commercial</td>
  32. <td v-else>Both</td>
  33. <td>{{item.rank}}</td>
  34. <td>
  35. <button
  36. type="button"
  37. @click="Edit(item.id)"
  38. class="btn btn-b-n"
  39. style="width: 85px; height:40px;"
  40. >Edit</button>
  41. </td>
  42. <td>
  43. <button
  44. type="button"
  45. @click="Delete(item)"
  46. class="btn btn-b-n"
  47. style="width: 85px; height:40px;"
  48. >Delete</button>
  49. </td>
  50. </tr>
  51. </tbody>
  52. </table>
  53. </div>
  54. </div>
  55. </template>
  56. <script>
  57. import { mapState, mapActions } from 'vuex';
  58. export default {
  59. name: 'UserDefinedGroup',
  60. mounted() {
  61. this.getUserDefinedGroups();
  62. },
  63. computed: {
  64. ...mapState('propertyAdmin', ['userDefinedGroups']),
  65. },
  66. methods: {
  67. ...mapActions('propertyAdmin', [
  68. 'getUserDefinedGroups',
  69. 'deleteUserDefinedGroup',
  70. ]),
  71. New() {
  72. this.$router.push('/userDefinedGroups/userDefinedGroup');
  73. },
  74. Edit(id) {
  75. this.$router.push(`/userDefinedGroups/userDefinedGroup/${id}`);
  76. },
  77. Delete(item) {
  78. if (item.id === 0) {
  79. this.userDefinedGroups.pop(item);
  80. }
  81. this.deleteUserDefinedGroup(item.id);
  82. },
  83. },
  84. };
  85. </script>