zhangyanpeng
2020-05-07 dca74c76b85c5ece7b87beae9d9f921883b55564
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
<template>
    <div>
        <div align="left">
            <!-- 实际支付费用 -->
            <div class="btn-line">
                <el-button type="primary" @click="showDetail">确认费用</el-button>
            </div>
            <el-form label-width="80px" :inline="true" :label-position="labelPosition" :model="formInline" class="form-inline">
                <el-form-item label="项目名称">
                    <el-input v-model="formInline.name" placeholder="项目名称"></el-input>
                </el-form-item>
                
                <el-form-item label="研究目的">
                    <el-select v-model="formInline.type" placeholder="研究目的">
                        <el-option label="干预性系统评价" value="干预性系统评价"></el-option>
                        <el-option label="诊断性系统评价" value="诊断性系统评价"></el-option>
                        <el-option label="预后性系统评价" value="预后性系统评价"></el-option>
                        <el-option label="相关性系统评价" value="相关性系统评价"></el-option>
                    </el-select>
                </el-form-item>
                
            
                <el-form-item label="项目状态">
                    <el-select v-model="formInline.status" placeholder="项目状态">
                        <el-option label="未开始" value="edit"></el-option>
                        <el-option label="进行中" value="working"></el-option>
                        <el-option label="已延期" value="delay"></el-option>
                        <el-option label="已结束" value="finish"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item >
                    <el-button type="primary" @click="query_">查询</el-button>
                    <el-button type="info" @click="empty_">重置</el-button>
                </el-form-item>
            </el-form>
            <div class="btn-line">
            </div>
        </div>
 
        <el-table  highlight-current-row
                ref="data_table"
                @current-change="tableChange"
                v-loading="loading_table"
                size="small"
                :data="tableData" 
                :header-cell-style="{'width': '100%', 'text-align': 'center'}" 
                :row-class-name="tableRowClassName">
                <el-table-column type="index" width="50"> </el-table-column>
            <el-table-column prop="name" label="项目名称" width="120" show-overflow-tooltip>
            </el-table-column>
            <el-table-column prop="status" label="当前状态" width="100" align="center" :formatter="status_">
            </el-table-column>
            <el-table-column prop="reseachType" label="研究类型" width="130">
            </el-table-column>
            <el-table-column prop="totalCnt" label="服务项目数" width="100" align="center">
            </el-table-column>
            <el-table-column prop="finishCnt" label="已完成项目" width="100" align="center">
            </el-table-column>
            <el-table-column prop="delayCnt" label="延期项目" width="100" align="center">
            </el-table-column>
            <el-table-column prop="startTime" label="开始时间" width="100" align="center" :formatter="dateFormat_">
            </el-table-column>
            <el-table-column prop="endTime" label="结束时间" width="100" align="center" :formatter="dateFormat_" >
            </el-table-column>
            <el-table-column prop="desp" label="项目描述" show-overflow-tooltip></el-table-column>
        </el-table>
        <div style="text-align: right; background-color: #fff;">
            <el-pagination 
                @current-change="handleCurrentChange"
                background :current-page="pagenum" 
                :page-sizes="[15]" 
                :page-size="pagesize" 
                layout="total, sizes, prev, pager, next, jumper"
             :total="total">
            </el-pagination>
        </div>
        
        <el-dialog title="项目详情确认" v-if="dialog_2" @close="Cancel2"  width="70%" top="50px" :visible.sync="dialog_2" append-to-body>
            <substepReadOnly @closeProject="closeDetail"  v-bind:xmId="detailData.id" ref="newProject2_"></substepReadOnly>
        </el-dialog>
        
    </div>
</template>
 
