产品添加编辑增加产品编码产品规格产品型号采购类型联调添加编辑产品接口获取编码列表获取自动编码规则接口
2个文件已添加
2个文件已修改
192 ■■■■■ 已修改文件
src/api/common/standard.js 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/data.js 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/makepager/FormBtnsView.vue 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/mixin/codeMixin.js 131 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/common/standard.js
New file
@@ -0,0 +1,20 @@
import request from "@/common/untils/request"
export function getCodeStandardList(data) {
  // return  axios.get(`/api/code/getCodeList`, {
  //   params: data
  // })
  return request({
    url: "/api-wms/v1/code/getCodeList",
    method: "get",
    params: data
  })
}
// 获取自动编码
export function getAutoCode(data) {
  return request({
    url: "/api-wms/v1/code/getAutoCode",
    method: "post",
    data
  })
}
src/api/data.js
@@ -201,6 +201,21 @@
    id: 5
  },
]
//采购类型
const purchaseType = [
  {
    name: "采购",
    id: 1,
  },
  {
    name: "自制",
    id: 2,
  },
  {
    name: "委外",
    id: 3,
  },
];
export const getDataByType = (type) => {
  if (type == "purchaseStatus") {
    return purchaseStatus
@@ -224,5 +239,7 @@
    return positionType
  }else if(type=='baseOperationTypeTwo'){
    return baseOperationTypeTwo
  }else if(type=='purchaseType'){
    return purchaseType;
  }
}
src/components/makepager/FormBtnsView.vue
@@ -14,14 +14,14 @@
    >
      <div class="left"><i class="el-icon-present"></i></div>
      <div class="right">
        <div class="right-label">{{ (countObject?.inLibrary ?? 0) + "件" }}</div>
        <div class="right-label">{{ (countObject?.amount ?? 0) + "件" }}</div>
        <div class="right-label">在库</div>
      </div>
    </div>
    <div v-if="!showProduct && !showWarehouse && !showPosition && !addProduct" class="sub-number no-cursor">
      <div class="left"><i class="el-icon-present"></i></div>
      <div class="right">
        <div class="right-label">{{ (countObject?.forecast ?? 0) + "件" }}</div>
        <div class="right-label">{{ (countObject?.predictionAmount ?? 0) + "件" }}</div>
        <div class="right-label">预测</div>
      </div>
    </div>
@@ -33,8 +33,8 @@
    >
      <div class="left icon-view"><i class="el-icon-sort"></i></div>
      <div class="right">
        <div class="right-label">{{ "进: " + (countObject?.enter ?? 0) }}</div>
        <div class="right-label">{{ "出: " + (countObject?.exit ?? 0) }}</div>
        <div class="right-label">{{ "进: " + (countObject?.inputAmount ?? 0) }}</div>
        <div class="right-label">{{ "出: " + (countObject?.outputAmount ?? 0) }}</div>
      </div>
    </div>
    <!-- <div
@@ -56,14 +56,20 @@
    >
      <div class="left"><i class="el-icon-refresh"></i></div>
      <div class="right">
        <div class="right-label">{{ countObject?.reorderRule ?? 0 }}</div>
        <div class="right-label">重订货规则</div>
        <template v-if="countObject?.reorderRuleNum== 1">
          <div class="right-label">最小:{{ countObject?.minInventoryRule ?? 0 }}</div>
          <div class="right-label">最大:{{  countObject?.maxInventoryRule ?? 0 }}</div>
        </template>
        <template v-else>
          <div class="right-label">{{ countObject?.reorderRuleNum ?? 0 }}</div>
          <div class="right-label">重订货规则</div>
        </template>
      </div>
    </div>
    <div v-if="showProduct" class="sub-number left_border yes-cursor" @click="productClick">
      <div class="left"><i class="el-icon-s-fold"></i></div>
      <div class="right">
        <div class="right-label">{{ countObject?.product ?? 0 }}</div>
        <div class="right-label">{{ countObject?.reorderRuleNum ?? 0 }}</div>
        <div class="right-label">产品</div>
      </div>
    </div>
