<!--
  @description:供应商查看变更公告列表
  @Modifier:ysg
  @date:2020/09/10
  procurement/procurementChangeNotice-list
-->
<template>
  <div>
    <!--标题-->
    <div class="title title_border p0-16">
      <i class="el-icon-s-home" />
      变更公告
    </div>
    <section class="p0-16">
      <!--查询条件-->
      <div class="crud_menu_title clearfix">
        <span class="icon-line fl">查询条件</span>
        <span class="fr pointer" @click="handleToggleSearch">
          <el-link
            :underline="false"
            :class="toggleSearchStatus?'arrow-is-active':''"
            type="primary"
            class="toggleSearchStatus icon el-icon-arrow-down"
          />
          {{ toggleSearchStatus?'收起高级查询' :'展开高级查询' }}
        </span>
      </div>
      <div :class="{'SearchContent_show':toggleSearchStatus}" class="clearfix SearchContent">
        <div class="SearchContent_leftInput fl">
          <el-form
            ref="searchForm"
            :model="searchForm"
            label-width="108px"
            label-position="left"
            inline
          >
            <el-form-item
              ref="tenderNo"
              label="采购项目编号"
              class="el-form-item--three"
              prop="tenderNo"
            >
              <el-input
                v-model.trim="searchForm.tenderNo"
                placeholder="请输入采购项目编号"
                style="width:15vw"
                @keyup.enter.native="onSearch"
              />
            </el-form-item>
            <!--变更公告名称-->
            <el-form-item
              ref="title"
              label="变更公告名称"
              class="el-form-item--three"
              prop="title"
            >
              <el-input
                v-model="searchForm.title"
                placeholder="请输入变更公告名称"
                style="width:15vw"
                @keyup.enter.native="onSearch"
              />
            </el-form-item>
            <!--采购方式-->
            <el-form-item
              ref="tenderMethod"
              label="采购方式"
              class="el-form-item--three"
              prop="tenderMethod"
            >
              <el-select v-model="searchForm.tenderMethod" style="width:15vw" placeholder="请选择">
                <el-option
                  v-for="item in tendermethodList"
                  :key="item.typename"
                  :label="item.typename"
                  :value="item.typecode"
                />
              </el-select>
            </el-form-item>
            <el-form-item
              ref="tenderType"
              label="公开/邀请"
              class="el-form-item--three"
              prop="tenderType"
            >
              <el-select v-model="searchForm.tenderType" placeholder="请选择" style="width:15vw">
                <el-option
                  v-for="item in protprojectPurchaseResultStatusList"
                  :key="item.typename"
                  :label="item.typename"
                  :value="item.typecode"
                />
              </el-select>
            </el-form-item>
            <el-form-item
              ref="buyerExecutorName"
              label="采购执行单位"
              prop="buyerExecutorName"
              class="el-form-item--three"
            >
              <el-input
                v-model="searchForm.buyerExecutorName"
                placeholder="采购执行单位"
                style="width:15vw"
              />
            </el-form-item>
            <!--创建日期-->
            <el-form-item ref="date" label="发布日期" prop="date">
              <el-date-picker
                v-model="searchForm.relDateBegin"
                type="datetime"
                placeholder="选择日期时间"
                style="width:15vw"
              />~
              <el-date-picker
                v-model="searchForm.relDateEnd"
                type="datetime"
                placeholder="选择日期时间"
                style="width:15vw"
              />
            </el-form-item>
          </el-form>
        </div>
        <div class="fr">
          <el-button type="primary" @click="onSearch">
            搜 索
          </el-button>
          <el-button plain type="info" @click="resetForm('searchForm')">
            重 置
          </el-button>
        </div>
      </div>
      <!--查询结果-->
      <div class="crud_menu_title">
        <span class="icon-line">查询结果</span>
      </div>
      <!--响应内容-->
      <div>
        <el-table
          ref="smallTable"
          :data="tableData"
          class="tableLimit procurement_table"
          width="100%"
        >
          <el-table-column
            header-align="center"
            type="index"
            label="序号"
            width="60px"
            align="center"
          />
          <el-table-column header-align="center" align="left" label="采购项目编号/名称" min-width="230">
            <template slot-scope="scope">
              <p>{{ scope.row.tenderNo }}</p>
              <p>{{ scope.row.tenderName }}</p>
            </template>
          </el-table-column>
          <el-table-column
            header-align="center"
            align="left"
            prop="title"
            label="变更公告名称"
            min-width="200"
          />
          <el-table-column header-align="center" label="采购方式" width="140" align="center">
            <template slot-scope="scope">
              <p>{{ filterDictText(tendermethodList,scope.row.tenderMethod ) }}</p>
            </template>
          </el-table-column>
          <el-table-column
            header-align="center"
            align="center"
            prop="tenderType"
            label="公开/邀请"
          >
            <template slot-scope="scope">
              <p>{{ filterDictText(tendertypeList,scope.row.tenderType ) }}</p>
            </template>
          </el-table-column>

          <el-table-column
            header-align="center"
            label="采购执行单位"
            align="center"
            min-width="120"
            prop="buyerExecutorName"
          >
            <!-- <template slot-scope="scope"> -->
            <!-- <p>{{ filterDictText(isAcceptArr,scope.row.buyerExecutorName ) }}</p> -->
            <!-- </template> -->
          </el-table-column>
          <el-table-column header-align="center" label="发布时间" align="center" width="180">
            <template
              slot-scope="scope"
            >
              <!-- {{ filterDictText(protprojectPurchaseResultStatusList,scope.row.relDate) }} -->
              {{ $Moment(scope.row.relDate).format(momentDateTime) }}
            </template>
          </el-table-column>
          <el-table-column header-align="center" label="操作" align="center" width="80">
            <template slot-scope="scope">
              <el-link
                :underline="false"
                size="mini"
                type="primary"
                width="120"
                @click="intoProject(scope.row)"
              >
                [查看]
              </el-link>
            </template>
          </el-table-column>
        </el-table>
        <!--分页组件-->
        <pagination :pagination-data="paginationData" @change="loadData" />
      </div>
    </section>
    <!-- 查看变更详情弹框-->
    <projectAlterDialog v-if="alterDialog.dialog" :dialog-data="alterDialog" />
  </div>
