Showing
23 changed files
with
355 additions
and
333 deletions
| ... | @@ -207,7 +207,6 @@ export default { | ... | @@ -207,7 +207,6 @@ export default { |
| 207 | this.pageNum = this.page; | 207 | this.pageNum = this.page; |
| 208 | } | 208 | } |
| 209 | }, | 209 | }, |
| 210 | - mounted() {}, | ||
| 211 | methods: { | 210 | methods: { |
| 212 | nextClick() { | 211 | nextClick() { |
| 213 | this.$emit("currentChange", { | 212 | this.$emit("currentChange", { |
| ... | @@ -226,7 +225,7 @@ export default { | ... | @@ -226,7 +225,7 @@ export default { |
| 226 | currentChange(val) { | 225 | currentChange(val) { |
| 227 | this.$emit("currentChange", { | 226 | this.$emit("currentChange", { |
| 228 | page: val, | 227 | page: val, |
| 229 | - start: val > 1 ? (val-1) * this.limitSize + 1 : val, | 228 | + start: val > 1 ? (val-1) * this.limitSize + 1 : val, |
| 230 | }); | 229 | }); |
| 231 | scrollTo(0, 800); | 230 | scrollTo(0, 800); |
| 232 | }, | 231 | }, |
| ... | @@ -245,15 +244,15 @@ export default { | ... | @@ -245,15 +244,15 @@ export default { |
| 245 | } else if (selection.includes(this.data[row.index])) { | 244 | } else if (selection.includes(this.data[row.index])) { |
| 246 | if (!selection.includes(this.data[this.start])) { | 245 | if (!selection.includes(this.data[this.start])) { |
| 247 | this.$refs.tables.toggleRowSelection(this.data[this.start], true); | 246 | this.$refs.tables.toggleRowSelection(this.data[this.start], true); |
| 248 | - if(this.selectTable.includes(this.data[this.start])){ | 247 | + if (this.selectTable.includes(this.data[this.start])) { |
| 249 | this.selectTable.push(this.data[this.start]); | 248 | this.selectTable.push(this.data[this.start]); |
| 250 | } | 249 | } |
| 251 | } | 250 | } |
| 252 | for (i = min; i <= sum + min; i++) { | 251 | for (i = min; i <= sum + min; i++) { |
| 253 | this.$refs.tables.toggleRowSelection(this.data[i], true); | 252 | this.$refs.tables.toggleRowSelection(this.data[i], true); |
| 254 | - if(!this.selectTable.includes(this.data[i])){ | 253 | + if (!this.selectTable.includes(this.data[i])) { |
| 255 | this.selectTable.push(this.data[i]); | 254 | this.selectTable.push(this.data[i]); |
| 256 | - } | 255 | + } |
| 257 | } | 256 | } |
| 258 | } else if (!selection.includes(this.data[row.index])) { | 257 | } else if (!selection.includes(this.data[row.index])) { |
| 259 | this.selectTable.splice(min > 1 ? min - 2 : min, sum + 1); | 258 | this.selectTable.splice(min > 1 ? min - 2 : min, sum + 1); |
| ... | @@ -274,7 +273,7 @@ export default { | ... | @@ -274,7 +273,7 @@ export default { |
| 274 | } | 273 | } |
| 275 | } | 274 | } |
| 276 | } | 275 | } |
| 277 | - selection = this.selectTable.sort(this.compare('index','ascending')); | 276 | + selection = this.selectTable.sort(this.compare("index", "ascending")); |
| 278 | this.$emit("tableSelect", { selection, row }); | 277 | this.$emit("tableSelect", { selection, row }); |
| 279 | }, | 278 | }, |
| 280 | tableSelectAll(selection) { | 279 | tableSelectAll(selection) { | ... | ... |
| ... | @@ -22,11 +22,12 @@ | ... | @@ -22,11 +22,12 @@ |
| 22 | trigger="click" | 22 | trigger="click" |
| 23 | > | 23 | > |
| 24 | <div class="avatar-wrapper"> | 24 | <div class="avatar-wrapper"> |
| 25 | - <img :src="avatar" class="user-avatar" /> | 25 | + <img :src="avatar" class="user-avatar"> |
| 26 | </div> | 26 | </div> |
| 27 | <el-dropdown-menu slot="dropdown"> | 27 | <el-dropdown-menu slot="dropdown"> |
| 28 | - <!-- <el-dropdown-item @click.native.stop="drawer = true">个人中心</el-dropdown-item> --> | 28 | + <router-link to="/user/profile"> |
| 29 | - <el-dropdown-item @click.native="logout"> | 29 | + </router-link> |
| 30 | + <el-dropdown-item @click.native="logout"> | ||
| 30 | <span>退出登录</span> | 31 | <span>退出登录</span> |
| 31 | </el-dropdown-item> | 32 | </el-dropdown-item> |
| 32 | </el-dropdown-menu> | 33 | </el-dropdown-menu> | ... | ... |
| 1 | import router from './router' | 1 | import router from './router' |
| 2 | import store from './store' | 2 | import store from './store' |
| 3 | import { Message } from 'element-ui' | 3 | import { Message } from 'element-ui' |
| 4 | -//import NProgress from 'nprogress' | 4 | +import { getToken,setToken } from '@/utils/auth' |
| 5 | -//import 'nprogress/nprogress.css' | ||
| 6 | -import { getToken } from '@/utils/auth' | ||
| 7 | 5 | ||
| 8 | -//NProgress.configure({ showSpinner: false }) | ||
| 9 | 6 | ||
| 10 | const whiteList = ['/login', '/auth-redirect', '/bind', '/register'] | 7 | const whiteList = ['/login', '/auth-redirect', '/bind', '/register'] |
| 11 | 8 | ||
| 12 | router.beforeEach((to, from, next) => { | 9 | router.beforeEach((to, from, next) => { |
| 13 | - //NProgress.start() | ||
| 14 | if (getToken()) { | 10 | if (getToken()) { |
| 15 | /* has token*/ | 11 | /* has token*/ |
| 16 | if (to.path === '/login') { | 12 | if (to.path === '/login') { |
| 17 | next({ path: '/' }) | 13 | next({ path: '/' }) |
| 18 | - //NProgress.done() | ||
| 19 | } else { | 14 | } else { |
| 20 | if (store.getters.roles.length === 0) { | 15 | if (store.getters.roles.length === 0) { |
| 21 | // 判断当前用户是否已拉取完user_info信息 | 16 | // 判断当前用户是否已拉取完user_info信息 |
| ... | @@ -26,9 +21,10 @@ router.beforeEach((to, from, next) => { | ... | @@ -26,9 +21,10 @@ router.beforeEach((to, from, next) => { |
| 26 | next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 | 21 | next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 |
| 27 | }) | 22 | }) |
| 28 | }).catch(err => { | 23 | }).catch(err => { |
| 24 | + Message.error(err) | ||
| 29 | store.dispatch('LogOut').then(() => { | 25 | store.dispatch('LogOut').then(() => { |
| 30 | - Message.error(err) | 26 | + // next({ path: '/' }) |
| 31 | - next({ path: '/' }) | 27 | + window.location.href = "https://testsso.ute.apac.fedex.com/logout";//wsso系统跳转 |
| 32 | }) | 28 | }) |
| 33 | }) | 29 | }) |
| 34 | } else { | 30 | } else { |
| ... | @@ -37,16 +33,22 @@ router.beforeEach((to, from, next) => { | ... | @@ -37,16 +33,22 @@ router.beforeEach((to, from, next) => { |
| 37 | } | 33 | } |
| 38 | } else { | 34 | } else { |
| 39 | // 没有token | 35 | // 没有token |
| 40 | - if (whiteList.indexOf(to.path) !== -1) { | 36 | + //wsso登录时对后端重定向带来的token进行记录 |
| 41 | - // 在免登录白名单,直接进入 | 37 | + let token = location.search.split("token=")[1] |
| 42 | - next() | 38 | + if(token != undefined && token != '' && token != null){ |
| 43 | - } else { | 39 | + setToken(token) |
| 44 | - next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页 | 40 | + next({ path: '/' }) |
| 45 | - //NProgress.done() | 41 | + }else{ |
| 42 | + if (whiteList.indexOf(to.path) !== -1) { | ||
| 43 | + // 在免登录白名单,直接进入 | ||
| 44 | + next() | ||
| 45 | + } else { | ||
| 46 | + window.location.href = "https://testsso.ute.apac.fedex.com/logout";//wsso系统跳转 | ||
| 47 | + } | ||
| 46 | } | 48 | } |
| 49 | + | ||
| 47 | } | 50 | } |
| 48 | }) | 51 | }) |
| 49 | 52 | ||
| 50 | router.afterEach(() => { | 53 | router.afterEach(() => { |
| 51 | - //NProgress.done() | ||
| 52 | }) | 54 | }) | ... | ... |
| ... | @@ -5,178 +5,178 @@ | ... | @@ -5,178 +5,178 @@ |
| 5 | 5 | ||
| 6 | const baseURL = process.env.VUE_APP_BASE_API | 6 | const baseURL = process.env.VUE_APP_BASE_API |
| 7 | 7 | ||
| 8 | - // 日期格式化 | ||
| 9 | - export function parseTime(time, pattern) { | ||
| 10 | - //debugger | ||
| 11 | - if (arguments.length === 0 || !time) { | ||
| 12 | - return null | ||
| 13 | - } | ||
| 14 | - const format = pattern || '{y}-{m}-{d} {h}:{i}:{s}' | ||
| 15 | - let date | ||
| 16 | - if (typeof time === 'object') { | ||
| 17 | - date = time | ||
| 18 | - } else { | ||
| 19 | - if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) { | ||
| 20 | - time = parseInt(time) | ||
| 21 | - } else if (typeof time === 'string') { | ||
| 22 | - time = time.replace(new RegExp(/-/gm), '/'); | ||
| 23 | - } | ||
| 24 | - if ((typeof time === 'number') && (time.toString().length === 10)) { | ||
| 25 | - time = time * 1000 | ||
| 26 | - } | ||
| 27 | - date = new Date(time) | ||
| 28 | - } | ||
| 29 | - const formatObj = { | ||
| 30 | - y: date.getFullYear(), | ||
| 31 | - m: date.getMonth() + 1, | ||
| 32 | - d: date.getDate(), | ||
| 33 | - h: date.getHours(), | ||
| 34 | - i: date.getMinutes(), | ||
| 35 | - s: date.getSeconds(), | ||
| 36 | - a: date.getDay() | ||
| 37 | - } | ||
| 38 | - const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => { | ||
| 39 | - let value = formatObj[key] | ||
| 40 | - // Note: getDay() returns 0 on Sunday | ||
| 41 | - if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value] } | ||
| 42 | - if (result.length > 0 && value < 10) { | ||
| 43 | - value = '0' + value | ||
| 44 | - } | ||
| 45 | - return value || 0 | ||
| 46 | - }) | ||
| 47 | - return time_str | ||
| 48 | - } | ||
| 49 | - | ||
| 50 | - // 表单重置 | ||
| 51 | - export function resetForm(refName) { | ||
| 52 | - if (this.$refs[refName]) { | ||
| 53 | - this.$refs[refName].resetFields(); | ||
| 54 | - } | ||
| 55 | - } | ||
| 56 | - | ||
| 57 | - // 添加日期范围 | ||
| 58 | - export function addDateRange(params, dateRange, propName) { | ||
| 59 | - var search = params; | ||
| 60 | - search.params = {}; | ||
| 61 | - if (null != dateRange && '' != dateRange) { | ||
| 62 | - if (typeof (propName) === "undefined") { | ||
| 63 | - search.params["beginTime"] = dateRange[0]; | ||
| 64 | - search.params["endTime"] = dateRange[1]; | ||
| 65 | - } else { | ||
| 66 | - search.params["begin" + propName] = dateRange[0]; | ||
| 67 | - search.params["end" + propName] = dateRange[1]; | ||
| 68 | - } | ||
| 69 | - } | ||
| 70 | - return search; | ||
| 71 | - } | ||
| 72 | - | ||
| 73 | - // 回显数据字典 | ||
| 74 | - export function selectDictLabel(datas, value) { | ||
| 75 | - var actions = []; | ||
| 76 | - Object.keys(datas).some((key) => { | ||
| 77 | - if (datas[key].dictValue == ('' + value)) { | ||
| 78 | - actions.push(datas[key].dictLabel); | ||
| 79 | - return true; | ||
| 80 | - } | ||
| 81 | - }) | ||
| 82 | - return actions.join(''); | ||
| 83 | - } | ||
| 84 | - | ||
| 85 | - // 回显数据字典(字符串数组) | ||
| 86 | - export function selectDictLabels(datas, value, separator) { | ||
| 87 | - var actions = []; | ||
| 88 | - var currentSeparator = undefined === separator ? "," : separator; | ||
| 89 | - var temp = value.split(currentSeparator); | ||
| 90 | - Object.keys(value.split(currentSeparator)).some((val) => { | ||
| 91 | - Object.keys(datas).some((key) => { | ||
| 92 | - if (datas[key].dictValue == ('' + temp[val])) { | ||
| 93 | - actions.push(datas[key].dictLabel + currentSeparator); | ||
| 94 | - } | ||
| 95 | - }) | ||
| 96 | - }) | ||
| 97 | - return actions.join('').substring(0, actions.join('').length - 1); | ||
| 98 | - } | ||
| 99 | - | ||
| 100 | - // 通用下载方法 | ||
| 101 | - export function download(fileName) { | ||
| 102 | - window.location.href = baseURL + "/common/download?fileName=" + encodeURI(fileName) + "&delete=" + true; | ||
| 103 | - } | ||
| 104 | - | ||
| 105 | - // 字符串格式化(%s ) | ||
| 106 | - export function sprintf(str) { | ||
| 107 | - var args = arguments, flag = true, i = 1; | ||
| 108 | - str = str.replace(/%s/g, function () { | ||
| 109 | - var arg = args[i++]; | ||
| 110 | - if (typeof arg === 'undefined') { | ||
| 111 | - flag = false; | ||
| 112 | - return ''; | ||
| 113 | - } | ||
| 114 | - return arg; | ||
| 115 | - }); | ||
| 116 | - return flag ? str : ''; | ||
| 117 | - } | ||
| 118 | - | ||
| 119 | - // 转换字符串,undefined,null等转化为"" | ||
| 120 | - export function praseStrEmpty(str) { | ||
| 121 | - if (!str || str == "undefined" || str == "null") { | ||
| 122 | - return ""; | ||
| 123 | - } | ||
| 124 | - return str; | ||
| 125 | - } | ||
| 126 | - | ||
| 127 | - /** | ||
| 128 | - * 构造树型结构数据 | ||
| 129 | - * @param {*} data 数据源 | ||
| 130 | - * @param {*} id id字段 默认 'id' | ||
| 131 | - * @param {*} parentId 父节点字段 默认 'parentId' | ||
| 132 | - * @param {*} children 孩子节点字段 默认 'children' | ||
| 133 | - */ | ||
| 134 | - export function handleTree(data, id, parentId, children) { | ||
| 135 | - let config = { | ||
| 136 | - id: id || 'id', | ||
| 137 | - parentId: parentId || 'parentId', | ||
| 138 | - childrenList: children || 'children' | ||
| 139 | - }; | ||
| 140 | - | ||
| 141 | - var childrenListMap = {}; | ||
| 142 | - var nodeIds = {}; | ||
| 143 | - var tree = []; | ||
| 144 | - | ||
| 145 | - for (let d of data) { | ||
| 146 | - let parentId = d[config.parentId]; | ||
| 147 | - if (childrenListMap[parentId] == null) { | ||
| 148 | - childrenListMap[parentId] = []; | ||
| 149 | - } | ||
| 150 | - nodeIds[d[config.id]] = d; | ||
| 151 | - childrenListMap[parentId].push(d); | ||
| 152 | - } | ||
| 153 | - | ||
| 154 | - for (let d of data) { | ||
| 155 | - let parentId = d[config.parentId]; | ||
| 156 | - if (nodeIds[parentId] == null) { | ||
| 157 | - tree.push(d); | ||
| 158 | - } | ||
| 159 | - } | ||
| 160 | - | ||
| 161 | - for (let t of tree) { | ||
| 162 | - adaptToChildrenList(t); | ||
| 163 | - } | ||
| 164 | - | ||
| 165 | - function adaptToChildrenList(o) { | ||
| 166 | - if (childrenListMap[o[config.id]] !== null) { | ||
| 167 | - o[config.childrenList] = childrenListMap[o[config.id]]; | ||
| 168 | - } | ||
| 169 | - if (o[config.childrenList]) { | ||
| 170 | - for (let c of o[config.childrenList]) { | ||
| 171 | - adaptToChildrenList(c); | ||
| 172 | - } | ||
| 173 | - } | ||
| 174 | - } | ||
| 175 | - return tree; | ||
| 176 | - } | ||
| 177 | - | ||
| 178 | - //字符串英文转大写,;转英文; | ||
| 179 | - export function upCase(str){ | ||
| 180 | - let newStr = str.replace(/;/g,";").toUpperCase(); | ||
| 181 | - return newStr; | ||
| 182 | - } | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 8 | +// 日期格式化 | ||
| 9 | +export function parseTime(time, pattern) { | ||
| 10 | + debugger | ||
| 11 | + if (arguments.length === 0 || !time) { | ||
| 12 | + return null | ||
| 13 | + } | ||
| 14 | + const format = pattern || '{y}-{m}-{d} {h}:{i}:{s}' | ||
| 15 | + let date | ||
| 16 | + if (typeof time === 'object') { | ||
| 17 | + date = time | ||
| 18 | + } else { | ||
| 19 | + if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) { | ||
| 20 | + time = parseInt(time) | ||
| 21 | + } else if (typeof time === 'string') { | ||
| 22 | + time = time.replace(new RegExp(/-/gm), '/'); | ||
| 23 | + } | ||
| 24 | + if ((typeof time === 'number') && (time.toString().length === 10)) { | ||
| 25 | + time = time * 1000 | ||
| 26 | + } | ||
| 27 | + date = new Date(time) | ||
| 28 | + } | ||
| 29 | + const formatObj = { | ||
| 30 | + y: date.getFullYear(), | ||
| 31 | + m: date.getMonth() + 1, | ||
| 32 | + d: date.getDate(), | ||
| 33 | + h: date.getHours(), | ||
| 34 | + i: date.getMinutes(), | ||
| 35 | + s: date.getSeconds(), | ||
| 36 | + a: date.getDay() | ||
| 37 | + } | ||
| 38 | + const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => { | ||
| 39 | + let value = formatObj[key] | ||
| 40 | + // Note: getDay() returns 0 on Sunday | ||
| 41 | + if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value] } | ||
| 42 | + if (result.length > 0 && value < 10) { | ||
| 43 | + value = '0' + value | ||
| 44 | + } | ||
| 45 | + return value || 0 | ||
| 46 | + }) | ||
| 47 | + return time_str | ||
| 48 | +} | ||
| 49 | + | ||
| 50 | +// 表单重置 | ||
| 51 | +export function resetForm(refName) { | ||
| 52 | + if (this.$refs[refName]) { | ||
| 53 | + this.$refs[refName].resetFields(); | ||
| 54 | + } | ||
| 55 | +} | ||
| 56 | + | ||
| 57 | +// 添加日期范围 | ||
| 58 | +export function addDateRange(params, dateRange, propName) { | ||
| 59 | + var search = params; | ||
| 60 | + search.params = {}; | ||
| 61 | + if (null != dateRange && '' != dateRange) { | ||
| 62 | + if (typeof (propName) === "undefined") { | ||
| 63 | + search.params["beginTime"] = dateRange[0]; | ||
| 64 | + search.params["endTime"] = dateRange[1]; | ||
| 65 | + } else { | ||
| 66 | + search.params["begin" + propName] = dateRange[0]; | ||
| 67 | + search.params["end" + propName] = dateRange[1]; | ||
| 68 | + } | ||
| 69 | + } | ||
| 70 | + return search; | ||
| 71 | +} | ||
| 72 | + | ||
| 73 | +// 回显数据字典 | ||
| 74 | +export function selectDictLabel(datas, value) { | ||
| 75 | + var actions = []; | ||
| 76 | + Object.keys(datas).some((key) => { | ||
| 77 | + if (datas[key].dictValue == ('' + value)) { | ||
| 78 | + actions.push(datas[key].dictLabel); | ||
| 79 | + return true; | ||
| 80 | + } | ||
| 81 | + }) | ||
| 82 | + return actions.join(''); | ||
| 83 | +} | ||
| 84 | + | ||
| 85 | +// 回显数据字典(字符串数组) | ||
| 86 | +export function selectDictLabels(datas, value, separator) { | ||
| 87 | + var actions = []; | ||
| 88 | + var currentSeparator = undefined === separator ? "," : separator; | ||
| 89 | + var temp = value.split(currentSeparator); | ||
| 90 | + Object.keys(value.split(currentSeparator)).some((val) => { | ||
| 91 | + Object.keys(datas).some((key) => { | ||
| 92 | + if (datas[key].dictValue == ('' + temp[val])) { | ||
| 93 | + actions.push(datas[key].dictLabel + currentSeparator); | ||
| 94 | + } | ||
| 95 | + }) | ||
| 96 | + }) | ||
| 97 | + return actions.join('').substring(0, actions.join('').length - 1); | ||
| 98 | +} | ||
| 99 | + | ||
| 100 | +// 通用下载方法 | ||
| 101 | +export function download(fileName) { | ||
| 102 | + window.location.href = baseURL + "/common/download?fileName=" + encodeURI(fileName) + "&delete=" + true; | ||
| 103 | +} | ||
| 104 | + | ||
| 105 | +// 字符串格式化(%s ) | ||
| 106 | +export function sprintf(str) { | ||
| 107 | + var args = arguments, flag = true, i = 1; | ||
| 108 | + str = str.replace(/%s/g, function () { | ||
| 109 | + var arg = args[i++]; | ||
| 110 | + if (typeof arg === 'undefined') { | ||
| 111 | + flag = false; | ||
| 112 | + return ''; | ||
| 113 | + } | ||
| 114 | + return arg; | ||
| 115 | + }); | ||
| 116 | + return flag ? str : ''; | ||
| 117 | +} | ||
| 118 | + | ||
| 119 | +// 转换字符串,undefined,null等转化为"" | ||
| 120 | +export function praseStrEmpty(str) { | ||
| 121 | + if (!str || str == "undefined" || str == "null") { | ||
| 122 | + return ""; | ||
| 123 | + } | ||
| 124 | + return str; | ||
| 125 | +} | ||
| 126 | + | ||
| 127 | +/** | ||
| 128 | + * 构造树型结构数据 | ||
| 129 | + * @param {*} data 数据源 | ||
| 130 | + * @param {*} id id字段 默认 'id' | ||
| 131 | + * @param {*} parentId 父节点字段 默认 'parentId' | ||
| 132 | + * @param {*} children 孩子节点字段 默认 'children' | ||
| 133 | + */ | ||
| 134 | +export function handleTree(data, id, parentId, children) { | ||
| 135 | + let config = { | ||
| 136 | + id: id || 'id', | ||
| 137 | + parentId: parentId || 'parentId', | ||
| 138 | + childrenList: children || 'children' | ||
| 139 | + }; | ||
| 140 | + | ||
| 141 | + var childrenListMap = {}; | ||
| 142 | + var nodeIds = {}; | ||
| 143 | + var tree = []; | ||
| 144 | + | ||
| 145 | + for (let d of data) { | ||
| 146 | + let parentId = d[config.parentId]; | ||
| 147 | + if (childrenListMap[parentId] == null) { | ||
| 148 | + childrenListMap[parentId] = []; | ||
| 149 | + } | ||
| 150 | + nodeIds[d[config.id]] = d; | ||
| 151 | + childrenListMap[parentId].push(d); | ||
| 152 | + } | ||
| 153 | + | ||
| 154 | + for (let d of data) { | ||
| 155 | + let parentId = d[config.parentId]; | ||
| 156 | + if (nodeIds[parentId] == null) { | ||
| 157 | + tree.push(d); | ||
| 158 | + } | ||
| 159 | + } | ||
| 160 | + | ||
| 161 | + for (let t of tree) { | ||
| 162 | + adaptToChildrenList(t); | ||
| 163 | + } | ||
| 164 | + | ||
| 165 | + function adaptToChildrenList(o) { | ||
| 166 | + if (childrenListMap[o[config.id]] !== null) { | ||
| 167 | + o[config.childrenList] = childrenListMap[o[config.id]]; | ||
| 168 | + } | ||
| 169 | + if (o[config.childrenList]) { | ||
| 170 | + for (let c of o[config.childrenList]) { | ||
| 171 | + adaptToChildrenList(c); | ||
| 172 | + } | ||
| 173 | + } | ||
| 174 | + } | ||
| 175 | + return tree; | ||
| 176 | +} | ||
| 177 | + | ||
| 178 | +//字符串英文转大写,;转英文; | ||
| 179 | +export function upCase(str){ | ||
| 180 | + let newStr = str.replace(/;/g,";").toUpperCase().trim(); | ||
| 181 | + return newStr; | ||
| 182 | +} | ... | ... |
| 1 | import axios from 'axios' | 1 | import axios from 'axios' |
| 2 | -import { Message, MessageBox } from 'element-ui' | 2 | +import { Message,MessageBox } from 'element-ui' |
| 3 | import store from '@/store' | 3 | import store from '@/store' |
| 4 | -import { getToken, setToken } from '@/utils/auth' | 4 | +import { getToken,setToken } from '@/utils/auth' |
| 5 | import errorCode from '@/utils/errorCode' | 5 | import errorCode from '@/utils/errorCode' |
| 6 | 6 | ||
| 7 | axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8' | 7 | axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8' |
| ... | @@ -54,7 +54,7 @@ service.interceptors.request.use(config => { | ... | @@ -54,7 +54,7 @@ service.interceptors.request.use(config => { |
| 54 | // 响应拦截器 | 54 | // 响应拦截器 |
| 55 | service.interceptors.response.use(res => { | 55 | service.interceptors.response.use(res => { |
| 56 | if(res.headers['token']){ | 56 | if(res.headers['token']){ |
| 57 | - setToken(decodeURI(res.headers['token'])) | 57 | + setToken(decodeURIComponent(res.headers['token'])) |
| 58 | } | 58 | } |
| 59 | // 未设置状态码则默认成功状态 | 59 | // 未设置状态码则默认成功状态 |
| 60 | const code = res.data.code || 200; | 60 | const code = res.data.code || 200; |
| ... | @@ -81,7 +81,7 @@ service.interceptors.response.use(res => { | ... | @@ -81,7 +81,7 @@ service.interceptors.response.use(res => { |
| 81 | type: 'error' | 81 | type: 'error' |
| 82 | }) | 82 | }) |
| 83 | return Promise.reject(new Error(msg)) | 83 | return Promise.reject(new Error(msg)) |
| 84 | - } else if (code !== 200 && code !== 201 && code !== 202) { | 84 | + } else if (code !== 200 && code !== 201 && code !== 202 && code !== 603) { |
| 85 | Message({ | 85 | Message({ |
| 86 | message: msg, | 86 | message: msg, |
| 87 | type: 'error' | 87 | type: 'error' | ... | ... |
This diff is collapsed. Click to expand it.
| ... | @@ -119,7 +119,7 @@ export default { | ... | @@ -119,7 +119,7 @@ export default { |
| 119 | }, | 119 | }, |
| 120 | ], | 120 | ], |
| 121 | }, | 121 | }, |
| 122 | - loading:false, | 122 | + loading:false |
| 123 | }; | 123 | }; |
| 124 | }, | 124 | }, |
| 125 | methods: { | 125 | methods: { |
| ... | @@ -133,7 +133,7 @@ export default { | ... | @@ -133,7 +133,7 @@ export default { |
| 133 | }, | 133 | }, |
| 134 | //确定配舱 | 134 | //确定配舱 |
| 135 | submit() { | 135 | submit() { |
| 136 | - this.loading= true; | 136 | + this.loading = true; |
| 137 | let arr = []; | 137 | let arr = []; |
| 138 | this.tableData.forEach((item) => { | 138 | this.tableData.forEach((item) => { |
| 139 | arr.push(item.id); | 139 | arr.push(item.id); | ... | ... |
| ... | @@ -13,10 +13,11 @@ | ... | @@ -13,10 +13,11 @@ |
| 13 | v-model.trim="purposeOfFlightNo" | 13 | v-model.trim="purposeOfFlightNo" |
| 14 | placeholder="航班号" | 14 | placeholder="航班号" |
| 15 | @keyup.enter.native="getList" | 15 | @keyup.enter.native="getList" |
| 16 | + clearable | ||
| 16 | ></el-input> | 17 | ></el-input> |
| 17 | </el-form-item> | 18 | </el-form-item> |
| 18 | <el-form-item label="状态"> | 19 | <el-form-item label="状态"> |
| 19 | - <el-select v-model="queryParams.status" placeholder="状态"> | 20 | + <el-select v-model="queryParams.status" placeholder="状态" clearable> |
| 20 | <el-option label="有效" value="1"></el-option> | 21 | <el-option label="有效" value="1"></el-option> |
| 21 | <el-option label="停用" value="3"></el-option> | 22 | <el-option label="停用" value="3"></el-option> |
| 22 | </el-select> | 23 | </el-select> |
| ... | @@ -36,12 +37,25 @@ | ... | @@ -36,12 +37,25 @@ |
| 36 | type="primary" | 37 | type="primary" |
| 37 | icon="el-icon-plus" | 38 | icon="el-icon-plus" |
| 38 | size="mini" | 39 | size="mini" |
| 39 | - @click="$router.push({ name: 'FlightAllocConfigAdd', params: { handle: 'add' } })" | 40 | + @click=" |
| 41 | + $router.push({ | ||
| 42 | + name: 'FlightAllocConfigAdd', | ||
| 43 | + params: { handle: 'add' }, | ||
| 44 | + }) | ||
| 45 | + " | ||
| 40 | >添加</el-button | 46 | >添加</el-button |
| 41 | > | 47 | > |
| 42 | </div> | 48 | </div> |
| 43 | </el-form> | 49 | </el-form> |
| 44 | - <el-table :data="flyList" v-loading="loading" size="small" highlight-current-row border stripe> | 50 | + |
| 51 | + <el-table | ||
| 52 | + :data="flyList" | ||
| 53 | + v-loading="loading" | ||
| 54 | + size="small" | ||
| 55 | + highlight-current-row | ||
| 56 | + border | ||
| 57 | + stripe | ||
| 58 | + > | ||
| 45 | <el-table-column | 59 | <el-table-column |
| 46 | prop="purposeOfFlightNo" | 60 | prop="purposeOfFlightNo" |
| 47 | label="航班号" | 61 | label="航班号" |
| ... | @@ -128,15 +142,13 @@ import { | ... | @@ -128,15 +142,13 @@ import { |
| 128 | enableOrDisable, | 142 | enableOrDisable, |
| 129 | } from "@/api/destinationFlight"; | 143 | } from "@/api/destinationFlight"; |
| 130 | 144 | ||
| 131 | -import { parseTime } from "@/utils/FedEx"; | ||
| 132 | - | ||
| 133 | export default { | 145 | export default { |
| 134 | - name:"FlightAllocConfig", | 146 | + name: "FlightAllocConfig", |
| 135 | data() { | 147 | data() { |
| 136 | return { | 148 | return { |
| 137 | queryParams: { | 149 | queryParams: { |
| 138 | purposeOfFlightNo: "", | 150 | purposeOfFlightNo: "", |
| 139 | - status:"1", | 151 | + status: "1", |
| 140 | start: 0, | 152 | start: 0, |
| 141 | limit: 10, | 153 | limit: 10, |
| 142 | }, | 154 | }, |
| ... | @@ -194,18 +206,17 @@ export default { | ... | @@ -194,18 +206,17 @@ export default { |
| 194 | cancelButtonText: "取消", | 206 | cancelButtonText: "取消", |
| 195 | showCancelButton: true, | 207 | showCancelButton: true, |
| 196 | type: "warning", | 208 | type: "warning", |
| 197 | - }) | 209 | + }).then(() => { |
| 198 | - .then(()=> { | 210 | + delFlightId(id) |
| 199 | - delFlightId(id) | ||
| 200 | .then((res) => { | 211 | .then((res) => { |
| 201 | this.$message({ | 212 | this.$message({ |
| 202 | message: res.msg, | 213 | message: res.msg, |
| 203 | type: res.code === 200 ? "success" : "warning", | 214 | type: res.code === 200 ? "success" : "warning", |
| 204 | }); | 215 | }); |
| 205 | - this.getList() | 216 | + this.getList(); |
| 206 | }) | 217 | }) |
| 207 | .catch(() => {}); | 218 | .catch(() => {}); |
| 208 | - }) | 219 | + }); |
| 209 | } | 220 | } |
| 210 | }, | 221 | }, |
| 211 | //启用,停用 | 222 | //启用,停用 |
| ... | @@ -215,9 +226,9 @@ export default { | ... | @@ -215,9 +226,9 @@ export default { |
| 215 | confirmButtonText: "确定", | 226 | confirmButtonText: "确定", |
| 216 | cancelButtonText: "取消", | 227 | cancelButtonText: "取消", |
| 217 | type: "warning", | 228 | type: "warning", |
| 218 | - }) | 229 | + }).then(() => { |
| 219 | - .then(()=> { | 230 | + enableOrDisable(id, status) |
| 220 | - enableOrDisable(id, status).then((res) => { | 231 | + .then((res) => { |
| 221 | if (res.code != 200) { | 232 | if (res.code != 200) { |
| 222 | this.msgError(res.msg); | 233 | this.msgError(res.msg); |
| 223 | } else { | 234 | } else { |
| ... | @@ -225,23 +236,23 @@ export default { | ... | @@ -225,23 +236,23 @@ export default { |
| 225 | this.msgSuccess(tip + "成功"); | 236 | this.msgSuccess(tip + "成功"); |
| 226 | } | 237 | } |
| 227 | }) | 238 | }) |
| 228 | - .catch(()=> {}); | 239 | + .catch(() => {}); |
| 229 | - }) | 240 | + }); |
| 230 | }, | 241 | }, |
| 231 | }, | 242 | }, |
| 232 | created() { | 243 | created() { |
| 233 | this.getList(); | 244 | this.getList(); |
| 234 | }, | 245 | }, |
| 235 | - computed:{ | 246 | + computed: { |
| 236 | purposeOfFlightNo: { | 247 | purposeOfFlightNo: { |
| 237 | get: function () { | 248 | get: function () { |
| 238 | return this.queryParams.purposeOfFlightNo; | 249 | return this.queryParams.purposeOfFlightNo; |
| 239 | }, | 250 | }, |
| 240 | set: function (val) { | 251 | set: function (val) { |
| 241 | - this.queryParams.purposeOfFlightNo = val.toUpperCase() | 252 | + this.queryParams.purposeOfFlightNo = val.toUpperCase(); |
| 242 | }, | 253 | }, |
| 243 | }, | 254 | }, |
| 244 | - } | 255 | + }, |
| 245 | }; | 256 | }; |
| 246 | </script> | 257 | </script> |
| 247 | 258 | ... | ... |
| ... | @@ -503,10 +503,28 @@ export default { | ... | @@ -503,10 +503,28 @@ export default { |
| 503 | 503 | ||
| 504 | created() { | 504 | created() { |
| 505 | let handle = this.$route.params.handle; | 505 | let handle = this.$route.params.handle; |
| 506 | + allDictData().then((response) => { | ||
| 507 | + if (response.code != 200) { | ||
| 508 | + this.$message({ | ||
| 509 | + showClose: true, | ||
| 510 | + message: response.msg, | ||
| 511 | + type: "error", | ||
| 512 | + }); | ||
| 513 | + return; | ||
| 514 | + } | ||
| 515 | + let dict = response.data; | ||
| 516 | + this.cargoType = dict.cargoType; | ||
| 517 | + this.cargoStatus = dict.cargoStatus; | ||
| 518 | + this.serviceCode = dict.serviceCode.sort((a, b) => | ||
| 519 | + a.englishName.localeCompare(b.englishName) | ||
| 520 | + ); | ||
| 521 | + | ||
| 522 | + this.handlingCode = this.sorttodo(dict.handlingCode, "BLANK"); | ||
| 523 | + this.subCategory = dict.subCategory; | ||
| 524 | + }); | ||
| 506 | this.routeName = this.$route.name; | 525 | this.routeName = this.$route.name; |
| 507 | this.dataId = this.$route.params.id; | 526 | this.dataId = this.$route.params.id; |
| 508 | this.handleName = this.$route.params.handle; | 527 | this.handleName = this.$route.params.handle; |
| 509 | - this.dictData() | ||
| 510 | if (handle === "detail") { | 528 | if (handle === "detail") { |
| 511 | this.disable = true; | 529 | this.disable = true; |
| 512 | } | 530 | } | ... | ... |
This diff is collapsed. Click to expand it.
| 1 | <template> | 1 | <template> |
| 2 | - <div> | 2 | + <div class="app-container"> |
| 3 | - <el-form class="form-header" :model="queryParams" label-position="right" label-width="auto" size="medium"> | 3 | + <el-form |
| 4 | + class="form-header" | ||
| 5 | + :model="queryParams" | ||
| 6 | + label-position="right" | ||
| 7 | + label-width="auto" | ||
| 8 | + size="medium" | ||
| 9 | + > | ||
| 4 | <el-row> | 10 | <el-row> |
| 5 | <el-col :span="6"> | 11 | <el-col :span="6"> |
| 6 | <el-form-item label="航班日期从" prop="fltDateStart"> | 12 | <el-form-item label="航班日期从" prop="fltDateStart"> |
| ... | @@ -87,27 +93,26 @@ | ... | @@ -87,27 +93,26 @@ |
| 87 | </el-switch> | 93 | </el-switch> |
| 88 | </el-col> | 94 | </el-col> |
| 89 | </el-row> | 95 | </el-row> |
| 90 | - <div style="margin-top:25px"> | 96 | + <div style="margin-top: 25px"> |
| 91 | - <el-button | 97 | + <el-button |
| 92 | - type="primary" | 98 | + type="primary" |
| 93 | - icon="el-icon-search" | 99 | + icon="el-icon-search" |
| 94 | - size="mini" | 100 | + size="mini" |
| 95 | - @click="handleQuery" | 101 | + @click="handleQuery" |
| 96 | - >搜索</el-button | 102 | + >搜索</el-button |
| 97 | - > | 103 | + > |
| 98 | - <el-button | 104 | + <el-button |
| 99 | - type="warning" | 105 | + type="warning" |
| 100 | - :disabled="tableData.length == 0" | 106 | + :disabled="tableData.length == 0" |
| 101 | - @click="xlse()" | 107 | + @click="xlse()" |
| 102 | - :loading="downLoadingTip.downloading" | 108 | + :loading="downLoadingTip.downloading" |
| 103 | - icon="el-icon-download" | 109 | + icon="el-icon-download" |
| 104 | - size="mini" | 110 | + size="mini" |
| 105 | - >{{ | 111 | + >{{ |
| 106 | - downLoadingTip.downloading ? downLoadingTip.tip : "导出" | 112 | + downLoadingTip.downloading ? downLoadingTip.tip : "导出" |
| 107 | - }}</el-button | 113 | + }}</el-button |
| 108 | - > | 114 | + > |
| 109 | </div> | 115 | </div> |
| 110 | - | ||
| 111 | </el-form> | 116 | </el-form> |
| 112 | 117 | ||
| 113 | <el-table | 118 | <el-table |
| ... | @@ -122,23 +127,27 @@ | ... | @@ -122,23 +127,27 @@ |
| 122 | label="运单号" | 127 | label="运单号" |
| 123 | align="center" | 128 | align="center" |
| 124 | prop="waybillNo" | 129 | prop="waybillNo" |
| 130 | + width="150" | ||
| 125 | /> | 131 | /> |
| 126 | <el-table-column | 132 | <el-table-column |
| 127 | :show-overflow-tooltip="true" | 133 | :show-overflow-tooltip="true" |
| 128 | label="品牌描述" | 134 | label="品牌描述" |
| 129 | align="center" | 135 | align="center" |
| 130 | prop="nameDescription" | 136 | prop="nameDescription" |
| 137 | + width="150" | ||
| 131 | /> | 138 | /> |
| 132 | <el-table-column | 139 | <el-table-column |
| 133 | label="航班日期" | 140 | label="航班日期" |
| 134 | align="center" | 141 | align="center" |
| 135 | prop="fltDate" | 142 | prop="fltDate" |
| 143 | + width="150" | ||
| 136 | /> | 144 | /> |
| 137 | - <el-table-column label="航班号" align="center" prop="fltNo" width="100"/> | 145 | + <el-table-column label="航班号" align="center" prop="fltNo" /> |
| 138 | <el-table-column | 146 | <el-table-column |
| 139 | label="航班路线" | 147 | label="航班路线" |
| 140 | align="center" | 148 | align="center" |
| 141 | prop="route" | 149 | prop="route" |
| 150 | + width="150" | ||
| 142 | /> | 151 | /> |
| 143 | <el-table-column | 152 | <el-table-column |
| 144 | label="配置航班类型" | 153 | label="配置航班类型" |
| ... | @@ -146,9 +155,9 @@ | ... | @@ -146,9 +155,9 @@ |
| 146 | prop="kindName" | 155 | prop="kindName" |
| 147 | width="130" | 156 | width="130" |
| 148 | /> | 157 | /> |
| 149 | - <el-table-column label="尺寸" align="center" prop="sizeStr" width="70"/> | 158 | + <el-table-column label="尺寸" align="center" prop="sizeStr" /> |
| 150 | - <el-table-column label="件数" align="center" prop="qty" width="70"/> | 159 | + <el-table-column label="件数" align="center" prop="qty" /> |
| 151 | - <el-table-column label="实际重量" align="center" prop="actualWeight" width="100"/> | 160 | + <el-table-column label="实际重量" align="center" prop="actualWeight" /> |
| 152 | <el-table-column | 161 | <el-table-column |
| 153 | label="创建时间" | 162 | label="创建时间" |
| 154 | align="center" | 163 | align="center" |
| ... | @@ -255,12 +264,6 @@ export default { | ... | @@ -255,12 +264,6 @@ export default { |
| 255 | this.tableData = response.data.list; | 264 | this.tableData = response.data.list; |
| 256 | this.total = response.data.totalCount; | 265 | this.total = response.data.totalCount; |
| 257 | this.loading = false; | 266 | this.loading = false; |
| 258 | - if(response.data.list.length == 0){ | ||
| 259 | - this.$message({ | ||
| 260 | - message: "未查询到数据", | ||
| 261 | - type: "warning", | ||
| 262 | - }); | ||
| 263 | - } | ||
| 264 | } else { | 267 | } else { |
| 265 | this.msgError(response.msg); | 268 | this.msgError(response.msg); |
| 266 | } | 269 | } | ... | ... |
| ... | @@ -81,7 +81,6 @@ | ... | @@ -81,7 +81,6 @@ |
| 81 | uploadExcel(option) { | 81 | uploadExcel(option) { |
| 82 | //上传excel | 82 | //上传excel |
| 83 | const file = option.file; | 83 | const file = option.file; |
| 84 | - console.log(option); | ||
| 85 | this.loading=true; | 84 | this.loading=true; |
| 86 | importcaPreReview(file, this.form.type).then((res) => { | 85 | importcaPreReview(file, this.form.type).then((res) => { |
| 87 | this.loading=false; | 86 | this.loading=false; | ... | ... |
| ... | @@ -72,7 +72,7 @@ import { | ... | @@ -72,7 +72,7 @@ import { |
| 72 | importFlight, | 72 | importFlight, |
| 73 | } from "@/api/flightInfoImport"; | 73 | } from "@/api/flightInfoImport"; |
| 74 | export default { | 74 | export default { |
| 75 | - name:"FlightInformationImport", | 75 | + name: "FlightInformationImport", |
| 76 | data() { | 76 | data() { |
| 77 | return { | 77 | return { |
| 78 | flightType: [], | 78 | flightType: [], |
| ... | @@ -125,15 +125,14 @@ export default { | ... | @@ -125,15 +125,14 @@ export default { |
| 125 | uploadExcel(option) { | 125 | uploadExcel(option) { |
| 126 | //上传excel | 126 | //上传excel |
| 127 | const file = option.file; | 127 | const file = option.file; |
| 128 | - console.log(option); | ||
| 129 | importFlight(file, this.form.type).then((res) => { | 128 | importFlight(file, this.form.type).then((res) => { |
| 130 | if (res.code != 200) { | 129 | if (res.code != 200) { |
| 131 | if (res.code == 603) { | 130 | if (res.code == 603) { |
| 132 | - this.$alert(res.msg , "提示", { | 131 | + this.$alert(res.msg, "提示", { |
| 133 | confirmButtonText: "确定", | 132 | confirmButtonText: "确定", |
| 134 | type: "warning", | 133 | type: "warning", |
| 135 | }); | 134 | }); |
| 136 | - }else { | 135 | + } else { |
| 137 | this.$message.error(res.msg); | 136 | this.$message.error(res.msg); |
| 138 | this.tableData = res.data; | 137 | this.tableData = res.data; |
| 139 | } | 138 | } |
| ... | @@ -172,13 +171,6 @@ export default { | ... | @@ -172,13 +171,6 @@ export default { |
| 172 | }, | 171 | }, |
| 173 | }; | 172 | }; |
| 174 | </script> | 173 | </script> |
| 175 | -<style rel="stylesheet/scss" lang="scss"> | 174 | + |
| 176 | -.upload-demo { | 175 | +<style> |
| 177 | - float: right; | ||
| 178 | -} | ||
| 179 | -.el-upload-list { | ||
| 180 | - display: inline-block; | ||
| 181 | - margin-left: 10px; | ||
| 182 | - vertical-align: top; | ||
| 183 | -} | ||
| 184 | </style> | 176 | </style> |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
| 1 | <template> | 1 | <template> |
| 2 | <div class="login"> | 2 | <div class="login"> |
| 3 | - <el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form"> | 3 | + <el-form |
| 4 | + ref="loginForm" | ||
| 5 | + :model="loginForm" | ||
| 6 | + :rules="loginRules" | ||
| 7 | + class="login-form" | ||
| 8 | + > | ||
| 4 | <h3 class="title">IMAC后台管理系统</h3> | 9 | <h3 class="title">IMAC后台管理系统</h3> |
| 5 | <el-form-item prop="username"> | 10 | <el-form-item prop="username"> |
| 6 | - <el-input v-model="loginForm.username" type="text" auto-complete="off" placeholder="账号"> | 11 | + <el-input |
| 7 | - <svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" /> | 12 | + v-model="loginForm.username" |
| 13 | + type="text" | ||
| 14 | + auto-complete="off" | ||
| 15 | + placeholder="账号" | ||
| 16 | + > | ||
| 17 | + <svg-icon | ||
| 18 | + slot="prefix" | ||
| 19 | + icon-class="user" | ||
| 20 | + class="el-input__icon input-icon" | ||
| 21 | + /> | ||
| 8 | </el-input> | 22 | </el-input> |
| 9 | </el-form-item> | 23 | </el-form-item> |
| 10 | <el-form-item prop="password"> | 24 | <el-form-item prop="password"> |
| ... | @@ -15,17 +29,20 @@ | ... | @@ -15,17 +29,20 @@ |
| 15 | placeholder="密码" | 29 | placeholder="密码" |
| 16 | @keyup.enter.native="handleLogin" | 30 | @keyup.enter.native="handleLogin" |
| 17 | > | 31 | > |
| 18 | - <svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" /> | 32 | + <svg-icon |
| 33 | + slot="prefix" | ||
| 34 | + icon-class="password" | ||
| 35 | + class="el-input__icon input-icon" | ||
| 36 | + /> | ||
| 19 | </el-input> | 37 | </el-input> |
| 20 | </el-form-item> | 38 | </el-form-item> |
| 21 | - | ||
| 22 | <!-- <el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">记住密码</el-checkbox> --> | 39 | <!-- <el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">记住密码</el-checkbox> --> |
| 23 | - <el-form-item style="width:100%;marginTop:44px"> | 40 | + <el-form-item style="width: 100%; marginTop: 44px"> |
| 24 | <el-button | 41 | <el-button |
| 25 | :loading="loading" | 42 | :loading="loading" |
| 26 | size="medium" | 43 | size="medium" |
| 27 | type="primary" | 44 | type="primary" |
| 28 | - style="width:100%;" | 45 | + style="width: 100%" |
| 29 | @click.native.prevent="handleLogin" | 46 | @click.native.prevent="handleLogin" |
| 30 | > | 47 | > |
| 31 | <span v-if="!loading">登 录</span> | 48 | <span v-if="!loading">登 录</span> |
| ... | @@ -43,7 +60,7 @@ | ... | @@ -43,7 +60,7 @@ |
| 43 | <script> | 60 | <script> |
| 44 | import { getCodeImg } from "@/api/login"; | 61 | import { getCodeImg } from "@/api/login"; |
| 45 | //import Cookies from "js-cookie"; | 62 | //import Cookies from "js-cookie"; |
| 46 | -import { encrypt, } from '@/utils/jsencrypt' | 63 | +import { encrypt } from "@/utils/jsencrypt"; |
| 47 | 64 | ||
| 48 | export default { | 65 | export default { |
| 49 | name: "Login", | 66 | name: "Login", |
| ... | @@ -54,18 +71,18 @@ export default { | ... | @@ -54,18 +71,18 @@ export default { |
| 54 | loginForm: { | 71 | loginForm: { |
| 55 | username: "root", | 72 | username: "root", |
| 56 | password: "123", | 73 | password: "123", |
| 57 | - rememberMe: false | 74 | + rememberMe: false, |
| 58 | }, | 75 | }, |
| 59 | loginRules: { | 76 | loginRules: { |
| 60 | username: [ | 77 | username: [ |
| 61 | - { required: true, trigger: "blur", message: "用户名不能为空" } | 78 | + { required: true, trigger: "blur", message: "用户名不能为空" }, |
| 62 | ], | 79 | ], |
| 63 | password: [ | 80 | password: [ |
| 64 | - { required: true, trigger: "blur", message: "密码不能为空" } | 81 | + { required: true, trigger: "blur", message: "密码不能为空" }, |
| 65 | - ] | 82 | + ], |
| 66 | }, | 83 | }, |
| 67 | loading: false, | 84 | loading: false, |
| 68 | - redirect: undefined | 85 | + redirect: undefined, |
| 69 | }; | 86 | }; |
| 70 | }, | 87 | }, |
| 71 | watch: { | 88 | watch: { |
| ... | @@ -75,46 +92,53 @@ export default { | ... | @@ -75,46 +92,53 @@ export default { |
| 75 | }, | 92 | }, |
| 76 | immediate: true | 93 | immediate: true |
| 77 | } | 94 | } |
| 78 | - }, | 95 | + }, |
| 79 | created() { | 96 | created() { |
| 80 | - | ||
| 81 | this.getCookie(); | 97 | this.getCookie(); |
| 82 | }, | 98 | }, |
| 83 | methods: { | 99 | methods: { |
| 84 | - | ||
| 85 | getCookie() { | 100 | getCookie() { |
| 86 | const username = localStorage.getItem("username"); | 101 | const username = localStorage.getItem("username"); |
| 87 | const password = localStorage.getItem("password"); | 102 | const password = localStorage.getItem("password"); |
| 88 | - const rememberMe = localStorage.getItem('rememberMe') | 103 | + const rememberMe = localStorage.getItem("rememberMe"); |
| 89 | this.loginForm = { | 104 | this.loginForm = { |
| 90 | username: username === undefined ? this.loginForm.username : username, | 105 | username: username === undefined ? this.loginForm.username : username, |
| 91 | password: password === undefined ? this.loginForm.password : password, | 106 | password: password === undefined ? this.loginForm.password : password, |
| 92 | - rememberMe: rememberMe === undefined ? false : Boolean(rememberMe) | 107 | + rememberMe: rememberMe === undefined ? false : Boolean(rememberMe), |
| 93 | }; | 108 | }; |
| 94 | }, | 109 | }, |
| 95 | handleLogin() { | 110 | handleLogin() { |
| 96 | - this.$refs.loginForm.validate(valid => { | 111 | + this.$refs.loginForm.validate((valid) => { |
| 97 | if (valid) { | 112 | if (valid) { |
| 98 | this.loading = true; | 113 | this.loading = true; |
| 99 | if (this.loginForm.rememberMe) { | 114 | if (this.loginForm.rememberMe) { |
| 100 | - localStorage.setItem("username", this.loginForm.username, { expires: 30 }); | 115 | + localStorage.setItem("username", this.loginForm.username, { |
| 101 | - localStorage.setItem("password", this.loginForm.password, { expires: 30 }); | 116 | + expires: 30, |
| 102 | - localStorage.setItem('rememberMe', this.loginForm.rememberMe, { expires: 30 }); | 117 | + }); |
| 118 | + localStorage.setItem("password", this.loginForm.password, { | ||
| 119 | + expires: 30, | ||
| 120 | + }); | ||
| 121 | + localStorage.setItem("rememberMe", this.loginForm.rememberMe, { | ||
| 122 | + expires: 30, | ||
| 123 | + }); | ||
| 103 | } else { | 124 | } else { |
| 104 | localStorage.removeItem("username"); | 125 | localStorage.removeItem("username"); |
| 105 | localStorage.removeItem("password"); | 126 | localStorage.removeItem("password"); |
| 106 | - localStorage.removeItem('rememberMe'); | 127 | + localStorage.removeItem("rememberMe"); |
| 107 | } | 128 | } |
| 108 | - this.$store.dispatch("Login", this.loginForm).then(() => { | 129 | + this.$store |
| 109 | - this.$router.push({ path: this.redirect || "/" }).catch(()=>{}); | 130 | + .dispatch("Login", this.loginForm) |
| 110 | - }).catch(() => { | 131 | + .then(() => { |
| 111 | - this.loading = false; | 132 | + this.$router.push({ path: this.redirect || "/" }).catch(() => {}); |
| 112 | - //this.getCode(); | 133 | + }) |
| 113 | - }); | 134 | + .catch(() => { |
| 135 | + this.loading = false; | ||
| 136 | + //this.getCode(); | ||
| 137 | + }); | ||
| 114 | } | 138 | } |
| 115 | }); | 139 | }); |
| 116 | - } | 140 | + }, |
| 117 | - } | 141 | + }, |
| 118 | }; | 142 | }; |
| 119 | </script> | 143 | </script> |
| 120 | 144 | ... | ... |
-
Please register or login to post a comment