index.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*
  2. * @Author: howie
  3. * @Date: 2022-06-14 10:14:37
  4. * @LastEditors: howie
  5. * @LastEditTime: 2022-07-03 17:47:25
  6. * @FilePath: \supply-front\src\mixin\index.js
  7. * @Description:
  8. *
  9. * Copyright (c) 2022, All Rights Reserved.
  10. */
  11. export default {
  12. data() {
  13. return {
  14. currentPage: 1, // 当前页码
  15. pageSize: 10, // 每页数量
  16. listTotal: 0, // 列表总数
  17. listLoading: false, // 加载
  18. screenForm: {}, // 筛选表单数据
  19. dataList: [], // 表格数据
  20. ids: [], // 多选数据id
  21. dialogVisible: false, // 弹框
  22. conditionList: [],
  23. dataList:[]
  24. }
  25. },
  26. created() {
  27. this.getList();
  28. },
  29. methods: {
  30. // 提交筛选表单
  31. submitScreenForm() {
  32. this.currentPage = 1;
  33. this.getList();
  34. },
  35. // 重置筛选表单
  36. resetScreenForm() {
  37. this.$refs.screenForm.resetFields();
  38. this.currentPage = 1;
  39. this.getList();
  40. },
  41. hanlePagination(val){
  42. // 更改每页数量
  43. this.handleSizeChange(val)
  44. // 更改当前页
  45. this.handleCurrentChange(val)
  46. },
  47. // 更改每页数量
  48. handleSizeChange(val) {
  49. this.pageSize = val;
  50. this.currentPage = 1;
  51. this.getList();
  52. },
  53. // 更改当前页
  54. handleCurrentChange(val) {
  55. this.currentPage = val;
  56. this.getList();
  57. },
  58. // Windows全局打印
  59. hanlePrint() {
  60. window.print()
  61. },
  62. // 筛选全部数据
  63. hanleSelectAll(selection,index) {
  64. this.ids = selection.map((k) => {
  65. return k.id || k.updPriceBillId;
  66. });
  67. console.log(this.ids);
  68. },
  69. /**
  70. * @description 单条数据删除 或者 全部数据删除
  71. * @author zhou
  72. * @param {*} id 删除单条数据传
  73. * @return {*} Promise.resolve(ids)
  74. */
  75. hanleDeleteAllPromise(id) {
  76. return new Promise((resolve, reject) => {
  77. const ids = id ? [id] : this.ids
  78. if (!ids.length) {
  79. this.$errorMsg("请选择删除内容");
  80. return;
  81. }
  82. resolve(ids)
  83. })
  84. }
  85. }
  86. }