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/components/makepager/CommonFormTableView.vue | 89 +++++++++++--------------------------------- 1 files changed, 23 insertions(+), 66 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 = "" -- Gitblit v1.8.0