<template>
  <div class="detail-container proposed-project">
    <head-form-new title="拟建项目" :form-data="formData" :query-params="queryParams" :total="tableDataTotal" :isExcel="true"
      @handle-search="handleSearch" />
    <skeleton style="margin-left:16px;" v-if="isSkeleton"></skeleton>
    <tables v-else :indexFixed="true" :defaultSort="defaultSort" :tableLoading="tableLoading" :tableData="tableData" :forData="forData"
      :tableDataTotal="tableDataTotal" :queryParams="queryParams" @handle-current-change="handleCurrentChange" @sort-change="sortChange">
      <template slot="projectName" slot-scope="scope">
        <router-link :to="`/radar/Establishment/details/${scope.row.id}`" tag="a" class="a-link" v-if="scope.row.id&&scope.row.projectName "
          v-html="scope.row.projectName"></router-link>
        <div v-else v-html="scope.row.projectName  || '--'"></div>
      </template>
      <template slot="isProjcet" slot-scope="scope">
        <span>{{scope.row.isProjcet==1?'是':'否'}}</span>
      </template>
    </tables>

  </div>
</template>

<script>
import mixin from '../mixins/mixin';
import { approvalProjectPage } from '@/api/detail/party-a/opport';
import skeleton from '@/views/project/projectList/component/skeleton';
export default {
  name: 'Proposed',
  props: ['companyId'],
  mixins: [mixin],
  components: {
    skeleton
  },
  data() {
    return {
      queryParams: {
        cid: this.companyId,
        sort: 3,
        pageNum: 1,
        pageSize: 20
      },
      defaultSort: { prop: 'planStartTime', order: 'descending' },
      forData: [
        { label: '项目名称', prop: 'projectName', minWidth: '300', slot: true },
        // {label: '成交金额（万元）', prop: 'money', sortable: 'custom', descending: '1', ascending: '2', width: '150'},
        { label: '项目类别', prop: 'projectCategories', width: '100' },
        { label: '计划开工日期', prop: 'planStartTime', sortable: 'custom', descending: '3', ascending: '4', width: '130' },
        { label: '计划完工日期', prop: 'planEndTime', sortable: 'custom', descending: '13', ascending: '14', width: '130' },
        { label: '审批结果', prop: 'examineStatus', width: '100' },
        { label: '是否为民间推介项目', prop: 'isProjcet', width: '150', slot: true }
      ],
      formData: [
        { type: 3, fieldName: 'keys', value: '', placeholder: '输入项目名称关键词查询', options: [], width: 220, uid: this.getUid() },
        { type: 1, fieldName: 'isProject', value: '', placeholder: '是否为民间推介项目', options: [{ name: '不限', value: null }, { name: '是', value: '1' }, { name: '否', value: '0' }], width: 180, uid: this.getUid() },
      ],
      //列表
      tableLoading: false,
      tableData: [],
      tableDataTotal: 0,
      isSkeleton: true,
    };
  },
  computed: {
  },
  created() {
    this.handleQuery();
  },
  methods: {
    async handleQuery(params) {
      this.tableLoading = true;
      let param = params ? params : this.queryParams;
      let res = await approvalProjectPage(param);
      this.tableLoading = false;
      if (res.code == 200) {
        this.isSkeleton = false;
        this.tableData = res.rows;
      }
      this.tableDataTotal = res.total;
    }
  }
}
</script>
<style lang="scss" scoped>
.detail-container {
  background: #ffffff;
  border-radius: 4px;
  padding: 16px;
}

.proposed-project {
  @import "@/assets/styles/search-common.scss";
}
</style>
