<template>
  <div class="app-container">
    <div class="filter-container">
      <div class="filter-group ">
        <div class="filter-lable">
          企业名称：
        </div>
        <div class="filter-width">
          <el-input v-model="KEYWORDS" placeholder="搜索" class="filter-item"/>
        </div>
      </div>
      <div :style="{'margin-top': searchFromCollapse ? '0px' : '10px'}" class="filter-group">
        <el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="getQuery">
          搜索
        </el-button>
        <el-button v-waves class="filter-item" type="success" icon="el-icon-refresh" @click="goKeyReset">
          重置
        </el-button>
      </div>
      <!--      <el-button v-waves class="filter-item" type="info" icon="el-icon-bottom-right" size="mini" plain @click="getExcelModel">-->
      <!--        导出-->
      <!--      </el-button>-->
    </div>
    <el-table
      v-loading="listLoading"
      ref="multipleTable"
      :data="varList"
      :row-key="getRowKey"
      :header-cell-style="{
        'font-weight': 'bold',
        'color': '#000'
      }"
      :row-class-name="tableRowClassName"
      tooltip-effect="dark"
      border
      fit
      highlight-current-row
    >
      <el-table-column
        :reserve-selection="true"
        type="selection"
        width="55"
        align="center"/>
      <el-table-column type="index" label="序号" width="50" align="center" />
      <el-table-column prop="CORP_NAME" label="企业名称" />
      <el-table-column prop="CREATTIME" label="开户日期" />

      <el-table-column prop="COMPANY_AREA" label="所属区域" />
      <el-table-column prop="VIPLEVELNAME" label="会员级别" />
      <el-table-column label="操作" width="380" align="center" >
        <template slot-scope="{row}">
          <el-button v-show="edit" type="primary" icon="el-icon-refresh" size="mini" @click="resetPwd(row.CORPINFO_ID)">重置密码</el-button>
          <el-button type="success" icon="el-icon-view" size="mini" @click="handleShow(row)">查看</el-button>
          <el-button type="warning" icon="el-icon-edit" size="mini" @click="handleEdit(row)">编辑</el-button>
          <el-button v-show="del" type="danger" icon="el-icon-delete" size="mini" @click="handleDelete(row.CORPINFO_ID)">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    <div class="page-btn-group">
      <div>
        <el-button v-show="add" type="primary" icon="el-icon-plus" @click="handleAdd">新增</el-button>
      </div>
      <pagination :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="getList" />
    </div>
    <el-dialog :visible.sync="dialogFormDeliver" title="交付" width="600px">
      <el-form ref="form" :rules="deliverRules" :model="form" label-width="110px" style="width: 500px;">
        <el-form-item label="交付日期" prop="DELIVERDATE">
          <el-date-picker id="DELIVERDATE" ref="DELIVERDATE" v-model="form.DELIVERDATE" :picker-options="pickerOptions" value-format="yyyy-MM-dd" format="yyyy-MM-dd" style="width: 100%" type="date" placeholder="交付日期"/>
        </el-form-item>
        <el-form-item label="使用期限" prop="TERM">

          <el-select v-model="form.TERM" placeholder="请选择">
            <el-option v-for="item in formList" :key="item.ID" :label="item.NAME" :value="item.ID" />
          </el-select>
        </el-form-item>

        <el-form-item label="合同">
          <span>{{ form.CONTRACT_FILE && form.CONTRACT_FILE.name }}</span>
          <el-upload :before-upload="beforeListingFileUpload" class="avatar-uploader" accept=".pdf" action="">
            <el-button type="primary">上传</el-button>
          </el-upload>
        </el-form-item>

      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="closeDeliver">取 消</el-button>
        <el-button type="warning" @click="deliver(1)">清 除</el-button>
        <el-button type="primary" @click="deliver(2)">确 定</el-button>
      </div>
    </el-dialog>
    <el-dialog :visible.sync="dialogFormRenew" title="续费" width="600px">
      <el-form ref="form" :rules="renewRules" :model="form" label-width="110px" style="width: 500px;">

        <el-form-item label="使用期限" prop="TERM">
          <el-select v-model="form.TERM" placeholder="请选择">
            <el-option v-for="item in formList" :key="item.ID" :label="item.NAME" :value="item.ID" />
          </el-select>
        </el-form-item>
        <el-form-item label="合同">
          <span>{{ form.CONTRACT_FILE && form.CONTRACT_FILE.name }}</span>
          <el-upload :before-upload="beforeListingFileUpload" class="avatar-uploader" accept=".pdf" action="">
            <el-button type="primary">上传</el-button>
          </el-upload>
        </el-form-item>

      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormRenew = false">取 消</el-button>
        <el-button type="primary" @click="renew()">确 定</el-button>
      </div>
    </el-dialog>

    <el-dialog :visible.sync="dialogFormStop" title="停用" width="600px">
      <el-form ref="form" :rules="stopRules" :model="form" label-width="110px" style="width: 500px;">
        <el-form-item label="停用原因：" prop="STOPREASON">
          <el-input v-model="form.STOPREASON" placeholder="请输入内容" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormStop = false">取 消</el-button>
        <el-button type="primary" @click="goStop()">确 定</el-button>
      </div>
    </el-dialog>
    <el-dialog :visible.sync="dialogFormEdit" :title="dialogType==='edit'?'修改':'新增'" width="600px">
      <el-form ref="form" :rules="rules" :model="form" label-width="110px" style="width: 500px;">
        <el-form-item label="有效使用起始时间" prop="USE_DATE_START">
          <el-date-picker
            v-model="form.USE_DATE_START"
            type="date"
            placeholder="选择日期"/>
        </el-form-item>
        <el-form-item label="有效使用结束时间" prop="USE_DATE_END">
          <el-date-picker
            v-model="form.USE_DATE_END"
            type="date"
            placeholder="选择日期"/>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormEdit = false">取 消</el-button>
        <el-button type="primary" @click="goupdateISuseSave">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import Pagination from '@/components/Pagination' // 通过 el-pagination二次打包
