优化
This commit is contained in:
parent
d34bb4ebd6
commit
2faa1a474c
@ -31,9 +31,11 @@ import {
|
|||||||
Tabs,
|
Tabs,
|
||||||
TabPane,
|
TabPane,
|
||||||
Menu,
|
Menu,
|
||||||
MenuItem
|
MenuItem,
|
||||||
|
Loading
|
||||||
} from 'element-ui'
|
} from 'element-ui'
|
||||||
|
|
||||||
|
Vue.prototype.$loading = Loading
|
||||||
Vue.prototype.$message = Message
|
Vue.prototype.$message = Message
|
||||||
Vue.prototype.$confirm = MessageBox.confirm
|
Vue.prototype.$confirm = MessageBox.confirm
|
||||||
Vue.prototype.$alert = MessageBox.alert
|
Vue.prototype.$alert = MessageBox.alert
|
||||||
|
|||||||
@ -1,5 +1,12 @@
|
|||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import { Message } from 'element-ui'
|
import { Message, Loading } from 'element-ui'
|
||||||
|
// const id = Loading.service({
|
||||||
|
// target: document.querySelector('.appamin'),
|
||||||
|
// background: 'rgba(255, 255, 255, 0.1)',
|
||||||
|
// spinner: 'el-icon-loading',
|
||||||
|
// text: '请求加载中。。。'
|
||||||
|
// })
|
||||||
|
// id.close()
|
||||||
// import store from '@/store'
|
// import store from '@/store'
|
||||||
// import { getToken } from '@/utils/auth'
|
// import { getToken } from '@/utils/auth'
|
||||||
// import errorCode from '@/utils/errorCode'
|
// import errorCode from '@/utils/errorCode'
|
||||||
@ -14,8 +21,17 @@ const service = axios.create({
|
|||||||
// 超时
|
// 超时
|
||||||
timeout: 1500000
|
timeout: 1500000
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const options = {
|
||||||
|
fullscreen: true,
|
||||||
|
target: document.querySelector('.appamin'),
|
||||||
|
background: 'rgba(255, 255, 255, 0.1)',
|
||||||
|
spinner: 'el-icon-loading',
|
||||||
|
text: '请求加载中。。。'}
|
||||||
|
|
||||||
// request拦截器
|
// request拦截器
|
||||||
service.interceptors.request.use(config => {
|
service.interceptors.request.use(config => {
|
||||||
|
Loading.service(options)
|
||||||
// 是否需要设置 token
|
// 是否需要设置 token
|
||||||
// const isToken = (config.headers || {}).isToken === false
|
// const isToken = (config.headers || {}).isToken === false
|
||||||
// if (getToken() && !isToken) {
|
// if (getToken() && !isToken) {
|
||||||
@ -29,6 +45,10 @@ service.interceptors.request.use(config => {
|
|||||||
|
|
||||||
// 响应拦截器
|
// 响应拦截器
|
||||||
service.interceptors.response.use(res => {
|
service.interceptors.response.use(res => {
|
||||||
|
const id = setTimeout(() => {
|
||||||
|
Loading.service(options).close()
|
||||||
|
clearTimeout(id)
|
||||||
|
}, 300)
|
||||||
// 未设置状态码则默认成功状态
|
// 未设置状态码则默认成功状态
|
||||||
const code = res.data.code || 200
|
const code = res.data.code || 200
|
||||||
if (code !== 200) {
|
if (code !== 200) {
|
||||||
@ -41,6 +61,10 @@ service.interceptors.response.use(res => {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
|
const id = setTimeout(() => {
|
||||||
|
Loading.service(options).close()
|
||||||
|
clearTimeout(id)
|
||||||
|
}, 300)
|
||||||
console.log('err' + error)
|
console.log('err' + error)
|
||||||
let { message } = error
|
let { message } = error
|
||||||
if (message === 'Network Error') {
|
if (message === 'Network Error') {
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
<div @click="handleChangle(3)" :class="{active:active===3}" class="a commonFont"><span class="eidt-header-circle">3</span>流程设计</div>
|
<div @click="handleChangle(3)" :class="{active:active===3}" class="a commonFont"><span class="eidt-header-circle">3</span>流程设计</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="eidt-right">
|
<div class="eidt-right">
|
||||||
<el-button type="primary" @click="handSaveBasisc">保 存</el-button>
|
<el-button :loading='loadings' type="primary" @click="handSaveBasisc">保 存</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="eidt-content boderAndRadius">
|
<div class="eidt-content boderAndRadius">
|
||||||
<basis :basisForm.sync='basisForm' v-show="active===1"/>
|
<basis :basisForm.sync='basisForm' v-show="active===1"/>
|
||||||
@ -27,6 +27,7 @@ console.log('saveDetailProcs: ', saveDetailProcs)
|
|||||||
export default {
|
export default {
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
loadings: false,
|
||||||
active: 1,
|
active: 1,
|
||||||
// 基础
|
// 基础
|
||||||
basisForm: {
|
basisForm: {
|
||||||
@ -64,6 +65,14 @@ export default {
|
|||||||
async handSaveBasisc () {
|
async handSaveBasisc () {
|
||||||
console.log('this.processInfo: ', this.processInfo)
|
console.log('this.processInfo: ', this.processInfo)
|
||||||
console.log('this.basisForm: ', this.basisForm)
|
console.log('this.basisForm: ', this.basisForm)
|
||||||
|
if (!this.basisForm.name) {
|
||||||
|
return this.$message.error('请输入考评组名称')
|
||||||
|
}
|
||||||
|
if (!this.basisForm.depIds && !this.basisForm.staffIds) {
|
||||||
|
return this.$message.error('请选择被考核人员')
|
||||||
|
}
|
||||||
|
|
||||||
|
this.loadings = true
|
||||||
try {
|
try {
|
||||||
let res = await saveBaseSet(this.basisForm)
|
let res = await saveBaseSet(this.basisForm)
|
||||||
this.basisForm = res
|
this.basisForm = res
|
||||||
@ -89,6 +98,7 @@ export default {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.$message.error(error.msg)
|
this.$message.error(error.msg)
|
||||||
}
|
}
|
||||||
|
this.loadings = false
|
||||||
this.$message({
|
this.$message({
|
||||||
message: '保存成功',
|
message: '保存成功',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user