<template>
  <div>
    <el-dialog title="添加特征" :visible.sync="visible" width="800px" :before-close="close" append-to-body>
        <div>
            <el-form :model="form" label-position="right" label-width="140px" >
                <el-form-item label="所属权要：">
                    <span>权要{{ form.rightId+1 }}</span>
                </el-form-item>
                <el-form-item label="证据文献：">
                    <span>{{ form.proofSortStr }}</span>
                </el-form-item>
                <el-form-item label="所属特征：">
                    <div class="selectButton">
                        <el-select v-model="form.featureId" placeholder="请选择"  style="width:100%" :popperAppendToBody="false" >
                            <el-option v-for="item in featureList" :key="item.featureId" :label="item.featureName" :value="item.featureId">
                                <el-tooltip class="item" effect="dark" :content="item.content" placement="top">
                                    <span>{{ item.featureName }}</span>
                                </el-tooltip>
                            </el-option>
                        </el-select>
                        <el-button @click.stop="addFeature( )" ><i class="el-icon-plus"></i></el-button>
                    </div>
                </el-form-item>
                <el-form-item label="无效请求书理由：">
                    <myRich-Text placeholder="请输入无效请求书理由" v-model="form.proofStr"></myRich-Text>
                </el-form-item>
                <el-form-item label="答辩意见：">
                    <myRich-Text placeholder="请输入答辩意见" v-model="form.argumentStr"></myRich-Text>
                </el-form-item>
            </el-form>
        </div>
        <div slot="footer" class="dialog-footer">
            <el-button @click="close">取 消</el-button>
            <el-button type="primary" @click="submit">确 定</el-button>
        </div>
    </el-dialog>
    <el-dialog title="添加特征" :visible.sync="addFeatureVisible" width="800px" :before-close="closeFeature" append-to-body>
      <div>
        <rightContent :reportId="form.reportId" ref="rightContent"></rightContent>
      </div>
    </el-dialog>
  </div>
</template>

<script>
// import { RichText1 } from '@/views/components/common/RichText/mixins';
import rightContent from '../addFeatures/rightContent.vue'
export default {
  components: {
    rightContent
  },
//   mixins:[RichText1],
  props: ['featureList'],
  data() {
    return {
        visible:false,
        addFeatureVisible:false,
        form:{},
        rightDetails:{}
    };
  },
  watch: {},
  computed: {},
  created() {},
  mounted() {},
  methods: {
    open(form,right){
        this.form = {...form,
            proofStr:"",
            argumentStr:"",
         }
        this.rightDetails = right
        this.visible = true
    },
    closeFeature() {
      this.addFeatureVisible = false
      this.$emit('addFeature')
    },
    close(){
        this.visible = false
    },
    submit(){
        this.$api.addArguments(this.form).then(response=>{
            if(response.code == 200){
                this.$message.success('添加成功')
                this.close()
                this.$emit('submit',true)
            }
        })
    },
     //添加特征
     addFeature() {
      this.addFeatureVisible=true
      this.$nextTick(()=>{
        this.$refs.rightContent.open(this.rightDetails)
    })
    },
  },
};
</script>
<style lang="scss">
  @import '@/assets/css/selectButton.scss';
</style>
<style lang="scss" scoped>
</style>