Browse Source

四个页面

preview
tianq 3 years ago
parent
commit
005bf8112c
  1. 266
      epmet-oper-web/src/views/modules/customer/customize/menuCustomer.vue
  2. 4
      epmet-oper-web/src/views/modules/customer/customize/menuDataCustomer.vue
  3. 250
      epmet-oper-web/src/views/modules/workPc/dataMenu.vue
  4. 249
      epmet-oper-web/src/views/modules/workPc/menu.vue

266
epmet-oper-web/src/views/modules/customer/customize/menuCustomer.vue

@ -17,7 +17,18 @@
<el-button type="primary" @click="open('')">开启</el-button> <el-button type="primary" @click="open('')">开启</el-button>
<el-button type="primary" @click="close('')">关闭</el-button> <el-button type="primary" @click="close('')">关闭</el-button>
</div> </div>
<el-table v-loading="dataListLoading" :data="dataList" row-key="id" border style="width: 100%;" ref="form" @selection-change="handleSelectionChange"> <el-table
v-loading="dataListLoading"
:data="dataList"
row-key="id"
:row-class-name="rowClassNameFun"
@select="selectFun"
@select-all="selectAllFun"
:header-row-class-name="headerRowClassName"
border
style="width: 100%;"
ref="form"
>
<el-table-column type="selection" fixed="left" align="center" width="50" /> <el-table-column type="selection" fixed="left" align="center" width="50" />
<el-table-column label="序号" fixed="left" type="index" align="center" width="50" /> <el-table-column label="序号" fixed="left" type="index" align="center" width="50" />
@ -86,6 +97,175 @@ export default {
}, },
methods: { methods: {
initData(customerId, customerName) {
this.customerId = customerId;
this.customerName = customerName;
// if (this.mixinViewModuleOptions.createdIsNeed) {
// console.log(this.customerId+"22222");
this.query();
console.log(this.dataList);
this.initData2(this.dataList);
},
initData2(data) {
data.forEach(item => {
item.isSelect = false; //
if (item.children && item.children.length) {
this.initData2(item.children);
}
});
},
getData(data) {
console.log("getData",data)
data.forEach(item => {
console.log(item.name,item.isSelect)
if (item.isSelect) {
this.multipleSelection.push(item.id);
}
if (item.children) {
this.getData(item.children);
}
});
},
selectFun(selection, row) {
this.setRowIsSelect(row);
},
checkIsAllSelect() {
this.oneProductIsSelect = [];
this.dataList.forEach(item => {
this.oneProductIsSelect.push(item.isSelect);
});
//.true
let isAllSelect = this.oneProductIsSelect.every(selectStatusItem => {
return true == selectStatusItem;
});
return isAllSelect;
},
selectAllFun(selection) {
let isAllSelect = this.checkIsAllSelect();
this.dataList.forEach(item => {
item.isSelect = isAllSelect;
this.$refs.form.toggleRowSelection(item, !isAllSelect);
this.selectFun(selection, item);
});
},
rowClassNameFun({ row }) {
if (row.isSelect === '') {
return 'indeterminate';
}
},
headerRowClassName({ row }) {
let oneProductIsSelect = [];
this.dataList.forEach(item => {
oneProductIsSelect.push(item.isSelect);
});
if (oneProductIsSelect.includes('')) {
return 'indeterminate';
}
return '';
},
setRowIsSelect(row) {
//false
if (row.isSelect === '') {
row.isSelect = false;
this.$refs.form.toggleRowSelection(row, true);
}
row.isSelect = !row.isSelect;
let that = this;
function selectAllChildrens(data) {
data.forEach(item => {
item.isSelect = row.isSelect;
that.$refs.form.toggleRowSelection(item, row.isSelect);
if (item.children && item.children.length) {
selectAllChildrens(item.children);
}
});
}
function getSelectStatus(selectStatuaArr, data) {
data.forEach(childrenItem => {
selectStatuaArr.push(childrenItem.isSelect);
if (childrenItem.children && childrenItem.children.length) {
getSelectStatus(selectStatuaArr, childrenItem.children);
}
});
return selectStatuaArr;
}
function getLevelStatus(row) {
//parantId =0 1
//parantId !=0 3
if (row.pid == '0') {
if (row.children && row.children.length) {
return 1;
} else {
return 4;
}
} else {
if (!row.children || !row.children.length) {
return 3;
} else {
return 2;
}
}
}
let result = {};
//
function getExplicitNode(data, parentId) {
data.forEach(item => {
if (item.id == parentId) {
result = item;
}
if (item.children && item.children.length) {
getExplicitNode(item.children, parentId);
}
});
return result;
}
function operateLastLeve(row) {
// 1 2
let selectStatuaArr = [];
let item = getExplicitNode(that.dataList, row.pid);
selectStatuaArr = getSelectStatus(selectStatuaArr, item.children);
if (
selectStatuaArr.every(selectItem => {
return true == selectItem;
})
) {
item.isSelect = true;
that.$refs.form.toggleRowSelection(item, true);
} else if (
selectStatuaArr.every(selectItem => {
return false == selectItem;
})
) {
item.isSelect = false;
that.$refs.form.toggleRowSelection(item, false);
} else {
item.isSelect = '';
}
//
if (item.pid != '0') {
operateLastLeve(item);
}
}
//
//1 2 3
let levelSataus = getLevelStatus(row);
if (levelSataus == 1) {
selectAllChildrens(row.children);
} else if (levelSataus == 2) {
selectAllChildrens(row.children);
operateLastLeve(row);
} else if (levelSataus == 3) {
operateLastLeve(row);
}
},
search() { search() {
if (this.menuName != '') { if (this.menuName != '') {
let saveList = []; let saveList = [];
@ -119,6 +299,9 @@ export default {
open(id) { open(id) {
let menuIds = []; let menuIds = [];
this.multipleSelection = [];
this.getData(this.dataList);
if (id != '') { if (id != '') {
menuIds = [id]; menuIds = [id];
} else { } else {
@ -143,7 +326,9 @@ export default {
}, },
close(id) { close(id) {
let menuIds = []; let menuIds = [];
this.multipleSelection = [];
this.getData(this.dataList);
if (id != '') { if (id != '') {
menuIds = [id]; menuIds = [id];
} else { } else {
@ -199,25 +384,25 @@ export default {
}); });
}, },
initData(customerId, customerName) { // initData(customerId, customerName) {
if (customerId != '') { // if (customerId != '') {
this.customerId = customerId; // this.customerId = customerId;
this.customerName = customerName; // this.customerName = customerName;
// if (this.mixinViewModuleOptions.createdIsNeed) { // // if (this.mixinViewModuleOptions.createdIsNeed) {
// console.log(this.customerId+"22222"); // // console.log(this.customerId+"22222");
this.query(); // this.query();
// } // // }
} // }
}, // },
handleSelectionChange(val) { // handleSelectionChange(val) {
this.multipleSelection = []; // this.multipleSelection = [];
val.forEach(element => { // val.forEach(element => {
this.multipleSelection.push(element.id); // this.multipleSelection.push(element.id);
}); // });
console.log(this.multipleSelection); // console.log(this.multipleSelection);
}, // },
// //
diaCancel() { diaCancel() {
this.$emit('cancleBack'); this.$emit('cancleBack');
@ -235,4 +420,47 @@ export default {
line-height: 50px; line-height: 50px;
margin-bottom: 20px; margin-bottom: 20px;
} }
.indeterminate .el-checkbox__input .el-checkbox__inner {
background-color: #17B3A3 !important;
border-color: #17B3A3 !important;
color: #fff !important;
}
.indeterminate .el-checkbox__input.is-checked .el-checkbox__inner::after {
transform: scale(0.5);
}
.indeterminate .el-checkbox__input .el-checkbox__inner {
background-color: #f2f6fc;
border-color: #dcdfe6;
}
.indeterminate .el-checkbox__input .el-checkbox__inner::after {
border-color: #c0c4cc !important;
background-color: #c0c4cc;
}
.form-show th .el-checkbox__inner {
display: none !important;
}
.indeterminate .el-checkbox__input .el-checkbox__inner::after {
content: '';
position: absolute;
display: block;
background-color: #fff;
height: 2px;
transform: scale(0.5);
left: 0;
right: 0;
top: 5px;
width: auto !important;
}
.form-show .el-checkbox__inner {
display: block !important;
}
.form-show .el-checkbox {
display: block !important;
}
</style> </style>

4
epmet-oper-web/src/views/modules/customer/customize/menuDataCustomer.vue

@ -430,8 +430,8 @@ export default {
} }
.indeterminate .el-checkbox__input .el-checkbox__inner { .indeterminate .el-checkbox__input .el-checkbox__inner {
background-color: #409eff !important; background-color: #17B3A3 !important;
border-color: #409eff !important; border-color: #17B3A3 !important;
color: #fff !important; color: #fff !important;
} }

250
epmet-oper-web/src/views/modules/workPc/dataMenu.vue

@ -13,14 +13,16 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-table <el-table
@selection-change="handleSelectionChange"
v-loading="dataListLoading" v-loading="dataListLoading"
ref="form"
:data="dataList" :data="dataList"
row-key="id" row-key="id"
:row-class-name="rowClassNameFun"
@select="selectFun"
@select-all="selectAllFun"
:header-row-class-name="headerRowClassName"
border border
:height="tableHeight"
style="width: 100%;" style="width: 100%;"
ref="form"
> >
<el-table-column label="" fixed="left" type="selection" align="center" width="50" /> <el-table-column label="" fixed="left" type="selection" align="center" width="50" />
<el-table-column label="序号" fixed="left" type="index" align="center" width="50" /> <el-table-column label="序号" fixed="left" type="index" align="center" width="50" />
@ -92,7 +94,10 @@ export default {
}, },
customerFormVisible: false, customerFormVisible: false,
dataForm: { tableName: 'data_menu' }, dataForm: { tableName: 'data_menu' },
selMenuName: '' selMenuName: '',
selection: [],
selAllFlag: false,
}; };
}, },
components: { components: {
@ -107,6 +112,175 @@ export default {
...mapGetters(['clientHeight', 'resolution']) ...mapGetters(['clientHeight', 'resolution'])
}, },
methods: { methods: {
initData(customerId, customerName) {
this.customerId = customerId;
this.customerName = customerName;
// if (this.mixinViewModuleOptions.createdIsNeed) {
// console.log(this.customerId+"22222");
this.query();
console.log(this.dataList);
this.initData2(this.dataList);
},
initData2(data) {
data.forEach(item => {
item.isSelect = false; //
if (item.children && item.children.length) {
this.initData2(item.children);
}
});
},
getData(data) {
console.log("getData",data)
data.forEach(item => {
console.log(item.name,item.isSelect)
if (item.isSelect) {
this.multipleSelection.push(item.id);
}
if (item.children) {
this.getData(item.children);
}
});
},
selectFun(selection, row) {
this.setRowIsSelect(row);
},
checkIsAllSelect() {
this.oneProductIsSelect = [];
this.dataList.forEach(item => {
this.oneProductIsSelect.push(item.isSelect);
});
//.true
let isAllSelect = this.oneProductIsSelect.every(selectStatusItem => {
return true == selectStatusItem;
});
return isAllSelect;
},
selectAllFun(selection) {
let isAllSelect = this.checkIsAllSelect();
this.dataList.forEach(item => {
item.isSelect = isAllSelect;
this.$refs.form.toggleRowSelection(item, !isAllSelect);
this.selectFun(selection, item);
});
},
rowClassNameFun({ row }) {
if (row.isSelect === '') {
return 'indeterminate';
}
},
headerRowClassName({ row }) {
let oneProductIsSelect = [];
this.dataList.forEach(item => {
oneProductIsSelect.push(item.isSelect);
});
if (oneProductIsSelect.includes('')) {
return 'indeterminate';
}
return '';
},
setRowIsSelect(row) {
//false
if (row.isSelect === '') {
row.isSelect = false;
this.$refs.form.toggleRowSelection(row, true);
}
row.isSelect = !row.isSelect;
let that = this;
function selectAllChildrens(data) {
data.forEach(item => {
item.isSelect = row.isSelect;
that.$refs.form.toggleRowSelection(item, row.isSelect);
if (item.children && item.children.length) {
selectAllChildrens(item.children);
}
});
}
function getSelectStatus(selectStatuaArr, data) {
data.forEach(childrenItem => {
selectStatuaArr.push(childrenItem.isSelect);
if (childrenItem.children && childrenItem.children.length) {
getSelectStatus(selectStatuaArr, childrenItem.children);
}
});
return selectStatuaArr;
}
function getLevelStatus(row) {
//parantId =0 1
//parantId !=0 3
if (row.pid == '0') {
if (row.children && row.children.length) {
return 1;
} else {
return 4;
}
} else {
if (!row.children || !row.children.length) {
return 3;
} else {
return 2;
}
}
}
let result = {};
//
function getExplicitNode(data, parentId) {
data.forEach(item => {
if (item.id == parentId) {
result = item;
}
if (item.children && item.children.length) {
getExplicitNode(item.children, parentId);
}
});
return result;
}
function operateLastLeve(row) {
// 1 2
let selectStatuaArr = [];
let item = getExplicitNode(that.dataList, row.pid);
selectStatuaArr = getSelectStatus(selectStatuaArr, item.children);
if (
selectStatuaArr.every(selectItem => {
return true == selectItem;
})
) {
item.isSelect = true;
that.$refs.form.toggleRowSelection(item, true);
} else if (
selectStatuaArr.every(selectItem => {
return false == selectItem;
})
) {
item.isSelect = false;
that.$refs.form.toggleRowSelection(item, false);
} else {
item.isSelect = '';
}
//
if (item.pid != '0') {
operateLastLeve(item);
}
}
//
//1 2 3
let levelSataus = getLevelStatus(row);
if (levelSataus == 1) {
selectAllChildrens(row.children);
} else if (levelSataus == 2) {
selectAllChildrens(row.children);
operateLastLeve(row);
} else if (levelSataus == 3) {
operateLastLeve(row);
}
},
search() { search() {
if (this.menuName != '') { if (this.menuName != '') {
let saveList = []; let saveList = [];
@ -146,20 +320,22 @@ export default {
// }); // });
// } // }
// }, // },
handleSelectionChange(val) { // handleSelectionChange(val) {
this.multipleSelection = []; // this.multipleSelection = [];
val.forEach(element => { // val.forEach(element => {
this.multipleSelection.push(element.id); // this.multipleSelection.push(element.id);
}); // });
console.log(this.multipleSelection); // console.log(this.multipleSelection);
}, // },
showCustomerMenu(row) { showCustomerMenu(row) {
this.selMenuName = row.name; this.selMenuName = row.name;
this.$refs['customerForm'].init(row.id); this.$refs['customerForm'].init(row.id);
}, },
open(id) { open(id) {
console.log('Aa');
let menuIds = []; let menuIds = [];
this.multipleSelection = [];
this.getData(this.dataList);
if (id != '') { if (id != '') {
menuIds = [id]; menuIds = [id];
} else { } else {
@ -183,7 +359,9 @@ export default {
}, },
close(id) { close(id) {
let menuIds = []; let menuIds = [];
this.multipleSelection = [];
this.getData(this.dataList);
if (id != '') { if (id != '') {
menuIds = [id]; menuIds = [id];
} else { } else {
@ -208,9 +386,55 @@ export default {
}; };
</script> </script>
<style> <style>
.div_btn {
margin: 0 0 20px 0;
}
.little-head { .little-head {
border-bottom: dashed 1px #ccc; border-bottom: dashed 1px #ccc;
line-height: 50px; line-height: 50px;
margin-bottom: 20px; margin-bottom: 20px;
} }
.indeterminate .el-checkbox__input .el-checkbox__inner {
background-color: #17B3A3 !important;
border-color: #17B3A3 !important;
color: #fff !important;
}
.indeterminate .el-checkbox__input.is-checked .el-checkbox__inner::after {
transform: scale(0.5);
}
.indeterminate .el-checkbox__input .el-checkbox__inner {
background-color: #f2f6fc;
border-color: #dcdfe6;
}
.indeterminate .el-checkbox__input .el-checkbox__inner::after {
border-color: #c0c4cc !important;
background-color: #c0c4cc;
}
.form-show th .el-checkbox__inner {
display: none !important;
}
.indeterminate .el-checkbox__input .el-checkbox__inner::after {
content: '';
position: absolute;
display: block;
background-color: #fff;
height: 2px;
transform: scale(0.5);
left: 0;
right: 0;
top: 5px;
width: auto !important;
}
.form-show .el-checkbox__inner {
display: block !important;
}
.form-show .el-checkbox {
display: block !important;
}
</style> </style>

249
epmet-oper-web/src/views/modules/workPc/menu.vue

@ -14,13 +14,15 @@
</el-form> </el-form>
<el-table <el-table
v-loading="dataListLoading" v-loading="dataListLoading"
ref="form"
@selection-change="handleSelectionChange"
:data="dataList" :data="dataList"
row-key="id" row-key="id"
:row-class-name="rowClassNameFun"
@select="selectFun"
@select-all="selectAllFun"
:header-row-class-name="headerRowClassName"
border border
:height="tableHeight"
style="width: 100%;" style="width: 100%;"
ref="form"
> >
<el-table-column label="" fixed="left" type="selection" align="center" width="50" /> <el-table-column label="" fixed="left" type="selection" align="center" width="50" />
<el-table-column label="序号" fixed="left" type="index" align="center" width="50" /> <el-table-column label="序号" fixed="left" type="index" align="center" width="50" />
@ -86,7 +88,10 @@ export default {
}, },
customerFormVisible: false, customerFormVisible: false,
dataForm: { tableName: 'gov_menu' }, dataForm: { tableName: 'gov_menu' },
selMenuName: '' selMenuName: '',
selection: [],
selAllFlag: false,
}; };
}, },
components: { components: {
@ -103,6 +108,175 @@ export default {
}, },
methods: { methods: {
initData(customerId, customerName) {
this.customerId = customerId;
this.customerName = customerName;
// if (this.mixinViewModuleOptions.createdIsNeed) {
// console.log(this.customerId+"22222");
this.query();
console.log(this.dataList);
this.initData2(this.dataList);
},
initData2(data) {
data.forEach(item => {
item.isSelect = false; //
if (item.children && item.children.length) {
this.initData2(item.children);
}
});
},
getData(data) {
console.log("getData",data)
data.forEach(item => {
console.log(item.name,item.isSelect)
if (item.isSelect) {
this.multipleSelection.push(item.id);
}
if (item.children) {
this.getData(item.children);
}
});
},
selectFun(selection, row) {
this.setRowIsSelect(row);
},
checkIsAllSelect() {
this.oneProductIsSelect = [];
this.dataList.forEach(item => {
this.oneProductIsSelect.push(item.isSelect);
});
//.true
let isAllSelect = this.oneProductIsSelect.every(selectStatusItem => {
return true == selectStatusItem;
});
return isAllSelect;
},
selectAllFun(selection) {
let isAllSelect = this.checkIsAllSelect();
this.dataList.forEach(item => {
item.isSelect = isAllSelect;
this.$refs.form.toggleRowSelection(item, !isAllSelect);
this.selectFun(selection, item);
});
},
rowClassNameFun({ row }) {
if (row.isSelect === '') {
return 'indeterminate';
}
},
headerRowClassName({ row }) {
let oneProductIsSelect = [];
this.dataList.forEach(item => {
oneProductIsSelect.push(item.isSelect);
});
if (oneProductIsSelect.includes('')) {
return 'indeterminate';
}
return '';
},
setRowIsSelect(row) {
//false
if (row.isSelect === '') {
row.isSelect = false;
this.$refs.form.toggleRowSelection(row, true);
}
row.isSelect = !row.isSelect;
let that = this;
function selectAllChildrens(data) {
data.forEach(item => {
item.isSelect = row.isSelect;
that.$refs.form.toggleRowSelection(item, row.isSelect);
if (item.children && item.children.length) {
selectAllChildrens(item.children);
}
});
}
function getSelectStatus(selectStatuaArr, data) {
data.forEach(childrenItem => {
selectStatuaArr.push(childrenItem.isSelect);
if (childrenItem.children && childrenItem.children.length) {
getSelectStatus(selectStatuaArr, childrenItem.children);
}
});
return selectStatuaArr;
}
function getLevelStatus(row) {
//parantId =0 1
//parantId !=0 3
if (row.pid == '0') {
if (row.children && row.children.length) {
return 1;
} else {
return 4;
}
} else {
if (!row.children || !row.children.length) {
return 3;
} else {
return 2;
}
}
}
let result = {};
//
function getExplicitNode(data, parentId) {
data.forEach(item => {
if (item.id == parentId) {
result = item;
}
if (item.children && item.children.length) {
getExplicitNode(item.children, parentId);
}
});
return result;
}
function operateLastLeve(row) {
// 1 2
let selectStatuaArr = [];
let item = getExplicitNode(that.dataList, row.pid);
selectStatuaArr = getSelectStatus(selectStatuaArr, item.children);
if (
selectStatuaArr.every(selectItem => {
return true == selectItem;
})
) {
item.isSelect = true;
that.$refs.form.toggleRowSelection(item, true);
} else if (
selectStatuaArr.every(selectItem => {
return false == selectItem;
})
) {
item.isSelect = false;
that.$refs.form.toggleRowSelection(item, false);
} else {
item.isSelect = '';
}
//
if (item.pid != '0') {
operateLastLeve(item);
}
}
//
//1 2 3
let levelSataus = getLevelStatus(row);
if (levelSataus == 1) {
selectAllChildrens(row.children);
} else if (levelSataus == 2) {
selectAllChildrens(row.children);
operateLastLeve(row);
} else if (levelSataus == 3) {
operateLastLeve(row);
}
},
search() { search() {
if (this.menuName != '') { if (this.menuName != '') {
let saveList = []; let saveList = [];
@ -142,21 +316,23 @@ export default {
// }); // });
// } // }
// }, // },
handleSelectionChange(val) { // handleSelectionChange(val) {
this.multipleSelection = []; // this.multipleSelection = [];
val.forEach(element => { // val.forEach(element => {
this.multipleSelection.push(element.id); // this.multipleSelection.push(element.id);
}); // });
console.log(this.multipleSelection); // console.log(this.multipleSelection);
}, // },
showCustomerMenu(row) { showCustomerMenu(row) {
this.selMenuName = row.name; this.selMenuName = row.name;
this.$refs['customerForm'].init(row.id); this.$refs['customerForm'].init(row.id);
}, },
open(id) { open(id) {
console.log('Aa');
let menuIds = []; let menuIds = [];
this.multipleSelection = [];
this.getData(this.dataList);
if (id != '') { if (id != '') {
menuIds = [id]; menuIds = [id];
} else { } else {
@ -180,7 +356,9 @@ export default {
}, },
close(id) { close(id) {
let menuIds = []; let menuIds = [];
this.multipleSelection = [];
this.getData(this.dataList);
if (id != '') { if (id != '') {
menuIds = [id]; menuIds = [id];
} else { } else {
@ -205,9 +383,54 @@ export default {
}; };
</script> </script>
<style> <style>
.div_btn {
margin: 0 0 20px 0;
}
.little-head { .little-head {
border-bottom: dashed 1px #ccc; border-bottom: dashed 1px #ccc;
line-height: 50px; line-height: 50px;
margin-bottom: 20px; margin-bottom: 20px;
} }
.indeterminate .el-checkbox__input .el-checkbox__inner {
background-color: #17B3A3 !important;
border-color: #17B3A3 !important;
color: #fff !important;
}
.indeterminate .el-checkbox__input.is-checked .el-checkbox__inner::after {
transform: scale(0.5);
}
.indeterminate .el-checkbox__input .el-checkbox__inner {
background-color: #f2f6fc;
border-color: #dcdfe6;
}
.indeterminate .el-checkbox__input .el-checkbox__inner::after {
border-color: #c0c4cc !important;
background-color: #c0c4cc;
}
.form-show th .el-checkbox__inner {
display: none !important;
}
.indeterminate .el-checkbox__input .el-checkbox__inner::after {
content: '';
position: absolute;
display: block;
background-color: #fff;
height: 2px;
transform: scale(0.5);
left: 0;
right: 0;
top: 5px;
width: auto !important;
}
.form-show .el-checkbox__inner {
display: block !important;
}
.form-show .el-checkbox {
display: block !important;
}
</style> </style>

Loading…
Cancel
Save