峰峰执法平台简易案件程序板块 pad端
yang
2022-10-17 4107256a8d1fa9a2db0969122bfc760994b12421
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<template>
  <el-dialog
    title="修改"
    :visible.sync="dialogVisible"
    width="30%"
    :before-close="handleClose"
    v-dialogDrag>
    <div>
      <el-input
        type="textarea"
        v-model="lawVal"
        placeholder="请输入内容"
        :rows="type == 3 ? 4 : 1"></el-input>
        <div class="modifyLawBtn">
          <el-button type="primary" @click="modifyLawBtn">修改</el-button>
        </div>
    </div>
  </el-dialog>
</template>
 
<script>
   import {content} from "../../../api/lawAndReg/lawAndReg";
 
   export default {
        name: "modifyLawForm",
        data() {
            return {
                dialogVisible: false,
                title: '',
                content:'',
                lawVal:'',
                id: '',
                bianContent:'',
                zhangContent:'',
                jieContent:'',
                tiaoContent:'',
                type:'',
                pid:''
            }
        },
        computed: {
        },
        methods: {
            init(val) {
                console.log(val)
                this.title = val.title
                this.content = val.content
                this.id = val.id
                this.type = val.type
                this.pid = val.pid
                this.dialogVisible = true
                if(val.title || val.content) {
                    this.lawVal = this.title + ' ' + this.content
                }
            },
            handleClose() {
                this.dialogVisible = false
            },
            modifyLawBtn() {  //修改
                console.log(this.lawVal,'this.lawVal===')
                if(this.type == 0) {
                    this.bianContent = this.lawVal
                }else if(this.type == 1) {
                    this.zhangContent = this.lawVal
                    console.log(this.zhangContent,'this.zhangContent====')
                }else if(this.type == 2) {
                    this.jieContent = this.lawVal
                }else if(this.type == 3) {
                    this.tiaoContent = this.lawVal
                }
                let params = {
                    id: this.id,
                    zhangContent: this.zhangContent,  //章
                    bianContent: this.bianContent, //编
                    jieContent: this.jieContent, //节内容
                    tiaoContent: this.tiaoContent, //节内容
                }
                content(params).then(res => {
                    console.log(res,'res====')
                   if(res.data.code == 0) {
                       this.$message.success('修改成功')
                       this.$emit('callBack', this.id)
                       this.dialogVisible = false
                   }else {
                       this.$message.success('修改失败')
                       this.dialogVisible = false
                   }
                })
 
            }
        }
    }
</script>
 
<style lang="scss" scoped>
  .modifyLawBtn{
    width: 100%;
    display: flex;
    justify-content: center;
    margin-top: 20px;
  }
 
</style>