<template>
  <div>
    <div class="content">
      <dataBreadcrumb :breads="breads"></dataBreadcrumb>
      <el-button class="absolute" type="primary" @click="release">发布变更公告</el-button>
      <dataTable  :columns="columns"  :table-top="60"  url="notice/list" :page-obj="pageObj">
		  <el-table-column slot="auditStatus" label="操作" align="center"  width="100">
		    <template slot-scope="scope">
		      <div v-if="scope.row.auditStatus==0">未审核</div>
			   <div  v-else-if="scope.row.auditStatus==1">审核通过</div>
			    <div v-else>未通过</div>
		    </template>
		  </el-table-column>
        <el-table-column slot="operate" label="操作" align="center" fixed="right" width="100">
          <template slot-scope="scope">
            <el-button v-if="scope.row.auditStatus===2" type="text" size="small" @click="handleModify(scope.row.id)">修改 </el-button>
            <el-button v-else type="text" size="small" @click="handleSee(scope.row.noticeId)">查看 </el-button>
          </template>
        </el-table-column>
      </dataTable>
    </div>
  </div>
</template>

<script>
// import {
//   changeList
// } from '@api/purchaser/bid'
import dataBreadcrumb from '@components/dataBreadcrumb.vue'
import dataTable from '@components/dataTable.vue'
export default {
  components: {
    dataTable,
    dataBreadcrumb
  },
  data() {
    return {
		pageObj: {
		  size: 10,
		  currentPage: 1,
		   noticeType:"CHANGE",
		  func: (currentPage) => {
		    this.pageTurning(currentPage)
		  }
		},
      projectId: 2,
      breads: ['招标管理 ', '招标项目管理', '工作台'],
      tableData: [],
      columns: [{
        label: '公告名称',
        prop: 'title'
      },
      {
        label: '创建时间',
        prop: 'createTime',
        sortable: true
      },
	  {
	    slot: 'auditStatus'
	  },
      // {
      //   label: '备注',
      //   prop: 'reason'
      // },
      {
        slot: 'operate'
      }
      ] // 操作列
    }
  },
  created() {
	this.pageObj.projectId=localStorage.getItem("projectId")
  },
  methods: {
    handleModify(id) {
      this.$router.push({
        path: '/purchaser/bid/bidStage/changeList/changeNotice',
        query: {
		  id:id
        }
      })
    },
    release() {
      this.$router.push("/purchaser/bid/bidStage/changeList/changeNotice")
    },
    handleSee(id) {
      this.$router.push(`/purchaser/bid/bidStage/changeList/see?id=${id}`)
    },
  /*  async getchangeList() {
      try {
		  let projectId=localStorage.getItem("projectId");
        const {
          data,
          code
        } = await changeList(projectId)
        if (code === 200) {
          for (let item of data) {
            if (item.auditStatus === 0) {
              item.Status = '未审核'
            } else if (item.auditStatus === 1) {
              item.Status = '审核通过'
            } else {
              item.Status = '未通过'
            }
          }
          this.tableData = data
        }
      } catch (e) {
        console.log(e)
      }
    } */
  }
}
</script>

<style scoped>
	.absolute {
		position: absolute;
		top: 65px
	}
</style>
