yangfeng
2023-11-15 968f9503d8bf7311253f6b81315d034c453f0c28
上架规则产品到达位置修改
2个文件已修改
238 ■■■■■ 已修改文件
src/components/makepager/CommonFormTableView.vue 155 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/warehouseManage/listingRules/index.vue 83 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/makepager/CommonFormTableView.vue
@@ -163,14 +163,47 @@
                      v-for="(item, index) in selLocationOptions"
                      :key="index"
                      :label="item.jointName"
                      :value="{ value: item.id, 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.toLocation" 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"
                    filterable
                    style="width: 80%"
                    @change="
                      (val) => {
                        selLocationClick(val, item.prop)
                      }
                    "
                  >
                    <el-option
                      v-for="(item, index) in selToLocationOptions"
                      :key="index"
                      :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">
              <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]
@@ -191,7 +224,7 @@
                      v-for="(item, index) in selSonLocationOptions"
                      :key="index"
                      :label="item.jointName"
                      :value="{ value: item.id, label: item.jointName}"
                      :value="{ value: item.id, label: item.jointName }"
                    >
                    </el-option>
                  </el-select>
@@ -233,7 +266,7 @@
              <!-- 产品 -->
              <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>
                  <span v-if="scope.row.isEdit || scope.row.editable">{{ scope.row.productName }}</span>
                  <!-- <el-select
                    v-else
                    v-model="scope.row[item.prop]"
@@ -285,8 +318,8 @@
                :prop="'tableData.' + scope.$index + '.' + item.prop"
              >
                <div class="custom-name">
                  <span v-if="scope.row.isEdit || scope.row.editable">{{scope.row.productCategory }}</span>
                  <span v-if="scope.row.isEdit || scope.row.editable">{{ scope.row.productCategory }}</span>
                  <!-- <el-select
                    v-else
                    v-model="scope.row[item.prop]"
@@ -430,7 +463,7 @@
          tableData: [], // 接口返回数据
          tableColumn: [
            // table表单
            { label: "", prop: "", min: 200, tooltip: true}
            { label: "", prop: "", min: 200, tooltip: true }
          ]
        }
      }
@@ -467,14 +500,15 @@
        { id: 2, name: "打" }
      ],
      selLocationOptions: [], // 位置
      selSonLocationOptions:[], //子位置
      selSonLocationOptions: [], //子位置
      selToLocationOptions: [], // 产品到达位置
      companyOptions: [], // 公司
      selRouteOptions: [{ id: 1, name: "制造" }], // 路线
      locacionName: "",
      locacionId: 0,
      productName: "",
      productId: "",
      initialPosition:""
      initialPosition: ""
    }
  },
  created() {
@@ -488,7 +522,7 @@
      this.getProductCategoryList()
    }
    if (this.islistingrules) {
      this.getLocationList()
      this.getToLocationList()
      // this.getCompanyList()
    }
    this.tableList = this.productTableList
@@ -516,10 +550,10 @@
    },
    async handleSelectClient(value, item) {
      if (value === "product") {
        if(item.categoryId===0||item.categoryName===""){
          this.productTypeNameOptions =[]
          this.tableList.tableData[this.tableList.rowClickIndex].productCategory=''
        }else{
        if (item.categoryId === 0 || item.categoryName === "") {
          this.productTypeNameOptions = []
          this.tableList.tableData[this.tableList.rowClickIndex].productCategory = ""
        } else {
          await getProductCategoryList({
            categoryId: item.categoryId,
            keyWord: item.categoryName,
@@ -529,38 +563,38 @@
            if (res.code === 200) {
              const list = res.data ? res.data : []
              this.productTypeNameOptions = list
              this.tableList.tableData[this.tableList.rowClickIndex].productCategory=list[0].name
              this.tableList.tableData[this.tableList.rowClickIndex].productCategory = list[0].name
            }
          })
        }
      }else if(value==="productType"){
      } else if (value === "productType") {
        console.log("产品类型选中")
      }
      this.$emit("selProductClick",value,item)
      this.$emit("selProductClick", value, item)
    },
    querySearchAsync(queryString, cb, value) {
      let restaurants=''
      if(value==="product"){
         restaurants = this.productNameOptions
      }else if(value==="productType"){
         restaurants = this.productTypeNameOptions
      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=[]
      if (results.length === 0) {
        this.productTypeNameOptions = []
      }
      console.log(results,"results",value)
      this.$emit("querySearchData",queryString,results,value)
      console.log(results, "results", value)
      this.$emit("querySearchData", queryString, results, value)
    },
    createStateFilter(queryString) {
      return (state) => {
          return state.name.toLowerCase().indexOf(queryString.toLowerCase()) === 0
        return state.name.toLowerCase().indexOf(queryString.toLowerCase()) === 0
      }
    },
    // 清除选中产品
    setValueNull(val) {
      console.log(val,"看看val")
      console.log(val, "看看val")
    },
    // 库存调整获取位置和产品
@@ -573,7 +607,7 @@
        if (res.code === 200) {
          const list = res.data ? res.data : []
          this.selLocationOptions = list.locationList
          this.selSonLocationOptions=list.locationList
          this.selSonLocationOptions = list.locationList
          this.productNameOptions = list.productList
        }
      })
