tj
2025-06-05 bba272999cc546f65781bf3d20245a3f819af67f
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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
<template>
  <div>
    <!-- 列表页面 -->
    <div class="page-container">
      <!-- 查询条件 -->
      <div class="search-section">
        <el-form :inline="true" :model="queryForm" class="demo-form-inline" label-width="auto">
          <el-form-item label="关键字">
            <el-input v-model="queryForm.keyword" placeholder="名称/描述/备注/项目经理/联系人" clearable />
          </el-form-item>
          <el-form-item label="类型">
            <el-select v-model="queryForm.type_list" placeholder="类型" clearable filterable :multiple="true">
              <el-option v-for="item in projectTypeArr" :key="item.value" :label="item.label" :value="item.value" />
            </el-select>
          </el-form-item>
          <el-form-item label="阶段">
            <el-select v-model="queryForm.stage_list" placeholder="阶段" clearable filterable :multiple="true">
              <el-option v-for="item in projectStageArr" :key="item.value" :label="item.label" :value="item.value" />
            </el-select>
          </el-form-item>
          <el-form-item label="状态">
            <el-select v-model="queryForm.status_list" placeholder="类型" clearable filterable :multiple="true">
              <el-option v-for="item in projectStatusArr" :key="item.value" :label="item.label" :value="item.value" />
            </el-select>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="search">查询</el-button>
            <el-button type="primary" @click="exportReport">导出</el-button>
          </el-form-item>
        </el-form>
      </div>
    </div>
    <div class="card-container">
      <el-card v-for="item in tableData" :key="item.project_id" class="project-card">
        <div class="card-header">{{ item.project_name }}</div>
        <div class="card-body">
          <p><strong>类型:</strong>{{ item.project_type_name }}</p>
          <p><strong>项目经理:</strong>{{ item.manager_name }}</p>
          <p><strong>客户:</strong>{{ item.company_name }}</p>
          <p><strong>客户联系人:</strong>{{ item.contact_name }}</p>
          <p class="row-flex">
            <span class="half"><strong>对内工时/h:</strong>{{ item.inner_hours }}</span>
            <span class="half"><strong>对外工时/h:</strong>{{ item.outer_hours }}</span>
          </p>
          <p class="row-flex">
            <span class="half"><strong>基础工时/h:</strong>{{ item.base_hours }}</span>
            <span class="half"><strong>实际工时/h:</strong>{{ item.actual_hours }}</span>
          </p>
 
          <p><strong>预计时间(开始/完成):</strong>{{ item.estimate_start_time }} ~ {{ item.estimate_complete_time }}</p>
          <p><strong>实际时间(开始/完成):</strong>{{ item.actual_start_time }} ~ {{ item.actual_complete_time }}</p>
          <el-collapse>
            <el-collapse-item title="更多信息">
              <p><strong>状态:</strong>{{ item.project_status_name }}</p>
              <p><strong>阶段:</strong>{{ item.project_stage_name }}</p>
              <p><strong>项目描述:</strong>{{ item.desc }}</p>
              <p><strong>备注:</strong>{{ item.remark }}</p>
            </el-collapse-item>
          </el-collapse>
        </div>
      </el-card>
    </div>
 
  </div>
</template>
 
<script setup>
import { ref, reactive, onMounted } from 'vue'
import { ElMessageBox, ElMessage } from 'element-plus'
import projectInfo from '@/model/projectInfo'
import sysDictItemModel from '@/model/sysDictItem'
 
const loading = ref(false)
const tableData = ref([])
 
const queryForm = reactive({
  keyword: '',
  type_list: [],   // 改为数组
  stage_list: [],  // 改为数组
  status_list: [], // 改为数组
  page: 1,
  count: 10,
})
 
onMounted(() => {
  // 列出所有项目信息
  getProjectInfoList()
  loadDictDitems()
})
 
const getProjectInfoList = async () => {
  try {
    loading.value = true
    tableData.value = await projectInfo.getProjectInfoReportList(queryForm)
    loading.value = false
  } catch (error) {
    loading.value = false
    if (error.code === 10020) {
      tableData.value = []
    }
  }
}
 
const exportProjectInfoList = async () => {
  try {
    loading.value = true
    await projectInfo.exportProjectInfoList(queryForm)
    loading.value = false
  } catch (error) {
    loading.value = false
 
  }
}
 
const search = () => {
  // 执行查询操作,更新表格数据
  // 列出所有项目信息
  getProjectInfoList()
}
 
const exportReport = () => {
  // 执行查询操作,更新表格数据
  // 列出所有项目信息
  exportProjectInfoList()
}
 
const projectTypeArr = ref([])
const projectStatusArr = ref([])
const projectStageArr = ref([])
// 根据字典类型查询字典
const loadDictDitems = async () => {
  projectTypeArr.value = await sysDictItemModel.getSysDictItemListByType('project_type')
  projectStatusArr.value = await sysDictItemModel.getSysDictItemListByType('project_status')
  projectStageArr.value = await sysDictItemModel.getSysDictItemListByType('project_stage')
}
 
</script>
 
<style lang="css" scoped>
.page-container {
  padding: 10px;
}
 
.el-form--inline {
  .el-form-item {
 
    .el-input,
    .el-cascader,
    .el-select,
    .el-autocomplete {
      width: 240px;
    }
  }
}
</style>
<style scoped>
.card-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 16px;
  padding: 16px;
}
 
.project-card {
  padding: 16px;
}
 
.card-header {
  font-weight: bold;
  font-size: 18px;
  margin-bottom: 8px;
}
 
.card-body p {
  margin: 4px 0;
}
</style>
 
<style scoped>
.row-flex {
  display: flex;
  justify-content: space-between;
  margin: 6px 0;
}
 
.row-flex .half {
  flex: 1;
  box-sizing: border-box;
  padding-right: 10px;
  /* 可选:用于右边距 */
}
</style>