RepairManageModal.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <template>
  2. <j-modal
  3. :title="title"
  4. :width="width"
  5. :visible="visible"
  6. switchFullscreen
  7. @ok="handleOk"
  8. :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
  9. @cancel="handleCancel"
  10. cancelText="关闭">
  11. <repair-manage-form v-if="modalType==='form'" ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></repair-manage-form>
  12. <repair-manage-dispatch v-if="modalType==='dispatch'" ref="dispatchForm"></repair-manage-dispatch>
  13. </j-modal>
  14. </template>
  15. <script>
  16. import RepairManageForm from './RepairManageForm'
  17. import RepairManageDispatch from './RepairManageDispatch.vue'
  18. export default {
  19. name: 'RepairManageModal',
  20. components: {
  21. RepairManageForm,
  22. RepairManageDispatch
  23. },
  24. data () {
  25. return {
  26. title:'',
  27. width:800,
  28. visible: false,
  29. disableSubmit: false,
  30. modalType: 'form',
  31. }
  32. },
  33. methods: {
  34. add () {
  35. this.visible=true
  36. this.$nextTick(()=>{
  37. this.$refs.realForm.add();
  38. })
  39. },
  40. edit (record) {
  41. this.visible=true
  42. this.$nextTick(()=>{
  43. this.$refs.realForm.edit(record);
  44. })
  45. },
  46. dispatch (record) {
  47. console.log(this.modalType)
  48. this.modalType = 'dispatch'
  49. this.visible=true
  50. this.$nextTick(()=>{
  51. this.$refs.dispatchForm.dispatch(record);
  52. })
  53. },
  54. close () {
  55. this.$emit('close');
  56. this.visible = false;
  57. this.modalType = 'form';
  58. },
  59. handleOk () {
  60. this.$refs.realForm.submitForm();
  61. },
  62. submitCallback(){
  63. this.$emit('ok');
  64. this.visible = false;
  65. this.modalType = 'form';
  66. },
  67. handleCancel () {
  68. this.close()
  69. }
  70. }
  71. }
  72. </script>