charles
2024-08-06 5ecb7958c96d3f0b6d47b79aff7eb306c2cf690f
src/views/warehouseManage/position/AddDialog.vue
@@ -19,7 +19,14 @@
            <span>动作</span>
            <!-- <el-button plain size="mini" style="margin-left: 15px" @click="deleteClick">删除</el-button> -->
          </span>
          <el-button v-if="showEdit" plain size="mini" style="margin-left: 15px" @click="editClick">编辑</el-button>
          <el-button
            v-if="showEdit && editConfig.infomation.type == 3"
            plain
            size="mini"
            style="margin-left: 15px"
            @click="editClick"
            >编辑</el-button
          >
        </div>
      </div>
      <!-- 内容 -->
@@ -32,11 +39,27 @@
        size="mini"
      >
        <div class="content-number-bg">
          <FormBtnsView :showPosition="true" :showWarehouse="false" @productClick="productClick" />
          <FormBtnsView :showPosition="true" :showPositionCursor="this.editConfig.title != '新建'?true:false" @positionReport="positionReport" :showWarehouse="false" @productClick="productClick" />
        </div>
        <div class="basic-info">
          <div class="basic-info-view">
            <el-row>
              <el-col :span="12" class="line_height_30px">
                <el-form-item
                        label="仓库"
                        prop="warehouseId">
                  <el-select
                          @change="selWarehouse"
                          v-model="editConfig.infomation.warehouseId"
                          placeholder="请选择"
                          size="mini"
                          style="width:90%"
                          :disabled="!showFooter"
                  >
                    <el-option v-for="warehouse in warehouseList" :key="warehouse.id" :label="warehouse.name" :value="warehouse.id"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12" class="line_height_30px">
                <el-form-item label="位置名称" prop="name">
                  <el-input
@@ -53,10 +76,10 @@
                    v-model="editConfig.infomation.parentId"
                    placeholder="请选择"
                    size="mini"
                    :disabled="editCommonConfig.title=='编辑'"
                    :disabled="editCommonConfig.title != '新建'"
                    style="width: 90%"
                  >
                    <el-option v-for="item in positionList" :key="item.id" :label="item.name" :value="item.id">
                    <el-option v-for="item in positionList" :key="item.id" :label="item.jointName" :value="item.id">
                    </el-option>
                  </el-select>
                </el-form-item>
@@ -68,7 +91,7 @@
                  <el-select
                    v-model="editConfig.infomation.type"
                    filterable
                    :disabled="editCommonConfig.title=='编辑'"
                    :disabled="editCommonConfig.title != '新建'"
                    placeholder="请选择"
                    style="width: 90%"
                    no-data-text="暂无数据"
@@ -177,6 +200,8 @@
<script>
import { addLocation, updateLocation, deleteLocation } from "@/api/warehouseManage/warehouse"
import { getDataByType } from "@/api/data"
import {getWarehouseList} from '@/api/warehouseManage/warehouse.js'
import {getLocationList} from "@/api/overview/overview";
export default {
  name: "AddScrapDialog",
  props: {
@@ -190,19 +215,23 @@
        }
      }
    },
    positionList: {
   /* positionList: {
      type: [Array]
    }
    }*/
  },
  components: {},
  computed: {},
  data() {
    return {
        positionList:[],
      warehouseList:[],
      dialogWidth: "50%",
      editConfig: this.editCommonConfig,
      rules: {
         warehouseId:[{ required: true, message: "请输选择仓库", trigger: "change" }],
        name: [{ required: true, message: "请输入", trigger: "change" }],
        parentId: [{ required: true, message: "请选择上级位置", trigger: "change" }],
        // parentId: [{ required: true, message: "请选择位置类型", trigger: "change" }],
        type: [{ required: true, message: "请选择上级位置", trigger: "change" }],
        countFrequency: [
          {
            required: false,
@@ -222,8 +251,32 @@
  },
  created() {
    this.setBottonView()
    this.queryWareHouse();
    this.queryLocationList();
  },
  methods: {
      async queryWareHouse(){
          const {code,data}=await getWarehouseList({page:0,pageSize:0,keyword: ""});
          if(code===200){
              this.warehouseList=data;
          }
      },
      queryLocationList(val){
          getLocationList({
              warehouseId:val,
              type:3,
              keyWord: "",
              page: 0,
              pageSize: 0,
          }).then((res) => {
              if (res.code == 200) {
                  this.positionList=res.data;
              }
          });
      },
      selWarehouse(val){
          this.queryLocationList(val);
      },
    validatorNum(rule, value, callback) {
      if (value) {
        if (value == undefined || value == null) {
@@ -240,11 +293,22 @@
        callback()
      }
    },
    // 当前库存
    positionReport(){
      if(this.editConfig.title != '新建'){
        this.$router.push({
          name: "locationReport",
          params: {
            locationId: this.editConfig.infomation.id
          }
        })
      }
    },
    // 路线
    productClick() {},
    // 设置删除/打印/编辑是否显示
    setBottonView() {
      if (this.editConfig.title === "新建") {
      if (this.editConfig.title === "新建" || this.editConfig.title === "编辑") {
        this.showEdit = false
        this.showFooter = true
      } else if (this.editConfig.infomation.status === "完成") {
@@ -279,7 +343,6 @@
    },
    saveParams() {
      let data = JSON.parse(JSON.stringify(this.editConfig.infomation))
      let params = {
        name: data.name,
        parentId: data.parentId,
@@ -290,11 +353,12 @@
        countFrequency: data.countFrequency ? Number(data.countFrequency) : 0,
        recentlyCount: data.recentlyCount,
        nextCount: data.nextCount,
        notes: data.notes
      }
        notes: data.notes,
        warehouseId:data.warehouseId
      };
      if (data.id) {
        params.id = data.id;
        params.jointName=data.jointName;
        params.id = data.id
        params.jointName = data.jointName
      }
      return params
    },