@@ -602,12 +636,34 @@
        page: 1,
        pageSize: 100
      }).then((res) => {
        console.log(res,"newlocal")
        console.log(res, "newlocal")
        if (res.code === 200) {
          const list = res.data ? res.data : []
          this.selLocationOptions = list
          this.selSonLocationOptions=list
            console.log(list,"999")
          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 getToLocationList() {
      await getLocationList({
        // keyword: "",
        type: 3,
        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
@@ -617,17 +673,17 @@
      })
    },
    // 设置子位置
    async setLocationList(jointName){
    async setLocationList(jointName) {
      await getLocationList({
        // keyword: "",
        jointName: jointName,
        page: 1,
        pageSize: 100
      }).then((res) => {
        console.log(res,"newlocal")
        console.log(res, "newlocal")
        if (res.code === 200) {
          const list = res.data ? res.data : []
          this.selSonLocationOptions=list
          this.selSonLocationOptions = list
          // if (this.isReorder) {
          //   this.locacionName = list[0]?.name
          //   this.locacionId = list[0]?.id
@@ -685,7 +741,7 @@
          if (res.code === 200) {
            const list = res.data ? res.data : []
            this.selLocationOptions = list.locationList
            this.selSonLocationOptions=list.locationList
            this.selSonLocationOptions = list.locationList
          }
        })
      }
@@ -706,10 +762,10 @@
      // this.$emit("selProductTypeClick", item)
    },
    // 产品类型获取焦点
    productTypeFocus(){
    productTypeFocus() {
      getProductCategoryList({
        categoryId: 0,
        keyWord:"",
        keyWord: "",
        page: 1,
        pageSize: 15
      }).then((res) => {
@@ -721,8 +777,8 @@
    },
    // 选择位置
    selLocationClick(item, prop, row) {
      console.log(item,prop,row,"起始位置")
      if(prop==="areaName"){
      console.log(item, prop, row, "起始位置")
      if (prop === "areaName") {
        // this.initialPosition=item.label
        getLocationList({
          jointName: item.label,
@@ -731,7 +787,7 @@
        }).then((res) => {
          if (res.code === 200) {
            const list = res.data ? res.data : []
            this.selSonLocationOptions=list
            this.selSonLocationOptions = list
            if (this.isReorder) {
              this.locacionName = list[0]?.name
              this.locacionId = list[0]?.id
@@ -760,8 +816,8 @@
      this.$emit("selLocationClick", item, prop)
    },
    // 选择子位置
    selSonLocationClick(item){
      this.$emit("selSonLocationClick",item)
    selSonLocationClick(item) {
      this.$emit("selSonLocationClick", item)
    },
    // 获取在库与预测数量
    getAmountAndPrediction(item, val, ite) {
@@ -913,16 +969,15 @@
        font-size: 13px;
        cursor: pointer;
      }
    }
  }
}
::v-deep {
  .el-autocomplete{
      height:28px;
    .el-input{
      height:28px ;
      .el-input__inner{
  .el-autocomplete {
    height: 28px;
    .el-input {
      height: 28px;
      .el-input__inner {
        height: 28px;
      }
    }
@@ -964,7 +1019,7 @@
  height: 35px;
  text-align: center;
}
::v-deep .el-table__body-wrapper{
::v-deep .el-table__body-wrapper {
  height: unset !important;
}
</style>
src/views/warehouseManage/listingRules/index.vue
@@ -27,7 +27,7 @@
          @querySearchData="querySearchData"
          @selProductClick="selProductClick"
        >
        <!--
          <!--
          @selProductTypeClick="selProductTypeClick"
         -->
          <template slot="tableButton">
@@ -82,8 +82,8 @@
      queryProductId: null,
      categoryId: null,
      searchTaskMap: [],
      isCreate:false,
      thatRow:{},
      isCreate: false,
      thatRow: {}
    }
  },
  created() {
@@ -111,13 +111,13 @@
        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
      }
    },
    // 请求数据
@@ -157,7 +157,7 @@
    },
    // 新增
    addProductClick() {
      this.isCreate=true
      this.isCreate = true
      this.tableList.tableColumn[1].product = true
      this.tableList.tableColumn[2].productType = true
      console.log(this.tableData)
@@ -177,7 +177,7 @@
          subLocation: "",
          productName: "",
          companyName: "",
          productCategory:"",
          productCategory: "",
          isSet: true,
          isEdit: false,
          isOrder: true
@@ -213,14 +213,14 @@
            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
            }
          })
        }
@@ -240,7 +240,7 @@
    // 取消
    discardBtnClick() {
      this.getData()
      this.isCreate=false
      this.isCreate = false
      this.tableList.tableColumn[1].product = true
      this.tableList.tableColumn[2].productType = true
      this.addTitle = "新建"
@@ -279,21 +279,20 @@
    },
    // 行点击
    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
@@ -308,25 +307,25 @@
        }
      }
    },
    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
            }
          }
        }
@@ -368,14 +367,14 @@
      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
      }
@@ -399,19 +398,17 @@
  },
  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 {