This commit is contained in:
熊成强 2020-11-06 15:33:50 +08:00
parent 01f538f722
commit 349cd5e4e9
21 changed files with 130 additions and 41 deletions

View File

@ -1,20 +1,13 @@
<template>
<div id="app">
<router-view class="main"/>
<!-- <Loading :active.sync="active"
:can-cancel="true"
:on-cancel="onCancel"
:is-full-page="fullPage"></Loading> -->
</div>
</template>
<script>
import { mapState, mapActions } from 'vuex'
import * as dd from 'dingtalk-jsapi'
import { apiDingtalkLogin } from '@/api/login'
// import Loading from 'vue-loading-overlay'
// Import stylesheet
// import 'vue-loading-overlay/dist/vue-loading.css'
import { apiDingtalkLogin, apiUserInfo } from '@/api/login'
export default {
name: 'App',
data () {
@ -24,7 +17,6 @@ export default {
}
},
components: {
// Loading
},
computed: {
...mapState(['user'])
@ -36,7 +28,7 @@ export default {
onCancel () {
},
...mapActions(['GET_DEPLIST']),
...mapActions(['GET_DEPLIST', 'SET_USER_INFO']),
//
handleGetDingtalkCode () {
let _this = this
@ -58,6 +50,7 @@ export default {
apiDingtalkLogin(val).then(res => {
if (res && res.code === 0) {
this.$cookies.set('token', res.token)
this.handleInfo()
this.dataForm.verify = '登录成功,跳转中...'
window.open(window.location.protocol + '//' + window.location.host + '/digitization/kpi/workbench/home?code=' + this.dingCode.code)
} else {
@ -66,6 +59,13 @@ export default {
this.$router.replace({ name: 'dingTalkLogin' })
}
})
},
//
async handleInfo () {
let res = await apiUserInfo()
if (res.code === 200) {
this.SET_USER_INFO(res.user)
}
}
}
}

View File

@ -34,3 +34,12 @@ export function apiSendSMS (query = {}) {
data: query
})
}
// 获取用户信息
export function apiUserInfo (query = {}) {
return request({
url: '/lz_management/sys/user/info',
method: 'get',
query: query
})
}

View File

@ -8,3 +8,12 @@ export function apiDingtalkLogin (query) {
data: query
})
}
// 获取用户信息
export function apiUserInfo (query = {}) {
return request({
url: '/lz_management/sys/user/info',
method: 'get',
query: query
})
}

View File

