Merge branch 'develop' of https://e.coding.net/ctcdevteam/hberp/hberp into develop
This commit is contained in:
commit
50dda78a92
|
@ -66,12 +66,10 @@ export default {
|
|||
let hasToken = getToken();
|
||||
if (hasToken) {
|
||||
this.refreshCountData();
|
||||
this.refreshtoken();
|
||||
this.$store.dispatch("user/getCount", {});
|
||||
}else{
|
||||
this.$router.push({name:'login'})
|
||||
}
|
||||
// console.log('$store.state.user.refresh:'+this.$store.state.user.refresh);
|
||||
},
|
||||
methods: {
|
||||
refreshCountData(){
|
||||
|
@ -84,18 +82,6 @@ export default {
|
|||
},0)
|
||||
},50000)
|
||||
},
|
||||
refreshtoken(){
|
||||
let refresh = getRefresh();
|
||||
/* debugger;
|
||||
console.log('refresh:'+refresh);
|
||||
debugger;*/
|
||||
// let refresh = this.$store.state.user.refresh;
|
||||
this.timer = window.setInterval(() => {
|
||||
if (refresh) {
|
||||
this.$store.dispatch("user/refreshToken", refresh);
|
||||
}
|
||||
},3540000)
|
||||
},
|
||||
handleClickOutside() {
|
||||
this.$store.dispatch('app/closeSideBar', { withoutAnimation: false })
|
||||
},
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
import { login, logout, getInfo } from '@/api/user'
|
||||
import { getCount } from '@/api/workflow'
|
||||
import { refreshToken } from '@/api/user'
|
||||
import { getToken, setToken, removeToken,getRefresh, setRefresh } from '@/utils/auth'
|
||||
import { getToken, setToken, removeToken} from '@/utils/auth'
|
||||
import { resetRouter } from '@/router'
|
||||
|
||||
const getDefaultState = () => {
|
||||
return {
|
||||
token: getToken(),
|
||||
name: '',
|
||||
refresh: getRefresh(),
|
||||
refresh: '',
|
||||
avatar: '',
|
||||
count: {},
|
||||
perms: []
|
||||
|
@ -50,8 +50,8 @@ const actions = {
|
|||
const { data } = response;
|
||||
commit('SET_TOKEN', data.access);
|
||||
commit('SET_REFRESH', data.refresh);
|
||||
sessionStorage.setItem('refresh',data.refresh);
|
||||
setToken(data.access);
|
||||
setRefresh(data.refresh);
|
||||
resolve()
|
||||
}).catch(error => {
|
||||
reject(error)
|
||||
|
@ -69,14 +69,11 @@ const actions = {
|
|||
this.$router.push({name:'login',params:{}});
|
||||
reject('验证失败,重新登陆.');
|
||||
}
|
||||
|
||||
const { perms, name, avatar } = data;
|
||||
|
||||
// perms must be a non-empty array
|
||||
if (!perms || perms.length <= 0) {
|
||||
reject('没有任何权限!')
|
||||
}
|
||||
|
||||
commit('SET_PERMS', perms);
|
||||
commit('SET_NAME', name);
|
||||
commit('SET_AVATAR', avatar);
|
||||
|
@ -129,10 +126,9 @@ const actions = {
|
|||
return new Promise((resolve, reject) => {
|
||||
refreshToken({refresh:ref}).then((res) => {
|
||||
const { data } = res;
|
||||
removeToken();
|
||||
commit('SET_TOKEN', data.access);
|
||||
// commit('SET_REFRESH', data.refresh);
|
||||
setToken(data.access);
|
||||
// setRefresh(data.refresh);
|
||||
resolve()
|
||||
}).catch(error => {
|
||||
reject(error)
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import Cookies from 'js-cookie'
|
||||
|
||||
const TokenKey = 'token';
|
||||
const refreshKey = 'refresh';
|
||||
|
||||
export function getToken() {
|
||||
return Cookies.get(TokenKey)
|
||||
|
@ -14,15 +13,4 @@ export function setToken(token) {
|
|||
export function removeToken() {
|
||||
return Cookies.remove(TokenKey)
|
||||
}
|
||||
export function getRefresh() {
|
||||
return Cookies.get(refreshKey)
|
||||
}
|
||||
|
||||
export function setRefresh(refresh) {
|
||||
return Cookies.set(refreshKey, refresh)
|
||||
}
|
||||
|
||||
export function removeRefresh() {
|
||||
return Cookies.remove(refreshKey)
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
import axios from 'axios'
|
||||
import { MessageBox, Message } from 'element-ui'
|
||||
import store from '@/store'
|
||||
import { getToken } from '@/utils/auth'
|
||||
|
||||
import { refreshToken } from '@/api/user'
|
||||
import { getToken,setToken,removeToken } from '@/utils/auth'
|
||||
let isRefreshing = false;
|
||||
//重试队列
|
||||
let requests = [];
|
||||
// create an axios instance
|
||||
const service = axios.create({
|
||||
baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url
|
||||
|
@ -56,7 +59,7 @@ service.interceptors.response.use(
|
|||
* You can also judge the status by HTTP Status Code
|
||||
*/
|
||||
response => {
|
||||
const res = response.data
|
||||
const res = response.data;
|
||||
if(res.code>=200 && res.code<400){
|
||||
return res
|
||||
}
|
||||
|
@ -68,7 +71,40 @@ service.interceptors.response.use(
|
|||
duration: 3 * 1000
|
||||
})
|
||||
}else{
|
||||
MessageBox.confirm('认证失败,请重新登陆.', '确认退出', {
|
||||
if (!isRefreshing) {
|
||||
isRefreshing = true;
|
||||
//调用刷新token的接口
|
||||
return refreshToken({refresh: sessionStorage.getItem('refresh')}).then(res => {
|
||||
const token = res.data.access;
|
||||
// 替换token
|
||||
removeToken();
|
||||
setToken(token);
|
||||
response.headers.Authorization = 'Bearer ' + token;
|
||||
// token 刷新后将数组的方法重新执行
|
||||
requests.forEach((cb) => cb(token));
|
||||
requests = []; // 重新请求完清空
|
||||
return service(response.config)
|
||||
}).catch(err => {
|
||||
//跳到登录页
|
||||
removeToken();
|
||||
store.dispatch('user/logout').then(() => {
|
||||
location.reload()
|
||||
});
|
||||
return Promise.reject(err)
|
||||
}).finally(() => {
|
||||
isRefreshing = false
|
||||
})
|
||||
}else {
|
||||
// 返回未执行 resolve 的 Promise
|
||||
return new Promise(resolve => {
|
||||
// 用函数形式将 resolve 存入,等待刷新后再执行
|
||||
requests.push(token => {
|
||||
response.headers.Authorization = 'Bearer ' + token;
|
||||
resolve(service(response.config))
|
||||
})
|
||||
})
|
||||
}
|
||||
/* MessageBox.confirm('认证失败,请重新登陆.', '确认退出', {
|
||||
confirmButtonText: '重新登陆',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
|
@ -76,9 +112,8 @@ service.interceptors.response.use(
|
|||
store.dispatch('user/logout').then(() => {
|
||||
location.reload()
|
||||
})
|
||||
})
|
||||
})*/
|
||||
}
|
||||
|
||||
} else if (res.code >= 400) {
|
||||
if(res.msg.indexOf('请调整位置')>-1){
|
||||
return;
|
||||
|
|
|
@ -78,13 +78,13 @@
|
|||
width="120px"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<el-link
|
||||
<!--<el-link
|
||||
v-if="checkPermission(['echeckrecord_update'])"
|
||||
type="primary"
|
||||
@click="handleEdit(scope)"
|
||||
>
|
||||
编辑
|
||||
</el-link>
|
||||
</el-link>-->
|
||||
<el-link
|
||||
v-if="checkPermission(['echeckrecord_delete'])"
|
||||
type="danger"
|
||||
|
|
|
@ -99,7 +99,7 @@
|
|||
</el-link>
|
||||
<el-link
|
||||
v-if="
|
||||
checkPermission(['fifo_hear']) && scope.row.is_audited == false
|
||||
checkPermission(['fifo_audit']) && scope.row.is_audited == false
|
||||
"
|
||||
type="primary"
|
||||
@click="handleAudit(scope)"
|
||||
|
|
|
@ -133,7 +133,6 @@
|
|||
<el-form-item label="规格型号">
|
||||
<el-input v-model="material.specification" placeholder="规格型号"/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="计量单位">
|
||||
<el-select style="width: 100%" v-model="material.unit" placeholder="请选择">
|
||||
<el-option
|
||||
|
@ -145,7 +144,6 @@
|
|||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="物料类别">
|
||||
<el-select style="width: 100%" v-model="material.type" placeholder="请选择物料类别">
|
||||
<el-option
|
||||
|
@ -166,6 +164,21 @@
|
|||
<el-form-item label="排序">
|
||||
<el-input-number style="width: 100%;" v-model="material.sort_str" :step="1" :min="0" step-strictly placeholder="排序"></el-input-number>
|
||||
</el-form-item>
|
||||
<el-form-item label="详情文件">
|
||||
<el-upload
|
||||
ref="upload"
|
||||
:action="upUrl"
|
||||
:on-preview="handlePreview"
|
||||
:on-success="handleUpSuccess"
|
||||
:on-remove="handleRemove"
|
||||
:headers="upHeaders"
|
||||
:file-list="fileList"
|
||||
:limit="1"
|
||||
accept=".pdf"
|
||||
>
|
||||
<el-button size="small" type="primary">上传文件</el-button>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div style="text-align: right">
|
||||
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
|
||||
|
@ -184,9 +197,8 @@
|
|||
getProcessList
|
||||
} from "@/api/mtm";
|
||||
import checkPermission from "@/utils/permission";
|
||||
|
||||
|
||||
import {genTree} from "@/utils";
|
||||
import {upUrl, upHeaders} from "@/api/file";
|
||||
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
|
||||
const defaultmaterial = {
|
||||
name: null,
|
||||
|
@ -198,6 +210,7 @@
|
|||
sort_str: null,
|
||||
count_safe: 0,
|
||||
processes: [],
|
||||
file:null,
|
||||
};
|
||||
export default {
|
||||
components: {Pagination},
|
||||
|
@ -207,6 +220,9 @@
|
|||
materialList: {
|
||||
count: 0,
|
||||
},
|
||||
upHeaders: upHeaders(),
|
||||
upUrl: upUrl(),
|
||||
fileList: [],
|
||||
processOptions: [],
|
||||
options_: {
|
||||
// "1": '成品',
|
||||
|
@ -281,6 +297,19 @@
|
|||
},
|
||||
methods: {
|
||||
checkPermission,
|
||||
handlePreview(file) {
|
||||
if ("url" in file) {
|
||||
window.open(file.url);
|
||||
} else {
|
||||
window.open(file.response.data.path);
|
||||
}
|
||||
},
|
||||
handleUpSuccess(res, file, filelist) {
|
||||
this.material.file = res.data.id;
|
||||
},
|
||||
handleRemove(file, filelist) {
|
||||
this.material.file = null;
|
||||
},
|
||||
//物料详情
|
||||
handledetail(scope){
|
||||
this.$router.push({name: "MaterialDetail", params: { id: scope.row.id,type: scope.row.type }, })
|
||||
|
@ -331,14 +360,31 @@
|
|||
this.material = Object.assign({}, defaultmaterial);
|
||||
this.dialogType = "new";
|
||||
this.dialogVisible = true;
|
||||
if (this.material.file) {
|
||||
this.fileList = [
|
||||
{
|
||||
name: this.process.instruction_.name,
|
||||
url: this.process.instruction_.path,
|
||||
},
|
||||
];
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
this.$refs["Form"].clearValidate();
|
||||
});
|
||||
},
|
||||
handleEdit(scope) {
|
||||
this.fileList = [];
|
||||
this.material = Object.assign({}, scope.row); // copy obj
|
||||
this.dialogType = "edit";
|
||||
this.dialogVisible = true;
|
||||
if (this.material.file) {
|
||||
this.fileList = [
|
||||
{
|
||||
name: this.material.file_.name,
|
||||
url: this.material.file_.path,
|
||||
},
|
||||
];
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
this.$refs["Form"].clearValidate();
|
||||
});
|
||||
|
@ -367,6 +413,7 @@
|
|||
if (res.code >= 200) {
|
||||
this.getList();
|
||||
this.dialogVisible = false;
|
||||
this.fileList = [];
|
||||
this.$message.success("成功");
|
||||
}
|
||||
});
|
||||
|
@ -375,6 +422,7 @@
|
|||
if (res.code >= 200) {
|
||||
this.getList();
|
||||
this.dialogVisible = false;
|
||||
this.fileList = [];
|
||||
this.$message.success("成功");
|
||||
}
|
||||
});
|
||||
|
|
|
@ -9,23 +9,25 @@
|
|||
border
|
||||
>
|
||||
<el-descriptions-item label="物料编号">
|
||||
{{ materialdetail.number }}</el-descriptions-item
|
||||
>
|
||||
{{ materialdetail.number }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="物料名称">
|
||||
{{ materialdetail.name }}</el-descriptions-item
|
||||
>
|
||||
{{ materialdetail.name }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="规格型号" :span="2">
|
||||
{{ materialdetail.specification }}</el-descriptions-item
|
||||
>
|
||||
{{ materialdetail.specification }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="计量单位">
|
||||
{{ materialdetail.unit }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="数量">
|
||||
{{ materialdetail.count }}</el-descriptions-item
|
||||
>
|
||||
{{ materialdetail.count }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="文件">
|
||||
<el-link :href="materialdetail.file_.path">{{materialdetail.file_.name}}</el-link>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-card>
|
||||
|
||||
<el-tabs v-model="activeName" type="card">
|
||||
<el-tab-pane
|
||||
label="供应商"
|
||||
|
@ -47,30 +49,19 @@
|
|||
<template slot-scope="scope">{{ scope.row.batch }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="物料名称">
|
||||
<template slot-scope="scope">{{
|
||||
scope.row.material_.name
|
||||
}}</template>
|
||||
<template slot-scope="scope">{{scope.row.material_.name}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="规格型号">
|
||||
<template slot-scope="scope">{{
|
||||
scope.row.material_.specification
|
||||
}}</template>
|
||||
<template slot-scope="scope">{{scope.row.material_.specification}}</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="物料编号">
|
||||
<template slot-scope="scope">{{
|
||||
scope.row.material_.number
|
||||
}}</template>
|
||||
<template slot-scope="scope">{{scope.row.material_.number}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="仓库名称">
|
||||
<template slot-scope="scope">{{
|
||||
scope.row.warehouse_.name
|
||||
}}</template>
|
||||
<template slot-scope="scope">{{scope.row.warehouse_.name}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="仓库编号">
|
||||
<template slot-scope="scope">{{
|
||||
scope.row.warehouse_.number
|
||||
}}</template>
|
||||
<template slot-scope="scope">{{scope.row.warehouse_.number}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="物料总存量">
|
||||
<template slot-scope="scope">{{ scope.row.count }}</template>
|
||||
|
|
|
@ -175,6 +175,9 @@
|
|||
<el-table-column label="计量单位" min-width="100">
|
||||
<template slot-scope="scope">{{ scope.row.material_.unit }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="规格" min-width="100">
|
||||
<template slot-scope="scope">{{ scope.row.material_.specification }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单位消耗量" min-width="100">
|
||||
<template slot-scope="scope">{{ scope.row.count }}</template>
|
||||
</el-table-column>
|
||||
|
|
|
@ -72,7 +72,7 @@
|
|||
订单项
|
||||
</el-link>
|
||||
<el-link
|
||||
v-if="checkPermission(['puorder_hear']) &&scope.row.is_audited == false"
|
||||
v-if="checkPermission(['puorder_audit']) &&scope.row.is_audited == false"
|
||||
type="primary"
|
||||
@click="handleAudit(scope)"
|
||||
>
|
||||
|
|
Loading…
Reference in New Issue