edit.vue 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <template>
  2. <div class="inline-16">
  3. <el-button type="text" icon="el-icon-edit" size="small" class="inline-16" style="color:#333" @click="onShow()">编 辑</el-button>
  4. <el-dialog title="编辑群组" append-to-body :visible.sync="dialogFormVisible" width="600px">
  5. <el-form :model="form" ref="form" label-position="right" label-width="80px" size="small">
  6. <el-form-item label="群组名称" prop="groupname" :rules="[
  7. { required: true, message: '群组名称不能为空'},
  8. ]">
  9. <el-input v-model="form.groupname" autocomplete="on" placeholder="输入群组名称"></el-input>
  10. </el-form-item>
  11. </el-form>
  12. <div slot="footer" class="dialog-footer">
  13. <el-button size="small" style="width:120px" @click="dialogFormVisible = false">取 消</el-button>
  14. <el-button size="small" style="width:120px" type="primary" @click="addGroup()">确 定</el-button>
  15. </div>
  16. </el-dialog>
  17. </div>
  18. </template>
  19. <script>
  20. export default {
  21. props:['data'],
  22. data () {
  23. return {
  24. dialogFormVisible:false,
  25. form:{}
  26. }
  27. },
  28. methods:{
  29. onShow () {
  30. this.dialogFormVisible = true
  31. this.form = Object.assign({},this.form,this.data.data)
  32. },
  33. addGroup () {
  34. this.$refs['form'].validate(async (valid) => {
  35. if (!valid) return false;
  36. const res = this.$api.requested({
  37. "id": "20220831164203",
  38. "version":1,
  39. "content": this.form
  40. })
  41. this.tool.showMessage(res,()=>{
  42. setTimeout(() => {
  43. this.$emit('onSuccess')
  44. }, 500);
  45. this.dialogFormVisible = false
  46. })
  47. });
  48. }
  49. }
  50. }
  51. </script>
  52. <style>
  53. </style>