From c91ea4d8cda53c0f319c9f4306ff03e7c774bca0 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期五, 15 三月 2024 16:03:56 +0800
Subject: [PATCH] 业务管理:检验任务(update)

---
 src/components/tool/value-table.vue |   78 ++++++++++++++++++++++++++++++--------
 1 files changed, 61 insertions(+), 17 deletions(-)

diff --git a/src/components/tool/value-table.vue b/src/components/tool/value-table.vue
index 648a160..bdf39e9 100644
--- a/src/components/tool/value-table.vue
+++ b/src/components/tool/value-table.vue
@@ -31,11 +31,31 @@
 		justify-content: center;
 	}
 
-	.body{
+	.body {
 		overflow-x: hidden;
 	}
 </style>
 <style>
+  .value-table .highlight-warning-row-border td{
+    border-top: 2px solid #ffcd29;
+    border-bottom: 2px solid #ffcd29;
+  }
+  .value-table .highlight-warning-row-border td:first-child{
+    border-left: 2px solid #ffcd29;
+  }
+  .value-table .highlight-warning-row-border td:last-child{
+    border-right: 2px solid #ffcd29;
+  }
+  .value-table .highlight-danger-row-border td{
+    border-top: 2px solid red;
+    border-bottom: 2px solid red;
+  }
+  .value-table .highlight-danger-row-border td:first-child{
+    border-left: 2px solid red;
+  }
+  .value-table .highlight-danger-row-border td:last-child{
+    border-right: 2px solid red;
+  }
 	.value-table .el-upload {
 		width: 100%;
 	}
@@ -51,25 +71,28 @@
 			<el-table ref="eltable" :data="tableData" style="width: 100%;" height="100%" tooltip-effect="dark" border
 				@selection-change="selectChange" @select="select" v-loading="loading" @sort-change="sortChange"
 				@row-click="rowClick" :show-summary="data.countFleid!=undefined && data.countFleid.length > 0"
-				:summary-method="getSummaries">
-				<el-table-column type="selection" width="65" v-if="data.showSelect">
+				:summary-method="getSummaries" :key="Math.random()" :row-class-name="tableRowClassName">
+				<el-table-column type="selection" width="65" v-if="data.showSelect" :key="Math.random()">
 				</el-table-column>
-				<el-table-column align="center" type="index" label="搴忓彿" width="70" v-if="data.isIndex">
+				<el-table-column type="index" align="center" label="搴忓彿" width="70" v-if="data.isIndex" :key="Math.random()">
 				</el-table-column>
 				<el-table-column :prop="a.label" :label="a.value" sortable="custom" v-for="(a, ai) in tableHead" :key="ai"
-					show-overflow-tooltip min-width="160">
+         show-overflow-tooltip min-width="160">
 					<template slot-scope="scope">
 						<div v-if="showType(a.label, data.tagField) != null">
 							<el-tag v-for="(b, bi) in data.tagField[a.label].select" :key="bi" v-if="b.value == scope.row[a.label]"
 								:type="b.type" size="medium">{{b.label}}</el-tag>
 						</div>
+            <!-- 鍙搷浣滆杩涜鐐瑰嚮浜嬩欢 -->
+            <span v-else-if="data.linkEvent&&showLink(a.label, data.linkEvent)" style="color:#409EFF;cursor: pointer;" @click="handleLinkEvent(scope.row,data.linkEvent[a.label])">{{scope.row[a.label]}}</span>
 						<span v-else>{{scope.row[a.label]}}</span>
 					</template>
 				</el-table-column>
-				<el-table-column fixed="right" align="center" label="鎿嶄綔" :width="50 + data.do.length * 30"
+				<el-table-column fixed="right" align="center" label="鎿嶄綔" :width="getWidth()"
 					v-if="data.do.length > 0">
 					<template slot-scope="scope">
 						<el-button v-for="(a, ai) in data.do" :key="ai" :type="a.type"
+              :disabled="a.disabFun ? a.disabFun(scope.row,scope.$index) : false"
 							@click="main(scope.row, a)">{{a.font}}</el-button>
 					</template>
 				</el-table-column>
@@ -92,7 +115,7 @@
 							<el-input v-model="upData[a.label]" size="small" clearable :placeholder="`璇疯緭鍏�${a.value}`"
 								v-if="showType(a.label, data.selectField) == null" :disabled="isDisabled(a.label)"></el-input>
 							<el-select v-model="upData[a.label]" size="small" v-if="showType(a.label, data.selectField) != null"
-								style="width: 100%;" :disabled="isDisabled(a.label)">
+								style="width: 100%;" :disabled="isDisabled(a.label)" clearable>
 								<el-option v-for="(b, bi) in data.selectField[a.label].select" :key="bi" :value="b.value"
 									:label="b.label"></el-option>
 							</el-select>
@@ -108,7 +131,7 @@
 							<el-input v-model="upData[a.label]" size="small" clearable :placeholder="`璇疯緭鍏�${a.value}`"
 								v-if="showType(a.label, data.selectField) == null" :disabled="isDisabled(a.label)"></el-input>
 							<el-select v-model="upData[a.label]" size="small" v-if="showType(a.label, data.selectField) != null"
-								style="width: 100%;" :disabled="isDisabled(a.label)">
+								style="width: 100%;" :disabled="isDisabled(a.label)" clearable>
 								<el-option v-for="(b, bi) in data.selectField[a.label].select" :key="bi" :value="b.value"
 									:label="b.label"></el-option>
 							</el-select>
@@ -132,7 +155,7 @@
 							<el-input v-model="upData[a.label]" size="small" clearable :placeholder="`璇疯緭鍏�${a.value}`"
 								v-if="showType(a.label, data.selectField) == null"></el-input>
 							<el-select v-model="upData[a.label]" size="small" v-if="showType(a.label, data.selectField) != null"
-								style="width: 100%;" :placeholder="`璇烽�夋嫨${a.value}`">
+								style="width: 100%;" :placeholder="`璇烽�夋嫨${a.value}`" clearable>
 								<el-option v-for="(b, bi) in data.selectField[a.label].select" :key="bi" :value="b.value"
 									:label="b.label"></el-option>
 							</el-select>
@@ -147,7 +170,7 @@
 							<el-input v-model="upData[a.label]" size="small" clearable :placeholder="`璇疯緭鍏�${a.value}`"
 								v-if="showType(a.label, data.selectField) == null"></el-input>
 							<el-select v-model="upData[a.label]" size="small" v-if="showType(a.label, data.selectField) != null"
-								style="width: 100%;" :placeholder="`璇烽�夋嫨${a.value}`">
+								style="width: 100%;" :placeholder="`璇烽�夋嫨${a.value}`" clearable>
 								<el-option v-for="(b, bi) in data.selectField[a.label].select" :key="bi" :value="b.value"
 									:label="b.label"></el-option>
 							</el-select>
@@ -193,6 +216,9 @@
 	} from 'iview';
 	export default {
 		props: {
+      tableRowClassName:{
+        type: Function
+      },
 			url: {
 				type: String,
 				default: () => null
@@ -223,8 +249,8 @@
 								order: 'asc'
 							}
 						},
-						isIndex: true,
-						showSelect: true,
+						isIndex: false,
+						showSelect: false,
 						select: true,
 						row: 1,
 						do: [{
@@ -264,8 +290,8 @@
 							order: 'asc'
 						}
 					},
-					isIndex: true,
-					showSelect: true,
+					isIndex: false,
+					showSelect: false,
 					select: true,
 					row: 1,
 					do: [{
@@ -388,6 +414,10 @@
 				var str = ob[val]
 				return str == undefined ? null : ob[val].select
 			},
+      showLink(val, ob){
+        var str = ob[val]
+				return str == undefined ? null : ob[val].method
+      },
 			showAddReq(label) {
 				if (this.data.requiredAdd == undefined) {
 					return
@@ -465,7 +495,8 @@
 					}
 				} else {
 					delete row.orderBy
-					this.$emit(val.method, row)
+					this.$parent[val.method](row)
+					// this.$emit(val.method, row)
 				}
 			},
 			saveUpData() {
@@ -504,7 +535,6 @@
 				})
 			},
 			openAddDia(addUrl) {
-				console.log(addUrl);
 				this.addDia = true
 				this.addUrl = addUrl
 				this.upData = {}
@@ -546,7 +576,7 @@
 					return
 				}
 				for (var i = 0; i < this.data.requiredAdd.length; i++) {
-					if (this.upData[this.data.requiredAdd[i]] == null || this.upData[this.data.requiredAdd[i]] == '') {
+					if (this.upData[this.data.requiredAdd[i]] === null || this.upData[this.data.requiredAdd[i]] === '') {
 						var list = this.upHead.filter(a => {
 							if (a.label == this.data.requiredAdd[i]) return a
 						})
@@ -698,6 +728,20 @@
 					}
 				});
 				return sums;
+			},
+      handleLinkEvent(row,val){
+        if(val.method=='doDiy'){
+          this.main(row,val)
+        }else{
+          this.$emit(val.method,row)
+        }
+      },
+			getWidth(){
+				let count = 0
+				this.data.do.forEach(a=>{
+					count += a.font.length
+				})
+				return count * 15 + 60 + 'px'
 			}
 		}
 	}

--
Gitblit v1.9.3