|
|
@@ -206,18 +206,17 @@ export default {
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
|
type: 'warning'
|
|
|
- }).then(() => {
|
|
|
- remove(this.allList[this.arrowsShow].id)
|
|
|
- this.arrowsShow = null
|
|
|
- this.$nextTick(() => {
|
|
|
- setTimeout(() => {
|
|
|
- this.getTreeList()
|
|
|
- }, 100)
|
|
|
- })
|
|
|
- this.$message({
|
|
|
- type: 'success',
|
|
|
- message: '删除成功!'
|
|
|
- })
|
|
|
+ }).then(async () => {
|
|
|
+ const res = await remove(this.allList[this.arrowsShow].id)
|
|
|
+ if (res.code === 0) {
|
|
|
+ this.arrowsShow = null
|
|
|
+ this.$nextTick(() => {
|
|
|
+ setTimeout(() => {
|
|
|
+ this.getTreeList()
|
|
|
+ }, 100)
|
|
|
+ })
|
|
|
+ this.$message.success('删除成功!')
|
|
|
+ } else if (res.code === -1) this.$message.warning('此仓库已使用,不能删除!')
|
|
|
}).catch(() => {
|
|
|
this.$message({
|
|
|
type: 'info',
|
|
|
@@ -235,7 +234,7 @@ export default {
|
|
|
},
|
|
|
async popupOneOK () {
|
|
|
if (this.popupOneName.trim() === '') return this.$message.error('库区名称不能为空')
|
|
|
- if (this.popupOneName.length > 8) return this.$message.error('库区名称不能超过15个字符')
|
|
|
+ if (this.popupOneName.length > 8) return this.$message.error('库区名称不能超过15个字')
|
|
|
await addEntrepot({
|
|
|
level: 1,
|
|
|
name: this.popupOneName,
|
|
|
@@ -254,26 +253,21 @@ export default {
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
|
type: 'warning'
|
|
|
- }).then(() => {
|
|
|
- // console.log(666, this.allList[this.arrowsShow].children[this.entrepotShow].id)
|
|
|
- remove(this.allList[this.arrowsShow].children[this.entrepotShow].id)
|
|
|
- this.entrepotShow = 0
|
|
|
- // this.arrowsShow = null
|
|
|
- // this.towList.name = ''
|
|
|
- this.$nextTick(() => {
|
|
|
- setTimeout(() => {
|
|
|
- this.getTreeList()
|
|
|
+ }).then(async () => {
|
|
|
+ const res = await remove(this.allList[this.arrowsShow].children[this.entrepotShow].id)
|
|
|
+ if (res.code === 0) {
|
|
|
+ this.entrepotShow = 0
|
|
|
+ this.$nextTick(() => {
|
|
|
setTimeout(() => {
|
|
|
- if (this.allList[this.arrowsShow].children) this.towList = this.allList[this.arrowsShow].children[0]
|
|
|
- else this.towList.name = ''
|
|
|
- // console.log(999, this.allList[this.arrowsShow].children.length)
|
|
|
+ this.getTreeList()
|
|
|
+ setTimeout(() => {
|
|
|
+ if (this.allList[this.arrowsShow].children) this.towList = this.allList[this.arrowsShow].children[0]
|
|
|
+ else this.towList.name = ''
|
|
|
+ }, 100)
|
|
|
}, 100)
|
|
|
- }, 100)
|
|
|
- })
|
|
|
- this.$message({
|
|
|
- type: 'success',
|
|
|
- message: '删除成功!'
|
|
|
- })
|
|
|
+ })
|
|
|
+ this.$message.success('删除成功!')
|
|
|
+ } else if (res.code === -1) this.$message.warning('此仓库已使用,不能删除!')
|
|
|
}).catch(() => {
|
|
|
this.$message({
|
|
|
type: 'info',
|
|
|
@@ -300,9 +294,9 @@ export default {
|
|
|
},
|
|
|
async popupTowOK () {
|
|
|
if (this.popupTowNum.trim() === '') return this.$message.error('仓库编号不能为空')
|
|
|
- if (this.popupTowNum.length > 8) return this.$message.error('仓库编号不能超过15个字符')
|
|
|
+ if (this.popupTowNum.length > 8) return this.$message.error('仓库编号不能超过15个字')
|
|
|
if (this.popupTowName.trim() === '') return this.$message.error('仓库名称不能为空')
|
|
|
- if (this.popupTowName.length > 8) return this.$message.error('仓库名称不能超过15个字符')
|
|
|
+ if (this.popupTowName.length > 8) return this.$message.error('仓库名称不能超过15个字')
|
|
|
await addEntrepot({
|
|
|
level: 2,
|
|
|
name: this.popupTowName,
|
|
|
@@ -332,19 +326,18 @@ export default {
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
|
type: 'warning'
|
|
|
- }).then(() => {
|
|
|
- remove(id)
|
|
|
- // 刷新页面
|
|
|
- this.$nextTick(() => {
|
|
|
- setTimeout(() => {
|
|
|
- this.getTreeList()
|
|
|
- this.tableData = this.tableData.filter(v => v.id !== id)
|
|
|
- }, 100)
|
|
|
- })
|
|
|
- this.$message({
|
|
|
- type: 'success',
|
|
|
- message: '删除成功!'
|
|
|
- })
|
|
|
+ }).then(async () => {
|
|
|
+ const res = await remove(id)
|
|
|
+ if (res.code === 0) {
|
|
|
+ // 刷新页面
|
|
|
+ this.$nextTick(() => {
|
|
|
+ setTimeout(() => {
|
|
|
+ this.getTreeList()
|
|
|
+ this.tableData = this.tableData.filter(v => v.id !== id)
|
|
|
+ }, 100)
|
|
|
+ })
|
|
|
+ this.$message.success('删除成功!')
|
|
|
+ } else if (res.code === -1) this.$message.warning('此仓库已使用,不能删除!')
|
|
|
}).catch(() => {
|
|
|
this.$message({
|
|
|
type: 'info',
|