Browse Source

合并冲突

pull/92/head
liwei 3 years ago
parent
commit
4308ead787
2 changed files with 110 additions and 58 deletions
  1. +1
    -0
      package.json
  2. +109
    -58
      src/views/quality/ods.vue

+ 1
- 0
package.json View File

@ -47,6 +47,7 @@
"file-saver": "2.0.1",
"js-cookie": "2.2.0",
"moment": "^2.29.1",
"neffos.js": "^0.1.25",
"node-fetch": "^2.6.1",
"normalize.css": "7.0.0",
"nprogress": "0.2.0",


+ 109
- 58
src/views/quality/ods.vue View File

@ -48,24 +48,27 @@
</el-carousel>
</div>
</div>
<div class="footer-info">
<!-- <div class="footer-info">
<div>扫描产品信息</div>
<div class="bg-color">
<el-input v-model="code" autofocus placeholder="请扫码" @keyup.enter.native="enterPress"></el-input>
</div>
</div>
</div> -->
</div>
</template>
<script>
import { codeparser } from '@/api/quality/pkg.js'
// import { codeparser } from '@/api/quality/pkg.js'
import * as api from '@/api/quality/ods'
import { getOneOdshead } from '@/api/productexe/base'
import permissLogin from './component/login'
import { getToken } from '@/utils/auth'
const neffos = require('neffos.js')
export default {
components: {permissLogin},
data() {
return {
baseUrl: process.env.VUE_APP_BASE_API,
baseWsUrl: (process.env.VUE_APP_BASE_API).substring(7),
supplierList: [],
actPos: 0,
code: '',
@ -77,11 +80,10 @@ export default {
cutTime: 5000, //
nowIndex: 0,
isLoginVisible: false, //
// torquePicture: '', //
partNumber: '', //
barCodeData: '', //
tableData: [], //
timer: '', //
// timer: '', //
}
},
computed: {
@ -89,38 +91,87 @@ export default {
return this.$refs.videoPlayer.player
},
},
mounted() {
// this.runExample()
},
created() {
this.codeparser()
// this.codeparser()
},
methods: {
//
timedInterface() {
if (this.isLoginVisible === true) {
this.timer = setInterval(() => {
this.getScrewList()
}, 1000)
}
},
//
getScrewList() {
let params = {
stn: this.workPlaceNr
}
api.getScrewList(params).then((res) => {
if (res.code == 200) {
this.partNumber = res.data['PARTNO']
this.barCodeData = res.data['UNITSN']
} else {
this.$message.error(res.msg)
async runExample() {
const _this = this
const ws = (function (getToken){
const self = {}
const nameSpaces = {}
function register(nameSpaceName, events) {
events._OnNamespaceConnected = function (nsConn, msg) {
if (nsConn.conn.wasReconnected()) {
console.log(`re-onnected to namespace: ${msg.Namespace}${nsConn.conn.reconnectTries} after trie(s)`);
} else {
console.log(`onnected to namespace: ${msg.Namespace}`);
}
nsConn.emit("login",JSON.stringify({
'token': getToken(),
'STN': String(_this.workPlaceNr)
}));
};
events.onLogin = function (nsConn, msg) {
console.log(msg)
};
nameSpaces[nameSpaceName] = events
}
async function dial(host) {
return await neffos.dial(`ws://${host}/admin/ws`, nameSpaces, {
reconnect: 1000 * 5
});
}
self.register = register;
self.dial = dial;
return self;
})(getToken)
ws.register("EODS", {
STN_DATA: function (nsConn, msg) {
let msgData = JSON.parse(msg.Body)
_this.code = msgData.UNITSN
_this.partNumber = msgData['PARTNO']
_this.barCodeData = msgData['UNITSN']
_this.getArtrouteodsLst()
// console.log(JSON.parse(msg.Body))
}
})
const connection = await ws.dial(_this.baseWsUrl)
connection.connect("EODS");
},
//
// timedInterface() {
// if (this.isLoginVisible === true) {
// this.timer = setInterval(() => {
// this.getScrewList()
// }, 1000)
// }
// },
//
// getScrewList() {
// let params = {
// stn: this.workPlaceNr
// }
// api.getScrewList(params).then((res) => {
// if (res.code == 200) {
// this.partNumber = res.data['PARTNO']
// this.barCodeData = res.data['UNITSN']
// } else {
// this.$message.error(res.msg)
// }
// })
// },
getLoginMessage(data) {
if (data.isLoginSuccess === true) {
this.workPlaceNr = data.actPosItem
this.isLoginVisible = data.isLoginSuccess
this.getScrewList()
this.timedInterface()
this.runExample()
// this.getScrewList()
// this.timedInterface()
}
},
// andon
@ -137,33 +188,33 @@ export default {
})
},
//
enterPress(e) {
if (!this.isLoginVisible) {
this.$message({
type: 'warning',
message: '请先登录',
})
return
}
let code = e.target.value.trim()
let ruleCode = this.codeRules.filter(
(code) => code['CodeParser-ParserId'] == 'EODS'
)[0]
if (ruleCode['CodeParser-Length'] != 0) {
code = code.substr(
ruleCode['CodeParser-StartPos'],
ruleCode['CodeParser-Length']
)
}
this.code = code
this.getArtrouteodsLst()
},
// enterPress(e) {
// if (!this.isLoginVisible) {
// this.$message({
// type: 'warning',
// message: '',
// })
// return
// }
// let code = e.target.value.trim()
// let ruleCode = this.codeRules.filter(
// (code) => code['CodeParser-ParserId'] == 'EODS'
// )[0]
// if (ruleCode['CodeParser-Length'] != 0) {
// code = code.substr(
// ruleCode['CodeParser-StartPos'],
// ruleCode['CodeParser-Length']
// </span><span class="err"> pan> )
// }
// this.code = code
// this.getArtrouteodsLst()
// },
//
codeparser() {
codeparser().then((res) => {
this.codeRules = res.data
})
},
// codeparser() {
// codeparser().then((res) => {
// this.codeRules = res.data
// })
// },
//
getArtrouteodsLst() {
api.getArtrouteodsLst(this.code, this.workPlaceNr).then(async (res) => {
@ -234,11 +285,11 @@ export default {
})
},
},
beforeDestroy() {
if (this.timer) {
clearInterval(this.timer)
}
},
// beforeDestroy() {
// if (this.timer) {
// clearInterval(this.timer)
// }
// },
}
</script>
<style lang="scss" scoped>


Loading…
Cancel
Save