diff --git a/src/views/business/report.vue b/src/views/business/report.vue
index d833399..7045eaf 100644
--- a/src/views/business/report.vue
+++ b/src/views/business/report.vue
@@ -221,7 +221,7 @@
-
+
{{ row.brandName }}
+
+
+
+
+ {{ row.brandName }}
+
+
+
+
+
+
+
+
+ {{ row.categoryIds }}
+
+
+
+
+
+
+
+
+ {{ row.productCode }}
+
+
+
+
+
+
+
+
+ {{ row.productQuantity }}
+
+
+
+
+
+ {{ row.productPrice }}
+
+
+
+
+
+
+ 编辑
+
+
+ 删除
+
+
+ 确定
+
+
+ 取消
+
+
+ 删除
+
+
+
+
+
+ 添加项目需求
+
保存
@@ -245,7 +225,7 @@
import { SelectList } from "../../api/product/brand";
import { list } from "../../api/product/product";
export default {
- name:'orderShop',
+ name: 'orderShop',
components: {
RedStar,
inputVue,
@@ -255,13 +235,15 @@
brandName: "",
categoryIds: "",
productCode: "",
- productQuantity1: "",
- productPrice1: "",
+ productQuantity: "",
+ productPrice: "",
list: {
codeList: [],
brandList: [],
categoryList: [],
},
+ showEdit: [], // 用来判断是否处于编辑状态
+ isFirst:[], // 用来判断是否初次添加
productList: [{ index: "" }],
isShowAdd: false, // 添加采购需求
options: {},
@@ -364,6 +346,24 @@
close() {
this.isShowAdd = false;
},
+ // 添加项目新需求
+ handleAddBtn() {
+ const obj = {
+ brandName: '',
+ categoryIds: '',
+ productCode: '',
+ productQuantity: '',
+ productPrice: ''
+ }
+ this.addInfo.productList.push(obj);
+ this.showEdit[this.addInfo.productList.length - 1] = true
+ this.isFirst[this.addInfo.productList.length - 1] = 1
+ this.brandName = ""
+ this.categoryIds = ""
+ this.productCode = ""
+ this.productQuantity1 = ""
+ this.productPrice1 = ""
+ },
addTableDataClick() {
const obj = {};
obj.brandName = this.brandName;
@@ -394,7 +394,7 @@
console.log(code);
// 获取产品型号列表
list({ categoryId: code }).then((res) => {
- this.list.CodeList = res;
+ this.list.codeList = res;
});
},
valiateProduct() {
@@ -445,6 +445,82 @@
return false;
}
},
+ // 确定保存
+ submit(index, row) {
+ // 发送请求,隐藏输入框
+ const { productCode, brandName, categoryIds, addInfo: { productList: { productQuantity, productPrice } } } = this
+ if (categoryIds && brandName && productQuantity && productPrice) {
+ row.productCode = this.addInfo.productList.productCode
+ row.brandName = this.brandName
+ row.categoryIds = this.categoryIds
+ row.productQuantity = this.addInfo.productList.productQuantity
+ row.productPrice = this.addInfo.productList.productPrice
+ this.$message({
+ type: 'success',
+ message: '已缓存,记得点击保存提交修改喔!',
+ duration: 888,
+ onClose: () => {
+ this.$set(this.showEdit, index, false) // vue添加属性的方法
+ }
+ })
+ row.productCode = this.addInfo.productList.productCode
+ row.brandName = this.brandName
+ row.categoryIds = this.categoryIds
+ row.productQuantity = this.addInfo.productList.productQuantity
+ row.productPrice = this.addInfo.productList.productPrice
+ this.$set(this.isFirst, index, 2)
+ this.brandName = ''
+ this.categoryIds = ''
+ this.addInfo.productList.productCode = ''
+ this.addInfo.productList.productQuantity = ''
+ this.addInfo.productList.productPrice = ''
+ } else {
+ this.$message({
+ message: "请先完整选择或填写信息",
+ type: "error",
+ });
+ }
+ },
+ // 修改
+ showUpdate(index, row) {
+ this.showEdit[index] = true
+ this.$set(this.showEdit, index, true) // 这里要用$set方法,否则页面状态不更新
+ this.brandName = row.brandName
+ this.categoryIds = row.categoryIds
+ this.addInfo.productList.productCode = row.productCode
+ this.addInfo.productList.productQuantity = row.productQuantity
+ this.addInfo.productList.productPrice = row.productPrice
+ },
+ // 取消修改
+ cancelUpdate(index) {
+ this.$confirm('取消修改?', '提示', {
+ confirmButtonText: '确定',
+ cancelButtonText: '取消',
+ type: 'warning'
+ })
+ .then(() => {
+ this.$set(this.showEdit, index, false)
+ })
+ .catch(() => { })
+ },
+ // 删除
+ showDelete(index, row) {
+ this.$confirm('确认删除?', '提示', {
+ confirmButtonText: '确定',
+ cancelButtonText: '取消',
+ type: 'warning'
+ })
+ .then(() => {
+ this.addInfo.productList = this.addInfo.productList.filter((item, Index) => index !== Index)
+ this.showEdit = this.showEdit.filter((item, Index) => index !== Index)
+ this.isFirst = this.showEdit.isFirst((item, Index) => index !== Index)
+ this.$message({
+ message: '已删除',
+ type: 'success'
+ })
+ })
+ .catch(() => { })
+ },
},
};
@@ -490,7 +566,7 @@
}
.order-table {
- margin-top: 20px;
+ margin: 10px 20px;
}
}