<template>
  <div>
    <el-button size="small" type="primary"  @click="dialogVisible = true;listData()">编 辑</el-button>
    <el-drawer
        title="编辑提成发放清单"
        :visible.sync="dialogVisible"
        size="700px"
        direction="rtl"
        append-to-body
        @close="onClose">
      <div class="drawer__panel">
        <el-row :gutter="20">
          <el-form :model="form" :rules="rules" ref="formRef" label-width="120px" label-position="left" size="mini">
            <el-col :span="24">
              <el-form-item label="备注:" prop="remarks">
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-input v-model="form.remarks" type="textarea" rows="5" placeholder="请输入备注信息"></el-input>
            </el-col>
          </el-form>
        </el-row>
      </div>
      <div class="fixed__btn__panel">
        <el-button size="small" @click="onClose" class="normal-btn-width">取 消</el-button>
        <el-button size="small" type="primary"  @click="onSubmit" class="normal-btn-width">确 定</el-button>
      </div>
    </el-drawer>
  </div>
</template>

<script>
export default {
  name: "edit",
  props:["data"],
  data(){
    return {
      dialogVisible:false,
      tablecols:[],
      list:[],
      form:{
        "sa_hrpayapplyid":0,
        "billdate": new Date().getFullYear() + '-' + (new Date().getMonth() + 1) + '-' + new Date().getDate(),
        "billno":"",
        "remarks":"",
        "hrpayapplydetail": []
      },
      rules:{},
    }
  },
  methods:{
    async listData(){
      const res = await this.$api.requested(this.param)
      this.list = res.data
    },
    selectionChange(row){
      this.form.hrpayapplydetail = row.map(item=>{
        return {
          "sa_hrpayapplydetailid": 0,
          "remarks": item.remarks,
          "sa_hrcashbillid": item.sa_hrcashbillid
        }
      })
    },
    async onSubmit(){
      const res = await this.$api.requested({
        "id": "20240117105204",
        "content": this.form
      })
      this.tool.showMessage(res,()=>{
        this.dialogVisible = false
        this.$emit('onSuccess')
      })
    },
    onClose(){
      this.dialogVisible = false
      this.form = {
        "sa_hrpayapplyid":0,
        "billdate": '',
        "billno":"",
        "remarks":"",
        "hrpayapplydetail": []
      }
    }
  },
}
</script>

<style scoped>

</style>
