index.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. <template>
  2. <div>
  3. <basic-container v-if="show">
  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. :table-loading="loading"
  17. >
  18. <template slot="portOfLoadSearch">
  19. <port-info v-model="search.portOfLoad" />
  20. </template>
  21. <template slot="portOfDestinationSearch">
  22. <port-info v-model="search.portOfDestination" />
  23. </template>
  24. <template slot="menuLeft">
  25. <el-button
  26. type="primary"
  27. icon="el-icon-plus"
  28. size="small"
  29. @click.stop="newAdd()"
  30. >新单</el-button
  31. >
  32. <el-button type="success" size="small" disabled>复制新单</el-button>
  33. <el-button type="info" size="small">报表</el-button>
  34. </template>
  35. <template slot="corpIdSearch">
  36. <select-component
  37. v-model="search.corpId"
  38. :configuration="configuration"
  39. ></select-component>
  40. </template>
  41. <template slot-scope="scope" slot="corpId">
  42. {{ scope.row.corpsName }}
  43. </template>
  44. <template slot-scope="scope" slot="menu">
  45. <el-button
  46. type="text"
  47. icon="el-icon-view"
  48. size="small"
  49. @click.stop="beforeOpenPage(scope.row, 1)"
  50. >查看
  51. </el-button>
  52. <el-button
  53. type="text"
  54. icon="el-icon-edit"
  55. size="small"
  56. @click.stop="editOpen(scope.row, 2)"
  57. >编辑
  58. </el-button>
  59. <el-button
  60. type="text"
  61. icon="el-icon-delete"
  62. size="small"
  63. @click.stop="rowDel(scope.row, scope.index)"
  64. >删除
  65. </el-button>
  66. </template>
  67. </avue-crud>
  68. </basic-container>
  69. <detail-page
  70. ref="detail"
  71. @goBack="goBack"
  72. @inRefresh="refreshChange"
  73. :detailData="detailData"
  74. v-else
  75. ></detail-page>
  76. </div>
  77. </template>
  78. <script>
  79. import option from "./config/mainList.json";
  80. import { getList, remove } from "@/api/basicData/customerInquiry";
  81. import detailPage from "./detailsPage.vue";
  82. export default {
  83. name: "customerInformation",
  84. data() {
  85. return {
  86. configuration: {
  87. multipleChoices: false,
  88. multiple: false,
  89. collapseTags: false,
  90. placeholder: "请点击右边按钮选择",
  91. dicData: []
  92. },
  93. search: {},
  94. form: {},
  95. option: option,
  96. parentId: 0,
  97. dataList: [],
  98. page: {
  99. pageSize: 10,
  100. currentPage: 1,
  101. total: 0
  102. },
  103. show: true,
  104. detailData: {},
  105. loading: false
  106. };
  107. },
  108. components: { detailPage },
  109. created() {
  110. let _this = this;
  111. this.option.column.forEach(e => {
  112. if (e.prop == "exchangeRate") {
  113. e.formatter = function(row) {
  114. return _this.textFormat(
  115. Number(row.exchangeRate ? row.exchangeRate : 0) / 100,
  116. "0.00%"
  117. );
  118. };
  119. }
  120. if (e.prop == "creditAmount") {
  121. e.formatter = function(row) {
  122. return _this.textFormat(
  123. Number(row.creditAmount ? row.creditAmount : 0),
  124. "#,##0.00"
  125. );
  126. };
  127. }
  128. });
  129. },
  130. methods: {
  131. //删除列表后面的删除按钮触发触发(row, index, done)
  132. rowDel(row, index, done) {
  133. this.$confirm("确定删除数据?", {
  134. confirmButtonText: "确定",
  135. cancelButtonText: "取消",
  136. type: "warning"
  137. }).then(() => {
  138. remove(row.id);
  139. this.$message({
  140. type: "success",
  141. message: "删除成功!"
  142. });
  143. this.page.currentPage = 1;
  144. this.onLoad(this.page);
  145. });
  146. },
  147. //查看跳转页面
  148. beforeOpenPage(row, status) {
  149. this.detailData = {
  150. id: row.id,
  151. status: status
  152. };
  153. this.show = false;
  154. },
  155. editOpen(row, status) {
  156. this.detailData = {
  157. id: row.id,
  158. status: status
  159. };
  160. this.show = false;
  161. },
  162. //点击搜索按钮触发
  163. searchChange(params, done) {
  164. this.page.currentPage = 1;
  165. this.onLoad(this.page, params);
  166. done();
  167. },
  168. currentChange(val) {
  169. this.page.currentPage = val;
  170. },
  171. sizeChange(val) {
  172. this.page.currentPage = 1;
  173. this.page.pageSize = val;
  174. },
  175. onLoad(page, params) {
  176. this.loading = true;
  177. getList(page.currentPage, page.pageSize, params)
  178. .then(res => {
  179. this.dataList = res.data.data.records ? res.data.data.records : [];
  180. this.page.total = res.data.data.total;
  181. if (this.page.total) {
  182. this.option.height = window.innerHeight - 380;
  183. } else {
  184. this.option.height = window.innerHeight - 305;
  185. }
  186. this.loading = false;
  187. })
  188. .finally(() => {
  189. this.loading = false;
  190. });
  191. },
  192. refreshChange() {
  193. this.onLoad(this.page, this.search);
  194. },
  195. newAdd() {
  196. this.show = false;
  197. },
  198. goBack() {
  199. this.detailData=this.$options.data().detailData
  200. this.show = true;
  201. }
  202. }
  203. };
  204. </script>
  205. <style scoped>
  206. ::v-deep .select-component {
  207. display: flex;
  208. }
  209. </style>