diff --git a/src/components/mycomponent/dialog/brandAddDialog.vue b/src/components/mycomponent/dialog/brandAddDialog.vue index 5449e3b..b9c132d 100644 --- a/src/components/mycomponent/dialog/brandAddDialog.vue +++ b/src/components/mycomponent/dialog/brandAddDialog.vue @@ -29,9 +29,9 @@ > @@ -113,7 +113,7 @@ watch: { dataInfo: { handler(vla) { - if (vla != '') { + if (vla !== '') { this.addInfo = { brandCode: vla.brandCode, // 编号 brandName: vla.brandName, @@ -122,6 +122,7 @@ categoryIds: this.categoryName(vla.categorys), remark: vla.remark } + debugger } else { this.addInfo = { brandCode: '', // 编号 @@ -170,19 +171,16 @@ // 数据处理 categoryName(category) { const ary = [] - if (category.length == 0) return '' + if (category.length === 0) return '' category.forEach(ele => { ary.push(ele.categoryId) }) return ary }, supplierName(supplier) { - const ary = [] - if (supplier.length == 0) return '' - supplier.forEach(ele => { - ary.push(ele.supplierName) - }) - return ary + if (supplier.length === 0) return [] + const supplierIds = supplier.map(item => item.id) + return supplierIds } } diff --git a/src/components/mycomponent/dialog/brandAddDialog.vue b/src/components/mycomponent/dialog/brandAddDialog.vue index 5449e3b..b9c132d 100644 --- a/src/components/mycomponent/dialog/brandAddDialog.vue +++ b/src/components/mycomponent/dialog/brandAddDialog.vue @@ -29,9 +29,9 @@ > @@ -113,7 +113,7 @@ watch: { dataInfo: { handler(vla) { - if (vla != '') { + if (vla !== '') { this.addInfo = { brandCode: vla.brandCode, // 编号 brandName: vla.brandName, @@ -122,6 +122,7 @@ categoryIds: this.categoryName(vla.categorys), remark: vla.remark } + debugger } else { this.addInfo = { brandCode: '', // 编号 @@ -170,19 +171,16 @@ // 数据处理 categoryName(category) { const ary = [] - if (category.length == 0) return '' + if (category.length === 0) return '' category.forEach(ele => { ary.push(ele.categoryId) }) return ary }, supplierName(supplier) { - const ary = [] - if (supplier.length == 0) return '' - supplier.forEach(ele => { - ary.push(ele.supplierName) - }) - return ary + if (supplier.length === 0) return [] + const supplierIds = supplier.map(item => item.id) + return supplierIds } } diff --git a/src/views/product/categoryList.vue b/src/views/product/categoryList.vue index 89792f6..7930e4c 100644 --- a/src/views/product/categoryList.vue +++ b/src/views/product/categoryList.vue @@ -55,21 +55,22 @@ > 删除 - - - 导出 - - + + + 导出 + + - + @@ -120,7 +120,7 @@ { + }).catch(_ => { this.loading = false }) }, // 删除 Cdelete(row) { - this.$confirm(`确认删除此品类吗?`, "提示", { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: "warning", - }) - .then(() => { - const id = row.id - C_delete({ id: id }).then((res) => { - // 删除成功 跟新列表 - if (res.code === 200) { - this.$message({ - message: '删除成功', - type: 'success' - }) - this.refresh() - } + this.$confirm(`确认删除此品类吗?`, '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + const id = row.id + C_delete({ id: id }).then((res) => { + // 删除成功 跟新列表 + if (res.code === 200) { + this.$message({ + message: '删除成功', + type: 'success' + }) + this.refresh() + } + }) }) }, // 批量删除 BatchDelete() { - if(this.$refs.multipleTable.selection.length !== 0){ - this.$confirm(`确认删除选中的这些品类吗?`, "提示", { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: "warning", - }) - .then(() => { - // 得到选中行 - const dle_ary = this.$refs.multipleTable.selection - const ids = [] - dle_ary.forEach((ele) => { - ids.push(ele.id) - }) - C_batchDelete({ ids: ids }).then((res) => { - if (res.code === 200) { - this.$message({ - message: '删除成功', - type: 'success' + if (this.$refs.multipleTable.selection.length !== 0) { + this.$confirm(`确认删除选中的这些品类吗?`, '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + // 得到选中行 + const dle_ary = this.$refs.multipleTable.selection + const ids = [] + dle_ary.forEach((ele) => { + ids.push(ele.id) }) - this.refresh() - } - }) - }else{ - this.$message({ - message: "请先勾选需要删除的品类", - type: "error", - }); - } + C_batchDelete({ ids: ids }).then((res) => { + if (res.code === 200) { + this.$message({ + message: '删除成功', + type: 'success' + }) + this.refresh() + } + }) + }) + } else { + this.$message({ + message: '请先勾选需要删除的品类', + type: 'error' + }) + } }, // 编辑 compile(row) { diff --git a/src/components/mycomponent/dialog/brandAddDialog.vue b/src/components/mycomponent/dialog/brandAddDialog.vue index 5449e3b..b9c132d 100644 --- a/src/components/mycomponent/dialog/brandAddDialog.vue +++ b/src/components/mycomponent/dialog/brandAddDialog.vue @@ -29,9 +29,9 @@ > @@ -113,7 +113,7 @@ watch: { dataInfo: { handler(vla) { - if (vla != '') { + if (vla !== '') { this.addInfo = { brandCode: vla.brandCode, // 编号 brandName: vla.brandName, @@ -122,6 +122,7 @@ categoryIds: this.categoryName(vla.categorys), remark: vla.remark } + debugger } else { this.addInfo = { brandCode: '', // 编号 @@ -170,19 +171,16 @@ // 数据处理 categoryName(category) { const ary = [] - if (category.length == 0) return '' + if (category.length === 0) return '' category.forEach(ele => { ary.push(ele.categoryId) }) return ary }, supplierName(supplier) { - const ary = [] - if (supplier.length == 0) return '' - supplier.forEach(ele => { - ary.push(ele.supplierName) - }) - return ary + if (supplier.length === 0) return [] + const supplierIds = supplier.map(item => item.id) + return supplierIds } } diff --git a/src/views/product/categoryList.vue b/src/views/product/categoryList.vue index 89792f6..7930e4c 100644 --- a/src/views/product/categoryList.vue +++ b/src/views/product/categoryList.vue @@ -55,21 +55,22 @@ > 删除 - - - 导出 - - + + + 导出 + + - + @@ -120,7 +120,7 @@ { + }).catch(_ => { this.loading = false }) }, // 删除 Cdelete(row) { - this.$confirm(`确认删除此品类吗?`, "提示", { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: "warning", - }) - .then(() => { - const id = row.id - C_delete({ id: id }).then((res) => { - // 删除成功 跟新列表 - if (res.code === 200) { - this.$message({ - message: '删除成功', - type: 'success' - }) - this.refresh() - } + this.$confirm(`确认删除此品类吗?`, '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + const id = row.id + C_delete({ id: id }).then((res) => { + // 删除成功 跟新列表 + if (res.code === 200) { + this.$message({ + message: '删除成功', + type: 'success' + }) + this.refresh() + } + }) }) }, // 批量删除 BatchDelete() { - if(this.$refs.multipleTable.selection.length !== 0){ - this.$confirm(`确认删除选中的这些品类吗?`, "提示", { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: "warning", - }) - .then(() => { - // 得到选中行 - const dle_ary = this.$refs.multipleTable.selection - const ids = [] - dle_ary.forEach((ele) => { - ids.push(ele.id) - }) - C_batchDelete({ ids: ids }).then((res) => { - if (res.code === 200) { - this.$message({ - message: '删除成功', - type: 'success' + if (this.$refs.multipleTable.selection.length !== 0) { + this.$confirm(`确认删除选中的这些品类吗?`, '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + // 得到选中行 + const dle_ary = this.$refs.multipleTable.selection + const ids = [] + dle_ary.forEach((ele) => { + ids.push(ele.id) }) - this.refresh() - } - }) - }else{ - this.$message({ - message: "请先勾选需要删除的品类", - type: "error", - }); - } + C_batchDelete({ ids: ids }).then((res) => { + if (res.code === 200) { + this.$message({ + message: '删除成功', + type: 'success' + }) + this.refresh() + } + }) + }) + } else { + this.$message({ + message: '请先勾选需要删除的品类', + type: 'error' + }) + } }, // 编辑 compile(row) { diff --git a/src/views/product/editBrand.vue b/src/views/product/editBrand.vue index dd74221..2d84065 100644 --- a/src/views/product/editBrand.vue +++ b/src/views/product/editBrand.vue @@ -26,7 +26,7 @@ - + 0) { - this.brandForm.supplierIds.push(row.suppliers[0].supplierId) - this.brandForm.supplierIdsStr = row.suppliers[0].supplierId + this.brandForm.supplierIds = row.suppliers.map(item => item.supplierId) } // 设置所属品类 选中 if (row.categorys.length > 0) {