import { requestFN } from '@/utils/request'
import waves from '@/directive/waves' // waves directive
import { upload } from '@/utils/upload'
export default {
  components: { Pagination },
  directives: { waves },
  data() {
    return {
      listLoading: true,
      add: false,
      del: false,
      edit: false,
      inputmarket: '',
      inputproject: '',
      inputimplementation: '',
      inputmaintenance: '',
      listQuery: {
        page: 1,
        limit: 10
      },
      ROLEID: JSON.parse(sessionStorage.getItem('user')).ROLEID,
      searchFromCollapse: true,
      total: 0,
      KEYWORDS: '',
      varList: [],
      pd: [],
      form: {
        CONTRACT_FILE: {},
        file: ''
      },
      MARKETING_PERSON: '',
      IMPLEMENTATION_PERRON: '',
      PROJECT_LEADER: '',
      MAINTENANCE_PERSON: '',
      dates: [],
      areaList: [], // 属地
      areaProps: {
        lazy: true,
        lazyLoad: this.lazyLoad,
        value: 'numValue',
        id: 'id',
        label: 'label',
        children: 'children',
        checkStrictly: true
      },
      marketingPersonList: [], // 市场人员
      implementationPersonList: [],
      projectPersonList: [],
      maintenancePersonList: [],
      POSSESSION: [],
      isAdmin: false,
      dialogFormChange: false,
      changForm: {
        CORPINFO_ID: '',
        AGENCY_MANAGEMENT_ID: '',
        marketingPerson: '',
        marketingPersonName: '',
        projectPerson: '',
        projectPersonName: '',
        implementationPerson: '',
        implementationPersonName: '',
        maintenancePerson: '',
        maintenancePersonName: '',
        WHETHER_PRE_SALE_SERVICE: '',
        WHETHER_AFTER_SALES_SERVICE: '',
        marketingPersonList: [],
        projectPersonList: [],
        implementationPersonList: [],
        maintenancePersonList: []
      },
      validityList: [
        { 'ID': '30', 'NAME': '一个月' },
        { 'ID': '90', 'NAME': '三个月' }
      ],
      // stepList: [
      //   { 'ID': '10', 'NAME': '待指定市场人员' },
      //   // { 'ID': '3', 'NAME': '待验收' },
      //   { 'ID': '-1', 'NAME': '实施延期' },
      //   { 'ID': '3', 'NAME': '验收打回' },
      //   { 'ID': '4', 'NAME': '验收' },
      //   { 'ID': '2', 'NAME': '实施' },
      //   { 'ID': '5', 'NAME': '临期' },
      //   { 'ID': '1', 'NAME': '正常' },
      //   { 'ID': '0', 'NAME': '维护' },
      //   { 'ID': '6', 'NAME': '待交付' },
      //   { 'ID': '7', 'NAME': '待指派项目负责人' },
      //   { 'ID': '8', 'NAME': '待指定实施人员' },
      //   { 'ID': '9', 'NAME': '待审核' }
      // ],
      formList: [
        { 'ID': '1', 'NAME': '一年' },
        { 'ID': '2', 'NAME': '两年' },
        { 'ID': '3', 'NAME': '三年' },
        { 'ID': '4', 'NAME': '四年' },
        { 'ID': '5', 'NAME': '五年' }
      ],
      VALIDITY: '',
      CREATOR: '',
      multipleSelectionAll: [], // 所有选中的数据包含跨页数据
      multipleSelection: [], // 当前页选中的数据
      dialogFormEdit: false,
      dialogFormDeliver: false,
      dialogFormRenew: false,
      dialogFormStop: false,
      dialogType: 'add',
      rules: {
        USE_DATE_START: [{ required: true, message: '有效使用起始时间不能为空', trigger: 'blur' }],
        USE_DATE_END: [{ required: true, message: '有效使用结束时间不能为空', trigger: 'blur' }]
      },
      deliverRules: {

        DELIVERDATE: [{ required: true, message: '交付日期不能为空', trigger: 'blur' }],
        TERM: [{ required: true, message: '有效期不能为空', trigger: 'blur' }]
      },
      renewRules: {

        TERM: [{ required: true, message: '有效期不能为空', trigger: 'blur' }]
      },
      stopRules: {

        STOPREASON: [{ required: true, message: '停用原因不能为空', trigger: 'blur' }]
      },
      pickerOptions: {
        disabledDate(time) {
          return time.getTime() > Date.now()
        }
      }
    }
  },
  created() {
    var user = sessionStorage.getItem('user')
    var obj = JSON.parse(user)
    if (obj && (obj.AGENCY_MANAGEMENT_ID === '' || obj.AGENCY_MANAGEMENT_ID == null)) {
      this.isAdmin = true
    }
    this.getList(this.ROLE_ID)
    this.getDict()
    this.getDictByDicId('e725d2a91b8248f4b8f49889038df7de').then(data => {
      this.areaList = data
    })
  },
  methods: {
    lazyLoad(nodeValue, resolve) {
      if (nodeValue.data && (!nodeValue.children || nodeValue.children.length == 0)) {
        this.getDictByDicId(nodeValue.data.id).then(data => {
          resolve(data)
        })
      } else {
        resolve(null)
      }
    },
    getRowKey(row) {
      return row.CORPINFO_ID
    },
    // 搜索
    getQuery() {
      this.$refs.multipleTable.clearSelection()
      this.getList()
    },
    getExcelModel() {
      const _selectData = this.$refs.multipleTable.selection
      if (_selectData == null || _selectData.length == 0) {
        this.$message({
          message: '请选中要导出的数据...',
          type: 'error'
        })
        return false
      }
      const ids = _selectData.map((item, index) => {
        return item.CORPINFO_ID
      }).join(',')

      this.$confirm('确定要导出到excel吗?', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.listLoading = false
        window.open(this.config.httpurl + '/hidden/excelNormal?ids=' + ids)
      }).catch(() => {
        this.listLoading = false
      })
      this.listLoading = false
    },
    // 获取列表
    getList() {
      this.listLoading = true
      this.POSSESSION
      var possession = ''
      var possessionLevel = ''
      if (this.POSSESSION && this.POSSESSION.length > 0) {
        possession = this.POSSESSION[this.POSSESSION.length - 1]
        possessionLevel = this.POSSESSION.length
      }
      requestFN(
        '/corpinfo/list?showCount=' + this.listQuery.limit + '&currentPage=' + this.listQuery.page,
        {
          KEYWORDS: this.KEYWORDS,
          CREATOR: this.CREATOR,
          ISSMALL: '2',
          PAGETYPE: '1',
          POSSESSION: possession,
          POSSESSIONLEVEL: possessionLevel,
          VALIDITY: this.VALIDITY,
          DELIVERSTARTTIME: this.dates[0],
          DELIVERENDTIME: this.dates[1]
        }
      ).then((data) => {
        this.listLoading = false
        this.varList = data.varList
        this.total = data.page.totalResult
        this.hasButton()
        this.pd = data.pd
      }).catch((e) => {
        this.listLoading = false
      })
    },

    beforeListingFileUpload(file) {
      if (file.name.substr(file.name.lastIndexOf('.'), file.name.length - 1) != '.pdf') {
        this.$message({
          message: '请上传PDF文件!',
          type: 'warning'
        })
        return false
      }
      this.form.file = file
      this.form.CONTRACT_FILE = file
      return false
    },
    // 重置
    goKeyReset() {
      this.KEYWORDS = ''
      this.CREATOR = ''
      this.VALIDITY = ''
      this.dates = []
      this.POSSESSION = []

      this.getQuery()
    },
    goDeliver(id) {
      this.form = {
        CONTRACT_FILE: {},
        file: ''
      }
      this.form.CORPINFO_ID = id
      this.dialogFormDeliver = true
    },
    goRenew(id) {
      this.form = {
        CONTRACT_FILE: {},
        file: ''
      }
      this.form.CORPINFO_ID = id
      this.dialogFormRenew = true
    },
    editStatus(id) {
      this.form = {}
      this.form.CORPINFO_ID = id
      this.dialogFormStop = true
    },

    deliver(operationType) {
      this.$refs.form.validate(valid => {
        if (valid) {
          this.form.OPERATIONTYPE = operationType
          const loading = this.$loading({
            lock: true,
            text: '提交中...',
            spinner: 'el-icon-loading',
            background: 'rgba(0, 0, 0, 0.7)'
          })
          const formData = new FormData()
          Object.keys(this.form).map(key => {
            formData.append(key, this.form[key])
          })
          upload(
            '/corpinfo/deliver',
            formData
          ).then((data) => {
            loading.close()
            this.$message({
              message: '操作成功',
              type: 'success'
            })
            this.dialogFormDeliver = false
            this.getList()
          }).catch((e) => {
            loading.close()
          })
        } else {
          return false
        }
      })
    },
    renew() {
      this.$refs.form.validate(valid => {
        if (valid) {
          const loading = this.$loading({
            lock: true,
            text: '提交中...',
            spinner: 'el-icon-loading',
            background: 'rgba(0, 0, 0, 0.7)'
          })
          const formData = new FormData()
          Object.keys(this.form).map(key => {
            formData.append(key, this.form[key])
          })
          upload(
            '/corpinfo/renew',
            formData
          ).then((data) => {
            loading.close()
            this.$message({
              message: '操作成功',
              type: 'success'
            })
            this.dialogFormRenew = false
            this.getList()
          }).catch((e) => {
            loading.close()
          })
        } else {
          return false
        }
      })
    },
    closeDeliver() {
      this.form = {}
      this.dialogFormDeliver = false
    },
    // 添加
    handleAdd() {
      this.$parent.CORPINFO_ID = ''
      this.$parent.activeName = 'corpEdit'
    },
    handleShow(row) {
      this.$parent.CORPINFO_ID = row.CORPINFO_ID
      this.$parent.activeName = 'corpView'
    },
    // 修改
    handleEdit(row) {
      this.$parent.CORPINFO_ID = row.CORPINFO_ID
      this.$parent.activeName = 'corpEdit'
    },
    // 保存
    confirm() {
      this.$refs.form.validate(valid => {
        if (valid) {
          this.listLoading = true
          requestFN(
            '/corpinfo/' + this.dialogType,
            this.form
          ).then((data) => {
            this.listLoading = false
            this.dialogFormEdit = false
            this.getList()
          }).catch((e) => {
            this.listLoading = false
          })
        } else {
          return false
        }
      })
    },
    goStop() {
      this.$refs.form.validate(valid => {
        if (valid) {
          this.$confirm('确定要停用吗?', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(() => {
            this.listLoading = true
            requestFN(
              '/corpinfo/goStop',
              this.form
            ).then(() => {
              this.$message({
                message: '停用成功',
                type: 'success'
              })
              this.dialogFormStop = false
              this.varList = []
              this.listQuery.page = 1
              this.getList()
            }).catch((e) => {
              this.listLoading = false
            })
          }).catch(() => {
          })
        } else {
          return false
        }
      })
    },
    goEdit() {
      requestFN(
        '/corpinfo/changePersonnel',
        this.changForm
      ).then((data) => {
        this.$message({
          message: '修改成功',
          type: 'success'
        })
        this.dialogFormChange = false
        this.getList()
      }).catch((e) => {
      })
    },
    handleDelete(id) {
      this.$confirm('确定要删除吗?', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.listLoading = true
        requestFN(
          '/corpinfo/delete',
          {
            CORPINFO_ID: id
          }
        ).then(() => {
          this.$message({
            message: '删除成功',
            type: 'success'
          })
          this.listLoading = false
          this.varList = []
          this.listQuery.page = 1
          this.getList()
        }).catch((e) => {
          this.listLoading = false
        })
      }).catch(() => {
      })
    },

    batchDel() {
      const _selectData = this.$refs.multipleTable.selection
      if (_selectData == null || _selectData.length == 0) {
        this.$message({
          message: '请选中要删除的项...',
          type: 'error'
        })
        return false
      }
      const ids = _selectData.map((item, index) => {
        return item.CORPINFO_ID
      }).join(',')

      this.$confirm('确定要删除选中的数据吗?', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.listLoading = true
        requestFN(
          '/corpinfo/deleteAll',
          {
            DATA_IDS: ids
          }
        ).then(() => {
          this.$message({
            message: '删除成功',
            type: 'success'
          })
          this.listLoading = false
          this.varList = []
          this.listQuery.page = 1
          this.$refs.multipleTable.clearSelection()
          this.getList()
        }).catch((e) => {
          this.listLoading = false
        })
      }).catch(() => {
      })
    },
    // 判断按钮权限，用于是否显示按钮
    hasButton: function() {
      var keys = 'corpinfo:add,corpinfo:del,corpinfo:edit,toExcel'
      requestFN(
        '/head/hasButton',
        {
          keys: keys
        }
      ).then((data) => {
        this.add = data.corpinfofhadminadd		// 新增权限
        this.del = data.corpinfofhadmindel		// 删除权限
        this.edit = data.corpinfofhadminedit	// 修改权限
      }).catch((e) => {
        this.listLoading = false
      })
    },

    // 获取数据字典数据
    getDictByDicId(dicId) {
      var dicListVal = []
      return new Promise((resolve) => {
        let id = ''
        if (!dicId) {
          id = '0'
        } else {
          id = dicId
        }
        requestFN(
          '/dictionaries/getLevelsAndSCount',
          {
            DICTIONARIES_ID: id
          }
        ).then((data) => {
          if (data.list.length > 0) {
            dicListVal = data.list.map((e) => {
              if (e.zcount == '0') {
                return { value: e.DICTIONARIES_ID.toString(), numValue: e.BIANMA.toString(), label: e.NAME, id: e.DICTIONARIES_ID, leaf: true }
              } else {
                return { value: e.DICTIONARIES_ID.toString(), numValue: e.BIANMA.toString(), label: e.NAME, id: e.DICTIONARIES_ID, children: [], leaf: false }
              }
            })
          } else {
            dicListVal = undefined
          }
          return resolve(dicListVal)
        }).catch((e) => {
        })
      })
    },
    resetForm() {
      this.form = {
        CORPINFO_ID: '', // 备注1
        CONTRACT_FILE: {},
        file: ''
      }
    },
    // 登录企业
    goLogin: function(id) {
      this.$confirm('确定要进入系统吗?', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.listLoading = true
        requestFN(
          '/corpinfo/goLogin',
          {
            CORPINFO_ID: id
          }
        ).then((data) => {
          this.listLoading = false
          // if (data.USERNAME != 'admin') {
          window.open(config.qyurl + 'static/bi/admin_to_loading.html?qa=' + encodeURI(data.users.USERNAME) + '&zy=' + encodeURI(data.users.PASSWORD), '_blank')
          // }
          // else {
          //   window.open('https://qask.qhdsafety.com/bi/loading.html?qa=' + encodeURI(data.users.USERNAME) + '&zy=' + encodeURI(data.users.PASSWORD), '_blank')
          // }
        }).catch((e) => {
          this.listLoading = false
        })
      }).catch(() => {
      })
    },
    resetPwd(id) {
      this.$confirm('确定要进行密码重置吗？默认密码为Aa@123456', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.listLoading = true
        requestFN(
          '/corpinfo/resetPwd',
          {
            corpInfo: id,
            tm: new Date().getTime()
          }
        ).then((data) => {
          if (data.result == 'success') {
            this.$message({
              message: '重置成功',
              type: 'success'
            })
          } else {
            alert(data.msg)
            this.$message({
              message: data.msg,
              type: 'success'
            })
          }
          this.listLoading = false
        }).catch((e) => {
          this.listLoading = false
        })
      }).catch(() => {
      })
    },
    updateISuse(id) {
      this.$confirm('确定要禁用吗?', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.listLoading = true
        requestFN(
          '/corpinfo/updateISuse',
          {
            CORPINFO_ID: id
          }
        ).then(() => {
          this.$message({
            message: '禁用成功',
            type: 'success'
          })
          this.listLoading = false
          this.varList = []
          this.listQuery.page = 1
          this.getList()
        }).catch((e) => {
          this.listLoading = false
        })
      }).catch(() => {
      })
    },
    goupdateISuse(id) {
      // dialogFormEdit" :title="dialogType==='edit'
      this.dialogFormEdit = true
      this.dialogType = 'edit'
      this.form.CORPINFO_ID = id
    },
    goupdateISuseSave() {
      if (this.form.USE_DATE_END < this.form.USE_DATE_START) {
        this.$message({
          message: '结束时间不能早于开始时间',
          type: 'error'
        })
        this.form.USE_DATE_END = ''
        return false
      }
      this.listLoading = true
      requestFN(
        '/corpinfo/updateuse',
        {
          CORPINFO_ID: this.form.CORPINFO_ID,
          USE_DATE_START: this.form.USE_DATE_START,
          USE_DATE_END: this.form.USE_DATE_END
        }
      ).then((data) => {
        if (data.result == 'success') {
          this.$message({
            message: '保存成功',
            type: 'info'
          })
          this.varList = []
          this.getList()
        }
        this.listLoading = false
        this.dialogFormEdit = false
      }).catch((e) => {
        this.listLoading = false
      })
    },
    tableRowClassName({ row, rowIndex }) {
      if (!row.REMAININGTIME) {
        return
      }
      if (row.REMAININGTIME <= 30 && row.REMAININGTIME >= 0) {
        return 'yellow-row'
      } else if (row.REMAININGTIME > 30 && row.REMAININGTIME <= 90) {
        return 'green-row'
      } else if (row.REMAININGTIME < 0) {
        return 'red-row'
      }
      return ''
    },
    judgeTime(startTime) {
      startTime = startTime.replace(/\-/g, '/')
      var endTime = new Date()
      var sTime = new Date(startTime) // 开始时间
      var eTime = new Date(endTime) // 结束时间
      var timeType = 1000 * 3600 * 24
      var differDay = (eTime.getTime() - sTime.getTime()) / timeType
      var nineMon = 270
      var oneYear = 365
      if (differDay >= oneYear) {
        return 2
      }
      if (differDay >= nineMon) {
        return 1
      }
      return 0
    }
  }
}

</script>
<style>
  .el-table .yellow-row {
    background: rgba(248, 231, 28, 0.2);

  }

  .el-table .red-row {
    background: rgba(252, 2, 33, 0.2);
  }
  .el-table .green-row {
    background: rgba(26, 208, 22, 0.2);
  }

</style>
<style lang="sass" scoped>
  .uo-flex
    display: flex
  .filter-container
    position: relative
    .filter-flot
      position: absolute
      right: 0
      top: 0

</style>

