Commit dd8ff976 by fairyly

fix: 修改同步部门数据

parent 793fc8be
<!DOCTYPE html><html><head><meta charset=utf-8><link rel="shortcut icon" href=./favicon.ico><title>好办管理平台</title><link rel=stylesheet type=text/css href=//web-1251519181.file.myqcloud.com/custom-element/custom-element.1.0.24.css><link href=./static/css/app.5ac0ad0c347137fdea473368ecf3680c.css rel=stylesheet></head><body style="min-width: 1400px;" class=damolish><div id=app></div><script src=//web-1251519181.file.myqcloud.com/lib/vue/2.6.6/vue.min.js></script><script src=//web-1251519181.file.myqcloud.com/lib/vue-router/3.0.2/vue-router.min.js></script><script src=//web-1251519181.file.myqcloud.com/lib/vuex/3.1.0/vuex.min.js></script><script src=//web-1251519181.file.myqcloud.com/components/img-preview.2.0.00.js></script><script src=//web-1251519181.file.myqcloud.com/components/footer.2.0.04.js></script><script>// Raven.config('https://3715a345910d4c768e7a1ec14619c2d5@sentry.io/1413672').install();</script><script type=text/javascript src=./static/js/manifest.ee343d177be5912eb8af.js></script><script type=text/javascript src=./static/js/vendor.2cff6c68669f76f7bb26.js></script><script type=text/javascript src=./static/js/app.afd1ff31b04aa05a428b.js></script></body></html>
\ No newline at end of file
<!DOCTYPE html><html><head><meta charset=utf-8><link rel="shortcut icon" href=./favicon.ico><title>好办管理平台</title><link rel=stylesheet type=text/css href=//web-1251519181.file.myqcloud.com/custom-element/custom-element.1.0.24.css><link href=./static/css/app.fe840bde5b0964096797d07bfa32c17a.css rel=stylesheet></head><body style="min-width: 1400px;" class=damolish><div id=app></div><script src=//web-1251519181.file.myqcloud.com/lib/vue/2.6.6/vue.min.js></script><script src=//web-1251519181.file.myqcloud.com/lib/vue-router/3.0.2/vue-router.min.js></script><script src=//web-1251519181.file.myqcloud.com/lib/vuex/3.1.0/vuex.min.js></script><script src=//web-1251519181.file.myqcloud.com/components/img-preview.2.0.00.js></script><script src=//web-1251519181.file.myqcloud.com/components/footer.2.0.04.js></script><script>// Raven.config('https://3715a345910d4c768e7a1ec14619c2d5@sentry.io/1413672').install();</script><script type=text/javascript src=./static/js/manifest.5758f0e3d7de7d544a03.js></script><script type=text/javascript src=./static/js/vendor.2cff6c68669f76f7bb26.js></script><script type=text/javascript src=./static/js/app.afd1ff31b04aa05a428b.js></script></body></html>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
!function(e){var n=window.webpackJsonp;window.webpackJsonp=function(r,a,o){for(var f,d,i,u=0,b=[];u<r.length;u++)d=r[u],t[d]&&b.push(t[d][0]),t[d]=0;for(f in a)Object.prototype.hasOwnProperty.call(a,f)&&(e[f]=a[f]);for(n&&n(r,a,o);b.length;)b.shift()();if(o)for(u=0;u<o.length;u++)i=c(c.s=o[u]);return i};var r={},t={21:0};function c(n){if(r[n])return r[n].exports;var t=r[n]={i:n,l:!1,exports:{}};return e[n].call(t.exports,t,t.exports,c),t.l=!0,t.exports}c.e=function(e){var n=t[e];if(0===n)return new Promise(function(e){e()});if(n)return n[2];var r=new Promise(function(r,c){n=t[e]=[r,c]});n[2]=r;var a=document.getElementsByTagName("head")[0],o=document.createElement("script");o.type="text/javascript",o.charset="utf-8",o.async=!0,o.timeout=12e4,c.nc&&o.setAttribute("nonce",c.nc),o.src=c.p+"static/js/"+e+"."+{0:"cbd8baab911002c79be8",1:"9a1776fdc262362d75b8",2:"ae426c80e728c02a22cf",3:"e10c87a57d96e9f2d9ce",4:"55f32e862d526233bb6d",5:"afc7b726a46486df899a",6:"9e12ea68528f2ad5f9a5",7:"4c95fe66c59573d7da03",8:"c2a3c1c2b9ffb4687826",9:"617b6e3f6d04e59ae06b",10:"de993e1c4bc498c9dbd6",11:"29941951e052f4942eca",12:"c95e6e2e763aa2d73679",13:"28d4554055ef8599c8af",14:"6ddcbf8576b81570a798",15:"0a934f87a0f05eee4293",16:"ceb943561fcf2e88bc01",17:"30b2bb1593a5d6e55f0a",18:"b918fbf8403d96eac90a"}[e]+".js";var f=setTimeout(d,12e4);function d(){o.onerror=o.onload=null,clearTimeout(f);var n=t[e];0!==n&&(n&&n[1](new Error("Loading chunk "+e+" failed.")),t[e]=void 0)}return o.onerror=o.onload=d,a.appendChild(o),r},c.m=e,c.c=r,c.d=function(e,n,r){c.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},c.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return c.d(n,"a",n),n},c.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},c.p="./",c.oe=function(e){throw console.error(e),e}}([]);
\ No newline at end of file
!function(e){var n=window.webpackJsonp;window.webpackJsonp=function(r,a,o){for(var f,d,i,u=0,b=[];u<r.length;u++)d=r[u],t[d]&&b.push(t[d][0]),t[d]=0;for(f in a)Object.prototype.hasOwnProperty.call(a,f)&&(e[f]=a[f]);for(n&&n(r,a,o);b.length;)b.shift()();if(o)for(u=0;u<o.length;u++)i=c(c.s=o[u]);return i};var r={},t={21:0};function c(n){if(r[n])return r[n].exports;var t=r[n]={i:n,l:!1,exports:{}};return e[n].call(t.exports,t,t.exports,c),t.l=!0,t.exports}c.e=function(e){var n=t[e];if(0===n)return new Promise(function(e){e()});if(n)return n[2];var r=new Promise(function(r,c){n=t[e]=[r,c]});n[2]=r;var a=document.getElementsByTagName("head")[0],o=document.createElement("script");o.type="text/javascript",o.charset="utf-8",o.async=!0,o.timeout=12e4,c.nc&&o.setAttribute("nonce",c.nc),o.src=c.p+"static/js/"+e+"."+{0:"cbd8baab911002c79be8",1:"9a1776fdc262362d75b8",2:"ae426c80e728c02a22cf",3:"7dcb6583c88cca5621c9",4:"55f32e862d526233bb6d",5:"afc7b726a46486df899a",6:"9e12ea68528f2ad5f9a5",7:"4c95fe66c59573d7da03",8:"c2a3c1c2b9ffb4687826",9:"617b6e3f6d04e59ae06b",10:"de993e1c4bc498c9dbd6",11:"29941951e052f4942eca",12:"c95e6e2e763aa2d73679",13:"28d4554055ef8599c8af",14:"6ddcbf8576b81570a798",15:"0a934f87a0f05eee4293",16:"ceb943561fcf2e88bc01",17:"30b2bb1593a5d6e55f0a",18:"b918fbf8403d96eac90a"}[e]+".js";var f=setTimeout(d,12e4);function d(){o.onerror=o.onload=null,clearTimeout(f);var n=t[e];0!==n&&(n&&n[1](new Error("Loading chunk "+e+" failed.")),t[e]=void 0)}return o.onerror=o.onload=d,a.appendChild(o),r},c.m=e,c.c=r,c.d=function(e,n,r){c.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},c.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return c.d(n,"a",n),n},c.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},c.p="./",c.oe=function(e){throw console.error(e),e}}([]);
\ No newline at end of file
......@@ -4,7 +4,7 @@
* @Author: 无尘
* @Date: 2019-08-14 16:51:07
* @LastEditors : 无尘
* @LastEditTime : 2020-02-26 09:06:28
* @LastEditTime : 2020-02-26 11:30:27
-->
<!--
<wx-tree v-model="itemData" ></wx-tree>
......@@ -27,7 +27,7 @@ import wxTree from './wx-tree.vue';
</div>
</div>
</div>
<li-row v-if="item.expand" :itemObj="item" :itemData="item.children"></li-row
<li-row v-if="item.expand" :itemObj="item" :itemData="item.children" @changeParent="changeParent"></li-row
><!-- v-show="!!item.children.length && item.expand" -->
</li>
</draggable>
......@@ -84,19 +84,38 @@ export default {
},
computed: {},
methods: {
/**
* 触发父级
*/
changeParent(itemObj, flag) {
const that = this;
if (itemObj.addFlag) {
that.$emit('changeParent', that.itemObj, flag);
return false;
}
console.log('父级非新增:', itemObj, flag);
if (flag == 'add') {
that.$store.dispatch('saveAddInfo', itemObj);
}
if (flag == 'edit') {
that.$store.dispatch('saveEditInfo', itemObj);
}
},
/**
* 移动中
*/
onMove(evt) {
// const that = this;
// 判断中间是否存在父级
const draggedElement = evt.draggedContext.element;
// 首级不能移动
// 首
if (draggedElement.level == 0) {
return false;
}
console.log(evt, draggedElement, !draggedElement.fixed);
return !draggedElement.fixed;
},
/**
* move end
* m],ove end
*/
itemMoveEnd(evt) {
const that = this;
......@@ -105,7 +124,7 @@ export default {
that.$forceUpdate();
},
/**
* 改变数组数据
* 改变数组数据
*/
emitter(value) {
// console.log(value);
......@@ -151,15 +170,24 @@ export default {
console.log(newEle);
that.$nextTick(() => {
if (objKey == 'moved') {
if (that.itemObj.addFlag) {
that.$emit('changeParent', that.itemObj, 'edit');
}
that.$store.dispatch('saveEditInfo', newEle);
that.$store.dispatch('saveEditInfo', that.itemObj);
return false;
}
if (objKey == 'removed') {
if (that.itemObj.addFlag) {
that.$emit('changeParent', that.itemObj, 'edit');
}
that.$store.dispatch('saveEditInfo', newEle);
that.$store.dispatch('saveEditInfo', that.itemObj);
return false;
}
if (that.itemObj.addFlag) {
that.$emit('changeParent', that.itemObj, 'add');
}
that.$store.dispatch('saveAddInfo', newEle);
that.$store.dispatch('saveAddInfo', that.itemObj);
});
......@@ -183,7 +211,7 @@ export default {
item.children = await that.getChildData(item);
}
// 只有展开且不是门店的才会保存
// 只有展开且不是门店的才会保存
if (item.expand && !item.isStore) {
localforage.setItem('org' + item.departmentId, item);
}
......@@ -226,7 +254,7 @@ export default {
that.$store.dispatch('saveEditInfo', that.modItem);
return false;
}
// 添加子部门的时候判断是否有子级且不是新添加
// 添加子 部门的时候判断是否有子级且不是新添加
const arr = !that.additem.addFlag && !that.additem.children.length ? await that.getChildData(that.additem) : [];
if (arr.length && !that.additem.addFlag) {
arr.forEach(ele => {
......@@ -246,13 +274,16 @@ export default {
};
that.additem.children.push(childObj);
// 增加的字段
if (that.itemObj.addFlag) {
that.$emit('changeParent', that.itemObj, 'add');
}
that.$store.dispatch('saveAddInfo', that.additem);
that.$store.dispatch('saveAddInfo', childObj);
that.$forceUpdate();
},
/**
* 删除
* 删除
*/
delPost(item) {
const that = this;
......@@ -306,8 +337,8 @@ export default {
that.itemData.splice(key, 1);
that.$forceUpdate();
},
/**
* 获取下级数据
/* *
* 获取下级数据
*/
getChildData(item) {
const that = this;
......@@ -348,12 +379,12 @@ export default {
},
async checkLocal(data) {
// const that = this;
// con st that = this;
return new Promise((resolve, reject) => {
localforage
.getItem('org' + data.departmentId)
.then(value => {
// 当离线仓库中的值被载入时,此处代码运行
// 当离线仓库中的值被载入时,此处代码运行
// console.log(value);
value ? resolve(true) : resolve(false);
})
......@@ -397,7 +428,6 @@ export default {
that.getLocalData();
}
}
/* beforeDestroy() {} */
};
</script>
<style lang="less" scoped>
......
......@@ -4,7 +4,7 @@
* @Author: 无尘
* @Date: 2019-03-20 14:36:37
* @LastEditors : 无尘
* @LastEditTime : 2020-02-26 10:07:08
* @LastEditTime : 2020-02-26 10:33:14
-->
<template>
<div class="my-customer-wrap common-set-wrap">
......@@ -58,7 +58,7 @@
</div>
</div>
</div>
<wx-tree v-if="item.expand" :itemObj="item" :itemData="item.children" v-model="item.children"></wx-tree>
<wx-tree v-if="item.expand" :itemObj="item" :itemData="item.children" v-model="item.children" @changeParent="changeParent"></wx-tree>
</li>
</ul>
</div>
......@@ -139,6 +139,13 @@ export default {
computed: {},
methods: {
/**
* 触发父级
*/
changeParent(itemObj) {
// const that = this;
console.log('触发父级:', itemObj);
},
/**
* 保存
*/
saveData: _debounce(function() {
......
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