index.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <template>
  2. <div>
  3. <basic-container v-show="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="portOfLoadSearch">
  23. <port-info v-model="search.portOfLoad" />
  24. </template>
  25. <template slot="portOfDestinationSearch">
  26. <port-info v-model="search.portOfDestination" />
  27. </template>
  28. <template slot="businesDateSearch">
  29. <el-date-picker
  30. v-model="search.businesDate"
  31. type="daterange"
  32. start-placeholder="开始日期"
  33. end-placeholder="结束日期"
  34. format="yyyy-MM-dd"
  35. value-format="yyyy-MM-dd HH:mm:ss"
  36. :default-time="['00:00:00', '23:59:59']"
  37. >
  38. </el-date-picker>
  39. </template>
  40. <template slot="plannedDeliveryDateSearch">
  41. <el-date-picker
  42. v-model="search.plannedDeliveryDate"
  43. type="daterange"
  44. start-placeholder="开始日期"
  45. end-placeholder="结束日期"
  46. format="yyyy-MM-dd"
  47. value-format="yyyy-MM-dd HH:mm:ss"
  48. :default-time="['00:00:00', '23:59:59']"
  49. >
  50. </el-date-picker>
  51. </template>
  52. <template slot="createTimeSearch">
  53. <el-date-picker
  54. v-model="search.createTime"
  55. type="daterange"
  56. start-placeholder="开始日期"
  57. end-placeholder="结束日期"
  58. format="yyyy-MM-dd"
  59. value-format="yyyy-MM-dd HH:mm:ss"
  60. :default-time="['00:00:00', '23:59:59']"
  61. >
  62. </el-date-picker>
  63. </template>
  64. <template slot-scope="{ row }" slot="createUser">
  65. <span>{{ row.createUserName }}</span>
  66. </template>
  67. <template slot-scope="scope" slot="corpId">
  68. {{ scope.row.corpName }}
  69. </template>
  70. <template slot-scope="scope" slot="menu">
  71. <el-button
  72. type="text"
  73. icon="el-icon-edit"
  74. size="small"
  75. @click.stop="editOpen(scope.row, 2)"
  76. >编辑
  77. </el-button>
  78. </template>
  79. </avue-crud>
  80. </basic-container>
  81. <detail-page @goBack="goBack" :detailData="detailData" v-if="!show"></detail-page>
  82. </div>
  83. </template>
  84. <script>
  85. import option from "./config/mainList.json";
  86. import { getList, getPorts, gainUser } from "@/api/basicData/shippingInquiry";
  87. import detailPage from "./detailsPage.vue";
  88. export default {
  89. name: "customerInformation",
  90. data() {
  91. return {
  92. search: {},
  93. option: {},
  94. parentId: 0,
  95. dataList: [],
  96. page: {
  97. pageSize: 10,
  98. currentPage: 1,
  99. total: 0,
  100. pageSizes: [10, 50, 100, 200, 300, 400, 500]
  101. },
  102. show: true,
  103. detailData: {},
  104. loading: false
  105. };
  106. },
  107. components: { detailPage },
  108. async created() {
  109. this.option = await this.getColumnData(this.getColumnName(12), option);
  110. getPorts().then(res => {
  111. this.findObject(this.option.column, "portOfLoad").dicData = res.data;
  112. this.findObject(this.option.column, "portOfDestination").dicData =
  113. res.data;
  114. });
  115. gainUser().then(res => {
  116. this.findObject(this.option.column, "createUser").dicData = res.data.data;
  117. });
  118. },
  119. methods: {
  120. cellStyle() {
  121. return "padding:0;height:40px;";
  122. },
  123. //查看跳转页面
  124. beforeOpenPage(row, status) {
  125. this.detailData = {
  126. id: row.id,
  127. status: status
  128. };
  129. this.show = false;
  130. },
  131. editOpen(row, status) {
  132. this.detailData = {
  133. id: row.id,
  134. status: status
  135. };
  136. this.show = false;
  137. },
  138. //点击搜索按钮触发
  139. searchChange(params, done) {
  140. if (params.businesDate) {
  141. params.orderStartDate = params.businesDate[0];
  142. params.orderEndDate = params.businesDate[1];
  143. }
  144. if (params.plannedDeliveryDate) {
  145. params.plannedDeliveryStart = params.plannedDeliveryDate[0];
  146. params.plannedDeliveryEnd = params.plannedDeliveryDate[1];
  147. }
  148. if (params.createTime) {
  149. params.createTimeStart = params.createTime[0];
  150. params.createTimeEnd = params.createTime[1];
  151. }
  152. delete params.businesDate;
  153. delete params.plannedDeliveryDate;
  154. delete params.createTime;
  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. if (this.search.businesDate && this.search.businesDate.length > 0) {
  168. params = {
  169. ...params,
  170. orderStartDate: this.search.businesDate[0],
  171. orderEndDate: this.search.businesDate[1]
  172. };
  173. delete params.businesDate;
  174. }
  175. getList(page.currentPage, page.pageSize, params).then(res => {
  176. this.dataList = res.data.data.records ? res.data.data.records : [];
  177. this.page.total = res.data.data.total;
  178. if (this.page.total) {
  179. this.option.height = window.innerHeight - 300;
  180. }
  181. });
  182. },
  183. refreshChange() {
  184. this.onLoad(this.page, this.search);
  185. },
  186. goBack() {
  187. this.detailData = this.$options.data().detailData;
  188. this.show = true;
  189. this.onLoad(this.page, this.search);
  190. },
  191. async saveColumn() {
  192. const inSave = await this.saveColumnData(
  193. this.getColumnName(12),
  194. this.option
  195. );
  196. if (inSave) {
  197. this.$message.success("保存成功");
  198. //关闭窗口
  199. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  200. }
  201. }
  202. }
  203. };
  204. </script>
  205. <style scoped>
  206. ::v-deep .select-component {
  207. display: flex;
  208. }
  209. .page-crad ::v-deep .basic-container__card {
  210. height: 94.2vh;
  211. }
  212. </style>