index.vue 5.1 KB

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