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