<template>
  <el-dialog
    title="选择流程"
    :visible.sync="dialogVisible"
    width="720px"
    @close="close"
  >
    <el-form
      ref="fillForm"
      :model="fillForm"
      label-width="200px"
      style="width: 500px"
    >
      <el-form-item
        label="选择流程："
        prop="processesId"
        :rules="[{ required: true, message: '请选择流程', trigger: 'blur' }]"
      >
        <el-select
          v-model="fillForm.processesId"
          placeholder="请选择流程"
          clearable
        >
          <el-option
            v-for="item in processesList"
            :key="item.id"
            :label="item.name"
            :value="item.id"
          >
          </el-option>
        </el-select>
      </el-form-item>
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button @click="dialogVisible = false">取 消</el-button>
      <el-button type="primary" @click="submit">确 定</el-button>
    </span>
  </el-dialog>
</template>

<script>
export default {
  name: "selectArisDialog",
  data() {
    return {
      id: "",
      fillForm: {
        processesId: "",
      },
      processesList: [],
      dialogVisible: false,
    };
  },

  methods: {
    async init() {},

    async open(data) {
      this.dialogVisible = true;
      await this.init();
      if (data) {
        console.log("data", data);
        this.processesList = data;
      } else {
      }
    },
    submit() {
      this.$refs["fillForm"].validate((valid) => {
        if (valid) {
          this.$emit("closeDialog", { processesId: this.fillForm.processesId });
          this.dialogVisible = false;
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },
    close() {
      this.dialogVisible = false;
      this.$emit("closeDialog");
    },
  },
};
</script>

<style lang="sass" scoped>
</style>