中航光电热表web
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
2.0 KiB

1 month ago
<template>
<el-dialog title="新增" append-to-body :modelValue="openShow" width="70%" @close="closeDialog">
<div style="margin-bottom: 12px;" v-if="moldAddMore">
<el-button type="primary" @click="addTable">插入一行</el-button>
<el-button type="danger" @click="delTable">删除行</el-button>
</div>
<el-table :data="tableData" style="width: 100%">
<el-table-column prop="partName" label="月份" align="center">
<template #header>
<span><i style="color:red">*</i>月份</span>
</template>
<template #default="scope">
<span>{{ scope.row.partName }}</span>
</template>
</el-table-column>
</el-table>
<template #footer>
<span class="dialog-footer">
<el-button @click="closeDialog"> </el-button>
<el-button type="primary" @click="submit"> </el-button>
</span>
</template>
</el-dialog>
</template>
<script>
export default {
props: {
showDialog: {
type: Boolean,
default: false
},
moldAddMore: {
type: Boolean,
default: false
}
},
data() {
return {
openShow: false,
tableData: []
}
},
mounted() {
this.openShow = this.showDialog
},
methods: {
closeDialog() {
this.openShow = false
this.$emit('closeDialog');
},
// 插入一行
addTable() {
this.tableData.push({
code: '3',
No: '3',
number: '3',
shuliang: '',
shuliang: 0,
memo: ''
})
},
// 删除一行
delTable(row, index) {
this.tableData.splice(index, 1)
},
}
}
</script>
<style lang="scss" scoped></style>