add.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <template>
  2. <div>
  3. <el-button type="primary" size="small" @click="drawer=true">
  4. {{$t('新建')}}
  5. </el-button>
  6. <el-drawer
  7. :title="$t(`新建执行器`)"
  8. :visible.sync="drawer"
  9. :wrapperClosable="false"
  10. size="664px"
  11. direction="rtl"
  12. append-to-body
  13. :show-close="false">
  14. <div class="drawer__panel">
  15. <customForm ref="form" formname="form" v-if="drawer"></customForm>
  16. </div>
  17. <div class="fixed__btn__panel">
  18. <el-button size="small" @click="drawer = false" class="normal-btn-width">{{$t('取 消')}}</el-button>
  19. <el-button size="small" type="primary" @click="onSubmit" :loading="loading" class="normal-btn-width">{{$t('确 定')}}</el-button>
  20. </div>
  21. </el-drawer>
  22. </div>
  23. </template>
  24. <script>
  25. import customForm from '@/components/customForm/customForm'
  26. import {mapGetters} from "vuex";
  27. export default {
  28. components:{customForm},
  29. data () {
  30. return {
  31. drawer:false,
  32. type:'',
  33. valvetype:''
  34. }
  35. },
  36. computed:{
  37. ...mapGetters({
  38. loading:'loading'
  39. })
  40. },
  41. watch: {
  42. },
  43. methods:{
  44. onSubmit () {
  45. this.$refs.form.validateFields(()=>{
  46. this.$store.commit('setLoading',true)
  47. this.$api.requested({
  48. id:2024060513384502,
  49. content: this.$refs.form.form
  50. }).then(res=>{
  51. this.tool.showMessage(res,() => {
  52. this.$store.dispatch('changeDetailDrawer',true)
  53. this.$router.push({path:'/executeDetail',query:{id:res.data.itemid,rowindex:res.data.rowindex}})
  54. this.drawer = false
  55. this.$emit('onSuccess',res.data)
  56. })
  57. this.$store.commit('setLoading',false)
  58. })
  59. })
  60. },
  61. },
  62. }
  63. </script>
  64. <style scoped>
  65. .dialog-footer{
  66. margin-top:32px;
  67. text-align: center;
  68. }
  69. </style>