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
<template>
<div class="app-content">
<a-form layout="inline" :form="form" :model="searchForm">
<a-form-item>
<a-input placeholder="项目名称" v-model="searchForm.projName" :maxLength="100" style="width: 160px" />
</a-form-item>
<a-form-item>
<a-input placeholder="项目编号" v-model="searchForm.projNo" :maxLength="100" style="width: 160px" />
</a-form-item>
<a-form-item>
<base-select v-model="searchForm.reportYear" :title="'年度'" :type="7" :isAll="true" :width="160" />
</a-form-item>
<a-form-item>
<a-button type="primary" icon="search" @click="searchList">搜索</a-button>
<a-button icon="reload" style="margin-left: 10px" @click="searchFormReset" class="bt-normal">重置</a-button>
<a-button type="primary" style="margin-left: 10px" @click="FileDownload" icon="download">项目任务书模板下载</a-button>
</a-form-item>
<div style="width:100%;margin-bottom: 8px;">
<a-button type="primary" @click="exportData">导出Excel</a-button>
</div>
</a-form>
<a-table :dataSource="tableData" :columns="columns" rowKey="projId" :pagination="false" :loading="loading"> <!-- :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type: 'radio' }" -->
<template slot="projName" slot-scope="record">
<a @click="recordClick(record, 'viewProject')">{{record.projName}}</a>
</template>
<template slot="testStateName" slot-scope="record">
<span v-if="record">{{record}}</span>
<span v-else>未填写</span>
</template>
<template slot="option" slot-scope="record">
<a-button type="primary" size="small" v-if="((!record.testState||record.testState==1))" @click="recordClick(record,'UploadProjTask')">上传项目任务书</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} 条`" />
<a-modal v-model="taskFileEditView" title="上传项目任务书" :width="'60%'" :maskClosable="false" :footer="null" destroyOnClose class="sc_modal">
<task-file-edit v-model="selectProjId" @close="closeTaskFileEditWindow" />
</a-modal>
<s-modal title="项目详情" v-model="visibleView" v-if="visibleView">
<div slot="content">
<project-view v-model="selectProjId" @close="() => this.visibleView = false"></project-view>
</div>
</s-modal>
</div>
</template>
<script>
import { isEmptyParams, filterExportExcelData, tableColumnsName, } from "@/views/utils/common";
import { getType } from '@/views/utils/auth'
import baseSelect from '@/views/components/common/baseSelect'
import taskFileEdit from '@/views/report/task/components/taskFileEdit'
import projectView from '@/views/report/project/components/projectView'
import moment from 'moment'
import axios from 'axios'
const columns = [
{ title: "项目名称", scopedSlots: { customRender: 'projName' } },
{ title: "项目编号", dataIndex: "projNo" },
{ title: "项目开始时间", dataIndex: "projStart", tabKey: "2" },
{ title: "项目结束时间", dataIndex: "projEnd", tabKey: "2" },
{ title: "申报年度", dataIndex: "reportYear" },
//{ title: "状态", dataIndex: "testStateName", scopedSlots: { customRender: "testStateName" }, },
{ title: "操作", fixed: "right", width: "200px", scopedSlots: { customRender: "option" }, align: 'center' },
];
export default {
name: "projectTask",
components: { baseSelect, taskFileEdit, projectView, },
data() {
return {
form: this.$form.createForm(this, { name: 'advanced_search' }),
searchForm: { projName: '', projNo: '', testState: '5', reportYear: null },
tableData: [],
columns: columns,
pagination: {
pageIndex: 1,
pageSize: this.$defaultPageSize,
total: 0,
pageSizeOptions: this.$defaultPageSizeOptions,
},
selectedRowKeys: [],
loading: false,
taskFileEditView: false,
selectProjId: null,
//selectTaskId: null,
//selectTestState: null,
visibleView: false,
id: null,
url1: {
downloadUrl: '/downloadFile/202408091430.doc',
fileName: '项目任务书模板.doc',
},
url2: {
downloadUrl: '/downloadFile/202408091430.doc',
fileName: '公立医院高水平临床专科发展科技项目任务书.doc',
},
realurl: null,
};
},
created () {
this.getYear()
if (getType() == 1)
this.realurl = this.url1
else
this.realurl = this.url2
},
methods: {
getYear () {
this.$api.batch.getCurrentYearBatch({ type: 1, projType: getType() }).then(({ data = {} }) => {
if (data) {
this.searchForm.reportYear = data.year
this.getListByPage()
}
}).catch(() => { })
},
getListByPage () {
this.loading = true
let pars = isEmptyParams(this.searchForm)
let par = {
...pars,
pageIndex: this.pagination.pageIndex,
pageSize: this.pagination.pageSize
}
this.$api.taskReport.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.projStart) {
e.projStart = moment(e.projStart).format('YYYY-MM-DD')
e.projEnd = moment(e.projEnd).format('YYYY-MM-DD')
}
})
}
}).catch(() => {
this.loading = false
})
},
searchList () {
this.getListByPage()
},
change () {
this.getListByPage()
},
showSizeChange (current, pageSize) {
this.pagination.pageIndex = current
this.pagination.pageSize = pageSize
this.getListByPage()
},
onSelectChange (selectedRowKeys, selectedRows) {
this.selectedRowKeys = selectedRowKeys
this.selectProjId = selectedRows[0].projId
// this.selectTaskId = selectedRows[0].id
// this.selectTestState = selectedRows[0].testState
},
searchFormReset () {
this.searchForm = {
projName: '',
projNo: '',
testState: '5',
reportYear: moment().year(),
}
},
recordClick (record, type) {
if (type === 'UploadProjTask') {
this.selectProjId = record.projId
this.taskFileEditView = true
}
if (type === 'viewProject') {
this.selectProjId = record.projId
this.visibleView = true
}
},
closeTaskFileEditWindow() {
this.taskFileEditView = false
},
exportData () {
this.$ToDoExcel(`任务书列表`, tableColumnsName(this.columns), filterExportExcelData(this.columns, this.tableData))
},
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()
})
},
}
};
</script>