接口数据

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, username: user,
password: password password: password
}) })
// 手持登陆查询菜单权限 // 手持登陆查询菜单权限
export const authority = (id) => post('api/pda/authority', { export const authority = (id) => post2('api/pda/authority', {
accountId: id accountId: id
}) })
/** 站点管理 */ /** 站点管理 */
// 1.1查询所有区域信息 // 1.1查询所有区域信息
// export const queryArea = () => post('api/hand/queryArea', {}) export const queryArea = () => post2('api/hand/queryArea', {})
export const queryArea = () => { // export const queryArea = () => {
let res = { // 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'}] // 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 // return res
} // }
// 1.2根据区域查询设备编号及状态 // 1.2根据区域查询设备编号及状态
// export const queryPointByArea = (code) => post('api/hand/queryPointByArea', { export const queryPointByArea = (code) => post2('api/hand/queryPointByArea', {
// areaCode: code areaCode: code
// }) })
export const queryPointByArea = () => { // export const queryPointByArea = () => {
let res = { // 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'}] // 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 // return res
} // }
/** 呼叫管理 */ /** 呼叫管理 */
// 1.1创建任务(确定起点) // 1.1创建任务(确定起点)
export const callTask = (scodes, code) => post('api/hand/callTask', { export const callTask = (scodes, code) => post2('api/hand/callTask', {
start_device_codes: scodes, start_device_codes: scodes,
next_device_code: code 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( axios.interceptors.request.use(
config => { config => {
let token = '' // let token = ''
if (store.getters.userInfo !== '') { // if (store.getters.userInfo !== '') {
token = JSON.parse(store.getters.userInfo).token // token = JSON.parse(store.getters.userInfo).token
} // }
token && (config.headers.Authorization = token) // token && (config.headers.Authorization = token)
if (config.method === 'post') { if (config.method === 'post') {
if (!config.data.flag) { if (!config.data.flag) {
config.data = config.data config.data = config.data
@@ -49,20 +49,20 @@ axios.interceptors.response.use(
} }
) )
export const post = (sevmethod, params) => { // export const post = (sevmethod, params) => {
return new Promise((resolve, reject) => { // return new Promise((resolve, reject) => {
axios.post(`${store.getters.baseUrl}/` + sevmethod, params) // axios.post(`${store.getters.baseUrl}/` + sevmethod, params)
.then(response => { // .then(response => {
resolve(response.data) // resolve(response.data)
}, error => { // }, error => {
Dialog(error.message) // Dialog(error.message)
reject(error.message) // reject(error.message)
}) // })
.catch((error) => { // .catch((error) => {
reject(error) // reject(error)
}) // })
}) // })
} // }
export const post2 = (sevmethod, params) => { export const post2 = (sevmethod, params) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {

View File

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

View File

@@ -4,7 +4,7 @@
<section class="content" style="margin-bottom: 0"> <section class="content" style="margin-bottom: 0">
<div class="userInfo"> <div class="userInfo">
<div class="fxcol"> <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> <p class="p2">欢迎进入晟华手持系统</p>
</div> </div>
<div class="exit" @click="Quit"> <div class="exit" @click="Quit">

View File

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

View File

@@ -3,10 +3,10 @@
<header><span class="fxcol">设置</span></header> <header><span class="fxcol">设置</span></header>
<section class="content"> <section class="content">
<ul class="pwd-manage-content"> <ul class="pwd-manage-content">
<li> <!-- <li>
<span>lms地址:</span> <span>lms地址:</span>
<input type="text" v-model.trim="addrip"> <input type="text" v-model.trim="addrip">
</li> </li> -->
<li> <li>
<span>acs地址:</span> <span>acs地址:</span>
<input type="text" v-model.trim="acsip"> <input type="text" v-model.trim="acsip">
@@ -40,10 +40,10 @@ export default {
}, },
methods: { methods: {
_submit () { _submit () {
if (this.addrip === '') { // if (this.addrip === '') {
this.toast('请填写wms地址') // this.toast('请填写wms地址')
return // return
} // }
if (this.acsip === '') { if (this.acsip === '') {
this.toast('请填写acs地址') this.toast('请填写acs地址')
return return
@@ -57,7 +57,7 @@ export default {
// return // return
// } // }
// 存值 // 存值
this.$store.dispatch('setBaseUrl', this.addrip) // this.$store.dispatch('setBaseUrl', this.addrip)
this.$store.dispatch('setAcsIp', this.acsip) this.$store.dispatch('setAcsIp', this.acsip)
// this.$store.dispatch('setPrintUrl', this.printip) // this.$store.dispatch('setPrintUrl', this.printip)
// this.$store.dispatch('setRefreshTime', this.setTime) // 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 fl" v-for="(el, i) in e.pointArr" :key="i">
<div class="site_item_box clear"> <div class="site_item_box clear">
<h3 class="fl">站点</h3> <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> <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="s_code_tip" @click="setStartcode(el)">起点</div>
<div class="n_code_tip" @click="setNextcode(el)">终点</div> <div class="n_code_tip" @click="setNextcode(el)">终点</div>
</div> </div> -->
</div> </div>
</div> </div>
</div> </div>
@@ -26,15 +26,15 @@
<section class="submit-bar"> <section class="submit-bar">
<div class="dot_item"> <div class="dot_item">
<p class="p1">起始点</p> <p class="p1">起始点</p>
<p class="p2">设备号{{scodenameArr.toString()}}</p> <p class="p2">设备号{{sObj.device_name}}</p>
</div> </div>
<div class="dot_item"> <div class="dot_item">
<p class="p1">目标点</p> <p class="p1">目标点</p>
<p class="p2">设备号{{nObj.device_name}}</p> <p class="p2">设备号{{nObj.device_name}}</p>
</div> </div>
<div class="btn_block"> <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': JSON.stringify(sObj) === '{}' && 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) === '{}'}" :disabled="disabled1" @click="toSure">确认</button>
</div> </div>
</section> </section>
</section> </section>
@@ -56,9 +56,9 @@ export default {
pointArr: [], pointArr: [],
regobj: {}, regobj: {},
disabled1: false, disabled1: false,
scodeArr: [], sObj: {},
scodenameArr: [], nObj: {},
nObj: {} isS: false
} }
}, },
mounted () { mounted () {
@@ -109,23 +109,24 @@ export default {
this.refresh(e) this.refresh(e)
} }
}, },
setStartcode (e) { setcode (el) {
this.scodeArr.push(e.device_code) if (this.isS === false) {
this.scodenameArr.push(e.device_name) this.sObj = el
}, this.isS = true
setNextcode (e) { } else if (this.isS) {
this.nObj = e this.nObj = el
this.isS = false
}
}, },
/** 清空点位选择 */ /** 清空点位选择 */
cancle () { cancle () {
this.scodeArr = [] this.sObj = {}
this.scodenameArr = []
this.nObj = {} this.nObj = {}
this.disabled1 = false this.disabled1 = false
}, },
toSure () { toSure () {
this.disabled1 = true this.disabled1 = true
if (this.scodeArr.length === 0 || JSON.stringify(this.nObj) === '{}') { if (JSON.stringify(this.sObj) === '{}' || JSON.stringify(this.nObj) === '{}') {
this.disabled1 = false this.disabled1 = false
return return
} }
@@ -133,7 +134,7 @@ export default {
}, },
async _callTask () { async _callTask () {
try { 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) this.toast(res.desc)
clearInterval(this.timer) clearInterval(this.timer)
this.timer = null this.timer = null
@@ -185,17 +186,13 @@ export default {
_font(14px,20px,#000,500) _font(14px,20px,#000,500)
.site_item_box_inner_r .site_item_box_inner_r
_fj(center) _fj(center)
flex-direction column
_wh(calc(100% - 18px), 40px) _wh(calc(100% - 18px), 40px)
background-color #fff background-color #fff
border-radius 3px border-radius 3px
padding 0 .05rem
overflow hidden overflow hidden
p p
display block
_wh(100%, 20px)
overflow hidden
_font(14px,20px,#999,,center) _font(14px,20px,#999,,center)
padding 0 .05rem
.s_n_code_tip .s_n_code_tip
_fj() _fj()
_wh(100%, .5rem) _wh(100%, .5rem)