frockForm.vue 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <template>
  2. <div>
  3. <Base :form-data="formData" page-type="frock" :module="module" :common-data="commonData" />
  4. <Model :form-data="formData" page-type="frock" :module="module" :common-data="commonData" />
  5. <div style="margin: 20px 0">
  6. <el-button type="primary" size="small" @click="onSbumit(1)">提交</el-button>
  7. <el-button type="primary" size="small" @click="onSbumit(2)">暂存-草稿箱</el-button>
  8. <el-button size="small" @click="onReset">重置</el-button>
  9. </div>
  10. </div>
  11. </template>
  12. <script>
  13. import Base from '../components/base.vue'
  14. import Model from '../components/model.vue'
  15. import Mixin from '../mixin'
  16. import { addLoginFrock, editLoginFrock, submitLoginFrock } from '@/api/frock'
  17. export default {
  18. components: {
  19. Base,
  20. Model
  21. },
  22. mixins: [Mixin],
  23. methods: {
  24. onSbumit(type) {
  25. const params = {
  26. ...this.formData
  27. }
  28. if (params.fileList.length) {
  29. params.drawUpload = params.fileList[0].url
  30. }
  31. if (type === 1) {
  32. submitLoginFrock(params).then(res => {
  33. this.commonFn('提交成功')
  34. })
  35. } else {
  36. if (!this.detailId) {
  37. addLoginFrock(params).then(res => {
  38. this.commonFn('新增成功')
  39. })
  40. return
  41. }
  42. editLoginFrock(params).then(res => {
  43. this.commonFn('编辑成功')
  44. })
  45. }
  46. },
  47. commonFn(name) {
  48. this.$successMsg(name)
  49. this.$emit('updateList')
  50. }
  51. }
  52. }
  53. </script>
  54. <style lang="scss" scoped></style>