<template>
  <el-dialog title="审核" append-to-body :modelValue="openShow" width="30%" @close="closeDialog">
    <avue-form :option="option"></avue-form>

    <template #footer>
      <span class="dialog-footer">
        <el-button @click="closeDialog">取 消</el-button>
        <el-button type="primary" @click="submit">确 定</el-button>
      </span>
    </template>
  </el-dialog>
</template>
<script>
import {
  updateProcess,
} from '../../api/flowManagement/index';
export default {
  props: {
    showDialog: {
      type: Boolean,
      default: false,
    },
  },
  data() {
    return {
      openShow: false,
      option: {
        submitBtn: false,
        emptyBtn: false,
        column: [
          {
            label: '审批结果',
            prop: 'input',
            span: 24,
            type: 'radio',
            dicData: [
              { label: '审批通过', value: 0 },
              { label: '审批不通过', value: 1 },
            ],
            rules: [{ required: true, message: '请输入姓名', trigger: 'blur' }],
          },
          {
            label: '驳回原因',
            prop: 'input2',
            // type: 'select',
            type: 'textarea',
            span: 24,
            // dicData: [
            //     {
            //         label: '不需要结算',
            //         value: '1',
            //     },
            //     {
            //         label: '基础数据有误',
            //         value: '2',
            //     }
            // ]
          },
        ],
      },
    };
  },
  mounted() {
    this.openShow = this.showDialog;
  },
  methods: {
    closeDialog() {
      this.openShow = false;
      this.$emit('closeDialog');
    },
    submit() {
      this.$refs.form.validate(async (valid) => {
        if (valid) {
          let params = {
            id: this.$route.query.id,
            approvalStatus:'',
            
            // status: this.option.column[0].value,
            // reason: this.option.column[1].value,
          };
          updateProcess(params).then((res) => { 
            if (res.code == 200) {
              this.$message.success('操作成功');
              this.closeDialog();
            }
          });
          
        }
      })
    }
  },
};
</script>
<style lang="scss" scoped></style>
