index.vue 5.4 KB

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