This commit is contained in:
liushuai
2020-04-02 18:25:25 +08:00
parent 3440f4e75e
commit 3397357a3e
18 changed files with 578 additions and 232 deletions

View File

@@ -33,8 +33,8 @@
</div>
</div>
</el-card>
<el-card style="width: 39%; float: left">
<el-table :data="tableData1" border stripe size="mini" highlight-current-row style="width: 515px;margin-top: 15px" height="720px" @row-click="searchTable2">
<el-card style="width: 47%; float: left">
<el-table :data="tableData1" border stripe size="mini" highlight-current-row style="width: 620px;margin-top: 15px" height="720px" @row-click="searchTable2">
<el-table-column label="项目名称" align="center" width="140px">
<template slot-scope="scope">
{{ scope.row.项目名称 }}
@@ -55,10 +55,15 @@
{{ scope.row.机床数量 }}
</template>
</el-table-column>
<el-table-column label="计划装配完成" align="center" width="110px">
<template slot-scope="scope">
{{ scope.row.机床装配完成时间 ? scope.row.机床装配完成时间.split(' ')[0] : '' }}
</template>
</el-table-column>
</el-table>
</el-card>
<el-card style="width: 61%; float: left">
<el-table :data="tableData2" border size="mini" highlight-current-row style="width: 525px;margin-top: 15px" height="720px" @row-dblclick="changeState" @row-click="deleteData1">
<el-card style="width: 51%; float: left">
<el-table :data="tableData2" :summary-method="getSummaries" border size="mini" highlight-current-row style="width: 525px;margin-top: 15px" height="720px" show-summary @row-dblclick="changeState" @row-click="deleteData1">
<el-table-column label="组号" align="center" width="120px">
<template slot-scope="scope">
<template v-if="scope.row.edit">
@@ -85,7 +90,7 @@
</template>
</template>
</el-table-column>
<el-table-column label="计划工时" align="center" width="100px">
<el-table-column label="计划工时(分)" align="center" width="120px" prop="计划工时">
<template slot-scope="scope">
<template v-if="scope.row.edit">
<el-input v-model="scope.row.计划工时" size="mini" style="width: 100%" props="" @input="filterNuber(scope.row.计划工时, scope.$index, '计划工时')"/>
@@ -183,6 +188,33 @@ export default {
})
}
},
getSummaries(param) {
const { columns, data } = param
const sums = []
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '合计'
return
}
if (index === 2) {
const values = data.map(item => Number(item['计划工时']))
if (!values.every(value => isNaN(value))) {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr)
if (!isNaN(value)) {
return prev + curr
} else {
return prev
}
}, 0)
sums[index] += ' 分'
} else {
sums[index] = ''
}
}
})
return sums
},
changeState(row) {
row.edit = !row.edit
},