低代码平台完成
This commit is contained in:
		
							
								
								
									
										77
									
								
								tpl/add.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										77
									
								
								tpl/add.vue
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,77 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <section class="add">
 | 
			
		||||
    <ai-detail>
 | 
			
		||||
      <ai-title slot="title" :title="pageTitle"/>
 | 
			
		||||
      <template #content>
 | 
			
		||||
        <el-form ref="AddForm" :model="form" size="small" label-width="120px" :rules="rules">
 | 
			
		||||
          @content
 | 
			
		||||
        </el-form>
 | 
			
		||||
      </template>
 | 
			
		||||
      <template #footer>
 | 
			
		||||
        <el-button @click="back">取消</el-button>
 | 
			
		||||
        <el-button type="primary" @click="submit">提交</el-button>
 | 
			
		||||
      </template>
 | 
			
		||||
    </ai-detail>
 | 
			
		||||
  </section>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
export default {
 | 
			
		||||
  name: "add",
 | 
			
		||||
  props: {
 | 
			
		||||
    instance: Function,
 | 
			
		||||
    dict: Object,
 | 
			
		||||
    permissions: Function
 | 
			
		||||
  },
 | 
			
		||||
  computed: {
 | 
			
		||||
    isEdit: v => !!v.$route.query.id,
 | 
			
		||||
    pageTitle: v => v.isEdit ? "编辑@name" : "新增@name"
 | 
			
		||||
  },
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      form: {},
 | 
			
		||||
      rules: {
 | 
			
		||||
        @rules
 | 
			
		||||
      },
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    getDetail() {
 | 
			
		||||
      let {id} = this.$route.query
 | 
			
		||||
      id && this.instance.post("/node/@rightCode/detail", null, {
 | 
			
		||||
        params: {id}
 | 
			
		||||
      }).then(res => {
 | 
			
		||||
        if (res?.data) {
 | 
			
		||||
          this.form = res.data
 | 
			
		||||
        }
 | 
			
		||||
      })
 | 
			
		||||
    },
 | 
			
		||||
    back() {
 | 
			
		||||
      this.$router.push({})
 | 
			
		||||
    },
 | 
			
		||||
    submit() {
 | 
			
		||||
      this.$refs.AddForm.validate(v => {
 | 
			
		||||
        if (v) {
 | 
			
		||||
          this.instance.post("/node/@rightCode/addOrUpdate", this.form).then(res => {
 | 
			
		||||
            if (res?.code == 0) {
 | 
			
		||||
              this.$message.success("提交成功!")
 | 
			
		||||
              this.back()
 | 
			
		||||
            }
 | 
			
		||||
          })
 | 
			
		||||
        }
 | 
			
		||||
      })
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
  created() {
 | 
			
		||||
    this.getDetail()
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
<style lang="scss" scoped>
 | 
			
		||||
.add {
 | 
			
		||||
  .half {
 | 
			
		||||
    width: 50%
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
		Reference in New Issue
	
	Block a user