index.vue 6.8 KB

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