Commit 957ffc87 authored by caolaoban's avatar caolaoban

Merge branch 'dev' of http://94.191.100.41/tfmom/tf-mom-web into dev

parents 977e95a2 091d4de4
......@@ -123,13 +123,11 @@ export default {
formData.append('file', this.file.raw)
this.$api.apiUploadFile(`/InStorageRequestItem/importByExcel?id=${id}`, formData).then(res => { // 调用接口
this.uploading = false
if (res.code === '0') {
this.$utils.showMessageSuccess(res.message)
this.$utils.showMessageSuccess(res.data.message)
this.$emit('refreshTable')
this.close()
} else {
this.$utils.showMessageError(res.message)
}
}).catch(err => {
this.uploading = false
// this.$utils.showMessageError(err)
console.log('err', err)
})
......
......@@ -35,11 +35,11 @@
<el-button type="primary" class="searchBtn" @click="cancel">取消</el-button>
</span>
<storage-details ref="storageDetailsCreatOrEdit" :basic-data="detailsPropData" @addTableData="addTableData" />
<import-file ref="importFile" :param="importParam" />
<import-file ref="importFile" :param="importParam" @refreshTable="searchInStorageRequestItem" />
</div>
</template>
<script>
import { post, del, get } from '@/utils/http'
import { post, get } from '@/utils/http'
import StorageDetails from './component/storageDetailsCreateCom'
import ImportFile from './component/importFile'
import { downloadFile } from '@/utils/http'
......@@ -328,31 +328,29 @@ export default {
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
const id = row.id
// const id = row.id
if (row.id) {
del(`InStorageRequestItem/batch/${id}`).then(res => {
// del(`InStorageRequestItem/batch/${id}`).then(res => {
for (const item of this.tableData) {
const index = this.submitData.findIndex(el => el.rowId === row.rowId || el.rowId === row.parentId)
// 父类修改
if (item.rowId === row.rowId) {
this.tableData.splice(this.tableData.indexOf(item), 1)
break
this.submitData[index].operator = 'REMOVE'
}
// 子类修改
for (const child of item.children) {
if (child.rowId === row.rowId) {
const childIndex = this.submitData[index].children.findIndex(elChild => elChild.rowId === row.rowId)
this.tableData[this.tableData.indexOf(item)].children.splice(item.children.indexOf(child), 1)
break
this.submitData[index].children[childIndex].operator = 'REMOVE'
}
}
}
this.$message({
type: 'success',
message: '删除成功!'
})
this.treeTableNoArrange(this.tableData)
}).catch((err) => {
console.log(err)
})
this.treeTableNoArrange(this.tableData, 'remove')
// }).catch((err) => {
// console.log(err)
// })
} else {
for (const item of this.tableData) {
// 父类修改
......@@ -434,7 +432,7 @@ export default {
{ title: '含税单价', key: 'taxUnitPrice', headerAlign: 'center' },
{ title: '含税金额', key: 'taxPrice', headerAlign: 'center' },
{ title: '税率', key: 'taxRate', headerAlign: 'center' },
{ title: '报检人', key: 'applyUserName', headerAlign: 'center' },
{ title: '报检人', key: 'creator.userName', headerAlign: 'center' },
{
title: '接受仓库', key: 'extname', headerAlign: 'center', formatter: (row, column, cellValue, index) => {
const value = row.storageZone ? row.storageZone.extname : row.storageZoneName
......@@ -461,6 +459,7 @@ export default {
{ title: '创建时间', key: 'createTime', headerAlign: 'center' }
],
tableData: [],
submitData: [],
tableParam: [],
operator: null,
addData: {},
......@@ -754,7 +753,7 @@ export default {
},
// 组装表格数据
addTableData(formData) {
const tableData = Array.from(this.tableData)
const tableData = Array.from(this.submitData)
this.tableData = []
this.addData = formData
const tableDataItem = {
......@@ -794,7 +793,7 @@ export default {
this.treeTableNoArrange(tableData)
},
submit() {
const tableData = this.tableData.slice()
const tableData = this.submitData.slice()
tableData.forEach((obj, i) => {
for (const key in obj) {
if (key === 'storageZone') {
......@@ -811,7 +810,7 @@ export default {
})
}
})
const isVirtualHasChild = tableData.find(item => item.isVirtual && (!item.children || !item.children.length))
const isVirtualHasChild = tableData.find(item => item.isVirtual && (!item.children || !item.children.length || item.children && !(item.children.find(child => child.operator !== 'REMOVE'))))
if (isVirtualHasChild) return this.$utils.showMessageWarning('父件为虚拟件时,必须添加子件!')
const param = {
'operator': this.operator,
......@@ -837,8 +836,12 @@ export default {
console.log(err)
})
},
treeTableNoArrange(tableData) {
tableData.forEach((item, i) => {
treeTableNoArrange(tableData, type) {
if (type !== 'remove') {
this.submitData = this.$utils.deepClone(tableData)
this.tableData = this.$utils.deepClone(tableData)
}
this.tableData.forEach((item, i) => {
item.parentIndex = i + 1
if (item.children) {
item.children.forEach((child, j) => {
......@@ -847,7 +850,6 @@ export default {
})
}
})
this.tableData = tableData
},
changePageSize(pageSize) {
this.pagination.pageSize = pageSize
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment