接口格式
This commit is contained in:
15
index.html
15
index.html
@@ -8,3 +8,18 @@
|
||||
<div id="app"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<script>
|
||||
(function (doc, win) {
|
||||
var docEl = doc.documentElement,
|
||||
resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
|
||||
recalc = function () {
|
||||
var clientWidth = docEl.clientWidth;
|
||||
if (!clientWidth) return;
|
||||
docEl.style.fontSize = 100 * (clientWidth / 1920) + 'px';
|
||||
};
|
||||
if (!doc.addEventListener) return;
|
||||
win.addEventListener(resizeEvt, recalc, false);
|
||||
doc.addEventListener('DOMContentLoaded', recalc, false);
|
||||
})(document, window);
|
||||
</script>
|
||||
5
src/assets/js/getData1.js
Normal file
5
src/assets/js/getData1.js
Normal file
@@ -0,0 +1,5 @@
|
||||
import {post} from '@js/http.js'
|
||||
|
||||
export const workScreen = (wflag) => post('api/bigScreenScreen/workScreen', {
|
||||
web_flag: wflag
|
||||
})
|
||||
10
src/assets/js/getData2.js
Normal file
10
src/assets/js/getData2.js
Normal file
@@ -0,0 +1,10 @@
|
||||
import {post} from '@js/http.js'
|
||||
|
||||
export const screenZK = (id, cid) => post('api/bigScreenScreen/zk', {
|
||||
accountId: id,
|
||||
center_id: cid
|
||||
})
|
||||
export const query3Dcartoon = (id, cid) => post('api/bigScreenScreen/query3Dcartoon', {
|
||||
accountId: id,
|
||||
center_id: cid
|
||||
})
|
||||
78
src/assets/js/http.js
Normal file
78
src/assets/js/http.js
Normal file
@@ -0,0 +1,78 @@
|
||||
import axios from 'axios'
|
||||
import { Dialog, toast } from './mUtils.js'
|
||||
import store from '../../vuex/store'
|
||||
import router from '@/router'
|
||||
|
||||
axios.defaults.timeout = 50000
|
||||
axios.defaults.headers.post['Content-Type'] = 'application/json;charset=UTF-8'
|
||||
|
||||
axios.interceptors.request.use(
|
||||
config => {
|
||||
if (config.method === 'post') {
|
||||
if (!config.data.flag) {
|
||||
config.data = config.data
|
||||
} else {
|
||||
config.data = config.data.formData
|
||||
}
|
||||
}
|
||||
return config
|
||||
},
|
||||
error => {
|
||||
Dialog('错误的传参')
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
|
||||
axios.interceptors.response.use(
|
||||
response => {
|
||||
if (response.status === 200) {
|
||||
return Promise.resolve(response)
|
||||
} else {
|
||||
return Promise.reject(response)
|
||||
}
|
||||
},
|
||||
error => {
|
||||
if (error && error.response) {
|
||||
switch (error.response.status) {
|
||||
case 401:
|
||||
toast(error.response.data.message)
|
||||
store.dispatch('setSignOut')
|
||||
router.push('/login')
|
||||
break
|
||||
}
|
||||
return Promise.reject(error.response.data)
|
||||
} else {
|
||||
return Promise.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 post1 = (sevmethod, params) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.post(sevmethod, params)
|
||||
.then(response => {
|
||||
resolve(response.data)
|
||||
}, error => {
|
||||
Dialog(error.message)
|
||||
reject(error.message)
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
}
|
||||
@@ -6,7 +6,7 @@ import store from './vuex/store'
|
||||
import _ from 'lodash'
|
||||
import '@css/reset.css'
|
||||
import '@css/layout.styl'
|
||||
import '@js/rem.js'
|
||||
// import '@js/rem.js'
|
||||
import filter from '@js/filter.js'
|
||||
import { Dialog, toast } from '@js/mUtils.js'
|
||||
import {post} from '@fetch/api.js'
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
|
||||
<script>
|
||||
import NavHeader from '@components/header.vue'
|
||||
import {query3Dcartoon} from '@js/getData2.js'
|
||||
export default {
|
||||
name: 'Animation',
|
||||
components: {
|
||||
@@ -63,24 +64,13 @@ export default {
|
||||
this.getData()
|
||||
},
|
||||
methods: {
|
||||
getData () {
|
||||
let data = {
|
||||
'_SRVNAME': 'server.app.screenAPI',
|
||||
'_SRVMETHOD': 'query3Dcartoon',
|
||||
'_DATA': JSON.stringify({
|
||||
accountId: '',
|
||||
form: {
|
||||
center_id: ''
|
||||
}
|
||||
})
|
||||
async getData () {
|
||||
let res = await query3Dcartoon('', '')
|
||||
if (res.code === '1') {
|
||||
this.initInfo = res.result
|
||||
} else {
|
||||
this.Dialog(res.desc)
|
||||
}
|
||||
this
|
||||
.$post(data)
|
||||
.then(res => {
|
||||
if (res.code === '1') {
|
||||
this.initInfo = res.result
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,6 +175,7 @@
|
||||
import NavHeader from '@components/nav.vue'
|
||||
import NumberGrow from '@/components/NumberGrow'
|
||||
import * as echarts from 'echarts'
|
||||
import {workScreen} from '@js/getData1.js'
|
||||
export default {
|
||||
name: 'producedata',
|
||||
components: {
|
||||
@@ -375,44 +376,35 @@ export default {
|
||||
this.getList()
|
||||
}, this.interTime)
|
||||
},
|
||||
getList () {
|
||||
let data = {
|
||||
'_SRVNAME': 'server.app.LargeScreenAPI',
|
||||
'_SRVMETHOD': 'queryLargeScreen',
|
||||
'_DATA': JSON.stringify({
|
||||
web_flag: this.$route.query.type || '1'
|
||||
async getList () {
|
||||
let type = this.$route.query.type || '1'
|
||||
let res = await workScreen(type)
|
||||
if (res.code === '1') {
|
||||
this.xdata2 = []
|
||||
this.ydata2 = []
|
||||
this.initData = res.result
|
||||
this.nav.title = res.result.screenname
|
||||
this.arr1 = res.result.arr1
|
||||
this.arr2 = res.result.arr2
|
||||
this.jo3 = res.result.jo3
|
||||
this.jo6 = res.result.jo6
|
||||
this.arr4 = res.result.arr4
|
||||
this.arr5 = res.result.arr5
|
||||
this.data = [
|
||||
{value: this.jo3.sumproduce_qty, name: '未开始数量'},
|
||||
{value: this.jo3.sumproducing_qty, name: '生产中数量'},
|
||||
{value: this.jo3.sumfinishproduce_qty, name: '已完成数量'}
|
||||
]
|
||||
res.result.arr7.forEach((el) => {
|
||||
this.xdata2.push(el.date)
|
||||
this.ydata2.push(el.count)
|
||||
})
|
||||
this._getEchart()
|
||||
this._getEchart1()
|
||||
this._getEchart2()
|
||||
} else {
|
||||
// this.toast(res.desc)
|
||||
}
|
||||
this
|
||||
.$post(data)
|
||||
.then(res => {
|
||||
if (res.code === '1') {
|
||||
this.xdata2 = []
|
||||
this.ydata2 = []
|
||||
this.initData = res.result
|
||||
this.nav.title = res.result.screenname
|
||||
this.arr1 = res.result.arr1
|
||||
this.arr2 = res.result.arr2
|
||||
this.jo3 = res.result.jo3
|
||||
this.jo6 = res.result.jo6
|
||||
this.arr4 = res.result.arr4
|
||||
this.arr5 = res.result.arr5
|
||||
this.data = [
|
||||
{value: this.jo3.sumproduce_qty, name: '未开始数量'},
|
||||
{value: this.jo3.sumproducing_qty, name: '生产中数量'},
|
||||
{value: this.jo3.sumfinishproduce_qty, name: '已完成数量'}
|
||||
]
|
||||
res.result.arr7.forEach((el) => {
|
||||
this.xdata2.push(el.date)
|
||||
this.ydata2.push(el.count)
|
||||
})
|
||||
this._getEchart()
|
||||
this._getEchart1()
|
||||
this._getEchart2()
|
||||
} else {
|
||||
// this.toast(res.desc)
|
||||
}
|
||||
})
|
||||
},
|
||||
_getEchart () {
|
||||
let data = this.data
|
||||
|
||||
@@ -88,6 +88,7 @@
|
||||
<script>
|
||||
import NavHeader from '@components/header.vue'
|
||||
import { maxArr } from '@js/mUtils.js'
|
||||
import {screenZK} from '@js/getData2.js'
|
||||
export default {
|
||||
name: 'WorkShop',
|
||||
components: {
|
||||
@@ -562,59 +563,50 @@ export default {
|
||||
let myChart = this.$echarts.init(echart)
|
||||
myChart.setOption(option)
|
||||
},
|
||||
_getDatas () {
|
||||
let data = {
|
||||
'_SRVNAME': 'server.app.screenAPI',
|
||||
'_SRVMETHOD': 'queryWorkshop',
|
||||
'_DATA': JSON.stringify({
|
||||
accountId: '',
|
||||
form: {
|
||||
center_id: this.$store.getters.workshopId
|
||||
}
|
||||
})
|
||||
async _getDatas () {
|
||||
let cid = ''
|
||||
if (this.$store.getters.workshopId) {
|
||||
cid = this.$store.getters.equipId
|
||||
}
|
||||
this
|
||||
.$post(data)
|
||||
.then(res => {
|
||||
if (res.code === '1') {
|
||||
this.nameToday = []
|
||||
this.numToday = []
|
||||
this.numPlan = []
|
||||
this.dateBar1 = []
|
||||
this.enoughBar1 = []
|
||||
this.needNumBar1 = []
|
||||
this.notEnoughBar1 = []
|
||||
this.dateBar2 = []
|
||||
this.enoughBar2 = []
|
||||
this.needNumBar2 = []
|
||||
this.notEnoughBar2 = []
|
||||
this.debugging = res.result.shopData.production_today1
|
||||
this.shopData = res.result.shopData
|
||||
this.calculator()
|
||||
res.result.production.map(el => {
|
||||
this.nameToday.push(el.name_today)
|
||||
this.numToday.push(el.num_today)
|
||||
this.numPlan.push(el.num_plan)
|
||||
})
|
||||
res.result.data_bar1.xDate.map(el => {
|
||||
this.dateBar1.push(el.date)
|
||||
this.enoughBar1.push(el.enough)
|
||||
this.needNumBar1.push(el.need_num)
|
||||
this.notEnoughBar1.push(el.not_enough)
|
||||
})
|
||||
res.result.data_bar2.xDate.map(el => {
|
||||
this.dateBar2.push(el.date)
|
||||
this.enoughBar2.push(el.enough)
|
||||
this.needNumBar2.push(el.repertory)
|
||||
this.notEnoughBar2.push(el.not_enough)
|
||||
})
|
||||
this._getEchart1()
|
||||
this._getEchart2()
|
||||
this._getEchart3()
|
||||
} else {
|
||||
this.toast(res.desc)
|
||||
}
|
||||
let res = await screenZK('', cid)
|
||||
if (res.code === '1') {
|
||||
this.nameToday = []
|
||||
this.numToday = []
|
||||
this.numPlan = []
|
||||
this.dateBar1 = []
|
||||
this.enoughBar1 = []
|
||||
this.needNumBar1 = []
|
||||
this.notEnoughBar1 = []
|
||||
this.dateBar2 = []
|
||||
this.enoughBar2 = []
|
||||
this.needNumBar2 = []
|
||||
this.notEnoughBar2 = []
|
||||
this.debugging = res.result.shopData.production_today1
|
||||
this.shopData = res.result.shopData
|
||||
this.calculator()
|
||||
res.result.production.map(el => {
|
||||
this.nameToday.push(el.name_today)
|
||||
this.numToday.push(el.num_today)
|
||||
this.numPlan.push(el.num_plan)
|
||||
})
|
||||
res.result.data_bar1.xDate.map(el => {
|
||||
this.dateBar1.push(el.date)
|
||||
this.enoughBar1.push(el.enough)
|
||||
this.needNumBar1.push(el.need_num)
|
||||
this.notEnoughBar1.push(el.not_enough)
|
||||
})
|
||||
res.result.data_bar2.xDate.map(el => {
|
||||
this.dateBar2.push(el.date)
|
||||
this.enoughBar2.push(el.enough)
|
||||
this.needNumBar2.push(el.repertory)
|
||||
this.notEnoughBar2.push(el.not_enough)
|
||||
})
|
||||
this._getEchart1()
|
||||
this._getEchart2()
|
||||
this._getEchart3()
|
||||
} else {
|
||||
this.Dialog(res.desc)
|
||||
}
|
||||
}
|
||||
},
|
||||
beforeDestroy () {
|
||||
|
||||
Reference in New Issue
Block a user