index.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. <template>
  2. <basic-container v-if="show">
  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,1)"
  39. >查看
  40. </el-button>
  41. <el-button
  42. type="text"
  43. icon="el-icon-edit"
  44. size="small"
  45. @click.stop="editOpen(scope.row,2)"
  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. <detail-page
  59. ref="detail"
  60. @goBack="goBack"
  61. :detailData="detailData"
  62. v-else
  63. ></detail-page>
  64. </template>
  65. <script>
  66. import option from "./config/mainList.json";
  67. import {customerList, typeSave, deleteDetails} from "@/api/basicData/configuration"
  68. import {selectInvoiceList,
  69. removeInvoiceList,} from "@/api/importTrade/invoice"
  70. import detailPage from "./detailsPageEdit.vue";
  71. export default {
  72. name: "customerInformation",
  73. data() {
  74. return {
  75. form: {},
  76. option: option,
  77. parentId: 0,
  78. show:true,
  79. detailData:{},
  80. dataList: [],
  81. page: {
  82. pageSize: 10,
  83. pagerCount: 5,
  84. total: 0,
  85. }
  86. }
  87. },
  88. components:{
  89. detailPage
  90. },
  91. created() {
  92. if(this.$route.query.form){
  93. this.detailData={
  94. form:this.$route.query.form
  95. }
  96. this.show = false;
  97. }
  98. },
  99. methods: {
  100. //删除列表后面的删除按钮触发触发(row, index, done)
  101. rowDel(row, index, done) {
  102. this.$confirm("确定将选择数据删除?", {
  103. confirmButtonText: "确定",
  104. cancelButtonText: "取消",
  105. type: "warning"
  106. }).then(() => {
  107. return removeInvoiceList(row.id);
  108. }).then(() => {
  109. this.$message({
  110. type: "success",
  111. message: "操作成功!"
  112. });
  113. this.page.currentPage = 1;
  114. this.onLoad(this.page);
  115. });
  116. },
  117. //修改时的修改按钮点击触发
  118. rowUpdate(row, index, done, loading) {
  119. typeSave(row).then(() => {
  120. this.$message({
  121. type: "success",
  122. message: "操作成功!"
  123. });
  124. // 数据回调进行刷新
  125. done(row);
  126. }, error => {
  127. window.console.log(error);
  128. loading();
  129. });
  130. },
  131. //新增修改时保存触发
  132. rowSave(row, done, loading) {
  133. typeSave(row).then(res => {
  134. console.log(res)
  135. done()
  136. })
  137. },
  138. //查询全部
  139. initData() {
  140. customerList().then(res => {
  141. console.log(this.form);
  142. const column = this.findObject(this.option.column, "parentId");
  143. column.dicData = res.data.data.records;
  144. });
  145. },
  146. //新增子项触发
  147. handleAdd(row) {
  148. this.parentId = row.id;
  149. const column = this.findObject(this.option.column, "parentId");
  150. column.value = row.id;
  151. column.addDisabled = true;
  152. this.$refs.crud.rowAdd();
  153. },
  154. //查看跳转页面
  155. beforeOpenPage(row, status) {
  156. this.detailData = {
  157. id: row.id,
  158. status: status
  159. };
  160. this.show = false;
  161. },
  162. //新增跳转页面
  163. beforeOpen(row) {
  164. this.detailData = {
  165. id: row.id,
  166. status: 0
  167. };
  168. this.show = false;
  169. },
  170. editOpen(row, status) {
  171. this.detailData = {
  172. id: row.id,
  173. status: status
  174. };
  175. this.show = false;
  176. },
  177. //点击新增时触发
  178. beforeClose(done) {
  179. this.parentId = "";
  180. const column = this.findObject(this.option.column, "parentId");
  181. column.value = "";
  182. column.addDisabled = false;
  183. done();
  184. },
  185. //点击搜索按钮触发
  186. searchChange(params, done) {
  187. this.page.currentPage = 1;
  188. this.onLoad(this.page, params);
  189. done()
  190. },
  191. searchReset() {
  192. console.log('1')
  193. },
  194. selectionChange() {
  195. console.log('1')
  196. },
  197. currentChange() {
  198. console.log('1')
  199. },
  200. sizeChange() {
  201. console.log('1')
  202. },
  203. refreshChange() {
  204. console.log('1')
  205. },
  206. onLoad(page, params) {
  207. let queryParams = Object.assign({}, params, {
  208. size: page.pageSize,
  209. current: page.currentPage,
  210. })
  211. selectInvoiceList(queryParams).then(res => {
  212. this.dataList = res.data.data.records
  213. this.page.total = res.data.data.total
  214. })
  215. },
  216. goBack() {
  217. this.detailData=this.$options.data().detailData
  218. this.show = true;
  219. }
  220. }
  221. }
  222. </script>
  223. <style scoped>
  224. </style>