Commit 83c9d0fe authored by 徐来柯's avatar 徐来柯

update

parent fc8638fd
<template>
<div class="box-container">
<div class="wrap">
<search-form :formList="[1,2,3]" :searchList="searchList" :btnList="[1,2]" :formData="formData" @searchData="searchData" @openDialog="openDialog" @delData="delData" />
<search-form :formList="[1,2,3]" :searchList="searchList" :btnList="[1,2]" :formData="formData" @scanGunCode="scanGunCode" @searchData="searchData" @openDialog="openDialog" @delData="delData" />
<el-table
border
height="675"
......@@ -186,6 +186,25 @@ export default {
console.log('err',err)
})
},
// 扫码枪扫码
scanGunCode(value) {
console.log('开始扫码。。。')
this.$axios({
method:"post",
url:`/api/MaterialDelivery/MaterialDelivery_ScanCodeAdd?ScanCode=${value}`,
}).then((res)=>{
console.log('扫码成功。。。')
var postData = {
argKeyWord: this.formData.argKeyWord,
argWhere: this.formData.argWhere,
Stime: this.formData.dateValue ? this.$moment(this.formData.dateValue[0]).format('YYYY-MM-DD HH:mm:ss') : '',
Etime: this.formData.dateValue ? this.$moment(this.formData.dateValue[1]).format('YYYY-MM-DD HH:mm:ss') : ''
}
this.searchData(this.postData)
}).catch(() => {
console.log('扫码失败。。。')
})
},
handleSelectionChange (val) {
this.checkList = val
},
......
<template>
<div class="box-container">
<div class="wrap">
<search-form :formList="[1,2,3]" :btnList="[1,2]" :searchList="searchList" :formData="formData" @searchData="searchData" @openDialog="openDialog" @delData="delData" />
<search-form :formList="[1,2,3]" :btnList="[1,2]" :searchList="searchList" :formData="formData" @scanGunCode="scanGunCode" @searchData="searchData" @openDialog="openDialog" @delData="delData" />
<el-table
border
height="675"
......@@ -149,7 +149,6 @@ export default {
},
created() {
this.searchData()
this.scanGunCode()
},
methods: {
searchData () {
......@@ -197,86 +196,23 @@ export default {
}
},
// 扫码枪扫码
scanGunCode() {
let barCode = ''
let lastTime, nextTime
let lastCode, nextCode
window.document.onkeypress = e => {
// if (this.loading) {
// // 防止高频率扫码,只能扫一次
// return
// }
if (window.event) {
// IE
nextCode = e.keyCode
} else if (e.which) {
// Netscape/Firefox/Opera
nextCode = e.which
}
if (e.which === 13) {
if (barCode.length < 3) return // 手动输入的时间不会让code的长度大于2,所以这里只会对扫码枪有
console.log(barCode)
console.log('扫码结束')
// this.loading = true
const cacheCode = barCode
this.$axios({
method:"post",
url:`/api/MaterialWarehousing/MaterialDelivery_ScanCodeAdd`,
data: {
ScanCode: cacheCode
}
}).then((res)=>{
var postData = {
argKeyWord: this.formData.argKeyWord,
argWhere: this.formData.argWhere,
Stime: this.formData.dateValue ? this.$moment(this.formData.dateValue[0]).format('YYYY-MM-DD HH:mm:ss') : '',
Etime: this.formData.dateValue ? this.$moment(this.formData.dateValue[1]).format('YYYY-MM-DD HH:mm:ss') : ''
}
this.searchData(this.postData)
})
// request({
// url: `/api/MaterialWarehousing/MaterialDelivery_ScanCodeAdd`,
// method: 'put',
// data: {
// ScanCode: cacheCode
// }
// })
// .then(res => {
// // this.loading = false
// var postData = {
// argKeyWord: this.formData.argKeyWord,
// argWhere: this.formData.argWhere,
// Stime: this.formData.dateValue ? this.$moment(this.formData.dateValue[0]).format('YYYY-MM-DD HH:mm:ss') : '',
// Etime: this.formData.dateValue ? this.$moment(this.formData.dateValue[1]).format('YYYY-MM-DD HH:mm:ss') : ''
// }
// $this.searchData(this.postData)
// })
// .catch(() => {
// // this.loading = false
// })
barCode = ''
lastCode = ''
lastTime = ''
return
}
nextTime = new Date().getTime()
if (!lastTime && !lastCode) {
console.log('扫码开始。。。')
barCode += e.key
}
if (lastCode && lastTime && nextTime - lastTime > 500) {
// 当扫码前有keypress事件时,防止首字缺失
console.log('防止首字缺失。。。')
barCode = e.key
} else if (lastCode && lastTime) {
console.log('扫码中。。。')
barCode += e.key
scanGunCode(value) {
console.log('开始扫码。。。')
this.$axios({
method:"post",
url:`/api/MaterialWarehousing/MWarehousing_ScanCodeAdd?ScanCode=${value}`,
}).then((res)=>{
console.log('扫码成功。。。')
var postData = {
argKeyWord: this.formData.argKeyWord,
argWhere: this.formData.argWhere,
Stime: this.formData.dateValue ? this.$moment(this.formData.dateValue[0]).format('YYYY-MM-DD HH:mm:ss') : '',
Etime: this.formData.dateValue ? this.$moment(this.formData.dateValue[1]).format('YYYY-MM-DD HH:mm:ss') : ''
}
lastCode = nextCode
lastTime = nextTime
console.log(lastCode)
}
this.searchData(this.postData)
}).catch(() => {
console.log('扫码失败。。。')
})
},
resetData () {
return {
......
<template>
<div class="box-container">
<div class="wrap">
<search-form :formList="[1,2,3]" :btnList="[1,2]" :searchList="searchList" :formData="formData" @searchData="searchData" @openDialog="openDialog" @delData="delData" />
<search-form :formList="[1,2,3]" :btnList="[1,2]" :searchList="searchList" :formData="formData" @scanGunCode="scanGunCode" @searchData="searchData" @openDialog="openDialog" @delData="delData" />
<el-table
border
height="675"
......@@ -151,7 +151,6 @@ export default {
},
created() {
this.searchData()
this.scanGunCode()
},
methods: {
searchData () {
......@@ -199,86 +198,23 @@ export default {
}
},
// 扫码枪扫码
scanGunCode() {
let barCode = ''
let lastTime, nextTime
let lastCode, nextCode
window.document.onkeypress = e => {
// if (this.loading) {
// // 防止高频率扫码,只能扫一次
// return
// }
if (window.event) {
// IE
nextCode = e.keyCode
} else if (e.which) {
// Netscape/Firefox/Opera
nextCode = e.which
}
if (e.which === 13) {
if (barCode.length < 3) return // 手动输入的时间不会让code的长度大于2,所以这里只会对扫码枪有
console.log(barCode)
console.log('扫码结束')
// this.loading = true
const cacheCode = barCode
this.$axios({
method:"post",
url:`/api/MaterialWarehousing/MaterialDelivery_ScanCodeAdd`,
data: {
ScanCode: cacheCode
}
}).then((res)=>{
var postData = {
argKeyWord: this.formData.argKeyWord,
argWhere: this.formData.argWhere,
Stime: this.formData.dateValue ? this.$moment(this.formData.dateValue[0]).format('YYYY-MM-DD HH:mm:ss') : '',
Etime: this.formData.dateValue ? this.$moment(this.formData.dateValue[1]).format('YYYY-MM-DD HH:mm:ss') : ''
}
this.searchData(this.postData)
})
// request({
// url: `/api/MaterialWarehousing/MaterialDelivery_ScanCodeAdd`,
// method: 'put',
// data: {
// ScanCode: cacheCode
// }
// })
// .then(res => {
// // this.loading = false
// var postData = {
// argKeyWord: this.formData.argKeyWord,
// argWhere: this.formData.argWhere,
// Stime: this.formData.dateValue ? this.$moment(this.formData.dateValue[0]).format('YYYY-MM-DD HH:mm:ss') : '',
// Etime: this.formData.dateValue ? this.$moment(this.formData.dateValue[1]).format('YYYY-MM-DD HH:mm:ss') : ''
// }
// $this.searchData(this.postData)
// })
// .catch(() => {
// // this.loading = false
// })
barCode = ''
lastCode = ''
lastTime = ''
return
}
nextTime = new Date().getTime()
if (!lastTime && !lastCode) {
console.log('扫码开始。。。')
barCode += e.key
}
if (lastCode && lastTime && nextTime - lastTime > 500) {
// 当扫码前有keypress事件时,防止首字缺失
console.log('防止首字缺失。。。')
barCode = e.key
} else if (lastCode && lastTime) {
console.log('扫码中。。。')
barCode += e.key
scanGunCode(value) {
console.log('开始扫码。。。')
this.$axios({
method:"post",
url:`/api/ProductDelivery/ProductDelivery_ScanCodeAdd?ScanCode=${value}`,
}).then((res)=>{
console.log('扫码成功。。。')
var postData = {
argKeyWord: this.formData.argKeyWord,
argWhere: this.formData.argWhere,
Stime: this.formData.dateValue ? this.$moment(this.formData.dateValue[0]).format('YYYY-MM-DD HH:mm:ss') : '',
Etime: this.formData.dateValue ? this.$moment(this.formData.dateValue[1]).format('YYYY-MM-DD HH:mm:ss') : ''
}
lastCode = nextCode
lastTime = nextTime
console.log(lastCode)
}
this.searchData(this.postData)
}).catch(() => {
console.log('扫码失败。。。')
})
},
resetData () {
return {
......
<template>
<div class="box-container">
<div class="wrap">
<search-form :formList="[1,2,3]" :btnList="[1,2]" :searchList="searchList" :formData="formData" @searchData="searchData" @openDialog="openDialog" @delData="delData" />
<search-form :formList="[1,2,3]" :btnList="[1,2]" :searchList="searchList" :formData="formData" @scanGunCode="scanGunCode" @searchData="searchData" @openDialog="openDialog" @delData="delData" />
<el-table
border
height="675"
......@@ -151,7 +151,6 @@ export default {
},
created() {
this.searchData()
this.scanGunCode()
},
methods: {
searchData () {
......@@ -199,86 +198,23 @@ export default {
}
},
// 扫码枪扫码
scanGunCode() {
let barCode = ''
let lastTime, nextTime
let lastCode, nextCode
window.document.onkeypress = e => {
// if (this.loading) {
// // 防止高频率扫码,只能扫一次
// return
// }
if (window.event) {
// IE
nextCode = e.keyCode
} else if (e.which) {
// Netscape/Firefox/Opera
nextCode = e.which
}
if (e.which === 13) {
if (barCode.length < 3) return // 手动输入的时间不会让code的长度大于2,所以这里只会对扫码枪有
console.log(barCode)
console.log('扫码结束')
// this.loading = true
const cacheCode = barCode
this.$axios({
method:"post",
url:`/api/MaterialWarehousing/MaterialDelivery_ScanCodeAdd`,
data: {
ScanCode: cacheCode
}
}).then((res)=>{
var postData = {
argKeyWord: this.formData.argKeyWord,
argWhere: this.formData.argWhere,
Stime: this.formData.dateValue ? this.$moment(this.formData.dateValue[0]).format('YYYY-MM-DD HH:mm:ss') : '',
Etime: this.formData.dateValue ? this.$moment(this.formData.dateValue[1]).format('YYYY-MM-DD HH:mm:ss') : ''
}
this.searchData(this.postData)
})
// request({
// url: `/api/MaterialWarehousing/MaterialDelivery_ScanCodeAdd`,
// method: 'put',
// data: {
// ScanCode: cacheCode
// }
// })
// .then(res => {
// // this.loading = false
// var postData = {
// argKeyWord: this.formData.argKeyWord,
// argWhere: this.formData.argWhere,
// Stime: this.formData.dateValue ? this.$moment(this.formData.dateValue[0]).format('YYYY-MM-DD HH:mm:ss') : '',
// Etime: this.formData.dateValue ? this.$moment(this.formData.dateValue[1]).format('YYYY-MM-DD HH:mm:ss') : ''
// }
// $this.searchData(this.postData)
// })
// .catch(() => {
// // this.loading = false
// })
barCode = ''
lastCode = ''
lastTime = ''
return
}
nextTime = new Date().getTime()
if (!lastTime && !lastCode) {
console.log('扫码开始。。。')
barCode += e.key
}
if (lastCode && lastTime && nextTime - lastTime > 500) {
// 当扫码前有keypress事件时,防止首字缺失
console.log('防止首字缺失。。。')
barCode = e.key
} else if (lastCode && lastTime) {
console.log('扫码中。。。')
barCode += e.key
scanGunCode(value) {
console.log('开始扫码。。。')
this.$axios({
method:"post",
url:`/api/ProductStorage/ProductStorage_ScanCodeAdd?ScanCode=${value}`,
}).then((res)=>{
console.log('扫码成功。。。')
var postData = {
argKeyWord: this.formData.argKeyWord,
argWhere: this.formData.argWhere,
Stime: this.formData.dateValue ? this.$moment(this.formData.dateValue[0]).format('YYYY-MM-DD HH:mm:ss') : '',
Etime: this.formData.dateValue ? this.$moment(this.formData.dateValue[1]).format('YYYY-MM-DD HH:mm:ss') : ''
}
lastCode = nextCode
lastTime = nextTime
console.log(lastCode)
}
this.searchData(this.postData)
}).catch(() => {
console.log('扫码失败。。。')
})
},
resetData () {
return {
......
......@@ -30,8 +30,8 @@
<div class="search-btn" @click="searchData" >查询</div>
<div class="search-block search-input" v-if="formList.includes(3)" style="margin-left: 20px">
<el-input type="text" v-model="formData.scanValue"></el-input>
<div class="search-block search-input" v-if="formList.includes(3)" style="width: 280px; margin-left: 20px">
<el-input type="text" ref="codeInput" v-model="formData.scanValue" @keyup.enter.native="scanGunCode" ></el-input>
</div>
</div>
......@@ -93,7 +93,15 @@ export default {
return {
}
},
created () {
this.$nextTick(() => {
this.$refs.codeInput.focus()
})
},
methods: {
scanGunCode () {
this.$emit('scanGunCode', this.formData.scanValue)
},
searchData () {
this.$emit('searchData')
},
......
......@@ -14,21 +14,21 @@
<el-select class="selectName" @change="getGroups" v-model="argDevice" placeholder="请选择">
<el-option
v-for="item in deviceList"
:key="item.Name"
:label="item.Name"
:value="item.Type">
:key="item.DeviceName"
:label="item.DeviceName"
:value="item.DeviceName">
</el-option>
</el-select>
</div>
<div class="search-block">
<span class="search" >组名:</span>
<el-select class="selectName" @click="getTypes" v-model="argGroup" placeholder="请选择">
<el-select class="selectName" @change="getTypes" v-model="argGroup" placeholder="请选择">
<el-option
v-for="item in groupList"
:key="item.Name"
:label="item.Name"
:value="item.Type">
:key="item.GroupName"
:label="item.GroupName"
:value="item.GroupName">
</el-option>
</el-select>
</div>
......@@ -38,9 +38,9 @@
<el-select class="selectName" v-model="argDataType" placeholder="请选择">
<el-option
v-for="item in typeList"
:key="item.Name"
:label="item.Name"
:value="item.Type">
:key="item"
:label="item"
:value="item">
</el-option>
</el-select>
</div>
......@@ -93,7 +93,7 @@
</el-table-column>
</el-table>
<!-- 第三部分 分页 -->
<Pagination @pageFun="pageFun" />
<Pagination ref="page" :totalCount="totalCount" :totalPage="totalPage" @pageFun="pageFun" />
</div>
<div class="btn">
<div @click="close()" class="cancle">取 消</div>
......@@ -118,8 +118,12 @@ export default {
deviceList: [],
typeList: [],
groupList: [],
cloneData: [],
innerTableData: [],
num: 1,
// 分页数据
totalCount: 0,
// pageIndex: 1,
totalPage: 1
}
},
directives: {
......@@ -146,6 +150,7 @@ export default {
}
},
created () {
this.getData()
this.getDevices()
},
methods:{
......@@ -155,12 +160,52 @@ export default {
// return v.toString(16);
// });
// },
// 分页方法
getData () {
var $this = this
var postData = {
argDevice: this.argDevice,
argGroup: this.argGroup,
argDataType: this.argDataType,
argKeyWord: this.argKeyWord,
argPageSize: 50,
argPageIndex: 1
}
this.$axios({
method:"post",
url:`/api/NewTrendChart/GstVariableList`,
}).then((res)=>{
if(res.data.data.length != 0 ){
this.AllTableData = res.data.data.map(item => ({
...item,
UpdateTime: this.$moment(item.UpdateTime).format('YYYY-MM-DD HH:mm:ss')
}))
// 克隆一份tableData数据
this.cloneData= JSON.parse(JSON.stringify(this.AllTableData))
if(this.AllTableData.length > this.$refs.page.pageSize){
this.tableData = this.AllTableData.slice(0, this.$refs.page.pageSize)
}else{
this.tableData = this.AllTableData
}
this.totalCount = this.AllTableData.length
// this.pageIndex = 1
this.totalPage = Math.ceil(this.AllTableData.length / this.$refs.page.pageSize)
}else{
this.tableData = []
this.totalCount = 0
// this.pageIndex = 1
this.totalPage = 1
}
this.pageFun(1)
}).catch(function(err){
console.log('err',err)
})
},
// 分页方法
pageFun(num){
if(num == 1){
this.innerTableData = this.innerTableData.slice(0,50)
this.tableData = this.cloneData.slice(0, this.$refs.page.pageSize)
}else{
this.innerTableData = this.innerTableData.slice((num-1)*this.pageSize + 1,this.pageSize*num)
this.tableData = this.cloneData.slice((num-1)*this.$refs.page.pageSize,this.$refs.page.pageSize*num)
}
},
close(){
......@@ -184,45 +229,51 @@ export default {
this.$emit('conserve', dialogData)
},
getDevices () {
this.groupList = []
this.typeList = []
this.argGroup = ''
this.argDataType = ''
this.$axios({
method:"post",
url:`/api/VariableManage/QueryDevices`,
url:`/api/FormulaManage/FormulaManage_GstCondition`,
}).then((res)=>{
this.deviceList = res.data.data
this.typeList = []
this.groupList = []
})
},
getGroups () {
var $this = this
this.argGroup = ''
this.argDataType = ''
this.groupList = []
this.typeList = []
this.$axios({
method:"post",
url:`/api/VariableManage/DeviceChange`,
data: { device: this.argDevice }
url:`/api/FormulaManage/FormulaManage_GstCondition`,
}).then((res)=>{
if (res.data.data) {
this.groupList = res.data.data
this.typeList = []
} else {
this.groupList = []
}
res.data.data.forEach(item => {
if (item.DeviceName === this.argDevice) {
$this.groupList = item.Groups
}
})
})
},
getTypes () {
var postData = {
device: this.argDevice,
group: this.argGroup,
limit: ''
}
var $this = this
this.argDataType = ''
this.typeList = []
this.$axios({
method:"post",
url:`/api/VariableManage/GroupChange`,
data: postData
url:`/api/FormulaManage/FormulaManage_GstCondition`,
}).then((res)=>{
if (res.data.data) {
this.typeList = res.data.data
} else {
this.typeList = []
}
res.data.data.forEach(item => {
if (item.DeviceName === this.argDevice) {
item.Groups.forEach(item => {
if (item.GroupName === $this.argGroup) {
$this.typeList = item.DataTypes
}
})
}
})
})
},
}
......
......@@ -33,7 +33,7 @@
label="设备编号"
:show-overflow-tooltip="true"
width="185"
prop="Num">
prop="DevNuber">
</el-table-column>
<el-table-column
label="设备名称"
......@@ -57,7 +57,7 @@
label="变量关联"
:show-overflow-tooltip="true"
width="185"
prop="relat">
prop="Proalert">
</el-table-column>
<el-table-column
......@@ -149,7 +149,7 @@ export default {
query(){
this.$axios({
method:"post",
url:`/api/Device/Device_Query?argKeyWord=${this.argKeyWord}`,
url:`/api/Device/Device_Query?argKeyWord=${this.argKeyWord}&argWhere=${this.argWhere}`,
}).then((res)=>{
if(res.data.data.length != 0 ){
this.AllTableData = res.data.data
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment