Commit 3f632606 by caoyanzhi

update: 修改代码,遵守代码规范

parent be67b6e1
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
"clipboard": "^2.0.4", "clipboard": "^2.0.4",
"core-js": "^2.6.5", "core-js": "^2.6.5",
"element-ui": "^2.13.2", "element-ui": "^2.13.2",
"sass": "^1.26.10",
"vue": "^2.6.10", "vue": "^2.6.10",
"vue-router": "^3.0.3", "vue-router": "^3.0.3",
"vuex": "^3.0.1" "vuex": "^3.0.1"
...@@ -37,6 +36,7 @@ ...@@ -37,6 +36,7 @@
"less-loader": "^5.0.0", "less-loader": "^5.0.0",
"lint-staged": "^8.1.5", "lint-staged": "^8.1.5",
"qs": "^6.7.0", "qs": "^6.7.0",
"sass": "^1.26.10",
"sass-loader": "^9.0.2", "sass-loader": "^9.0.2",
"style-resources-loader": "^1.3.3", "style-resources-loader": "^1.3.3",
"stylus": "^0.54.5", "stylus": "^0.54.5",
......
...@@ -5,6 +5,6 @@ let api = { ...@@ -5,6 +5,6 @@ let api = {
getEnterpriseDetail: '/enterprise-detail', // 获取企业详情 getEnterpriseDetail: '/enterprise-detail', // 获取企业详情
refreshEnterpriseInfo: '/setting/wx-enterprise-info-flush', // 刷新企业信息 refreshEnterpriseInfo: '/setting/wx-enterprise-info-flush', // 刷新企业信息
storeRangeDetail: '/store-range-detail', // 查询绑定信息 storeRangeDetail: '/store-range-detail', // 查询绑定信息
} };
export default getFetch(api, '/hb-manage-operation-web'); export default getFetch(api, '/hb-manage-operation-web');
import { request } from '@/utils/request.js'; import { request } from '@/utils/request.js';
export default function getFetch (api, baseUrl) { export default function getFetch(api, baseUrl) {
api = api || {}; api = api || {};
let keys = Object.keys(api); let keys = Object.keys(api);
keys.forEach(key => { keys.forEach(key => {
...@@ -8,6 +8,6 @@ export default function getFetch (api, baseUrl) { ...@@ -8,6 +8,6 @@ export default function getFetch (api, baseUrl) {
if (typeof opt === 'string') opt = { url: opt }; if (typeof opt === 'string') opt = { url: opt };
opt.url = `${baseUrl}${opt.url}`; opt.url = `${baseUrl}${opt.url}`;
api[key] = params => request(opt, params); api[key] = params => request(opt, params);
}) });
return api; return api;
} }
...@@ -5,16 +5,16 @@ let api = { ...@@ -5,16 +5,16 @@ let api = {
getUserInfo: '/user/userinfo', getUserInfo: '/user/userinfo',
// 登出 // 登出
getLoginOut: '/logout' getLoginOut: '/logout'
} };
let api1 = { let api1 = {
isLogin: { isLogin: {
url: '/login', url: '/login',
useIntercept: false useIntercept: false
} }
} };
api = getFetch(api, '/gic-operation-web'); api = getFetch(api, '/gic-operation-web');
api1 = getFetch(api1, '/hb-manage-operation-web') api1 = getFetch(api1, '/hb-manage-operation-web');
export default { ...api, ...api1 }; export default { ...api, ...api1 };
\ No newline at end of file
...@@ -15,6 +15,6 @@ const api = { ...@@ -15,6 +15,6 @@ const api = {
delOperationItem: '/del-operation-item', // 删除操作项 delOperationItem: '/del-operation-item', // 删除操作项
haobanVersionList: '/haoban-version-list', // 获取好办版本列表 haobanVersionList: '/haoban-version-list', // 获取好办版本列表
appVersionList: '/app-version-list', // 获取应用版本列表 appVersionList: '/app-version-list', // 获取应用版本列表
} };
export default getFetch(api, '/hb-manage-operation-web'); export default getFetch(api, '/hb-manage-operation-web');
...@@ -8,12 +8,12 @@ ...@@ -8,12 +8,12 @@
*/ */
// 防抖 // 防抖
export function _debounce(fn, delay) { export function _debounce(fn, delay) {
var delay = delay || 200; delay = delay || 200;
var timer; let timer;
// console.log(fn) // console.log(fn)
return function() { return function() {
var that = this; let that = this;
var args = arguments; let args = arguments;
if (timer) { if (timer) {
clearTimeout(timer); clearTimeout(timer);
} }
...@@ -25,13 +25,13 @@ export function _debounce(fn, delay) { ...@@ -25,13 +25,13 @@ export function _debounce(fn, delay) {
} }
// 节流 // 节流
export function _throttle(fn, interval) { export function _throttle(fn, interval) {
var last; let last;
var timer; let timer;
var interval = interval || 200; interval = interval || 200;
return function() { return function() {
var that = this; let that = this;
var args = arguments; let args = arguments;
var now = +new Date(); let now = +new Date();
if (last && now - last < interval) { if (last && now - last < interval) {
clearTimeout(timer); clearTimeout(timer);
timer = setTimeout(function() { timer = setTimeout(function() {
...@@ -48,6 +48,7 @@ export function _throttle(fn, interval) { ...@@ -48,6 +48,7 @@ export function _throttle(fn, interval) {
/** /**
* 手机号格式化 * 手机号格式化
* @param {String} phone * @param {String} phone
* @return {string}
*/ */
export function formatPhone(phone) { export function formatPhone(phone) {
phone = phone.toString(); phone = phone.toString();
...@@ -75,11 +76,13 @@ export function formatDate(time) { ...@@ -75,11 +76,13 @@ export function formatDate(time) {
/** /**
* 千位分割 * 千位分割
* @param {number} num
* @return {string}
*/ */
export function formatNum(num) { export function formatNum(num) {
let number = num.toString().split('.'); // 分隔小数点 let number = num.toString().split('.'); // 分隔小数点
let dot = '0.' + (number[1] || 0); let dot = '0.' + (number[1] || 0);
var reg = /\d{1,3}(?=(\d{3})+$)/g; let reg = /\d{1,3}(?=(\d{3})+$)/g;
return ( return (
(number[0] + '').replace(reg, '$&,') + (number[0] + '').replace(reg, '$&,') +
'.' + '.' +
......
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
export default { export default {
/** /**
* 一个汉字算两个字符,一个英文字母或数字算一个字符 * 一个汉字算两个字符,一个英文字母或数字算一个字符
* @param {string} val
* @return {number}
*/ */
getByteLen: function(val) { getByteLen: function(val) {
let valStr = val == '' || val == null ? '' : val; let valStr = val == '' || val == null ? '' : val;
...@@ -30,6 +32,8 @@ export default { ...@@ -30,6 +32,8 @@ export default {
}, },
/** /**
* 一个汉字算一个字,一个英文字母或数字算半个字 * 一个汉字算一个字,一个英文字母或数字算半个字
* @param {string} val
* @return {number}
*/ */
getZhLen: function(val) { getZhLen: function(val) {
let valStr = val == '' || val == null ? '' : val; let valStr = val == '' || val == null ? '' : val;
...@@ -45,26 +49,29 @@ export default { ...@@ -45,26 +49,29 @@ export default {
return Math.ceil(len); return Math.ceil(len);
}, },
/*暂无用*/ /* 暂无用*/
cutStr: function(str, len, type) { cutStr: function(str, len, type) {
let char_length = 0; let charLength = 0;
for (let i = 0; i < str.length; i++) { for (let i = 0; i < str.length; i++) {
let son_str = str.charAt(i); let sonStr = str.charAt(i);
if (type == 1) { if (type == 1) {
encodeURI(son_str).length > 2 ? (char_length += 1) : (char_length += 0.5); encodeURI(sonStr).length > 2 ? (charLength += 1) : (charLength += 0.5);
} }
if (type == 2) { if (type == 2) {
char_length += 1; charLength += 1;
} }
if (char_length >= len) { if (charLength >= len) {
let sub_len = char_length == len ? i + 1 : i; let subLen = charLength == len ? i + 1 : i;
return str.substr(0, sub_len); return str.substr(0, subLen);
} }
} }
}, },
/** /**
* 限制字数用, 一个汉字算一个字,两个英文/字母算一个字 * 限制字数用, 一个汉字算一个字,两个英文/字母算一个字
* @param {string} val
* @param {number} max
* @return {string}
*/ */
getByteVal: function(val, max) { getByteVal: function(val, max) {
let valStr = val == '' || val == null ? '' : val; let valStr = val == '' || val == null ? '' : val;
...@@ -81,6 +88,9 @@ export default { ...@@ -81,6 +88,9 @@ export default {
/** /**
* 限制字符数用, 一个汉字算两个字符,一个英文/字母算一个字符 * 限制字符数用, 一个汉字算两个字符,一个英文/字母算一个字符
* @param {string} val
* @param {number} max
* @return {string}
*/ */
getCharVal: function(val, max) { getCharVal: function(val, max) {
let valStr = val == '' || val == null ? '' : val; let valStr = val == '' || val == null ? '' : val;
...@@ -97,6 +107,8 @@ export default { ...@@ -97,6 +107,8 @@ export default {
/** /**
* 正则校验,校验非负数字 * 正则校验,校验非负数字
* @param {string|number} v
* @return {boolean}
*/ */
regPos: function(v) { regPos: function(v) {
let regTest = /^\d+(\.\d+)?$/; let regTest = /^\d+(\.\d+)?$/;
......
...@@ -17,31 +17,31 @@ export default { ...@@ -17,31 +17,31 @@ export default {
* var storeBusinessTime="10:00-22:00" to * var storeBusinessTime="10:00-22:00" to
*/ */
timeToDate: function(val) { timeToDate: function(val) {
var date = new Date() let date = new Date();
var y = date.getFullYear(); let y = date.getFullYear();
var m = date.getMonth() +1; let m = date.getMonth() + 1;
var day = date.getDate(); let day = date.getDate();
var d = []; var newArr = []; let d = []; let newArr = [];
var dArr = val.split('-'); let dArr = val.split('-');
dArr.forEach(function(ele,index){ dArr.forEach(function(ele, index){
newArr.push(ele.split(':')) newArr.push(ele.split(':'));
}) });
d = [new Date(y,m,day,newArr[0][0],newArr[0][1]),new Date(y,m,day,newArr[1][0],newArr[1][1])] d = [ new Date(y, m, day, newArr[0][0], newArr[0][1]), new Date(y, m, day, newArr[1][0], newArr[1][1]) ];
return d; return d;
}, },
dateToTime(val) { dateToTime(val) {
console.log(val) console.log(val);
// (0-9)年月数字的显示 // (0-9)年月数字的显示
function formatDig(num) { function formatDig(num) {
return num > 9 ? '' + num : '0' + num; return num > 9 ? '' + num : '0' + num;
} }
var t; let t;
var t1 = formatDig(new Date(val[0]).getHours())+':'+formatDig(new Date(val[0]).getMinutes()) let t1 = formatDig(new Date(val[0]).getHours()) + ':' + formatDig(new Date(val[0]).getMinutes());
var t2 = formatDig(new Date(val[1]).getHours())+':'+formatDig(new Date(val[1]).getMinutes()) let t2 = formatDig(new Date(val[1]).getHours()) + ':' + formatDig(new Date(val[1]).getMinutes());
t= t1+'-'+t2 t = t1 + '-' + t2;
return t; return t;
} }
} };
...@@ -35,7 +35,8 @@ const dateFormat = function(timeSpan, format) { ...@@ -35,7 +35,8 @@ const dateFormat = function(timeSpan, format) {
/** /**
* 时间戳---> 年-月-日 时:分:秒 * 时间戳---> 年-月-日 时:分:秒
* @param timestamp * @param {timestamp} data
* @return {undefined|string}
*/ */
const formatTimeStamp = function(data) { const formatTimeStamp = function(data) {
if (!data) { if (!data) {
...@@ -53,7 +54,8 @@ const formatTimeStamp = function(data) { ...@@ -53,7 +54,8 @@ const formatTimeStamp = function(data) {
/** /**
* 时间戳---> 年.月.日 时:分:秒 * 时间戳---> 年.月.日 时:分:秒
* @param timestamp * @param {timestamp} data
* @return {undefined|string}
*/ */
const formatTimeYmdHms = function(data) { const formatTimeYmdHms = function(data) {
if (!data) { if (!data) {
...@@ -71,7 +73,8 @@ const formatTimeYmdHms = function(data) { ...@@ -71,7 +73,8 @@ const formatTimeYmdHms = function(data) {
/** /**
* 时间戳---> 年-月 * 时间戳---> 年-月
* @param timestamp * @param {timestamp} data timestamp
* @return {undefined|string}
*/ */
const timeStampToYm = function(data) { const timeStampToYm = function(data) {
if (!data) { if (!data) {
...@@ -85,7 +88,8 @@ const timeStampToYm = function(data) { ...@@ -85,7 +88,8 @@ const timeStampToYm = function(data) {
/** /**
* 时间戳---> 年-月-日 * 时间戳---> 年-月-日
* @param timestamp * @param {timestamp} data
* @return {undefined|string}
*/ */
const timeStampToYmd = function(data) { const timeStampToYmd = function(data) {
if (!data) { if (!data) {
...@@ -100,7 +104,8 @@ const timeStampToYmd = function(data) { ...@@ -100,7 +104,8 @@ const timeStampToYmd = function(data) {
/** /**
* 时间戳---> 时:分:秒 * 时间戳---> 时:分:秒
* @param timestamp * @param {timestamp} data
* @return {undefined|string}
*/ */
const timeStampToHms = function(data) { const timeStampToHms = function(data) {
if (!data) { if (!data) {
...@@ -115,26 +120,27 @@ const timeStampToHms = function(data) { ...@@ -115,26 +120,27 @@ const timeStampToHms = function(data) {
/** /**
* 时间戳---> *天*小时*分 * 时间戳---> *天*小时*分
* @param timestamp * @param {timestamp} date
* @return {undefined|string}
*/ */
const timeStampSpace = function(date) { const timeStampSpace = function(date) {
if (!date) { if (!date) {
return; return;
} }
let date2 = new Date(); let date2 = new Date();
let date3 = new Date(Number(date)).getTime() - date2.getTime(); //时间差的毫秒数 let date3 = new Date(Number(date)).getTime() - date2.getTime(); // 时间差的毫秒数
if (date3 < 0) { if (date3 < 0) {
return ''; return '';
} }
//计算出相差天数 // 计算出相差天数
let days = Math.floor(date3 / (24 * 3600 * 1000)); let days = Math.floor(date3 / (24 * 3600 * 1000));
//计算出小时数 // 计算出小时数
let leave1 = date3 % (24 * 3600 * 1000); //计算天数后剩余的毫秒数 let leave1 = date3 % (24 * 3600 * 1000); // 计算天数后剩余的毫秒数
let hours = Math.floor(leave1 / (3600 * 1000)); let hours = Math.floor(leave1 / (3600 * 1000));
//计算相差分钟数 // 计算相差分钟数
let leave2 = leave1 % (3600 * 1000); //计算小时数后剩余的毫秒数 let leave2 = leave1 % (3600 * 1000); // 计算小时数后剩余的毫秒数
let minutes = Math.floor(leave2 / (60 * 1000)); let minutes = Math.floor(leave2 / (60 * 1000));
//计算相差秒数 // 计算相差秒数
// let leave3 = leave2 % (60 * 1000); //计算分钟数后剩余的毫秒数 // let leave3 = leave2 % (60 * 1000); //计算分钟数后剩余的毫秒数
// let seconds = Math.round(leave3 / 1000); // let seconds = Math.round(leave3 / 1000);
return `${days}${hours}小时${minutes}分`; return `${days}${hours}小时${minutes}分`;
...@@ -142,7 +148,8 @@ const timeStampSpace = function(date) { ...@@ -142,7 +148,8 @@ const timeStampSpace = function(date) {
/** /**
* 手机号格式化 * 手机号格式化
* @param {String} phone * @param {string} phone
* @return {string}
*/ */
const formatPhoneNum = function(phone) { const formatPhoneNum = function(phone) {
if (!phone) { if (!phone) {
...@@ -154,7 +161,8 @@ const formatPhoneNum = function(phone) { ...@@ -154,7 +161,8 @@ const formatPhoneNum = function(phone) {
/** /**
* 姓名格式化 * 姓名格式化
* @param {String} phone * @param {string} name
* @return {string}
*/ */
const formatName = function(name) { const formatName = function(name) {
if (!name) { if (!name) {
...@@ -166,7 +174,8 @@ const formatName = function(name) { ...@@ -166,7 +174,8 @@ const formatName = function(name) {
/** /**
* 毫秒---> *时*分*秒 * 毫秒---> *时*分*秒
* @param timestamp * @param {timestamp} msTime
* @return {string}
*/ */
const formatTime = function(msTime) { const formatTime = function(msTime) {
if (!msTime) { if (!msTime) {
......
...@@ -58,7 +58,7 @@ export default { ...@@ -58,7 +58,7 @@ export default {
if (Array.isArray(item.nodeChildren) && item.nodeChildren.length > 0) { if (Array.isArray(item.nodeChildren) && item.nodeChildren.length > 0) {
item.collapsFlag = !item.collapsFlag; item.collapsFlag = !item.collapsFlag;
} else { } else {
this.$router.push({path: item.uri}); this.$router.push({ path: item.uri });
} }
}, },
}, },
...@@ -78,12 +78,12 @@ export default { ...@@ -78,12 +78,12 @@ export default {
function setCollapsFlag(arr) { function setCollapsFlag(arr) {
arr = arr.slice(); arr = arr.slice();
return arr.map(item => { return arr.map(item => {
that.$set(item, 'collapsFlag', true) that.$set(item, 'collapsFlag', true);
if (item.nodeChildren && item.nodeChildren.length > 0) { if (item.nodeChildren && item.nodeChildren.length > 0) {
item.nodeChildren = setCollapsFlag(item.nodeChildren); item.nodeChildren = setCollapsFlag(item.nodeChildren);
} }
return item; return item;
}) });
} }
} }
} }
......
...@@ -24,7 +24,7 @@ export default { ...@@ -24,7 +24,7 @@ export default {
return { return {
menu: [], menu: [],
breadList: [] breadList: []
} };
}, },
methods: { methods: {
updateAsideMenu(menu) { updateAsideMenu(menu) {
...@@ -39,7 +39,7 @@ export default { ...@@ -39,7 +39,7 @@ export default {
this.breadList = []; this.breadList = [];
} }
} }
} };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
</template> </template>
<script> <script>
import { origin, succCode } from '@/config' import { origin, succCode } from '@/config';
import fetch from '@/api'; import fetch from '@/api';
const { getUserInfo, getLoginOut, isLogin } = fetch; const { getUserInfo, getLoginOut, isLogin } = fetch;
export default { export default {
...@@ -47,7 +47,7 @@ export default { ...@@ -47,7 +47,7 @@ export default {
origin, origin,
userInfo: {}, userInfo: {},
showUserInfo: false showUserInfo: false
} };
}, },
created() { created() {
this.getUserInfo(); this.getUserInfo();
...@@ -66,8 +66,8 @@ export default { ...@@ -66,8 +66,8 @@ export default {
this.$emit('updateAsideMenu', result.menuTree || []); this.$emit('updateAsideMenu', result.menuTree || []);
}).catch(e => { }).catch(e => {
window.location.reload(); window.location.reload();
}) });
}) });
}, },
// 退出登录 // 退出登录
onLoginOut() { onLoginOut() {
...@@ -75,11 +75,11 @@ export default { ...@@ -75,11 +75,11 @@ export default {
getLoginOut().then(res => { getLoginOut().then(res => {
this.$message.success('退出成功'); this.$message.success('退出成功');
window.location.href = '/operation-platform/#/'; window.location.href = '/operation-platform/#/';
}) });
}) });
} }
} }
} };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
......
...@@ -41,4 +41,4 @@ Object.keys(filters).forEach(key => { ...@@ -41,4 +41,4 @@ Object.keys(filters).forEach(key => {
new Vue({ new Vue({
router, router,
render: h => h(App) render: h => h(App)
}).$mount('#app') }).$mount('#app');
...@@ -61,4 +61,4 @@ export const routes = [ ...@@ -61,4 +61,4 @@ export const routes = [
redirect: '/404', redirect: '/404',
hidden: true hidden: true
} }
] ];
const TokenKey = 'Admin-Token' const TokenKey = 'Admin-Token';
export function getToken() { export function getToken() {
return localStorage.getItem(TokenKey); return localStorage.getItem(TokenKey);
......
import Vue from 'vue' import Vue from 'vue';
import Clipboard from 'clipboard' import Clipboard from 'clipboard';
function clipboardSuccess() { function clipboardSuccess() {
Vue.prototype.$message({ Vue.prototype.$message({
message: '复制成功', message: '复制成功',
type: 'success', type: 'success',
duration: 1500 duration: 1500
}) });
} }
function clipboardError() { function clipboardError() {
Vue.prototype.$message({ Vue.prototype.$message({
message: '复制失败', message: '复制失败',
type: 'error' type: 'error'
}) });
} }
export default function handleClipboard(text, event) { export default function handleClipboard(text, event) {
const clipboard = new Clipboard(event.target, { const clipboard = new Clipboard(event.target, {
text: () => text text: () => text
}) });
clipboard.on('success', () => { clipboard.on('success', () => {
clipboardSuccess() clipboardSuccess();
clipboard.off('error') clipboard.off('error');
clipboard.off('success') clipboard.off('success');
clipboard.destroy() clipboard.destroy();
}) });
clipboard.on('error', () => { clipboard.on('error', () => {
clipboardError() clipboardError();
clipboard.off('error') clipboard.off('error');
clipboard.off('success') clipboard.off('success');
clipboard.destroy() clipboard.destroy();
}) });
clipboard.onClick(event) clipboard.onClick(event);
} }
...@@ -3,13 +3,14 @@ ...@@ -3,13 +3,14 @@
* @param {string} uri 原始url * @param {string} uri 原始url
* @param {string} key 追加的key * @param {string} key 追加的key
* @param {string} value 追加的key的value * @param {string} value 追加的key的value
* @return {string}
*/ */
export const updateQueryStringParameter = (uri, key, value) => { export const updateQueryStringParameter = (uri, key, value) => {
if (!value) { if (!value) {
return uri; return uri;
} }
var re = new RegExp('([?&])' + key + '=.*?(&|$)', 'i'); const re = new RegExp('([?&])' + key + '=.*?(&|$)', 'i');
var separator = uri.indexOf('?') !== -1 ? '&' : '?'; const separator = uri.indexOf('?') !== -1 ? '&' : '?';
if (uri.match(re)) { if (uri.match(re)) {
return uri.replace(re, '$1' + key + '=' + value + '$2'); return uri.replace(re, '$1' + key + '=' + value + '$2');
} else { } else {
......
...@@ -28,7 +28,7 @@ const request = (opt, params) => { ...@@ -28,7 +28,7 @@ const request = (opt, params) => {
useIntercept: true, useIntercept: true,
// 设置headers, 但是好像没效果,以后再说吧 // 设置headers, 但是好像没效果,以后再说吧
headers: {} headers: {}
} };
requestConfig = Object.assign(requestConfig, opt); requestConfig = Object.assign(requestConfig, opt);
if (requestConfig.useFormData) params = qs.stringify(params); if (requestConfig.useFormData) params = qs.stringify(params);
switch (requestConfig.method.toLowerCase()) { switch (requestConfig.method.toLowerCase()) {
...@@ -60,18 +60,18 @@ const request = (opt, params) => { ...@@ -60,18 +60,18 @@ const request = (opt, params) => {
const response = error.response || {}; const response = error.response || {};
const { data, status } = response; const { data, status } = response;
if (status === 401) { if (status === 401) {
let url = isPro ? '../operation-platform/' : 'https://four.gicdev.com/operation-platform/' let url = isPro ? '../operation-platform/' : 'https://four.gicdev.com/operation-platform/';
window.location.href = url; window.location.href = url;
} }
if (data && data.message) { if (data && data.message) {
Message({ Message({
message: data.message, message: data.message,
type: 'warning' type: 'warning'
}) });
} }
reject(error); reject(error);
})
}); });
} });
};
export {axios, request}; export { axios, request };
...@@ -103,7 +103,7 @@ export default { ...@@ -103,7 +103,7 @@ export default {
data: [], data: [],
selected: [] selected: []
} }
} };
}, },
created() { created() {
const { enterpriseId } = this.$route.query; const { enterpriseId } = this.$route.query;
...@@ -118,7 +118,7 @@ export default { ...@@ -118,7 +118,7 @@ export default {
getEnterpriseDetail() { getEnterpriseDetail() {
getEnterpriseDetail({ wxEnterpriseId: this.enterpriseId }).then(res => { getEnterpriseDetail({ wxEnterpriseId: this.enterpriseId }).then(res => {
Object.assign(this.enterpriseDetail, res.result); Object.assign(this.enterpriseDetail, res.result);
}) });
}, },
onRefresh() { onRefresh() {
refreshEnterpriseInfo().then(this.getEnterpriseDetail); refreshEnterpriseInfo().then(this.getEnterpriseDetail);
...@@ -134,25 +134,25 @@ export default { ...@@ -134,25 +134,25 @@ export default {
return result.length > 0 ? result.join('/') : '--'; return result.length > 0 ? result.join('/') : '--';
}, },
getBindDetail(storeData, type) { getBindDetail(storeData, type) {
const { wxEnterpriseId, enterpriseId } = storeData const { wxEnterpriseId, enterpriseId } = storeData;
const params = { const params = {
wxEnterpriseId, wxEnterpriseId,
enterpriseId, enterpriseId,
operationType: type, // 0 门店绑定 1门店分享 operationType: type, // 0 门店绑定 1门店分享
} };
this.bindInfo.show = true; this.bindInfo.show = true;
this.bindInfo.type = type; this.bindInfo.type = type;
storeRangeDetail(params).then(res => { storeRangeDetail(params).then(res => {
this.bindInfo.data = res.result || []; this.bindInfo.data = res.result || [];
this.bindInfo.selected = this.bindInfo.data.map(el => el.id); this.bindInfo.selected = this.bindInfo.data.map(el => el.id);
}) });
}, },
onBindInfoClose() { onBindInfoClose() {
this.bindInfo.data = []; this.bindInfo.data = [];
this.bindInfo.selected = []; this.bindInfo.selected = [];
} }
} }
} };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
......
...@@ -82,13 +82,13 @@ export default { ...@@ -82,13 +82,13 @@ export default {
// 分页相关的数据 // 分页相关的数据
pager: { pager: {
total: 0, total: 0,
pageSizes: [20, 40, 60, 80], pageSizes: [ 20, 40, 60, 80 ],
pageSize: 20, pageSize: 20,
currentPage: 1 currentPage: 1
}, },
// 企业列表 // 企业列表
enterpriseList: [] enterpriseList: []
} };
}, },
created() { created() {
this.getEnterpriseList(); this.getEnterpriseList();
...@@ -104,12 +104,12 @@ export default { ...@@ -104,12 +104,12 @@ export default {
bindFlag, bindFlag,
pageSize, pageSize,
pageNum: currentPage pageNum: currentPage
} };
getEnterpriseList(params).then(res => { getEnterpriseList(params).then(res => {
const { totalCount, result } = res.result || {}; const { totalCount, result } = res.result || {};
this.pager.total = totalCount || 0; this.pager.total = totalCount || 0;
this.enterpriseList = result || []; this.enterpriseList = result || [];
}) });
}, },
onSearch() { onSearch() {
this.pager.currentPage = 1; this.pager.currentPage = 1;
...@@ -130,7 +130,7 @@ export default { ...@@ -130,7 +130,7 @@ export default {
result = el.label; result = el.label;
} }
return el.value == val; return el.value == val;
}) });
return result; return result;
}, },
toEnterpriseDetail(enterpriseData) { toEnterpriseDetail(enterpriseData) {
...@@ -138,7 +138,7 @@ export default { ...@@ -138,7 +138,7 @@ export default {
this.$router.push(`/enterprise-detail?enterpriseId=${wxEnterpriseId}`); this.$router.push(`/enterprise-detail?enterpriseId=${wxEnterpriseId}`);
} }
} }
} };
</script> </script>
<style scoped> <style scoped>
......
...@@ -14,13 +14,13 @@ ...@@ -14,13 +14,13 @@
</template> </template>
<script> <script>
import img_403 from '@/assets/403_images/error_403.svg'; import img403 from '@/assets/403_images/error_403.svg';
export default { export default {
name: 'Page403', name: 'Page403',
data() { data() {
return { return {
img_403 img403
}; };
}, },
computed: { computed: {
......
...@@ -14,13 +14,13 @@ ...@@ -14,13 +14,13 @@
</template> </template>
<script> <script>
import img_404 from '@/assets/404_images/error_404.svg'; import img404 from '@/assets/404_images/error_404.svg';
export default { export default {
name: 'Page404', name: 'Page404',
data() { data() {
return { return {
img_404 img404
}; };
}, },
computed: { computed: {
......
...@@ -14,13 +14,13 @@ ...@@ -14,13 +14,13 @@
</template> </template>
<script> <script>
import img_500 from '@/assets/500_images/error_500.svg'; import img500 from '@/assets/500_images/error_500.svg';
export default { export default {
name: 'Page500', name: 'Page500',
data() { data() {
return { return {
img_500 img500
}; };
}, },
computed: { computed: {
......
...@@ -22,13 +22,13 @@ ...@@ -22,13 +22,13 @@
</template> </template>
<script> <script>
import img_404 from '@/assets/gic-error.png'; import img404 from '@/assets/gic-error.png';
export default { export default {
name: 'Page404', name: 'Page404',
data() { data() {
return { return {
img_404 img404
}; };
}, },
computed: { computed: {
......
...@@ -22,9 +22,9 @@ ...@@ -22,9 +22,9 @@
</template> </template>
<script> <script>
import img_403 from '@/assets/403_images/error_403.svg'; import img403 from '@/assets/403_images/error_403.svg';
import img_404 from '@/assets/404_images/error_404.svg'; import img404 from '@/assets/404_images/error_404.svg';
import img_500 from '@/assets/500_images/error_500.svg'; import img500 from '@/assets/500_images/error_500.svg';
export default { export default {
name: 'Index', name: 'Index',
...@@ -33,9 +33,9 @@ export default { ...@@ -33,9 +33,9 @@ export default {
imgSrc: '', imgSrc: '',
message: '', message: '',
srcList: { srcList: {
403: img_403, 403: img403,
404: img_404, 404: img404,
500: img_500 500: img500
}, },
msgList: { msgList: {
403: '抱歉,你无权访问该页面', 403: '抱歉,你无权访问该页面',
...@@ -45,8 +45,8 @@ export default { ...@@ -45,8 +45,8 @@ export default {
}; };
}, },
mounted() { mounted() {
var that = this; let that = this;
var path = that.$route.path.split('/')[1]; let path = that.$route.path.split('/')[1];
that.imgSrc = that.srcList[path]; that.imgSrc = that.srcList[path];
that.message = that.msgList[path]; that.message = that.msgList[path];
} }
......
...@@ -24,9 +24,9 @@ export default { ...@@ -24,9 +24,9 @@ export default {
data() { data() {
return { return {
activeName: 'first' activeName: 'first'
};
} }
} };
}
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
......
...@@ -133,7 +133,7 @@ const { getMenuList, addMenu, editMenu, delMenu, haobanVersionList, appVersionLi ...@@ -133,7 +133,7 @@ const { getMenuList, addMenu, editMenu, delMenu, haobanVersionList, appVersionLi
export default { export default {
name: 'MenuList', name: 'MenuList',
props: { props: {
appType: [String, Number] appType: [ String, Number ]
}, },
data() { data() {
return { return {
...@@ -162,24 +162,24 @@ export default { ...@@ -162,24 +162,24 @@ export default {
roleRange: 1, // 1管理员适用2管理员和门店适用3门店适用 roleRange: 1, // 1管理员适用2管理员和门店适用3门店适用
}, },
editMenuRules: { editMenuRules: {
hbVersion: [{ required: true, message: '请选择好办版本', trigger: 'change' }], hbVersion: [ { required: true, message: '请选择好办版本', trigger: 'change' } ],
menuName: [{ required: true, message: '页面名称不能为空', trigger: 'blur' }], menuName: [ { required: true, message: '页面名称不能为空', trigger: 'blur' } ],
code: [{ required: true, message: '页面code不能为空', trigger: 'blur' }] code: [ { required: true, message: '页面code不能为空', trigger: 'blur' } ]
}
} }
};
}, },
mounted() { mounted() {
this.menuList = []; this.menuList = [];
this.initData() this.initData();
}, },
methods: { methods: {
initData() { initData() {
haobanVersionList().then(res => { haobanVersionList().then(res => {
this.haobanVersionList = res.result || []; this.haobanVersionList = res.result || [];
}) });
appVersionList().then(res => { appVersionList().then(res => {
this.appVersionList = res.result || []; this.appVersionList = res.result || [];
}) });
this.getMenuList(); this.getMenuList();
}, },
// 获取节点列表数据 // 获取节点列表数据
...@@ -188,10 +188,10 @@ export default { ...@@ -188,10 +188,10 @@ export default {
menuId: '', menuId: '',
appType: this.appType, appType: this.appType,
keyword: this.search keyword: this.search
} };
getMenuList(params).then(res => { getMenuList(params).then(res => {
this.menuList = this.flatDataToTree(res.result || []); this.menuList = this.flatDataToTree(res.result || []);
}) });
}, },
// 收起、展开子节点 // 收起、展开子节点
onExpandChange() { onExpandChange() {
...@@ -199,7 +199,7 @@ export default { ...@@ -199,7 +199,7 @@ export default {
this.$nextTick(() => { this.$nextTick(() => {
this.expand = !this.expand; this.expand = !this.expand;
this.showTable = true; this.showTable = true;
}) });
}, },
// 新建节点、新建子节点、编辑节点弹窗打开 // 新建节点、新建子节点、编辑节点弹窗打开
onEditMenu(menuData, isSubMenu) { onEditMenu(menuData, isSubMenu) {
...@@ -246,7 +246,7 @@ export default { ...@@ -246,7 +246,7 @@ export default {
openType: 0, openType: 0,
menuFlag: 1, menuFlag: 1,
roleRange: 1 roleRange: 1
}) });
this.$nextTick(this.$refs.editMenu.clearValidate); this.$nextTick(this.$refs.editMenu.clearValidate);
}, },
// 新建节点、新建子节点、编辑节点弹窗保存 // 新建节点、新建子节点、编辑节点弹窗保存
...@@ -263,7 +263,7 @@ export default { ...@@ -263,7 +263,7 @@ export default {
openType, openType,
menuFlag, menuFlag,
roleRange roleRange
} };
if (parentId) { if (parentId) {
params.parentId = parentId; params.parentId = parentId;
} }
...@@ -283,7 +283,7 @@ export default { ...@@ -283,7 +283,7 @@ export default {
this.$message.success(msg); this.$message.success(msg);
this.getMenuList(); this.getMenuList();
} }
}) });
}, },
// 删除节点 // 删除节点
onDelMenu(menuData) { onDelMenu(menuData) {
...@@ -292,13 +292,13 @@ export default { ...@@ -292,13 +292,13 @@ export default {
delMenu({ menuId }).then(res => { delMenu({ menuId }).then(res => {
this.$message.success('删除成功!'); this.$message.success('删除成功!');
this.getMenuList(); this.getMenuList();
}) });
}) });
}, },
// 跳转到权限项列表页 // 跳转到权限项列表页
toPermissionList(menuData) { toPermissionList(menuData) {
const { menuId } = menuData; const { menuId } = menuData;
this.$router.push(`/permission-list?menuId=${menuId}&appType=${this.appType}`) this.$router.push(`/permission-list?menuId=${menuId}&appType=${this.appType}`);
}, },
flatDataToTree(data) { flatDataToTree(data) {
return data.filter(el => { return data.filter(el => {
...@@ -308,8 +308,8 @@ export default { ...@@ -308,8 +308,8 @@ export default {
el.children = children; // 如果存在子级,则给父级添加一个children属性,并赋值 el.children = children; // 如果存在子级,则给父级添加一个children属性,并赋值
} }
return el.parentId == 0; return el.parentId == 0;
}) });
}, },
} }
} };
</script> </script>
...@@ -24,14 +24,14 @@ export default { ...@@ -24,14 +24,14 @@ export default {
data() { data() {
return { return {
activeName: 'first' activeName: 'first'
} };
}, },
created() { created() {
const { type } = this.$route.query; const { type } = this.$route.query;
const tabs = ['', 'first', 'second', 'third', 'fourth']; const tabs = [ '', 'first', 'second', 'third', 'fourth' ];
this.activeName = tabs[type > 0 && type < 5 ? type : 1] ; this.activeName = tabs[type > 0 && type < 5 ? type : 1] ;
} }
} };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
......
...@@ -112,7 +112,7 @@ const { getOperationItemList, addOperationItem, editOperationItem, delOperationI ...@@ -112,7 +112,7 @@ const { getOperationItemList, addOperationItem, editOperationItem, delOperationI
export default { export default {
name: 'OperationTable', name: 'OperationTable',
props: { props: {
appType: [String, Number] appType: [ String, Number ]
}, },
data() { data() {
return { return {
...@@ -128,7 +128,7 @@ export default { ...@@ -128,7 +128,7 @@ export default {
// 分页相关的数据 // 分页相关的数据
pager: { pager: {
total: 0, total: 0,
pageSizes: [20, 40, 60, 80], pageSizes: [ 20, 40, 60, 80 ],
pageSize: 20, pageSize: 20,
currentPage: 1 currentPage: 1
}, },
...@@ -149,12 +149,12 @@ export default { ...@@ -149,12 +149,12 @@ export default {
version: '' version: ''
}, },
editOperationRule: { editOperationRule: {
menuId: [{ required: true, message: '请选择节点', trigger: 'change' }], menuId: [ { required: true, message: '请选择节点', trigger: 'change' } ],
version: [{ required: true, message: '请选择版本', trigger: 'change' }], version: [ { required: true, message: '请选择版本', trigger: 'change' } ],
operationItemName: [{ required: true, message: '操作项名称不能为空', trigger: 'blur' }], operationItemName: [ { required: true, message: '操作项名称不能为空', trigger: 'blur' } ],
operationItemCode: [{ required: true, message: '操作项code不能为空', trigger: 'blur' }], operationItemCode: [ { required: true, message: '操作项code不能为空', trigger: 'blur' } ],
}
} }
};
}, },
created() { created() {
this.initData(); this.initData();
...@@ -165,13 +165,13 @@ export default { ...@@ -165,13 +165,13 @@ export default {
getMenuList({ appType: this.appType }).then(res => { getMenuList({ appType: this.appType }).then(res => {
this.flatMenuList = res.result || []; this.flatMenuList = res.result || [];
this.menuList = this.flatDataToTree(res.result || []); this.menuList = this.flatDataToTree(res.result || []);
}) });
haobanVersionList().then(res => { haobanVersionList().then(res => {
this.haobanVersionList = res.result || []; this.haobanVersionList = res.result || [];
}) });
appVersionList().then(res => { appVersionList().then(res => {
this.appVersionList = res.result || []; this.appVersionList = res.result || [];
}) });
}, },
// 获取操作项列表 // 获取操作项列表
getOperationList() { getOperationList() {
...@@ -181,12 +181,12 @@ export default { ...@@ -181,12 +181,12 @@ export default {
pageNum: currentPage, pageNum: currentPage,
pageSize, pageSize,
appType: this.appType appType: this.appType
} };
getOperationItemList(params).then(res => { getOperationItemList(params).then(res => {
const { totalCount, result } = res.result || {}; const { totalCount, result } = res.result || {};
this.pager.total = totalCount || 0; this.pager.total = totalCount || 0;
this.operationList = result || []; this.operationList = result || [];
}) });
}, },
onSearch() { onSearch() {
this.pager.currentPage = 1; this.pager.currentPage = 1;
...@@ -221,8 +221,8 @@ export default { ...@@ -221,8 +221,8 @@ export default {
if (el.menuId == menuId && el.parentId > 0) { if (el.menuId == menuId && el.parentId > 0) {
result = getFullId(menuList, el.parentId).concat(result); result = getFullId(menuList, el.parentId).concat(result);
} }
return el.menuId == menuId return el.menuId == menuId;
}) });
return result; return result;
} }
}, },
...@@ -239,7 +239,7 @@ export default { ...@@ -239,7 +239,7 @@ export default {
roleRange: '1', roleRange: '1',
version: '', version: '',
appType: '' appType: ''
}) });
this.$nextTick(this.$refs.editOperation.clearValidate); this.$nextTick(this.$refs.editOperation.clearValidate);
}, },
onMenuChange(menuIds) { onMenuChange(menuIds) {
...@@ -248,7 +248,7 @@ export default { ...@@ -248,7 +248,7 @@ export default {
if (el.menuId == menuId) { if (el.menuId == menuId) {
this.editOperation.menuCode = el.code; this.editOperation.menuCode = el.code;
} }
return el.menuId == menuId return el.menuId == menuId;
}); });
}, },
// 新建、编辑操作项 弹窗保存 // 新建、编辑操作项 弹窗保存
...@@ -265,7 +265,7 @@ export default { ...@@ -265,7 +265,7 @@ export default {
authItemFlag, authItemFlag,
roleRange, roleRange,
version version
} };
this.editOperation.loading = true; this.editOperation.loading = true;
if (operationItemId) { if (operationItemId) {
...@@ -280,7 +280,7 @@ export default { ...@@ -280,7 +280,7 @@ export default {
this.editOperation.show = false; this.editOperation.show = false;
this.getOperationList(); this.getOperationList();
} }
}) });
}, },
// 删除操作项 // 删除操作项
onDel(operationData) { onDel(operationData) {
...@@ -292,8 +292,8 @@ export default { ...@@ -292,8 +292,8 @@ export default {
this.pager.currentPage--; this.pager.currentPage--;
} }
this.getOperationList(); this.getOperationList();
}) });
}) });
}, },
flatDataToTree(data) { flatDataToTree(data) {
return data.filter(el => { return data.filter(el => {
...@@ -303,8 +303,8 @@ export default { ...@@ -303,8 +303,8 @@ export default {
el.children = children; // 如果存在子级,则给父级添加一个children属性,并赋值 el.children = children; // 如果存在子级,则给父级添加一个children属性,并赋值
} }
return el.parentId == 0; return el.parentId == 0;
}) });
}, },
} }
} };
</script> </script>
...@@ -55,8 +55,8 @@ export default { ...@@ -55,8 +55,8 @@ export default {
data() { data() {
return { return {
bread: [ bread: [
{ path: '/menu-config', name: '权限配置'}, { path: '/menu-config', name: '权限配置' },
{ name: '权限项'} { name: '权限项' }
], ],
menuId: '', menuId: '',
appType: '', appType: '',
...@@ -73,10 +73,10 @@ export default { ...@@ -73,10 +73,10 @@ export default {
operationItemIds: [] // 包含的操作项id operationItemIds: [] // 包含的操作项id
}, },
editAuthRule: { editAuthRule: {
authItemName: [{ required: true, message: '权限项名称不能为空', trigger: 'blur' }], authItemName: [ { required: true, message: '权限项名称不能为空', trigger: 'blur' } ],
operationItemIds: [{ required: true, message: '请至少选择一个操作项', trigger: 'change' }] operationItemIds: [ { required: true, message: '请至少选择一个操作项', trigger: 'change' } ]
}
} }
};
}, },
created() { created() {
const { menuId, appType } = this.$route.query; const { menuId, appType } = this.$route.query;
...@@ -86,7 +86,7 @@ export default { ...@@ -86,7 +86,7 @@ export default {
this.menuId = menuId; this.menuId = menuId;
this.appType = appType; this.appType = appType;
this.initData(); this.initData();
this.$emit('updateBread', this.bread) this.$emit('updateBread', this.bread);
}, },
methods: { methods: {
initData() { initData() {
...@@ -105,13 +105,13 @@ export default { ...@@ -105,13 +105,13 @@ export default {
if (pageNum + 1 <= totalPage) { if (pageNum + 1 <= totalPage) {
this.getOperationItemList(pageNum + 1); this.getOperationItemList(pageNum + 1);
} }
}) });
}, },
// 获取权限项列表 // 获取权限项列表
getAuthItemList() { getAuthItemList() {
getAuthItemList({ menuId: this.menuId }).then(res => { getAuthItemList({ menuId: this.menuId }).then(res => {
this.authList = res.result || []; this.authList = res.result || [];
}) });
}, },
// 编辑权限项弹窗打开 // 编辑权限项弹窗打开
onEditAuthOpen(authData) { onEditAuthOpen(authData) {
...@@ -121,7 +121,7 @@ export default { ...@@ -121,7 +121,7 @@ export default {
operationItemIds: Array.isArray(operationItemList) ? operationItemList.map(el => el.operationItemId) : [], operationItemIds: Array.isArray(operationItemList) ? operationItemList.map(el => el.operationItemId) : [],
authItemId, authItemId,
authItemName, authItemName,
}) });
}, },
// 新建、编辑权限项弹窗关闭 // 新建、编辑权限项弹窗关闭
onEditAuthClose() { onEditAuthClose() {
...@@ -141,7 +141,7 @@ export default { ...@@ -141,7 +141,7 @@ export default {
authItemName: emojiToStr(authItemName), authItemName: emojiToStr(authItemName),
operationItemIds: operationItemIds.join(','), operationItemIds: operationItemIds.join(','),
menuId: this.menuId menuId: this.menuId
} };
this.editAuth.loading = true; this.editAuth.loading = true;
if (authItemId) { if (authItemId) {
params.authItemId = authItemId; params.authItemId = authItemId;
...@@ -154,7 +154,7 @@ export default { ...@@ -154,7 +154,7 @@ export default {
this.editAuth.show = false; this.editAuth.show = false;
this.getAuthItemList(); this.getAuthItemList();
} }
}) });
}, },
// 删除权限项 // 删除权限项
onDelAuth(authData) { onDelAuth(authData) {
...@@ -163,13 +163,13 @@ export default { ...@@ -163,13 +163,13 @@ export default {
delAuthItem({ authItemId }).then(res => { delAuthItem({ authItemId }).then(res => {
this.$message.success('删除成功!'); this.$message.success('删除成功!');
this.getAuthItemList(); this.getAuthItemList();
}) });
}) });
}, },
// 去操作项列表页 // 去操作项列表页
toOperationList() { toOperationList() {
this.$router.push(`/operation-list?type=${this.appType}`); this.$router.push(`/operation-list?type=${this.appType}`);
} }
} }
} };
</script> </script>
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