index.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  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-edit"
  80. size="small"
  81. @click.stop="editOpen(scope.row, 2)"
  82. >编辑
  83. </el-button>
  84. </template>
  85. </avue-crud>
  86. </basic-container>
  87. <detail-page @goBack="goBack" :detailData="detailData" v-else></detail-page>
  88. </div>
  89. </template>
  90. <script>
  91. import option from "./config/mainList.json";
  92. import { getList, getPorts, gainUser } from "@/api/basicData/shippingInquiry";
  93. import detailPage from "./detailsPage.vue";
  94. export default {
  95. name: "customerInformation",
  96. data() {
  97. return {
  98. configuration: {
  99. multipleChoices: false,
  100. multiple: false,
  101. collapseTags: false,
  102. placeholder: "请点击右边按钮选择",
  103. dicData: []
  104. },
  105. search: {},
  106. option: {},
  107. parentId: 0,
  108. dataList: [],
  109. page: {
  110. pageSize: 10,
  111. currentPage: 1,
  112. total: 0
  113. },
  114. show: true,
  115. detailData: {},
  116. loading: false
  117. };
  118. },
  119. components: { detailPage },
  120. async created() {
  121. this.option = await this.getColumnData(this.getColumnName(12), option);
  122. let _this = this;
  123. this.option.column.forEach(e => {
  124. if (e.prop == "exchangeRate") {
  125. e.formatter = function(row) {
  126. return _this.textFormat(
  127. Number(row.exchangeRate ? row.exchangeRate : 0) / 100,
  128. "0.00%"
  129. );
  130. };
  131. }
  132. if (e.prop == "creditAmount") {
  133. e.formatter = function(row) {
  134. return _this.textFormat(
  135. Number(row.creditAmount ? row.creditAmount : 0),
  136. "#,##0.00"
  137. );
  138. };
  139. }
  140. });
  141. getPorts().then(res => {
  142. this.findObject(this.option.column, "portOfLoad").dicData = res.data;
  143. this.findObject(this.option.column, "portOfDestination").dicData =
  144. res.data;
  145. });
  146. gainUser().then(res => {
  147. this.findObject(this.option.column, "createUser").dicData = res.data.data;
  148. });
  149. },
  150. methods: {
  151. cellStyle() {
  152. return "padding:0;height:40px;";
  153. },
  154. //查看跳转页面
  155. beforeOpenPage(row, status) {
  156. this.detailData = {
  157. id: row.id,
  158. status: status
  159. };
  160. this.show = false;
  161. },
  162. editOpen(row, status) {
  163. this.detailData = {
  164. id: row.id,
  165. status: status
  166. };
  167. this.show = false;
  168. },
  169. //点击搜索按钮触发
  170. searchChange(params, done) {
  171. if (params.businesDate) {
  172. params.orderStartDate = params.businesDate[0];
  173. params.orderEndDate = params.businesDate[1];
  174. }
  175. if (params.plannedDeliveryDate) {
  176. params.plannedDeliveryStart = params.plannedDeliveryDate[0];
  177. params.plannedDeliveryEnd = params.plannedDeliveryDate[1];
  178. }
  179. if (params.createTime) {
  180. params.createTimeStart = params.createTime[0];
  181. params.createTimeEnd = params.createTime[1];
  182. }
  183. delete params.businesDate;
  184. delete params.plannedDeliveryDate;
  185. delete params.createTime;
  186. this.page.currentPage = 1;
  187. this.onLoad(this.page, params);
  188. done();
  189. },
  190. currentChange(val) {
  191. this.page.currentPage = val;
  192. },
  193. sizeChange(val) {
  194. this.page.currentPage = 1;
  195. this.page.pageSize = val;
  196. },
  197. onLoad(page, params) {
  198. if (this.search.businesDate && this.search.businesDate.length > 0) {
  199. params = {
  200. ...params,
  201. orderStartDate: this.search.businesDate[0],
  202. orderEndDate: this.search.businesDate[1]
  203. };
  204. delete params.businesDate;
  205. }
  206. getList(page.currentPage, page.pageSize, params).then(res => {
  207. this.dataList = res.data.data.records ? res.data.data.records : [];
  208. this.page.total = res.data.data.total;
  209. if (this.page.total) {
  210. this.option.height = window.innerHeight - 340;
  211. }
  212. });
  213. },
  214. refreshChange() {
  215. this.onLoad(this.page, this.search);
  216. },
  217. goBack() {
  218. this.detailData = this.$options.data().detailData;
  219. this.show = true;
  220. },
  221. async saveColumn() {
  222. const inSave = await this.saveColumnData(
  223. this.getColumnName(12),
  224. this.option
  225. );
  226. if (inSave) {
  227. this.$message.success("保存成功");
  228. //关闭窗口
  229. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  230. }
  231. }
  232. }
  233. };
  234. </script>
  235. <style scoped>
  236. ::v-deep .select-component {
  237. display: flex;
  238. }
  239. .page-crad ::v-deep .basic-container__card {
  240. height: 94.2vh;
  241. }
  242. </style>