index.vue 5.2 KB

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