多次出入库代码提交

pro
郑明梁 2 years ago
parent 0039e3e2b5
commit e8155ce822

@ -51,6 +51,9 @@ import DictData from "@/components/DictData";
// 去除控制台的 Vue warn 警告信息
Vue.config.silent = true;
//自定义消息框
import ShowMsgBox from '@/utils/MsgBox'
// 全局方法挂载
Vue.prototype.getDicts = getDicts;
Vue.prototype.getConfigKey = getConfigKey;
@ -76,6 +79,7 @@ Vue.use(directive);
Vue.use(plugins);
Vue.use(VueMeta);
Vue.use(allTools);
Vue.use(ShowMsgBox)
DictData.install();
/**

@ -0,0 +1,18 @@
import MsgBox from '@/views/components/MsgBox'
let ConfirmConstructor, instance
const showMsgBox = {
install(Vue) {
ConfirmConstructor = Vue.extend(MsgBox)
instance = new ConfirmConstructor().$mount()
document.body.appendChild(instance.$el)
Vue.prototype.$showMsgBox = options => {
Object.assign(instance, options)
instance.init()
}
}
}
export default showMsgBox

@ -0,0 +1,150 @@
<template>
<div>
<div v-if="show" class="cancelTips" >
<div class="cancelBox">
<p class="tips">{{ caption }}</p>
<p class="title">{{ msg }}</p>
<div class="selectBtn">
<el-button size="small" type="primary" @click="cancelClick"></el-button>
<el-button ref="uRef" size="small" type="primary" @click="confirmClick"></el-button>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
name: "MsgBox",
props: {
caption: {},
show: {},
msg: {},
callback: {}
},
data() {
return {
value: null,
keyCode: '',
lastTime: '',
nextTime: '',//
lastCode: '',
nextCode: '',//
}
},
destroyed() {
// enter
this.enterKeyupDestroyed();
},
methods: {
enterKey(event) {
this.nextCode = event.keyCode
// ()
if (this.nextCode == 13) {
if (this.keyCode == 'true') {
this.confirmClick();
} else if (this.keyCode == 'false') {
this.cancelClick(0);
}
this.keyCode = ''
this.lastCode = ''
this.lastTime = ''
return
}
this.nextTime = new Date().getTime() //
if (!this.lastTime && !this.lastCode) { //
this.keyCode += event.key //
}
//
if (this.lastCode && this.lastTime && this.nextTime - this.lastTime > 30) { // keypress,
this.keyCode = event.key
} else if (this.lastCode && this.lastTime) {
this.keyCode += event.key
}
this.lastCode = this.nextCode
this.lastTime = this.nextTime
},
enterKeyupDestroyed() {
document.removeEventListener("keyup", this.enterKey);
},
enterKeyup() {
document.addEventListener("keyup", this.enterKey);
},
init() {
this.show = true;
this.enterKeyup();
},
close() {
this.show = false;
this.callback("close")
},
confirmClick() {
this.show = false;
this.callback("yes")
this.enterKeyupDestroyed();
},
cancelClick() {
this.show = false;
this.callback("no")
this.enterKeyupDestroyed();
}
}
}
</script>
<style type="text/scss" lang="scss" scoped>
.cancelTips {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 9999999;
margin: auto;
width: 100%;
background: rgba(0, 0, 0, 0.6);
.cancelBox {
position: absolute;
top: 30%;
left: 40%;
width: 20%;
margin: auto;
background: #fff;
border-radius: 12px;
text-align: center;
.tips {
font-size: 16px;
margin: 30px 0 15px;
text-align: center;
font-weight: bold;;
}
.title {
font-size: 16px;
text-align: center;
color: #767676;
margin-bottom: 30px;
}
.selectBtn {
width: 100%;
text-align: center;
display: flex;
height: 60px;
line-height: 60px;
margin: 0 auto;
display: flex;
justify-content: space-around;
border-top: 1px solid #ebebeb;
}
}
}
</style>

@ -9,11 +9,14 @@
<el-row>
<el-col :span="17">
<el-form-item label="UDI:">
<el-input v-model="inputQuery.udiCode" :disabled="detailList.length>0" placeholder="请输入UDI" clearable></el-input>
<el-input v-model="inputQuery.udiCode" ref="udiCodeInputRef" @keypress.enter.native="addCode($event)"
:disabled="detailList.length>0" placeholder="请输入UDI" clearable></el-input>
</el-form-item>
</el-col>
<el-col :span="2">
<el-button type="primary" size="mini" @click="addCode" :disabled="detailList.length>0" style="margin-left: 15px">添加</el-button>
<el-button type="primary" size="mini" @click="addCode" :disabled="detailList.length>0"
style="margin-left: 15px">添加
</el-button>
</el-col>
</el-row>
<el-row>
@ -24,7 +27,9 @@
</el-col>
<el-col :span="8">
<el-form-item label="标记:">
<el-input v-model="inputQuery.mark" :disabled="this.formName==2" placeholder="请输入标记" clearable></el-input>
<el-input v-model="inputQuery.mark" ref="markInputRef" :disabled="this.formName==2"
@keypress.enter.native="addMark($event)"
placeholder="请输入标记" clearable></el-input>
</el-form-item>
</el-col>
</el-row>
@ -55,7 +60,8 @@
<el-row>
<el-col :span="17">
<el-form-item label="往来单位:">
<el-input v-model="inputQuery.fromCorp" :disabled="this.inputQuery.udiCode==null"
<el-input v-model="inputQuery.fromCorp" ref="fromCorpInputRef"
@keypress.enter.native="addFromCorp($event)" :disabled="this.inputQuery.udiCode==null"
placeholder="请输入往来单位" clearable></el-input>
</el-form-item>
</el-col>
@ -77,7 +83,9 @@
<el-table-column label="使用时间" prop="useTime" show-overflow-tooltip="true"></el-table-column>
<el-table-column label="操作" width="120px">
<template slot-scope="scope">
<el-button type="text" size="small" v-if="scope.row.status!=1" @click.native.stop="deleteDialog(scope.row)"></el-button>
<el-button type="text" size="small" v-if="scope.row.status!=1" @click.native.stop="deleteDialog(scope.row)">
删除
</el-button>
</template>
</el-table-column>
</el-table>
@ -85,21 +93,20 @@
<el-dialog
:title="tableName"
:visible.sync="orderMutiDelectVisible"
width="60%"
:append-to-body="true"
v-if="orderMutiDelectVisible"
@close='closeDialog'
:close-on-click-modal="false"
:close-on-press-escape="false"
:title="tableName"
:visible.sync="orderMutiDelectVisible"
width="60%"
:append-to-body="true"
v-if="orderMutiDelectVisible"
@close='closeDialog'
:close-on-click-modal="false"
:close-on-press-escape="false"
>
<ioOrderMutiEditSelectDialog
:closeDialogDelect="closeDialogDelect"
:filterQuery="inputQuery"
:closeDialogDelect="closeDialogDelect"
:filterQuery="inputQuery"
></ioOrderMutiEditSelectDialog>
</el-dialog>
</div>
</template>
@ -116,6 +123,7 @@ import {
} from "@/api/inout/orderMuti";
import ioOrderMutiEditSelectDialog from "@/views/inout/muti/ioOrderMutiEditSelectDialog"
export default {
name: "ioOrderMutiEditDialog",
props: {
@ -145,15 +153,66 @@ export default {
supId: null,
},
pId: null,
popupsVisible: false,
orderMutiDelectVisible: false,
tableName: '使用记录选择',
invList: [],
fromInvOptions: [],
busTypes: [],
detailList: [],
keyCode: '',
lastTime: '',
nextTime: '',//
lastCode: '',
nextCode: '',//
}
},
mounted() {
if (this.formName == 2) {
this.$refs.fromCorpInputRef.focus();
} else {
this.$refs.udiCodeInputRef.focus();
}
this.enterKeyup();
},
destroyed() {
// enter
this.enterKeyupDestroyed();
},
methods: {
enterKey(event) {
this.nextCode = event.keyCode
// ()
if (this.nextCode == 13) {
if (this.keyCode == 'true') {
this.saveOrder(1);
} else if (this.keyCode == 'false') {
this.saveOrder(0);
}
this.keyCode = ''
this.lastCode = ''
this.lastTime = ''
return
}
this.nextTime = new Date().getTime() //
if (!this.lastTime && !this.lastCode) { //
this.keyCode += event.key //
}
//
if (this.lastCode && this.lastTime && this.nextTime - this.lastTime > 30) { // keypress,
this.keyCode = event.key
} else if (this.lastCode && this.lastTime) {
this.keyCode += event.key
}
this.lastCode = this.nextCode
this.lastTime = this.nextTime
},
enterKeyupDestroyed() {
document.removeEventListener("keyup", this.enterKey);
},
enterKeyup() {
document.addEventListener("keyup", this.enterKey);
},
addCode() {
checkUdi(this.inputQuery).then((response) => {
if (response.code == 20000) {
@ -164,6 +223,7 @@ export default {
this.inputQuery.ggxh = response.data.data.ggxh
this.inputQuery.totalCount = response.data.data.totalCount
this.inputQuery.useCount = response.data.data.useCount
this.$refs.fromCorpInputRef.focus();
} else {
this.$message.error(response.message);
}
@ -173,37 +233,44 @@ export default {
} else if (response.code == 999) {
this.$message.error(response.message);
} else if (response.code == 888) {
this.$confirm("是否要首次使用", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
this.$refs.udiCodeInputRef.blur();
this.enterKeyupDestroyed();
this.$showMsgBox({
caption: "询问",
msg: '是否要首次使用',
callback: (data) => {
if (data == 'yes') {
addOrderMuti(this.inputQuery).then((response) => {
if (response.code == 20000) {
this.pId = response.data;
filterMutiList({id: this.pId}).then((response) => {
if (response.code == 20000) {
this.inputQuery.cpmctymc = response.data.data.cpmctymc
this.inputQuery.ggxh = response.data.data.ggxh
this.inputQuery.totalCount = response.data.data.totalCount
this.inputQuery.useCount = response.data.data.useCount
this.$refs.fromCorpInputRef.focus();
this.enterKeyup();
} else {
this.$refs.markInputRef.focus();
}
}).catch(() => {
this.$message.error("添加失败");
});
} else {
this.$message.error(response.message);
}
}).catch(() => {
this.$message.error("添加失败");
});
} else if (data == 'no') {
this.inputQuery.mark = "";
this.$refs.markInputRef.focus();
this.enterKeyup();
}
}
})
.then(() => {
addOrderMuti(this.inputQuery).then((response) => {
if (response.code == 20000) {
this.pId = response.data;
filterMutiList({id: this.pId}).then((response) => {
if (response.code == 20000) {
this.inputQuery.cpmctymc = response.data.data.cpmctymc
this.inputQuery.ggxh = response.data.data.ggxh
this.inputQuery.totalCount = response.data.data.totalCount
this.inputQuery.useCount = response.data.data.useCount
} else {
this.$message.error(response.message);
}
}).catch(() => {
this.$message.error("添加失败");
});
} else {
this.$message.error(response.message);
}
}).catch(() => {
this.$message.error("添加失败");
});
})
.catch(() => {
this.orderMutiDelectVisible = true;
});
}
}).catch(() => {
@ -220,9 +287,9 @@ export default {
}
})
.catch(() => {
this.$message.error("添加失败");
});
.catch(() => {
this.$message.error("添加失败");
});
} else {
updateMuti(this.inputQuery).then((response) => {
if (response.code == 20000) {
@ -232,9 +299,9 @@ export default {
}
})
.catch(() => {
this.$message.error("添加失败");
});
.catch(() => {
this.$message.error("添加失败");
});
}
},
addFromCorp() {
@ -254,14 +321,14 @@ export default {
});
},
selectMutiDetailList() {
selectMutiDetailList({mutiIdFk:this.pId}).then((response) => {
selectMutiDetailList({mutiIdFk: this.pId}).then((response) => {
if (response.code == 20000) {
this.detailList = response.data || [];
this.inputQuery.useCount=this.detailList.length
this.inputQuery.useCount = this.detailList.length
}
})
},
getMark(){
getMark() {
getMark().then((response) => {
if (response.code == 20000) {
this.inputQuery.mark = response.data;
@ -277,36 +344,51 @@ export default {
this.inputQuery.totalCount = response.data.data.totalCount
this.inputQuery.useCount = response.data.data.useCount
this.detailList = response.data.detailList
this.inputQuery.useCount=this.detailList.length
this.inputQuery.useCount = this.detailList.length
} else {
this.$message.error(response.message);
}
});
},
closeDialogDelect(row){
this.orderMutiDelectVisible=false;
this.pId=row.id;
closeDialogDelect(row) {
this.orderMutiDelectVisible = false;
this.pId = row.id;
this.filterMutiList();
},
saveOrder(status){
var query={
id:this.pId,
saveOrder(status) {
var query = {
id: this.pId,
mark: this.inputQuery.mark,
useCount:this.inputQuery.useCount,
useCount: this.inputQuery.useCount,
totalCount: this.inputQuery.totalCount,
status:status
status: status
}
updateOrderMuti(query).then((response) => {
if (response.code == 20000) {
this.closeDialog()
this.closeDialog()
} else {
this.$message.error(response.message);
}
});
},
deleteDialog(row) {
delectMutiDelect({id: row.id}).then((response) => {
if (response.code == 20000) {
this.selectMutiDetailList()
} else {
this.$message.error(response.message);
}
});
},
deleteDialog(row){
delectMutiDelect({id:row.id}).then((response) => {
addMark() {
filterMutiDetailList({udiCode: this.inputQuery.udiCode, mark: this.inputQuery.mark}).then((response) => {
if (response.code == 20000) {
this.inputQuery.cpmctymc = response.data.cpmctymc
this.inputQuery.ggxh = response.data.ggxh
this.inputQuery.totalCount = response.data.totalCount
this.inputQuery.useCount = response.data.useCount
this.pId = response.data.id;
this.$refs.fromCorpInputRef.focus();
this.selectMutiDetailList()
} else {
this.$message.error(response.message);
@ -316,11 +398,11 @@ export default {
},
components: {ioOrderMutiEditSelectDialog},
created() {
if(this.formName==2){
if (this.formName == 2) {
this.inputQuery = this.filterQuery
this.pId=this.inputQuery.id
this.pId = this.inputQuery.id
this.selectMutiDetailList()
}else{
} else {
this.getMark();
}

@ -0,0 +1,58 @@
<template>
<div>
12354
</div>
</template>
<script>
export default {
data() {
return {
}
},
mounted() {
//
var code = ''
var lastTime, nextTime //
var lastCode, nextCode //
document.onkeypress = (e) => {
debugger
//
if (window.event) { // IE
nextCode = e.keyCode
} else if (e.which) { // Netscape/Firefox/Opera
nextCode = e.which
}
// ()
if (nextCode === 13) {
if (code.length < 3) return // code2
this.codeFind(code) //
code = ''
lastCode = ''
lastTime = ''
return
}
nextTime = new Date().getTime() //
if (!lastTime && !lastCode) { //
code += e.key //
}
//
if (lastCode && lastTime && nextTime - lastTime > 30) { // keypress,
code = e.key
} else if (lastCode && lastTime) {
code += e.key
}
lastCode = nextCode
lastTime = nextTime
}
},
methods: {
//
codeFind(code) {
alert(code)
}
}
}
</script>
Loading…
Cancel
Save