| | |
| | | <div class="basic-info-view"> |
| | | <CommonFormTableView |
| | | ref="productTable" |
| | | :addTypeIdMultiple="true" |
| | | :disabledList="disabledList" |
| | | :product-table-list="productTableList" |
| | | :detail-enter="detailEnter" |
| | | :isOperate="isOperate" |
| | | @inputContent="inputContent" |
| | | @addProductClick="addProductClick" |
| | | @getSelectArray="getSelectArray" |
| | | @emptyProductClick="emptyProductClick" |
| | | @clearupProduct="clearupProduct" |
| | | @selCommonName="selCommonName" |
| | | @handleProduct="handleProduct" |
| | | /> |
| | | </div> |
| | | </div> |
| | |
| | | infomation: {} |
| | | } |
| | | } |
| | | }, |
| | | disabledList:{ |
| | | type:[Array], |
| | | default: () => { |
| | | return [] |
| | | } |
| | | } |
| | | }, |
| | | components: { CommonFormTableView }, |
| | |
| | | isNoProduct: true, |
| | | supplierId: this.addCommonConfig.infomation.supplierId, |
| | | detailEnter: true, |
| | | isOperate: true, |
| | | deliveryTime: this.addCommonConfig.infomation.deliveryTime, // 供货时长 |
| | | shippingDuration: this.addCommonConfig.infomation.shippingDuration, // 物流时长 |
| | | purchasePrice: this.addCommonConfig.infomation.purchasePrice // 采购价格 |
| | |
| | | if (this.editConfig.title === "添加") { |
| | | createProduct({ |
| | | list: this.tableData |
| | | }).then((res) => { |
| | | console.log(res) |
| | | this.editConfig.visible = false |
| | | if (res.code === 200) { |
| | | this.$message.success("添加成功") |
| | | this.$parent.getProductList() |
| | | } |
| | | }).catch(e=>{ |
| | | console.log(e) |
| | | }) |
| | | .then((res) => { |
| | | console.log(res) |
| | | this.editConfig.visible = false |
| | | if (res.code === 200) { |
| | | this.$message.success("添加成功") |
| | | this.$parent.getProductList() |
| | | } |
| | | }) |
| | | .catch((e) => { |
| | | console.log(e) |
| | | }) |
| | | } else { |
| | | const params = this.saveParams() |
| | | updateProduct(params).then((res) => { |
| | |
| | | let data = this.editConfig.infomation |
| | | let params = { |
| | | deliveryTime: this.deliveryTime || 0, |
| | | id: data.ID || 0, |
| | | maximumStock: data.maximumStock || 0, |
| | | minimumStock: data.minimumStock || 0, |
| | | modelNumber: data.modelNumber || "", |
| | | name: data.name || "", |
| | | number: data.number || "", |
| | | productType: data.productType || "", |
| | | id: data.id || 0, |
| | | // maximumStock: data.maximumStock || 0, |
| | | // minimumStock: data.minimumStock || 0, |
| | | // modelNumber: data.modelNumber || "", |
| | | // name: data.name || "", |
| | | // number: data.number || "", |
| | | // productType: data.productType || "", |
| | | purchasePrice: this.purchasePrice || 0, |
| | | remark: data.remark || "", |
| | | // remark: data.remark || "", |
| | | shippingDuration: this.shippingDuration || 0, |
| | | specifications: data.specifications || "", |
| | | // specifications: data.specifications || "", |
| | | supplierId: this.supplierId || 0, |
| | | unit: data.unit || "" |
| | | // unit: data.unit || "" |
| | | ...this.tableData[0] |
| | | } |
| | | return params |
| | | }, |
| | | handleProduct(item, row) { |
| | | this.editConfig.infomation.id = row.id |
| | | }, |
| | | setTableForm() { |
| | | if (this.editConfig.title === "添加") { |
| | |
| | | } |
| | | this.productTableList = { |
| | | tableData: this.tableData, |
| | | isReturn: true, |
| | | tableColumn: [ |
| | | { label: "产品名称", prop: "name", productName: true, isRequird: true }, |
| | | { label: "产品名称", prop: "name", productName: true, isRequird: true, width: 250 }, |
| | | { label: "产品编码", prop: "number" }, |
| | | { label: "计量单位", prop: "unit" }, |
| | | { label: "规格型号", prop: "specifications" }, |
| | |
| | | }, |
| | | // 产品列表输入 |
| | | inputContent(val, prop, row) { |
| | | this.productId = row.productId |
| | | this.deliveryTime = row.deliveryTime |
| | | this.shippingDuration = row.shippingDuration |
| | | this.purchasePrice = row.purchasePrice |
| | | this.tableData.map((item) => { |
| | | if (item.productId === row.productId) { |
| | | if (item.number == row.number) { |
| | | item[prop] = val |
| | | item.supplierId = this.supplierId |
| | | item.deliveryTime = this.deliveryTime |
| | | item.shippingDuration = this.shippingDuration |
| | | item.purchasePrice = this.purchasePrice |
| | | item.supplierId = Number(this.supplierId) |
| | | } |
| | | }) |
| | | }, |
| | | // 产品新增 |
| | | addProductClick() { |
| | | this.productId++ |
| | | this.tableData.push({ |
| | | productId: this.productId, |
| | | id: 0, |
| | | amount: 0, |
| | | desc: "", |
| | | name: "", |
| | | number: "", |
| | | purchasePrice: 0, |
| | | total: 0, |
| | | deliveryTime: 0, |
| | | shippingDuration: 0, |
| | | supplierId: this.supplierId |
| | | }) |
| | | // this.productId++ |
| | | // this.tableData.push({ |
| | | // productId: this.productId, |
| | | // id: 0, |
| | | // amount: 0, |
| | | // desc: "", |
| | | // name: "", |
| | | // number: "", |
| | | // purchasePrice: 0, |
| | | // total: 0, |
| | | // deliveryTime: 0, |
| | | // shippingDuration: 0, |
| | | // supplierId: this.supplierId |
| | | // }) |
| | | }, |
| | | // 新增方式修改 |
| | | getSelectArray(val, index) { |
| | | console.log(val, "ddd99999") |
| | | if (this.tableData.length == 1 && this.tableData[0].number.length == 0) { |
| | | this.tableData = [] |
| | | } |
| | | if (index < this.tableData.length) { |
| | | this.tableData.splice(index, 1) |
| | | val.map((item, ind) => { |
| | | this.tableData.splice(index + ind, 0, item) |
| | | }) |
| | | } else { |
| | | this.tableData = this.tableData.concat(val) |
| | | } |
| | | this.productTableList.tableData = this.tableData |
| | | // this.showSummary.show = true |
| | | }, |
| | | // 产品清空 |
| | | emptyProductClick() { |