priceLibrary.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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. :search.sync="search"
  19. @search-change="searchChange"
  20. @current-change="currentChange"
  21. @size-change="sizeChange"
  22. @refresh-change="refreshChange"
  23. @on-load="getList"
  24. @saveColumn="saveColumn"
  25. @selection-change="selectionChange"
  26. :cell-style="cellStyle"
  27. :table-loading="loading"
  28. >
  29. <template slot="cnameSearch">
  30. <goods-select
  31. v-model="search.cname"
  32. :configuration="goodsConfiguration"
  33. />
  34. </template>
  35. </avue-crud>
  36. </span>
  37. <span slot="footer" class="dialog-footer">
  38. <el-button @click="visible = false">取 消</el-button>
  39. <el-button
  40. type="primary"
  41. @click="importData"
  42. :disabled="selectionList.length == 0"
  43. >导 入</el-button
  44. >
  45. </span>
  46. </el-dialog>
  47. </div>
  48. </template>
  49. <script>
  50. import option from "./config/priceLibrary.json";
  51. import { getPricebank, getGoodstype } from "@/api/basicData/customerInquiry";
  52. import { dateFormat } from "@/util/date";
  53. import _ from "lodash";
  54. export default {
  55. data() {
  56. return {
  57. visible: false,
  58. loading: true,
  59. data: [],
  60. search: {},
  61. tableOption: option,
  62. height: window.innerHeight - 500,
  63. page: {
  64. currentPage: 1,
  65. total: 0,
  66. pageSize: 10
  67. },
  68. selectionList: [],
  69. goodsConfiguration: {
  70. multipleChoices: false,
  71. multiple: false,
  72. collapseTags: false,
  73. placeholder: "请点击右边按钮选择",
  74. dicData: [],
  75. clearable: true
  76. }
  77. };
  78. },
  79. props: {},
  80. filters: {},
  81. created() {
  82. getGoodstype(1, 500).then(res => {
  83. this.findObject(this.tableOption.column, "goodsTypeName").dicData =
  84. res.data.data.records;
  85. });
  86. },
  87. methods: {
  88. init() {
  89. this.visible = true;
  90. this.getList(this.page, this.search);
  91. },
  92. cellStyle() {
  93. return "padding:0;height:40px;";
  94. },
  95. importData() {
  96. this.visible = false;
  97. this.$emit("importLibray", this.selectionList);
  98. },
  99. currentChange(val) {
  100. this.page.currentPage = val;
  101. },
  102. sizeChange(val) {
  103. this.page.currentPage = 1;
  104. this.page.pageSize = val;
  105. },
  106. //点击搜索按钮触发
  107. searchChange(params, done) {
  108. if (params.dateValidity) {
  109. params.dateValidityStart = params.dateValidity[0];
  110. params.dateValidityEnd = params.dateValidity[1];
  111. }
  112. delete params.dateValidity;
  113. this.getList(this.page, params);
  114. done();
  115. },
  116. getList(page, params) {
  117. const data = {
  118. ...params,
  119. billType: "CG",
  120. statusTime: dateFormat(new Date(), "yyyy-MM-dd")
  121. };
  122. this.loading = true;
  123. getPricebank(page.currentPage, page.pageSize, data)
  124. .then(res => {
  125. this.data = res.data.data.records ? res.data.data.records : [];
  126. this.page.total = res.data.data.total;
  127. if (this.page.total > 0) {
  128. this.tableOption.height = window.innerHeight - 500;
  129. }
  130. })
  131. .finally(() => {
  132. this.loading = false;
  133. });
  134. },
  135. selectionChange(list) {
  136. this.selectionList = list;
  137. },
  138. closed() {
  139. this.$refs.crud.toggleSelection();
  140. }
  141. },
  142. watch: {}
  143. };
  144. </script>
  145. <style scoped lang="scss"></style>