| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254 |
- <template>
- <div class="app-container">
- <div class="filter-container">
- <div class="filter-view">
- <el-select
- class="filter-input"
- placeholder="Account Type"
- clearable
- @change="onClickSearch"
- v-model="filters.pageVo.accountType">
- <el-option
- v-for="(item,index) in options.types"
- :key="index"
- :label="item"
- :value="item"/>
- </el-select>
- <el-input
- v-model="filters.pageVo.criteria"
- placeholder="Entity Name, POC Name, POC Email"
- prefix-icon="el-icon-search"
- style="max-width: 300px;"
- @change="onClickSearch"
- @keyup.enter.native="onClickSearch"
- clearable/>
- </div>
- </div>
- <el-table
- v-loading="table.loading"
- :data="table.list">
- <el-table-column
- align="center"
- label="Entity Name"
- prop="entityName"
- min-width="150"/>
- <el-table-column
- align="center"
- label="Account Type"
- prop="accountType"
- min-width="150"/>
- <el-table-column
- align="center"
- label="POC Name"
- prop="pocName"
- min-width="150"/>
- <el-table-column
- align="center"
- label="POC Email"
- prop="pocEmail"
- min-width="150"/>
- <el-table-column
- align="center"
- label="Effective Date"
- prop="effectiveDate"
- min-width="150"/>
- <el-table-column
- align="center"
- label="Billing Date"
- prop="billingDate"
- min-width="150"/>
- <el-table-column
- align="center"
- label="Update Date Time"
- prop="updateDateTime"
- min-width="150"/>
- <el-table-column
- align="center"
- label="Status"
- prop="status"
- min-width="120"/>
- <el-table-column
- align="center"
- label="Action"
- min-width="80"
- v-if="!$route.meta.onlyView">
- <template v-slot="{ row }">
- <el-dropdown
- class="action-dropdown"
- @command="(v) => handleCommand(v, row)"
- v-if="row.status != 'Inactive'">
- <i class="el-icon-more icon-action"></i>
- <el-dropdown-menu slot="dropdown">
- <el-dropdown-item
- command="onClickEdit">
- Edit
- </el-dropdown-item>
- <el-dropdown-item
- command="assignGroups"
- v-if="row.accountType == 'Corporate'">
- Assign Groups
- </el-dropdown-item>
- <el-dropdown-item
- command="assignSites"
- v-else>
- Assign Sites
- </el-dropdown-item>
- <el-dropdown-item
- command="onClickDelete">
- Delete
- </el-dropdown-item>
- </el-dropdown-menu>
- </el-dropdown>
- </template>
- </el-table-column>
- </el-table>
- <div class="right">
- <pagination
- v-show="table.total > 0"
- :total="table.total"
- :page.sync="filters.pageNo"
- :limit.sync="filters.pageSize"
- @pagination="getTableData" />
- </div>
- <Assignment
- v-bind="assign"
- @hide="hideAssiment"/>
- </div>
- </template>
- <script>
- import financial from '@/http/api/financial';
- import Assignment from './assignment.vue'
- import Pagination from '@/components/Pagination'
- export default {
- data() {
- return {
- filters: {
- pageNo: 1,
- pageSize: 10,
- pageVo: {
- criteria: "",
- accountType: ""
- }
- },
- table: {
- list: [],
- total: 0,
- loading: false
- },
- options: {
- types: []
- },
- assign: {
- item: {},
- visible: false,
- isGroup: false
- }
- };
- },
- components: { Pagination, Assignment },
- created() {
- this.getAccountTypeOptions();
- this.onClickSearch();
- },
- methods: {
- onClickSearch() {
- this.filters.pageNo = 1
- this.getTableData()
- },
- getAccountTypeOptions() {
- financial.getBillingAccountTypes().then(res => {
- if (res.data) {
- this.options.types = res.data
- }
- }).catch(err => {
- this.$message({
- message: error,
- type: 'error'
- })
- })
- },
- getTableData() {
- this.table.loading = true;
- financial.getBillingAccountPages(this.filters).then(res => {
- if (res.data && res.total) {
- this.table.total = res.total;
- this.table.list = res.data;
- } else {
- this.table.total = 0;
- this.table.list = [];
- }
- }).catch(err => {
- this.$message({
- type: 'error',
- message: err
- })
- this.table.total = 0;
- this.table.list = [];
- }).finally(() => {
- this.table.loading = false;
- })
- },
- handleCommand(cb, item) {
- this[cb](item)
- },
- onClickAdd() {
- this.$router.push({
- path: "/financial-management/billing-account-add"
- })
- },
- onClickEdit(row) {
- this.$router.push({
- path: "/financial-management/billing-account-edit/" + row.entityId
- })
- },
- onClickDelete(row) {
- this.$confirm('Are you sure you want to delete this item?', 'Set Inactive', {
- confirmButtonText: 'OK',
- cancelButtonText: 'Cancel',
- type: 'warning'
- }).then(res => {
- this.deleteEntity(row.entityId);
- })
- },
- assignSites(row) {
- this.assign.item = row;
- this.assign.isGroup = false;
- this.assign.visible = true;
- },
- assignGroups(row) {
- this.assign.item = row;
- this.assign.isGroup = true;
- this.assign.visible = true;
- },
- hideAssiment(e) {
- this.assign.item = {};
- this.assign.visible = false;
- this.assign.isGroup = false;
- if (e) {
- this.getTableData();
- }
- },
- deleteEntity(id) {
- this.loading = true;
- financial.deleteBillingAccount(id).then(res => {
- this.$message({
- type: 'success',
- message: "Set inactive success."
- })
- this.getTableData()
- }).catch(err => {
- this.$message({
- type: 'error',
- message: err
- })
- this.loading = false;
- })
- }
- }
- }
- </script>
- <style scoped>
- </style>
|