|
@@ -8,7 +8,9 @@
|
|
|
<el-button type="primary" @click="addRow(columns[0].length)" v-if="edit"
|
|
<el-button type="primary" @click="addRow(columns[0].length)" v-if="edit"
|
|
|
>新增行</el-button
|
|
>新增行</el-button
|
|
|
>
|
|
>
|
|
|
- <el-checkbox v-model="isMerge" style="margin-left: 10px">合并单元格</el-checkbox>
|
|
|
|
|
|
|
+ <el-checkbox v-model="isMerge" style="margin-left: 10px" v-if="edit"
|
|
|
|
|
+ >合并单元格</el-checkbox
|
|
|
|
|
+ >
|
|
|
<div class="table" style="margin-top: 10px" :id="id">
|
|
<div class="table" style="margin-top: 10px" :id="id">
|
|
|
<div
|
|
<div
|
|
|
class="table-body"
|
|
class="table-body"
|
|
@@ -66,7 +68,7 @@
|
|
|
<i
|
|
<i
|
|
|
class="el-icon-delete delete"
|
|
class="el-icon-delete delete"
|
|
|
style="display: none"
|
|
style="display: none"
|
|
|
- @click="removeColumn(item,index)"
|
|
|
|
|
|
|
+ @click="removeColumn(item, index)"
|
|
|
v-if="edit && rowIndex == 0"
|
|
v-if="edit && rowIndex == 0"
|
|
|
></i>
|
|
></i>
|
|
|
<i
|
|
<i
|
|
@@ -92,7 +94,7 @@
|
|
|
class="templateInput"
|
|
class="templateInput"
|
|
|
:id="item.id"
|
|
:id="item.id"
|
|
|
:ref="item.id + 'ref'"
|
|
:ref="item.id + 'ref'"
|
|
|
- :readonly="item.readonly == 2 || !edit"
|
|
|
|
|
|
|
+ :readonly="item.readonly == 2 || readonly"
|
|
|
@click="inputClick(item)"
|
|
@click="inputClick(item)"
|
|
|
@input="calculation"
|
|
@input="calculation"
|
|
|
autocomplete="off"
|
|
autocomplete="off"
|
|
@@ -104,7 +106,7 @@
|
|
|
class="templateInput"
|
|
class="templateInput"
|
|
|
:id="item.id"
|
|
:id="item.id"
|
|
|
:ref="item.id + 'ref'"
|
|
:ref="item.id + 'ref'"
|
|
|
- :readonly="item.readonly == 2 || !edit"
|
|
|
|
|
|
|
+ :readonly="item.readonly == 2 || readonly"
|
|
|
@click="inputClick(item, rowIndex == 0 ? 'columns' : null)"
|
|
@click="inputClick(item, rowIndex == 0 ? 'columns' : null)"
|
|
|
@input="calculation"
|
|
@input="calculation"
|
|
|
type="text"
|
|
type="text"
|
|
@@ -130,6 +132,10 @@
|
|
|
edit: {
|
|
edit: {
|
|
|
default: true,
|
|
default: true,
|
|
|
type: Boolean
|
|
type: Boolean
|
|
|
|
|
+ },
|
|
|
|
|
+ readonly: {
|
|
|
|
|
+ default: false,
|
|
|
|
|
+ type: Boolean
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
data() {
|
|
data() {
|
|
@@ -169,8 +175,8 @@
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
startSelecting(event) {
|
|
startSelecting(event) {
|
|
|
- if(!this.isMerge){
|
|
|
|
|
- return
|
|
|
|
|
|
|
+ if (!this.isMerge) {
|
|
|
|
|
+ return;
|
|
|
}
|
|
}
|
|
|
this.isSelecting = true;
|
|
this.isSelecting = true;
|
|
|
this.startX = event.clientX;
|
|
this.startX = event.clientX;
|
|
@@ -307,8 +313,7 @@
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
// 方法:删除指定列
|
|
// 方法:删除指定列
|
|
|
- removeColumn(item,index) {
|
|
|
|
|
-
|
|
|
|
|
|
|
+ removeColumn(item, index) {
|
|
|
this.columns.splice(index, 1);
|
|
this.columns.splice(index, 1);
|
|
|
this.columns.forEach((row, columnIndex) => {
|
|
this.columns.forEach((row, columnIndex) => {
|
|
|
row.forEach((cell, index) => {
|
|
row.forEach((cell, index) => {
|