<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>
|