| | |
| | | @querySearchData="querySearchData" |
| | | @selProductClick="selProductClick" |
| | | > |
| | | <!-- |
| | | <!-- |
| | | @selProductTypeClick="selProductTypeClick" |
| | | --> |
| | | <template slot="tableButton"> |
| | |
| | | queryProductId: null, |
| | | categoryId: null, |
| | | searchTaskMap: [], |
| | | isCreate:false, |
| | | thatRow:{}, |
| | | isCreate: false, |
| | | thatRow: {} |
| | | } |
| | | }, |
| | | created() { |
| | |
| | | selectBox: false, |
| | | selectIndex: true, |
| | | tableColumn: [ |
| | | { label: "当产品到达", prop: "areaName", location: true }, |
| | | { label: "当产品到达", prop: "areaName", toLocation: true }, |
| | | { label: "产品", prop: "productName", product: true }, |
| | | { label: "产品类别", prop: "productCategory", productType: true }, |
| | | { label: "存储到子位置", prop: "subLocation", sonLocation: true } |
| | | // { label: "公司", prop: "companyName", company: true } |
| | | ], |
| | | rowClickIndex:-1 |
| | | rowClickIndex: -1 |
| | | } |
| | | }, |
| | | // 请求数据 |
| | |
| | | }, |
| | | // 新增 |
| | | addProductClick() { |
| | | this.isCreate=true |
| | | this.isCreate = true |
| | | this.tableList.tableColumn[1].product = true |
| | | this.tableList.tableColumn[2].productType = true |
| | | console.log(this.tableData) |
| | |
| | | subLocation: "", |
| | | productName: "", |
| | | companyName: "", |
| | | productCategory:"", |
| | | productCategory: "", |
| | | isSet: true, |
| | | isEdit: false, |
| | | isOrder: true |
| | |
| | | areaId: this.areaId, |
| | | locationId: this.subLocationId, |
| | | productCategoryId: this.productCategoryId, |
| | | productId: this.productId |
| | | productId: this.productId |
| | | }).then((res) => { |
| | | console.log(res) |
| | | if (res.code === 200) { |
| | | this.getData() |
| | | let tipStr = this.currentRowId === 0 ? "添加成功" : "修改成功" |
| | | this.$message.success(tipStr) |
| | | this.isCreate=false |
| | | this.isCreate = false |
| | | } |
| | | }) |
| | | } |
| | |
| | | // 取消 |
| | | discardBtnClick() { |
| | | this.getData() |
| | | this.isCreate=false |
| | | this.isCreate = false |
| | | this.tableList.tableColumn[1].product = true |
| | | this.tableList.tableColumn[2].productType = true |
| | | this.addTitle = "新建" |
| | |
| | | }, |
| | | // 行点击 |
| | | tableRowClick(row, rowIndex) { |
| | | |
| | | this.thatRow=row |
| | | this.tableList.rowClickIndex=rowIndex |
| | | this.thatRow = row |
| | | this.tableList.rowClickIndex = rowIndex |
| | | this.rowIndex = rowIndex |
| | | this.isSel() |
| | | if (!this.isNoProduct && this.currentRowId === 0) { |
| | | this.$message.error("请完成当前新建或取消新建") |
| | | }else { |
| | | this.currentRowId = row.id||0 |
| | | } else { |
| | | this.currentRowId = row.id || 0 |
| | | this.addTitle = "保存" |
| | | this.showDiscard = true |
| | | this.isRowClick = true |
| | | if (this.isNoProduct) { |
| | | // this.tableData.splice(this.tableData.length - 1, 1) |
| | | this.tableData.map((item, index) => { |
| | | this.tableData.map((item, index) => { |
| | | if (index === rowIndex) { |
| | | item.isEdit = false |
| | | item.isOrder = true |
| | |
| | | } |
| | | } |
| | | }, |
| | | querySearchData(queryString,results,value){ |
| | | if(this.isCreate){ |
| | | if(queryString===''){ |
| | | querySearchData(queryString, results, value) { |
| | | if (this.isCreate) { |
| | | if (queryString === "") { |
| | | this.tableList.tableColumn[1].product = true |
| | | this.tableList.tableColumn[2].productType = true |
| | | }else{ |
| | | if(value==="product"){ |
| | | } else { |
| | | if (value === "product") { |
| | | this.tableList.tableColumn[2].productType = false |
| | | if(results.length!==0){ |
| | | this.productId=results[0].id |
| | | }else{ |
| | | this.productId=0 |
| | | if (results.length !== 0) { |
| | | this.productId = results[0].id |
| | | } else { |
| | | this.productId = 0 |
| | | } |
| | | }else if(value==="productType"){ |
| | | } else if (value === "productType") { |
| | | this.tableList.tableColumn[1].product = false |
| | | if(results.length!==0){ |
| | | this.productCategoryId=results[0].id |
| | | }else{ |
| | | this.productCategoryId=0 |
| | | if (results.length !== 0) { |
| | | this.productCategoryId = results[0].id |
| | | } else { |
| | | this.productCategoryId = 0 |
| | | } |
| | | } |
| | | } |
| | |
| | | this.subLocationId = item.value |
| | | }, |
| | | // 选中产品方法 |
| | | selProductClick(value,item){ |
| | | if(value==="product"){ |
| | | selProductClick(value, item) { |
| | | if (value === "product") { |
| | | this.RuleType = 1 |
| | | this.tableList.tableColumn[2].productType = false |
| | | this.productId=item.id |
| | | this.productCategoryId=item.categoryId |
| | | }else if(value==="productType"){ |
| | | this.productCategoryId=item.id |
| | | this.productId = item.id |
| | | this.productCategoryId = item.categoryId |
| | | } else if (value === "productType") { |
| | | this.productCategoryId = item.id |
| | | this.RuleType = 2 |
| | | this.tableList.tableColumn[1].product = false |
| | | } |
| | |
| | | }, |
| | | watch: { |
| | | rowIndex(newVal) { |
| | | if(this.isCreate){ |
| | | if(newVal===0){ |
| | | if (this.isCreate) { |
| | | if (newVal === 0) { |
| | | this.tableList.tableColumn[1].product = true |
| | | this.tableList.tableColumn[2].productType = true |
| | | }else{ |
| | | } else { |
| | | this.$message.error("请完成当前新建或取消新建") |
| | | this.tableList.tableColumn[1].product = false |
| | | this.tableList.tableColumn[2].productType = false |
| | | } |
| | | }else{ |
| | | if ( |
| | | this.tableList.tableData[newVal].productName === "" |
| | | ) { |
| | | } else { |
| | | if (this.tableList.tableData[newVal].productName === "") { |
| | | this.tableList.tableColumn[1].product = false |
| | | this.tableList.tableColumn[2].productType = true |
| | | } else { |