index.vue 6.5 KB

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