|
|
@@ -34,11 +34,7 @@
|
|
|
@change="materialTimeChange"
|
|
|
/>
|
|
|
<span style="margin-left: 30px">经销商范围</span>
|
|
|
- <select
|
|
|
- class="selectStyle"
|
|
|
- v-model="scope"
|
|
|
- autocomplete="off"
|
|
|
- >
|
|
|
+ <select class="selectStyle" v-model="scope" autocomplete="off">
|
|
|
<option value="1">共通</option>
|
|
|
<option value="0">部分</option>
|
|
|
</select>
|
|
|
@@ -51,10 +47,10 @@
|
|
|
<div v-for="(item, index) in areaList" :key="index">
|
|
|
<input
|
|
|
type="checkbox"
|
|
|
- :value="item.sign"
|
|
|
+ :value="item"
|
|
|
v-model="checkedBoxList"
|
|
|
@click="clickCheckbox(index)"
|
|
|
- /><span>{{ item.area }}</span>
|
|
|
+ /><span>{{ item }}</span>
|
|
|
</div>
|
|
|
<button @click.prevent="addByArea">添加</button>
|
|
|
</div>
|
|
|
@@ -84,7 +80,7 @@
|
|
|
<img
|
|
|
src="../../img/add.png"
|
|
|
@click="addGroup(index)"
|
|
|
- v-if="addFlag[index]"
|
|
|
+ v-if="item.flag"
|
|
|
/>
|
|
|
<img
|
|
|
src="../../img/delete.png"
|
|
|
@@ -106,7 +102,8 @@
|
|
|
<UpLoadTable
|
|
|
:tableData="tableData"
|
|
|
@change_icon="changeIcon"
|
|
|
- :imgFlag="imgFlag"
|
|
|
+ :pageSize="pageSize"
|
|
|
+ :currentPage="currentPage"
|
|
|
/>
|
|
|
</div>
|
|
|
<div class="page" v-show="scope === '0'">
|
|
|
@@ -128,9 +125,9 @@
|
|
|
</div>
|
|
|
<button @click="submit" class="submitBtn">提交</button>
|
|
|
<TipModal
|
|
|
- :tipFlag='tipModalFlag'
|
|
|
- :tipText='tipModalText'
|
|
|
- @close_tip_modal='closeTipModal'
|
|
|
+ :tipFlag="tipModalFlag"
|
|
|
+ :tipText="tipModalText"
|
|
|
+ @close_tip_modal="closeTipModal"
|
|
|
/>
|
|
|
</div>
|
|
|
</template>
|
|
|
@@ -139,8 +136,7 @@
|
|
|
import UpLoadTable from "./components/UploadInforTable";
|
|
|
import Count from "../../components/Count";
|
|
|
import Tablepage from "../../components/TablePage";
|
|
|
-import TipModal from "../../components/TipModal"
|
|
|
-import { AREASLIST } from "./uploadinfo";
|
|
|
+import TipModal from "../../components/TipModal";
|
|
|
export default {
|
|
|
props: {
|
|
|
isManufacturer: {
|
|
|
@@ -152,7 +148,7 @@ export default {
|
|
|
UpLoadTable,
|
|
|
Count,
|
|
|
Tablepage,
|
|
|
- TipModal
|
|
|
+ TipModal,
|
|
|
},
|
|
|
watch: {},
|
|
|
data() {
|
|
|
@@ -168,7 +164,6 @@ export default {
|
|
|
addByCustomize: "",
|
|
|
dlrList: [], // 自定义添加
|
|
|
addGroupList: [], // 添加的小组
|
|
|
- addFlag: [true, true, true, true, true, true], // 长度等于groupList.length
|
|
|
optionFlag: false, // 是否展示按小组添加的选择栏
|
|
|
fileDes: [], // 上传的文件名
|
|
|
file: "", //上传的文件
|
|
|
@@ -176,14 +171,14 @@ export default {
|
|
|
sum: 0, // 一共有多少条数据
|
|
|
pageSize: 20, // 每页展示的数据
|
|
|
currentPage: 1,
|
|
|
- areaList: AREASLIST, // 按区域添加
|
|
|
+ areaList: [], // 按区域添加
|
|
|
groupList: [], // 按小组添加
|
|
|
localMonth: "",
|
|
|
tableData: [], // 表格显示的数据
|
|
|
- AllDlr: [], // 所有进销商数据
|
|
|
- imgFlag: new Array(20).fill(true), // 筛选栏用添加图片还是删除图片
|
|
|
+ allDlr: [], // 所有进销商数据
|
|
|
+ idList: [],
|
|
|
tipModalFlag: false,
|
|
|
- tipModalText: ''
|
|
|
+ tipModalText: "",
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -234,57 +229,69 @@ export default {
|
|
|
},
|
|
|
// 点击按区域添加button
|
|
|
addByArea: function () {
|
|
|
- console.log(this.checkedBoxList);
|
|
|
- console.log(JSON.parse(JSON.stringify(this.checkedBoxList)));
|
|
|
- let dataObj = {
|
|
|
- localArea: ['东区', '南区']
|
|
|
+ let req = {
|
|
|
+ localArea: this.checkedBoxList,
|
|
|
};
|
|
|
- this.getDlrData(dataObj);
|
|
|
- this.getAllDlr(dataObj);
|
|
|
+ console.log(req,'按区域添加');
|
|
|
+ this.getAllDlr(req);
|
|
|
},
|
|
|
// 自定义添加
|
|
|
addBySelf: function () {
|
|
|
let dataObj = {
|
|
|
queryParams: this.addByCustomize,
|
|
|
};
|
|
|
- this.getDlrData(dataObj);
|
|
|
+ console.log(this,dataObj, '自定义添加入参');
|
|
|
this.getAllDlr(dataObj);
|
|
|
},
|
|
|
// 按小组添加,增加小组
|
|
|
addGroup: function (index) {
|
|
|
- this.addFlag.splice(index, 1, false);
|
|
|
- console.log(this.addFlag);
|
|
|
+ this.groupList[index].flag = !this.groupList[index].flag;
|
|
|
},
|
|
|
// 按小组添加,删除小组
|
|
|
deleteGroup: function (index) {
|
|
|
- this.addFlag.splice(index, 1, true);
|
|
|
+ this.groupList[index].flag = !this.groupList[index].flag;
|
|
|
},
|
|
|
// 点击按小组添加 添加按钮
|
|
|
addByGroup: function () {
|
|
|
this.addGroupList = [];
|
|
|
- this.addFlag.forEach((item, index) => {
|
|
|
- if (!item) {
|
|
|
- this.addGroupList.push(this.groupList[index]['id']);
|
|
|
+ this.groupList.forEach(element => {
|
|
|
+ if(!element.flag){
|
|
|
+ this.addGroupList.push(element.id);
|
|
|
}
|
|
|
});
|
|
|
- console.log(this.addGroupList);
|
|
|
+ let req = {
|
|
|
+ groupList: this.addGroupList
|
|
|
+ }
|
|
|
+ console.log('点击按小组添加入参', req)
|
|
|
+ this.getAllDlr(req);
|
|
|
this.optionFlag = false;
|
|
|
},
|
|
|
// 筛选
|
|
|
changeIcon: function (i) {
|
|
|
- this.imgFlag.splice(i, 1, !this.imgFlag[i]);
|
|
|
- // 筛选后的数据
|
|
|
+ let index = (this.currentPage - 1) * this.pageSize + i;
|
|
|
+ this.allDlr[index].flag = !this.allDlr[index].flag;
|
|
|
+ },
|
|
|
+ // 选中经销商的id 组成列表
|
|
|
+ dlrIdList: function () {
|
|
|
+ this.idList = [];
|
|
|
+ this.allDlr.forEach((element) => {
|
|
|
+ if (element.flag) {
|
|
|
+ this.idList.push(element.id);
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
// 关闭提示框
|
|
|
- closeTipModal: function() {
|
|
|
+ closeTipModal: function () {
|
|
|
this.tipModalFlag = false;
|
|
|
this.$router.go(0);
|
|
|
},
|
|
|
// 获取某一页面的数据,展示在表格
|
|
|
changePage: function (page) {
|
|
|
this.currentPage = page;
|
|
|
- console.log(page);
|
|
|
- this.getDlrData(this.currentPage);
|
|
|
+ this.tableData = this.allDlr.slice(
|
|
|
+ (this.currentPage - 1) * this.pageSize,
|
|
|
+ this.currentPage * this.pageSize
|
|
|
+ );
|
|
|
},
|
|
|
// 点击上一页,下一页,首页,尾页
|
|
|
jumpPage: function (item) {
|
|
|
@@ -302,7 +309,10 @@ export default {
|
|
|
this.currentPage = this.totalPage;
|
|
|
break;
|
|
|
}
|
|
|
- this.getDlrData(this.currentPage);
|
|
|
+ this.tableData = this.allDlr.slice(
|
|
|
+ (this.currentPage - 1) * this.pageSize,
|
|
|
+ this.currentPage * this.pageSize
|
|
|
+ );
|
|
|
},
|
|
|
// 点击提交,检查名字是否重复,获取数据
|
|
|
submit: function () {
|
|
|
@@ -320,6 +330,7 @@ export default {
|
|
|
alert("请导入附件");
|
|
|
return;
|
|
|
}
|
|
|
+ this.dlrIdList();
|
|
|
this.submitRequest();
|
|
|
}
|
|
|
},
|
|
|
@@ -351,11 +362,10 @@ export default {
|
|
|
paramData.append("dataDesc", this.inforDes);
|
|
|
paramData.append("sourceTime", this.materialTime);
|
|
|
paramData.append("dealerScope", this.scope);
|
|
|
- console.log(this.scope, 111)
|
|
|
- if (this.scope === '0') {
|
|
|
- paramData.append("dealerList", this.AllDlr);
|
|
|
- console.log(1111)
|
|
|
- console.log(this.AllDlr, 11111);
|
|
|
+ console.log(this.scope, 111);
|
|
|
+ if (this.scope === "0") {
|
|
|
+ paramData.append("dealerList", this.idList);
|
|
|
+ console.log(1111, this.idList);
|
|
|
}
|
|
|
console.log(paramData.getAll("dataName"));
|
|
|
this.$http
|
|
|
@@ -363,7 +373,7 @@ export default {
|
|
|
.then((res) => {
|
|
|
if (res.data && res.data.code === 200) {
|
|
|
this.tipModalFlag = true;
|
|
|
- this.tipModalText = '上传成功!';
|
|
|
+ this.tipModalText = "上传成功!";
|
|
|
} else {
|
|
|
alert("上传失败,请重试");
|
|
|
console.log(res);
|
|
|
@@ -395,24 +405,37 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
// 获取所有经销商信息接口
|
|
|
- getAllDlr: function (data = {}) {
|
|
|
+ getAllDlr: function (data = {}, flag) {
|
|
|
this.$http({
|
|
|
method: "post",
|
|
|
url: "/sys/agent/selectAgentInfoPage",
|
|
|
data: data,
|
|
|
})
|
|
|
.then((res) => {
|
|
|
+ console.log(res);
|
|
|
+ this.tableData = [];
|
|
|
+ this.allDlr = [];
|
|
|
if (res.data && res.data.code === 200) {
|
|
|
- this.dlrList = [];
|
|
|
- let dealerList = res.data.data;
|
|
|
- dealerList.forEach((item)=>{this.AllDlr.push(item.id)})
|
|
|
- console.log(this.AllDlr)
|
|
|
- let resData = this.AllDlr;
|
|
|
- resData.forEach((item) => {
|
|
|
- // 获取自定义下拉框的值
|
|
|
- this.dlrList.push(item.dlrName);
|
|
|
- this.dlrList.push(item.dlrCode);
|
|
|
+ // 整合数据, 主要目的是加一个 flag,在用户点击筛选的时候,好判断
|
|
|
+ res.data.data.forEach((item) => {
|
|
|
+ this.allDlr.push({
|
|
|
+ id: item.id,
|
|
|
+ dlrCode: item.dlrCode,
|
|
|
+ dlrName: item.dlrName,
|
|
|
+ localArea: item.localArea,
|
|
|
+ flag: true,
|
|
|
+ });
|
|
|
});
|
|
|
+ this.sum = res.data.count;
|
|
|
+ this.tableData = this.allDlr.slice(0, this.pageSize);
|
|
|
+ // 获取自定义添加datalist下拉框的值
|
|
|
+ if (!flag) {
|
|
|
+ this.dlrList = [];
|
|
|
+ this.allDlr.forEach((item) => {
|
|
|
+ this.dlrList.push(item.dlrName);
|
|
|
+ this.dlrList.push(item.dlrCode);
|
|
|
+ });
|
|
|
+ }
|
|
|
} else {
|
|
|
console.log(res);
|
|
|
}
|
|
|
@@ -421,18 +444,25 @@ export default {
|
|
|
console.log(err);
|
|
|
});
|
|
|
},
|
|
|
- // 分页获取所有进销商信息接口
|
|
|
- getDlrData: function (data = {}) {
|
|
|
+ // 获取小组接口
|
|
|
+ selectGroupList: function () {
|
|
|
this.$http({
|
|
|
method: "post",
|
|
|
- url: "/sys/agent/selectAgentInfoPage",
|
|
|
- data: data,
|
|
|
+ url: "/sys/group/selectGroupList",
|
|
|
+ data: {},
|
|
|
})
|
|
|
.then((res) => {
|
|
|
if (res.data && res.data.code === 200) {
|
|
|
- console.log(res, 'pageres');
|
|
|
- this.tableData = res.data.data;
|
|
|
- this.sum = res.data.count;
|
|
|
+ this.groupList = [];
|
|
|
+ res.data.data.forEach((item) => {
|
|
|
+ this.groupList.push(
|
|
|
+ {
|
|
|
+ id: item.id,
|
|
|
+ groupName: item.groupName,
|
|
|
+ flag: true
|
|
|
+ }
|
|
|
+ )
|
|
|
+ })
|
|
|
} else {
|
|
|
console.log(res);
|
|
|
}
|
|
|
@@ -441,17 +471,17 @@ export default {
|
|
|
console.log(err);
|
|
|
});
|
|
|
},
|
|
|
- // 获取小组接口
|
|
|
- selectGroupList: function () {
|
|
|
+ // 获取 所有区域 接口
|
|
|
+ getAreaList: function () {
|
|
|
this.$http({
|
|
|
method: "post",
|
|
|
- url: "/sys/group/selectGroupList",
|
|
|
- data: {},
|
|
|
+ url: "/sys/agent/selectAgentAreaInfoList",
|
|
|
})
|
|
|
.then((res) => {
|
|
|
+ console.log(res, 1111111);
|
|
|
if (res.data && res.data.code === 200) {
|
|
|
- this.groupList = res.data.data;
|
|
|
- console.log(this.groupList);
|
|
|
+ this.areaList = res.data.data;
|
|
|
+ console.log(this.areaList)
|
|
|
} else {
|
|
|
console.log(res);
|
|
|
}
|
|
|
@@ -467,8 +497,7 @@ export default {
|
|
|
created() {
|
|
|
// 获取所有经销商信息
|
|
|
this.getAllDlr();
|
|
|
- // 获取第一页经销商信息
|
|
|
- this.getDlrData();
|
|
|
+ this.getAreaList();
|
|
|
// 获取所有的资料名称
|
|
|
this.getAllDataName();
|
|
|
this.selectGroupList();
|