priceLibrary.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <template>
  2. <div>
  3. <el-dialog
  4. title="出口价格库"
  5. class="el-dialogDeep"
  6. :visible.sync="visible"
  7. width="60%"
  8. append-to-body
  9. @closed="closed"
  10. v-dialog-drag
  11. >
  12. <span>
  13. <avue-crud
  14. ref="crud"
  15. :data="data"
  16. :option="tableOption"
  17. :page.sync="page"
  18. @current-change="currentChange"
  19. @size-change="sizeChange"
  20. @refresh-change="refreshChange"
  21. @on-load="getList"
  22. @saveColumn="saveColumn"
  23. @selection-change="selectionChange"
  24. :cell-style="cellStyle"
  25. :table-loading="loading"
  26. >
  27. </avue-crud>
  28. </span>
  29. <span slot="footer" class="dialog-footer">
  30. <el-button @click="visible = false">取 消</el-button>
  31. <el-button type="primary" @click="importData" :disabled="selectionList.length==0">导 入</el-button>
  32. </span>
  33. </el-dialog>
  34. </div>
  35. </template>
  36. <script>
  37. import option from "./config/priceLibrary.json";
  38. import { getPricebank } from "@/api/basicData/customerInquiry";
  39. import { dateFormat } from "@/util/date";
  40. import _ from "lodash";
  41. export default {
  42. data() {
  43. return {
  44. visible: false,
  45. loading: true,
  46. data: [],
  47. tableOption: option,
  48. height: window.innerHeight - 500,
  49. page: {
  50. currentPage: 1,
  51. total: 0,
  52. pageSize: 10
  53. },
  54. selectionList: []
  55. };
  56. },
  57. props: {},
  58. filters: {},
  59. created() {},
  60. methods: {
  61. init() {
  62. this.visible = true;
  63. this.getList();
  64. },
  65. cellStyle() {
  66. return "padding:0;height:40px;";
  67. },
  68. importData() {
  69. this.visible = false;
  70. this.$emit('importLibray',this.selectionList)
  71. },
  72. currentChange(val) {
  73. this.page.currentPage = val;
  74. },
  75. sizeChange(val) {
  76. this.page.currentPage = 1;
  77. this.page.pageSize = val;
  78. },
  79. getList() {
  80. const data = {
  81. billType: "CG",
  82. statusTime: dateFormat(new Date(), "yyyy-MM-dd")
  83. };
  84. this.loading = true;
  85. getPricebank(this.page.currentPage, this.page.pageSize, data)
  86. .then(res => {
  87. this.data = res.data.data.records ? res.data.data.records : [];
  88. this.page.total = res.data.data.total;
  89. console.log(this.page.total);
  90. if (this.page.total > 0) {
  91. this.tableOption.height = window.innerHeight - 500;
  92. }
  93. })
  94. .finally(() => {
  95. this.loading = false;
  96. });
  97. },
  98. selectionChange(list){
  99. this.selectionList=list
  100. },
  101. closed(){
  102. this.$refs.crud.toggleSelection();
  103. }
  104. },
  105. watch: {}
  106. };
  107. </script>
  108. <style scoped lang="scss"></style>