addEdit.vue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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="closeModel"
  14. >
  15. <!-- {{ sitem }} -->
  16. <el-card style="margin-top: -20px" v-loading="loading">
  17. <add-edit-form
  18. v-if="showModel"
  19. :id="id"
  20. :sitem="sitem"
  21. :show-model="showModel"
  22. :is-detail="isDetail"
  23. @closeModel="handClick"
  24. @refresh="refresh"
  25. />
  26. </el-card>
  27. </el-dialog>
  28. </template>
  29. <script>
  30. import addEditForm from "./addEditForm.vue";
  31. export default {
  32. name: "handover",
  33. props: ["showModel", "id", "isDetail", "sitem"],
  34. components: {
  35. addEditForm,
  36. },
  37. data() {
  38. return {
  39. sitem: null,
  40. title: "",
  41. showModelThis: this.showModel,
  42. };
  43. },
  44. watch: {
  45. showModel: function (val) {
  46. this.showModelThis = val;
  47. if (val) {
  48. this.initForm();
  49. }
  50. },
  51. showModelThis(val) {
  52. if (!val) {
  53. this.$emit("cancel");
  54. }
  55. },
  56. },
  57. methods: {
  58. closeModel() {
  59. console.log("closeModel!!");
  60. },
  61. async initForm() {
  62. this.loading = true;
  63. console.log(this.id);
  64. if (this.id === "add") {
  65. this.title = "新建售后申请";
  66. this.rulesThis = this.rules;
  67. } else {
  68. if (this.isDetail) {
  69. this.rulesThis = {};
  70. } else {
  71. this.rulesThis = this.rules;
  72. }
  73. }
  74. this.loading = false;
  75. },
  76. handClick(e) {
  77. console.log(e);
  78. this.showModelThis = e;
  79. },
  80. refresh(e) {
  81. console.log(e);
  82. this.showModelThis = e;
  83. this.$emit("refresh", true);
  84. },
  85. },
  86. };
  87. </script>
  88. <style lang="scss" scoped>
  89. </style>