main.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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. v-dialog-drag
  12. >
  13. <span>
  14. <avue-crud
  15. ref="crud"
  16. :data="data"
  17. :option="tableOption"
  18. :page.sync="page"
  19. :search.sync="search"
  20. @search-change="searchChange"
  21. @current-change="currentChange"
  22. @size-change="sizeChange"
  23. @refresh-change="refreshChange"
  24. @on-load="getList"
  25. @saveColumn="saveColumn"
  26. @selection-change="selectionChange"
  27. :cell-style="cellStyle"
  28. :table-loading="loading"
  29. >
  30. <template slot="cnameSearch">
  31. <goods-select
  32. v-model="search.cname"
  33. :configuration="goodsConfiguration"
  34. />
  35. </template>
  36. <template slot="corpId" slot-scope="{ row }">
  37. <span>{{ row.corpName }}</span>
  38. </template>
  39. </avue-crud>
  40. </span>
  41. <span slot="footer" class="dialog-footer">
  42. <el-button @click="visible = false">取 消</el-button>
  43. <el-button
  44. type="primary"
  45. @click="importData"
  46. :disabled="selectionList.length == 0"
  47. >导 入</el-button
  48. >
  49. </span>
  50. </el-dialog>
  51. </div>
  52. </template>
  53. <script>
  54. import option from "./configuration/mainList.json";
  55. import { getPricebank, getGoodstype } from "@/api/basicData/customerInquiry";
  56. import { dateFormat } from "@/util/date";
  57. import _ from "lodash";
  58. export default {
  59. data() {
  60. return {
  61. visible: false,
  62. loading: true,
  63. data: [],
  64. search: {},
  65. tableOption: option,
  66. height: window.innerHeight - 500,
  67. page: {
  68. currentPage: 1,
  69. total: 0,
  70. pageSize: 10
  71. },
  72. selectionList: [],
  73. goodsConfiguration: {
  74. multipleChoices: false,
  75. multiple: false,
  76. collapseTags: false,
  77. placeholder: "请点击右边按钮选择",
  78. dicData: [],
  79. clearable: true
  80. },
  81. partType: false,
  82. partreData: false
  83. };
  84. },
  85. props: {},
  86. filters: {},
  87. created() {
  88. getGoodstype(1, 500).then(res => {
  89. this.findObject(this.tableOption.column, "goodsTypeName").dicData =
  90. res.data.data.records;
  91. });
  92. },
  93. methods: {
  94. init(status, partreData) {
  95. this.partType = status;
  96. this.partreData = partreData;
  97. this.visible = true;
  98. this.getList(this.page, this.search);
  99. },
  100. cellStyle() {
  101. return "padding:0;height:40px;";
  102. },
  103. importData() {
  104. if (this.partreData) {
  105. if (this.selectionList.length != 1) {
  106. return this.$message.error("重新选择的时候只能选择一条数据");
  107. }
  108. }
  109. this.visible = false;
  110. if(this.partType){
  111. this.$emit("librayToPart", this.selectionList,this.partreData);
  112. }else{
  113. this.$emit("importLibray", this.selectionList);
  114. }
  115. },
  116. currentChange(val) {
  117. this.page.currentPage = val;
  118. },
  119. sizeChange(val) {
  120. this.page.currentPage = 1;
  121. this.page.pageSize = val;
  122. },
  123. //点击搜索按钮触发
  124. searchChange(params, done) {
  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 - 350;
  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>