From aacd5124a84b24da593d480dd93213881807e9b8 Mon Sep 17 00:00:00 2001 From: hzz Date: Fri, 26 Jan 2024 17:15:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AD=9F=E5=8A=A0=E6=8B=89=E5=A4=A7=E5=B1=8F?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=20=E5=B7=A5=E4=BD=8D=E5=B1=8F=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=20=20=E8=AE=A1=E5=88=92=E4=BA=A7=E9=87=8F=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/http/Exhibition/station.ts | 2 +- src/locales/lang/en.ts | 10 +- src/utils/http_custom.ts | 208 ++++++++++++++++++ .../Exhibition/Bengal/component/Header.vue | 4 +- src/views/Exhibition/Bengal/index.vue | 18 +- src/views/Exhibition/Station/index.vue | 30 +-- src/views/MicroExhibition/index.vue | 2 +- 7 files changed, 234 insertions(+), 40 deletions(-) create mode 100644 src/utils/http_custom.ts diff --git a/src/http/Exhibition/station.ts b/src/http/Exhibition/station.ts index dd5fd0b..e8fd34c 100644 --- a/src/http/Exhibition/station.ts +++ b/src/http/Exhibition/station.ts @@ -1,4 +1,4 @@ -import {get,post} from "@/utils/http" +import {get,post} from "@/utils/http_custom" //获取设备在线状态、设备列表 export function getStatus(data){ diff --git a/src/locales/lang/en.ts b/src/locales/lang/en.ts index c037890..6cce5cd 100644 --- a/src/locales/lang/en.ts +++ b/src/locales/lang/en.ts @@ -86,11 +86,11 @@ export default { 'QiCheDevSchedule':'AIAIM Division\n Equipment Complete Schedule', 'InPlantProductsDevList':'Equipment List', 'SerialNum':'Serial Number', - 'RackNum':'Machine Number', - 'DevName':'Machine Name', - 'JiqiName':'Machine Name', + 'RackNum':'Machine number', + 'DevName':'Machine name', + 'JiqiName':'Machine name', 'ofLegion':'Affiliated Division', - 'DevStatus':'Device Status', + 'DevStatus':'Device status', 'JiqiStatus':'Machine Status', "RunTime":'Working hours', 'finishSchedule':'Complete Schedule', @@ -160,7 +160,7 @@ export default { 'haltTime':'Emergency Stop hours', 'DevRunComparison':'Running Comparison Diagram', 'TimeUtilizationRate':'Time Utilization', - 'UtilizationRate':'Utilization Rate', + 'UtilizationRate':'Utilization rate', 'MicrofactoriesDevChart':'Micro-Factory Equipment IoT', 'MicrofactoriesDevinfo':'Micro-Factory Equipment Information', 'DevRunNum':'Running Equipment Quantity', diff --git a/src/utils/http_custom.ts b/src/utils/http_custom.ts new file mode 100644 index 0000000..bd3cdfa --- /dev/null +++ b/src/utils/http_custom.ts @@ -0,0 +1,208 @@ +// http.ts +import axios, { AxiosRequestConfig, AxiosResponse } from 'axios' +// import {development,production} from "@/utils/devSever" +import qs from 'qs' +// import MD5 from 'js-md5'; +import { open4 } from "./hint" +import Router from '../router/index' +// const router = Router; //路由全局对象 +// import "./dateRormat" //导出时间原型添加事件 +let url = process.env.VUE_APP_BASE_API +// if (process.env.NODE_ENV === 'development') { +// url = development.xhr//开发环境 + +// } else if (process.env.NODE_ENV === 'production') { +// url = production.xhr;//生产环境 //正式环境+ +// } + +// 3.创建自定义axios 限制响应时间 +axios.create({ + + // baseURL: url, + timeout: 3000, +}) + + +//请求拦截器 +axios.interceptors.request.use((config: AxiosRequestConfig | any) => { + // console.group("本次请求地址为", config) //请求提示 + // 在发送请求之前做些什么,例如加入token + // if (config.data) { + // console.group("本次请求地址为", config.data.split("&")[0].split("=")[1]) //请求提示 + // } else { + // console.group("本次请求地址为", config.params.code) //请求提示 + // } + return config; +}, function (error) { + // 对请求错误做些什么 + return Promise.reject(error); +}); + +//响应拦截器 +axios.interceptors.response.use(function (response: AxiosResponse) { + // 在接收响应做些什么,例如跳转到登录页 + // console.log(response, "我是响应拦截器") + const router = Router; //路由全局对象 + + let status = response.status; + // console.log(response,"sssssssfafafafafaaaf"); + + // if (status === 200) { + // let code = response.data.Code; + + // if (code == "") { + // // console.log("调用成功") + // } else if (code == -10000) { + // open4("接口调用失败:" + response.data.Message) + // return; + // } else if (code == 'user login Error') { + // open4("登陆过期:" + response.data.Message) + // setTimeout(() => { + // router.push('/Login') + // }, 1000); + // return; + // } + // } else if (status === 401) { + // open4("接口调用失败:" + response.data.Message) + // return; + + // } else if (status === 500) { + // open4("接口调用失败:" + response.data.Message) + // return; + // } + + // if (response.data.success == 'false') { + // open4("接口调用失败:" + response.data.Message) + // return; + // } + return response; +}, function (error) { + // 对响应错误做点什么 + return Promise.reject(error); +}); + + +export function get(staurl: string, data: any = '') { + // let strTime = (new Date()).Format("yyyyMMddhhmmss") + // let strPara = '{"datetime":"' + strTime + '",' + data + '}'; + // console.log(strPara); + // let password = "RicardPwd"; + // let strSign = password + strPara + password; + // console.log(strSign); + // strSign = MD5(strSign); + // let strData = 'code=' + code + '&sign=' + strSign + '¶=' + strPara; + + let _url = staurl //"?" + strData; + + return new Promise((resolve, rejects) => { + let header = { //请求头设置 + "Access-Control-Allow-Origin": "*" + } + axios({ + url: _url,//在线跨域请求 + method: "get",//默认是get请求 + headers: header, + params: data + }).then(function (val) { + // console.log(val) // axios会对我们请求来的结果进行再一次的封装( 让安全性提高 ) + resolve(val.data) + }).catch(function (err) { + // console.log(err) + rejects(err) + }) + + }) +} + + +export function put(staurl: string, data: any = '') { + // let strTime = (new Date()).Format("yyyyMMddhhmmss") + // let strPara = '{"datetime":"' + strTime + '",' + data + '}'; + // console.log(strPara); + // let password = "RicardPwd"; + // let strSign = password + strPara + password; + // console.log(strSign); + // strSign = MD5(strSign); + // let strData = 'code=' + code + '&sign=' + strSign + '¶=' + strPara; + + let _url = staurl //"?" + strData; + + return new Promise((resolve, rejects) => { + let header = { //请求头设置 + "Access-Control-Allow-Origin": "*" + } + axios({ + url: _url,//在线跨域请求 + method: "put",//默认是get请求 + headers: header, + params: data + }).then(function (val) { + // console.log(val) // axios会对我们请求来的结果进行再一次的封装( 让安全性提高 ) + resolve(val.data) + }).catch(function (err) { + // console.log(err) + rejects(err) + }) + + }) +} + + +export function post(staurl: string, data: any = "", method: string = "POST") { + + // strData = 'code=' + code + '&sign=' + strSign + '¶=' + tmpPara; + // console.log(strData); + let _url = staurl //+ "?" + strData; + let METHOD = method || "POST" + return new Promise((resolve, rejects) => { + let params: any = {} + // 处理表单结果中文件的操作 + + axios({ + url: _url, + method: METHOD, + data: data + }).then(function (res) { + // console.log(val) // axios会对我们请求来的结果进行再一次的封装( 让安全性提高 ) + resolve(res.data) + }).catch(function (err) { + // console.log(err) + rejects(err) + }) + + + }) +} + + + +export function postupLoad(staurl: string, data: any = "", method: string = "POST") { + + + let _url = staurl //+ "?" + strData; + let METHOD = method || "POST" + let header = { //请求头设置 + "Content-Type": "multipart/form-data" + } + return new Promise((resolve, rejects) => { + let params: any = {} + // 处理表单结果中文件的操作 + + axios({ + url: _url, + method: METHOD, + data: data, + headers: header + }).then(function (res) { + // console.log(val) // axios会对我们请求来的结果进行再一次的封装( 让安全性提高 ) + resolve(res.data) + }).catch(function (err) { + // console.log(err) + rejects(err) + }) + + + }) +} + + diff --git a/src/views/Exhibition/Bengal/component/Header.vue b/src/views/Exhibition/Bengal/component/Header.vue index 8c26bae..deb5fed 100644 --- a/src/views/Exhibition/Bengal/component/Header.vue +++ b/src/views/Exhibition/Bengal/component/Header.vue @@ -68,9 +68,9 @@ onMounted(() => { position: absolute; top: 25px; line-height: 50px; - font-weight: 400; + font-weight: 700; font-style: normal; - font-size: 30px; + font-size: 36px; color: rgba(0, 255, 255, 0.996078431372549); } diff --git a/src/views/Exhibition/Bengal/index.vue b/src/views/Exhibition/Bengal/index.vue index 2576770..7d556b0 100644 --- a/src/views/Exhibition/Bengal/index.vue +++ b/src/views/Exhibition/Bengal/index.vue @@ -34,9 +34,9 @@
- +
@@ -124,8 +124,6 @@ import Header from './component/Header.vue' import BorderVue from './component/Border.vue' import DevCard from './component/DevCard.vue' import BarChart from './component/BarChart.vue' - -import { getmDeviceList, getmDeviceProduction } from '@/http/MicroExhibition' import { ref, onMounted, onUnmounted, getCurrentInstance, watch, onUpdated, computed, reactive } from 'vue' import { mjlDeviceList, mjlDeviceProduction } from '@/http/Exhibition/Bengal' @@ -142,7 +140,7 @@ if (lang && languageHash(lang) && languageHash(lang) != getStoredLanguage()) { window.location.reload() } -let videoUrl = ref('https://d.tufting222.cn/video/yzy/GEDOS_merge.mp4') +let videoUrl = ref('https://d.tufting222.cn/video/yzy/micor_edos_english.mp4') const videoElement = ref(null) let timer = null let timers = null @@ -243,11 +241,11 @@ function getWebsocket(val) { xhj_data[1].value = msg.WorkingState } //JUKI - if (msg.RackNumber == 'JUKI高速直驱平缝机') { + if (msg.RackNumber == 'DDL-900C') { juki_data[1].value = msg.WorkingState } //Yamato - if (msg.RackNumber == 'Yamato包缝机') { + if (msg.RackNumber == 'AZ7000SD') { yamato_data[1].value = msg.WorkingState } @@ -425,11 +423,11 @@ onUnmounted(() => { justify-content: space-around; align-items: center; box-sizing: border-box; - padding: 0 20px; + /* padding: 0 20px; */ } .key-text { - width: 60%; + width: 50%; font-size: 18px; color: #02c1d7; font-weight: 700; @@ -437,7 +435,7 @@ onUnmounted(() => { } .value-text { - width: 40%; + width: 50%; font-size: 16px; font-weight: bold; color: #AEEEFAFE; diff --git a/src/views/Exhibition/Station/index.vue b/src/views/Exhibition/Station/index.vue index 8cb5905..54617ca 100644 --- a/src/views/Exhibition/Station/index.vue +++ b/src/views/Exhibition/Station/index.vue @@ -1,16 +1,7 @@ -