addEdit.vue 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <template>
  2. <el-dialog
  3. title="新建售后退货"
  4. :center="true"
  5. align="left"
  6. top="22vh"
  7. width="1000px"
  8. :close-on-click-modal="false"
  9. :visible.sync="showModelThis"
  10. element-loading-text="拼命加载中"
  11. element-loading-spinner="el-icon-loading"
  12. element-loading-background="rgba(0, 0, 0, 0.8)"
  13. @close="showModelThis = false"
  14. >
  15. <el-card v-loading="loading" style="margin-top: -20px">
  16. <add-edit-form
  17. v-if="showModel"
  18. :id="id"
  19. :sitem="sitem"
  20. :show-model="showModel"
  21. :is-detail="isDetail"
  22. @closeModel="handClick"
  23. @refresh="refresh"
  24. />
  25. </el-card>
  26. </el-dialog>
  27. </template>
  28. <script>
  29. import addEditForm from './addEditForm.vue'
  30. export default {
  31. name: 'Handover',
  32. components: {
  33. addEditForm
  34. },
  35. props: ['showModel', 'id', 'isDetail', 'sitem'],
  36. data() {
  37. return {
  38. sitem: null,
  39. title: '',
  40. showModelThis: this.showModel
  41. }
  42. },
  43. watch: {
  44. showModel: function(val) {
  45. this.showModelThis = val
  46. if (val) {
  47. this.initForm()
  48. }
  49. },
  50. showModelThis(val) {
  51. if (!val) {
  52. this.$emit('cancel')
  53. }
  54. }
  55. },
  56. methods: {
  57. async initForm() {
  58. this.loading = true
  59. if (this.id === 'add') {
  60. this.title = '新建售后退货'
  61. this.rulesThis = this.rules
  62. } else {
  63. if (this.isDetail) {
  64. this.rulesThis = {}
  65. } else {
  66. this.rulesThis = this.rules
  67. }
  68. }
  69. this.loading = false
  70. },
  71. handClick(e) {
  72. this.showModelThis = e
  73. },
  74. refresh(e) {
  75. console.log(e)
  76. this.showModelThis = e
  77. this.$emit('refresh', true)
  78. }
  79. }
  80. }
  81. </script>
  82. <style lang="scss" scoped>
  83. </style>