From 15b3879cd259108e7ebb755fe02c190f28f1e20c Mon Sep 17 00:00:00 2001
From: leiqunqing <zhengqifeng@hnkhzn.com>
Date: 星期五, 06 二月 2026 14:46:23 +0800
Subject: [PATCH] 完善项目
---
代码管理/WIDESEAWCS_Client/src/components/basic/VolTable.vue | 308 ++++++++++++++++++++-------------------------------
1 files changed, 120 insertions(+), 188 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WIDESEAWCS_Client/src/components/basic/VolTable.vue" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WIDESEAWCS_Client/src/components/basic/VolTable.vue"
index 096a1ea..227800d 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WIDESEAWCS_Client/src/components/basic/VolTable.vue"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WIDESEAWCS_Client/src/components/basic/VolTable.vue"
@@ -143,21 +143,13 @@
>
<div style="display: flex; align-items: center" @click.stop>
<i
- style="
- padding: 3px;
- margin-right: 10px;
- color: #8f9293;
- cursor: pointer;
- "
+ style="padding: 3px; margin-right: 10px; color: #8f9293; cursor: pointer"
@click="showUpload(scope.row, column)"
class="el-icon-upload"
></i>
<img
v-show="column.edit.type == 'img'"
- v-for="(file, imgIndex) in getFilePath(
- scope.row[column.field],
- column
- )"
+ v-for="(file, imgIndex) in getFilePath(scope.row[column.field], column)"
:key="imgIndex"
:onerror="defaultImg"
@click="viewImg(scope.row, column, file.path, $event)"
@@ -168,10 +160,7 @@
style="margin-right: 8px"
v-show="column.edit.type != 'img'"
class="t-file"
- v-for="(file, fIndex) in getFilePath(
- scope.row[column.field],
- column
- )"
+ v-for="(file, fIndex) in getFilePath(scope.row[column.field], column)"
:key="fIndex"
@click="dowloadFile(file)"
>{{ file.name }}</a
@@ -197,8 +186,7 @@
v-model="scope.row[column.field]"
@change="
(val) => {
- column.onChange &&
- column.onChange(scope.row, column, val);
+ column.onChange && column.onChange(scope.row, column, val);
}
"
:type="column.edit.type"
@@ -216,8 +204,7 @@
v-model="scope.row[column.field]"
@change="
(val) => {
- column.onChange &&
- column.onChange(scope.row, column, val);
+ column.onChange && column.onChange(scope.row, column, val);
}
"
:placeholder="column.placeholder || column.title"
@@ -253,9 +240,7 @@
>
</el-switch>
<template
- v-else-if="
- ['select', 'selectList'].indexOf(column.edit.type) != -1
- "
+ v-else-if="['select', 'selectList'].indexOf(column.edit.type) != -1"
>
<el-select-v2
style="width: 100%"
@@ -267,9 +252,7 @@
:placeholder="column.placeholder || column.title"
:autocomplete="column.autocomplete"
:options="column.bind.data"
- @change="
- column.onChange && column.onChange(scope.row, column)
- "
+ @change="column.onChange && column.onChange(scope.row, column)"
clearable
:disabled="initColumnDisabled(scope.row, column)"
>
@@ -284,16 +267,12 @@
v-else
v-model="scope.row[column.field]"
:filterable="
- column.filter || column.bind.data.length > 10
- ? true
- : false
+ column.filter || column.bind.data.length > 10 ? true : false
"
:multiple="column.edit.type == 'select'"
:placeholder="column.placeholder || column.title"
:autocomplete="column.autocomplete"
- @change="
- column.onChange && column.onChange(scope.row, column)
- "
+ @change="column.onChange && column.onChange(scope.row, column)"
clearable
:disabled="initColumnDisabled(scope.row, column)"
>
@@ -333,10 +312,7 @@
:disabled="initColumnDisabled(scope.row, column)"
></el-input>
</div>
- <div
- class="extra"
- v-if="column.extra && edit.rowIndex == scope.$index"
- >
+ <div class="extra" v-if="column.extra && edit.rowIndex == scope.$index">
<a
:style="column.extra.style"
style="text-decoration: none"
@@ -359,10 +335,7 @@
></a>
<img
v-else-if="column.type == 'img'"
- v-for="(file, imgIndex) in getFilePath(
- scope.row[column.field],
- column
- )"
+ v-for="(file, imgIndex) in getFilePath(scope.row[column.field], column)"
:key="imgIndex"
:onerror="defaultImg"
@click="viewImg(scope.row, column, file.path, $event)"
@@ -373,10 +346,7 @@
style="margin-right: 8px"
v-else-if="column.type == 'file' || column.type == 'excel'"
class="t-file"
- v-for="(file, fIndex) in getFilePath(
- scope.row[column.field],
- column
- )"
+ v-for="(file, fIndex) in getFilePath(scope.row[column.field], column)"
:key="fIndex"
@click="dowloadFile(file)"
>{{ file.name }}</a
@@ -418,9 +388,7 @@
:effect="column.effect"
>{{ formatter(scope.row, column, true) }}</el-tag
>
- <template v-else>{{
- formatter(scope.row, column, true)
- }}</template>
+ <template v-else>{{ formatter(scope.row, column, true) }}</template>
</div>
<span v-else>{{ formatter(scope.row, column, true) }}</span>
@@ -463,9 +431,7 @@
:max-file="currentColumn.edit.maxFile"
:img="currentColumn.edit.type == 'img'"
:excel="currentColumn.edit.type == 'excel'"
- :fileTypes="
- currentColumn.edit.fileTypes ? currentColumn.edit.fileTypes : []
- "
+ :fileTypes="currentColumn.edit.fileTypes ? currentColumn.edit.fileTypes : []"
:fileInfo="fileInfo"
:upload-after="uploadAfter"
>
@@ -477,9 +443,7 @@
<el-button type="default" size="small" @click="uploadModel = false"
>鍏抽棴</el-button
>
- <el-button type="primary" size="small" @click="saveUpload"
- >淇濆瓨</el-button
- >
+ <el-button type="primary" size="small" @click="saveUpload">淇濆瓨</el-button>
</div>
</template>
</VolBox>
@@ -506,9 +470,7 @@
},
components: {
"table-render": VolTableRender,
- VolUpload: defineAsyncComponent(() =>
- import("@/components/basic/VolUpload.vue")
- ),
+ VolUpload: defineAsyncComponent(() => import("@/components/basic/VolUpload.vue")),
VolBox: defineAsyncComponent(() => import("@/components/basic/VolBox.vue")),
},
props: {
@@ -642,7 +604,6 @@
default: 500,
},
selectable: {
-
type: Function,
default: (row, index) => {
return true;
@@ -783,33 +744,28 @@
}
});
if (keys.length > 0) {
- this.http
- .post("/api/Sys_Dictionary/GetVueDictionary", keys)
- .then((dic) => {
- dic.forEach((x) => {
- if (x.data.length > this.select2Count) {
- x.data.forEach((item) => {
- item.label = item.value;
- item.value = item.key;
+ this.http.post("/api/Sys_Dictionary/GetVueDictionary", keys).then((dic) => {
+ dic.forEach((x) => {
+ if (x.data.length > this.select2Count) {
+ x.data.forEach((item) => {
+ item.label = item.value;
+ item.value = item.key;
+ });
+ }
+ columnBind.forEach((c) => {
+ // 杞崲鏁版嵁婧愮殑绫诲瀷涓庡垪鐨勭被鍨嬩竴鑷�(2020.04.04)
+ if (c.key == x.dicNo && (c.valueTyoe == "int" || c.valueTyoe == "sbyte")) {
+ x.data.forEach((d) => {
+ // 2020.09.01澧炲姞瀵规暟瀛楃被鍨嬬殑浜屾鍒ゆ柇
+ if (!isNaN(d.key)) {
+ d.key = ~~d.key;
+ }
});
}
- columnBind.forEach((c) => {
- // 杞崲鏁版嵁婧愮殑绫诲瀷涓庡垪鐨勭被鍨嬩竴鑷�(2020.04.04)
- if (
- c.key == x.dicNo &&
- (c.valueTyoe == "int" || c.valueTyoe == "sbyte")
- ) {
- x.data.forEach((d) => {
- // 2020.09.01澧炲姞瀵规暟瀛楃被鍨嬬殑浜屾鍒ゆ柇
- if (!isNaN(d.key)) {
- d.key = ~~d.key;
- }
- });
- }
- if (c.key == x.dicNo) c.data.push(...x.data);
- });
+ if (c.key == x.dicNo) c.data.push(...x.data);
});
});
+ });
}
this.paginations.sort = this.pagination.sortName;
@@ -861,11 +817,7 @@
},
extraClick(row, column) {
column.extra.click &&
- column.extra.click(
- row,
- column,
- this.url ? this.rowData : this.tableData
- );
+ column.extra.click(row, column, this.url ? this.rowData : this.tableData);
},
headerClick(column, event) {
if (this.clickEdit && this.edit.rowIndex != -1) {
@@ -885,74 +837,76 @@
rowDbClick(row, column, event) {
//2021.05.23澧炲姞鍙屽嚮琛屼簨浠�
this.$emit("rowDbClick", { row, column, event });
- },rowClick(row, column, event) {
- // 2022.02.20澧炲姞鐐瑰嚮鏃惰〃鏍煎弬鏁板垽鏂�
- if (!column) {
- return;
- }
+ },
+ rowClick(row, column, event) {
+ // 2022.02.20澧炲姞鐐瑰嚮鏃惰〃鏍煎弬鏁板垽鏂�
+ if (!column) {
+ return;
+ }
- // ===== 浼樺寲锛氶殧绂诲閫夋鐐瑰嚮浜嬩欢锛岄伩鍏嶅啋娉″共鎵� 寮�濮� =====
- // 鍒ゆ柇鐐瑰嚮鐩爣鏄惁鏄閫夋锛堟垨澶嶉�夋鎵�鍦ㄧ殑鍗曞厓鏍�/鍥炬爣锛�
- const targetEl = event.target;
- const isCheckbox = targetEl.classList.contains('el-checkbox__input') ||
- targetEl.closest('.el-checkbox__input') ||
- targetEl.closest('.el-table-column--selection');
- // 濡傛灉鐐瑰嚮鐨勬槸澶嶉�夋鍖哄煙锛岀洿鎺ヨ繑鍥烇紝涓嶆墽琛岃閫変腑閫昏緫
- if (isCheckbox) {
- return;
- }
- // ===== 浼樺寲锛氶殧绂诲閫夋鐐瑰嚮浜嬩欢 缁撴潫 =====
+ // ===== 浼樺寲锛氶殧绂诲閫夋鐐瑰嚮浜嬩欢锛岄伩鍏嶅啋娉″共鎵� 寮�濮� =====
+ // 鍒ゆ柇鐐瑰嚮鐩爣鏄惁鏄閫夋锛堟垨澶嶉�夋鎵�鍦ㄧ殑鍗曞厓鏍�/鍥炬爣锛�
+ const targetEl = event.target;
+ const isCheckbox =
+ targetEl.classList.contains("el-checkbox__input") ||
+ targetEl.closest(".el-checkbox__input") ||
+ targetEl.closest(".el-table-column--selection");
+ // 濡傛灉鐐瑰嚮鐨勬槸澶嶉�夋鍖哄煙锛岀洿鎺ヨ繑鍥烇紝涓嶆墽琛岃閫変腑閫昏緫
+ if (isCheckbox) {
+ return;
+ }
+ // ===== 浼樺寲锛氶殧绂诲閫夋鐐瑰嚮浜嬩欢 缁撴潫 =====
- // ===== 浼樺寲锛氱偣鍑昏閫変腑/鍒囨崲澶嶉�夋 寮�濮� =====
- // 1. 鍒ゆ柇鏄惁鏄剧ず澶嶉�夋锛坈k涓簍rue锛夛紝涓嶆樉绀哄垯鏃犻渶澶勭悊
- // 2. 缂栬緫鐘舵�佷笅涓嶈Е鍙戯紙閬垮厤骞叉壈缂栬緫鍔熻兘锛�
- if (this.ck && this.edit.rowIndex === -1) {
- // 3. 鍗曢�夊満鏅紙single涓簍rue锛夛細鍏堟竻绌烘墍鏈夐�変腑椤癸紝鍐嶅己鍒堕�変腑褰撳墠琛岋紙淇濇寔鍗曢�夐�昏緫锛�
- if (this.single) {
- this.$refs.table.clearSelection(); // 娓呯┖鎵�鏈夐�変腑
- this.$refs.table.toggleRowSelection(row, true); // 鍗曢�夊満鏅己鍒堕�変腑褰撳墠琛�
- }
- // 4. 澶氶�夊満鏅紙single涓篺alse锛夛細涓嶄紶绗簩涓弬鏁帮紝瀹炵幇鍒囨崲閫変腑/鍙栨秷鐘舵��
- else {
- this.$refs.table.toggleRowSelection(row); // 鍒囨崲鐘舵�侊紝鏀寔鍙栨秷閫変腑
- }
- }
- // ===== 浼樺寲锛氱偣鍑昏閫変腑/鍒囨崲澶嶉�夋 缁撴潫 =====
-
- // 姝e湪缂栬緫鏃讹紝绂佹瑙﹀彂rowClick浜嬩欢
- if (this.edit.rowIndex == -1) {
- this.$emit("rowClick", { row, column, event });
- }
- // 鐐瑰嚮琛屼簨浠�(2020.11.07)
- if (!this.doubleEdit) {
- return;
- }
- // 鐐瑰嚮鍏朵粬琛屾椂锛屽鏋滅偣鍑荤殑琛屼笌姝e湪缂栬緫鐨勮鐩稿悓锛屼繚鎸佺紪杈戠姸鎬�
- if (this.clickEdit && this.edit.rowIndex != -1) {
- if (row.elementIndex == this.edit.rowIndex) {
- // 鐐瑰嚮鐨勫崟鍏冩牸濡傛灉涓嶅彲浠ョ紪杈戯紝鐩存帴缁撴潫缂栬緫
- // 2020.10.12淇缁撴潫缂栬緫鏃讹紝element table楂樼増鏈睘鎬ц幏鍙栦笉鍒扮殑闂
- let _col = this.columns.find((x) => {
- return x.field == ((event && event.property) || column.property);
- });
- if (_col && (!_col.edit || _col.readonly)) {
- if (this.rowEndEdit(row, event)) {
- this.edit.rowIndex = -1;
+ // ===== 浼樺寲锛氱偣鍑昏閫変腑/鍒囨崲澶嶉�夋 寮�濮� =====
+ // 1. 鍒ゆ柇鏄惁鏄剧ず澶嶉�夋锛坈k涓簍rue锛夛紝涓嶆樉绀哄垯鏃犻渶澶勭悊
+ // 2. 缂栬緫鐘舵�佷笅涓嶈Е鍙戯紙閬垮厤骞叉壈缂栬緫鍔熻兘锛�
+ if (this.ck && this.edit.rowIndex === -1) {
+ // 3. 鍗曢�夊満鏅紙single涓簍rue锛夛細鍏堟竻绌烘墍鏈夐�変腑椤癸紝鍐嶅己鍒堕�変腑褰撳墠琛岋紙淇濇寔鍗曢�夐�昏緫锛�
+ if (this.single) {
+ this.$refs.table.clearSelection(); // 娓呯┖鎵�鏈夐�変腑
+ this.$refs.table.toggleRowSelection(row, true); // 鍗曢�夊満鏅己鍒堕�変腑褰撳墠琛�
+ }
+ // 4. 澶氶�夊満鏅紙single涓篺alse锛夛細涓嶄紶绗簩涓弬鏁帮紝瀹炵幇鍒囨崲閫変腑/鍙栨秷鐘舵��
+ else {
+ this.$refs.table.toggleRowSelection(row); // 鍒囨崲鐘舵�侊紝鏀寔鍙栨秷閫変腑
}
}
- return;
- }
- if (this.rowEndEdit(row, event && event.property ? event : column)) {
- this.edit.rowIndex = -1;
- }
- //褰撴鍦ㄧ紪杈戯紝涓旂偣鍑诲埌鍏朵粬琛屾椂锛屽湪鍘熺紪杈戠殑琛岀粨鏉熺紪杈戝悗锛岃Е鍙戞柊琛岀殑rowClick浜嬩欢
- //姝e湪缂栬緫鏃讹紝绂佹瑙﹀彂rowClick浜嬩欢
- if (this.edit.rowIndex == -1) {
- this.$emit("rowClick", { row, column, event });
- }
- }
- this.rowBeginEdit(row, column);
-},
+ // ===== 浼樺寲锛氱偣鍑昏閫変腑/鍒囨崲澶嶉�夋 缁撴潫 =====
+
+ // 姝e湪缂栬緫鏃讹紝绂佹瑙﹀彂rowClick浜嬩欢
+ if (this.edit.rowIndex == -1) {
+ this.$emit("rowClick", { row, column, event });
+ }
+ // 鐐瑰嚮琛屼簨浠�(2020.11.07)
+ if (!this.doubleEdit) {
+ return;
+ }
+ // 鐐瑰嚮鍏朵粬琛屾椂锛屽鏋滅偣鍑荤殑琛屼笌姝e湪缂栬緫鐨勮鐩稿悓锛屼繚鎸佺紪杈戠姸鎬�
+ if (this.clickEdit && this.edit.rowIndex != -1) {
+ if (row.elementIndex == this.edit.rowIndex) {
+ // 鐐瑰嚮鐨勫崟鍏冩牸濡傛灉涓嶅彲浠ョ紪杈戯紝鐩存帴缁撴潫缂栬緫
+ // 2020.10.12淇缁撴潫缂栬緫鏃讹紝element table楂樼増鏈睘鎬ц幏鍙栦笉鍒扮殑闂
+ let _col = this.columns.find((x) => {
+ return x.field == ((event && event.property) || column.property);
+ });
+ if (_col && (!_col.edit || _col.readonly)) {
+ if (this.rowEndEdit(row, event)) {
+ this.edit.rowIndex = -1;
+ }
+ }
+ return;
+ }
+ if (this.rowEndEdit(row, event && event.property ? event : column)) {
+ this.edit.rowIndex = -1;
+ }
+ //褰撴鍦ㄧ紪杈戯紝涓旂偣鍑诲埌鍏朵粬琛屾椂锛屽湪鍘熺紪杈戠殑琛岀粨鏉熺紪杈戝悗锛岃Е鍙戞柊琛岀殑rowClick浜嬩欢
+ //姝e湪缂栬緫鏃讹紝绂佹瑙﹀彂rowClick浜嬩欢
+ if (this.edit.rowIndex == -1) {
+ this.$emit("rowClick", { row, column, event });
+ }
+ }
+ this.rowBeginEdit(row, column);
+ },
// //姝e湪缂栬緫鏃讹紝绂佹鍑哄彂rowClick浜嬩欢
// if (this.edit.rowIndex == -1) {
@@ -1028,9 +982,7 @@
if (column.base64) {
fileInfo.push({
name: "",
- path:
- (file.indexOf("data") == -1 ? "data:image/png;base64," : "") +
- file,
+ path: (file.indexOf("data") == -1 ? "data:image/png;base64," : "") + file,
});
} else if (file.indexOf(".") != -1) {
let splitFile = file.split("/");
@@ -1200,9 +1152,7 @@
this.edit.rowIndex = -1;
return;
}
- let row = (this.url ? this.rowData : this.tableData)[
- this.edit.rowIndex
- ];
+ let row = (this.url ? this.rowData : this.tableData)[this.edit.rowIndex];
for (let index = 0; index < this.columns.length; index++) {
const _column = this.columns[index];
if (_column.edit) {
@@ -1300,9 +1250,7 @@
let data = this.url ? this.rowData : this.tableData;
let indexArr = this.getSelectedIndex();
if (indexArr.length == 0) {
- return this.$Message.error(
- "鍒犻櫎鎿嶄綔蹇呴』璁剧疆VolTable鐨勫睘鎬ndex='true'"
- );
+ return this.$Message.error("鍒犻櫎鎿嶄綔蹇呴』璁剧疆VolTable鐨勫睘鎬ndex='true'");
}
// if (indexArr.length == 0 || !this.key) {
// return this.$message.error(
@@ -1393,19 +1341,17 @@
}
if (remoteInfo.length == 0) return;
// ha= Object.assign([], ha, hb)
- this.http
- .post("/api/Sys_Dictionary/GetTableDictionary", remoteInfo)
- .then((dic) => {
- dic.forEach((x) => {
- this.remoteColumns.forEach((column) => {
- if (column.bind.key == x.key) {
- column.bind.data = Object.assign([], column.bind.data, x.data);
- // column.bind.data.push(...x.data);
- }
- });
+ this.http.post("/api/Sys_Dictionary/GetTableDictionary", remoteInfo).then((dic) => {
+ dic.forEach((x) => {
+ this.remoteColumns.forEach((column) => {
+ if (column.bind.key == x.key) {
+ column.bind.data = Object.assign([], column.bind.data, x.data);
+ // column.bind.data.push(...x.data);
+ }
});
- this.$emit("dicInited", dic);
});
+ this.$emit("dicInited", dic);
+ });
},
load(query, isResetPage) {
// isResetPage閲嶇疆鍒嗛〉鏁版嵁
@@ -1504,9 +1450,7 @@
if (data.summary.hasOwnProperty(col.field)) {
let sum = data.summary[col.field];
if (sum) {
- sum =
- (sum * 1.0).toFixed(col.numberLength || 2).replace(".00", "") *
- 1.0;
+ sum = (sum * 1.0).toFixed(col.numberLength || 2).replace(".00", "") * 1.0;
}
this.summaryData.push(sum);
} else {
@@ -1633,11 +1577,7 @@
: column.bind.data
).forEach((x) => {
// 2020.06.06淇鏁版嵁婧愪负selectList鏃�,key涓烘暟瀛�0鏃朵笉鑳借浆鎹㈡枃鏈殑闂
- if (
- x.key !== "" &&
- x.key !== undefined &&
- x.key + "" == valArr[index] + ""
- ) {
+ if (x.key !== "" && x.key !== undefined && x.key + "" == valArr[index] + "") {
valArr[index] = x.label || x.value;
}
});
@@ -1669,9 +1609,7 @@
if (column.summary == "avg") {
sum = sum / (this.rowData.length || this.tableData.length || 1);
}
- sum =
- (sum * 1.0).toFixed(column.numberLength || 2).replace(".00", "") *
- 1.0;
+ sum = (sum * 1.0).toFixed(column.numberLength || 2).replace(".00", "") * 1.0;
}
this.summaryData[this.summaryIndex[column.field]] = sum;
},
@@ -1696,8 +1634,7 @@
return true;
}
return (
- date1.valueOf() <
- (typeof date2 == "number" ? date2 : new Date(date2).valueOf())
+ date1.valueOf() < (typeof date2 == "number" ? date2 : new Date(date2).valueOf())
);
},
getDateOptions(date, item) {
@@ -1709,9 +1646,7 @@
//涓嶈缃椂鍒嗙锛屽悗闈細鑷姩鍔犱笂 08:00
item.min = item.min + " 00:00:000";
}
- return (
- this.compareDate(date, item.min) || !this.compareDate(date, item.max)
- );
+ return this.compareDate(date, item.min) || !this.compareDate(date, item.max);
},
getDateFormat(column) {
//瑙乭ttps://day.js.org/docs/zh-CN/display/format
@@ -1761,17 +1696,14 @@
if (this.currentColumn.edit.url === undefined) {
this.uploadUrl =
- "api/" +
- (this.url || "").replace("/api", "api").split("/")[1] +
- "/upload";
+ "api/" + (this.url || "").replace("/api", "api").split("/")[1] + "/upload";
} else {
this.uploadUrl = this.currentColumn.edit.url;
}
this.uploadModel = true;
},
uploadAfter(result, files) {
- this.currentColumn.uploadAfter &&
- this.currentColumn.uploadAfter(result, files);
+ this.currentColumn.uploadAfter && this.currentColumn.uploadAfter(result, files);
return true;
},
saveUpload() {
--
Gitblit v1.9.3