| | |
| | | v-model="scope.row[item.prop]" |
| | | placeholder="请选择" |
| | | size="mini" |
| | | filterable |
| | | style="width: 80%" |
| | | @change=" |
| | | (val) => { |
| | |
| | | <el-option |
| | | v-for="(item, index) in selLocationOptions" |
| | | :key="index" |
| | | :label="item.name" |
| | | :value="{ value: item.id, label: item.name }" |
| | | :label="item.jointName" |
| | | :value="{ value: item.id, label: item.jointName}" |
| | | > |
| | | </el-option> |
| | | </el-select> |
| | | </div> |
| | | </el-form-item> |
| | | <!-- 子位置 --> |
| | | <el-form-item v-else-if="item.sonLocation" label=" " :prop="'tableData.' + scope.$index + '.' + item.prop"> |
| | | <div class="custom-name"> |
| | | <span v-if="scope.row.isEdit || scope.row.editable">{{ |
| | | scope.row[item.prop]?.label ?? scope.row[item.prop] |
| | | }}</span> |
| | | <el-select |
| | | v-else |
| | | v-model="scope.row[item.prop]" |
| | | placeholder="请选择" |
| | | size="mini" |
| | | style="width: 80%" |
| | | @change=" |
| | | (val) => { |
| | | selSonLocationClick(val, item.prop) |
| | | } |
| | | " |
| | | > |
| | | <el-option |
| | | v-for="(item, index) in selSonLocationOptions" |
| | | :key="index" |
| | | :label="item.jointName" |
| | | :value="{ value: item.id, label: item.jointName}" |
| | | > |
| | | </el-option> |
| | | </el-select> |
| | |
| | | v-model="locacionName" |
| | | placeholder="请选择" |
| | | size="mini" |
| | | filterable |
| | | style="width: 80%" |
| | | @change=" |
| | | (val) => { |
| | |
| | | <!-- 产品 --> |
| | | <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[item.prop] }}</span> |
| | | <el-select |
| | | <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> |
| | | </el-select> |
| | | </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> |
| | | </div> |
| | | </el-form-item> |
| | | <!-- 产品类型 --> |
| | | <!-- 产品类别 --> |
| | | <el-form-item |
| | | v-else-if="item.productType" |
| | | label=" " |
| | | :prop="'tableData.' + scope.$index + '.' + item.prop" |
| | | > |
| | | <div class="custom-name"> |
| | | <span v-if="scope.row.isEdit || scope.row.editable">{{ scope.row[item.prop] }}</span> |
| | | <el-select |
| | | <span v-if="scope.row.isEdit || scope.row.editable">{{scope.row.productCategory }}</span> |
| | | |
| | | <!-- <el-select |
| | | v-else |
| | | v-model="scope.row[item.prop]" |
| | | placeholder="请选择" |
| | |
| | | }" |
| | | > |
| | | </el-option> |
| | | </el-select> |
| | | </el-select> --> |
| | | <el-autocomplete |
| | | v-else |
| | | style="width: 100%" |
| | | v-model="scope.row.productCategory" |
| | | @focus="productTypeFocus" |
| | | :fetch-suggestions=" |
| | | (queryString, callback) => { |
| | | querySearchAsync(queryString, callback, 'productType') |
| | | } |
| | | " |
| | | value-key="name" |
| | | @select="handleSelectClient('productType', $event)" |
| | | ></el-autocomplete> |
| | | </div> |
| | | </el-form-item> |
| | | <!-- 用户 --> |
| | |
| | | { id: 2, name: "打" } |
| | | ], |
| | | selLocationOptions: [], // 位置 |
| | | selSonLocationOptions:[], //子位置 |
| | | companyOptions: [], // 公司 |
| | | selRouteOptions: [{ id: 1, name: "制造" }], // 路线 |
| | | locacionName: "", |
| | | locacionId: 0, |
| | | productName: "", |
| | | productId: "" |
| | | productId: "", |
| | | initialPosition:"" |
| | | } |
| | | }, |
| | | created() { |
| | |
| | | } |
| | | }) |
| | | }, |
| | | async handleSelectClient(value, item) { |
| | | if (value === "product") { |
| | | if(item.categoryId===0||item.categoryName===""){ |
| | | this.productTypeNameOptions =[] |
| | | this.tableList.tableData[this.tableList.rowClickIndex].productCategory='' |
| | | }else{ |
| | | await getProductCategoryList({ |
| | | categoryId: item.categoryId, |
| | | keyWord: item.categoryName, |
| | | page: 1, |
| | | pageSize: 15 |
| | | }).then((res) => { |
| | | if (res.code === 200) { |
| | | const list = res.data ? res.data : [] |
| | | this.productTypeNameOptions = list |
| | | this.tableList.tableData[this.tableList.rowClickIndex].productCategory=list[0].name |
| | | } |
| | | }) |
| | | } |
| | | }else if(value==="productType"){ |
| | | console.log("产品类型选中") |
| | | } |
| | | this.$emit("selProductClick",value,item) |
| | | }, |
| | | querySearchAsync(queryString, cb, value) { |
| | | let restaurants='' |
| | | if(value==="product"){ |
| | | restaurants = this.productNameOptions |
| | | }else if(value==="productType"){ |
| | | restaurants = this.productTypeNameOptions |
| | | } |
| | | var results = queryString ? restaurants.filter(this.createStateFilter(queryString, value)) : restaurants |
| | | cb(results) |
| | | if(results.length===0){ |
| | | this.productTypeNameOptions=[] |
| | | } |
| | | console.log(results,"results",value) |
| | | this.$emit("querySearchData",queryString,results,value) |
| | | }, |
| | | createStateFilter(queryString) { |
| | | return (state) => { |
| | | return state.name.toLowerCase().indexOf(queryString.toLowerCase()) === 0 |
| | | } |
| | | }, |
| | | // 清除选中产品 |
| | | setValueNull(val) { |
| | | console.log(val,"看看val") |
| | | }, |
| | | |
| | | // 库存调整获取位置和产品 |
| | | async getRuleList() { |
| | | await getRuleList({ |
| | |
| | | if (res.code === 200) { |
| | | const list = res.data ? res.data : [] |
| | | this.selLocationOptions = list.locationList |
| | | this.selSonLocationOptions=list.locationList |
| | | this.productNameOptions = list.productList |
| | | } |
| | | }) |
| | |
| | | // 位置 |
| | | async getLocationList() { |
| | | await getLocationList({ |
| | | keyword: "", |
| | | // keyword: "", |
| | | jointName: this.initialPosition ? this.initialPosition : null, |
| | | productId: this.queryProductId ? this.queryProductId : null, |
| | | productCategoryId: this.categoryId ? this.categoryId : null, |
| | | 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 |
| | | this.$emit("selLocationClick", list[0], "locacionName") |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | // 设置子位置 |
| | | async setLocationList(jointName){ |
| | | await getLocationList({ |
| | | // keyword: "", |
| | | jointName: jointName, |
| | | page: 1, |
| | | pageSize: 100 |
| | | }).then((res) => { |
| | | console.log(res,"newlocal") |
| | | if (res.code === 200) { |
| | | const list = res.data ? res.data : [] |
| | | this.selSonLocationOptions=list |
| | | // if (this.isReorder) { |
| | | // this.locacionName = list[0]?.name |
| | | // this.locacionId = list[0]?.id |
| | | // this.$emit("selLocationClick", list[0], "locacionName") |
| | | // } |
| | | } |
| | | }) |
| | | }, |
| | |
| | | }) |
| | | }, |
| | | selProductNameClick(item) { |
| | | console.log(item) |
| | | this.tableList.tableData.map((ite) => { |
| | | this.productIndex = this.tableList.tableData.length - 1 |
| | | this.tableList.tableData.map((ite, index) => { |
| | | console.log(ite) |
| | | // if (ite.productName === item.name) { |
| | | ite.productId = item.id |
| | | ite.productName = item.name |
| | | ite.amount = item.amount |
| | | ite.unit = item.unit |
| | | // } |
| | | if (index === this.productIndex) { |
| | | ite.productId = item.id |
| | | ite.productName = item.name |
| | | ite.amount = item.amount |
| | | ite.unit = item.unit |
| | | } |
| | | }) |
| | | console.log(this.tableList.tableData) |
| | | }, |
| | | // 选择产品 |
| | | selProductClick(item) { |
| | |
| | | if (res.code === 200) { |
| | | const list = res.data ? res.data : [] |
| | | this.selLocationOptions = list.locationList |
| | | this.selSonLocationOptions=list.locationList |
| | | } |
| | | }) |
| | | } |
| | | console.log(this.tableList.tableData) |
| | | this.$emit("selProductClick", item) |
| | | // this.$emit("selProductClick", item) |
| | | }, |
| | | // 选择产品类型 |
| | | selProductTypeClick(item) { |
| | |
| | | if (this.isinventory) { |
| | | this.getProductCategoryList() |
| | | } |
| | | this.$emit("selProductTypeClick", item) |
| | | // this.$emit("selProductTypeClick", item) |
| | | }, |
| | | // 产品类型获取焦点 |
| | | productTypeFocus(){ |
| | | getProductCategoryList({ |
| | | categoryId: 0, |
| | | keyWord:"", |
| | | page: 1, |
| | | pageSize: 15 |
| | | }).then((res) => { |
| | | if (res.code === 200) { |
| | | const list = res.data ? res.data : [] |
| | | this.productTypeNameOptions = list |
| | | } |
| | | }) |
| | | }, |
| | | // 选择位置 |
| | | selLocationClick(item, prop, row) { |
| | | console.log(item,prop,row,"起始位置") |
| | | if(prop==="areaName"){ |
| | | // this.initialPosition=item.label |
| | | getLocationList({ |
| | | jointName: item.label, |
| | | page: 1, |
| | | pageSize: 100 |
| | | }).then((res) => { |
| | | if (res.code === 200) { |
| | | const list = res.data ? res.data : [] |
| | | this.selSonLocationOptions=list |
| | | if (this.isReorder) { |
| | | this.locacionName = list[0]?.name |
| | | this.locacionId = list[0]?.id |
| | | this.$emit("selLocationClick", list[0], "locacionName") |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | if (this.isReorder) { |
| | | if (this.productId !== 0) { |
| | | this.getAmountAndPrediction(row, "location", item) |
| | |
| | | }) |
| | | } |
| | | this.$emit("selLocationClick", item, prop) |
| | | }, |
| | | // 选择子位置 |
| | | selSonLocationClick(item){ |
| | | this.$emit("selSonLocationClick",item) |
| | | }, |
| | | // 获取在库与预测数量 |
| | | getAmountAndPrediction(item, val, ite) { |
| | |
| | | font-size: 13px; |
| | | cursor: pointer; |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | ::v-deep { |
| | | .el-autocomplete{ |
| | | height:28px; |
| | | .el-input{ |
| | | height:28px ; |
| | | .el-input__inner{ |
| | | height: 28px; |
| | | } |
| | | } |
| | | } |
| | | .el-form-item__label { |
| | | display: none; |
| | | } |
| | |
| | | height: 35px; |
| | | text-align: center; |
| | | } |
| | | ::v-deep .el-table__body-wrapper{ |
| | | height: unset !important; |
| | | } |
| | | </style> |