<template>
    <el-dialog title="批量修改控制标识" top="10px" :visible.sync="visible" width="40%" v-dialogDrag :close-on-click-modal="false"
      :before-close="cancel">
      <el-form :model="form" ref="ruleForm" size="mini" label-width="120px">
        <el-form-item label="控制标识：" prop="desItem">
          <el-select v-model="form.desItem" placeholder="请选择" style="width: 80%">
            <el-option v-for="item in identifyData" :key="item.id" :label="item.label" :value="item.label"
              :disabled="item.disabled">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item></el-form-item>
      </el-form>
      <div class="btnClass" style="text-align: right;">
        <el-button type="primary" size="mini" @click="sumbit('ruleForm')">
        保存
        </el-button>
        <el-button type="info" size="mini" @click="cancel"> 返回 </el-button>
    </div>
    </el-dialog>
  </template>
  
  <script>
  import {getFindList} from "@/api/system-management/templateSetting";
  export default {
    props: {
      visible: {
        type: Boolean,
        default: () => false,
      },
    },
    data() {
      return {
        form: {
          desItem: "",
        },
        identifyData:[],
        ruleForm:{
            desItem:[
                { required: true, message: '请选择', trigger: 'change' },
            ]
        }
        
      };
    },
    methods: {
        // 获取控制标识数据
        getIdentifyList() {
            getFindList({
                type: "control_identifier",
            }).then((res) => {
                this.identifyData = res.body.list;
            });
        },
        sumbit(formName) {
            this.$refs[formName].validate((valid) => {
            if (valid) {
                this.$emit("sumbit", this.form);
            } else {
                console.log("error submit!!");
                return false;
            }
            });
        },
        cancel() {
            this.$refs['ruleForm'].resetFields()
            this.$emit("cancel");
        },
    },
    mounted(){
        this.getIdentifyList();
        console.log()
    }
  };
  </script>
  
  <style lang="scss" scoped>
  ::v-deep {
    .el-divider--horizontal {
      margin: 13px 0;
    }
  }
  </style>
  