<!--
  @description: 业务配置编辑页面
  @Modifier: haofengxian
  @routerPath: /systemManagement/serviceConfiguration
  @date: 2020-9-24-11:30
-->
<template>
  <div>
    <!--标题-->
    <div class="title title_border p0-16">
      <i class="el-icon-s-home" />业务配置
    </div>
    <div class="p16">
      <el-form
        ref="fromData"
        :rules="rules"
        :inline-message="true"
        :model="formData"
      >
        <table class="from_table">
          <tr>
            <td>
              <el-form-item ref="expertFeedocTimeDec" label="专家名单解密时间（小时）" prop="expertFeedocTimeDec">
                <el-popover
                  placement="top-start"
                  popper-class="hint"
                  offset="5"
                  trigger="hover"
                  content="此处设定评标前几小时解密专家名单"
                >
                  <el-button slot="reference" type="info" class="prompt">
                    <i class="iconfont icon-qm" />
                  </el-button>
                </el-popover>
              </el-form-item>
            </td>
            <td>
              <el-input v-model="formData.expertFeedocTimeDec" placeholder="请输入" />
            </td>
            <td>
              <el-form-item ref="expertFeedocTimeDeficiency" label="提示保证金不足时间（天）" prop="expertFeedocTimeDeficiency">
                <el-popover
                  placement="top-start"
                  popper-class="hint"
                  offset="5"
                  trigger="hover"
                  content="此处设定开票前几天提示项目经理投标人保证金未到账或保证金不足，最小为0.5天"
                >
                  <el-button slot="reference" type="info" class="prompt">
                    <i class="iconfont icon-qm" />
                  </el-button>
                </el-popover>
              </el-form-item>
            </td>
            <td>
              <el-input v-model="formData.expertFeedocTimeDeficiency" placeholder="请输入" />
            </td>
          </tr>
          <tr>
            <td>
              <el-form-item ref="expertFeedocTimeOrverdue" label="保证金预期时间（天） " prop="expertFeedocTimeOrverdue">
                <el-popover
                  placement="top-start"
                  popper-class="hint"
                  offset="5"
                  trigger="hover"
                  content="此处设定在中标通知书发送成功几个自然日未发起保证金退款是逾期"
                >
                  <el-button slot="reference" type="info" class="prompt">
                    <i class="iconfont icon-qm" />
                  </el-button>
                </el-popover>
              </el-form-item>
            </td>
            <td>
              <el-input v-model="formData.expertFeedocTimeOrverdue" placeholder="请输入" />
            </td>
            <td />
            <td />
          </tr>
        </table>
      </el-form>
      <div class="but_footer">
        <div class="but_footer-h">
          <div class="but_footer-but">
            <el-button type="primary" @click="saveSystemTimeConfig('form')">
              生效
            </el-button>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
/* 接口*/
import { getSystemTimeConfig, saveOfupdateSystemTimeConfig } from '@api/common/tools'
/* 公用方法*/
import { characters1_auto } from '@/assets/js/validate'// 校验输入内容
export default {
  name: 'ServiceConfigAdd',
  data() {
    return {
      formData: {
        expertFeedocTimeDec: '', // 专家名单解密时间
        expertFeedocTimeDeficiency: '', // 提示保证金不足时间
        expertFeedocTimeOrverdue: '', // 保证金逾期时间
        id: ''
      },
      rules: {
        expertFeedocTimeDec: [{ required: true, validator: characters1_auto, trigger: 'blur' }],
        expertFeedocTimeDeficiency: [{ required: true, validator: characters1_auto, trigger: 'change' }],
        expertFeedocTimeOrverdue: [{ required: true, validator: characters1_auto, trigger: 'change' }]
      }
    }
  },
  created() {
    this.handleGetSystemTimeConfig()
  },
  methods: {
    // 获取系统时间配置
    handleGetSystemTimeConfig() {
      getSystemTimeConfig().then(res => {
        this.formData = res.data
      }).catch(() => {
      })
    },
    // 保存业务设置
    saveSystemTimeConfig() {
      this.$confirm('确认生效?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        confirmButtonClass: 'confirmBtn',
        cancelButtonClass: 'cancelBtn',
        type: 'warning'
      }).then(() => {
        saveOfupdateSystemTimeConfig(this.formData).then(res => {
          this.$message.success(res.header.msg)
        }).catch(() => {
        })
      }).catch(() => {
      })
    }
  }
}
</script>

<style scoped>

</style>
