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

update

parent fc8638fd
<template> <template>
<div class="box-container"> <div class="box-container">
<div class="wrap"> <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 <el-table
border border
height="675" height="675"
...@@ -186,6 +186,25 @@ export default { ...@@ -186,6 +186,25 @@ export default {
console.log('err',err) 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) { handleSelectionChange (val) {
this.checkList = val this.checkList = val
}, },
......
<template> <template>
<div class="box-container"> <div class="box-container">
<div class="wrap"> <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 <el-table
border border
height="675" height="675"
...@@ -149,7 +149,6 @@ export default { ...@@ -149,7 +149,6 @@ export default {
}, },
created() { created() {
this.searchData() this.searchData()
this.scanGunCode()
}, },
methods: { methods: {
searchData () { searchData () {
...@@ -197,86 +196,23 @@ export default { ...@@ -197,86 +196,23 @@ export default {
} }
}, },
// 扫码枪扫码 // 扫码枪扫码
scanGunCode() { scanGunCode(value) {
let barCode = '' console.log('开始扫码。。。')
let lastTime, nextTime this.$axios({
let lastCode, nextCode method:"post",
window.document.onkeypress = e => { url:`/api/MaterialWarehousing/MWarehousing_ScanCodeAdd?ScanCode=${value}`,
// if (this.loading) { }).then((res)=>{
// // 防止高频率扫码,只能扫一次 console.log('扫码成功。。。')
// return var postData = {
// } argKeyWord: this.formData.argKeyWord,
if (window.event) { argWhere: this.formData.argWhere,
// IE Stime: this.formData.dateValue ? this.$moment(this.formData.dateValue[0]).format('YYYY-MM-DD HH:mm:ss') : '',
nextCode = e.keyCode Etime: this.formData.dateValue ? this.$moment(this.formData.dateValue[1]).format('YYYY-MM-DD HH:mm:ss') : ''
} 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
} }
lastCode = nextCode this.searchData(this.postData)
lastTime = nextTime }).catch(() => {
console.log(lastCode) console.log('扫码失败。。。')
} })
}, },
resetData () { resetData () {
return { return {
......
<template> <template>
<div class="box-container"> <div class="box-container">
<div class="wrap"> <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 <el-table
border border
height="675" height="675"
...@@ -151,7 +151,6 @@ export default { ...@@ -151,7 +151,6 @@ export default {
}, },
created() { created() {
this.searchData() this.searchData()
this.scanGunCode()
}, },
methods: { methods: {
searchData () { searchData () {
...@@ -199,86 +198,23 @@ export default { ...@@ -199,86 +198,23 @@ export default {
} }
}, },
// 扫码枪扫码 // 扫码枪扫码
scanGunCode() { scanGunCode(value) {
let barCode = '' console.log('开始扫码。。。')
let lastTime, nextTime this.$axios({
let lastCode, nextCode method:"post",
window.document.onkeypress = e => { url:`/api/ProductDelivery/ProductDelivery_ScanCodeAdd?ScanCode=${value}`,
// if (this.loading) { }).then((res)=>{
// // 防止高频率扫码,只能扫一次 console.log('扫码成功。。。')
// return var postData = {
// } argKeyWord: this.formData.argKeyWord,
if (window.event) { argWhere: this.formData.argWhere,
// IE Stime: this.formData.dateValue ? this.$moment(this.formData.dateValue[0]).format('YYYY-MM-DD HH:mm:ss') : '',
nextCode = e.keyCode Etime: this.formData.dateValue ? this.$moment(this.formData.dateValue[1]).format('YYYY-MM-DD HH:mm:ss') : ''
} 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
} }
lastCode = nextCode this.searchData(this.postData)
lastTime = nextTime }).catch(() => {
console.log(lastCode) console.log('扫码失败。。。')
} })
}, },
resetData () { resetData () {
return { return {
......
<template> <template>
<div class="box-container"> <div class="box-container">
<div class="wrap"> <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 <el-table
border border
height="675" height="675"
...@@ -151,7 +151,6 @@ export default { ...@@ -151,7 +151,6 @@ export default {
}, },
created() { created() {
this.searchData() this.searchData()
this.scanGunCode()
}, },
methods: { methods: {
searchData () { searchData () {
...@@ -199,86 +198,23 @@ export default { ...@@ -199,86 +198,23 @@ export default {
} }
}, },
// 扫码枪扫码 // 扫码枪扫码
scanGunCode() { scanGunCode(value) {
let barCode = '' console.log('开始扫码。。。')
let lastTime, nextTime this.$axios({
let lastCode, nextCode method:"post",
window.document.onkeypress = e => { url:`/api/ProductStorage/ProductStorage_ScanCodeAdd?ScanCode=${value}`,
// if (this.loading) { }).then((res)=>{
// // 防止高频率扫码,只能扫一次 console.log('扫码成功。。。')
// return var postData = {
// } argKeyWord: this.formData.argKeyWord,
if (window.event) { argWhere: this.formData.argWhere,
// IE Stime: this.formData.dateValue ? this.$moment(this.formData.dateValue[0]).format('YYYY-MM-DD HH:mm:ss') : '',
nextCode = e.keyCode Etime: this.formData.dateValue ? this.$moment(this.formData.dateValue[1]).format('YYYY-MM-DD HH:mm:ss') : ''
} 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
} }
lastCode = nextCode this.searchData(this.postData)
lastTime = nextTime }).catch(() => {
console.log(lastCode) console.log('扫码失败。。。')
} })
}, },
resetData () { resetData () {
return { return {
......
...@@ -30,8 +30,8 @@ ...@@ -30,8 +30,8 @@
<div class="search-btn" @click="searchData" >查询</div> <div class="search-btn" @click="searchData" >查询</div>
<div class="search-block search-input" v-if="formList.includes(3)" style="margin-left: 20px"> <div class="search-block search-input" v-if="formList.includes(3)" style="width: 280px; margin-left: 20px">
<el-input type="text" v-model="formData.scanValue"></el-input> <el-input type="text" ref="codeInput" v-model="formData.scanValue" @keyup.enter.native="scanGunCode" ></el-input>
</div> </div>
</div> </div>
...@@ -93,7 +93,15 @@ export default { ...@@ -93,7 +93,15 @@ export default {
return { return {
} }
}, },
created () {
this.$nextTick(() => {
this.$refs.codeInput.focus()
})
},
methods: { methods: {
scanGunCode () {
this.$emit('scanGunCode', this.formData.scanValue)
},
searchData () { searchData () {
this.$emit('searchData') this.$emit('searchData')
}, },
......
...@@ -14,21 +14,21 @@ ...@@ -14,21 +14,21 @@
<el-select class="selectName" @change="getGroups" v-model="argDevice" placeholder="请选择"> <el-select class="selectName" @change="getGroups" v-model="argDevice" placeholder="请选择">
<el-option <el-option
v-for="item in deviceList" v-for="item in deviceList"
:key="item.Name" :key="item.DeviceName"
:label="item.Name" :label="item.DeviceName"
:value="item.Type"> :value="item.DeviceName">
</el-option> </el-option>
</el-select> </el-select>
</div> </div>
<div class="search-block"> <div class="search-block">
<span class="search" >组名:</span> <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 <el-option
v-for="item in groupList" v-for="item in groupList"
:key="item.Name" :key="item.GroupName"
:label="item.Name" :label="item.GroupName"
:value="item.Type"> :value="item.GroupName">
</el-option> </el-option>
</el-select> </el-select>
</div> </div>
...@@ -38,9 +38,9 @@ ...@@ -38,9 +38,9 @@
<el-select class="selectName" v-model="argDataType" placeholder="请选择"> <el-select class="selectName" v-model="argDataType" placeholder="请选择">
<el-option <el-option
v-for="item in typeList" v-for="item in typeList"
:key="item.Name" :key="item"
:label="item.Name" :label="item"
:value="item.Type"> :value="item">
</el-option> </el-option>
</el-select> </el-select>
</div> </div>
...@@ -93,7 +93,7 @@ ...@@ -93,7 +93,7 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
<!-- 第三部分 分页 --> <!-- 第三部分 分页 -->
<Pagination @pageFun="pageFun" /> <Pagination ref="page" :totalCount="totalCount" :totalPage="totalPage" @pageFun="pageFun" />
</div> </div>
<div class="btn"> <div class="btn">
<div @click="close()" class="cancle">取 消</div> <div @click="close()" class="cancle">取 消</div>
...@@ -118,8 +118,12 @@ export default { ...@@ -118,8 +118,12 @@ export default {
deviceList: [], deviceList: [],
typeList: [], typeList: [],
groupList: [], groupList: [],
cloneData: [],
innerTableData: [], innerTableData: [],
num: 1, // 分页数据
totalCount: 0,
// pageIndex: 1,
totalPage: 1
} }
}, },
directives: { directives: {
...@@ -146,6 +150,7 @@ export default { ...@@ -146,6 +150,7 @@ export default {
} }
}, },
created () { created () {
this.getData()
this.getDevices() this.getDevices()
}, },
methods:{ methods:{
...@@ -155,12 +160,52 @@ export default { ...@@ -155,12 +160,52 @@ export default {
// return v.toString(16); // 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){ pageFun(num){
if(num == 1){ if(num == 1){
this.innerTableData = this.innerTableData.slice(0,50) this.tableData = this.cloneData.slice(0, this.$refs.page.pageSize)
}else{ }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(){ close(){
...@@ -184,45 +229,51 @@ export default { ...@@ -184,45 +229,51 @@ export default {
this.$emit('conserve', dialogData) this.$emit('conserve', dialogData)
}, },
getDevices () { getDevices () {
this.groupList = []
this.typeList = []
this.argGroup = ''
this.argDataType = ''
this.$axios({ this.$axios({
method:"post", method:"post",
url:`/api/VariableManage/QueryDevices`, url:`/api/FormulaManage/FormulaManage_GstCondition`,
}).then((res)=>{ }).then((res)=>{
this.deviceList = res.data.data this.deviceList = res.data.data
this.typeList = []
this.groupList = []
}) })
}, },
getGroups () { getGroups () {
var $this = this
this.argGroup = ''
this.argDataType = ''
this.groupList = []
this.typeList = []
this.$axios({ this.$axios({
method:"post", method:"post",
url:`/api/VariableManage/DeviceChange`, url:`/api/FormulaManage/FormulaManage_GstCondition`,
data: { device: this.argDevice }
}).then((res)=>{ }).then((res)=>{
if (res.data.data) { res.data.data.forEach(item => {
this.groupList = res.data.data if (item.DeviceName === this.argDevice) {
this.typeList = [] $this.groupList = item.Groups
} else { }
this.groupList = [] })
}
}) })
}, },
getTypes () { getTypes () {
var postData = { var $this = this
device: this.argDevice, this.argDataType = ''
group: this.argGroup, this.typeList = []
limit: ''
}
this.$axios({ this.$axios({
method:"post", method:"post",
url:`/api/VariableManage/GroupChange`, url:`/api/FormulaManage/FormulaManage_GstCondition`,
data: postData
}).then((res)=>{ }).then((res)=>{
if (res.data.data) { res.data.data.forEach(item => {
this.typeList = res.data.data if (item.DeviceName === this.argDevice) {
} else { item.Groups.forEach(item => {
this.typeList = [] if (item.GroupName === $this.argGroup) {
} $this.typeList = item.DataTypes
}
})
}
})
}) })
}, },
} }
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
label="设备编号" label="设备编号"
:show-overflow-tooltip="true" :show-overflow-tooltip="true"
width="185" width="185"
prop="Num"> prop="DevNuber">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
label="设备名称" label="设备名称"
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
label="变量关联" label="变量关联"
:show-overflow-tooltip="true" :show-overflow-tooltip="true"
width="185" width="185"
prop="relat"> prop="Proalert">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
...@@ -149,7 +149,7 @@ export default { ...@@ -149,7 +149,7 @@ export default {
query(){ query(){
this.$axios({ this.$axios({
method:"post", method:"post",
url:`/api/Device/Device_Query?argKeyWord=${this.argKeyWord}`, url:`/api/Device/Device_Query?argKeyWord=${this.argKeyWord}&argWhere=${this.argWhere}`,
}).then((res)=>{ }).then((res)=>{
if(res.data.data.length != 0 ){ if(res.data.data.length != 0 ){
this.AllTableData = res.data.data 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