<template>
  <div>
    <el-button size="mini" @click="editBtn">编 辑</el-button>
    <el-drawer
      title="我是标题"
      :visible.sync="drawer"
      :with-header="false"
      direction="rtl"
      size="30%"
      append-to-body
      @close="closeDrawer">
      <div>
    <!-- <p class="normal-title normal-panel" style="line-height:32px;padding-left:16px;border-bottom:1px solid #eeeeee">新建合同</p> -->
      <div>
        <p class="normal-title normal-panel" style="border-bottom:1px solid #cccccc;padding:16px">编辑合同</p>
        <div class="container normal-panel" style="padding-bottom:0">
          <!--合作协议-->
          <el-row v-if="$route.query.type == '框架'">
            <el-form :model="form" :rules="rules" ref="form" label-position="right" label-width="100px" size="small">
              <el-col :span="24">
                <el-form-item label="合同模板" prop="sys_printmodelid">
                  <el-select v-model="form.sys_printmodelid">
                    <el-option label="一一一" value="111"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="经销商" prop="enterprisename">
                  <el-popover
                    placement="bottom"
                    trigger="manual"
                    v-model="agentVisible"
                    width="400">
                    <selectAgent ref="member" :param="agentListPrams" :radio="true" @onSelect="agentChange" @onCancel="agentVisible = false"></selectAgent>
                    <el-input readonly type="text" slot="reference" size="small" @focus="agentVisible=true;salerVisible = false;projectVisible=false" v-model="form.enterprisename"></el-input>
                  </el-popover>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="业务员" prop="saler_hrid">
                  <el-popover
                    placement="bottom"
                    trigger="manual"
                    v-model="salerVisible"
                    width="300">
                    <selectPople ref="member" :param="salerListParams" :radio="true" @onSelect="salerChange" @onCancel="salerVisible = false"></selectPople>
                    <el-input readonly type="text" slot="reference" size="small" @focus="salerVisible=true;agentVisible=false" v-model="form.salername"></el-input>
                  </el-popover>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="整体折扣" prop="discountrate">
                  <el-input type="text" size="small" v-model="form.discountrate"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="合同有效期" prop="begdate">
                  <el-input style="display:none" v-model="form.begdate"></el-input>
                <time-select ref="timeSelect" class="inline-16" @clearSelect="clearTime" @timeChange="timeChange"></time-select>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="签约日期" prop="signdate">
                  <el-date-picker
                    v-model="form.signdate"
                    type="date"
                    value-format="yyyy-MM-dd"
                    placeholder="选择日期">
                  </el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="合同描述" prop="remarks">
                  <el-input type="text" size="small" v-model="form.remarks"></el-input>
                </el-form-item>
              </el-col>
            </el-form>
          </el-row>
          <!--经销项目-->
          <el-row v-if="$route.query.type == '经销项目'">
            <el-form :model="form" :rules="rules" ref="form" label-position="right" label-width="100px" size="small">
              <el-col :span="24">
                <el-form-item label="合同模板" prop="sys_printmodelid">
                  <el-select v-model="form.sys_printmodelid">
                    <el-option label="一一一" value="111"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="经销商" prop="enterprisename">
                  <el-popover
                    placement="bottom"
                    trigger="manual"
                    v-model="agentVisible"
                    width="400">
                    <selectAgent ref="member" :param="agentListPrams" :radio="true" @onSelect="agentChange" @onCancel="agentVisible = false"></selectAgent>
                    <el-input readonly type="text" slot="reference" size="small" @focus="agentVisible=true;salerVisible = false;projectVisible=false" v-model="form.enterprisename"></el-input>
                  </el-popover>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="项目名称" prop="sa_projectid">
                  <el-popover
                    placement="bottom"
                    trigger="manual"
                    v-model="projectVisible"
                    width="600">
                    <seleteProject @onSelect="projectChange" @onCanel="projectVisible=false"></seleteProject>
                    <el-input readonly type="text" slot="reference" size="small" @focus="projectVisible=true;salerVisible = false;agentVisible=false" v-model="form.projectname"></el-input>
                  </el-popover>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="业务员" prop="saler_hrid">
                  <el-popover
                    placement="bottom"
                    trigger="manual"
                    v-model="salerVisible"
                    width="400">
                    <selectPople ref="member" :param="salerListParams" :radio="true" @onSelect="salerChange" @onCancel="salerVisible = false"></selectPople>
                    <el-input readonly type="text" slot="reference" size="small" @focus="salerVisible=true;agentVisible=false;projectVisible=false" v-model="form.salername"></el-input>
                  </el-popover>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="合同有效期" prop="begdate">
                  <input type="text" style="display:none" v-model="form.begdate">
                <time-select ref="timeSelect" class="inline-16" @clearSelect="clearTime" @timeChange="timeChange"></time-select>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="签约日期" prop="signdate">
                  <el-date-picker
                    v-model="form.signdate"
                    type="date"
                    value-format="yyyy-MM-dd"
                    placeholder="选择日期">
                  </el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="签约金额">
                  <el-input type="text" readonly size="small" placeholder="产品清单总额(自动计算)" v-model="form.signamount"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="合同描述" prop="hrid">
                  <el-input type="text" size="small" v-model="form.remarks"></el-input>
                </el-form-item>
              </el-col>
            </el-form>
          </el-row>
          <!--直销项目-->
          <el-row v-if="$route.query.type == '直销项目'">
            <el-form :model="form" :rules="rules" ref="form" label-position="right" label-width="100px" size="small">
              <el-col :span="24">
                <el-form-item label="合同模板" prop="sys_printmodelid">
                  <el-select v-model="form.sys_printmodelid">
                    <el-option label="一一一" value="111"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="客户" prop="enterprisename">
                  <el-popover
                    placement="bottom"
                    trigger="manual"
                    v-model="accountVisible"
                    width="400">
                    <selectAgent ref="member" :param="agentListPrams" :radio="true" @onSelect="accountChange" @onCancel="accountVisible = false"></selectAgent>
                    <el-input readonly type="text" slot="reference" size="small" @focus="accountVisible=true;agentVisible=false;salerVisible = false;projectVisible=false" v-model="form.enterprisename"></el-input>
                  </el-popover>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="项目名称" prop="sa_projectid">
                  <el-popover
                    placement="bottom"
                    trigger="manual"
                    v-model="projectVisible"
                    width="600">
                    <seleteProject @onSelect="projectChange" @onCanel="projectVisible=false"></seleteProject>
                    <el-input readonly type="text" slot="reference" size="small" @focus="projectVisible=true;salerVisible = false;agentVisible=false;accountVisible=false" v-model="form.projectname"></el-input>
                  </el-popover>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="业务员" prop="saler_hrid">
                  <el-popover
                    placement="bottom"
                    trigger="manual"
                    v-model="salerVisible"
                    width="300">
                    <selectPople ref="member" :param="salerListParams" :radio="true" @onSelect="salerChange" @onCancel="salerVisible = false"></selectPople>
                    <el-input readonly type="text" slot="reference" size="small" @focus="salerVisible=true;agentVisible=false;accountVisible=false;projectVisible=false" v-model="form.salername"></el-input>
                  </el-popover>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="签约日期" prop="signdate">
                  <el-date-picker
                    v-model="form.signdate"
                    type="date"
                    placeholder="选择日期">
                  </el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="合同有效期" prop="begdate">
                  <input type="text" style="display:none" v-model="form.begdate">
                <time-select ref="timeSelect" class="inline-16" @clearSelect="clearTime" @timeChange="timeChange"></time-select>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="签约金额">
                  <el-input type="text" readonly size="small" placeholder="产品清单总额(自动计算)" v-model="form.signamount"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="16">
                <el-form-item label="合同描述" prop="hrid">
                  <el-input type="text" size="small" v-model="form.remarks"></el-input>
                </el-form-item>
              </el-col>
            </el-form>
          </el-row>
          <!--工具使用协议-->
          <el-row v-if="$route.query.type == '工具借用'">
            <el-form :model="form" :rules="rules" ref="form" label-position="right" label-width="100px" size="small">
              <el-col :span="24">
                <el-form-item label="合同模板" prop="sys_printmodelid">
                  <el-select v-model="form.sys_printmodelid">
                    <el-option label="一一一" value="111"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="客户" prop="enterprisename">
                  <el-popover
                    placement="bottom"
                    trigger="manual"
                    v-model="accountVisible"
                    width="400">
                    <selectAgent ref="member" :param="agentListPrams" :radio="true" @onSelect="accountChange" @onCancel="accountVisible = false"></selectAgent>
                    <el-input readonly type="text" slot="reference" size="small" @focus="accountVisible=true;salerVisible = false" v-model="form.enterprisename"></el-input>
                  </el-popover>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="业务员" prop="saler_hrid">
                  <el-popover
                    placement="bottom"
                    trigger="manual"
                    v-model="salerVisible"
                    width="300">
                    <selectPople ref="member" :param="salerListParams" :radio="true" @onSelect="salerChange" @onCancel="salerVisible = false"></selectPople>
                    <el-input readonly type="text" slot="reference" size="small" @focus="salerVisible=true;accountVisible=false" v-model="form.salername"></el-input>
                  </el-popover>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="签约日期" prop="signdate">
                  <el-date-picker
                    v-model="form.signdate"
                    type="date"
                    placeholder="选择日期">
                  </el-date-picker>
                </el-form-item>
              </el-col>
              
              <el-col :span="24">
                <el-form-item label="签约金额">
                  <el-input type="text" readonly size="small" placeholder="产品清单总额(自动计算)" v-model="form.signamount"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="合同有效期" prop="begdate">
                  <input type="text" style="display:none" v-model="form.begdate">
                <time-select ref="timeSelect" class="inline-16" @clearSelect="clearTime" @timeChange="timeChange"></time-select>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="单套价格">
                  <el-input type="text" readonly size="small"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="16">
                <el-form-item label="合同描述" prop="hrid">
                  <el-input type="text" size="small" v-model="form.remarks"></el-input>
                </el-form-item>
              </el-col>
            </el-form>
          </el-row>
          <!--居间协议-->
          <el-row v-if="$route.query.type == '居间'">
            <el-form :model="form" :rules="rules" ref="form" label-position="right" label-width="110px" size="small">
              <el-col :span="24">
                <el-form-item label="合同模板" prop="sys_printmodelid">
                  <el-select v-model="form.sys_printmodelid">
                    <el-option label="一一一" value="111"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="居间服务商" prop="sys_enterpriseid">
                  <el-popover
                    placement="bottom"
                    trigger="manual"
                    v-model="agentVisible"
                    width="400">
                    <selectAgent ref="member" :param="agentListPrams" :radio="true" @onSelect="accountChange" @onCancel="agentVisible = false"></selectAgent>
                    <el-input readonly type="text" slot="reference" size="small" @focus="agentVisible=true;salerVisible = false;projectVisible=false;accountVisible=false" v-model="form.enterprisename"></el-input>
                  </el-popover>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="项目名称" prop="sa_projectid">
                  <el-popover
                    placement="bottom"
                    trigger="manual"
                    v-model="projectVisible"
                    width="600">
                    <seleteProject @onSelect="projectChange" @onCanel="projectVisible=false"></seleteProject>
                    <el-input readonly type="text" slot="reference" size="small" @focus="projectVisible=true;salerVisible = false;agentVisible=false;accountVisible=false" v-model="form.projectname"></el-input>
                  </el-popover>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="业务员" prop="saler_hrid">
                  <el-popover
                    placement="bottom"
                    trigger="manual"
                    v-model="salerVisible"
                    width="300">
                    <selectPople ref="member" :param="salerListParams" :radio="true" @onSelect="salerChange" @onCancel="salerVisible = false"></selectPople>
                    <el-input readonly type="text" slot="reference" size="small" @focus="salerVisible=true;projectVisible=false;agentVisible=false;accountVisible=false" v-model="form.salername"></el-input>
                  </el-popover>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="签约日期" prop="signdate">
                  <el-date-picker
                    v-model="form.signdate"
                    type="date"
                    placeholder="选择日期">
                  </el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="佣金比例(%)" prop="kickback">
                  <el-input type="text" size="small" v-model="form.kickback"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="合同有效期" prop="begdate">
                  <input type="text" style="display:none" v-model="form.begdate">
                <time-select ref="timeSelect" class="inline-16" @clearSelect="clearTime" @timeChange="timeChange"></time-select>
                </el-form-item>
              </el-col>
              <el-col :span="16">
                <el-form-item label="合同描述" prop="hrid">
                  <el-input type="text" size="small" v-model="form.remarks"></el-input>
                </el-form-item>
              </el-col>
            </el-form>
          </el-row>
        </div>
      </div>
      <div class="fixed__btn__panel">
        <el-button size="small" @click="onCancel" class="normal-btn-width">取 消</el-button>
        <el-button size="small" type="primary" @click="onSubmit" class="normal-btn-width">确 定</el-button>
      </div>
    </div>
    </el-drawer>
  </div>
</template>

<script>
import {mapGetters} from 'vuex'

export default {
  props:['data'],
  data () {
    return {
      drawer:false
    }
  },
  methods:{
    closeDrawer () {
    },
    editBtn () {
      this.drawer = true
    },
  },
  created() {
    this.getModelList()
  },
  mounted () {
  }
}

</script>
<style scoped>
/deep/.el-drawer {
  background: #F1F2F3 !important;
}
</style>