@ -20,7 +20,8 @@
</div> -->
</transition>
<div class="navBar-right" v-if="isNav">
<img onerror="javascript:this.src='/static/default.jpg';" :src="this.src" alt="">
<span>{{this.info.realName}}</span>
<img onerror="javascript:this.src='/static/default.jpg';" :src="this.info.avatar || ''" alt="">
</div>
</div>
</template>
@ -42,7 +43,7 @@ export default {
NavHeader
},
computed: {
...mapState({src: state => state.user.info.src}),
...mapState({ info: state => state.user.info }),
isNav () {
return !!this.$route.meta.isNav
},
@ -91,6 +92,11 @@ export default {
padding: 0 40px;
box-shadow: 0 1px 6px 0 rgba(0,0,0,.12), 0 1px 6px 0 rgba(0,0,0,.12);
&-right{
display: flex;
align-items: center;
span{
margin: 0 10px;
}
img{
width: 40px;
height: 40px;

View File

@ -10,7 +10,7 @@ import './style/index.less'
import '@/icons'
import VConsole from 'vconsole'
import VueCookie from 'vue-cookies'
import { debounce, departGetForm, personlGetForm, handleInput, messageSuccess } from '@/utils/common'
import { debounce, departGetForm, personlGetForm, handleInput, messageSuccess, loading, loadingClose } from '@/utils/common'
import { format } from '@/utils/dateFormat'
// }
@ -23,6 +23,8 @@ var vConsole = new VConsole({
Vue.use(VueCookie)
Vue.config.productionTip = false
Vue.prototype.$loadingStart = loading
Vue.prototype.$loadingEnd = loadingClose
Vue.prototype.$format = format
Vue.prototype.debounce = debounce
Vue.prototype.$personlGetForm = personlGetForm

View File

@ -2,11 +2,14 @@ import { getDepList } from '@/api/report'
const user = {
state: {
deplist: [],
info: {
src: ''
}
info: JSON.parse(localStorage.getItem('info')) || {}
},
mutations: {
SET_USER_INFO: (state, info) => {
localStorage.setItem('info', JSON.stringify(info))
state.info = info
},
SET_DEPLIST: (state, list = []) => {
state.deplist = list
}

View File

@ -90,3 +90,19 @@ export function messageSuccess (params) {
type: 'success'
})
}
let id = ''
export function loading (options = {
fullscreen: true,
target: document.querySelector('.appamin'),
background: 'rgba(255, 255, 255, 0.8)',
spinner: 'el-icon-loading',
text: '数据加载中'}) {
id = this.$loading.service(options)
}
export function loadingClose () {
setTimeout(() => {
id.close()
}, 300)
}

View File

@ -23,16 +23,16 @@ const service = axios.create({
timeout: 1500000
})
const options = {
fullscreen: true,
target: document.querySelector('.appamin'),
background: 'rgba(255, 255, 255, 0.8)',
spinner: 'el-icon-loading',
text: '数据加载中'}
// const options = {
// fullscreen: true,
// target: document.querySelector('.appamin'),
// background: 'rgba(255, 255, 255, 0.8)',
// spinner: 'el-icon-loading',
// text: '数据加载中'}
// request拦截器
service.interceptors.request.use(config => {
Loading.service(options)
// Loading.service(options)
// 是否需要设置 token
// const isToken = (config.headers || {}).isToken === false
// if (getToken() && !isToken) {
@ -47,20 +47,20 @@ service.interceptors.request.use(config => {
// 响应拦截器
service.interceptors.response.use(res => {
const id = setTimeout(() => {
Loading.service(options).close()
clearTimeout(id)
}, 300)
// const id = setTimeout(() => {
// Loading.service(options).close()
// clearTimeout(id)
// }, 300)
if (res.config.responseType === 'blob') {
return res
}
return res.data
},
error => {
const id = setTimeout(() => {
Loading.service(options).close()
clearTimeout(id)
}, 300)
// const id = setTimeout(() => {
// Loading.service(options).close()
// clearTimeout(id)
// }, 300)
console.log('err' + error)
let { message } = error
if (message === 'Network Error') {

View File

@ -153,7 +153,9 @@ export default {
},
async handleGetData (parmas = this.params) {
try {
this.$loadingStart()
let res = await apiGetAssessList(parmas)
this.$loadingEnd()
res = res.data
this.tableData = res.list
this.params.totalCount = res.totalCount

View File

@ -166,7 +166,9 @@ export default {
this.dialogFormVisible = true
},
async handleAgree () {
this.$loadingStart()
let res = await this.handlApiSaveapproval({status: 1, menuName: '同意了'})
this.$loadingEnd()
this.dialogFormVisible = !!res
},
//
@ -186,7 +188,9 @@ export default {
const obj = {status: 3, menuName: '催办了'}
if (this.info) obj.flowRecordId = this.info.flowRecordId
const params = Object.assign({}, this.form, {resultRecordId: this.$route.query.id || ''}, obj)
this.$loadingStart()
let res = await apiSaveapproval(params)
this.$loadingEnd()
if (res.code !== 200) {
this.$message.error(res.msg)
return
@ -216,7 +220,9 @@ export default {
const obj = {status: 4, menuName: '跳过了'}
if (this.info) obj.flowRecordId = this.info.flowRecordId
const params = Object.assign({}, this.form, {resultRecordId: this.$route.query.id || ''}, obj)
this.$loadingStart()
let res = await apiSaveapproval(params)
this.$loadingEnd()
if (res.code !== 200) {
this.$message.error(res.msg)
return
@ -248,7 +254,9 @@ export default {
})
},
async handleSubmit () {
this.$loadingStart()
let res = await this.handlApiSaveapproval({status: 5, menuName: '驳回了'})
this.$loadingEnd()
console.log('!!res: ', !!res)
this.bohui = !!res
},

View File

@ -84,8 +84,8 @@
<div v-if="tableInfo.result || tableInfo.score" class="table-bottom">
<div class="table-bottom-content">
<el-button size='small' @click="handleCancelResult" plain>取消</el-button>
<el-button size='small' @click="handleSaveDetail()" plain>暂存</el-button>
<el-button size='small' @click="handleGetNext" type="primary" >{{tableInfo.result?'提交结果值':'提交评分'}}</el-button>
<el-button size='small' :loading='loadingZan' @click="handleSaveDetail()" plain>暂存</el-button>
<el-button size='small' :loading='loadingTi' @click="handleGetNext" type="primary" >{{tableInfo.result?'提交结果值':'提交评分'}}</el-button>
</div>
</div>
<!-- <div v-else class="table-bottoms">
@ -128,6 +128,8 @@ export default {
},
data () {
return {
loadingTi: false,
loadingZan: false,
input: '',
scoreList: []
}
@ -138,14 +140,17 @@ export default {
},
methods: {
async handleGetNext () {
this.loadingTi = true
let res1 = await apiSaveDetail(this.obj)
if (res1.code !== 200) {
this.$message.error(res1.msg)
this.loadingTi = false
return
}
const obj = {status: 1, menuName: this.tableInfo.result ? '提交了结果值' : '提交了评分'}
const params = Object.assign({}, {resultRecordId: this.$route.query.id || ''}, obj)
let res = await apiSaveapproval(params)
this.this.loadingTi = false
if (res.code !== 200) {
this.$message.error(res.msg)
return
@ -166,7 +171,9 @@ export default {
console.log('resssss: ', res)
},
async handleSaveDetail (params = this.obj) {
this.loadingZan = true
let res = await apiSaveDetail(params)
this.loadingZan = false
if (res.code !== 200) {
this.$message.error(res.msg)
return

View File

@ -178,13 +178,14 @@ export default {
},
computed: {},
beforeMount () { },
mounted () {
this.handleList()
this.handleGetTbale()
async mounted () {
await this.handleList()
},
methods: {
async handleGetTbale (id = this.$route.query.id) {
this.$loadingStart()
let res = await apiResultGetDetail({ id })
this.$loadingEnd()
if (res.code !== 200) return
this.obj = res.data
},
@ -200,6 +201,7 @@ export default {
},
async handleList () {
let res = await apiResultRecordDetail({ resultRecordId: this.$route.query.id })
this.handleGetTbale()
if (res.code !== 200) return
const arr = res.data.flowRecordList.concat([])
for (let i in res.data.flowRecordList) {

View File

@ -19,7 +19,7 @@
<el-button size="small" icon="el-icon-plus" plain @click="handleChoose">选人员</el-button>
</el-form-item>
<el-form-item>
<el-button size="small" type="primary" @click="handleOnSubmit">确定</el-button>
<el-button size="small" :loading='isLoading' type="primary" @click="handleOnSubmit">确定</el-button>
</el-form-item>
</el-form>
</div>
@ -30,10 +30,11 @@
<script>
import getPersonnel from '@/components/getPersonnel'
import SmallNav from '@/components/kpi-layout/SmallNav'
import { apiAssessManagerChange} from '@/api/assessment'
import { apiAssessManagerChange } from '@/api/assessment'
export default {
data () {
return {
isLoading: false,
isSshow: false,
list: {
list: []
@ -59,7 +60,10 @@ export default {
confirm: 0,
changeType: 0
}
this.isLoading = false
this.$loadingStart()
let res = await apiAssessManagerChange(parmas)
this.isLoading = true
if (res.code === 503) {
this.$confirm(res.msg, '提示', {
confirmButtonText: '确定',
@ -68,6 +72,7 @@ export default {
}).then(async () => {
parmas.confirm = 1
let res1 = await apiAssessManagerChange(parmas)
this.$loadingEnd()
if (res1.code !== 200) return this.$message.error(res1.msg)
history.go(-1)
}).catch(() => {

View File

@ -320,8 +320,9 @@ export default {
this.handleGetListContent()
},
async handleGetListContent (params = this.params) {
console.log('params: ', params)
this.$loadingStart()
let res = await apiManagerDetail(params)
this.$loadingEnd()
if (res.code !== 200) return
this.tableData = res.data.list
this.params.totalCount = res.data.totalCount

View File

@ -282,7 +282,9 @@ export default {
startId: startId
}
try {
this.$loadingStart()
const result = await getChartData(params)
this.$loadingEnd()
// startIdstartId
if (typeof startId === 'undefined') {
this.defaultStartId[0] = result.data[0].type

View File

@ -181,12 +181,14 @@ export default {
},
beforeMount () {},
async mounted () {
this.$loadingStart()
this.handleGetGround()
const id = this.$route.query.id || ''
this.id = id
if (id) {
this.handleGetByIdForBasis(id)
await this.handleGetByIdForBasis(id)
}
this.$loadingEnd()
this.form = this.basisForm
},
methods: {

View File

@ -92,6 +92,7 @@ export default {
}
this.loadings = true
try {
this.$loadingStart()
let res1 = await apiCheckStaff(Object.assign({}, this.basisForm, {confirm: 1}))
console.log('res1: ', res1)
let res = await saveBaseSet(this.basisForm)
@ -113,6 +114,7 @@ export default {
console.log('this.templateForm: ', JSON.stringify(this.templateForm))
try {
let res = await saveTemSet(this.templateForm)
this.$loadingEnd()
res = res.data
// this.basisForm = res
console.log('res: ', res)

View File

@ -158,7 +158,9 @@ export default {
},
async handleGetData (parmas = Object.assign({}, this.params)) {
try {
this.$loadingStart()
let res = await getWorkList(parmas)
this.$loadingEnd()
if (res.code !== 200) return
res = res.data
console.log('res: ', res)

View File

@ -74,7 +74,9 @@ export default {
},
methods: {
handleGetList () {
this.$loadingStart()
apiGetWaitList(this.pageProcessedInfo).then(res => {
this.$loadingEnd()
if (res.code === 200) {
this.pageProcessedInfo.currPage = res.data.currPage
this.pageProcessedInfo.totalCount = res.data.totalCount

View File

@ -20,7 +20,8 @@
</template>
<script>
import { apiLogin, apiSendSMS } from '@/api/data'
import { apiLogin, apiSendSMS, apiUserInfo } from '@/api/data'
import { mapMutations } from 'vuex'
let hostList = 'lzmanagement.ldxinyong.com'
let thostList = 'tlzmanagement.ldxinyong.com'
const islzmanagement = window.location.host.indexOf('hostList') > -1 && window.location.host.indexOf('hostList') < 0
@ -38,6 +39,7 @@ export default {
beforeMount () {},
mounted () {},
methods: {
...mapMutations(['SET_USER_INFO']),
handleClick () {
this.isShow = !this.isShow
},
@ -53,6 +55,11 @@ export default {
if (res.code === 200) {
this.token = res.token
this.$cookies.set('token', res.token, res.expire)
let ress = await apiUserInfo()
if (ress.code === 200) {
this.SET_USER_INFO(ress.user)
}
console.log('ress: ', ress)
location.reload()
}
}

View File

@ -206,7 +206,9 @@ export default {
para['startTime'] = this.$format(this.formData.rangDate[0], 'yyyy-MM-dd hh:mm:ss')
para['endTime'] = this.$format(this.formData.rangDate[1], 'yyyy-MM-dd hh:mm:ss')
}
this.$loadingStart()
apiInitiateAssessmentInfo(para).then(res => {
this.$loadingEnd()
this.dialogSendVisible = false
if (res.code !== 200) {
this.$message.error(res.msg)