接口返回数据修改

This commit is contained in:
2022-10-22 14:00:02 +08:00
parent 730e0df403
commit b12611faee
13 changed files with 66 additions and 163 deletions

View File

@@ -2,7 +2,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0, minimum-scale=1.0,user-scalable=no">
<title>yy</title>
<title>永裕</title>
<script src="../../common/js/appmui.js"></script>
<!-- <script src="http://192.168.81.82:8000/CLodopfuncs.js" id='printid'></script> -->
</head>

View File

@@ -1,8 +1,11 @@
import {post} from '@config/http.js'
// 测试接口返回结果
export const test = () => post('test/1', {})
// 手持登录
export const loginApi = (user, password) => post('api/pda/handlogin', {
user: user,
export const loginApi = (user, password) => post('api/pda/login', {
username: user,
password: password
})
// 手持登陆查询菜单权限

View File

@@ -1,5 +1,5 @@
import axios from 'axios'
import { Dialog, toast } from './mUtils.js'
import { Dialog } from './mUtils.js'
import store from '../vuex/store'
import router from '@/router'
@@ -30,17 +30,14 @@ axios.interceptors.request.use(
axios.interceptors.response.use(
response => {
if (response.status === 200) {
return Promise.resolve(response)
} else {
return Promise.reject(response)
}
return Promise.resolve(response)
},
error => {
if (error && error.response) {
switch (error.response.status) {
case 400:
break
case 401:
toast(error.response.data.message)
store.dispatch('setSignOut')
router.push('/login')
break

View File

@@ -4,7 +4,7 @@
<section class="content" style="margin-bottom: 0">
<div class="userInfo">
<div class="fxcol">
<p class="p1">{{$store.getters.userInfo !== '' ? JSON.parse($store.getters.userInfo).nick_name : ''}}</p>
<p class="p1">{{$store.getters.userInfo !== '' ? JSON.parse($store.getters.userInfo).nickName : ''}}</p>
<p class="p2">欢迎进入永裕手持系统</p>
</div>
<div class="exit" @click="Quit">
@@ -70,11 +70,7 @@ export default {
async _authority () {
let accountId = this.$store.getters.userInfo !== '' ? JSON.parse(this.$store.getters.userInfo).account_id : ''
let res = await authority(accountId)
if (res.code === '1') {
this.menuList = [...res.result.sonTree]
} else {
this.Dialog(res.desc)
}
this.menuList = [...res.result.sonTree]
},
Quit () {
this.$store.dispatch('setSignOut')

View File

@@ -35,36 +35,19 @@ export default {
},
mounted () {
document.getElementsByTagName('body')[0].className = 'login-bg'
// window.getSystemInfoCallback = this.getSystemInfoCallback
// window.location.href = 'getSystemInfo'
},
methods: {
// getSystemInfoCallback (result) {
// window.localStorage.setItem('hhtId', result)
// },
// handleTest () {
// this.test = false
// setTimeout(() => {
// this.test = true
// this.testNumber = this.testNumber === 1 ? 2 : 1
// }, 200)
// },
changeType () {
this.type = this.type === 'password' ? 'text' : 'password'
},
async loginApi () {
try {
let res = await loginApi(this.loginname, encrypt(this.password))
if (res.code === '1') {
this.$store.dispatch('userInfo', JSON.stringify(res.result))
this.$router.push('/home')
} else {
this.Dialog(res.desc)
}
this.$store.dispatch('userInfo', JSON.stringify(res))
this.$router.push('/home')
this.disabled = false
} catch (err) {
this.disabled = false
this.Dialog(err)
}
},
_Login () {

View File

@@ -71,15 +71,11 @@ export default {
/** 查询点位 */
async _callEmptyqueryPoint () {
let res = await callEmptyqueryPoint()
if (res.code === '1') {
this.option2 = [...res.result.regionja]
this.option2.map(el => {
this.$set(el, 'value', el.region_id)
this.$set(el, 'label', el.region_name)
})
} else {
this.Dialog(res.desc)
}
this.option2 = [...res.result.regionja]
this.option2.map(el => {
this.$set(el, 'value', el.region_id)
this.$set(el, 'label', el.region_name)
})
},
/** 确认 */
async _callEmptyconfirm () {
@@ -90,12 +86,8 @@ export default {
}
try {
let res = await callEmptyconfirm(this.option2[this.active2].value, this.option3[this.active3].value, this.option3[this.active3].point_code, this.val2)
if (res.code === '1') {
this.toast(res.desc)
this.toCancle()
} else {
this.Dialog(res.desc)
}
this.toast(res.desc)
this.toCancle()
this.disabled1 = false
} catch (e) {
this.disabled1 = false

View File

@@ -64,15 +64,11 @@ export default {
/** 查询点位 */
async _callMaterialqueryPoint () {
let res = await callMaterialqueryPoint()
if (res.code === '1') {
this.option2 = [...res.result.regionja]
this.option2.map(el => {
this.$set(el, 'value', el.region_id)
this.$set(el, 'label', el.region_name)
})
} else {
this.Dialog(res.desc)
}
this.option2 = [...res.result.regionja]
this.option2.map(el => {
this.$set(el, 'value', el.region_id)
this.$set(el, 'label', el.region_name)
})
},
/** 确认 */
async _callMaterialconfirm () {
@@ -83,12 +79,8 @@ export default {
}
try {
let res = await callMaterialconfirm(this.option2[this.active2].value, this.option3[this.active3].value, this.option3[this.active3].point_code)
if (res.code === '1') {
this.toast(res.desc)
this.toCancle()
} else {
this.Dialog(res.desc)
}
this.toast(res.desc)
this.toCancle()
this.disabled1 = false
} catch (e) {
this.disabled1 = false

View File

@@ -50,12 +50,8 @@ export default {
}
try {
let res = await emptyAndQtyconfirm(this.val1, this.val2)
if (res.code === '1') {
this.toast(res.desc)
this.toCancle()
} else {
this.Dialog(res.desc)
}
this.toast(res.desc)
this.toCancle()
this.disabled1 = false
} catch (e) {
this.disabled1 = false

View File

@@ -98,14 +98,10 @@ export default {
async _updatePass () {
try {
let res = await updatePass(encrypt(this.val1), encrypt(this.val2))
if (res.code === '1') {
this.toast(res.desc)
this.$store.dispatch('setSignOut')
this.$router.push('/login')
} else {
this.Dialog(res.desc)
this.disabled = false
}
this.toast(res.desc)
this.$store.dispatch('setSignOut')
this.$router.push('/login')
this.disabled = false
} catch (e) {
this.disabled = false
}

View File

@@ -81,15 +81,11 @@ export default {
/** 查询点位 */
async _sendEmptyqueryPoint () {
let res = await sendEmptyqueryPoint()
if (res.code === '1') {
this.option2 = [...res.result.regionja]
this.option2.map(el => {
this.$set(el, 'value', el.region_id)
this.$set(el, 'label', el.region_name)
})
} else {
this.Dialog(res.desc)
}
this.option2 = [...res.result.regionja]
this.option2.map(el => {
this.$set(el, 'value', el.region_id)
this.$set(el, 'label', el.region_name)
})
},
/** 确认 */
async _sendEmptyconfirm () {
@@ -100,12 +96,8 @@ export default {
}
try {
let res = await sendEmptyconfirm(this.option2[this.active2].value, this.option3[this.active3].value, this.option3[this.active3].point_code, this.val1, this.val2)
if (res.code === '1') {
this.toast(res.desc)
this.toCancle()
} else {
this.Dialog(res.desc)
}
this.toast(res.desc)
this.toCancle()
this.disabled1 = false
} catch (e) {
this.disabled1 = false

View File

@@ -71,25 +71,11 @@ export default {
/** 查询点位 */
async _sendMaterialqueryPoint () {
let res = await sendMaterialqueryPoint()
if (res.code === '1') {
// this.option1 = [...res.result.workprocedureja]
// this.option1.map(el => {
// this.$set(el, 'value', el.workprocedure_id)
// this.$set(el, 'label', el.workprocedure_name)
// })
this.option2 = [...res.result.regionja]
this.option2.map(el => {
this.$set(el, 'value', el.region_id)
this.$set(el, 'label', el.region_name)
})
// this.option3 = [...res.result.workprocedureja.deviceja.pointArr]
// this.option3.map(el => {
// this.$set(el, 'value', el.point_id)
// this.$set(el, 'label', el.point_name)
// })
} else {
this.Dialog(res.desc)
}
this.option2 = [...res.result.regionja]
this.option2.map(el => {
this.$set(el, 'value', el.region_id)
this.$set(el, 'label', el.region_name)
})
},
/** 确认 */
async _sendMaterialconfirm () {
@@ -100,12 +86,8 @@ export default {
}
try {
let res = await sendMaterialconfirm(this.option2[this.active2].value, this.option3[this.active3].value, this.option3[this.active3].point_code, this.val2)
if (res.code === '1') {
this.toast(res.desc)
this.toCancle()
} else {
this.Dialog(res.desc)
}
this.toast(res.desc)
this.toCancle()
this.disabled1 = false
} catch (e) {
this.disabled1 = false

View File

@@ -76,33 +76,20 @@ export default {
},
methods: {
async queryTask () {
try {
let res = await queryTask(this.keyword, this.startPoint, this.endPoint)
if (res.code === '1') {
this.dataList = res.result
} else {
this.Dialog(res.desc)
}
} catch (err) {
this.Dialog(err)
}
let res = await queryTask(this.keyword, this.startPoint, this.endPoint)
this.dataList = res.result
},
async taskOperation (type) {
try {
let res = await taskOperation(this.pkId, type)
if (res.code === '1') {
this.toast('操作成功')
this.disabled = false
this.pkId = ''
this.btnred = false
this.dataList = []
this.queryTask()
} else {
this.Dialog(res.desc)
this.disabled = false
}
this.toast(res.desc)
this.disabled = false
this.pkId = ''
this.btnred = false
this.dataList = []
this.queryTask()
} catch (err) {
console.log(err)
this.disabled = false
}
},
toSure (type) {

View File

@@ -82,33 +82,20 @@ export default {
},
methods: {
async queryInstraction () {
try {
let res = await queryInstraction(this.keyword, this.startPoint, this.endPoint)
if (res.code === '1') {
this.dataList = res.result
} else {
this.Dialog(res.desc)
}
} catch (err) {
this.Dialog(err)
}
let res = await queryInstraction(this.keyword, this.startPoint, this.endPoint)
this.dataList = res.result
},
async instOperation (type) {
try {
let res = await instOperation(this.pkId, type)
if (res.code === '1') {
this.toast('操作成功')
this.disabled = false
this.pkId = ''
this.btnred = false
this.dataList = []
this.queryInstraction()
} else {
this.Dialog(res.desc)
this.disabled = false
}
this.toast(res.desc)
this.disabled = false
this.pkId = ''
this.btnred = false
this.dataList = []
this.queryInstraction()
} catch (err) {
console.log(err)
this.disabled = false
}
},
toSure (type) {