|
|
@@ -441,13 +441,20 @@
|
|
|
<template v-else>{{ row[item.prop] }}</template>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="批号" width="100" prop="assetName">
|
|
|
+ <el-table-column label="批号" width="100" prop="manualBatchNo">
|
|
|
<template slot-scope="{ row, $index }">
|
|
|
<template v-if="row.isSave">
|
|
|
{{ row.manualBatchNo }}
|
|
|
</template>
|
|
|
<el-form-item v-else>
|
|
|
- <el-input v-model="row.manualBatchNo"> </el-input>
|
|
|
+ <el-input
|
|
|
+ :ref="'manualBatchNo' + $index"
|
|
|
+ @keyup.native="
|
|
|
+ moveFocus($event, $index, 'manualBatchNo', '产品', row)
|
|
|
+ "
|
|
|
+ v-model="row.manualBatchNo"
|
|
|
+ >
|
|
|
+ </el-input>
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
@@ -489,6 +496,16 @@
|
|
|
required
|
|
|
>
|
|
|
<el-input
|
|
|
+ :ref="'minPackingCount' + $index"
|
|
|
+ @keyup.native="
|
|
|
+ moveFocus(
|
|
|
+ $event,
|
|
|
+ $index,
|
|
|
+ 'minPackingCount',
|
|
|
+ '产品',
|
|
|
+ row
|
|
|
+ )
|
|
|
+ "
|
|
|
type="number"
|
|
|
v-model="row.minPackingCount"
|
|
|
@input="minPackingCountChange(row, $event)"
|
|
|
@@ -519,6 +536,10 @@
|
|
|
required
|
|
|
>
|
|
|
<el-input
|
|
|
+ :ref="'outInNum' + $index"
|
|
|
+ @keyup.native="
|
|
|
+ moveFocus($event, $index, 'outInNum', '产品', row)
|
|
|
+ "
|
|
|
v-model="row.outInNum"
|
|
|
@input="packNum(row, $event)"
|
|
|
>
|
|
|
@@ -657,6 +678,10 @@
|
|
|
:prop="`warehousingMaterialList.${$index}.univalence`"
|
|
|
>
|
|
|
<el-input
|
|
|
+ :ref="'univalence' + $index"
|
|
|
+ @keyup.native="
|
|
|
+ moveFocus($event, $index, 'univalence', '产品', row)
|
|
|
+ "
|
|
|
v-model="row.univalence"
|
|
|
placeholder="非必填"
|
|
|
@input="
|
|
|
@@ -878,33 +903,52 @@
|
|
|
prop="measuringUnit"
|
|
|
></el-table-column>
|
|
|
<el-table-column label="物料代号" prop="materielCode" width="130">
|
|
|
- <template slot-scope="{ row }">
|
|
|
+ <template slot-scope="{ row, $index }">
|
|
|
<el-input
|
|
|
v-if="!row.isPack"
|
|
|
+ :ref="'materielCode' + $index"
|
|
|
+ @keyup.native="
|
|
|
+ moveFocus($event, $index, 'materielCode', '包装', row)
|
|
|
+ "
|
|
|
v-model="row.materielCode"
|
|
|
></el-input>
|
|
|
<span v-else>{{ row.materielCode }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="客户代号" prop="clientCode">
|
|
|
- <template slot-scope="{ row }">
|
|
|
+ <template slot-scope="{ row, $index }">
|
|
|
<el-input
|
|
|
v-if="!row.isPack"
|
|
|
+ :ref="'clientCode' + $index"
|
|
|
+ @keyup.native="
|
|
|
+ moveFocus($event, $index, 'clientCode', '包装', row)
|
|
|
+ "
|
|
|
v-model="row.clientCode"
|
|
|
></el-input>
|
|
|
<span v-else> {{ row.clientCode }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="刻码" prop="engrave">
|
|
|
- <template slot-scope="{ row }">
|
|
|
- <el-input v-if="!row.isPack" v-model="row.engrave"></el-input>
|
|
|
+ <template slot-scope="{ row, $index }">
|
|
|
+ <el-input
|
|
|
+ v-if="!row.isPack"
|
|
|
+ :ref="'engrave' + $index"
|
|
|
+ @keyup.native="
|
|
|
+ moveFocus($event, $index, 'engrave', '包装', row)
|
|
|
+ "
|
|
|
+ v-model="row.engrave"
|
|
|
+ ></el-input>
|
|
|
<span v-else>{{ row.engrave }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="重量" prop="weight" width="100">
|
|
|
- <template slot-scope="{ row }">
|
|
|
+ <template slot-scope="{ row, $index }">
|
|
|
<el-input
|
|
|
v-if="!row.isPack && row.measuringUnit != row.weightUtil"
|
|
|
+ :ref="'weight' + $index"
|
|
|
+ @keyup.native="
|
|
|
+ moveFocus($event, $index, 'weight', '包装', row)
|
|
|
+ "
|
|
|
v-model="row.weight"
|
|
|
@input="weightInput($event, row)"
|
|
|
></el-input>
|
|
|
@@ -1065,33 +1109,52 @@
|
|
|
prop="measuringUnit"
|
|
|
></el-table-column>
|
|
|
<el-table-column label="物料代号" prop="materielCode" width="130">
|
|
|
- <template slot-scope="{ row }">
|
|
|
+ <template slot-scope="{ row, $index }">
|
|
|
<el-input
|
|
|
v-if="!row.isPack"
|
|
|
+ :ref="'materielCode' + $index"
|
|
|
+ @keyup.native="
|
|
|
+ moveFocus($event, $index, 'materielCode', '物料', row)
|
|
|
+ "
|
|
|
v-model="row.materielCode"
|
|
|
></el-input>
|
|
|
<span v-else>{{ row.materielCode }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="客户代号" prop="clientCode">
|
|
|
- <template slot-scope="{ row }">
|
|
|
+ <template slot-scope="{ row, $index }">
|
|
|
<el-input
|
|
|
v-if="!row.isPack"
|
|
|
+ :ref="'clientCode' + $index"
|
|
|
+ @keyup.native="
|
|
|
+ moveFocus($event, $index, 'clientCode', '物料', row)
|
|
|
+ "
|
|
|
v-model="row.clientCode"
|
|
|
></el-input>
|
|
|
<span v-else>{{ row.clientCode }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="刻码" prop="engrave">
|
|
|
- <template slot-scope="{ row }">
|
|
|
- <el-input v-if="!row.isPack" v-model="row.engrave"></el-input>
|
|
|
+ <template slot-scope="{ row, $index }">
|
|
|
+ <el-input
|
|
|
+ v-if="!row.isPack"
|
|
|
+ :ref="'engrave' + $index"
|
|
|
+ @keyup.native="
|
|
|
+ moveFocus($event, $index, 'engrave', '物料', row)
|
|
|
+ "
|
|
|
+ v-model="row.engrave"
|
|
|
+ ></el-input>
|
|
|
<span v-else>{{ row.engrave }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="重量" prop="weight" width="100">
|
|
|
- <template slot-scope="{ row }">
|
|
|
+ <template slot-scope="{ row, $index }">
|
|
|
<el-input
|
|
|
v-if="!row.isPack && row.measuringUnit != row.weightUnit"
|
|
|
+ :ref="'weight' + $index"
|
|
|
+ @keyup.native="
|
|
|
+ moveFocus($event, $index, 'weight', '物料', row)
|
|
|
+ "
|
|
|
v-model="row.weight"
|
|
|
></el-input>
|
|
|
<span v-else>{{ row.weight }}</span>
|
|
|
@@ -1323,10 +1386,138 @@
|
|
|
this.initData();
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 键盘移动
|
|
|
+ moveFocus(event, index, key, type, row) {
|
|
|
+ let keyfield = [];
|
|
|
+ let listLength = 0;
|
|
|
+ switch (type) {
|
|
|
+ case '产品':
|
|
|
+ listLength = this.warehousingMaterialList.length;
|
|
|
+ keyfield = [
|
|
|
+ 'manualBatchNo',
|
|
|
+ 'minPackingCount',
|
|
|
+ 'outInNum',
|
|
|
+ 'univalence'
|
|
|
+ ];
|
|
|
+ break;
|
|
|
+ case '包装':
|
|
|
+ listLength = this.materialCodeReqList.length;
|
|
|
+ if (row.measuringUnit != row.weightUtil) {
|
|
|
+ keyfield = ['materielCode', 'clientCode', 'engrave', 'weight'];
|
|
|
+ } else {
|
|
|
+ keyfield = ['materielCode', 'clientCode', 'engrave'];
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case '物料':
|
|
|
+ listLength = this.resultArray.length;
|
|
|
+ if (row.measuringUnit != row.weightUnit) {
|
|
|
+ keyfield = ['materielCode', 'clientCode', 'engrave', 'weight'];
|
|
|
+ } else {
|
|
|
+ keyfield = ['materielCode', 'clientCode', 'engrave'];
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (event.keyCode === 13) {
|
|
|
+ // 回车
|
|
|
+ if (
|
|
|
+ index === listLength - 1 &&
|
|
|
+ key === keyfield[keyfield.length - 1]
|
|
|
+ ) {
|
|
|
+ // 最后一行最后一个
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ this.$refs[key + index].blur();
|
|
|
+ if (key === keyfield[keyfield.length - 1]) {
|
|
|
+ // 当前行最后一个,跳转下一行第一个
|
|
|
+ this.$refs[keyfield[0] + (index + 1)].focus();
|
|
|
+ } else {
|
|
|
+ // 跳转下一个
|
|
|
+ const nextkeyindex = keyfield.findIndex((k) => k === key) + 1;
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs[keyfield[nextkeyindex] + index].focus();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 向上 =38
|
|
|
+ if (event.keyCode === 38) {
|
|
|
+ console.log('向上');
|
|
|
+ if (index === 0) {
|
|
|
+ // 第一行
|
|
|
+ console.log('第一行无法向上');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.$refs[key + index].blur();
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs[key + (index - 1)].focus();
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ // 下 = 40
|
|
|
+ if (event.keyCode === 40) {
|
|
|
+ console.log('向下');
|
|
|
+ if (index === listLength - 1) {
|
|
|
+ // 最后一行
|
|
|
+ console.log('最后一行无法向下');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.$refs[key + index].blur();
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs[key + (index + 1)].focus();
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ // 左 = 37
|
|
|
+ if (event.keyCode === 37) {
|
|
|
+ console.log('向左');
|
|
|
+ if (index === 0 && key === keyfield[0]) {
|
|
|
+ // 第一行第一个
|
|
|
+ console.log('第一行第一个无法向左');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.$refs[key + index].blur();
|
|
|
+ if (key === keyfield[0]) {
|
|
|
+ // 当前行第一个,跳转上一行最后一个
|
|
|
+ this.$refs[keyfield[keyfield.length - 1] + (index - 1)].focus();
|
|
|
+ } else {
|
|
|
+ // 跳转上一个
|
|
|
+ const prevkeyindex = keyfield.findIndex((k) => k === key) - 1;
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs[keyfield[prevkeyindex] + index].focus();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 右 = 39
|
|
|
+ if (event.keyCode === 39) {
|
|
|
+ console.log('向右');
|
|
|
+ if (
|
|
|
+ index === listLength - 1 &&
|
|
|
+ key === keyfield[keyfield.length - 1]
|
|
|
+ ) {
|
|
|
+ // 最后一行最后一个
|
|
|
+ console.log('最后一行最后一个无法向左');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.$refs[key + index].blur();
|
|
|
+ if (key === keyfield[keyfield.length - 1]) {
|
|
|
+ // 当前行最后一个,跳转下一行第一个
|
|
|
+ this.$refs[keyfield[0] + (index + 1)].focus();
|
|
|
+ } else {
|
|
|
+ // 跳转下一个
|
|
|
+ const nextkeyindex = keyfield.findIndex((k) => k === key) + 1;
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs[keyfield[nextkeyindex] + index].focus();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
// 包装维度最小包装单元改变——>总重量
|
|
|
minPackingCountChange(row, value) {
|
|
|
if (value >= 0) {
|
|
|
- row.minPackingCount = value;
|
|
|
+ row.minPackingCount = value.replace(/^[0]+/, '');
|
|
|
} else {
|
|
|
row.minPackingCount = 0;
|
|
|
}
|