<template>
  <div>
    <el-button @click="dialogVisible = !dialogVisible">批量复核</el-button>
    <el-dialog title="批量复核" :visible.sync="dialogVisible" width="30%">
      <el-form ref="form" label-width="120px">
        <el-form-item label="复核状态">
          <el-select v-model="fInspStatusName" placeholder="请选择" style="width: 100%">
            <el-option label="同意" value="同意"></el-option>
            <el-option label="不同意" value="不同意"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="复核备注">
          <el-input v-model="fInspNotes"></el-input>
        </el-form-item>
      </el-form>
      <span slot="footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="onSubmit">确 认</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
import {updateInsp} from '@/api/service/dailyFunds'
import moment from 'moment'

export default {
  props: {
    row: {
      type: Object
    },
    column: {
      type: Object
    },
    index: {
      type: String
    },
    desc: {
      type: String
    },
    selectRows: {
      type: Object
    }
  },

  data() {
    return {
      dialogVisible: false,
      fInspStatusName: null,
      fInspNotes: null,
    };
  },

  created() {

  },
  methods: {
    onSubmit() {

      console.log('selectRows', this.selectRows);
      if (!this.selectRows || this.selectRows.length == 0) {
        this.$message.error('请选择数据！');
        return false;
      } else {
        this.$confirm('是否确认批量复核1？', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          let wDailyFundsList = [];
          this.selectRows.forEach(d => {
            wDailyFundsList.push({
              id: d.id_,
              fDate: d.wdailyfundsfdate + " 00:00:00",
              fOrgName: d.wdailyfundsforgname,
              fOrgId: d.wdailyfundsforgid,
              fOrgType: d.wdailyfundsforgtype
            })
          })
          updateInsp({
            wDailyFundsList: wDailyFundsList,
            fInspStatusName: this.fInspStatusName,
            fInspNotes: this.fInspNotes
          }).then((res) => {
            if (res.state) {
              this.$message.success(res.message)
              this.$emit("RefreshTable");
              this.dialogVisible = false;
            } else {
              this.$emit("RefreshTable");
              this.$message.warning(res.message)
              this.dialogVisible = false;
            }
          })
        });
      }
    },
    onClick() {
      // console.log('selectRows',this.selectRows);
      // console.log('row',this.row);
      // console.log('column',this.column);
      // console.log('index',this.index);
      // console.log('desc',this.desc);
    }
  }
}
</script>


<style scoped lang='scss'>
::v-deep {
  .el-dialog__footer {
    text-align: center !important;

    .el-button {
      margin-left: 20px;
    }
  }
}
</style>
