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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
<template>
<div class="app-content">
<div v-if="loadState && !isComplete" style="margin-top:12px">
<a-form-model ref="ruleForm" :model="formData" :rules="rules" class="from-table">
<a-row>
<a-col :span="24">
<div class="tb-title">
<span>补充人员基本信息</span>
</div>
</a-col>
</a-row>
<a-row>
<a-col :span="4" class="bg-gray">
<div class="required">民族</div>
</a-col>
<a-col :span="20">
<a-form-model-item prop="nation">
<para-select v-model="formData.nation" :width="150" :typeId="11" />
</a-form-model-item>
</a-col>
</a-row>
<a-row>
<a-col :span="4" class="bg-gray">
<div class="required">学历</div>
</a-col>
<a-col :span="20">
<a-form-model-item prop="education">
<para-select v-model="formData.education" :width="150" :typeId="8" />
</a-form-model-item>
</a-col>
</a-row>
<a-row>
<a-col :span="4" class="bg-gray">
<div class="required">职称</div>
</a-col>
<a-col :span="20">
<a-form-model-item prop="title">
<para-multi-select :width="150" v-model="formData.title" :typeId="7" />
</a-form-model-item>
</a-col>
</a-row>
<a-row>
<a-col :span="4" class="bg-gray">
<div class="required">专业</div>
</a-col>
<a-col :span="20">
<a-form-model-item prop="spec">
<para-multi-select :width="150" v-model="formData.spec" :typeId="42" />
</a-form-model-item>
</a-col>
</a-row>
<a-row>
<a-col :span="4" class="bg-gray">
<div class="required">邮箱</div>
</a-col>
<a-col :span="20">
<a-form-model-item prop="email">
<a-input v-model="formData.email" :maxLength="30" style="width:250px;" />
</a-form-model-item>
</a-col>
</a-row>
<a-row>
<a-col :span="24" style="text-align: center;">
<a-button type="primary" @click="submit">提交</a-button>
</a-col>
</a-row>
</a-form-model>
</div>
<div v-if="loadState && isComplete">
<a-form :form="form" :model="searchForm" layout="inline" class="search_form">
<a-form-item>
<a-input placeholder="项目名称" v-model="searchForm.projName" :maxLength="100" style="width: 180px" />
</a-form-item>
<a-form-item>
<a-input placeholder="项目编号" v-model="searchForm.projNo" :maxLength="100" style="width: 180px" />
</a-form-item>
<a-form-item>
<a-button type="primary" icon="search" @click="search">搜索</a-button>
<a-button icon="reload" style="margin-left: 10px" @click="reset" class="bt-normal">重置</a-button>
<a-button type="primary" style="margin-left: 10px" @click="FileDownload" icon="download">项目合同书模板下载</a-button>
<!-- <a-button icon="primary" style="margin-left: 10px" @click="FileView">查看</a-button> -->
</a-form-item>
</a-form>
<div style="width:100%;margin-bottom: 8px;">
<div style="display: inline-block;;width:50%">
<btn-group :data="tabDate" :itemCount="itemCount" v-model="activekey" @change="callback" />
</div>
<div style="display: inline-block;;width:50%;text-align: right;">
<a-button type="primary" @click="projectKPI" icon="download">绩效指标表</a-button>
<!-- <a-button type="primary" @click="createMember">新建项目组成员</a-button> -->
<a-button type="primary" style="margin-right:8px;" v-if="(display && isButten)" @click="createProject">新建项目</a-button>
<a-button type="primary" @click="exportData" icon="download">Excel</a-button>
</div>
</div>
<a-divider style="height: 1px; background-color: #e8e8e8;" />
<span class="form-description"> ※填报时间:{{ description }}</span>
<a-table :dataSource="tableData" :columns="columns" :scroll="{ x: 'max-content' }" rowKey="id" :pagination="false" :loading="loading">
<!-- size="small" bordered -->
<template slot="projName" slot-scope="record">
<a @click="recordClick(record, 'view')">{{record.projName}}</a>
</template>
<template slot="state" slot-scope="record">
<span>
{{ record.projStateName }}
</span>
</template>
<template slot="option" slot-scope="record">
<a-button type="link" size="small" @click="recordClick(record, 'view')">查看</a-button>
<a-button type="link" size="small" v-if="((record.projState == -10 || record.projState == 10 || record.projState == 30))" @click="recordClick(record, 'edit')">修改</a-button>
<a-popconfirm title="确定要上报吗?" v-if="((record.projState == 10 || record.projState == 30))" ok-text="确定" cancel-text="取消" @confirm="recordClick(record,'report')">
<a-button type="link" size="small">上报</a-button>
</a-popconfirm>
<a-button type="link" size="small" v-if="record.projState <= 10" @click="recordClick(record,'delete')">删除</a-button>
</template>
</a-table>
<a-pagination v-if="pagination.total > 0" :total="pagination.total" show-size-changer show-quick-jumper v-model="pagination.pageIndex" :page-size="pagination.pageSize" :page-size-options="pagination.pageSizeOptions" @showSizeChange="showSizeChange" @change="change" :showTotal="() => `共 ${pagination.total} 条`" />
</div>
<a-modal v-model="visibleEdit" v-if="visibleEdit" title="项目创建/修改" width="94%" :footer="null" :dialog-style="{ top: '8%' }" destroyOnClose :maskClosable="false">
<project-create v-model="id" @close="closeWindow"></project-create>
</a-modal>
<a-modal v-model="visibleView" v-if="visibleView" title="项目详情" width="94%" :footer="null" :dialog-style="{ top: '8%' }" destroyOnClose :maskClosable="false">
<project-view v-model="id" @close="closeWindow"></project-view>
</a-modal>
<a-modal v-model="visibleFileView" title="查看" width="1000px" :dialog-style="{ top: '10%' }" :footer="null" destroyOnClose>
<preview-file v-model="realurl.downloadUrl" :fileName="realurl.fileName"></preview-file>
</a-modal>
<a-modal v-model="projectKPIView" title="查看项目KPI" width="80%" :dialog-style="{ top: '10%' }" :footer="null" destroyOnClose>
<project-kpi></project-kpi>
</a-modal>
</div>
</template>
<script>
import { getType } from '@/views/utils/auth'
import moment from 'moment'
import { isEmptyParams, filterExportExcelData, tableColumnsName, checkEmail, personGender, personBirthday, checkImageFileType, checkDocumentFileType } from "@/views/utils/common"
import paraMultiSelect from '@/views/components/common/paraMultiSelect'
import paraSelect from '@/views/components/common/paraSelect'
import projectCreate from '@/views/report/project/components/projectCreate'
import projectEdit from '@/views/report/project/components/projectEdit'
import projectEditKey from "@/views/report/project/components/keyProject/projectEdit"
import projectView from '@/views/report/project/components/projectView'
import previewFile from '@/views/components/common/previewFile'
import axios from 'axios'
import projectKpi from '@/views/report/project/components/projectKPI'
export default {
name: 'reportProject',
components: {
projectView, projectCreate, projectEdit, paraMultiSelect, paraSelect, previewFile, projectEditKey, projectKpi
},
data () {
return {
projType: getType() == "1",
loadState: false, //判断是否查询信息完整状态
isComplete: false,
formData: { id: null, nation: null, title: null, education: null, spec: null, email: null, sex: null, birthday: null },
rules: {
nation: [{ required: true, message: '请选择民族', trigger: 'change' }],
title: [{ required: true, message: '请选择职称', trigger: 'change' }],
education: [{ required: true, message: '请选择学历', trigger: 'change' }],
spec: [{ required: true, message: '请选择专业', trigger: 'change' }],
// mobile: [{ required: true, message: '请输入手机号', trigger: 'blur' }],
email: [
{ required: true, message: '请输入邮箱', trigger: 'blur' },
{ required: true, validator: checkEmail, trigger: 'blur' }
],
},
size: 'small',
form: this.$form.createForm(this, { name: 'advanced_search' }),
activekey: '1',
tabDate: [
{ key: "1", tab: "未上报" },
{ key: "2", tab: "返回修改" },
{ key: "3", tab: "已上报" },
{ key: "4", tab: "所有" },
],
itemCount: [0, 0, 0, 0, 0],
// 表单
searchForm: { projName: null, projNo: null, projState: 1, reportYear: null, projType: getType() },
tableData: [],
columns: [
{ title: "项目名称", scopedSlots: { customRender: 'projName' } },
{ title: '项目编号', dataIndex: 'projNo', align: 'center' },
// { title: '版本号', dataIndex: 'versionNo', align: 'center' },
// { title: '项目类别', dataIndex: 'projClassName', align: 'center' },
{ title: '开始时间', dataIndex: 'startDate', align: 'center' },
{ title: '结束时间', dataIndex: 'endDate', align: 'center' },
{ title: '申报年度', dataIndex: 'reportYear', align: 'center' },
{ title: '状态', scopedSlots: { customRender: 'state' }, align: 'center' },
{ title: '操作', scopedSlots: { customRender: 'option' }, align: 'center', fixed: 'right', width: 180, },
],
pagination: { pageIndex: 1, pageSize: this.$defaultPageSize, total: 0, pageSizeOptions: this.$defaultPageSizeOptions, },
loading: false,
// 弹窗标志
visibleView: false,
visibleEdit: false,
id: null,
isButten: false,
display: true,
description: '',
// downloadUrl: '/downloadFile/202306151700.docx',
// fileName: '项目申报流程.docx',
// downloadUrl: '/downloadFile/ExpertInfo.xlsx',
// fileName: '专家导入模板.xlsx',
// downloadUrl: '/downloadFile/202406261130.pdf',
// fileName: '系统用户手册.pdf',
// downloadUrl: '/downloadFile/1637631492.jpg',
// fileName: '1637631492.jpg',
url1: {
downloadUrl: '/downloadFile/202406261120.doc',
fileName: '项目合同书模板.doc',
},
url2: {
downloadUrl: '/downloadFile/202407050900.doc',
fileName: '项目合同书模板.doc',
},
realurl: null,
visibleFileView: false,
projectKPIView: false,
}
},
created () {
this.getUserState()
if (getType() == 1)
this.realurl = this.url1
else
this.realurl = this.url2
},
methods: {
getUserState () {
this.isComplete = this.$store.state.app.isComplete
if (this.isComplete) {
this.loadState = true
this.getYear()
}
else {
this.getAppPersonInfo()
}
},
getAppPersonInfo () {
this.$api.person.getAppPersonInfo().then(({ data = {} }) => {
if (data) {
this.formData = data.person
this.loadState = true
this.isComplete = data.isComplete
this.$store.commit('app/setComplete', data.isComplete)
this.getYear()
}
}).catch(() => { })
},
getYear () {
this.$api.batch.getCurrentYearBatch({ type: 1, projType: getType() }).then(({ data = {} }) => {
if (data) {
this.isButten = data.disabled
this.description = data.description
this.searchForm.reportYear = data.year
this.getListByPage()
}
}).catch(() => { })
},
getListByPage () {
this.getCount()
this.loading = true
let pars = isEmptyParams(this.searchForm)
let par = { ...pars, pageIndex: this.pagination.pageIndex, pageSize: this.pagination.pageSize }
this.$api.project.getListByPage(par).then(({ data = {} }) => {
if (data) {
const { dataList = [], total = 0 } = data
this.tableData = dataList
this.pagination.total = total
this.loading = false
this.tableData.forEach(e => {
if (e.startDate) {
e.startDate = moment(e.startDate).format('YYYY-MM-DD')
e.endDate = moment(e.endDate).format('YYYY-MM-DD')
}
})
} this.loading = false
}).catch(() => { this.loading = false })
},
getCount () {
this.$api.project.getCount({ reportYear: this.searchForm.reportYear, projType: getType() }).then(({ data = {} }) => {
if (data) {
this.itemCount = [data.count1, data.count2, data.count3, data.count4, data.count5]
}
}).catch(() => { })
},
search () {
this.pagination.pageIndex = 1
this.getListByPage()
},
reset () {
this.searchForm.projName = null
this.searchForm.projNo = null
this.pagination.pageIndex = 1
this.getListByPage()
},
change () {
this.getListByPage()
},
showSizeChange (current, pageSize) {
this.pagination.pageIndex = current
this.pagination.pageSize = pageSize
this.getListByPage()
},
submit () {
this.$refs.ruleForm.validate(valid => {
if (valid) {
let pars = isEmptyParams(this.formData)
let par = { ...pars }
this.$api.person.updatePerson(par).then(({ data = {} }) => {
if (data) {
this.$message.success('提交成功!')
this.$store.commit('app/setComplete', true)
this.isComplete = true
}
}).catch(() => { })
} else {
return false
}
});
},
createProject () {
this.id = null
this.visibleEdit = true
//this.$store.commit('app/addCard', { title: '项目创建', key: '1299', code: 'projectCreate', keepAlive: 1, router: '/project/create', closable: true })
},
closeWindow (value) {
if (value === 'submit') {
this.visibleEdit = false
this.getListByPage()
} else if (value === 'save') {
this.getListByPage()
}
else if (value === 'error') {
this.id = null
this.visibleEdit = false
this.visibleView = false
}
},
onLoad (value) {
this.loading = value
},
recordClick (record, type) {
if (type === 'view') {
this.id = record.id
this.visibleView = true
} else if (type === 'edit') {
this.id = record.id
this.visibleEdit = true
} else if (type === 'delete') {
let self = this
this.$confirm({
title: '',
content: '确定要删除该项目?',
okText: '确定',
okType: 'danger',
cancelText: '取消',
onOk () {
self.loading = true
let par = { id: record.id }
self.$api.project.delete(par).then(({ code, data }) => {
if (data) {
self.$message.success('删除成功!')
self.getListByPage()
}
self.loading = false
}).catch(() => { self.loading = false })
},
onCancel () {
},
})
} else if (type === 'report') {
this.loading = true
this.$api.project.report({ auditObjectId: record.id, auditType: 1 }).then(({ data = {} }) => {
if (data) {
this.$message.success('上报成功!')
this.getListByPage()
}
this.loading = false
}).catch(() => { this.loading = false })
}
},
callback (key) {
if (key == '1')
this.display = true
else
this.display = false
this.searchForm.projState = key
this.getListByPage()
},
exportData () {
let pars = isEmptyParams(this.searchForm)
let par = { ...pars, pageIndex: -1, pageSize: -1 }
this.$api.project.getListByPage(par).then(({ data = {} }) => {
if (data) {
const { dataList = [], total = 0 } = data
this.$ToDoExcel(`项目列表`, tableColumnsName(this.columns), filterExportExcelData(this.columns, dataList))
}
}).catch(() => { })
},
FileDownload () {
axios({
url: this.realurl.downloadUrl, // 替换为实际文件的URL
method: 'GET',
responseType: 'blob' // 告诉axios返回的数据类型为Blob
}).then(response => {
const url = window.URL.createObjectURL(new Blob([response.data]))
const link = document.createElement('a')
link.href = url
link.setAttribute('download', this.realurl.fileName) // 下载文件的名称
document.body.appendChild(link)
link.click()
})
},
FileView () {
if (checkImageFileType(this.realurl.fileName)) {//文件为图片
this.$viewerApi({ images: [this.realurl.downloadUrl] })
} else {
if (checkDocumentFileType(this.realurl.fileName))
this.visibleFileView = true
}
},
projectKPI () {
this.projectKPIView = true
}
}
}
</script>