|
@@ -6,29 +6,12 @@
|
|
|
<p>{{ title }}</p>
|
|
|
</div>
|
|
|
<template v-if="dataList.length">
|
|
|
- <div
|
|
|
- :class="active ? 'bgActive' : 'bgActivecheckbox'"
|
|
|
- class="paren_content"
|
|
|
- >
|
|
|
+ <div :class="active ? 'bgActive' : 'bgActivecheckbox'" class="paren_content">
|
|
|
<template v-if="!type">
|
|
|
- <el-row
|
|
|
- v-infinite-scroll="load"
|
|
|
- :infinite-scroll-distance="20"
|
|
|
- infinite-scroll-disabled="disabled"
|
|
|
- class="scCont scrollbar"
|
|
|
- :gutter="16"
|
|
|
- >
|
|
|
+ <el-row v-infinite-scroll="load" :infinite-scroll-distance="20" infinite-scroll-disabled="disabled" class="scCont scrollbar" :gutter="16">
|
|
|
<el-checkbox-group @change="checkChange" v-model="checkList">
|
|
|
- <el-col
|
|
|
- :span="number"
|
|
|
- v-for="(item, index) in dataList"
|
|
|
- :key="index"
|
|
|
- >
|
|
|
- <div
|
|
|
- @click="handleBg(item, index)"
|
|
|
- :class="active && msg === index ? 'bgColor' : ''"
|
|
|
- class="cide"
|
|
|
- >
|
|
|
+ <el-col :span="number" v-for="(item, index) in dataList" :key="index">
|
|
|
+ <div @click="handleBg(item, index)" :class="active && msg === index ? 'bgColor' : ''" class="cide">
|
|
|
<div class="cide_header">
|
|
|
<p :title="item.name">{{ item.name }}</p>
|
|
|
<el-checkbox :label="index"></el-checkbox>
|
|
@@ -43,27 +26,12 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<template v-else-if="mainData.length">
|
|
|
- <div
|
|
|
- :class="active ? 'bgActive' : 'bgActivecheckbox'"
|
|
|
- class="paren_content"
|
|
|
- >
|
|
|
+ <div :class="active ? 'bgActive' : 'bgActivecheckbox'" class="paren_content">
|
|
|
<template v-if="type">
|
|
|
<el-row :gutter="16">
|
|
|
- <el-radio-group
|
|
|
- style="display: block"
|
|
|
- @change="radioChange"
|
|
|
- v-model="radio"
|
|
|
- >
|
|
|
- <el-col
|
|
|
- :span="number"
|
|
|
- v-for="(item, index) in mainData"
|
|
|
- :key="index"
|
|
|
- >
|
|
|
- <div
|
|
|
- @click.stop="handleBg(index)"
|
|
|
- :class="active && msg === index ? 'bgColor' : ''"
|
|
|
- class="cide"
|
|
|
- >
|
|
|
+ <el-radio-group style="display: block" @change="radioChange" v-model="radio">
|
|
|
+ <el-col :span="number" v-for="(item, index) in mainData" :key="index">
|
|
|
+ <div @click.stop="handleBg(index)" :class="active && msg === index ? 'bgColor' : ''" class="cide">
|
|
|
<div class="cide_header">
|
|
|
<p>{{ item.name }}</p>
|
|
|
<el-radio :label="index"></el-radio>
|
|
@@ -124,7 +92,7 @@ export default {
|
|
|
default: () => [],
|
|
|
},
|
|
|
},
|
|
|
- data() {
|
|
|
+ data () {
|
|
|
return {
|
|
|
radio: null,
|
|
|
checkList: [],
|
|
@@ -139,7 +107,7 @@ export default {
|
|
|
},
|
|
|
watch: {
|
|
|
radioCheck: {
|
|
|
- handler(num) {
|
|
|
+ handler (num) {
|
|
|
this.radio = num;
|
|
|
},
|
|
|
deep: true,
|
|
@@ -156,7 +124,7 @@ export default {
|
|
|
deep: true,
|
|
|
},
|
|
|
dataList: {
|
|
|
- handler(arr) {
|
|
|
+ handler (arr) {
|
|
|
if (this.roleType == "account") {
|
|
|
this.checkBoxs(arr, "UserId");
|
|
|
}
|
|
@@ -164,10 +132,9 @@ export default {
|
|
|
deep: true,
|
|
|
},
|
|
|
checkBoxList: {
|
|
|
- handler(arr) {
|
|
|
+ handler (arr) {
|
|
|
if (this.roleType == "roleByUpId") {
|
|
|
const datas = [];
|
|
|
- console.log(arr);
|
|
|
this.dataList.forEach((item, index) => {
|
|
|
arr.forEach((p) => {
|
|
|
if (item.RoleId == p.RoleId) {
|
|
@@ -180,23 +147,29 @@ export default {
|
|
|
},
|
|
|
deep: true,
|
|
|
},
|
|
|
+ GroupIds: {
|
|
|
+ handler () {
|
|
|
+ this.getRoleDataByUpId();
|
|
|
+ },
|
|
|
+ deep: true
|
|
|
+ }
|
|
|
},
|
|
|
computed: {
|
|
|
- noMore() {
|
|
|
+ noMore () {
|
|
|
return this.pageNum >= this.total;
|
|
|
},
|
|
|
- disabled() {
|
|
|
+ disabled () {
|
|
|
return this.loading || this.noMore;
|
|
|
},
|
|
|
},
|
|
|
methods: {
|
|
|
// 选中
|
|
|
- handleBg(item, i) {
|
|
|
+ handleBg (item, i) {
|
|
|
this.msg = i;
|
|
|
this.$emit("checkClick", item);
|
|
|
},
|
|
|
//多选框
|
|
|
- checkChange(arr) {
|
|
|
+ checkChange (arr) {
|
|
|
const datas = this.formatChecks(arr);
|
|
|
// if (this.roleType == 'account') {
|
|
|
// datas = this.formatChecks(arr, 'UserId');
|
|
@@ -204,11 +177,11 @@ export default {
|
|
|
this.$emit("checkChange", datas);
|
|
|
},
|
|
|
//单选框
|
|
|
- radioChange(val) {
|
|
|
+ radioChange (val) {
|
|
|
this.$emit("radioChange", val);
|
|
|
},
|
|
|
//格式化选中回调
|
|
|
- formatChecks(arr, key) {
|
|
|
+ formatChecks (arr, key) {
|
|
|
const datas = [];
|
|
|
// const ids = []
|
|
|
this.dataList.forEach((item, index) => {
|
|
@@ -224,7 +197,7 @@ export default {
|
|
|
return datas;
|
|
|
},
|
|
|
//多选框默认选中
|
|
|
- checkBoxs(arr, ids) {
|
|
|
+ checkBoxs (arr, ids) {
|
|
|
const datas = [];
|
|
|
arr.forEach((item, index) => {
|
|
|
this.checkBoxList.forEach((p) => {
|
|
@@ -271,24 +244,20 @@ export default {
|
|
|
},
|
|
|
|
|
|
//获取列表2
|
|
|
- async getRoleDataByUpId(ids) {
|
|
|
+ async getRoleDataByUpId () {
|
|
|
try {
|
|
|
this.loading = true;
|
|
|
const obj = {
|
|
|
-
|
|
|
GroupIds: this.GroupIds
|
|
|
};
|
|
|
- let result = null;
|
|
|
- if (this.roleType == 'roleByUpId') {
|
|
|
- result = await GetRoleByGroup(obj);
|
|
|
- }
|
|
|
+ const result = await GetRoleByGroup(obj);
|
|
|
if (result.code === 0) {
|
|
|
const datas = result.returnData;
|
|
|
this.dataList = datas;
|
|
|
this.dataList.forEach(item => {
|
|
|
item.name = item.RoleName
|
|
|
});
|
|
|
- this.checkBoxs(this.dataList, "RoleId");
|
|
|
+ // this.checkBoxs(this.dataList, "RoleId");
|
|
|
this.loading = false;
|
|
|
} else {
|
|
|
this.$message.error(result.message);
|
|
@@ -301,7 +270,7 @@ export default {
|
|
|
},
|
|
|
|
|
|
//滚动加载数据
|
|
|
- load() {
|
|
|
+ load () {
|
|
|
this.pageNum += 1;
|
|
|
if (this.roleType == 'account') {
|
|
|
this.getRoleData('UserId', 'UserName');
|