Commit 8834ad3a by fairyly

feat: 增加本地存储

parent 3169b6ce
<!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.48dcfffa9aad48e7af93ac4405d6edfa.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.430f6f10370fa87ea9e9.js></script><script type=text/javascript src=./static/js/vendor.2cff6c68669f76f7bb26.js></script><script type=text/javascript src=./static/js/app.4ad545414a2bd6f8aef7.js></script></body></html> <!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.7d8d9f0288e8ec2b99de5cd37b0f3c10.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.3969e50b04ec22393d1d.js></script><script type=text/javascript src=./static/js/vendor.2cff6c68669f76f7bb26.js></script><script type=text/javascript src=./static/js/app.4ad545414a2bd6f8aef7.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.
This source diff could not be displayed because it is too large. You can view the blob instead.
!function(e){var a=window.webpackJsonp;window.webpackJsonp=function(n,o,c){for(var f,d,i,u=0,b=[];u<n.length;u++)d=n[u],r[d]&&b.push(r[d][0]),r[d]=0;for(f in o)Object.prototype.hasOwnProperty.call(o,f)&&(e[f]=o[f]);for(a&&a(n,o,c);b.length;)b.shift()();if(c)for(u=0;u<c.length;u++)i=t(t.s=c[u]);return i};var n={},r={21:0};function t(a){if(n[a])return n[a].exports;var r=n[a]={i:a,l:!1,exports:{}};return e[a].call(r.exports,r,r.exports,t),r.l=!0,r.exports}t.e=function(e){var a=r[e];if(0===a)return new Promise(function(e){e()});if(a)return a[2];var n=new Promise(function(n,t){a=r[e]=[n,t]});a[2]=n;var o=document.getElementsByTagName("head")[0],c=document.createElement("script");c.type="text/javascript",c.charset="utf-8",c.async=!0,c.timeout=12e4,t.nc&&c.setAttribute("nonce",t.nc),c.src=t.p+"static/js/"+e+"."+{0:"1d32d63fa419a4b86bba",1:"9a1776fdc262362d75b8",2:"ed170b85a5d1ced841a3",3:"20599248eac439adeae8",4:"59cbb98ef3301b7d1be0",5:"afc7b726a46486df899a",6:"9e12ea68528f2ad5f9a5",7:"4c95fe66c59573d7da03",8:"c2a3c1c2b9ffb4687826",9:"4b8efecc95608bc88200",10:"ac7009c4a56552235c6f",11:"cdcdaabe8dd05b754b5f",12:"2bf38ff033ad1f7a922b",13:"b13f744cd55ac3168789",14:"840b162a636493a5d4f9",15:"b2964c8a20328a2a5e5f",16:"188fa59e318626239ae8",17:"17423916aa77b50f2ee3",18:"b918fbf8403d96eac90a"}[e]+".js";var f=setTimeout(d,12e4);function d(){c.onerror=c.onload=null,clearTimeout(f);var a=r[e];0!==a&&(a&&a[1](new Error("Loading chunk "+e+" failed.")),r[e]=void 0)}return c.onerror=c.onload=d,o.appendChild(c),n},t.m=e,t.c=n,t.d=function(e,a,n){t.o(e,a)||Object.defineProperty(e,a,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var a=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(a,"a",a),a},t.o=function(e,a){return Object.prototype.hasOwnProperty.call(e,a)},t.p="./",t.oe=function(e){throw console.error(e),e}}([]);
\ No newline at end of file
!function(e){var n=window.webpackJsonp;window.webpackJsonp=function(r,o,c){for(var f,i,u,b=0,d=[];b<r.length;b++)i=r[b],a[i]&&d.push(a[i][0]),a[i]=0;for(f in o)Object.prototype.hasOwnProperty.call(o,f)&&(e[f]=o[f]);for(n&&n(r,o,c);d.length;)d.shift()();if(c)for(b=0;b<c.length;b++)u=t(t.s=c[b]);return u};var r={},a={21:0};function t(n){if(r[n])return r[n].exports;var a=r[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,t),a.l=!0,a.exports}t.e=function(e){var n=a[e];if(0===n)return new Promise(function(e){e()});if(n)return n[2];var r=new Promise(function(r,t){n=a[e]=[r,t]});n[2]=r;var o=document.getElementsByTagName("head")[0],c=document.createElement("script");c.type="text/javascript",c.charset="utf-8",c.async=!0,c.timeout=12e4,t.nc&&c.setAttribute("nonce",t.nc),c.src=t.p+"static/js/"+e+"."+{0:"1d32d63fa419a4b86bba",1:"9a1776fdc262362d75b8",2:"7eb416b6fbade61bfe6c",3:"20599248eac439adeae8",4:"59cbb98ef3301b7d1be0",5:"afc7b726a46486df899a",6:"9e12ea68528f2ad5f9a5",7:"4c95fe66c59573d7da03",8:"c2a3c1c2b9ffb4687826",9:"4b8efecc95608bc88200",10:"ac7009c4a56552235c6f",11:"cdcdaabe8dd05b754b5f",12:"2bf38ff033ad1f7a922b",13:"b13f744cd55ac3168789",14:"840b162a636493a5d4f9",15:"b2964c8a20328a2a5e5f",16:"188fa59e318626239ae8",17:"17423916aa77b50f2ee3",18:"b918fbf8403d96eac90a"}[e]+".js";var f=setTimeout(i,12e4);function i(){c.onerror=c.onload=null,clearTimeout(f);var n=a[e];0!==n&&(n&&n[1](new Error("Loading chunk "+e+" failed.")),a[e]=void 0)}return c.onerror=c.onload=i,o.appendChild(c),r},t.m=e,t.c=r,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="./",t.oe=function(e){throw console.error(e),e}}([]);
\ No newline at end of file
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* @Author: 无尘 * @Author: 无尘
* @Date: 2019-08-14 16:51:07 * @Date: 2019-08-14 16:51:07
* @LastEditors : 无尘 * @LastEditors : 无尘
* @LastEditTime : 2020-02-21 17:11:20 * @LastEditTime : 2020-02-22 09:55:10
--> -->
<!-- <!--
<contact-tree :itemData="itemData" v-model="itemData" ></contact-tree> <contact-tree :itemData="itemData" v-model="itemData" ></contact-tree>
...@@ -83,7 +83,8 @@ export default { ...@@ -83,7 +83,8 @@ export default {
if (item.isStore == 0 && !item.children.length) { if (item.isStore == 0 && !item.children.length) {
item.children = await that.getChildData(item); item.children = await that.getChildData(item);
} }
if (item.expand) { // 只有展开且不是门店的才会保存
if (item.expand && !item.isStore) {
localforage.setItem(item.departmentId, item); localforage.setItem(item.departmentId, item);
} else { } else {
localforage.removeItem(item.departmentId); localforage.removeItem(item.departmentId);
...@@ -136,17 +137,53 @@ export default { ...@@ -136,17 +137,53 @@ export default {
}); });
}); });
}); });
},
async checkLocal(data) {
// const that = this;
return new Promise((resolve, reject) => {
localforage
.getItem(data.departmentId)
.then(value => {
// 当离线仓库中的值被载入时,此处代码运行
// console.log(value);
resolve(true);
})
.catch(function(err) {
// 当出错时,此处代码运行
resolve(false);
// console.log(err);
});
});
},
/**
* 获取存储的数据
*/
async getLocalData() {
const that = this;
for (let index = 0; index < that.itemData.length; index++) {
const flag = await that.checkLocal(that.itemData[index]);
if (flag) {
that.itemData[index].expand = true;
that.itemData[index].children = await that.getChildData(that.itemData[index]);
}
}
} }
}, },
watch: { watch: {
value: function(newData, oldData) { itemData: function(newData, oldData) {
const that = this; const that = this;
that.trData = JSON.parse(JSON.stringify(newData)); if (newData.length) {
that.getLocalData();
}
} }
}, },
mounted() { mounted() {
const that = this; const that = this;
that.trData = JSON.parse(JSON.stringify(that.value)); if (that.itemData.length) {
that.getLocalData();
}
} }
/* beforeDestroy() {} */ /* beforeDestroy() {} */
}; };
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @Author : 无尘 * @Author : 无尘
* @Date : 2020-02-13 14:02:40 * @Date : 2020-02-13 14:02:40
* @LastEditors : 无尘 * @LastEditors : 无尘
* @LastEditTime : 2020-02-21 15:26:36 * @LastEditTime : 2020-02-22 09:08:35
* @FilePath : \Hapi-demoj:\公司\haoban-3\src\components\company\depart-member.vue * @FilePath : \Hapi-demoj:\公司\haoban-3\src\components\company\depart-member.vue
--> -->
<!-- <!--
...@@ -55,303 +55,305 @@ ...@@ -55,303 +55,305 @@
</template> </template>
<script> <script>
/* eslint-disable */ /* eslint-disable */
import { _debounce } from '@/common/js/public'; import {
import { getRequest, postRequest } from '@/api/api'; _debounce
import errMsg from '@/common/js/error'; } from '@/common/js/public';
import showMsg from '@/common/js/showmsg'; import {
import addMember from '@/components/company/add-member.vue'; getRequest,
import modDepart from '@/components/company/mod-depart.vue'; postRequest
export default { } from '@/api/api';
name: 'depart-list', import errMsg from '@/common/js/error';
components: { import showMsg from '@/common/js/showmsg';
addMember, import addMember from '@/components/company/add-member.vue';
modDepart import modDepart from '@/components/company/mod-depart.vue';
}, export default {
props: { name: 'depart-list',
departObj: { components: {
type: Object, addMember,
default() { modDepart
return { },
departmentId: '', props: {
departmentName: '', departObj: {
wxDepartmentId: '', type: Object,
parentId: '', default () {
isStore: '', return {
staffCount: '', departmentId: '',
bindFlag: '' departmentName: '',
}; wxDepartmentId: '',
parentId: '',
isStore: '',
staffCount: '',
bindFlag: ''
};
}
} }
} },
}, data() {
data() { return {
return { searchInput: '',
searchInput: '', activeFlag: '',
activeFlag: '', statusOptions: [{
statusOptions: [
{
value: '', value: '',
label: '所有状态' label: '所有状态'
}, }, {
{
value: '0', value: '0',
label: '未激活' label: '未激活'
}, }, {
{
value: '1', value: '1',
label: '已激活' label: '已激活'
} }],
], // 分页参数
// 分页参数 currentPage: 1,
currentPage: 1, pageSize: 20,
pageSize: 20, total: 0,
total: 0, tableData: [],
tableData: [], // 新增
// 新增 memberVisible: false,
memberVisible: false, memberObj: {},
memberObj: {}, multipleSelection: [], //勾选数据
multipleSelection: [], //勾选数据 // 调整部门
// 调整部门 modVisible: false
modVisible: false };
};
},
methods: {
/**
* 输入
*/
toInput: _debounce(function(e, value) {
const that = this;
that.currentPage = 1;
that.getTableList();
}, 500),
// 搜索清除
clearInput() {
const that = this;
that.currentPage = 1;
that.getTableList();
},
// 选择状态
changeStatus() {
const that = this;
that.currentPage = 1;
that.getTableList();
}, },
methods: {
/**
* 输入
*/
toInput: _debounce(function(e, value) {
const that = this;
that.currentPage = 1;
that.getTableList();
}, 500),
// 搜索清除
clearInput() {
const that = this;
that.currentPage = 1;
that.getTableList();
},
// 选择状态
changeStatus() {
const that = this;
that.currentPage = 1;
that.getTableList();
},
/** /**
* 调整部门 * 调整部门
*/ */
modifyDepart() { modifyDepart() {
const that = this; const that = this;
if (!that.multipleSelection.length) { if (!that.multipleSelection.length) {
showMsg.showmsg('请先选择成员!', 'warning'); showMsg.showmsg('请先选择成员!', 'warning');
return false; return false;
} }
that.modVisible = true; that.modVisible = true;
}, },
modDepartData(res) { modDepartData(res) {
const that = this; const that = this;
that.modVisible = false; that.modVisible = false;
if (res == 'close') { if (res == 'close') {
return false; return false;
} }
that.currentPage = 1; that.currentPage = 1;
that.getTableList(); that.getTableList();
that.multipleSelection = []; that.multipleSelection = [];
}, },
/** /**
* 邀请 * 邀请
*/ */
toInvite(item) { toInvite(item) {
const that = this; const that = this;
if (item) { if (item) {
that.postInvite(item); that.postInvite(item);
} return false;
if (!that.multipleSelection.length) { }
showMsg.showmsg('请先选择成员!', 'warning'); if (!that.multipleSelection.length) {
return false; showMsg.showmsg('请先选择成员!', 'warning');
} return false;
that.postInvite(); }
}, that.postInvite();
postInvite(item) { },
const that = this; postInvite(item) {
let params = { const that = this;
staffIds: item ? item.staffId : that.multipleSelection.map(ele => ele.staffId).join(',') let params = {
}; staffIds: item ? item.staffId : that.multipleSelection.map(ele => ele.staffId).join(',')
postRequest('/haoban-manage3-web/staff-invite', params) };
.then(res => { postRequest('/haoban-manage3-web/staff-invite', params)
let resData = res.data; .then(res => {
if (resData.errorCode == 1) { let resData = res.data;
showMsg.showmsg('邀请成功', 'success'); if (resData.errorCode == 1) {
that.currentPage = 1; showMsg.showmsg('邀请成功', 'success');
that.getTableList(); that.currentPage = 1;
// 是否需要更新左侧 tree that.getTableList();
return false; // 是否需要更新左侧 tree
} return false;
errMsg.errorMsg(resData); }
}) errMsg.errorMsg(resData);
.catch(function(error) { })
that.$message.error({ .catch(function(error) {
duration: 1000, that.$message.error({
message: error.message duration: 1000,
message: error.message
});
}); });
}); },
},
/** /**
* 删除 * 删除
*/ */
toDel() { toDel() {
const that = this; const that = this;
if (!that.multipleSelection.length) { if (!that.multipleSelection.length) {
showMsg.showmsg('请先选择成员!', 'warning'); showMsg.showmsg('请先选择成员!', 'warning');
return false; return false;
} }
that.postDel(); that.postDel();
}, },
postDel() { postDel() {
const that = this; const that = this;
let params = { let params = {
staffDepartmentRelatedIds: that.multipleSelection.map(ele => ele.staffDepartmentRelatedIds).join(',') staffDepartmentRelatedIds: that.multipleSelection.map(ele => ele.staffDepartmentRelatedIds).join(',')
}; };
postRequest('/haoban-manage3-web/staff-batch-del', params) postRequest('/haoban-manage3-web/staff-batch-del', params)
.then(res => { .then(res => {
let resData = res.data; let resData = res.data;
if (resData.errorCode == 1) { if (resData.errorCode == 1) {
showMsg.showmsg('删除成功', 'success'); showMsg.showmsg('删除成功', 'success');
that.currentPage = 1; that.currentPage = 1;
that.getTableList(); that.getTableList();
return false; return false;
} }
errMsg.errorMsg(resData); errMsg.errorMsg(resData);
}) })
.catch(function(error) { .catch(function(error) {
that.$message.error({ that.$message.error({
duration: 1000, duration: 1000,
message: error.message message: error.message
});
}); });
}); },
},
/** /**
* 显示详情弹窗 * 显示详情弹窗
*/ */
showDetail(item) { showDetail(item) {
const that = this; const that = this;
that.memberObj = item; that.memberObj = item;
that.memberVisible = true; that.memberVisible = true;
}, },
/** /**
* 新建成员 * 新建成员
*/ */
addMember() { addMember() {
const that = this; const that = this;
that.memberVisible = true; that.memberVisible = true;
that.memberObj = {}; that.memberObj = {};
}, },
/** /**
* 确认新建后刷新 * 确认新建后刷新
*/ */
refreshData(res) { refreshData(res) {
const that = this; const that = this;
that.memberVisible = false; that.memberVisible = false;
that.memberObj = {}; that.memberObj = {};
if (res == 'close') { if (res == 'close') {
return false; return false;
} }
that.currentPage = 1; that.currentPage = 1;
that.getTableList(); that.getTableList();
}, },
/** /**
* 勾选 * 勾选
*/ */
handleSelectionChange(val) { handleSelectionChange(val) {
const that = this; const that = this;
that.multipleSelection = val; that.multipleSelection = val;
// 如果需要过滤就需要,下面重新勾选过滤后的数据 // 如果需要过滤就需要,下面重新勾选过滤后的数据
//rows.forEach(row => { //rows.forEach(row => {
// this.$refs.multipleDepartTable.toggleRowSelection(row); // this.$refs.multipleDepartTable.toggleRowSelection(row);
//}); //});
}, },
/** /**
* 分页---页码变化 * 分页---页码变化
*/ */
handleSizeChange(val) { handleSizeChange(val) {
const that = this; const that = this;
that.pageSize = val; that.pageSize = val;
that.getTableList(); that.getTableList();
}, },
/** /**
* 分页---当前页变化 * 分页---当前页变化
*/ */
handleCurrentChange(val) { handleCurrentChange(val) {
const that = this; const that = this;
that.currentPage = val; that.currentPage = val;
that.getTableList(); that.getTableList();
}, },
/** /**
* 获取列表数据 * 获取列表数据
*/ */
getTableList(val) { getTableList(val) {
const that = this; const that = this;
let para = { let para = {
departmentId: that.departObj.departmentId, departmentId: that.departObj.departmentId,
activeFlag: that.activeFlag, activeFlag: that.activeFlag,
keyWord: that.searchInput || '', // 搜索字段 keyWord: that.searchInput || '', // 搜索字段
pageNum: that.currentPage, // 当前页 pageNum: that.currentPage, // 当前页
pageSize: that.pageSize // 一页显示个数 pageSize: that.pageSize // 一页显示个数
}; };
getRequest('/haoban-manage3-web/staff-list', para) getRequest('/haoban-manage3-web/staff-list', para)
.then(res => { .then(res => {
let resData = res.data; let resData = res.data;
if (resData.errorCode == 1) { if (resData.errorCode == 1) {
that.tableData = resData.result.result || resData.result.list || []; that.tableData = resData.result.result || resData.result.list || [];
that.total = resData.result.totalCount || resData.result.total; that.total = resData.result.totalCount || resData.result.total;
return false; return false;
} }
errMsg.errorMsg(resData); errMsg.errorMsg(resData);
}) })
.catch(function(error) { .catch(function(error) {
that.$message.error({ that.$message.error({
duration: 1000, duration: 1000,
message: error.message message: error.message
});
}); });
}); }
} },
}, watch: {
watch: { departObj(newData, oldData) {
departObj(newData, oldData) { const that = this;
if (Object.keys(newData)) {
that.currentPage = 1;
that.getTableList();
}
}
},
mounted() {
const that = this; const that = this;
if (Object.keys(newData)) { if (Object.keys(that.departObj)) {
that.currentPage = 1; that.currentPage = 1;
that.getTableList(); that.getTableList();
} }
} }
}, };
mounted() {
const that = this;
if (Object.keys(that.departObj)) {
that.currentPage = 1;
that.getTableList();
}
}
};
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.w-274 { .w-274 {
width: 274px; width: 274px;
} }
.m-l-6 { .m-l-6 {
margin-left: 6px; margin-left: 6px;
} }
.depart-list-body { .depart-list-body {
.depart-children-list { .depart-children-list {
padding: 16px 10px; padding: 16px 10px;
background: #f5f7fa; background: #f5f7fa;
}
} }
} </style>
</style> \ No newline at end of file
...@@ -243,6 +243,7 @@ export default { ...@@ -243,6 +243,7 @@ export default {
const that = this; const that = this;
if (item) { if (item) {
that.postInvite(item); that.postInvite(item);
return false;
} }
if (!that.multipleSelection.length) { if (!that.multipleSelection.length) {
showMsg.showmsg('请先选择成员!', 'warning'); showMsg.showmsg('请先选择成员!', 'warning');
......
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