zuozhengqing
2023-11-15 e1a3c04432d808ca27e1158095d2564cd81ea379
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
@@ -517,10 +551,10 @@
    async handleSelectClient(value, item) {
      this.$emit("selProductClick",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,
@@ -530,37 +564,37 @@
            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("产品类型选中")
      }
    },
    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>