From 84326b11401f217cd483d13bc72cec4ffd5da7ce Mon Sep 17 00:00:00 2001
From: bob <bob.zhang@highdatas.com>
Date: 星期三, 25 十一月 2020 10:02:22 +0800
Subject: [PATCH] 2020-11-13

---
 src/views/list.vue |  117 +++++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 87 insertions(+), 30 deletions(-)

diff --git a/src/views/list.vue b/src/views/list.vue
index 3f83ec0..5b7a84c 100644
--- a/src/views/list.vue
+++ b/src/views/list.vue
@@ -1,9 +1,9 @@
 <template>
+	<!-- 宸插畬鎴愮殑涓嶄慨鏀归渶灏� finish1 鏀规垚 finish -->
 	<div>
 		<div align="left">
-
 			<div class="btn-line">
-				<el-button type="primary" @click="addProject">鏂板缓椤圭洰</el-button>
+				<!-- <el-button type="primary" @click="addProject">鏂板缓椤圭洰</el-button> -->
 				<el-button type="primary" v-if="editShow" @click="editProject">缂栬緫椤圭洰</el-button>
 				<el-button type="primary" @click="showDetail">鏌ョ湅璇︽儏</el-button>
 				<el-button type="primary" @click="download">瀵煎嚭timeline</el-button>
@@ -17,12 +17,14 @@
 					<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-form-item label="鐮旂┒绫诲瀷鍒嗙被" label-width="100px">
+					<el-select v-model="formInline.type" placeholder="鐮旂┒绫诲瀷鍒嗙被">
+						<el-option
+							v-for="(item,k) in options_type"
+							:key="k"
+							:label="item"
+							:value="item"
+						></el-option>
 					</el-select>
 				</el-form-item>
 				
@@ -49,34 +51,35 @@
 		<el-table  highlight-current-row
 				ref="data_table"
 				@current-change="tableChange"
+				@sort-change="sortChange"
 				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 prop="code" label="椤圭洰鍙�" width="130" sortable="custom">
 			</el-table-column>
-			<el-table-column prop="status" label="褰撳墠鐘舵��" width="100" align="center" :formatter="status_">
+			<el-table-column prop="name" label="椤圭洰鍚嶇О" width="120" sortable="custom" show-overflow-tooltip>
 			</el-table-column>
-			<el-table-column prop="reseachType" label="鐮旂┒绫诲瀷" width="130">
+			<el-table-column prop="status" label="褰撳墠鐘舵��" width="100" sortable="custom" align="center" :formatter="status_">
 			</el-table-column>
-			<el-table-column prop="totalCnt" label="鏈嶅姟椤圭洰鏁�" width="100" align="center">
+			<el-table-column prop="totalCnt" label="鏈嶅姟椤圭洰鏁�" width="120"  align="center">
 			</el-table-column>
-			<el-table-column prop="finishCnt" label="宸插畬鎴愰」鐩�" width="100" align="center">
+			<el-table-column prop="finishCnt" label="宸插畬鎴愰」鐩�" width="120"  align="center">
 			</el-table-column>
-			<el-table-column prop="delayCnt" label="寤舵湡椤圭洰" width="100" align="center">
+			<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 prop="startTime" label="寮�濮嬫椂闂�" width="100" sortable="custom" align="center" :formatter="dateFormat_">
 			</el-table-column>
-			<el-table-column prop="endTime" label="缁撴潫鏃堕棿" width="100" align="center" :formatter="dateFormat_" >
+			<el-table-column prop="endTime" label="缁撴潫鏃堕棿" width="100" sortable="custom" align="center" :formatter="dateFormat_" >
 			</el-table-column>
-			<el-table-column prop="desp" label="椤圭洰鎻忚堪" show-overflow-tooltip></el-table-column>
+			<el-table-column prop="desc" label="椤圭洰鎻忚堪" show-overflow-tooltip></el-table-column>
 			<el-table-column label="鎿嶄綔" align="center" width="300">
 			  <template v-slot="{row}">
 			    <el-row>
 			      <el-tooltip class="item" effect="dark" content="棰勮" placement="top">
