From 051145654d6b1b5556c70f91ca29384a35aa5f7d Mon Sep 17 00:00:00 2001 From: yangfeng <wanwan926_4@163.com> Date: 星期四, 16 十一月 2023 13:46:38 +0800 Subject: [PATCH] 公共组件选择产品改为下拉可搜索框、库存调整、补货、上架规则、重订货规则修改 --- src/views/warehouseManage/listingRules/index.vue | 3 src/views/productManage/reorderRules/index.vue | 39 ++++++------ src/components/makepager/SimpleSearchInput.vue | 28 ++++---- src/views/operate/orderPoint/index.vue | 7 +- src/components/makepager/CommonFormTableView.vue | 89 +++++++---------------------- src/views/operate/inventoryAdjustment/index.vue | 5 - 6 files changed, 65 insertions(+), 106 deletions(-) diff --git a/src/components/makepager/CommonFormTableView.vue b/src/components/makepager/CommonFormTableView.vue index 84d708e..7a7cf80 100644 --- a/src/components/makepager/CommonFormTableView.vue +++ b/src/components/makepager/CommonFormTableView.vue @@ -267,48 +267,17 @@ <el-form-item v-else-if="item.product" label=" " :prop="'tableData.' + scope.$index + '.' + item.prop"> <div class="custom-name"> <span v-if="scope.row.isEdit || scope.row.editable">{{ scope.row.productName }}</span> - <!-- <el-select - v-else - v-model="scope.row[item.prop]" - placeholder="璇烽�夋嫨" - size="mini" - filterable - style="width: 80%" - clearable - @clear="setValueNull(scope.row[item.prop])" - @change=" - (val) => { - selProductClick(val) - } - " - > - <el-option - v-for="(item, index) in productNameOptions" - :key="index" - :label="item.name" - :value="{ - value: item.id, - label: item.name, - amount: item.amount, - unit: item.unit, - categoryId: item.categoryId, - categoryName: item.categoryName - }" + <template v-else> + <SimpleSearchInput + v-model="scope.row[item.prop]" + :echoValue="scope.row[item.prop]" + :echoName="scope.row[item.prop]" + checkedNum="1" + :clearable="true" + @select-user="selProductClick" > - </el-option> - </el-select> --> - <el-autocomplete - v-else - style="width: 100%" - v-model="scope.row.productName" - :fetch-suggestions=" - (queryString, callback) => { - querySearchAsync(queryString, callback, 'product') - } - " - value-key="name" - @select="handleSelectClient('product', $event)" - ></el-autocomplete> + </SimpleSearchInput> + </template> </div> </el-form-item> <!-- 浜у搧绫诲埆 --> @@ -540,7 +509,6 @@ page: 1, pageSize: 100 }).then((res) => { - // console.log(res.data) if (res.code === 200) { if (res.data && res.data.length > 0) { this.productNameOptions = res.data @@ -549,7 +517,7 @@ }) }, async handleSelectClient(value, item) { - this.$emit("selProductClick",value,item) + this.$emit("selProductClick", value, item) if (value === "product") { if (item.categoryId === 0 || item.categoryName === "") { this.productTypeNameOptions = [] @@ -584,7 +552,6 @@ if (results.length === 0) { this.productTypeNameOptions = [] } - console.log(results, "results", value) this.$emit("querySearchData", queryString, results, value) }, createStateFilter(queryString) { @@ -603,7 +570,6 @@ locationId: 0, productId: "" }).then((res) => { - console.log(res) if (res.code === 200) { const list = res.data ? res.data : [] this.selLocationOptions = list.locationList @@ -636,12 +602,10 @@ page: 1, pageSize: 100 }).then((res) => { - console.log(res, "newlocal") if (res.code === 200) { const list = res.data ? res.data : [] this.selLocationOptions = list this.selSonLocationOptions = list - console.log(list, "999") if (this.isReorder) { this.locacionName = list[0]?.name this.locacionId = list[0]?.id @@ -658,12 +622,10 @@ page: 1, pageSize: 100 }).then((res) => { - console.log(res, "newlocal") if (res.code === 200) { const list = res.data ? res.data : [] this.selToLocationOptions = list this.selSonLocationOptions = list - console.log(list, "999") if (this.isReorder) { this.locacionName = list[0]?.name this.locacionId = list[0]?.id @@ -680,7 +642,6 @@ page: 1, pageSize: 100 }).then((res) => { - console.log(res, "newlocal") if (res.code === 200) { const list = res.data ? res.data : [] this.selSonLocationOptions = list @@ -695,7 +656,6 @@ // 鑾峰彇鍏徃鍒楄〃 async getCompanyList() { await getCompanyList().then((res) => { - console.log(res) if (res.code === 200) { this.companyOptions = res.data } @@ -704,7 +664,6 @@ selProductNameClick(item) { this.productIndex = this.tableList.tableData.length - 1 this.tableList.tableData.map((ite, index) => { - console.log(ite) if (index === this.productIndex) { ite.productId = item.id ite.productName = item.name @@ -716,20 +675,21 @@ // 閫夋嫨浜у搧 selProductClick(item) { if (this.isReorder) { - this.productId = item.value - this.productName = item.label + this.productId = item.id + this.productName = item.name this.getAmountAndPrediction(item, "product") } else { - this.tableList.tableData.map((ite) => { - if (ite.productName.label === item.label) { - ite.productId = item.value - ite.productName = item.label + this.tableList.tableData.map((ite, index) => { + if (index === 0) { + ite.productId = item.id + ite.productName = item.name ite.categoryId = item.categoryId ite.productCategory = item.categoryName ite.amount = item.amount ite.unit = item.unit } }) + this.$emit("selProductClick", "product", this.tableList.tableData[0]) } if (this.isinventory) { @@ -806,7 +766,6 @@ locationId: item.value, productId: "" }).then((res) => { - console.log(res) if (res.code === 200) { const list = res.data ? res.data : [] this.productNameOptions = list.productList @@ -822,28 +781,28 @@ // 鑾峰彇鍦ㄥ簱涓庨娴嬫暟閲� getAmountAndPrediction(item, val, ite) { console.log(item, val, ite) - console.log(this.productName) - console.log(this.tableList.tableData) if (this.productName.length > 0) { getAmountAndPrediction({ locationId: val === "product" ? this.locacionId : ite.value, productId: val === "product" ? item.value : this.productId }).then((res) => { if (res.code === 200) { - this.tableList.tableData.map((ite) => { - if (ite.productName.label === this.productName) { + this.tableList.tableData.map((ite, index) => { + if (index == 0) { ite.amount = res.data.amount ite.prediction = res.data.prediction + ite.productId = item.id + ite.productName = item.name ite.unit = item.unit } }) + this.$emit("selProductClick", this.tableList.tableData[0]) } }) } }, // 閫夋嫨璺嚎 selRouteClick(item, prop) { - console.log("33333333333333") this.$emit("selRouteClick", item, prop) }, // 閫夋嫨鍗曚綅/鐢ㄦ埛 @@ -891,7 +850,6 @@ }, commonInputChange(val, prop, row) { console.log(val, prop) - console.log(row) this.$emit("inputContent", val, prop, row) }, // 娓呯┖ @@ -902,7 +860,6 @@ clearupClient(row, scope) { this.productIndex = scope.$index this.tableList.tableData.map((ite, index) => { - console.log(scope.$index) if (scope.$index && scope.$index >= 0) { if (index === this.productIndex) { ite.name = "" diff --git a/src/components/makepager/SimpleSearchInput.vue b/src/components/makepager/SimpleSearchInput.vue index ddd2114..76a5dee 100644 --- a/src/components/makepager/SimpleSearchInput.vue +++ b/src/components/makepager/SimpleSearchInput.vue @@ -44,20 +44,20 @@ <ul class="infinite-list" @scroll="loadList"> <div class="background_color_eee"> <el-row :gutter="0"> - <el-col :span="8"> + <el-col :span="13"> <div class="grid-content bg-purple"> <span class="name">浜у搧鍚嶇О</span> </div> </el-col> <el-col :span="8"> - <div class="grid-content bg-purple">鍐呴儴缂栫爜</div> + <div class="grid-content bg-purple">浜у搧缂栫爜</div> </el-col> - <el-col :span="5"> + <!-- <el-col :span="5"> <div class="grid-content bg-purple">鍦ㄥ簱鏁伴噺</div> - </el-col> + </el-col> --> <el-col :span="3"> - <div class="grid-content bg-purple">璁¢噺鍗曚綅</div> + <div class="grid-content bg-purple">鍗曚綅</div> </el-col> </el-row> </div> @@ -70,22 +70,22 @@ :class="selectValue == user.id ? 'highlight-color' : ''" > <el-row :gutter="0"> - <el-col :span="8"> + <el-col :span="13"> <div class="grid-content bg-purple" :title="user[obj.name]"> {{ user[obj.name] || "--" }} </div> </el-col> - <el-col :span="6"> - <div class="grid-content bg-purple" :title="user.internalReference"> - <span class="name">{{ user.internalReference || "--" }}</span> + <el-col :span="8"> + <div class="grid-content bg-purple" :title="user.id"> + <span class="name">{{ user.id || "--" }}</span> </div> </el-col> - <el-col :span="6"> + <!-- <el-col :span="6"> <div class="grid-content bg-purple" :title="user.amount"> {{ user.amount || "--" }} </div> - </el-col> - <el-col :span="4"> + </el-col> --> + <el-col :span="3"> <div class="grid-content bg-purple" :title="user.unit"> {{ user.unit || "--" }} </div> @@ -371,9 +371,9 @@ <style lang="scss"> .user-simple-search-input-popper { - max-width: 630px; + max-width: 500px; .el-select-dropdown__wrap { - min-width: 509px; + min-width: 409px; width: 100%; min-height: 370px; diff --git a/src/views/operate/inventoryAdjustment/index.vue b/src/views/operate/inventoryAdjustment/index.vue index e97a63b..26528c4 100644 --- a/src/views/operate/inventoryAdjustment/index.vue +++ b/src/views/operate/inventoryAdjustment/index.vue @@ -315,9 +315,8 @@ this.locationId = item.value }, // 閫変腑浜у搧鏂规硶 - selProductClick(item) { - console.log(item) - this.productId = item.value + selProductClick(value, item) { + this.productId = item.productId }, // 鑾峰彇褰撳墠鏃堕棿 currentTime() { diff --git a/src/views/operate/orderPoint/index.vue b/src/views/operate/orderPoint/index.vue index 676f4a1..d9167c5 100644 --- a/src/views/operate/orderPoint/index.vue +++ b/src/views/operate/orderPoint/index.vue @@ -215,7 +215,7 @@ }, // 鏂板 addProductClick() { - console.log(this.addTitle) + console.log(this.addTitle, "qqqqqqqqqqqq") this.isSel() if (this.isNoProduct && this.addTitle === "鏂板缓") { this.$refs.tablelistRef.getProductList() @@ -356,8 +356,10 @@ }, // 閫変腑浜у搧鏂规硶 selProductClick(item) { - this.productId = item.value + this.productId = item.productId this.unit = item.unit + this.amount = item.amount + this.prediction = item.prediction }, // 閫変腑璺嚎鏂规硶 selRouteClick(item, prop) { @@ -383,7 +385,6 @@ }, ...res.data ] - console.log(res, "res666") }) }, // 鍒犻櫎type diff --git a/src/views/productManage/reorderRules/index.vue b/src/views/productManage/reorderRules/index.vue index 9a66f15..fad6b56 100644 --- a/src/views/productManage/reorderRules/index.vue +++ b/src/views/productManage/reorderRules/index.vue @@ -81,7 +81,7 @@ reorderId: 0, queryProductId: null, searchTaskMap: [], - currentRowId:-1 + currentRowId: -1 } }, created() { @@ -103,7 +103,7 @@ selectBox: false, selectIndex: true, tableColumn: [ - { label: "浜у搧", prop: "productName", product: true,width:"150px" }, + { label: "浜у搧", prop: "productName", product: true, width: "150px" }, { label: "浣嶇疆", prop: "locationName", defaultLocation: true }, { label: "鍦ㄥ簱鏁伴噺", prop: "amount" }, { label: "棰勬祴鏁伴噺", prop: "prediction" }, @@ -135,7 +135,7 @@ } return { ...item, - productName:item.product.name, + productName: item.product.name, locationName: item.location.name, isSet: false, isEdit: true, @@ -215,17 +215,18 @@ this.showDiscard = false let requestUrl = this.currentRowId === 0 ? addReorderRule : updateReorderRule let params = this.saveParams() - requestUrl(params).then((res) => { - if (res.code === 200) { - let tipStr = this.currentRowId === 0 ? "娣诲姞鎴愬姛" : "淇敼鎴愬姛" - this.$message.success(tipStr) + requestUrl(params) + .then((res) => { + if (res.code === 200) { + let tipStr = this.currentRowId === 0 ? "娣诲姞鎴愬姛" : "淇敼鎴愬姛" + this.$message.success(tipStr) + this.getData() + } + }) + .catch((err) => { this.getData() - } - }) - .catch((err) => { - this.getData() - console.log(err) - }) + console.log(err) + }) } }, saveParams() { @@ -281,7 +282,7 @@ if (!this.isNoProduct && this.currentRowId === 0) { this.$message.error("璇峰畬鎴愬綋鍓嶆柊寤烘垨鍙栨秷鏂板缓") } else { - this.currentRowId = row.id||0 + this.currentRowId = row.id || 0 this.addTitle = "淇濆瓨" this.showDiscard = true this.isRowClick = true @@ -318,11 +319,11 @@ this.locationId = item?.value ?? item?.id }, // 閫変腑浜у搧鏂规硶 - selProductClick(value,item){ - if(value==="product"){ - this.productId=item.id - this.unit=item.unit - } + selProductClick(item) { + this.productId = item.productId + this.unit = item.unit + this.amount = item.amount + this.prediction = item.prediction }, // 閫変腑璺嚎鏂规硶 selRouteClick(item, prop) { diff --git a/src/views/warehouseManage/listingRules/index.vue b/src/views/warehouseManage/listingRules/index.vue index bd4fda5..3e5914f 100644 --- a/src/views/warehouseManage/listingRules/index.vue +++ b/src/views/warehouseManage/listingRules/index.vue @@ -368,10 +368,11 @@ }, // 閫変腑浜у搧鏂规硶 selProductClick(value, item) { + console.log(value, item) if (value === "product") { this.RuleType = 1 this.tableList.tableColumn[2].productType = false - this.productId = item.id + this.productId = item.productId this.productCategoryId = item.categoryId } else if (value === "productType") { this.productCategoryId = item.id -- Gitblit v1.8.0