index.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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. </template>
  25. <template slot="corpIdSearch">
  26. <select-component
  27. v-model="search.corpId"
  28. :configuration="configuration"
  29. ></select-component>
  30. </template>
  31. <template slot-scope="scope" slot="corpId">
  32. {{ scope.row.corpsName }}
  33. </template>
  34. <template slot-scope="scope" slot="menu">
  35. <el-button
  36. type="text"
  37. icon="el-icon-view"
  38. size="small"
  39. @click.stop="beforeOpenPage(scope.row, scope.index)"
  40. >查看
  41. </el-button>
  42. <el-button
  43. type="text"
  44. icon="el-icon-edit"
  45. size="small"
  46. @click.stop="editOpen(scope.row, scope.index)"
  47. >编辑
  48. </el-button>
  49. <el-button
  50. type="text"
  51. icon="el-icon-delete"
  52. size="small"
  53. @click.stop="rowDel(scope.row, scope.index)"
  54. >删除
  55. </el-button>
  56. </template>
  57. </avue-crud>
  58. </basic-container>
  59. </template>
  60. <script>
  61. import option from "./config/mainList.json";
  62. import { getList, remove } from "@/api/basicData/customerInquiry";
  63. import { orderStateFormat } from "@/enums/order-stauts";
  64. export default {
  65. name: "customerInformation",
  66. data() {
  67. return {
  68. configuration: {
  69. multipleChoices: false,
  70. multiple: false,
  71. collapseTags: false,
  72. placeholder: "请点击右边按钮选择",
  73. dicData: []
  74. },
  75. search: {},
  76. option: option,
  77. parentId: 0,
  78. dataList: [{}],
  79. page: {
  80. pageSize: 10,
  81. currentPage: 1,
  82. total: 0
  83. }
  84. };
  85. },
  86. methods: {
  87. //删除列表后面的删除按钮触发触发(row, index, done)
  88. rowDel(row, index, done) {
  89. this.$confirm("确定将选择数据删除?", {
  90. confirmButtonText: "确定",
  91. cancelButtonText: "取消",
  92. type: "warning"
  93. }).then(() => {
  94. remove(row.id);
  95. this.$message({
  96. type: "success",
  97. message: "操作成功!"
  98. });
  99. this.page.currentPage = 1;
  100. this.onLoad(this.page);
  101. });
  102. },
  103. //查看跳转页面
  104. beforeOpenPage(row, index) {
  105. this.$router.push({
  106. path: "/exportcustomerInquiry_detailsPage",
  107. query: { id: JSON.stringify(row.id) }
  108. });
  109. },
  110. //新增跳转页面
  111. beforeOpen(row) {
  112. console.log(row);
  113. this.$router.push({
  114. path: "/exportInvoice_detailsPage",
  115. query: { id: JSON.stringify(row.id) }
  116. });
  117. },
  118. editOpen(row) {
  119. this.$router.push({
  120. path: "/exportcustomerInquiry_detailsPage",
  121. query: { id: JSON.stringify(row.id) }
  122. });
  123. },
  124. //点击搜索按钮触发
  125. searchChange(params, done) {
  126. this.page.currentPage = 1;
  127. this.onLoad(this.page, params);
  128. done();
  129. },
  130. currentChange(val) {
  131. this.page.currentPage = val;
  132. },
  133. sizeChange(val) {
  134. this.page.currentPage = 1;
  135. this.page.pageSize = val;
  136. },
  137. onLoad(page, params) {
  138. getList(page.currentPage, page.pageSize, params).then(res => {
  139. this.dataList = res.data.data.records ? res.data.data.records : [];
  140. this.page.total = res.data.data.total;
  141. if (this.page.total) {
  142. this.option.height = window.innerHeight - 380;
  143. } else {
  144. this.option.height = window.innerHeight - 305;
  145. }
  146. });
  147. },
  148. refreshChange() {
  149. this.onLoad(this.page, this.search);
  150. },
  151. newAdd() {
  152. this.$router.push({
  153. path: "/exportcustomerInquiry_detailsPage"
  154. });
  155. }
  156. }
  157. };
  158. </script>
  159. <style scoped>
  160. ::v-deep .select-component {
  161. display: flex;
  162. }
  163. </style>