index.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <template>
  2. <div>
  3. <basic-container v-if="show" class="page-crad">
  4. <avue-crud
  5. ref="crud"
  6. :option="option"
  7. :data="dataList"
  8. v-model="form"
  9. :page.sync="page"
  10. :search.sync="search"
  11. @search-change="searchChange"
  12. @current-change="currentChange"
  13. @size-change="sizeChange"
  14. @refresh-change="refreshChange"
  15. @on-load="onLoad"
  16. @saveColumn="saveColumn"
  17. >
  18. <template slot="menuLeft">
  19. <el-button type="info" size="small">报表</el-button>
  20. </template>
  21. <template slot="corpIdSearch">
  22. <select-component
  23. v-model="search.corpId"
  24. :configuration="configuration"
  25. ></select-component>
  26. </template>
  27. <template slot="portOfLoadSearch">
  28. <port-info v-model="search.portOfLoad" />
  29. </template>
  30. <template slot="portOfDestinationSearch">
  31. <port-info v-model="search.portOfDestination" />
  32. </template>
  33. <template slot-scope="scope" slot="corpId">
  34. {{ scope.row.corpName }}
  35. </template>
  36. <template slot-scope="scope" slot="menu">
  37. <el-button
  38. type="text"
  39. icon="el-icon-view"
  40. size="small"
  41. @click.stop="beforeOpenPage(scope.row, 1)"
  42. >查看
  43. </el-button>
  44. <el-button
  45. type="text"
  46. icon="el-icon-edit"
  47. size="small"
  48. @click.stop="editOpen(scope.row, 2)"
  49. >编辑
  50. </el-button>
  51. </template>
  52. </avue-crud>
  53. </basic-container>
  54. <detail-page @goBack="goBack" :detailData="detailData" v-else></detail-page>
  55. </div>
  56. </template>
  57. <script>
  58. import option from "./config/mainList.json";
  59. import { getList, getPorts } from "@/api/basicData/shippingInquiry";
  60. import detailPage from "./detailsPage.vue";
  61. export default {
  62. name: "customerInformation",
  63. data() {
  64. return {
  65. configuration: {
  66. multipleChoices: false,
  67. multiple: false,
  68. collapseTags: false,
  69. placeholder: "请点击右边按钮选择",
  70. dicData: []
  71. },
  72. search: {},
  73. option:{},
  74. parentId: 0,
  75. dataList: [],
  76. page: {
  77. pageSize: 10,
  78. currentPage: 1,
  79. total: 0
  80. },
  81. show: true,
  82. detailData: {},
  83. loading: false
  84. };
  85. },
  86. components: { detailPage },
  87. async created() {
  88. this.option = await this.getColumnData(this.getColumnName(12), option);
  89. let _this = this;
  90. this.option.column.forEach(e => {
  91. if (e.prop == "exchangeRate") {
  92. e.formatter = function(row) {
  93. return _this.textFormat(
  94. Number(row.exchangeRate ? row.exchangeRate : 0) / 100,
  95. "0.00%"
  96. );
  97. };
  98. }
  99. if (e.prop == "creditAmount") {
  100. e.formatter = function(row) {
  101. return _this.textFormat(
  102. Number(row.creditAmount ? row.creditAmount : 0),
  103. "#,##0.00"
  104. );
  105. };
  106. }
  107. });
  108. getPorts().then(res => {
  109. this.findObject(this.option.column, "portOfLoad").dicData = res.data;
  110. this.findObject(this.option.column, "portOfDestination").dicData =
  111. res.data;
  112. });
  113. },
  114. methods: {
  115. //查看跳转页面
  116. beforeOpenPage(row, status) {
  117. this.detailData = {
  118. id: row.id,
  119. status: status
  120. };
  121. this.show = false;
  122. },
  123. editOpen(row, status) {
  124. this.detailData = {
  125. id: row.id,
  126. status: status
  127. };
  128. this.show = false;
  129. },
  130. //点击搜索按钮触发
  131. searchChange(params, done) {
  132. this.page.currentPage = 1;
  133. this.onLoad(this.page, params);
  134. done();
  135. },
  136. currentChange(val) {
  137. this.page.currentPage = val;
  138. },
  139. sizeChange(val) {
  140. this.page.currentPage = 1;
  141. this.page.pageSize = val;
  142. },
  143. onLoad(page, params) {
  144. getList(page.currentPage, page.pageSize, params).then(res => {
  145. this.dataList = res.data.data.records ? res.data.data.records : [];
  146. this.page.total = res.data.data.total;
  147. if (this.page.total) {
  148. this.option.height = window.innerHeight - 380;
  149. } else {
  150. this.option.height = window.innerHeight - 305;
  151. }
  152. });
  153. },
  154. refreshChange() {
  155. this.onLoad(this.page, this.search);
  156. },
  157. goBack() {
  158. this.detailData = this.$options.data().detailData;
  159. this.show = true;
  160. },
  161. async saveColumn() {
  162. const inSave = await this.saveColumnData(
  163. this.getColumnName(12),
  164. this.option
  165. );
  166. if (inSave) {
  167. this.$message.success("保存成功");
  168. //关闭窗口
  169. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  170. }
  171. }
  172. }
  173. };
  174. </script>
  175. <style scoped>
  176. ::v-deep .select-component {
  177. display: flex;
  178. }
  179. .page-crad ::v-deep .basic-container__card {
  180. height: 86.5vh;
  181. }
  182. </style>