</template>
<script>
/* 接口*/
import { getChangeBulletinList } from '@/api/procurement/commonDesk'
/* 公用方法*/
import { filterObj, filterDictText } from '@/assets/js/utils' // 常用方法
/* 混合开发方法-参数字段*/
import { ListMixin } from '@/mixins/ListMixin' // 分页
import { initGroupMixin } from '@/mixins/initGroupMixin' // 字典信息
import { commonMxin } from '@/mixins/commonMxin' // 字典信息
/* 组件*/
import projectAlterDialog from './procurementProjectAlterDetail-dialog.vue' // 查看详情弹框
import pagination from '@comp/common/pagination/pagination' // 分页
/* 混合开发*/
import { procurementProjectGroupMixin } from '../mixins/procurementProjectGroupMixin' // 立项采购-字典
import { procurementProjectMixins } from '../mixins/procurementProjectMixins' // 立项采购-公用方法参数

export default {
  name: 'ChangeNotice',
  components: {
    pagination, // 分页
    projectAlterDialog
  },
  mixins: [
    ListMixin,
    commonMxin,
    initGroupMixin,
    procurementProjectGroupMixin,
    procurementProjectMixins
  ],
  data() {
    return {
      loading: true,
      // 搜索
      searchForm: {
        tenderNo: '', // 采购项目编号
        tenderMethod: '', // 采购方式
        title: '', // 清空采购项目名称
        tenderType: '',
        buyersName: '',
        buyerExecutorName: '',
        relDateBegin: '',
        relDateEnd: ''
      },
      tableData: [],
      alterDialog: {
        alterBizId: '', // 变更公告查看业务id
        dialog: false
      }
    }
  },
  created() {
    // 查询项目状态
    this.inCodes()
    // 字典信息
    this.initWebTypeGroup()
    // 获取列表信息
    this.loadData()
  },
  methods: {
    filterDictText,
    // 获取数据
    loadData() {
      const params = this.getQueryParams() // 查询条件
      getChangeBulletinList(params)
        .then(response => {
          this.loading = false
          this.paginationData.total = response.data.total
          this.tableData = response.data.records
          this.tableData.forEach(item => {
            item.relDate = this.$Moment(item.relDate).format(this.momentSaveFormat)
          })
        })
        .catch(() => {})
    },
    // 查询条件
    getQueryParams() {
      const param = Object.assign({}, this.searchForm)
      param.pageNo = this.paginationData.pageNo
      param.pageSize = this.paginationData.pageSize
      return filterObj(param)
    },
    // 搜索
    onSearch() {
      this.paginationData.pageNo = 1
      this.paginationData.pageSize = 10
      // 获取列表信息
      this.loadData()
    },
    // 重置
    resetForm(formName) {
      this.searchForm.tenderNo = '' // 清空采购项目编号
      this.searchForm.title = '' // 清空采购项目名称
      this.searchForm.tenderMethod = '' // 清空采购方式

      this.searchForm.tenderType = ''
      this.searchForm.buyersName = ''
      this.searchForm.buyerExecutorName = ''
      this.searchForm.relDateBegin = ''
      this.searchForm.relDateEnd = ''
      this.paginationData.page = 1
      this.paginationData.pageSize = 10
      this.$refs[formName].resetFields()
      // 获取列表信息
      this.loadData()
    },
    // 查看
    intoProject(row) {
      this.alterDialog.alterBizId = row.bizId
      this.alterDialog.dialog = true
    }
  }
}
</script>
<style lang="less" scoped>
    /deep/.el-dialog_table_he{
        margin-top: 5vh !important;
        height: 87%;
    }
    /deep/.el-dialog_table_he .el-dialog__body{
        // min-height: 100px;
        height: 80%;
        overflow-y: scroll;
    }
    /deep/.el-dialog .liststyle{
        width: 100%;
        padding: 0 10px;
        height: 100%;
        overflow-y: scroll;
    }
</style>