@@ -188,12 +194,12 @@
  padding: 0px 10px;
  font-size: 13px;
  .sub-number {
    width: 12.5%;
    width: 13%;
    border-right: 1px solid #e9e9e9;
    border-top: 1px solid #e9e9e9;
    border-bottom: 1px solid #e9e9e9;
    display: flex;
    padding: 3px 9px;
    padding: 3px 5px;
    .left {
      margin-top: 3px;
      font-size: 22px;
src/components/mixin/codeMixin.js
New file
@@ -0,0 +1,131 @@
import { getCodeStandardList,getAutoCode } from "@/api/common/standard"
export default {
  components: {},
  data() {
    return {
      // 编码
      // 是否自动生成
      isIdDisabled: false,
      inputValue: [],
      explain: "",
      codenumer: 0, //每次输入的编码
      codenumberList: [], //整条编码
      sum: 0,
      method: 0,
      objCode: { name: "", page: 0, pageSize: 0, type: "物料编码", codeStandID: "" },
      codeRule: {},
      codeLength: 0,
      autoCodeObj: {}
    }
  },
  methods: {
    async getRCodeStandardList() {
      try {
        if (this.editConfig.title == "新建") {
          const res = await getCodeStandardList(this.objCode)
          this.codenumer = []
          this.sum = 0
          this.explain = ""
          this.codeLength = 0;
          if (res.code == 200) {
            const { List = [], ID, AutoRule = {}, Method } = res.data ? res.data[0] : []
            this.codeRule = res.data ? res.data[0] : {}
            let autoRule = AutoRule
            let method = Method ? Method : 0
            this.method = method
            let rules = List
            this.editConfig.infomation.ID = ID
            if (method == 0 && res.data.data.length > 0) {
              console.log("sss")
              rules.forEach((item, index) => {
                // setTimeout(() => {
                //   this.codenumer = item.length;
                //   this.sum++;
                // }, 200);
                this.codenumer.push(item.Length)
                this.codeLength += item.Length;
                this.sum++
                this.explain += item.Name + (index === rules.Length - 1 ? "" : "/")
              })
            }
            console.log(method)
            if (method == 1) {
              if (Object.keys(autoRule).length > 0) {
                this.isIdDisabled = true
                if (autoRule.PrefixMethod == 1) {
                  let prefix = autoRule.PrefixValue.split("").length
                  this.codenumer.push(prefix)
                  this.codeLength += prefix;
                  if (autoRule.SuffixMethod == 2) {
                    this.codenumer.push(8)
                    this.codeLength += 8;
                  }
                  if (autoRule.AutoLength) {
                    this.codenumer.push(autoRule.AutoLength)
                    this.codeLength += autoRule.AutoLength;
                  }
                  this.sum = prefix + Number(autoRule.AutoLength)
                  // this.codeList(
                  //   this.editConfig.infomation.id ? this.editConfig.infomation.id : autoRule.PrefixValue
                  // )
                }
              }
            }
            this.$forceUpdate()
          } else {
            this.$message.error(res.data.msg ? res.data.msg : "获取编码规范失败,请重试!")
          }
          this.getAutoCodeValue()
        } else {
          this.codeList(this.editConfig.infomation.id)
        }
      } catch (err) {
        console.log(err)
      }
    },
    async getAutoCodeValue() {
      if(Object.keys(this.codeRule).length>0){
        const res = await getAutoCode(this.codeRule);
        if (res.code == 200) {
          let p={
            id:'',
            codeStandardID:'',
            maxAutoIncr:''
          }
          this.autoCodeObj = res.data?res.data:p;
          this.$set(this.editConfig.infomation, 'id', this.autoCodeObj.id)
        }else{
          this.$set(this.editConfig.infomation, 'id', this.codeRule.AutoRule.PrefixValue?this.codeRule.AutoRule.PrefixValue:'')
        }
      }
    },
    codeList(val) {
      this.inputValue = val
      this.codenumberList = val.toString()
      this.editConfig.infomation.number = this.codenumberList.length > 0 ? this.codenumberList.replace(/,/g, "") : ""
      console.log(this.codenumberList.replace(/,/g, ""))
    },
     // 订单编码单独校验
     validateCheckCode(rule, value, callback) {
      if (value && value.length > 0) {
        if (this.editConfig.title == "新建") {
            if (value.length != this.codeLength) {
              callback(new Error("请填写" + this.codeLength + "位的编码!"));
            }
         }
        callback();
      } else {
        callback(new Error("请输入编码"));
      }
    },
    // 配置编码规范的跳转
    numberClick() {
      window.open("http://www.fai365.com:9080/facilty", "_blank")
    }
  }
}