From 8c256aafcb5658dc83b342608dd538412b757397 Mon Sep 17 00:00:00 2001
From: zouzhibing
Date: Wed, 18 May 2022 18:07:29 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=A1=A8=E6=A0=BC?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
router/modules/table.js | 7 +-
utils/index.js | 36 +++-
views/table/components/edit.vue | 307 ++++++++++++++++----------------
views/table/edit.vue | 80 +++++----
4 files changed, 237 insertions(+), 193 deletions(-)
diff --git a/router/modules/table.js b/router/modules/table.js
index 5603ee7..d554902 100644
--- a/router/modules/table.js
+++ b/router/modules/table.js
@@ -25,7 +25,12 @@ const tableRouter = {
name: 'inline-table',
meta: { title: '行内编辑', noCache: true }
},
-
+ {
+ path: 'edit-table',
+ component: () => import('@/views/table/edit.vue'),
+ name: 'edit-table',
+ meta: { title: '可编辑表格', noCache: true }
+ },
]
}
diff --git a/utils/index.js b/utils/index.js
index 7f11201..387a385 100644
--- a/utils/index.js
+++ b/utils/index.js
@@ -5,12 +5,12 @@ import { parseTime } from './uniele'
*/
export function formatDate(cellValue) {
if (cellValue == null || cellValue == "") return "";
- var date = new Date(cellValue)
+ var date = new Date(cellValue)
var year = date.getFullYear()
var month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1
- var day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
- var hours = date.getHours() < 10 ? '0' + date.getHours() : date.getHours()
- var minutes = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()
+ var day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
+ var hours = date.getHours() < 10 ? '0' + date.getHours() : date.getHours()
+ var minutes = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()
var seconds = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds()
return year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds
}
@@ -330,7 +330,7 @@ export function makeMap(str, expectsLowerCase) {
? val => map[val.toLowerCase()]
: val => map[val]
}
-
+
export const exportDefault = 'export default '
export const beautifierConf = {
@@ -387,4 +387,28 @@ export function camelCase(str) {
export function isNumberStr(str) {
return /^[+-]?(0|([1-9]\d*))(\.\d+)?$/g.test(str)
}
-
+
+// // 深度克隆 array 数组或 json 对象,返回克隆后的副本
+export const deepObjClone = function(obj){
+ let weakMap = new WeakMap()
+ function clone (obj){
+ if(obj==null){return obj}
+ if(obj instanceof Date){ return new Date(obj) }
+ if(obj instanceof RegExp){ return new RegExp(obj)}
+ if(typeof obj !== 'object') return obj
+
+ if(weakMap.get(obj)){
+ return weakMap.get(obj)
+ }
+ var copy = new obj.constructor
+ weakMap.set(obj,copy)
+ for(var key in obj){
+ if(Object.prototype.hasOwnProperty.call(obj, key)){
+ var value = obj[key];
+ copy[key] = clone(value);
+ }
+ }
+ return copy;
+ }
+ return clone (obj)
+};
diff --git a/views/table/components/edit.vue b/views/table/components/edit.vue
index 3b853dc..a40abe0 100644
--- a/views/table/components/edit.vue
+++ b/views/table/components/edit.vue
@@ -5,7 +5,7 @@
添加一行数据
-
+
编辑
+ placement="top"
+ width="160"
+ v-model="scope.row.visible">
- 删除此行?
+
+ 删除此行?
- 取消
- 确定
-
- 删除
-
+ 删除
取消
@@ -109,160 +107,167 @@
-