接口数据

This commit is contained in:
2023-05-06 16:10:03 +08:00
parent ba30f60ab0
commit 3535af34e7
7 changed files with 72 additions and 75 deletions

View File

@@ -1,39 +1,39 @@
import {post} from '@config/http.js'
import {post2} from '@config/http.js'
// 手持登录
export const loginApi = (user, password) => post('api/pda/login', {
export const loginApi = (user, password) => post2('api/pda/login', {
username: user,
password: password
})
// 手持登陆查询菜单权限
export const authority = (id) => post('api/pda/authority', {
export const authority = (id) => post2('api/pda/authority', {
accountId: id
})
/** 站点管理 */
// 1.1查询所有区域信息
// export const queryArea = () => post('api/hand/queryArea', {})
export const queryArea = () => {
let res = {
result: [{region_code: '1', region_name: 'A1'}, {region_code: '2', region_name: 'A2'}, {region_code: '3', region_name: 'A2'}, {region_code: '4', region_name: 'A10'}]
}
return res
}
export const queryArea = () => post2('api/hand/queryArea', {})
// export const queryArea = () => {
// let res = {
// result: [{region_code: '1', region_name: 'A1'}, {region_code: '2', region_name: 'A2'}, {region_code: '3', region_name: 'A2'}, {region_code: '4', region_name: 'A10'}]
// }
// return res
// }
// 1.2根据区域查询设备编号及状态
// export const queryPointByArea = (code) => post('api/hand/queryPointByArea', {
// areaCode: code
// })
export const queryPointByArea = () => {
let res = {
result: [{device_code: '1', device_name: 'JLDFJLLJ'}, {device_code: '2', device_name: 'JLDFJLLJ'}, {device_code: '3', device_name: 'JLDFJLLJ'}, {device_code: '1', device_name: 'JLDFJLLJ'}, {device_code: '2', device_name: 'JLDFJLLJ'}, {device_code: '3', device_name: 'JLDFJLLJ'}, {device_code: '1', device_name: 'JLDFJLLJ'}, {device_code: '2', device_name: 'JLDFJLLJ'}, {device_code: '3', device_name: 'JLDFJLLJ'}, {device_code: '1', device_name: 'JLDFJLLJ'}, {device_code: '2', device_name: 'JLDFJLLJ'}, {device_code: '3', device_name: 'JLDFJLLJ'}, {device_code: '1', device_name: 'JLDFJLLJ'}, {device_code: '2', device_name: 'JLDFJLLJ'}, {device_code: '3', device_name: 'JLDFJLLJ'}, {device_code: '1', device_name: 'JLDFJLLJ'}, {device_code: '2', device_name: 'JLDFJLLJ'}, {device_code: '3', device_name: 'JLDFJLLJ'}, {device_code: '1', device_name: 'JLDFJLLJ'}, {device_code: '2', device_name: 'JLDFJLLJ'}, {device_code: '3', device_name: 'JLDFJLLJ'}, {device_code: '1', device_name: 'JLDFJLLJ'}, {device_code: '2', device_name: 'JLDFJLLJ'}, {device_code: '3', device_name: 'JLDFJLLJ'}, {device_code: '1', device_name: 'JLDFJLLJ'}, {device_code: '2', device_name: 'JLDFJLLJ'}, {device_code: '3', device_name: 'JLDFJLLJ'}]
}
return res
}
export const queryPointByArea = (code) => post2('api/hand/queryPointByArea', {
areaCode: code
})
// export const queryPointByArea = () => {
// let res = {
// result: [{device_code: '1', device_name: 'JLDFJLLJ'}, {device_code: '2', device_name: 'JLDFJLLJ'}, {device_code: '3', device_name: 'JLDFJLLJ'}, {device_code: '1', device_name: 'JLDFJLLJ'}, {device_code: '2', device_name: 'JLDFJLLJ'}, {device_code: '3', device_name: 'JLDFJLLJ'}, {device_code: '1', device_name: 'JLDFJLLJ'}, {device_code: '2', device_name: 'JLDFJLLJ'}, {device_code: '3', device_name: 'JLDFJLLJ'}, {device_code: '1', device_name: 'JLDFJLLJ'}, {device_code: '2', device_name: 'JLDFJLLJ'}, {device_code: '3', device_name: 'JLDFJLLJ'}, {device_code: '1', device_name: 'JLDFJLLJ'}, {device_code: '2', device_name: 'JLDFJLLJ'}, {device_code: '3', device_name: 'JLDFJLLJ'}, {device_code: '1', device_name: 'JLDFJLLJ'}, {device_code: '2', device_name: 'JLDFJLLJ'}, {device_code: '3', device_name: 'JLDFJLLJ'}, {device_code: '1', device_name: 'JLDFJLLJ'}, {device_code: '2', device_name: 'JLDFJLLJ'}, {device_code: '3', device_name: 'JLDFJLLJ'}, {device_code: '1', device_name: 'JLDFJLLJ'}, {device_code: '2', device_name: 'JLDFJLLJ'}, {device_code: '3', device_name: 'JLDFJLLJ'}, {device_code: '1', device_name: 'JLDFJLLJ'}, {device_code: '2', device_name: 'JLDFJLLJ'}, {device_code: '3', device_name: 'JLDFJLLJ'}]
// }
// return res
// }
/** 呼叫管理 */
// 1.1创建任务(确定起点)
export const callTask = (scodes, code) => post('api/hand/callTask', {
export const callTask = (scodes, code) => post2('api/hand/callTask', {
start_device_codes: scodes,
next_device_code: code
})

View File

@@ -8,11 +8,11 @@ axios.defaults.headers.post['Content-Type'] = 'application/json;charset=UTF-8'
axios.interceptors.request.use(
config => {
let token = ''
if (store.getters.userInfo !== '') {
token = JSON.parse(store.getters.userInfo).token
}
token && (config.headers.Authorization = token)
// let token = ''
// if (store.getters.userInfo !== '') {
// token = JSON.parse(store.getters.userInfo).token
// }
// token && (config.headers.Authorization = token)
if (config.method === 'post') {
if (!config.data.flag) {
config.data = config.data
@@ -49,20 +49,20 @@ axios.interceptors.response.use(
}
)
export const post = (sevmethod, params) => {
return new Promise((resolve, reject) => {
axios.post(`${store.getters.baseUrl}/` + sevmethod, params)
.then(response => {
resolve(response.data)
}, error => {
Dialog(error.message)
reject(error.message)
})
.catch((error) => {
reject(error)
})
})
}
// export const post = (sevmethod, params) => {
// return new Promise((resolve, reject) => {
// axios.post(`${store.getters.baseUrl}/` + sevmethod, params)
// .then(response => {
// resolve(response.data)
// }, error => {
// Dialog(error.message)
// reject(error.message)
// })
// .catch((error) => {
// reject(error)
// })
// })
// }
export const post2 = (sevmethod, params) => {
return new Promise((resolve, reject) => {

View File

@@ -9,7 +9,6 @@ import VueQrcodeReader from 'vue-qrcode-reader'
import store from './vuex/store'
import '@config/rem.js'
import Print from 'vue-print-nb'
import {post} from '@config/http.js'
import { Dialog, toast } from '@config/mUtils.js'
import filter from '@config/filter.js'
import { baseUrl } from '@config/env.js'
@@ -24,7 +23,6 @@ Vue.use(infiniteScroll)
Vue.use(Print)
Vue.prototype.Dialog = Dialog
Vue.prototype.toast = toast
Vue.prototype.$post = post
Vue.prototype.baseUrl = baseUrl
Vue.use(Print)
for (let k in filter) {

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).nickName : ''}}</p>
<p class="p1">{{$store.getters.userInfo !== '' ? JSON.parse($store.getters.userInfo).user_name : ''}}</p>
<p class="p2">欢迎进入晟华手持系统</p>
</div>
<div class="exit" @click="Quit">

View File

@@ -56,9 +56,9 @@ export default {
if (res.code === '1') {
let obj = {}
if (this.memberName) {
obj = Object.assign({}, res.result.user.user, {token: res.token, loginname: this.loginname})
obj = Object.assign({}, res.result, {loginname: this.loginname})
} else {
obj = Object.assign({}, res.result.user.user, {token: res.result.token, loginname: ''})
obj = Object.assign({}, res.result, {loginname: ''})
}
this.$store.dispatch('setUserInfo', JSON.stringify(obj))
this.$router.push('/home')
@@ -91,6 +91,8 @@ export default {
<style lang="stylus" scoped>
@import '~@style/mixin'
.content
margin 0
.p1
_font(.6rem,1,#444)
padding-top: 0.9rem

View File

@@ -3,10 +3,10 @@
<header><span class="fxcol">设置</span></header>
<section class="content">
<ul class="pwd-manage-content">
<li>
<!-- <li>
<span>lms地址:</span>
<input type="text" v-model.trim="addrip">
</li>
</li> -->
<li>
<span>acs地址:</span>
<input type="text" v-model.trim="acsip">
@@ -40,10 +40,10 @@ export default {
},
methods: {
_submit () {
if (this.addrip === '') {
this.toast('请填写wms地址')
return
}
// if (this.addrip === '') {
// this.toast('请填写wms地址')
// return
// }
if (this.acsip === '') {
this.toast('请填写acs地址')
return
@@ -57,7 +57,7 @@ export default {
// return
// }
// 存值
this.$store.dispatch('setBaseUrl', this.addrip)
// this.$store.dispatch('setBaseUrl', this.addrip)
this.$store.dispatch('setAcsIp', this.acsip)
// this.$store.dispatch('setPrintUrl', this.printip)
// this.$store.dispatch('setRefreshTime', this.setTime)

View File

@@ -11,12 +11,12 @@
<div class="site_item fl" v-for="(el, i) in e.pointArr" :key="i">
<div class="site_item_box clear">
<h3 class="fl">站点</h3>
<div class="fl site_item_box_inner_r">
<div class="fl site_item_box_inner_r" @click="setcode(el)">
<p>{{el.device_name}}</p>
<div class="s_n_code_tip">
<!-- <div class="s_n_code_tip">
<div class="s_code_tip" @click="setStartcode(el)">起点</div>
<div class="n_code_tip" @click="setNextcode(el)">终点</div>
</div>
</div> -->
</div>
</div>
</div>
@@ -26,15 +26,15 @@
<section class="submit-bar">
<div class="dot_item">
<p class="p1">起始点</p>
<p class="p2">设备号{{scodenameArr.toString()}}</p>
<p class="p2">设备号{{sObj.device_name}}</p>
</div>
<div class="dot_item">
<p class="p1">目标点</p>
<p class="p2">设备号{{nObj.device_name}}</p>
</div>
<div class="btn_block">
<button class="btn btn1" :class="{'btn-disabled': scodeArr.length === 0 && JSON.stringify(nObj) === '{}'}" @click="cancle">清空</button>
<button class="btn btn1" :class="{'btn-disabled': scodeArr.length === 0 || JSON.stringify(nObj) === '{}'}" :disabled="disabled1" @click="toSure">确认</button>
<button class="btn btn1" :class="{'btn-disabled': JSON.stringify(sObj) === '{}' && JSON.stringify(nObj) === '{}'}" @click="cancle">清空</button>
<button class="btn btn1" :class="{'btn-disabled': JSON.stringify(sObj) === '{}' || JSON.stringify(nObj) === '{}'}" :disabled="disabled1" @click="toSure">确认</button>
</div>
</section>
</section>
@@ -56,9 +56,9 @@ export default {
pointArr: [],
regobj: {},
disabled1: false,
scodeArr: [],
scodenameArr: [],
nObj: {}
sObj: {},
nObj: {},
isS: false
}
},
mounted () {
@@ -109,23 +109,24 @@ export default {
this.refresh(e)
}
},
setStartcode (e) {
this.scodeArr.push(e.device_code)
this.scodenameArr.push(e.device_name)
},
setNextcode (e) {
this.nObj = e
setcode (el) {
if (this.isS === false) {
this.sObj = el
this.isS = true
} else if (this.isS) {
this.nObj = el
this.isS = false
}
},
/** 清空点位选择 */
cancle () {
this.scodeArr = []
this.scodenameArr = []
this.sObj = {}
this.nObj = {}
this.disabled1 = false
},
toSure () {
this.disabled1 = true
if (this.scodeArr.length === 0 || JSON.stringify(this.nObj) === '{}') {
if (JSON.stringify(this.sObj) === '{}' || JSON.stringify(this.nObj) === '{}') {
this.disabled1 = false
return
}
@@ -133,7 +134,7 @@ export default {
},
async _callTask () {
try {
let res = await callTask(this.scodeArr, this.nObj.device_code)
let res = await callTask(this.sObj.device_code, this.nObj.device_code)
this.toast(res.desc)
clearInterval(this.timer)
this.timer = null
@@ -185,17 +186,13 @@ export default {
_font(14px,20px,#000,500)
.site_item_box_inner_r
_fj(center)
flex-direction column
_wh(calc(100% - 18px), 40px)
background-color #fff
border-radius 3px
padding 0 .05rem
overflow hidden
p
display block
_wh(100%, 20px)
overflow hidden
_font(14px,20px,#999,,center)
padding 0 .05rem
.s_n_code_tip
_fj()
_wh(100%, .5rem)