prompt.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. import lodash from 'lodash'
  2. const prompt = {
  3. data() {
  4. return {
  5. expands: [],
  6. queryParams: {
  7. current: 1,
  8. size: 10
  9. },
  10. total: 0,
  11. open: false,
  12. loading: false,
  13. detailList: {},
  14. companyList: [],
  15. dialogFormVisible: false,
  16. title: '',
  17. dialogType: ''
  18. }
  19. },
  20. methods: {
  21. resetClick(queryParams) {
  22. this.queryParams.current = 1
  23. this.$refs[queryParams].resetFields()
  24. this.getList()
  25. },
  26. searchClick() {
  27. this.queryParams.current = 1
  28. this.getList()
  29. },
  30. handleDetail(row) {
  31. this.detailList = row
  32. this.open = true
  33. },
  34. addClick() {
  35. this.title = '新增'
  36. this.dialogType = 'add'
  37. this.dialogFormVisible = true
  38. },
  39. editClick(row) {
  40. this.ruleForm = lodash.clone(row)
  41. this.title = '修改'
  42. this.dialogType = 'update'
  43. this.dialogFormVisible = true
  44. },
  45. resetForm(ruleForm) {
  46. this.reset()
  47. this.$refs[ruleForm].resetFields()
  48. this.dialogFormVisible = false
  49. },
  50. // 每页显示多少条
  51. handleSizeChange(val) {
  52. this.queryParams.size = val
  53. this.getList()
  54. },
  55. // 点击当前页
  56. handleCurrentChange(val) {
  57. // Object.keys(this.queryParams).forEach(key => {
  58. // if (this.queryParams[key] == 10 || this.queryParams[key] == 20 || this.queryParams[key] == 50 || this.queryParams[key] == 100 || this.queryParams[key] == 200) {
  59. //
  60. // }else {
  61. // this.queryParams[key] = ''
  62. // }
  63. // });
  64. this.queryParams.current = val
  65. this.getList()
  66. }
  67. }
  68. }
  69. export default prompt