diff --git a/src/utils/request.js b/src/utils/request.js index d2880d9..bb53200 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -16,7 +16,7 @@ const http = axios.create({ */ http.interceptors.request.use(config => { config.headers['Accept-Language'] = Cookies.get('language') || 'zh-CN' - config.headers['token'] = Cookies.get('token') || '' + config.headers['token'] = 'token' in config.headers ? config.headers.token : (Cookies.get('token') || '') // console.log('[request interceptor] token is:', config.headers['token']) // 默认参数 var defaults = {} diff --git a/src/views/modules/pms/opcAndBatchConfig/components/opcView.vue b/src/views/modules/pms/opcAndBatchConfig/components/opcView.vue index 63a37e8..5b27de9 100644 --- a/src/views/modules/pms/opcAndBatchConfig/components/opcView.vue +++ b/src/views/modules/pms/opcAndBatchConfig/components/opcView.vue @@ -1,6 +1,11 @@ @@ -12,11 +17,47 @@ export default { components: { InputsArea }, props: {}, data() { - return {}; + return { + dataForm: { + ip: "10.196.10.131", + messageMode: 1, + plcName: "Siemens OPC UA Server for OpenPCS 7", + policyConfig: "None", + urlConfig: "opc.tcp://CQNSDCSOPC1:4863", + userConfigs: "", + }, + btnLoading: false + }; + }, + watch: { + btnLoading(val) { + if (val) { + document.body.style.cursor = 'progress' + } else { + document.body.style.cursor = 'unset' + } + } + }, + methods: { + handleConnectOpc() { + this.btnLoading = true + const url = "/opcua/addThisPlc"; + this.$http.post(url, { ...this.dataForm }, { + headers: { + token: '' + } + }).then(({ data: res }) => { + this.btnLoading = false + if (res.code !== 0) { + this.$message({ + message: res.msg, + type: 'error', + duration: 1500 + }) + } + }); + }, }, - created() {}, - mounted() {}, - methods: {}, };