This commit is contained in:
zhangdingyu
2019-02-28 13:29:36 +08:00
2 changed files with 53 additions and 11 deletions

View File

@@ -53,7 +53,7 @@
:data="tableData" :data="tableData"
:summary-method="getSummaries" :summary-method="getSummaries"
style="width: 100%;max-height: 600px" style="width: 100%;max-height: 600px"
height="300" height="400"
show-summary show-summary
highlight-current-row highlight-current-row
border> border>
@@ -116,7 +116,7 @@
:data="tableDataPurchase" :data="tableDataPurchase"
border border
style="width: 100%;" style="width: 100%;"
height="300"> height="400">
<el-table-column <el-table-column
label="序号" label="序号"
align="center" align="center"
@@ -181,7 +181,7 @@
:data="tableData1" :data="tableData1"
border border
style="width: 100%;" style="width: 100%;"
height="300"> height="400">
<el-table-column <el-table-column
label="序号" label="序号"
align="center" align="center"
@@ -426,6 +426,8 @@ export default {
total4: 0, total4: 0,
total5: 0, total5: 0,
title: '', title: '',
totalNum: 0,
totalNum1: 0,
dialogFormVisible2: false, dialogFormVisible2: false,
dialogFormVisible3: false, dialogFormVisible3: false,
dialogFormVisible4: false, dialogFormVisible4: false,
@@ -484,6 +486,7 @@ export default {
}, },
methods: { methods: {
searchData() { searchData() {
this.totalNum = 0
this.loading = true this.loading = true
this.listLoading1 = true this.listLoading1 = true
this.listLoading2 = true this.listLoading2 = true
@@ -520,10 +523,11 @@ export default {
} }
searchTable(this.check, this.entryNameValue, this.check1, this.machine, this.check2, this.groupNum, this.check3, this.year, this.check4, this.month, this.check5, this.time, this.pageCurrent, this.pageSize).then(response => { searchTable(this.check, this.entryNameValue, this.check1, this.machine, this.check2, this.groupNum, this.check3, this.year, this.check4, this.month, this.check5, this.time, this.pageCurrent, this.pageSize).then(response => {
for (let i = 0; i < response.data.rows.length; i++) { for (let i = 0; i < response.data.rows.length; i++) {
if (response.data.rows[i].入库时间 !== null) { if (response.data.rows[i].入库时间 !== '') {
this.totalNum += 1
response.data.rows[i].入库时间 = response.data.rows[i].入库时间.split(' ', 2)[0] response.data.rows[i].入库时间 = response.data.rows[i].入库时间.split(' ', 2)[0]
} }
if (response.data.rows[i].计划完成时间 !== null) { if (response.data.rows[i].计划完成时间 !== '') {
response.data.rows[i].计划完成时间 = response.data.rows[i].计划完成时间.split(' ', 2)[0] response.data.rows[i].计划完成时间 = response.data.rows[i].计划完成时间.split(' ', 2)[0]
} }
} }
@@ -624,6 +628,7 @@ export default {
this.dialogFormVisible3 = false this.dialogFormVisible3 = false
}, },
handleSizeChange(val) { handleSizeChange(val) {
this.totalNum = 0
this.pageCurrent = 1 this.pageCurrent = 1
this.pageSize = val this.pageSize = val
if (this.entryNameValue !== null && this.entryNameValue !== '') { if (this.entryNameValue !== null && this.entryNameValue !== '') {
@@ -659,10 +664,11 @@ export default {
} }
searchTable(this.check, this.entryNameValue, this.check1, this.machine, this.check2, this.groupNum, this.check3, this.year, this.check4, this.month, this.check5, this.time, this.pageCurrent, this.pageSize).then(response => { searchTable(this.check, this.entryNameValue, this.check1, this.machine, this.check2, this.groupNum, this.check3, this.year, this.check4, this.month, this.check5, this.time, this.pageCurrent, this.pageSize).then(response => {
for (let i = 0; i < response.data.rows.length; i++) { for (let i = 0; i < response.data.rows.length; i++) {
if (response.data.rows[i].入库时间 !== null) { if (response.data.rows[i].入库时间 !== '') {
this.totalNum += 1
response.data.rows[i].入库时间 = response.data.rows[i].入库时间.split(' ', 2)[0] response.data.rows[i].入库时间 = response.data.rows[i].入库时间.split(' ', 2)[0]
} }
if (response.data.rows[i].计划完成时间 !== null) { if (response.data.rows[i].计划完成时间 !== '') {
response.data.rows[i].计划完成时间 = response.data.rows[i].计划完成时间.split(' ', 2)[0] response.data.rows[i].计划完成时间 = response.data.rows[i].计划完成时间.split(' ', 2)[0]
} }
} }
@@ -676,6 +682,7 @@ export default {
} }
}, },
handleCurrentChange(val) { handleCurrentChange(val) {
this.totalNum = 0
this.pageCurrent = val this.pageCurrent = val
if (this.entryNameValue !== null && this.entryNameValue !== '') { if (this.entryNameValue !== null && this.entryNameValue !== '') {
if (this.entryNameValue !== null && this.entryNameValue !== '') { if (this.entryNameValue !== null && this.entryNameValue !== '') {
@@ -710,10 +717,11 @@ export default {
} }
searchTable(this.check, this.entryNameValue, this.check1, this.machine, this.check2, this.groupNum, this.check3, this.year, this.check4, this.month, this.check5, this.time, this.pageCurrent, this.pageSize).then(response => { searchTable(this.check, this.entryNameValue, this.check1, this.machine, this.check2, this.groupNum, this.check3, this.year, this.check4, this.month, this.check5, this.time, this.pageCurrent, this.pageSize).then(response => {
for (let i = 0; i < response.data.rows.length; i++) { for (let i = 0; i < response.data.rows.length; i++) {
if (response.data.rows[i].入库时间 !== null) { if (response.data.rows[i].入库时间 !== '') {
this.totalNum += 1
response.data.rows[i].入库时间 = response.data.rows[i].入库时间.split(' ', 2)[0] response.data.rows[i].入库时间 = response.data.rows[i].入库时间.split(' ', 2)[0]
} }
if (response.data.rows[i].计划完成时间 !== null) { if (response.data.rows[i].计划完成时间 !== '') {
response.data.rows[i].计划完成时间 = response.data.rows[i].计划完成时间.split(' ', 2)[0] response.data.rows[i].计划完成时间 = response.data.rows[i].计划完成时间.split(' ', 2)[0]
} }
} }
@@ -921,6 +929,39 @@ export default {
this.loading = false this.loading = false
this.$message.warning('请先选择项目') this.$message.warning('请先选择项目')
} }
},
getSummaries(param) {
const { columns } = param
const sums = []
columns.forEach((column, index) => {
if (index === 4) {
sums[index] = '总件数'
return
} else if (index === 5) {
sums[index] = this.total + '件'
} else if (index === 6) {
sums[index] = '入库数量'
} else if (index === 7) {
sums[index] = this.totalNum + ' 件'
// const values = data.map(item => item['入库时间'])
// console.log(values)
// if (!values.every(value => value !== '')) {
// sums[index] = values.reduce((prev, curr) => {
// const value = curr
// console.log(value)
// if (value !== '') {
// return this.totalNum1 + 1
// } else {
// return this.totalNum1
// }
// }, '')
// sums[index] += '件'
// } else {
// sums[index] = 'N/A'
// }
}
})
return sums
} }
} }
} }

View File

@@ -565,8 +565,9 @@ export default {
} }
} }
if (this.err === 0) { // 传递成功后,清除该分组。当所有组都传递完成后,该项目下的机床和分组消失 if (this.err === 0) { // 传递成功后,清除该分组。当所有组都传递完成后,该项目下的机床和分组消失
const index = this.groupsNames.indexOf(this.groupValue) console.log(this.groupsNames.indexOf(this.groupValue), 22222)
this.groupsNames.splice(index, 1) // const index = this.groupsNames.indexOf(this.groupValue)
// this.groupsNames.splice(index, 1)
if (this.groupsNames.length === 0) { if (this.groupsNames.length === 0) {
const groupIndex = this.machineNames.indexOf(this.machineValue) const groupIndex = this.machineNames.indexOf(this.machineValue)
this.machineNames.splice(groupIndex, 1) this.machineNames.splice(groupIndex, 1)