main.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <template>
  2. <div>
  3. <el-dialog
  4. title="出口价格库"
  5. class="el-dialogDeep"
  6. :visible.sync="visible"
  7. top="5vh"
  8. width="80%"
  9. append-to-body
  10. @closed="closed"
  11. :close-on-click-modal="false"
  12. v-dialog-drag
  13. >
  14. <span>
  15. <avue-crud
  16. ref="crud"
  17. :data="data"
  18. :option="tableOption"
  19. :page.sync="page"
  20. :search.sync="search"
  21. @search-change="searchChange"
  22. @current-change="currentChange"
  23. @size-change="sizeChange"
  24. @refresh-change="refreshChange"
  25. @on-load="getList"
  26. @saveColumn="saveColumn"
  27. @selection-change="selectionChange"
  28. :cell-style="cellStyle"
  29. :table-loading="loading"
  30. >
  31. <template slot="cnameSearch">
  32. <goods-select
  33. v-model="search.cname"
  34. :configuration="goodsConfiguration"
  35. />
  36. </template>
  37. <template slot="corpId" slot-scope="{ row }">
  38. <span>{{ row.corpName }}</span>
  39. </template>
  40. </avue-crud>
  41. </span>
  42. <span slot="footer" class="dialog-footer">
  43. <el-button @click="visible = false">取 消</el-button>
  44. <el-button
  45. type="primary"
  46. @click="importData"
  47. :disabled="selectionList.length == 0"
  48. >导 入</el-button
  49. >
  50. </span>
  51. </el-dialog>
  52. </div>
  53. </template>
  54. <script>
  55. import option from "./configuration/mainList.json";
  56. import { getPricebank, getGoodstype } from "@/api/basicData/customerInquiry";
  57. import { dateFormat } from "@/util/date";
  58. import _ from "lodash";
  59. export default {
  60. data() {
  61. return {
  62. visible: false,
  63. loading: true,
  64. data: [],
  65. search: {},
  66. tableOption: option,
  67. height: window.innerHeight - 500,
  68. page: {
  69. currentPage: 1,
  70. total: 0,
  71. pageSize: 10
  72. },
  73. selectionList: [],
  74. goodsConfiguration: {
  75. multipleChoices: false,
  76. multiple: false,
  77. collapseTags: false,
  78. placeholder: "请点击右边按钮选择",
  79. dicData: [],
  80. clearable: true
  81. },
  82. partType: false,
  83. partreData: false
  84. };
  85. },
  86. props: {},
  87. filters: {},
  88. created() {
  89. getGoodstype(1, 500).then(res => {
  90. this.findObject(this.tableOption.column, "goodsTypeName").dicData =
  91. res.data.data.records;
  92. });
  93. },
  94. methods: {
  95. init(status, partreData) {
  96. this.partType = status;
  97. this.partreData = partreData;
  98. this.visible = true;
  99. this.getList(this.page, this.search);
  100. },
  101. cellStyle() {
  102. return "padding:0;height:40px;";
  103. },
  104. importData() {
  105. if (this.partreData) {
  106. if (this.selectionList.length != 1) {
  107. return this.$message.error("重新选择的时候只能选择一条数据");
  108. }
  109. }
  110. this.visible = false;
  111. if (this.partType) {
  112. this.$emit("librayToPart", this.selectionList, this.partreData);
  113. } else {
  114. this.$emit("importLibray", this.selectionList);
  115. }
  116. },
  117. currentChange(val) {
  118. this.page.currentPage = val;
  119. },
  120. sizeChange(val) {
  121. this.page.currentPage = 1;
  122. this.page.pageSize = val;
  123. },
  124. //点击搜索按钮触发
  125. searchChange(params, done) {
  126. this.search = this.deepClone(params);
  127. this.getList(this.page, params);
  128. done();
  129. },
  130. getList(page, params) {
  131. let data = {
  132. ...params,
  133. billType: "CG",
  134. statusTime: dateFormat(new Date(), "yyyy-MM-dd")
  135. };
  136. let obj = Object.assign(data, this.search);
  137. this.loading = true;
  138. getPricebank(page.currentPage, page.pageSize, obj)
  139. .then(res => {
  140. this.data = res.data.data.records ? res.data.data.records : [];
  141. this.page.total = res.data.data.total;
  142. if (this.page.total > 0) {
  143. this.tableOption.height = window.innerHeight - 350;
  144. }
  145. })
  146. .finally(() => {
  147. this.loading = false;
  148. });
  149. },
  150. selectionChange(list) {
  151. this.selectionList = list;
  152. },
  153. closed() {
  154. this.partreData = null;
  155. this.$refs.crud.toggleSelection();
  156. }
  157. },
  158. watch: {}
  159. };
  160. </script>
  161. <style scoped lang="scss"></style>