!105 修复粘贴功能

Merge pull request !105 from 德仔/develop
This commit is contained in:
德仔 2021-03-06 18:36:27 +08:00 committed by Gitee
commit c9a8264f1e

View File

@ -33,7 +33,7 @@
<el-button <el-button
size="mini" size="mini"
type="primary" type="primary"
@click="handleOnPaste" @click="handleOnPaste(scope.row.type)"
v-if="canCopyMenuTypes.includes(scope.row.type)" v-if="canCopyMenuTypes.includes(scope.row.type)"
>粘贴</el-button >粘贴</el-button
> >
@ -337,7 +337,9 @@ export default {
} }
arr[typePos].typeSpan.rowspan += 1; arr[typePos].typeSpan.rowspan += 1;
} }
lastNameHit = arr[arr.length - 1].name === cur.name; lastNameHit =
arr[arr.length - 1].name === cur.name &&
arr[arr.length - 1].type === cur.type;
if (lastNameHit) { if (lastNameHit) {
let namePos = arr.length - 1; let namePos = arr.length - 1;
for (let i = namePos; i >= 0; i--) { for (let i = namePos; i >= 0; i--) {
@ -460,12 +462,12 @@ export default {
this.$message.error(err); this.$message.error(err);
}); });
}, },
handleOnPaste() { handleOnPaste(type) {
// console.log(this.copyData); // console.log(this.copyData);
if (this.copyData) { if (this.copyData) {
this.addDishes({ this.addDishes({
num: this.num, num: this.num,
data: this.copyData, data: { ...this.copyData, type },
}).catch((err) => { }).catch((err) => {
this.$message.error(err); this.$message.error(err);
}); });