main.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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. <template slot="corpId" slot-scope="{ row }">
  36. <span>{{ row.corpName }}</span>
  37. </template>
  38. </avue-crud>
  39. </span>
  40. <span slot="footer" class="dialog-footer">
  41. <el-button @click="visible = false">取 消</el-button>
  42. <el-button
  43. type="primary"
  44. @click="importData"
  45. :disabled="selectionList.length == 0"
  46. >导 入</el-button
  47. >
  48. </span>
  49. </el-dialog>
  50. </div>
  51. </template>
  52. <script>
  53. import option from "./configuration/mainList.json";
  54. import { getPricebank, getGoodstype } from "@/api/basicData/customerInquiry";
  55. import { dateFormat } from "@/util/date";
  56. import _ from "lodash";
  57. export default {
  58. data() {
  59. return {
  60. visible: false,
  61. loading: true,
  62. data: [],
  63. search: {},
  64. tableOption: option,
  65. height: window.innerHeight - 500,
  66. page: {
  67. currentPage: 1,
  68. total: 0,
  69. pageSize: 10
  70. },
  71. selectionList: [],
  72. goodsConfiguration: {
  73. multipleChoices: false,
  74. multiple: false,
  75. collapseTags: false,
  76. placeholder: "请点击右边按钮选择",
  77. dicData: [],
  78. clearable: true
  79. },
  80. partType: false,
  81. partreData: false
  82. };
  83. },
  84. props: {},
  85. filters: {},
  86. created() {
  87. getGoodstype(1, 500).then(res => {
  88. this.findObject(this.tableOption.column, "goodsTypeName").dicData =
  89. res.data.data.records;
  90. });
  91. },
  92. methods: {
  93. init(status, partreData) {
  94. this.partType = status;
  95. this.partreData = partreData;
  96. this.visible = true;
  97. this.getList(this.page, this.search);
  98. },
  99. cellStyle() {
  100. return "padding:0;height:40px;";
  101. },
  102. importData() {
  103. if (this.partreData) {
  104. if (this.selectionList.length != 1) {
  105. return this.$message.error("重新选择的时候只能选择一条数据");
  106. }
  107. }
  108. this.visible = false;
  109. this.$emit("importLibray", this.selectionList, this.partType);
  110. },
  111. currentChange(val) {
  112. this.page.currentPage = val;
  113. },
  114. sizeChange(val) {
  115. this.page.currentPage = 1;
  116. this.page.pageSize = val;
  117. },
  118. //点击搜索按钮触发
  119. searchChange(params, done) {
  120. if (params.dateValidity) {
  121. params.dateValidityStart = params.dateValidity[0];
  122. params.dateValidityEnd = params.dateValidity[1];
  123. }
  124. delete params.dateValidity;
  125. this.getList(this.page, params);
  126. done();
  127. },
  128. getList(page, params) {
  129. const data = {
  130. ...params,
  131. billType: "CG",
  132. statusTime: dateFormat(new Date(), "yyyy-MM-dd")
  133. };
  134. this.loading = true;
  135. getPricebank(page.currentPage, page.pageSize, data)
  136. .then(res => {
  137. this.data = res.data.data.records ? res.data.data.records : [];
  138. this.page.total = res.data.data.total;
  139. if (this.page.total > 0) {
  140. this.tableOption.height = window.innerHeight - 500;
  141. }
  142. })
  143. .finally(() => {
  144. this.loading = false;
  145. });
  146. },
  147. selectionChange(list) {
  148. this.selectionList = list;
  149. },
  150. closed() {
  151. this.partreData = null;
  152. this.$refs.crud.toggleSelection();
  153. }
  154. },
  155. watch: {}
  156. };
  157. </script>
  158. <style scoped lang="scss"></style>