Procházet zdrojové kódy

Merge branch 'master' of http://119.23.210.103:3000/wy/mj_firm_former

zjy před 3 roky
rodič
revize
3dbf017681

+ 2 - 1
src/layout/header-aside/components/components/float-ball/index.vue

@@ -90,7 +90,8 @@ import { BASE_API,BUSINESS_BASE_URL } from '@/api/baseUrl' //引用导出地址
       });
     },
     created() {
-     this.getDataTimer = setInterval(this.loadData,1000*60*10); //每10分钟获取开始任务
+     //this.getDataTimer = setInterval(this.loadData,1000*60*10); //每10分钟获取开始任务
+     this.getDataTimer = setInterval(this.loadData,10000); //获取开始任务
     },
     /* 销毁定时事件*/
     beforeDestroy() {

+ 81 - 38
src/views/sample/goodsSelect.vue

@@ -3,7 +3,7 @@
     <div class="heads">供应商供货查询</div>
     <div class="top-box">
       <span class="t-span">供应商:</span>
-      <el-select v-model="quyu" placeholder="请选择" clearable>
+      <el-select v-model="quyu" placeholder="请选择" filterable clearable>
         <el-option
           v-for="item in options"
           :key="item.id_"
@@ -21,6 +21,7 @@
       :stripe="true"
       style="width: 100%"
       height="70vh"
+      v-loading="loading"
       :header-cell-style="{
         color: '#000',
         'font-size': '14px',
@@ -40,7 +41,7 @@
       </el-table-column>
       <el-table-column prop="wu_liao_bian_ma_" label="供应商" width="150">
         <template slot-scope="scope">
-          {{ scope.row.gong_ying_shang_A | gysfilter(scope.row.wai_jian_) }}
+          {{ scope.row.wu_liao_bian_ma_ | gysfilter(gysList) }}
         </template>
       </el-table-column>
       <el-table-column prop="pi_hao_" label="批号" width="120">
@@ -58,11 +59,16 @@
           {{ scope.row.gui_ge_xing_hao_ }}
         </template>
       </el-table-column>
-      <el-table-column prop="shu_liang_" label="数量" width="">
+      <el-table-column prop="shu_liang_" label="数量" width="80">
         <template slot-scope="scope">
           {{ scope.row.shu_liang_ }}
         </template>
       </el-table-column>
+      <el-table-column prop="shu_liang_" label="入库时间" width="">
+        <template slot-scope="scope">
+          {{ scope.row.wu_liao_bian_ma_|dhsjFilter(inkuList,scope.row.ru_ku_shi_jian_A_)}}
+        </template>
+      </el-table-column>
       <!-- <el-table-column prop="t2" label="t2" width="65">
         <template slot-scope="scope">
           {{ scope.row.huo_hao_ }}
@@ -75,7 +81,7 @@
         @current-change="handleCurrentChange"
         :current-page="currentPage4"
         :page-sizes="[10, 15, 25, 50]"
-        :page-size="20"
+        :page-size="10"
         layout="total, sizes, prev, pager, next, jumper"
         :total="numtotal"
       >
@@ -86,22 +92,24 @@
 
 <script>
 import curdPost from "@/business/platform/form/utils/custom/joinCURD.js";
-import data from "@/components/ibps-icon-select/data";
-let jsSql = `select id_ as wai_jian_, wu_liao_ming_chen,wu_liao_dai_ma_ AS wu_liao_bian_ma_,gong_ying_shang_ asgong_ying_shang_A,pi_hao_,huo_hao_,gui_ge_ AS gui_ge_xing_hao_,dao_huo_shu_liang AS shu_liang_,create_time_ FROM t_wljsysjlb ORDER BY create_time_ DESC LIMIT `;
-let cgSql = `select wai_jian_, wu_liao_ming_chen,wu_liao_bian_ma_,gong_ying_shang_A,pi_hao_,huo_hao_,gui_ge_xing_hao_,shu_liang_,create_time_ FROM t_cgysjlb UNION ALL `;
+let jsSql = `select id_ as wai_jian_, wu_liao_ming_chen,wu_liao_dai_ma_ AS wu_liao_bian_ma_,gong_ying_shang_ as gong_ying_shang_A,dao_ku_ri_qi_ as ru_ku_shi_jian_A_,pi_hao_,huo_hao_,gui_ge_ AS gui_ge_xing_hao_,dao_huo_shu_liang AS shu_liang_,create_time_ FROM t_wljsysjlb ORDER BY create_time_ DESC LIMIT `;
+let cgSql = `select wai_jian_, wu_liao_ming_chen,wu_liao_bian_ma_,gong_ying_shang_A,ru_ku_shi_jian_A_,pi_hao_,huo_hao_,gui_ge_xing_hao_,shu_liang_,create_time_ FROM t_cgysjlb UNION ALL `;
 export default {
   data() {
     return {
       tableData: [],
       quyu: "",
       riqi: "",
-      currentPage4: "",
-      currentPage: "1",
-      limit: "15",
+      currentPage4: 0,
+      currentPage: 1,
+      limit: "10",
       numtotal: "",
       currentSql: "",
       countSql: "",
       options: [],
+      gysList: [],
+      loading: true,
+      inkuList: [],
     };
   },
   //yszb
@@ -119,31 +127,22 @@ export default {
     });
   },
   filters: {
-    gysfilter: async function (value, ID_) {
-      console.log(value, ID_);
-      if (value) {
-        let sql1 = `select gong_ying_shang_m FROM t_gysml where id_= '${value}'`;
-        console.log(sql1)
-        await curdPost("sql", sql1).then((res) => {
-          let data1 = res.variables.data;
-          console.log(data1)
-          return data1[0].gong_ying_shang_m;
-        });
-      } else {
-        let sql = `select gong_ying_shang_m FROM t_gysml where id_=(SELECT gong_ying_shang_ FROM t_yszb WHERE id_ = '${ID_}')`;
-         console.log(sql)
-        await curdPost("sql", sql).then((res) => {
-          let data = res.variables.data;
-          console.log(data)
-          return data[0].gong_ying_shang_m;
-        });
+    gysfilter: function (value, arr) {
+      for (let i = 0; i < arr.length; i++) {
+        if (arr[i].wu_liao_bian_ma_ == value) {
+          return arr[i].gong_ying_shang_m;
+        }
       }
     },
-    numToFixedP: function (value) {
-      if (value > 9999) {
-        return "??";
+    dhsjFilter: function (value, arr,shijian) {
+      if(shijian){
+        return shijian;
+      }
+      for (let i = 0; i < arr.length; i++) {
+        if (arr[i].wu_liao_bian_ma_ == value) {
+          return arr[i].ru_ku_shi_jian_A_;
+        }
       }
-      return value.toFixed(2);
     },
     fmtDate: function (obj) {
       var date = new Date(obj);
@@ -178,13 +177,57 @@ export default {
         this_.numtotal = data[0].COUNT + data[1].COUNT;
       });
     },
-    loadData(sql) {
+    async loadData(sql) {
       // 请求表格数据函数
       let this_ = this;
+      let data = [];
+      let obj = {};
+      let obj1={};
       this.listData = [];
-      curdPost("sql", sql).then((res) => {
+      this_.gysLis = [];
+      await curdPost("sql", sql).then((res) => {
         this_.tableData = res.variables.data;
+        data = this_.tableData;
       });
+      for (let i = 0; i < data.length; i++) {
+        obj = {};
+        obj1={};
+        if (data[i].gong_ying_shang_m) {
+          // this_.jsgys(data[i].gong_ying_shang_m);
+          let sql1 = `select  gong_ying_shang_m FROM t_gysml where id_= '${data[i].gong_ying_shang_m}'`;
+          await curdPost("sql", sql1).then((res) => {
+            let data1 = res.variables.data;
+            if (data1.length > 0) {
+              obj.wu_liao_bian_ma_ = data[i].wu_liao_bian_ma_;
+              obj.gong_ying_shang_m = data1[0].gong_ying_shang_m || 0;
+              this_.gysList.push(obj);
+            }
+          });
+        } else {
+          // this_.cggys(data[i].wai_jian_);
+          let sql = `select gong_ying_shang_m FROM t_gysml where id_=(SELECT gong_ying_shang_ FROM t_yszb WHERE id_ = '${data[i].wai_jian_}')`;
+          await curdPost("sql", sql).then((res) => {
+            let data2 = res.variables.data;
+            if (data2.length > 0) {
+              obj.wu_liao_bian_ma_ = data[i].wu_liao_bian_ma_;
+              obj.gong_ying_shang_m = data2[0].gong_ying_shang_m || 0;
+              this_.gysList.push(obj);
+            }
+          });
+          let sql3 = `select dao_huo_ri_qi_ FROM t_yszb where id_='${data[i].wai_jian_}'`;
+          await curdPost("sql", sql3).then((res) => {
+            let data3 = res.variables.data;
+            if (data3.length > 0) {
+              obj1.wu_liao_bian_ma_ = data[i].wu_liao_bian_ma_;
+              obj1.ru_ku_shi_jian_A_ = data3[0].dao_huo_ri_qi_ || 0;
+              this_.inkuList.push(obj1);
+            }
+          });
+        }
+      }
+      setTimeout(() => {
+        this_.loading = false;
+      }, 200);
     },
     countLength(sql) {
       let this_ = this;
@@ -209,8 +252,6 @@ export default {
         this_.allLength();
         sql = cgSql + jsSql + this.limit;
       }
-      console.log(sql);
-
       return sql;
     },
     query() {
@@ -221,14 +262,16 @@ export default {
     handleSizeChange(val) {
       this.limit = val;
       let splitone = this.currentSql.split("LIMIT");
+      console.log(this.currentPage,val)
       let sql = cgSql + jsSql + this.currentPage + "," + val;
       this.currentSql = splitone[0] + "LIMIT " + val;
       this.loadData(sql);
     },
     handleCurrentChange(val) {
-      this.currentPage = val;
+      this.currentPage = parseInt(val);
       let splitone = this.currentSql.split("LIMIT");
-      let sql = cgSql + jsSql + val + "," + splitone[1];
+      console.log(splitone[1],val)
+      let sql = cgSql + jsSql + ((val-1)*splitone[1]) + "," + splitone[1];
       this.loadData(sql);
     },
   },