|
|
|
@ -1,41 +1,29 @@
|
|
|
|
|
<template>
|
|
|
|
|
<div style="padding: 0 40px;">
|
|
|
|
|
<div class="selectClass">
|
|
|
|
|
<Checkbox :indeterminate="indeterminate"
|
|
|
|
|
<Checkbox
|
|
|
|
|
:indeterminate="indeterminate"
|
|
|
|
|
:value="allSelect"
|
|
|
|
|
@click.prevent.native="handleCheckAll"> 全选</Checkbox>
|
|
|
|
|
<i-input icon="search"
|
|
|
|
|
@on-change="doSearch"
|
|
|
|
|
placeholder="请输入零售公司名称"
|
|
|
|
|
style="width: 250px"></i-input>
|
|
|
|
|
@click.prevent.native="handleCheckAll"
|
|
|
|
|
> 全选</Checkbox>
|
|
|
|
|
<i-input icon="search" @on-change="doSearch" placeholder="请输入零售公司名称" style="width: 250px"></i-input>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="companyTable">
|
|
|
|
|
<div class="companyListClass">
|
|
|
|
|
<Row :gutter="10">
|
|
|
|
|
<div v-show="loading"
|
|
|
|
|
style="padding: 50px 0"
|
|
|
|
|
class="loading">
|
|
|
|
|
<div v-show="loading" style="padding: 50px 0" class="loading">
|
|
|
|
|
<Spin fix>加载中...</Spin>
|
|
|
|
|
</div>
|
|
|
|
|
<CheckboxGroup size="large"
|
|
|
|
|
@on-change="onChange"
|
|
|
|
|
v-model="checkCompanys">
|
|
|
|
|
<i-col span="8"
|
|
|
|
|
v-if="!item.hide"
|
|
|
|
|
:key="index"
|
|
|
|
|
v-for="(item, index) in companyList">
|
|
|
|
|
<Checkbox size="large"
|
|
|
|
|
:label="item.value"
|
|
|
|
|
border>
|
|
|
|
|
<CheckboxGroup size="large" @on-change="onChange" v-model="checkCompanys">
|
|
|
|
|
<i-col span="8" v-if="!item.hide" :key="index" v-for="(item, index) in companyList">
|
|
|
|
|
<Checkbox size="large" :label="item.value" border>
|
|
|
|
|
<span>{{ item.label }}</span>
|
|
|
|
|
</Checkbox>
|
|
|
|
|
</i-col>
|
|
|
|
|
</CheckboxGroup>
|
|
|
|
|
</Row>
|
|
|
|
|
</div>
|
|
|
|
|
<Spin size="large"
|
|
|
|
|
fix
|
|
|
|
|
v-if="loading"></Spin>
|
|
|
|
|
<Spin size="large" fix v-if="loading"></Spin>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
@ -44,7 +32,7 @@ import ActivityManager from "../../services/ActivityManager/ActivityManager";
|
|
|
|
|
import store from "../../store/index";
|
|
|
|
|
export default {
|
|
|
|
|
name: "useActivityStepTwo",
|
|
|
|
|
data () {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
indeterminate: false,
|
|
|
|
|
allSelect: false,
|
|
|
|
@ -52,29 +40,33 @@ export default {
|
|
|
|
|
companyListdata: [],
|
|
|
|
|
checkCompanys: [],
|
|
|
|
|
orginCompanyList: [],
|
|
|
|
|
loading: false,
|
|
|
|
|
loading: false
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
mounted () {
|
|
|
|
|
mounted() {
|
|
|
|
|
let _this = this;
|
|
|
|
|
console.log(111, store.getters.useData);
|
|
|
|
|
if (store.getters.useData.company) {
|
|
|
|
|
store.getters.useData.company.forEach((item) => {
|
|
|
|
|
if (
|
|
|
|
|
store.getters.useData.company &&
|
|
|
|
|
store.getters.useData.company.length > 0
|
|
|
|
|
) {
|
|
|
|
|
store.getters.useData.company.forEach(item => {
|
|
|
|
|
if (_this.checkCompanys.indexOf(item.id) == -1) {
|
|
|
|
|
_this.checkCompanys.push(item.id);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
} else if (store.getters.useData.stores) {
|
|
|
|
|
store.getters.useData.stores.forEach((item) => {
|
|
|
|
|
store.getters.useData.stores.forEach(item => {
|
|
|
|
|
console.log(112221, item.parentId);
|
|
|
|
|
if (item.parentId && _this.checkCompanys.indexOf(item.parentId) == -1) {
|
|
|
|
|
_this.checkCompanys.push(item.parentId);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
this.getCompanyInfo()
|
|
|
|
|
this.getCompanyInfo();
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
onChange (data) {
|
|
|
|
|
onChange(data) {
|
|
|
|
|
let _this = this;
|
|
|
|
|
if (data.length === this.companyList.length) {
|
|
|
|
|
this.indeterminate = false;
|
|
|
|
@ -87,58 +79,58 @@ export default {
|
|
|
|
|
this.allSelect = false;
|
|
|
|
|
}
|
|
|
|
|
store.getters.useData.company = [];
|
|
|
|
|
data.forEach((item) => {
|
|
|
|
|
const c = _this._.find(
|
|
|
|
|
_this.companyListdata,
|
|
|
|
|
(shop) => shop.id == item
|
|
|
|
|
);
|
|
|
|
|
data.forEach(item => {
|
|
|
|
|
const c = _this._.find(_this.companyListdata, shop => shop.id == item);
|
|
|
|
|
if (c) {
|
|
|
|
|
store.getters.useData.company.push(c);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
doSearch (e) {
|
|
|
|
|
doSearch(e) {
|
|
|
|
|
const keyword = e.target.value;
|
|
|
|
|
let that = this;
|
|
|
|
|
if (keyword.length > 0) {
|
|
|
|
|
that.companyList.forEach((item) => {
|
|
|
|
|
that.companyList.forEach(item => {
|
|
|
|
|
if (item.label.indexOf(keyword) == -1) {
|
|
|
|
|
item.hide = true;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
that.companyList.forEach((item) => {
|
|
|
|
|
item.hide = false
|
|
|
|
|
that.companyList.forEach(item => {
|
|
|
|
|
item.hide = false;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
this.$forceUpdate();
|
|
|
|
|
console.log(1, that.companyList)
|
|
|
|
|
console.log(1, that.companyList);
|
|
|
|
|
},
|
|
|
|
|
getCompanyInfo () {
|
|
|
|
|
getCompanyInfo() {
|
|
|
|
|
let that = this;
|
|
|
|
|
let data = {
|
|
|
|
|
userId: JSON.parse(sessionStorage.getItem("loginInfo")).userId,
|
|
|
|
|
userId: JSON.parse(sessionStorage.getItem("loginInfo")).userId
|
|
|
|
|
};
|
|
|
|
|
this.loading = true;
|
|
|
|
|
ActivityManager.getCompany(data, function (data) {
|
|
|
|
|
ActivityManager.getCompany(data, function(data) {
|
|
|
|
|
that.companyList = [];
|
|
|
|
|
that.companyListdata = data.data.results;
|
|
|
|
|
if (store.getters.useData.company && store.getters.useData.company.length == that.companyListdata.length) {
|
|
|
|
|
if (
|
|
|
|
|
store.getters.useData.company &&
|
|
|
|
|
store.getters.useData.company.length == that.companyListdata.length
|
|
|
|
|
) {
|
|
|
|
|
that.allSelect = true;
|
|
|
|
|
}
|
|
|
|
|
data.data.results.forEach((element) => {
|
|
|
|
|
data.data.results.forEach(element => {
|
|
|
|
|
that.companyList.push({
|
|
|
|
|
label: element.name,
|
|
|
|
|
value: element.id,
|
|
|
|
|
value: element.id
|
|
|
|
|
});
|
|
|
|
|
that.orginCompanyList = that.companyList;
|
|
|
|
|
});
|
|
|
|
|
store.getters.useData.company = [];
|
|
|
|
|
console.log(123, that.checkCompanys, that.companyListdata)
|
|
|
|
|
that.checkCompanys.forEach((item) => {
|
|
|
|
|
console.log(123, that.checkCompanys, that.companyListdata);
|
|
|
|
|
that.checkCompanys.forEach(item => {
|
|
|
|
|
const c = that._.find(
|
|
|
|
|
that.companyListdata,
|
|
|
|
|
(company) => company.id == item
|
|
|
|
|
company => company.id == item
|
|
|
|
|
);
|
|
|
|
|
if (c) {
|
|
|
|
|
store.getters.useData.company.push(c);
|
|
|
|
@ -147,7 +139,7 @@ export default {
|
|
|
|
|
that.loading = false;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
handleCheckAll () {
|
|
|
|
|
handleCheckAll() {
|
|
|
|
|
let _this = this;
|
|
|
|
|
if (this.indeterminate) {
|
|
|
|
|
this.allSelect = false;
|
|
|
|
@ -158,24 +150,24 @@ export default {
|
|
|
|
|
|
|
|
|
|
if (this.allSelect) {
|
|
|
|
|
this.checkCompanys = [];
|
|
|
|
|
this.companyList.forEach((item) => {
|
|
|
|
|
this.companyList.forEach(item => {
|
|
|
|
|
this.checkCompanys.push(item.value);
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
this.checkCompanys = [];
|
|
|
|
|
}
|
|
|
|
|
store.getters.useData.company = [];
|
|
|
|
|
this.checkCompanys.forEach((item) => {
|
|
|
|
|
this.checkCompanys.forEach(item => {
|
|
|
|
|
const c = _this._.find(
|
|
|
|
|
_this.companyListdata,
|
|
|
|
|
(company) => company.id == item
|
|
|
|
|
company => company.id == item
|
|
|
|
|
);
|
|
|
|
|
if (c) {
|
|
|
|
|
store.getters.useData.company.push(c);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|