zjy пре 3 година
родитељ
комит
458b5e2c0a
1 измењених фајлова са 74 додато и 79 уклоњено
  1. 74 79
      src/views/warehouse/cangku.vue

+ 74 - 79
src/views/warehouse/cangku.vue

@@ -81,12 +81,12 @@
                     :key="index"
                     class="goods-dsc"
                     :style="{
-                      background: it.cun_fang_wei_zhi_ == '空' ? '' : '#67c23a',
+                      background: !it.wu_liao_bian_ma_ ?  '#67c23a':'' ,
                     }"
                   >
                     <div class="top-dsc">
                       <div class="position">
-                        <p>名称:{{ it.cun_fang_wei_zhi_ }}</p>
+                        <p>名称:{{ it.wu_pin_ming_chen }}</p>
                         <p>编码:{{ it.wu_liao_bian_ma_ || "空" }}</p>
                         <p>位置:{{ it.cun_fang_wei_zhi_ || "空" }}</p>
                         <p>货号:{{ it.huo_hao_ || "空" }}</p>
@@ -136,8 +136,8 @@ export default {
     return {
       cangkuOption: [],
       formInline: {
-        cang_ku_ming_chen_value: "耗材库",
-        qu_yu_value: "1号 货架",
+        cang_ku_ming_chen_value: " 主仓库",
+        qu_yu_value: "1号冰箱",
         huo_jia_value: "",
       },
       huojiaInfo: {
@@ -201,14 +201,20 @@ export default {
   mounted() {
     this.loadQueryData();
     this.firstLoadViewData();
-    this.firstLoadQuyu("试剂库1");
+    this.firstLoadQuyu("主仓库");
   },
   methods: {
     firstLoadQuyu(cang_ku) {
-      let sqlString = `select distinct qu_yu_,cun_chu_tiao_jian from t_ck where cang_ku_ming_chen = '${cang_ku}' order by qu_yu_ asc`;
+      let sqlString = `select DISTINCT subStr(wei_zhi_,1,4) as wei_zhi_,cun_chu_tiao_jian,qu_yu_ from t_ck where cang_ku_ming_chen = '${cang_ku}' order by wei_zhi_ asc`;
+      
       var this_ = this;
+      
       curdPost("sql", sqlString).then((response) => {
         this_.quyu_arr = response.variables.data;
+        console.log(this_.quyu_arr,"sqlqrr")
+        this_.quyu_arr.forEach(it=>{
+          it.wei_zhi_.includes("-")?"":it.qu_yu_ =it.qu_yu_+it.wei_zhi_.slice(3,4);
+        })
         if (!this.firstLoadActive) {
           this_.formInline.qu_yu_value = "";
         }
@@ -216,34 +222,28 @@ export default {
     },
     firstLoadViewData() {
       //首次加载视图数据 默认中心仓库 耗材区
-      this.formInline.cang_ku_ming_chen_value = "试剂库1";
-      this.formInline.qu_yu_value = "1号试剂柜";
+      this.formInline.cang_ku_ming_chen_value = "主仓库";
+      this.formInline.qu_yu_value = "1号冰箱";
       this.selectActive = 1;
       this.firstLoadActive = true;
-      this.quyuShow = "1号试剂柜";
-      var sqlString =
-        "select * from t_mjwlgl where cun_fang_wei_zhi_ like" +
-        "'%" +
-        "SJG1" +
-        "%'";
-      this.queryLoad(sqlString, "SJG1");
+      this.quyuShow = "1号冰箱";
+      var sqlString ="select * from t_mjwlgl where cun_fang_wei_zhi_ like" +"'%" +"BX1T" +"%'";
+      this.queryLoad(sqlString, "BX1T");
     },
-    sqlSlice(value) {
-      // let py = value.split("号")[1];
-
-      switch (value) {
-        case "货架":
-          return "HJ";
-        case "试剂柜":
-          return "SJG";
-        case "冰箱":
-          return "BX";
-        default:
-          "";
+    sqlSlice(value,num) {
+      if(value.includes("冰箱")){
+        if(value.includes("T")||value.includes("B")||value.includes("L")||value.includes("R")){
+          return 'BX'+num+value.slice(4,5);
+        }else{
+          return 'BX' +num
+        }
+      }else if(value.includes("货架")){
+        return "HJ"+num;
+      }else if(value.includes("试剂柜")){
+        return "SJG"+num;
       }
     },
-    loadQueryData() {
-      //查询选择仓库数据查询
+    loadQueryData() {//查询选择仓库数据查询
       var sqlString = "select distinct cang_ku_ming_chen from t_ck ";
       var this_ = this;
       curdPost("sql", sqlString).then((response) => {
@@ -255,71 +255,76 @@ export default {
         });
       });
     },
-    onSubmits() {
-      this.desShow = false;
-      //头部按钮查询事
-      // var sqlString = `select * from t_mjwlgl where cang_ku_ming_chen = '${this.formInline.cang_ku_ming_chen_value}' and qu_yu_ = '${this.formInline.qu_yu_value}'`;
-      let py = this.formInline.qu_yu_value.split("号")[1].replace(/^\s*/g, "");
-      let num = this.formInline.qu_yu_value.split("号")[0];
-      let quyu = this.sqlSlice(py);
-      let type = (quyu + num).replace(/^\s*/g, "");
-      var sqlString =
-        `select * from t_mjwlgl where cun_fang_wei_zhi_ like ` +
+    onSubmits() {  //头部按钮查询事
+      this.desShow = false;   
+      let value = this.formInline.qu_yu_value
+      let num = value.split("号")[0];
+      let type = this.sqlSlice(value,num);
+      console.log(type)
+      var sqlString =`select * from t_mjwlgl where cun_fang_wei_zhi_ like ` +
         "'%" +
         type +
         "%'";
       console.log(sqlString);
       this.queryLoad(sqlString, type);
+      this.formInline.qu_yu_value = value;
+      this.quyuShow = value
     },
     queryLoad(sql, py) {
+      
       var datas = [];
       this.cenghao = [];
       const labelsMap = {}; // map存储
       let typeData = [];
-      var sqltype =
-        `select DISTINCT SUBSTR(wei_zhi_,1,6) as wei_zhi_ from t_ck where wei_zhi_ like ` +
-        "'%" +
-        py +
-        "%'" +
-        "ORDER BY wei_zhi_ ASC ";
-      console.log(sqltype, sql);
+      var sqltype = 
+        `select DISTINCT SUBSTR(wei_zhi_,1,6) as wei_zhi_ from t_ck where wei_zhi_ like ` +"'%" +py +"%'" +"ORDER BY wei_zhi_ ASC "; //
+      console.log(sqltype, sql,"传进来参数");
       curdPost("sql", sqltype).then((res) => {
-        typeData = res.variables.data;
-        console.log(sqltype, sql);
-        curdPost("sql", sql).then((res) => {
-          datas = res.variables.data;
-          typeData.forEach((item) => {
+        typeData = res.variables.data; //查询该位置具有多少层 
+        curdPost("sql", sql).then((res) => {//sql 查询该位置在物料管理库存信息的物料
+          datas = res.variables.data;// 该位置的库存信息
+          typeData.forEach((item) => { //组件以货架分层的数据: {1:[],2:[],3:[],4:[],5:[],6}
             let num = item.wei_zhi_.split("-")[1];
             labelsMap[num] = [];
           });
-          if (datas.length == 0) {
-            for (var prop in labelsMap) {
-              labelsMap[prop].push({ cun_fang_wei_zhi_: "空" });
-            }
-
+          if (datas.length == 0) { //没有物料存在该位置
+            for (var prop in labelsMap) { 
+              typeData.forEach((item) => { //组件以货架分层的数据: {1:[],2:[],3:[],4:[],5:[],6}
+                 let num = item.wei_zhi_.split("-")[1];
+                 if(num == prop){
+                  labelsMap[prop].push({ cun_fang_wei_zhi_: item.wei_zhi_ });
+                  
+                 }
+              });
+            }          
             this.listData = labelsMap;
             return;
           }
-          datas.forEach((item) => {
+          datas.forEach((item) => {//有物料存在该区域
             let props1 = item.cun_fang_wei_zhi_.split("-")[1];
             for (var prop in labelsMap) {
               if (labelsMap.hasOwnProperty(prop)) {
                 if (prop == props1) {
                   labelsMap[prop].push(item);
                 }
-                if (prop != props1 && labelsMap[prop].length == 0) {
-                  labelsMap[prop].push({ cun_fang_wei_zhi_: "空" });
+                if (prop != props1 && labelsMap[prop].length == 0) {   
+                  typeData.forEach((item) => { //组件以货架分层的数据: {1:[],2:[],3:[],4:[],5:[],6}
+                     let num = item.wei_zhi_.split("-")[1];
+                     if(num == prop){
+                       labelsMap[prop].push({ cun_fang_wei_zhi_: item.wei_zhi_});
+                       labelsMap[prop].push({ "zhuangtai": "空"});
+                     }
+                  });
+                  // labelsMap[prop].push({ cun_fang_wei_zhi_: "空" });
                 }
               }
             }
           });
-
           let newarr = [];
           for (var prop in labelsMap) {
             if (labelsMap.hasOwnProperty(prop)) {
               if (labelsMap[prop].length > 1) {
                 var item = labelsMap[prop].slice(1);
-                // delete labelsMap[0]
                 console.log(item);
                 newarr.push(item);
               } else {
@@ -333,21 +338,12 @@ export default {
         });
       });
     },
-    qu_yu_Event(e) {
-      //点击区域事件,加载可视化视图
+    qu_yu_Event(e) { //点击区域事件,加载可视化视图 
       let value = e.target.innerText;
-      if (value.includes("(")) {
-        let index = value.indexOf("(");
-        value = value.slice(0, index);
-      }
-      let num = value.slice(0, 1);
-      console.log(value, "类型");
-      let py = value.split("号")[1].replace(/^\s*/g, "");
-      // let num = this.formInline.qu_yu_value.split("号")[0];
-      let quyu = this.sqlSlice(py);
-      let type = (quyu + num).replace(/^\s*/g, "");
-      var sqlString =
-        `select * from t_mjwlgl where cun_fang_wei_zhi_ like ` +
+      let num = value.split("号")[0];
+      let type = this.sqlSlice(value,num);
+      console.log(type)
+      var sqlString =`select * from t_mjwlgl where cun_fang_wei_zhi_ like ` +
         "'%" +
         type +
         "%'";
@@ -363,7 +359,6 @@ export default {
   watch: {
     //监控仓库名称变化 触发第一次加载数据
     "formInline.cang_ku_ming_chen_value": async function (newdata) {
-      console.log(newdata);
       this.firstLoadQuyu(newdata);
     },
     "formInline.qu_yu_value": function (newdata) {
@@ -534,9 +529,9 @@ p {
                   // color: #fbe8ff;
                   text-align: left;
                 }
-                .condition {
-                  // color: #fbe8ff;
-                }
+                // .condition {
+                //   // color: #fbe8ff;
+                // }
               }
               .bottom-dsc {
                 width: 100%;