|
|
@@ -8,7 +8,7 @@
|
|
|
<el-button type="primary" @click="addRow(columns[0].length)" v-if="edit"
|
|
|
>新增行</el-button
|
|
|
>
|
|
|
- <!-- <el-button type="primary" @click="copy()" v-if="edit">复制表格</el-button> -->
|
|
|
+ <el-button type="primary" @click="copy()" v-if="edit">复制表格</el-button>
|
|
|
<el-checkbox v-model="isMerge" style="margin-left: 10px" v-if="edit"
|
|
|
>合并单元格</el-checkbox
|
|
|
>
|
|
|
@@ -535,16 +535,22 @@
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
- // copy() {
|
|
|
- // this.$emit('copy', {
|
|
|
- // form: null,
|
|
|
- // equation: JSON.parse(JSON.stringify(this.equation)),
|
|
|
- // units: JSON.parse(JSON.stringify(this.units)),
|
|
|
- // valueObj: {
|
|
|
- // columns: JSON.parse(JSON.stringify(this.valueObj))
|
|
|
- // }
|
|
|
- // });
|
|
|
- // },
|
|
|
+ copy() {
|
|
|
+ let columns = JSON.parse(JSON.stringify(this.columns));
|
|
|
+ columns.forEach((item, index) => {
|
|
|
+ item.forEach((cell, _index) => {
|
|
|
+ cell.id = generateRandomString(5);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ this.$emit('copy', {
|
|
|
+ value: null,
|
|
|
+ equation: {},
|
|
|
+ units: {},
|
|
|
+ valueObj: {
|
|
|
+ columns
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
inputClick(item, type) {
|
|
|
if (!this.edit) {
|
|
|
return;
|