index.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  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. :cell-style="cellStyle"
  18. >
  19. <template slot="menuLeft">
  20. <el-button type="info" size="small">报表</el-button>
  21. </template>
  22. <template slot="corpIdSearch">
  23. <select-component
  24. v-model="search.corpId"
  25. :configuration="configuration"
  26. ></select-component>
  27. </template>
  28. <template slot="portOfLoadSearch">
  29. <port-info v-model="search.portOfLoad" />
  30. </template>
  31. <template slot="portOfDestinationSearch">
  32. <port-info v-model="search.portOfDestination" />
  33. </template>
  34. <template slot="businesDateSearch">
  35. <el-date-picker
  36. v-model="search.businesDate"
  37. type="daterange"
  38. start-placeholder="开始日期"
  39. end-placeholder="结束日期"
  40. format="yyyy-MM-dd"
  41. value-format="yyyy-MM-dd HH:mm:ss"
  42. :default-time="['00:00:00', '23:59:59']"
  43. >
  44. </el-date-picker>
  45. </template>
  46. <template slot="plannedDeliveryDateSearch">
  47. <el-date-picker
  48. v-model="search.plannedDeliveryDate"
  49. type="daterange"
  50. start-placeholder="开始日期"
  51. end-placeholder="结束日期"
  52. format="yyyy-MM-dd"
  53. value-format="yyyy-MM-dd HH:mm:ss"
  54. :default-time="['00:00:00', '23:59:59']"
  55. >
  56. </el-date-picker>
  57. </template>
  58. <template slot="createTimeSearch">
  59. <el-date-picker
  60. v-model="search.createTime"
  61. type="daterange"
  62. start-placeholder="开始日期"
  63. end-placeholder="结束日期"
  64. format="yyyy-MM-dd"
  65. value-format="yyyy-MM-dd HH:mm:ss"
  66. :default-time="['00:00:00', '23:59:59']"
  67. >
  68. </el-date-picker>
  69. </template>
  70. <template slot-scope="{ row }" slot="createUser">
  71. <span>{{ row.createUserName }}</span>
  72. </template>
  73. <template slot-scope="scope" slot="corpId">
  74. {{ scope.row.corpName }}
  75. </template>
  76. <template slot-scope="scope" slot="menu">
  77. <el-button
  78. type="text"
  79. icon="el-icon-view"
  80. size="small"
  81. @click.stop="beforeOpenPage(scope.row, 1)"
  82. >查看
  83. </el-button>
  84. <el-button
  85. type="text"
  86. icon="el-icon-edit"
  87. size="small"
  88. @click.stop="editOpen(scope.row, 2)"
  89. >编辑
  90. </el-button>
  91. </template>
  92. </avue-crud>
  93. </basic-container>
  94. <detail-page @goBack="goBack" :detailData="detailData" v-else></detail-page>
  95. </div>
  96. </template>
  97. <script>
  98. import option from "./config/mainList.json";
  99. import { getList, getPorts } from "@/api/basicData/shippingInquiry";
  100. import detailPage from "./detailsPage.vue";
  101. export default {
  102. name: "customerInformation",
  103. data() {
  104. return {
  105. configuration: {
  106. multipleChoices: false,
  107. multiple: false,
  108. collapseTags: false,
  109. placeholder: "请点击右边按钮选择",
  110. dicData: []
  111. },
  112. search: {},
  113. option: {},
  114. parentId: 0,
  115. dataList: [],
  116. page: {
  117. pageSize: 10,
  118. currentPage: 1,
  119. total: 0
  120. },
  121. show: true,
  122. detailData: {},
  123. loading: false
  124. };
  125. },
  126. components: { detailPage },
  127. async created() {
  128. this.option = await this.getColumnData(this.getColumnName(12), option);
  129. let _this = this;
  130. this.option.column.forEach(e => {
  131. if (e.prop == "exchangeRate") {
  132. e.formatter = function(row) {
  133. return _this.textFormat(
  134. Number(row.exchangeRate ? row.exchangeRate : 0) / 100,
  135. "0.00%"
  136. );
  137. };
  138. }
  139. if (e.prop == "creditAmount") {
  140. e.formatter = function(row) {
  141. return _this.textFormat(
  142. Number(row.creditAmount ? row.creditAmount : 0),
  143. "#,##0.00"
  144. );
  145. };
  146. }
  147. });
  148. getPorts().then(res => {
  149. this.findObject(this.option.column, "portOfLoad").dicData = res.data;
  150. this.findObject(this.option.column, "portOfDestination").dicData =
  151. res.data;
  152. });
  153. },
  154. methods: {
  155. cellStyle() {
  156. return "padding:0;height:40px;";
  157. },
  158. //查看跳转页面
  159. beforeOpenPage(row, status) {
  160. this.detailData = {
  161. id: row.id,
  162. status: status
  163. };
  164. this.show = false;
  165. },
  166. editOpen(row, status) {
  167. this.detailData = {
  168. id: row.id,
  169. status: status
  170. };
  171. this.show = false;
  172. },
  173. //点击搜索按钮触发
  174. searchChange(params, done) {
  175. if (params.businesDate) {
  176. params.orderStartDate = params.businesDate[0];
  177. params.orderEndDate = params.businesDate[1];
  178. }
  179. if (params.plannedDeliveryDate) {
  180. params.plannedDeliveryStart = params.plannedDeliveryDate[0];
  181. params.plannedDeliveryEnd = params.plannedDeliveryDate[1];
  182. }
  183. if (params.createTime) {
  184. params.createTimeStart = params.createTime[0];
  185. params.createTimeEnd = params.createTime[1];
  186. }
  187. delete params.businesDate;
  188. delete params.plannedDeliveryDate;
  189. delete params.createTime;
  190. this.page.currentPage = 1;
  191. this.onLoad(this.page, params);
  192. done();
  193. },
  194. currentChange(val) {
  195. this.page.currentPage = val;
  196. },
  197. sizeChange(val) {
  198. this.page.currentPage = 1;
  199. this.page.pageSize = val;
  200. },
  201. onLoad(page, params) {
  202. if (this.search.businesDate && this.search.businesDate.length > 0) {
  203. params = {
  204. ...params,
  205. orderStartDate: this.search.businesDate[0],
  206. orderEndDate: this.search.businesDate[1]
  207. };
  208. delete params.businesDate;
  209. }
  210. getList(page.currentPage, page.pageSize, params).then(res => {
  211. this.dataList = res.data.data.records ? res.data.data.records : [];
  212. this.page.total = res.data.data.total;
  213. if (this.page.total) {
  214. this.option.height = window.innerHeight - 380;
  215. } else {
  216. this.option.height = window.innerHeight - 305;
  217. }
  218. });
  219. },
  220. refreshChange() {
  221. this.onLoad(this.page, this.search);
  222. },
  223. goBack() {
  224. this.detailData = this.$options.data().detailData;
  225. this.show = true;
  226. },
  227. async saveColumn() {
  228. const inSave = await this.saveColumnData(
  229. this.getColumnName(12),
  230. this.option
  231. );
  232. if (inSave) {
  233. this.$message.success("保存成功");
  234. //关闭窗口
  235. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  236. }
  237. }
  238. }
  239. };
  240. </script>
  241. <style scoped>
  242. ::v-deep .select-component {
  243. display: flex;
  244. }
  245. .page-crad ::v-deep .basic-container__card {
  246. height: 86.5vh;
  247. }
  248. </style>