index.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. <template>
  2. <basic-container>
  3. <avue-crud
  4. ref="crud"
  5. :option="option"
  6. :data="dataList"
  7. v-model="form"
  8. :page.sync="page"
  9. :search.sync="search"
  10. @search-change="searchChange"
  11. @current-change="currentChange"
  12. @size-change="sizeChange"
  13. @refresh-change="refreshChange"
  14. @on-load="onLoad"
  15. >
  16. <template slot="menuLeft">
  17. <el-button
  18. type="primary"
  19. icon="el-icon-plus"
  20. size="small"
  21. @click.stop="newAdd()"
  22. >新单</el-button
  23. >
  24. <el-button type="success" size="small" disabled>复制新单</el-button>
  25. <el-button type="info" size="small">报表</el-button>
  26. </template>
  27. <template slot="corpIdSearch">
  28. <select-component
  29. v-model="search.corpId"
  30. :configuration="configuration"
  31. ></select-component>
  32. </template>
  33. <template slot="businesDateSearch">
  34. <el-date-picker
  35. v-model="search.businesDate"
  36. type="daterange"
  37. start-placeholder="开始日期"
  38. end-placeholder="结束日期"
  39. format="yyyy-MM-dd"
  40. value-format="yyyy-MM-dd HH:mm:ss"
  41. :default-time="['00:00:00', '23:59:59']"
  42. >
  43. </el-date-picker>
  44. </template>
  45. <template slot="requiredDeliveryDateSearch">
  46. <el-date-picker
  47. v-model="search.requiredDeliveryDate"
  48. type="daterange"
  49. start-placeholder="开始日期"
  50. end-placeholder="结束日期"
  51. format="yyyy-MM-dd"
  52. value-format="yyyy-MM-dd HH:mm:ss"
  53. :default-time="['00:00:00', '23:59:59']"
  54. >
  55. </el-date-picker>
  56. </template>
  57. <template slot-scope="scope" slot="corpId">
  58. {{ scope.row.corpsName }}
  59. </template>
  60. <template slot-scope="scope" slot="menu">
  61. <el-button
  62. type="text"
  63. icon="el-icon-view"
  64. size="small"
  65. @click.stop="beforeOpenPage(scope.row, 1)"
  66. >查看
  67. </el-button>
  68. <el-button
  69. type="text"
  70. icon="el-icon-edit"
  71. size="small"
  72. @click.stop="editOpen(scope.row, 2)"
  73. >编辑
  74. </el-button>
  75. <el-button
  76. type="text"
  77. icon="el-icon-delete"
  78. size="small"
  79. @click.stop="rowDel(scope.row, scope.index)"
  80. >删除
  81. </el-button>
  82. </template>
  83. </avue-crud>
  84. </basic-container>
  85. </template>
  86. <script>
  87. import option from "./config/mainList.json";
  88. import { getList, remove } from "@/api/exportTrade/purchaseContract";
  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: option,
  103. parentId: 0,
  104. dataList: [],
  105. page: {
  106. pageSize: 10,
  107. currentPage: 1,
  108. total: 0
  109. }
  110. };
  111. },
  112. created() {
  113. let _this = this;
  114. this.option.column.forEach(e => {
  115. if (e.prop == "exchangeRate") {
  116. e.formatter = function(row) {
  117. return _this.textFormat(
  118. Number(row.exchangeRate ? row.exchangeRate : 0) / 100,
  119. "0.00%"
  120. );
  121. };
  122. }
  123. if (e.prop == "creditAmount") {
  124. e.formatter = function(row) {
  125. return _this.textFormat(
  126. Number(row.creditAmount ? row.creditAmount : 0),
  127. "#,##0.00"
  128. );
  129. };
  130. }
  131. });
  132. },
  133. methods: {
  134. //删除列表后面的删除按钮触发触发(row, index, done)
  135. rowDel(row, index, done) {
  136. this.$confirm("确定删除数据?", {
  137. confirmButtonText: "确定",
  138. cancelButtonText: "取消",
  139. type: "warning"
  140. }).then(() => {
  141. remove(row.id);
  142. this.$message({
  143. type: "success",
  144. message: "删除成功!"
  145. });
  146. this.page.currentPage = 1;
  147. this.onLoad(this.page);
  148. });
  149. },
  150. //查看跳转页面
  151. beforeOpenPage(row, status) {
  152. this.$router.$avueRouter.closeTag();
  153. this.$router.push({
  154. path: "/exportpurchaseContract_detailsPage",
  155. query: { id: JSON.stringify(row.id), status: status }
  156. });
  157. },
  158. editOpen(row, status) {
  159. this.$router.$avueRouter.closeTag();
  160. this.$router.push({
  161. path: "/exportpurchaseContract_detailsPage",
  162. query: { id: JSON.stringify(row.id), status: status }
  163. });
  164. },
  165. //点击搜索按钮触发
  166. searchChange(params, done) {
  167. if (params.businesDate) {
  168. params.businesStartDate = params.businesDate[0];
  169. params.businesEndDate = params.businesDate[1];
  170. }
  171. if (params.requiredDeliveryDate) {
  172. params.requiredDeliveryStartDate = params.requiredDeliveryDate[0];
  173. params.requiredDeliveryEndDate = params.requiredDeliveryDate[1];
  174. }
  175. delete params.businesDate;
  176. delete params.requiredDeliveryDate;
  177. this.page.currentPage = 1;
  178. this.onLoad(this.page, params);
  179. done();
  180. },
  181. currentChange(val) {
  182. this.page.currentPage = val;
  183. },
  184. sizeChange(val) {
  185. this.page.currentPage = 1;
  186. this.page.pageSize = val;
  187. },
  188. onLoad(page, params) {
  189. getList(page.currentPage, page.pageSize, params).then(res => {
  190. this.dataList = res.data.data.records ? res.data.data.records : [];
  191. this.page.total = res.data.data.total;
  192. if (this.page.total) {
  193. this.option.height = window.innerHeight - 380;
  194. } else {
  195. this.option.height = window.innerHeight - 305;
  196. }
  197. });
  198. },
  199. refreshChange() {
  200. this.onLoad(this.page, this.search);
  201. },
  202. newAdd() {
  203. this.$router.$avueRouter.closeTag();
  204. this.$router.push({
  205. path: "/exportpurchaseContract_detailsPage",
  206. query:{
  207. pageType:'new'
  208. }
  209. });
  210. }
  211. }
  212. };
  213. </script>
  214. <style scoped>
  215. ::v-deep .select-component {
  216. display: flex;
  217. }
  218. </style>