<script>
    import substepReadOnly from './popup/substepReadOnly.vue';
    export default {
        
        components: {
          substepReadOnly,
        },
        data() {
            return {
                editShow: true,
                upload_url: "",
                upload_type: "",
                upload_headers: {},
                upload_data: {},
                
                pdfUrl: "",
                currentPage: 1,
                pageCount: 0,
                
                loading_table: false,
                query: "",
                rowData:undefined,
                detailData:undefined,
                dialog_1: false,
                dialog_2: false,
                dialog_upload: false,
                dialog_pdf: false,
                pagenum: 1,
                pagesize: 15,
                total: 0,
                selected: undefined,
                labelPosition: "left",
                tableData: [],
                userId:"",
                assign:undefined,
                formInline: {
                    user: '',
                    region: ''
                },
            }
        },
        mounted() { //组件配置后,页面显示前。用于加载数据
            this.getData();
            //this.userId = localStorage.getItem('userId');
            //this.assign = localStorage.getItem('assign');
            
            this.userId = this.$cookies.get('userId');
            this.assign = this.$cookies.get('assign');
        },
        methods: {
            Cancel2() {
                this.dialog_2 = false;
                //this.closeDetail();
            },
            closeDetail() {
                this.dialog_2 = false;
                //this.detailData = undefined;
            },
            showDetail() {
                if(!this.selected || !this.selected.id){
                    this.$message({message:'请选中一个项目', type: 'warning'});
                    return;
                }
                this.dialog_2 = true;
            },
            tableChange(val) {
                if (!val) {
                    val = {};
                }
                this.selected = val;
                this.detailData = val;
            //    this.editShow = true;
                 if (this.selected.userId == this.userId) {
                    this.editShow = true;
                }else {
                    this.editShow = false;
                }
                
            },
            handleCurrentChange(pageno) {
                this.pagenum = pageno;
                this.query_();
            },
            empty_() {
                this.formInline = {};
                this.query_();
            },
            query_() {
                this.getData(this.formInline);
            },
            getData(query) {
                this.loading_table = true;
                let pageno = this.pagenum;
                let url = "/api/scheme/page/" + pageno;
                
                let params =  {
                    pageSize: this.pagesize,
                    isRun: true
                };
                if(this.assign) {
                    params.userId = this.userId;
                }
                if(query){
                    params.name = query.name;
                    params.status = query.status;
                    params.type = query.type;
                }
                this.$axios.get(url, {
                        params
                    })
                    .then(data_ => {
                        window.console.log(data_);
                        let clientHeight = document.documentElement.clientHeight;
                        let tableHeight_ = clientHeight - 60 - 20 - 60 - 62 - 48 - 48 - 20;
                        this.$refs.data_table.$el.getElementsByClassName('el-table__body-wrapper')[0].style['height'] = tableHeight_ - 10 + "px";// - header_height
                        this.$refs.data_table.$el.getElementsByClassName('el-table__body-wrapper')[0].style['min-height'] = tableHeight_ - 10 + "px";
                        this.$refs.data_table.$el.getElementsByClassName('el-table__body-wrapper')[0].style['overflow'] = "overlay";
                        
                        this.tableData = data_.data.data.datas.records; //给tableData赋值
                        this.total = data_.data.data.datas.total;
                        this.loading_table = false;
                    }).catch(error => {
                //        console.log(error);
                    })
            },
            tableRowClassName(row, rowIndex) {
                if (row.finish) {
                    return 'success-row';
                } else if(row.delay){
                    return 'warning-row';
                }
                return '';
            },
            onSubmit() {
                query_();
            },
            dateFormat_(row, colum, val ,index) {
                return this.$moment(val).format('YYYY-MM-DD');
            
            },
            status_(row, colum, val ,index) {
                if(val == "working") {
                    return "进行中";
                }else if(val == "edit") {
                    return "未开始";
                }else if(val == "delay") {
                    return "已延期";
                }else if(val == "finish") {
                    return "已结束";
                }
            },
            finishFotmat(row, colum, val ,index) {
                if(val) {
                    return "已结束";
                }else {
                    return "进行中";
                }
            },
            addProject() {
                this.dialog_1 = true;
                this.rowData = {};
            },
            editProject() {
                if(!this.selected || this.selected.status == "finish"){
                    
                    this.$message({message:'请选中一条未完成的项目', type: 'warning'});
                }else {
                    this.rowData = {
                        id:this.selected.id,
                        desp:this.selected.desp,
                        name: this.selected.name,
                        beginDate: this.selected.beginDate,
                        endDate: this.selected.endDate,
                        objective:this.selected.reseachType,
                        items:[this.$moment(this.selected.startTime).format('YYYY-MM-DD'),this.$moment(this.selected.endTime).format('YYYY-MM-DD')]
                    }
                    this.dialog_1 = true;
                }
                
                
            },closeNewProject() {
                this.dialog_1 = false;
                query_();
            },
            
        }
    }
</script>
 
<style>
    .btn-line {
        margin-bottom: 20px;
    }
    .el-table .warning-row {
        background: oldlace;
      }
    
      .el-table .success-row {
        background: #f0f9eb;
      }
</style>