Commit ed1d1078 by 无尘

fix: 修复门店架构选择 bug

parent e377090e
<!DOCTYPE html><html><head><meta charset=utf-8><link rel="shortcut icon" href=./favicon.ico><title>好办管理平台</title><link href=./static/css/app.a7d10afbd6278f98197532c03851641d.css rel=stylesheet></head><body style="min-width: 1400px;"><div id=app></div><script src=https://cdn.ravenjs.com/3.26.2/vue/raven.min.js crossorigin=anonymous></script><script>Raven.config('https://3715a345910d4c768e7a1ec14619c2d5@sentry.io/1413672').install();</script><script type=text/javascript src=./static/js/manifest.bab9b7a48fe7791ea658.js></script><script type=text/javascript src=./static/js/vendor.1fb32a1d0eb8b56a0d21.js></script><script type=text/javascript src=./static/js/app.1061ee1420a425c7c561.js></script></body></html> <!DOCTYPE html><html><head><meta charset=utf-8><link rel="shortcut icon" href=./favicon.ico><title>好办管理平台</title><link href=./static/css/app.5d68a2a530fa4092ca2d8ddc48daadef.css rel=stylesheet></head><body style="min-width: 1400px;"><div id=app></div><script src=https://cdn.ravenjs.com/3.26.2/vue/raven.min.js crossorigin=anonymous></script><script>Raven.config('https://3715a345910d4c768e7a1ec14619c2d5@sentry.io/1413672').install();</script><script type=text/javascript src=./static/js/manifest.4068dc3c8ddccdb3fb41.js></script><script type=text/javascript src=./static/js/vendor.1fb32a1d0eb8b56a0d21.js></script><script type=text/javascript src=./static/js/app.2991ab9a5c0e8dc479ec.js></script></body></html>
\ No newline at end of file \ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
!function(e){var f=window.webpackJsonp;window.webpackJsonp=function(a,b,n){for(var r,t,o,i=0,u=[];i<a.length;i++)t=a[i],c[t]&&u.push(c[t][0]),c[t]=0;for(r in b)Object.prototype.hasOwnProperty.call(b,r)&&(e[r]=b[r]);for(f&&f(a,b,n);u.length;)u.shift()();if(n)for(i=0;i<n.length;i++)o=d(d.s=n[i]);return o};var a={},c={59:0};function d(f){if(a[f])return a[f].exports;var c=a[f]={i:f,l:!1,exports:{}};return e[f].call(c.exports,c,c.exports,d),c.l=!0,c.exports}d.e=function(e){var f=c[e];if(0===f)return new Promise(function(e){e()});if(f)return f[2];var a=new Promise(function(a,d){f=c[e]=[a,d]});f[2]=a;var b=document.getElementsByTagName("head")[0],n=document.createElement("script");n.type="text/javascript",n.charset="utf-8",n.async=!0,n.timeout=12e4,d.nc&&n.setAttribute("nonce",d.nc),n.src=d.p+"static/js/"+e+"."+{0:"57f17558f1bb0a025f30",1:"0ebe3ead93207dc78a78",2:"a168f9f3fa5a62ea5c70",3:"7f87f1f60c09bb6ad371",4:"57e69a2e14597cd906ec",5:"d453dce272cb1568e82a",6:"75b373af2f81e7a154c6",7:"e2adc4d7afcbe0a7ed52",8:"c06c65f291db880703b4",9:"38b6ecdabf74697faf0f",10:"e814eb130da46ab8f9ac",11:"2a6371e26ce81d53bfa6",12:"7456b731b3dcfc614219",13:"f0eeeb571414f7729a5b",14:"03b6a6249c86c65ed92f",15:"e0b74d60b14247754cb3",16:"d2f23967b1247f2207ec",17:"9cfaee8d66ae728ea464",18:"81ae347a12f75b90e007",19:"cc8c9552f7ea84249be2",20:"a8abdc23bdc593b762e5",21:"7623e0e62d945f12a17c",22:"631e380b15ba2dd24a20",23:"8ff94dc2b60dce48b29a",24:"c375006443ec34b746e4",25:"fa6c7852de32d7b615e8",26:"d8efbedb17e4d009a399",27:"2ea724b0442e927bfdf5",28:"9a1d85eb0508672d79fb",29:"558fa206d4a6f8f9c632",30:"fd5021c8b519d456294c",31:"25f483a744ba0fd42df0",32:"1698f86a851d84bc6e8e",33:"c390504b594e1f84e4d8",34:"8155480fe9f81f88b815",35:"308ac3bedeff9dcf6336",36:"0431cd8a342c85095c1a",37:"92fafbae4b635255cd8f",38:"906dd52db56ce245bd63",39:"9b6dad740714bbea21b8",40:"5e1e9bd1ea4f73d73124",41:"f650191e4adbbe354c40",42:"1f852a650fdbf7a7eaad",43:"4842dfa5f621ec0d1021",44:"7d0d22818b921288b612",45:"59e18b2a7837adcacf03",46:"31d46e2653e81d5473f4",47:"d0a51bf3b55df6639a10",48:"ab596ee0fdbba2cc5bed",49:"312fbfa8240b2f51ff62",50:"a75c0b98514e4b842995",51:"69d21ef59916ac8c6b6c",52:"6c2d7fe9d24ef551fdc2",53:"b758fbea575c48fbf253",54:"c95aee296157f26f7df7",55:"e951ac8beefff56da08d",58:"acb5d0caf683189666dc"}[e]+".js";var r=setTimeout(t,12e4);function t(){n.onerror=n.onload=null,clearTimeout(r);var f=c[e];0!==f&&(f&&f[1](new Error("Loading chunk "+e+" failed.")),c[e]=void 0)}return n.onerror=n.onload=t,b.appendChild(n),a},d.m=e,d.c=a,d.d=function(e,f,a){d.o(e,f)||Object.defineProperty(e,f,{configurable:!1,enumerable:!0,get:a})},d.n=function(e){var f=e&&e.__esModule?function(){return e.default}:function(){return e};return d.d(f,"a",f),f},d.o=function(e,f){return Object.prototype.hasOwnProperty.call(e,f)},d.p="./",d.oe=function(e){throw console.error(e),e}}([]); !function(e){var a=window.webpackJsonp;window.webpackJsonp=function(f,b,n){for(var r,t,o,i=0,u=[];i<f.length;i++)t=f[i],c[t]&&u.push(c[t][0]),c[t]=0;for(r in b)Object.prototype.hasOwnProperty.call(b,r)&&(e[r]=b[r]);for(a&&a(f,b,n);u.length;)u.shift()();if(n)for(i=0;i<n.length;i++)o=d(d.s=n[i]);return o};var f={},c={59:0};function d(a){if(f[a])return f[a].exports;var c=f[a]={i:a,l:!1,exports:{}};return e[a].call(c.exports,c,c.exports,d),c.l=!0,c.exports}d.e=function(e){var a=c[e];if(0===a)return new Promise(function(e){e()});if(a)return a[2];var f=new Promise(function(f,d){a=c[e]=[f,d]});a[2]=f;var b=document.getElementsByTagName("head")[0],n=document.createElement("script");n.type="text/javascript",n.charset="utf-8",n.async=!0,n.timeout=12e4,d.nc&&n.setAttribute("nonce",d.nc),n.src=d.p+"static/js/"+e+"."+{0:"7ce09492475d4b3012a7",1:"0ebe3ead93207dc78a78",2:"a168f9f3fa5a62ea5c70",3:"7f87f1f60c09bb6ad371",4:"57e69a2e14597cd906ec",5:"d453dce272cb1568e82a",6:"75b373af2f81e7a154c6",7:"e2adc4d7afcbe0a7ed52",8:"c06c65f291db880703b4",9:"38b6ecdabf74697faf0f",10:"e814eb130da46ab8f9ac",11:"2a6371e26ce81d53bfa6",12:"7456b731b3dcfc614219",13:"f0eeeb571414f7729a5b",14:"03b6a6249c86c65ed92f",15:"e0b74d60b14247754cb3",16:"d2f23967b1247f2207ec",17:"9cfaee8d66ae728ea464",18:"81ae347a12f75b90e007",19:"cc8c9552f7ea84249be2",20:"562aab9ff5f3b41a54a2",21:"6b9ce9fabbeccc750310",22:"a105960ae105d893439e",23:"3b1369caa6277647235a",24:"c375006443ec34b746e4",25:"fa6c7852de32d7b615e8",26:"d8efbedb17e4d009a399",27:"2ea724b0442e927bfdf5",28:"9a1d85eb0508672d79fb",29:"558fa206d4a6f8f9c632",30:"fd5021c8b519d456294c",31:"25f483a744ba0fd42df0",32:"1698f86a851d84bc6e8e",33:"c390504b594e1f84e4d8",34:"8155480fe9f81f88b815",35:"308ac3bedeff9dcf6336",36:"0431cd8a342c85095c1a",37:"92fafbae4b635255cd8f",38:"906dd52db56ce245bd63",39:"9b6dad740714bbea21b8",40:"5e1e9bd1ea4f73d73124",41:"f650191e4adbbe354c40",42:"1f852a650fdbf7a7eaad",43:"4842dfa5f621ec0d1021",44:"7d0d22818b921288b612",45:"59e18b2a7837adcacf03",46:"31d46e2653e81d5473f4",47:"d0a51bf3b55df6639a10",48:"ab596ee0fdbba2cc5bed",49:"312fbfa8240b2f51ff62",50:"a75c0b98514e4b842995",51:"69d21ef59916ac8c6b6c",52:"6c2d7fe9d24ef551fdc2",53:"b758fbea575c48fbf253",54:"c95aee296157f26f7df7",55:"e951ac8beefff56da08d",58:"acb5d0caf683189666dc"}[e]+".js";var r=setTimeout(t,12e4);function t(){n.onerror=n.onload=null,clearTimeout(r);var a=c[e];0!==a&&(a&&a[1](new Error("Loading chunk "+e+" failed.")),c[e]=void 0)}return n.onerror=n.onload=t,b.appendChild(n),f},d.m=e,d.c=f,d.d=function(e,a,f){d.o(e,a)||Object.defineProperty(e,a,{configurable:!1,enumerable:!0,get:f})},d.n=function(e){var a=e&&e.__esModule?function(){return e.default}:function(){return e};return d.d(a,"a",a),a},d.o=function(e,a){return Object.prototype.hasOwnProperty.call(e,a)},d.p="./",d.oe=function(e){throw console.error(e),e}}([]);
\ No newline at end of file \ No newline at end of file
...@@ -111,12 +111,13 @@ export default { ...@@ -111,12 +111,13 @@ export default {
}, },
menuData: [], menuData: [],
menusObj: {}, menusObj: {},
defaultOpen: [], defaultOpen: [], // 默认展开节点的 key 的数组
selectedList: [], selectedList: [],
brandSelection: 0, // 看了代码发现这里是取的索引值 brandSelection: 0, // 看了代码发现这里是取的索引值,不是品牌 id
brands: [], brands: [],
hasOpened: false, hasOpened: false,
firstRender: true // 判断是否是第一次渲染数据,用于切换品牌时判断 firstRender: true, // 判断是否是第一次渲染数据,用于切换品牌时判断
renderFlag: true // 应用判断渲染
}; };
}, },
methods: { methods: {
...@@ -134,8 +135,8 @@ export default { ...@@ -134,8 +135,8 @@ export default {
let treeData = []; let treeData = [];
if (res.data.errorCode == 1) { if (res.data.errorCode == 1) {
treeData = res.data.result || []; treeData = res.data.result || [];
that.formatGroupData(treeData);
} }
that.formatGroupData(treeData);
}) })
.catch(e => {}); .catch(e => {});
}, },
...@@ -144,15 +145,15 @@ export default { ...@@ -144,15 +145,15 @@ export default {
*/ */
formatGroupData(data) { formatGroupData(data) {
let that = this; let that = this;
let selType = that.selectType; let selType = that.selectType; // 传入:选择门店的类型(all 所有都可选, person 只选人,store 只选门店, group 只选分组, group-store 选门店/分组)
let fbdList = that.forbidenList; let fbdList = that.forbidenList; // 传入: 需要禁用的分组的 id
that.menusObj = {}; that.menusObj = {};
data.forEach(group => { data.forEach(group => {
group.label = group.name || ''; group.label = group.name || ''; // 新增
group.id = group.groupId || ''; group.id = group.groupId || ''; // 新增
group.disableOpen = false; group.disableOpen = false; // 新增
let isForbiden = !!(fbdList.indexOf(group.id) > -1); // 判断当前分组是否在禁用分组列表内 let isForbiden = !!(fbdList.indexOf(group.id) > -1); // 判断当前分组是否在禁用分组列表内
group.disabled = group.hasPression != 1 || selType == 'person' || selType == 'store' || isForbiden; group.disabled = group.hasPression != 1 || selType == 'person' || selType == 'store' || isForbiden; // 新增
let arr = []; let arr = [];
data.forEach(child => { data.forEach(child => {
child.disableOpen = false; child.disableOpen = false;
...@@ -161,13 +162,16 @@ export default { ...@@ -161,13 +162,16 @@ export default {
arr.push(child); arr.push(child);
} }
}); });
// 把简单 json 数组转换成 父子关系的 json
if (arr.length > 0) { if (arr.length > 0) {
group.childrens = arr; group.childrens = arr;
} else if (group.level != 0 && that.selectType != 'group') { } else if (group.level != 0 && that.selectType != 'group') {
group.childrens = [{ label: '' }]; group.childrens = [{ label: '' }];
group.isLast = true; group.isLast = true;
} }
if (group.level == 0) { if (group.level == 0) {
// 禁用分组
group.disabled = (group.childrens && group.childrens.length > 0) || (group.hasPression != 1 || selType == 'person' || selType == 'store' || isForbiden); group.disabled = (group.childrens && group.childrens.length > 0) || (group.hasPression != 1 || selType == 'person' || selType == 'store' || isForbiden);
group.hasLoad = true; group.hasLoad = true;
that.brands.push(group); that.brands.push(group);
...@@ -177,7 +181,7 @@ export default { ...@@ -177,7 +181,7 @@ export default {
} }
that.menusObj[group.id] = group; that.menusObj[group.id] = group;
}); });
that.menuData = [that.brands[0]]; that.menuData = [that.brands[0]]; // 设置树形结构数据
if (selType != 'group') { if (selType != 'group') {
this.getStoreList(that.menuData[0]); this.getStoreList(that.menuData[0]);
} }
...@@ -231,6 +235,7 @@ export default { ...@@ -231,6 +235,7 @@ export default {
if (that.$refs.tree) { if (that.$refs.tree) {
that.renderDefault(); that.renderDefault();
} }
that.renderFlag = false; // 应用中使用:设置默认参数,默认情况传入品牌的 groupId ,不再去请求门店数据,切换的时候再去请求
} }
}) })
.catch(e => {}); .catch(e => {});
...@@ -261,6 +266,12 @@ export default { ...@@ -261,6 +266,12 @@ export default {
// 现在问题是每次都追加数据了 // 现在问题是每次都追加数据了
let arr = !!parent.childrens ? parent.childrens : []; let arr = !!parent.childrens ? parent.childrens : [];
arr = arr.concat(list); arr = arr.concat(list);
let hash = {};
// 去重数组对象
arr = arr.reduce(function(item, next) {
hash[next.storeId] ? '' : (hash[next.storeId] = true && item.push(next));
return item;
}, []);
parent.childrens = JSON.parse(JSON.stringify(arr)); parent.childrens = JSON.parse(JSON.stringify(arr));
// parent.isLast = true; // 追加后重新设置isLast // parent.isLast = true; // 追加后重新设置isLast
that.$forceUpdate(); that.$forceUpdate();
...@@ -270,7 +281,9 @@ export default { ...@@ -270,7 +281,9 @@ export default {
this.defaultOpen.push(parent.id); this.defaultOpen.push(parent.id);
} }
that.$forceUpdate(); that.$forceUpdate();
// this.renderDefault(); that.$nextTick(() => {
that.menuData = JSON.parse(JSON.stringify(that.menuData));
}); // this.renderDefault();
}, },
/** /**
* 节点关闭时,取消复选框的禁用 * 节点关闭时,取消复选框的禁用
...@@ -316,7 +329,7 @@ export default { ...@@ -316,7 +329,7 @@ export default {
* 选择品牌 * 选择品牌
*/ */
selectBrand(val) { selectBrand(val) {
this.menuData = [this.brands[val]]; this.menuData = [this.brands[val]]; // 默认品牌数据为分组第一层数据
this.brands[val].hasLoad = true; this.brands[val].hasLoad = true;
this.firstRender = true; this.firstRender = true;
if (this.selectType != 'group') { if (this.selectType != 'group') {
...@@ -329,17 +342,18 @@ export default { ...@@ -329,17 +342,18 @@ export default {
* 渲染回显数据 * 渲染回显数据
*/ */
renderDefault() { renderDefault() {
this.$nextTick(() => { let that = this;
let list = this.defaultList; that.$nextTick(() => {
this.selectedList = list; let list = that.defaultList;
that.selectedList = list;
if (!!list.length) { if (!!list.length) {
this.$refs.tree.setCheckedNodes(list); that.$refs.tree.setCheckedNodes(list);
} }
list.forEach(li => { list.forEach(item => {
if (li.employeeClerkId) { if (item.employeeClerkId) {
this.defaultOpen = [li.storeId]; that.defaultOpen = [item.storeId];
} else if (!li.storeId && !li.employeeClerkId) { } else if (!item.storeId && !item.employeeClerkId) {
this.defaultOpen.push(this.menusObj[li.id].parentId); that.defaultOpen.push(that.menusObj[item.id].parentId);
} }
}); });
}); });
...@@ -373,15 +387,20 @@ export default { ...@@ -373,15 +387,20 @@ export default {
}, },
deep: true deep: true
}, },
// 应用中使用到,需要禁止选择品牌,品牌的 brandId 外部传进来的需要是 groupId,然后对比当前组件内的 groupId;
currentBrand: function(newData, oldData) { currentBrand: function(newData, oldData) {
let that = this; let that = this;
if (!!newData) { if (!!newData) {
that.brands.forEach((ele,index) => { that.brands.forEach((ele,index) => {
if(ele.id == newData) { // 目前有些问题,brands 中只有groupId ,没有 brandId if(ele.id == newData) { // 目前有些问题,brands 中只有groupId ,没有 brandId
that.brandSelection = index; that.brandSelection = index; // 之前 that.brandSelection 都是取得索引值,不是 id 值
}
})
that.$nextTick(function () {
if (!that.renderFlag) {
that.selectBrand(that.brandSelection);
} }
}) })
that.selectBrand(that.brandSelection);
} }
} }
} }
......
...@@ -4,10 +4,8 @@ ...@@ -4,10 +4,8 @@
<div class="daily-set-content boder-box"> <div class="daily-set-content boder-box">
<div class="table-condition flex flex-space-between m-b-23"> <div class="table-condition flex flex-space-between m-b-23">
<div class="table-condition-left"> <div class="table-condition-left">
<el-select v-model="conditionObj.completed" placeholder="请选择" class="w-105" @change="changeSelect"> <el-select v-model="conditionObj.completed" placeholder="请选择" class="w-105" @change="changeSelect"> <el-option v-for="item in completedOptions" :key="item.value" :label="item.label" :value="item.value"> </el-option> </el-select
<el-option v-for="item in completedOptions" :key="item.value" :label="item.label" :value="item.value"> </el-option> ><el-select v-model="conditionObj.overdue" placeholder="请选择" class="w-105 m-l-10" @change="changeSelect">
</el-select>
<el-select v-model="conditionObj.overdue" placeholder="请选择" class="w-105" @change="changeSelect">
<el-option v-for="item in overOptions" :key="item.value" :label="item.label" :value="item.value"> </el-option> <el-option v-for="item in overOptions" :key="item.value" :label="item.label" :value="item.value"> </el-option>
</el-select> </el-select>
</div> </div>
...@@ -32,7 +30,7 @@ ...@@ -32,7 +30,7 @@
<el-table-column label="指派对象"> <el-table-column label="指派对象">
<template slot-scope="scope"> <template slot-scope="scope">
<div class="flex flex-pack-center flex-start"> <div class="flex flex-pack-center flex-start">
<div class="image-wrap flex flex-align-center flex-pack-center"> <div :class="['image-wrap flex flex-align-center flex-pack-center', !!scope.row.headImgUrl ? 'bg-eceaeb' : 'bg-82c5ff']">
<img v-if="!!scope.row.headImgUrl" :src="scope.row.headImgUrl" alt="" /> <img v-if="!!scope.row.headImgUrl" :src="scope.row.headImgUrl" alt="" />
<i v-else class="iconfont icon-yewuduanmorentouxian"></i> <i v-else class="iconfont icon-yewuduanmorentouxian"></i>
</div> </div>
...@@ -110,7 +108,7 @@ export default { ...@@ -110,7 +108,7 @@ export default {
}, },
data() { data() {
return { return {
tableH: window.screen.availHeight - 464 - 126 - 120, tableH: window.screen.availHeight - 464 - 126,
activeId: '2', // 详情头部选中 id activeId: '2', // 详情头部选中 id
activeBrand: this.brandId, // 品牌 id activeBrand: this.brandId, // 品牌 id
topMenuData: [ topMenuData: [
...@@ -132,11 +130,11 @@ export default { ...@@ -132,11 +130,11 @@ export default {
}, },
completedOptions: [ completedOptions: [
{ {
label: '已完成', label: '已上报',
value: '1' value: '1'
}, },
{ {
label: '联营', label: '未上报',
value: '2' value: '2'
} }
], ],
...@@ -146,25 +144,11 @@ export default { ...@@ -146,25 +144,11 @@ export default {
value: '1' value: '1'
}, },
{ {
label: '联营', label: '未逾期',
value: '2' value: '0'
}
],
tableData: [
{
storeName: '1111',
headImgUrl: '222',
clerkName: '对象',
clerkId: '',
completed: '',
overdue: '',
taskId: '',
storeId: '',
createTime: '',
completeTime: '',
lastTime: ''
} }
], ],
tableData: [],
multipleSelection: [], multipleSelection: [],
dialogVisible: false, // 二维码 dialogVisible: false, // 二维码
// 分页参数 // 分页参数
...@@ -428,8 +412,13 @@ export default { ...@@ -428,8 +412,13 @@ export default {
height: 40px; height: 40px;
max-width: 40px; max-width: 40px;
max-height: 40px; max-height: 40px;
background: #eceaeb;
border-radius: 4px; border-radius: 4px;
&.bg-82c5ff {
background: #82c5ff;
}
&.bg-eceaeb {
background: #eceaeb;
}
img { img {
max-width: 40px; max-width: 40px;
max-height: 40px; max-height: 40px;
......
...@@ -126,29 +126,28 @@ export default { ...@@ -126,29 +126,28 @@ export default {
}, },
storeTypeOptions: [ storeTypeOptions: [
{ {
value: '',
label: '所有'
},
{
value: '0', value: '0',
label: '直营', label: '直营'
disabled: false
}, },
{ {
value: '1', value: '1',
label: '联营', label: '联营'
disabled: false
}, },
{ {
value: '2', value: '2',
label: '代理', label: '代理'
disabled: false
}, },
{ {
value: '3', value: '3',
label: '代销', label: '代销'
disabled: false
}, },
{ {
value: '4', value: '4',
label: '托管', label: '托管'
disabled: false
} }
], ],
selectRadio: '', // 选择当页/选择全部 selectRadio: '', // 选择当页/选择全部
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment