diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 77dd96b..e5eebc1 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -7,7 +7,8 @@ import { import { getToken, setToken, - removeToken + removeToken, + removeWzglUser } from '@/utils/auth' import { resetRouter @@ -139,7 +140,8 @@ const actions = { console.log("logout",state.token) logout(state.token).then(() => { removeToken() // must remove token first - resetRouter() + resetRouter() + removeWzglUser() commit('RESET_STATE') resolve() }).catch(error => { @@ -153,7 +155,8 @@ const actions = { commit }) { return new Promise(resolve => { - removeToken() // must remove token first + removeToken() // must remove token first + removeWzglUser() commit('RESET_STATE') resolve() }) diff --git a/src/utils/auth.js b/src/utils/auth.js index b47e5c1..ccd9d0e 100644 --- a/src/utils/auth.js +++ b/src/utils/auth.js @@ -1,6 +1,8 @@ import Cookies from 'js-cookie' const TokenKey = 'patrol_wzgl_token' +const UserInfo = 'patrol_wzgl_user' + export function getToken() { //return Cookies.get(TokenKey) @@ -22,3 +24,24 @@ export function removeToken() { return Cookies.remove(TokenKey) } + +export function getWzglUser() { + //return Cookies.get(TokenKey) + + if (Cookies.get(UserInfo)) { + return Cookies.get(UserInfo) + } else { + return sessionStorage.getItem(UserInfo); + } +} + +export function setWzglUser(User) { + sessionStorage.setItem(UserInfo, User); + return Cookies.set(UserInfo, User) +} + +export function removeWzglUser() { + sessionStorage.clear(); + return Cookies.remove(UserInfo) + +} diff --git a/src/views/dashboard/index.vue b/src/views/dashboard/index.vue index 46cc687..e85b2d5 100644 --- a/src/views/dashboard/index.vue +++ b/src/views/dashboard/index.vue @@ -40,6 +40,9 @@ import { getInfo } from '../../api/user.js' + import { + setWzglUser + } from '@/utils/auth.js' export default { components: { @@ -183,6 +186,7 @@ getInfo().then(response => { console.log(response) this.user = response + setWzglUser(this.user) }).catch(error => {}) this.start_time = this.recentTime(-14, 'yyyy-MM-dd') this.end_time = this.getNowDate() diff --git a/src/views/outbounds/component/addoutbounds.vue b/src/views/outbounds/component/addoutbounds.vue index 1286cc1..b0ee046 100644 --- a/src/views/outbounds/component/addoutbounds.vue +++ b/src/views/outbounds/component/addoutbounds.vue @@ -1,683 +1,684 @@ - - - - - - - *出库时间: - - - - - - - - - - - - 借用仓库: - - - - - - - - - - - - - 借用部门: - - - - - - - - - - - - *经办人: - - - - - - - - - - 报废原因: - - - - - - - - - - 备注: - - - - - - - - - - 出库明细 : - - - 新增出库明细 - - - - - - 删除 - - - - - - - - - - - - - - - - - - *物资编码: - - - - - - - - 资产名称: - - - - - - - - 规格型号: - - - - - - - - 物资类型: - - - - - - - - 入库批次: - - - - - - - - 在库数量: - - - - - - - - *出库数量: - - - - - - - - *是否回库: - - - - - - - - - - - 回库时间: - - - - - - - - - - - - - - - 查询 - - - - - - - - - - - - - + + + + + + + *出库时间: + + + + + + + + + + + + 借用仓库: + + + + + + + + + + + + + 借用部门: + + + + + + + + + + + + *经办人: + + + + + + + + + + 报废原因: + + + + + + + + + + 备注: + + + + + + + + + + 出库明细 : + + + 新增出库明细 + + + + + + 删除 + + + + + + + + + + + + + + + + + + *物资编码: + + + + + + + + 资产名称: + + + + + + + + 规格型号: + + + + + + + + 物资类型: + + + + + + + + 入库批次: + + + + + + + + 在库数量: + + + + + + + + *出库数量: + + + + + + + + *是否回库: + + + + + + + + + + + 回库时间: + + + + + + + + + + + + + + + 查询 + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/views/outbounds/index.vue b/src/views/outbounds/index.vue index 82d6d91..9c48129 100644 --- a/src/views/outbounds/index.vue +++ b/src/views/outbounds/index.vue @@ -8,7 +8,9 @@ 查询 添加 + @click="$refs['addoutbounds'].isShow = true,$refs['addoutbounds'].type = 'add', + $refs['addoutbounds'].chukuType = chukuType, + $refs['addoutbounds'].authName=authName">添加 @@ -21,7 +23,8 @@ :table-item="table"> - + + 编辑 出库 请示流程 @@ -29,7 +32,9 @@ 打印 删除 - + + + @@ -48,8 +53,8 @@ destroy } from "@/api/system/baseForm.js" import { - getInfo - } from "@/api/user.js" + getWzglUser + } from "@/utils/auth.js" import { getOutboundsStatus } from "@/api/contract.js" @@ -81,7 +86,8 @@ left: 0 }, loading:false, - userName:'', + userName:'', + authName:'', select: { pageSize: 10, pageIndex: 1, @@ -152,10 +158,10 @@ } }, methods: { - getUserName(){ - getInfo().then(res => { - this.userName = res.username - }) + async getUserName(){ + const res = await JSON.parse(getWzglUser()) + this.userName = res.username + this.authName = res.name }, async getindex() { this.loading = true diff --git a/src/views/stocks/component/addRuku.vue b/src/views/stocks/component/addRuku.vue index 47d53b1..baa5c0f 100644 --- a/src/views/stocks/component/addRuku.vue +++ b/src/views/stocks/component/addRuku.vue @@ -310,7 +310,8 @@ isShow: false, type: 'add', id: '', - rukuType: '', + rukuType: '', + authName:'', rukuTypeName: '盘点', tableName: 'stocks', importstableName: 'stocks_items', @@ -978,10 +979,14 @@ } if (this.type === 'editor') { this.getDetail() + } + if(this.type=='add'){ + this.form.jingbanren = this.authName } } else { this.id = '' - this.type = '' + this.type = '' + this.authName = '' this.mingxiList = [] this.$refs['dialog'].reset() } diff --git a/src/views/stocks/index.vue b/src/views/stocks/index.vue index faee9dc..0861b07 100644 --- a/src/views/stocks/index.vue +++ b/src/views/stocks/index.vue @@ -8,7 +8,9 @@ 查询 添加 + @click="$refs['addRuku'].isShow = true,$refs['addRuku'].type = 'add', + $refs['addRuku'].rukuType = rukuType + $refs['addRuku'].authName =authName">添加 @@ -21,14 +23,17 @@ :table-item="table"> - - 编辑 - - - 删除 - + + + 编辑 + + + 删除 + + + @@ -49,7 +54,10 @@ import addRuku from "./component/addRuku.vue" import { Message - } from 'element-ui' + } from 'element-ui' + import { + getWzglUser + } from "@/utils/auth.js" import imports from "@/views/component/imports.vue" import { index as fieldIndex @@ -64,6 +72,7 @@ }, data() { return { + authName:'', loading:false, select: { pageSize: 10, @@ -140,7 +149,11 @@ ] } }, - methods: { + methods: { + async getUserName(){ + const res = JSON.parse(getWzglUser()) + this.authName = res.name + }, async getindex() { this.loading = true const res = await index({ @@ -198,7 +211,8 @@ this.rukuType = this.rukuTypeList[k] } } - } + } + this.getUserName() this.getindex() }