-			        <el-button type="primary" icon=" el-icon-view" circle @click="viewHT(row)"></el-button>
+			        <el-button :disabled="!row.attachment" type="primary" icon=" el-icon-view" circle @click="viewHT(row)"></el-button>
 			      </el-tooltip>
 			      <el-tooltip class="item" effect="dark" content="涓婁紶鎶ヤ环鍚堝悓" placement="top">
 			        <el-button type="success" icon="el-icon-upload2" circle @click="uploadHT(row)"></el-button>
@@ -181,20 +184,63 @@
 				labelPosition: "left",
 				tableData: [],
 				userId:"",
-				assign:undefined,
-				formInline: {
-					user: '',
-					region: ''
-				},
+				assign:null,
+				formInline: {},
+				options_type:[
+					"Health technology assessment (HTA)",
+					"Clinical practice guideline (CPG)",
+					"Evidence mapping",
+					"Overview of review",
+					"Scoping review",
+					"Rapid review",
+					"Systematic review",
+					"Rapid review",
+					"Randomised controlled trial (RCT)",
+					"Other"
+				],
+				
+				orderBy: "",
 			}
 		},
 		mounted() { //缁勪欢閰嶇疆鍚庯紝椤甸潰鏄剧ず鍓嶃�傜敤浜庡姞杞芥暟鎹�
+			//this.userId = localStorage.getItem('userId');
+			//this.assign = localStorage.getItem('assign');
+			
+			this.userId = this.$cookies.get('userId');
+			this.assign = this.$cookies.get('assign');
+			
 			this.getData();
-			this.userId = localStorage.getItem('userId');
-			this.assign = localStorage.getItem('assign');
 		},
 		methods: {
+			sortChange(column, prop, order) {
+				this.orderBy = "";
+				if (column.prop && column.order) {
+					this.orderBy = this.toLine(column.prop);
+					if (column.order == "descending") {
+						this.orderBy += " desc";
+					}
+				}
+				
+				this.query_();
+			},
+			
+			// 涓嬪垝绾胯浆鎹㈤┘宄�
+			toHump(name) {
+			    return name.replace(/\_(\w)/g, function(all, letter){
+			        return letter.toUpperCase();
+			    });
+			},
+			// 椹煎嘲杞崲涓嬪垝绾�
+			toLine(name) {
+			  return name.replace(/([A-Z])/g,"_$1").toLowerCase();
+			},
+			
 			download() {
+				if (!this.selected) {
+					this.$message({message:'璇烽�夋嫨涓嬭浇鏉$洰', type: 'warning'});
+					return;
+				}
+				
 				if(!this.selected.id || this.selected.status == "edit"){
 					this.$message({message:'銆愭湭寮�濮嬨�戠姸鎬佷笉鑳戒笅杞�', type: 'warning'});
 					return;
@@ -312,14 +358,24 @@
 				let params =  {
 					pageSize: this.pagesize
 				};
-				if(this.assign) {
+				if(this.assign == "true") {
 					params.userId = this.userId;
 				}
-				if(query){
+				
+				if (query && query.name) {
 					params.name = query.name;
+				}
+				if (query && query.status) {
 					params.status = query.status;
+				}
+				if (query && query.type) {
 					params.type = query.type;
 				}
+				
+				if(this.orderBy) {
+					params.orderBy = this.orderBy;
+				}
+				
 				this.$axios.get(url, {
 						params
 					})
@@ -376,13 +432,14 @@
 				this.rowData = {};
 			},
 			editProject() {
-				if(!this.selected || this.selected.status == "finish"){
-					
+				//宸插畬鎴愮殑涓嶄慨鏀归渶灏� finish1 鏀规垚 finish
+			//	if(!this.selected || this.selected.status == "finish"){
+				if(!this.selected || this.selected.status == "finish1"){
 					this.$message({message:'璇烽�変腑涓�鏉℃湭瀹屾垚鐨勯」鐩�', type: 'warning'});
 				}else {
 					this.rowData = {
 						id:this.selected.id,
-						desp:this.selected.desp,
+						desc:this.selected.desc,
 						name: this.selected.name,
 						beginDate: this.selected.beginDate,
 						endDate: this.selected.endDate,

--
Gitblit v1.8.0