index.vue 6.7 KB

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