index.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. <template>
  2. <basic-container>
  3. <avue-crud :option="option"
  4. :data="dataList"
  5. ref="crud"
  6. v-model="form"
  7. :page.sync="page"
  8. @row-del="rowDel"
  9. @row-update="rowUpdate"
  10. :before-open="beforeOpen"
  11. :before-close="beforeClose"
  12. @row-save="rowSave"
  13. @search-change="searchChange"
  14. @search-reset="searchReset"
  15. @selection-change="selectionChange"
  16. @current-change="currentChange"
  17. @size-change="sizeChange"
  18. @refresh-change="refreshChange"
  19. @on-load="onLoad">
  20. <template slot="menuLeft">
  21. <el-button size="small"
  22. type="success"
  23. :disabled="true"
  24. @click.stop=""
  25. >复制新单
  26. </el-button>
  27. <el-button size="small"
  28. type="info"
  29. @click.stop=""
  30. >报表
  31. </el-button>
  32. </template>
  33. <template slot-scope="scope" slot="menu">
  34. <el-button
  35. type="text"
  36. icon="el-icon-view"
  37. size="small"
  38. @click.stop="beforeOpenPage(scope.row,scope.index)"
  39. >查看
  40. </el-button>
  41. <el-button
  42. type="text"
  43. icon="el-icon-edit"
  44. size="small"
  45. @click.stop="editOpen(scope.row,scope.index)"
  46. >编辑
  47. </el-button>
  48. <el-button
  49. type="text"
  50. icon="el-icon-delete"
  51. size="small"
  52. @click.stop="rowDel(scope.row,scope.index)"
  53. >删除
  54. </el-button>
  55. </template>
  56. </avue-crud>
  57. </basic-container>
  58. </template>
  59. <script>
  60. import option from "./config/mainList.json";
  61. import {customerList, typeSave, deleteDetails} from "@/api/basicData/configuration"
  62. import {selectInvoiceList,
  63. removeInvoiceList,} from "@/api/importTrade/invoice"
  64. export default {
  65. name: "customerInformation",
  66. data() {
  67. return {
  68. form: {},
  69. option: option,
  70. parentId: 0,
  71. dataList: [],
  72. page: {
  73. pageSize: 10,
  74. pagerCount: 5,
  75. total: 0,
  76. }
  77. }
  78. },
  79. created() {
  80. },
  81. methods: {
  82. //删除列表后面的删除按钮触发触发(row, index, done)
  83. rowDel(row, index, done) {
  84. this.$confirm("确定将选择数据删除?", {
  85. confirmButtonText: "确定",
  86. cancelButtonText: "取消",
  87. type: "warning"
  88. }).then(() => {
  89. return removeInvoiceList(row.id);
  90. }).then(() => {
  91. this.$message({
  92. type: "success",
  93. message: "操作成功!"
  94. });
  95. this.page.currentPage = 1;
  96. this.onLoad(this.page);
  97. });
  98. },
  99. //修改时的修改按钮点击触发
  100. rowUpdate(row, index, done, loading) {
  101. typeSave(row).then(() => {
  102. this.$message({
  103. type: "success",
  104. message: "操作成功!"
  105. });
  106. // 数据回调进行刷新
  107. done(row);
  108. }, error => {
  109. window.console.log(error);
  110. loading();
  111. });
  112. },
  113. //新增修改时保存触发
  114. rowSave(row, done, loading) {
  115. typeSave(row).then(res => {
  116. console.log(res)
  117. done()
  118. })
  119. },
  120. //查询全部
  121. initData() {
  122. customerList().then(res => {
  123. console.log(this.form);
  124. const column = this.findObject(this.option.column, "parentId");
  125. column.dicData = res.data.data.records;
  126. });
  127. },
  128. //新增子项触发
  129. handleAdd(row) {
  130. this.parentId = row.id;
  131. const column = this.findObject(this.option.column, "parentId");
  132. column.value = row.id;
  133. column.addDisabled = true;
  134. this.$refs.crud.rowAdd();
  135. },
  136. //查看跳转页面
  137. beforeOpenPage(row, index) {
  138. this.$router.push({
  139. path: "/importInvoice_detailsPage",
  140. query: {id: JSON.stringify(row.id)},
  141. });
  142. },
  143. //新增跳转页面
  144. beforeOpen(row, index) {
  145. this.$router.push({
  146. path: "/importInvoice_detailsPage",
  147. query: {id: JSON.stringify(row.id)},
  148. });
  149. },
  150. editOpen(row, index) {
  151. this.$router.push({
  152. path: "/importInvoice_detailsPage",
  153. query: {id: JSON.stringify(row.id)},
  154. });
  155. },
  156. //点击新增时触发
  157. beforeClose(done) {
  158. this.parentId = "";
  159. const column = this.findObject(this.option.column, "parentId");
  160. column.value = "";
  161. column.addDisabled = false;
  162. done();
  163. },
  164. //点击搜索按钮触发
  165. searchChange(params, done) {
  166. this.page.currentPage = 1;
  167. this.onLoad(this.page, params);
  168. done()
  169. },
  170. searchReset() {
  171. console.log('1')
  172. },
  173. selectionChange() {
  174. console.log('1')
  175. },
  176. currentChange() {
  177. console.log('1')
  178. },
  179. sizeChange() {
  180. console.log('1')
  181. },
  182. refreshChange() {
  183. console.log('1')
  184. },
  185. onLoad(page, params) {
  186. let queryParams = Object.assign({}, params, {
  187. size: page.pageSize,
  188. current: page.currentPage,
  189. })
  190. selectInvoiceList(queryParams).then(res => {
  191. this.dataList = res.data.data.records
  192. this.page.total = res.data.data.total
  193. })
  194. },
  195. }
  196. }
  197. </script>
  198. <style scoped>
  199. </style>