<template>
        <div class="dialog-content dialog-jointly-batch">
            <div class="p-16">
                <el-form ref="ruleForm" 
                        :model="ObjectInfo" 
                        :rules="rulesClient" 
                        label-width="100px" 
                        class="demo-ruleForm">
                        <el-row :gutter="20" type="flex" align="middle">
                            <el-col :span="24">
                            <el-form-item label="选择协办员" prop="assistMediatorId">
                                <el-select v-model="ObjectInfo.assistMediatorId"
                                           clearable placeholder="请选择" class="width100">
                                    <el-option
                                            v-for="item in operateMethodOptions"
                                            :key="item.id"
                                            :label="item.realName"
                                            :value="item.id"
                                            :disabled="userInfo.id == item.id ? true : false">
                                    </el-option>
                                </el-select>
                            </el-form-item>
                            </el-col>
                        </el-row>
                </el-form>
            </div>
            <span class="dialog-footer">
                <el-button size="small" @click="handleClose()">取消</el-button>
                <el-button size="small" type="primary" @click="handleSubmit()">提交协办</el-button>
            </span>
        </div>
</template>
<script>
import api from "@/services/caseManagement";
    export default {
        components: {
        },
        props: {
            caseId: {
                type: String,
                default: () => {},
            },
        },
        data() {
            return {
                userInfo:this.$store.state.userinfo,
                operateMethodOptions:[],
                ObjectInfo:{
                    assistMediatorId: '',
                    id:'',
                },
                rulesClient: {
                    assistMediatorId: [
                        { required: true, message: '请选择协办人员', trigger: 'change',},
                    ],
                },
            };
        },
        mounted () {
            this.getuserList()
        },
        methods: {
            // 列表数据
            getuserList() {
                api.getCurrGroupUserList().then(res => {
                    if (!res.code) {
                        this.operateMethodOptions = res
                    }
                })
            },
            handleSubmit(){
                if(!this.$clickThrottle()) { return }//防止重复点击
                this.$refs.ruleForm.validate((valid) => {
                    if(valid) {
                        this.ObjectInfo.id = this.caseId
                        api.updateAssistMediator(this.ObjectInfo).then((res) => {
                            this.$message.success("提交协办成功");
                            this.handleClose()
                            this.$emit('handleSubmit',23213)
                        });
                    }
                })
            },

            handleClose() {
                this.$emit('update:singlejointlyvisible', false)
            },
        }
    };
</script>

<style scoped lang="scss">
.dialog-jointly-batch {
  width: 395px;
  max-height: 500px;

  .tabs__search-criteria-title {
    width: 100%;
  }

  .case-batch-num {
    background-color: rgba(236, 238, 241, 0.8196078431);
    padding: 15px 20px;
    border-radius: 4px;

    a {
      font-size: 16px;
      font-weight: 500;
      color: #C66A5B;
    }
  }

  .officelist {
    background-color: rgba(236, 238, 241, 0.8196078431);
    padding: 20px 20px;

    .el-checkbox {
      width: 180px;
      margin: 10px;
    }
  }
  .dialog-footer{
    display: inline-block;
    width: 400px;
    text-align: right;
    border-top: solid 1px #E5E6EB;
    padding: 10px;
  }
}
</style>