MrShi
2025-09-22 ad054c369ed1ee164024f47d38b10824d41f9a9c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
<template>
  <TableLayout :permissions="['business:project:query']">
    <!-- 搜索表单 -->
    <el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="100px" inline>
      <el-form-item label="项目名称" prop="name">
        <el-input v-model="searchForm.name" placeholder="请输入项目名称" @keypress.enter.native="search"></el-input>
      </el-form-item>
      <el-form-item label="状态" prop="status">
        <el-select v-model="searchForm.status" placeholder="请选择流程状态">
          <el-option
            v-for="item in status"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          />
        </el-select>
      </el-form-item>
      <section>
        <el-button type="primary" @click="search">搜索</el-button>
        <el-button @click="reset">重置</el-button>
      </section>
    </el-form>
    <!-- 表格和分页 -->
    <template v-slot:table-wrap>
      <div v-if="tableData.list.length">
        <div class="project">
          <!-- {{ tableData.list }} -->
          <div v-for="item in tableData.list" :key="item.id" class="project-item">
            <ProjectItem
              :id="item.id"
              :canApply="false"
              :isApply="false"
              :projectName="item.name"
              :companyNum="item.serverCompanyNum"
              :status="item.status"
              :imgurlfull="item.imgurlfull"
              :applyDate="item.startDate.substring(0,item.startDate.length-3)+'~'+item.endDate.substring(0,item.endDate.length-3)"
              :declareStatus="item.declareStatus"
              :city="item.cityName"
              @projectDetail="showCompany(item)"
              @showCompany="showCompany(item)"
            />
          </div>
 
        </div>
        <pagination
          @size-change="handleSizeChange"
          @current-change="handlePageChange"
          :pagination="tableData.pagination"
        ></pagination>
      </div>
      <div v-else class="empty">
        <img src="@/assets/images/default_nodata@2x.png" alt="">
      </div>
    </template>
    <!-- 新建/修改 -->
    <OperaProjectDetailWindow ref="operaProjectDetailWindow" @success="handlePageChange"/>
    <projectApply ref="projectApply" @success="handlePageChange"/>
    <exportProjectApply ref="exportProjectApply" @success="handlePageChange"/>
  </TableLayout>
</template>
 
<script>
import BaseTable from '@/components/base/BaseTable'
import TableLayout from '@/layouts/TableLayout'
import Pagination from '@/components/common/Pagination'
import OperaProjectDetailWindow from '@/components/business/OperaProjectDetailWindow'
import projectApply from '@/components/business/comprehensiveServe/projectApply'
import exportProjectApply from '@/components/business/comprehensiveServe/exportProjectApply'
import ProjectItem from '@/components/business/ProjectItem'
import { projectDetail } from "@/api/business/project"
 
export default {
  name: 'Project',
  extends: BaseTable,
  components: { TableLayout, Pagination, ProjectItem, OperaProjectDetailWindow, projectApply, exportProjectApply },
  data () {
    return {
      activeName: 'first',
      // 搜索
      searchForm: {
        status: '',
        name: ''
      }
      // status: [
      //   // 0未开始 1进行中 2已结束,
      //   { label: '未开始', value: 0 },
      //   { label: '进行中', value: 1 },
      //   { label: '已结束', value: 2 }
      // ]
    }
  },
  computed: {
    status() {
      if (this.userInfo.type == 6) {
        return [
          // 0未开始 1进行中 2已结束,
          // { label: '未开始', value: 0 },
          { label: '进行中', value: 1 },
          { label: '已结束', value: 2 }
        ]
      } else {
        return [
          // 0未开始 1进行中 2已结束,
          { label: '未开始', value: 0 },
          { label: '进行中', value: 1 },
          { label: '已结束', value: 2 }
        ]
      }
    }
  },
  created () {
    this.config({
      module: '项目信息表',
      api: '/business/project',
      'field.id': 'id',
      'field.main': 'id'
    })
    this.tableData.pagination = {
      pageIndex: 1,
      pageSize: 9,
      pageSizes: [9, 18, 27, 36],
      total: 0
    }
    this.search()
  },
  methods: {
    selectProject(id) {
      projectDetail(id)
        .then(res => {
          console.log(res);
          this.$refs.operaProjectDetailWindow.open('项目详情', res)
        })
        .catch(() => {
          this.$message.error('获取项目详情出错')
        })
      // this.$refs.operaProjectDetailWindow.open('项目详情', {})
    },
    showCompany(item) {
      // debugger
      if (this.userInfo.type == 6) {
        this.$refs.exportProjectApply.open('企业列表', { projectId: item.id, serviceLimt: item.serviceLimt })
      } else {
        this.$refs.projectApply.open('企业列表', { projectId: item.id, serviceLimt: item.serviceLimt, hcTips: item.checkReq, serviceReq: item.serviceReq })
      }
    }
  }
}
</script>
 
<style lang="scss" scoped>
.project {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
}
.project-item {
  width: calc(33% - 1px);
  box-sizing: border-box;
  padding: 10px;
}
.empty {
  width: 100%;
  height: 400px;
  position: relative;
  img {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    bottom: 0;
    margin: auto;
    width: 268px;
    height: 268px;
  }
}
</style>