diff --git a/src/main.js b/src/main.js
index 2d50da53..503c356d 100644
--- a/src/main.js
+++ b/src/main.js
@@ -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();
/**
diff --git a/src/utils/MsgBox.js b/src/utils/MsgBox.js
new file mode 100644
index 00000000..d31e9a79
--- /dev/null
+++ b/src/utils/MsgBox.js
@@ -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
diff --git a/src/views/components/MsgBox.vue b/src/views/components/MsgBox.vue
new file mode 100644
index 00000000..ed7aa4ad
--- /dev/null
+++ b/src/views/components/MsgBox.vue
@@ -0,0 +1,150 @@
+
+
+
+
+
{{ caption }}
+
{{ msg }}
+
+ 取消
+ 确定
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/inout/muti/ioOrderMutiEditDialog.vue b/src/views/inout/muti/ioOrderMutiEditDialog.vue
index 55c4d909..d1031565 100644
--- a/src/views/inout/muti/ioOrderMutiEditDialog.vue
+++ b/src/views/inout/muti/ioOrderMutiEditDialog.vue
@@ -9,11 +9,14 @@
-
+
- 添加
+ 添加
+
@@ -24,7 +27,9 @@
-
+
@@ -55,7 +60,8 @@
-
@@ -77,7 +83,9 @@
- 删除
+
+ 删除
+
@@ -85,21 +93,20 @@
-
@@ -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();
}
diff --git a/src/views/test.vue b/src/views/test.vue
new file mode 100644
index 00000000..35d58e2a
--- /dev/null
+++ b/src/views/test.vue
@@ -0,0 +1,58 @@
+
+
+ 12354
+
+
+
+