GridSelectDialog.vue 3.59 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
<template>
  <el-dialog
    :title="promptData.title"
    :visible.sync="show"
    custom-class="grid-ety"
    :highlight-current-row="true"
    width="60%"
    :before-close="beforeClose"
  >
    <el-table
      :data="tableData"
      border
      @row-dblclick="selectEty"
    >
      <el-table-column
        v-for="(item, idx) in promptData.columns"
        :key="idx"
        :property="item.prop"
        :label="item.label"
        :width="item.width"
      >
      </el-table-column>
    </el-table>
    <el-pagination
      layout="prev, pager, next, total, jumper"
      :total="pagination.total"
      :page-sizes="pagination.pageSizes"
      :page-size="pagination.pageSize"
      :current-page="pagination.currentPage"
      @current-change="currentChange"
      @size-change="handleSizeChange"
    >
    </el-pagination>
  </el-dialog>
</template>

<script>
import Api from "~/service/Api";
import commonApi from '~/mixin/commonApi';
export default {
  mixins: [commonApi],
  data() {
    return {
      show: false,
      cod: '',
      tableData: [],
      pagination: {
        currentPage: 1,
        pageSizes: [10, 20, 50, 100, 500],
        pageSize: 10,
        total: 0,
      },
      promptData: {
        title: 'Select a Transaction',
        columns: [
          {
            prop: 'cod',
            label: 'Description'
          },
          {
            prop: 'bus',
            label: 'Bus. Sector'
          },
          {
            prop: 'bustrnflg',
            label: 'Business Trn.'
          },
          {
            prop: 'reltyp',
            label: 'Release Method'
          },
          {
            prop: 'relamt',
            label: 'Real. Amount'
          },
          {
            prop: 'ccstyp',
            label: 'Compliance Check'
          },
          {
            prop: 'subflg',
            label: 'Subcontr. -creating Trn.'
          },
          {
            prop: 'sepflg',
            label: 'Temp. Settl. allowed'
          },
          {
            prop: 'rouflg',
            label: 'Routing allowed'
          },
          {
            prop: 'concreflg',
            label: 'Allocate New Contract'
          },
          {
            prop: 'negflg',
            label: 'Need pass. Data to Exec.'
          },
          {
            prop: 'jobflg',
            label: 'Job operation allowed'
          }

        ]
      }
    };
  },
  methods: {
    async handleSearch() {
      let params = {
        inr: '',
        oldkey: '',
        dissel: '',
        usrcon: '',
        rouflg: '',
        sepflg: '',
        cod: this.cod,
        dtaflg: '',
        lnkobj: '',
        pageNum: this.pagination.currentPage,
        pageSize: this.pagination.pageSize,
      };
      const loading = this.loading();
      let res = await Api.post('/service/trnrel/findAtpCod', params);
      if (res.respCode == SUCCESS) {
        this.tableData = res.data && res.data.atpList.list;
        this.pagination.total = Number((res.data && res.data.atpList.total) || 0);
      }
      loading.close();
    },
    currentChange(val) {
      this.pagination.currentPage = val;
      this.handleSearch()
    },
    handleSizeChange(val) {
      this.pagination.currentPage = 1;
      this.pagination.pageSize = val;
      this.handleSearch();
    },
    selectEty(row) {
      this.$emit("selectEty", {
        ...row,
        role: this.promptData.type
      });
      this.show = false;
      this.currentPage = 1;
    },
    beforeClose(done) {
      this.show = false;
      this.currentPage = 1;
      done();
    },
  },
};
</script>

<style>
.grid-ety .el-table .cell {
  white-space: pre-wrap;
}
</style>