| | |
| | | <SearchCommonView |
| | | :add-title="addTitle" |
| | | :show-discard="showDiscard" |
| | | :placeholder="'请输入位置/产品'" |
| | | :placeholder="'请输入产品/产品类别'" |
| | | :amount-view="false" |
| | | :search-task-map="searchTaskMap" |
| | | @addCommonClick="addProductClick" |
| | | @searchClick="getList" |
| | | @discardBtnClick="discardBtnClick" |
| | | @applyBtnClick="applyBtnClick" |
| | | @delSelectClick="delSelectClick" |
| | | /> |
| | | </div> |
| | | <div class="list-view"> |
| | |
| | | isRowClick: false, |
| | | areaId: 0, |
| | | productId: 0, |
| | | productCategoryId:0, |
| | | productCategoryId: 0, |
| | | subLocationId: 0, |
| | | currentRowId: 0, |
| | | rowIndex:-1, |
| | | RuleType:0, |
| | | rowIndex: -1, |
| | | RuleType: 0, |
| | | queryProductId: null, |
| | | categoryId: null, |
| | | searchTaskMap: [] |
| | | } |
| | | }, |
| | | created() { |
| | | this.setTable() |
| | | let query = this.$route.query |
| | | if (query) { |
| | | console.log("aaaaaaaaaaaaa", query) |
| | | this.queryProductId = query.productId?.length ? query.productId : null |
| | | this.categoryId = query.id ? Number(query.id) : null |
| | | this.pagerOptions.currPage = 1 |
| | | this.searchTaskMap = |
| | | query?.id > 0 |
| | | ? [{ categoryId: this.categoryId, title: query.categoryName }] |
| | | : query.productId?.length > 0 |
| | | ? [{ productId: this.queryProductId, title: query.productName }] |
| | | : [] |
| | | console.log(this.searchTaskMap) |
| | | } |
| | | this.getData() |
| | | }, |
| | | methods: { |
| | |
| | | tableColumn: [ |
| | | { label: "当产品到达", prop: "areaName", location: true }, |
| | | { label: "产品", prop: "productName", product: true }, |
| | | { label: "产品类别", prop: "productCategory",productType: true }, |
| | | { label: "产品类别", prop: "productCategory", productType: true }, |
| | | { label: "存储到子位置", prop: "subLocation", location: true } |
| | | // { label: "公司", prop: "companyName", company: true } |
| | | ] |
| | |
| | | // 请求数据 |
| | | async getData() { |
| | | await getListingRulesList({ |
| | | // keyword: this.keyword, |
| | | productId: this.queryProductId ? this.queryProductId : null, |
| | | productCategoryId: this.categoryId ? this.categoryId : null, |
| | | page: this.pagerOptions.currPage, |
| | | pageSize: this.pagerOptions.pageSize |
| | | }).then((res) => { |
| | |
| | | }, |
| | | // 新增 |
| | | addProductClick() { |
| | | this.tableList.tableColumn[1].product=true |
| | | this.tableList.tableColumn[2].productType=true |
| | | this.tableList.tableColumn[1].product = true |
| | | this.tableList.tableColumn[2].productType = true |
| | | console.log(this.tableData) |
| | | this.isSel() |
| | | if (this.isNoProduct && this.addTitle === "新建") { |
| | |
| | | } else { |
| | | if (this.areaId === 0) { |
| | | this.$message.error("请选择当前产品到达位置") |
| | | } else if (this.productId === 0 && this.productCategoryId==='') { |
| | | } else if (this.productId === 0 && this.productCategoryId === "") { |
| | | this.$message.error("请选择产品或产品类别") |
| | | } else if (this.subLocationId === 0) { |
| | | this.$message.error("请选择存储到子位置") |
| | |
| | | }) |
| | | let requestUrl = this.currentRowId === 0 ? addListingRules : updateListingRules |
| | | requestUrl({ |
| | | RuleType:this.RuleType, |
| | | id: this.currentRowId, |
| | | areaId: this.areaId, |
| | | locationId: this.subLocationId, |
| | | productCategoryId: this.productCategoryId||'', |
| | | productId: this.productId||'' |
| | | RuleType: this.RuleType, |
| | | id: this.currentRowId, |
| | | areaId: this.areaId, |
| | | locationId: this.subLocationId, |
| | | productCategoryId: this.productCategoryId || "", |
| | | productId: this.productId || "" |
| | | }).then((res) => { |
| | | console.log(res) |
| | | if (res.code === 200) { |
| | |
| | | }, |
| | | // 取消 |
| | | discardBtnClick() { |
| | | this.tableList.tableColumn[1].product=true |
| | | this.tableList.tableColumn[2].productType=true |
| | | this.tableList.tableColumn[1].product = true |
| | | this.tableList.tableColumn[2].productType = true |
| | | if (this.isRowClick) { |
| | | this.tableData.map((item) => { |
| | | item.isEdit = true |
| | |
| | | }, |
| | | // 行点击 |
| | | tableRowClick(row, rowIndex) { |
| | | this.rowIndex=rowIndex |
| | | this.rowIndex = rowIndex |
| | | this.isSel() |
| | | if (!this.isNoProduct && this.currentRowId === 0) { |
| | | this.$message.error("请完成当前新建或取消新建") |
| | | } else { |
| | | this.tableList.tableColumn[2].productType=true |
| | | this.tableList.tableColumn[2].productType = true |
| | | this.currentRowId = row.id |
| | | this.addTitle = "保存" |
| | | this.showDiscard = true |
| | |
| | | this.subLocationId = row.locationId |
| | | this.productCategoryId = row.productCategoryId |
| | | this.productId = row.productId |
| | | if(this.tableList.tableData[rowIndex].productName===""||this.tableList.tableData[rowIndex].productName===" "){ |
| | | this.tableList.tableColumn[1].product=false |
| | | this.tableList.tableColumn[2].productType=true |
| | | }else{ |
| | | this.tableList.tableColumn[1].product=true |
| | | this.tableList.tableColumn[2].productType=false |
| | | if ( |
| | | this.tableList.tableData[rowIndex].productName === "" || |
| | | this.tableList.tableData[rowIndex].productName === " " |
| | | ) { |
| | | this.tableList.tableColumn[1].product = false |
| | | this.tableList.tableColumn[2].productType = true |
| | | } else { |
| | | this.tableList.tableColumn[1].product = true |
| | | this.tableList.tableColumn[2].productType = false |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | // 搜索 |
| | | getList(val) { |
| | |
| | | }, |
| | | // 选中产品方法 |
| | | selProductClick(item) { |
| | | console.log(item,"产品") |
| | | this.RuleType=1 |
| | | this.tableList.tableColumn[2].productType=false |
| | | console.log(item, "产品") |
| | | this.RuleType = 1 |
| | | this.tableList.tableColumn[2].productType = false |
| | | this.productId = item.value |
| | | this.productCategoryId = item.categoryId |
| | | }, |
| | | // 选中产品类型方法 |
| | | selProductTypeClick(item) { |
| | | this.RuleType=2 |
| | | if(this.currentRowId===0){ |
| | | this.productCategoryId=item.value |
| | | }else{ |
| | | this.tableList.tableColumn[1].product=false |
| | | this.tableList.tableData[this.rowIndex].productName=' ' |
| | | this.productId='' |
| | | this.productCategoryId=this.tableList.tableData[this.rowIndex].productCategoryId |
| | | this.RuleType = 2 |
| | | if (this.currentRowId === 0) { |
| | | this.productCategoryId = item.value |
| | | } else { |
| | | this.tableList.tableColumn[1].product = false |
| | | this.tableList.tableData[this.rowIndex].productName = " " |
| | | this.productId = "" |
| | | this.productCategoryId = this.tableList.tableData[this.rowIndex].productCategoryId |
| | | } |
| | | }, |
| | | // 删除 |
| | |
| | | this.getData() |
| | | } |
| | | }) |
| | | }, |
| | | // 删除产品类型 |
| | | delSelectClick() { |
| | | this.categoryId = 0 |
| | | this.queryProductId = "" |
| | | this.getData() |
| | | } |
| | | }, |
| | | watch:{ |
| | | rowIndex(newVal){ |
| | | if(this.tableList.tableData[newVal].productName===" "){ |
| | | this.tableList.tableColumn[1].product=false |
| | | this.tableList.tableColumn[2].productType=true |
| | | }else{ |
| | | this.tableList.tableColumn[1].product=true |
| | | this.tableList.tableColumn[2].productType=false |
| | | watch: { |
| | | rowIndex(newVal) { |
| | | if (this.tableList.tableData[newVal].productName === " ") { |
| | | this.tableList.tableColumn[1].product = false |
| | | this.tableList.tableColumn[2].productType = true |
| | | } else { |
| | | this.tableList.tableColumn[1].product = true |
| | | this.tableList.tableColumn[2].productType = false |
| | | } |
| | | } |
| | | } |