From 9adcc3c8e0103e63034b7d085e3d6163b9ea6894 Mon Sep 17 00:00:00 2001
From: "LAPTOP-AKBAACR8\\An.Hr" <297504645@qq.com>
Date: Wed, 22 Mar 2023 13:58:34 +0800
Subject: [PATCH] =?UTF-8?q?=E5=AD=97=E6=AE=B5=E8=AE=BE=E7=BD=AE=E5=85=A8?=
=?UTF-8?q?=E9=80=89?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
fe/PC/src/components/rowDrop/index.vue | 213 ++++++++++++-------------
1 file changed, 106 insertions(+), 107 deletions(-)
diff --git a/fe/PC/src/components/rowDrop/index.vue b/fe/PC/src/components/rowDrop/index.vue
index 192873664..f9d9d9fcf 100644
--- a/fe/PC/src/components/rowDrop/index.vue
+++ b/fe/PC/src/components/rowDrop/index.vue
@@ -8,6 +8,13 @@
字段设置
+
+
+
+
+
+ 全选
+
-
-
{{ item.label }}
@@ -53,13 +54,12 @@ export default {
},
data() {
return {
- visibleclose:true,
- visibleon:false,
name: null,
oldData: null,
newData: null,
- // checked: false,
dataList: [],
+ // 全选 allSelect hasSelect NoSelect
+ allSeletType:'NoSelect',
}
},
props: {
@@ -78,114 +78,102 @@ export default {
},
mounted() {
this.formatData(this.tableColumns)
+ this.initSelectSta()
},
methods: {
reset() {
this.$confirm('重置后,字段设置将恢复初始设置,是否继续?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- cancelButtonClass:'rowDropNotHideItem'
- }).then(() => {
- localStorage.removeItem(this.$store.getters.name.userName + '_' + this.$route.name)
- let _resetCol = this.$isTableColumns[this.$route.name]
- _resetCol.forEach(item => {
- item.isture = true
- })
- this.dataList = _resetCol
- this.$emit('radio',_resetCol)
- this.close()
- }).catch(() => {
+ confirmButtonText: '确定',
+ cancelButtonText: '取消',
+ type: 'warning',
+ cancelButtonClass:'rowDropNotHideItem'
+ }).then(() => {
+ localStorage.removeItem(this.$store.getters.name.userName + '_' + this.$route.name)
+ let _resetCol = this.$isTableColumns[this.$route.name]
+ _resetCol.forEach(item => {
+ item.isture = true
+ })
+ this.dataList = _resetCol
+ this.initSelectSta()
+ this.$emit('radio',_resetCol)
+ this.close()
+ }).catch(() => {
- });
+ });
},
close() {
- this.$emit('closeRowDrop')
+ this.$emit('closeRowDrop')
},
- // save () {
- // this.$emit('closeRowDrop')
- // this.$emit('radio',this.dataList)
- // // 本地缓存 当前用户名 + 路由名称
- // localStorage.setItem(this.$store.getters.name.userName + '_' + this.$route.name, JSON.stringify(this.dataList))
- // },
- // 格式化表头数据
- formatData (val) {
- this.dataList = JSON.parse(JSON.stringify(val))
- this.dataList.forEach(item => {
- if (item.isture == undefined) {
- item.isture = true
- }
- })
- },
- // 拖拽事件
- handleEdit(index, row) {
- console.log(index, row);
- },
- save () {
- this.$forceUpdate()
- this.$emit('radio',this.dataList)
- // 本地缓存 当前用户名 + 路由名称
- localStorage.setItem(this.$store.getters.name.userName + '_' + this.$route.name, JSON.stringify(this.dataList))
- },
- // 格式化表头数据
- formatData (val) {
- this.dataList = JSON.parse(JSON.stringify(val))
- this.dataList.forEach(item => {
- if (item.isture == undefined) {
- item.isture = true
- }
- })
- },
- // 拖拽事件
- handleEdit(index, row) {
- console.log(index, row);
- },
- handleDelete(index, row) {
- console.log(index, row);
- },
- dragstart(value) {
- this.oldData = value
- },
- // 记录移动过程中信息
- dragenter(value, e) {
- this.newData = value
- e.preventDefault()
- },
- // 拖拽最终操作
- dragend(value, e) {
- if (this.oldData !== this.newData) {
- let oldIndex = this.dataList.indexOf(this.oldData)
- let newIndex = this.dataList.indexOf(this.newData)
- let newItems = [...this.dataList]
- // 删除老的节点
- newItems.splice(oldIndex, 1)
- // 在列表中目标位置增加新的节点
- newItems.splice(newIndex, 0, this.oldData)
- this.dataList = [...newItems]
- this.save()
- }
- },
- // 拖动事件(主要是为了拖动时鼠标光标不变为禁止)
- dragover(e) {
- e.preventDefault()
- },
- // 拖拽事件结束
- // 点击展开拖拽框
- visclose(){
- this.visibleclose = false
- this.visibleon = true
- },
- // 点击关闭拖拽框
- vison(){
- this.visibleclose = true
- this.visibleon = false
- },
- rediochange(index){
- this.dataList[index].isture = !this.dataList[index].isture
- this.save()
+ // 格式化表头数据
+ formatData (val) {
+ this.dataList = JSON.parse(JSON.stringify(val))
+ this.dataList.forEach(item => {
+ if (item.isture == undefined) {
+ item.isture = true
+ }
+ })
+ },
+ save () {
+ this.$forceUpdate()
+ this.$emit('radio',this.dataList)
+ // 本地缓存 当前用户名 + 路由名称
+ localStorage.setItem(this.$store.getters.name.userName + '_' + this.$route.name, JSON.stringify(this.dataList))
+ },
+ dragstart(value) {
+ this.oldData = value
+ },
+ // 记录移动过程中信息
+ dragenter(value, e) {
+ this.newData = value
+ e.preventDefault()
+ },
+ // 拖拽最终操作
+ dragend(value, e) {
+ if (this.oldData !== this.newData) {
+ let oldIndex = this.dataList.indexOf(this.oldData)
+ let newIndex = this.dataList.indexOf(this.newData)
+ let newItems = [...this.dataList]
+ // 删除老的节点
+ newItems.splice(oldIndex, 1)
+ // 在列表中目标位置增加新的节点
+ newItems.splice(newIndex, 0, this.oldData)
+ this.dataList = [...newItems]
+ this.save()
}
- }
+ },
+ // 拖动事件(主要是为了拖动时鼠标光标不变为禁止)
+ dragover(e) {
+ e.preventDefault()
+ },
+ // item元素点击眼睛事件
+ rediochange(index){
+ this.dataList[index].isture = !this.dataList[index].isture
+ this.initSelectSta()
+ this.save()
+ },
+ // 初始化当前全选状态
+ initSelectSta(){
+ let _num = 0
+ this.dataList.forEach(item=>{
+ if(item.isture){
+ _num ++
+ }
+ })
+ if(_num == 0){this.allSeletType = 'NoSelect'}
+ if(_num == this.dataList.length){this.allSeletType = 'allSelect'}
+ if(_num > 0 && _num != this.dataList.length){this.allSeletType = 'hasSelect'}
+ },
+ // 全选点击事件
+ redioAllChange(){
+ let isSelectAll = !(this.allSeletType == 'allSelect')
+ this.allSeletType = isSelectAll ? 'allSelect' : 'NoSelect';
+ this.dataList.forEach(item=>{
+ return item.isture = isSelectAll
+ })
+ this.save()
+ },
}
+}