Kaynağa Gözat

fix:供应商查询

zjy 3 yıl önce
ebeveyn
işleme
17806e1f6a
1 değiştirilmiş dosya ile 267 ekleme ve 0 silme
  1. 267 0
      src/views/sample/goodsSelect.vue

+ 267 - 0
src/views/sample/goodsSelect.vue

@@ -0,0 +1,267 @@
+<template>
+  <div>
+    <div class="heads">供应商供货查询</div>
+    <div class="top-box">
+      <span class="t-span">供应商:</span>
+      <el-select v-model="quyu" placeholder="请选择" clearable>
+        <el-option
+          v-for="item in options"
+          :key="item.id_"
+          :label="item.gong_ying_shang_m"
+          :value="item.id_"
+        >
+        </el-option>
+      </el-select>
+      <el-button class="btn" type="primary" @click="query">
+        <i class="ibps-icon-search"></i>查询
+      </el-button>
+    </div>
+    <el-table
+      :data="tableData"
+      :stripe="true"
+      style="width: 100%"
+      height="70vh"
+      :header-cell-style="{
+        color: '#000',
+        'font-size': '14px',
+        padding: '6px 6px',
+        background: '#a7d6f8 !important',
+      }"
+    >
+      <el-table-column
+        prop="wu_liao_ming_chen"
+        label="物料名称"
+        width="200"
+      ></el-table-column>
+      <el-table-column prop="wu_liao_bian_ma_" label="物料编码" width="100">
+        <template slot-scope="scope">
+          {{ scope.row.wu_liao_bian_ma_ }}
+        </template>
+      </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_) }}
+        </template>
+      </el-table-column>
+      <el-table-column prop="pi_hao_" label="批号" width="120">
+        <template slot-scope="scope">
+          {{ scope.row.pi_hao_ }}
+        </template>
+      </el-table-column>
+      <el-table-column prop="huo_hao_" label="货号" width="120">
+        <template slot-scope="scope">
+          {{ scope.row.huo_hao_ }}
+        </template>
+      </el-table-column>
+      <el-table-column prop="gui_ge_xing_hao_" label="规格型号" width="120">
+        <template slot-scope="scope">
+          {{ scope.row.gui_ge_xing_hao_ }}
+        </template>
+      </el-table-column>
+      <el-table-column prop="shu_liang_" label="数量" width="">
+        <template slot-scope="scope">
+          {{ scope.row.shu_liang_ }}
+        </template>
+      </el-table-column>
+      <!-- <el-table-column prop="t2" label="t2" width="65">
+        <template slot-scope="scope">
+          {{ scope.row.huo_hao_ }}
+        </template>
+      </el-table-column> -->
+    </el-table>
+    <div class="block">
+      <el-pagination
+        @size-change="handleSizeChange"
+        @current-change="handleCurrentChange"
+        :current-page="currentPage4"
+        :page-sizes="[10, 15, 25, 50]"
+        :page-size="20"
+        layout="total, sizes, prev, pager, next, jumper"
+        :total="numtotal"
+      >
+      </el-pagination>
+    </div>
+  </div>
+</template>
+
+<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 `;
+export default {
+  data() {
+    return {
+      tableData: [],
+      quyu: "",
+      riqi: "",
+      currentPage4: "",
+      currentPage: "1",
+      limit: "15",
+      numtotal: "",
+      currentSql: "",
+      countSql: "",
+      options: [],
+    };
+  },
+  //yszb
+  created() {
+    let this_ = this;
+    let sql = cgSql + jsSql + this.limit;
+    this.currentSql = sql;
+    this.loadData(sql);
+    this.allLength();
+    let gysSql =
+      "select id_,gong_ying_shang_m FROM t_gysml where gong_ying_shang_l ='设备、物料供应商'";
+    curdPost("sql", gysSql).then((res) => {
+      let data = res.variables.data;
+      this_.options = data;
+    });
+  },
+  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;
+        });
+      }
+    },
+    numToFixedP: function (value) {
+      if (value > 9999) {
+        return "??";
+      }
+      return value.toFixed(2);
+    },
+    fmtDate: function (obj) {
+      var date = new Date(obj);
+      var y = 1900 + date.getYear();
+      var m = "0" + (date.getMonth() + 1);
+      var d = "0" + date.getDate();
+      var h = date.getHours();
+      var min = date.getMinutes();
+      var s = date.getMinutes();
+      return (
+        y +
+        "-" +
+        m.substring(m.length - 2, m.length) +
+        "-" +
+        d.substring(d.length - 2, d.length) +
+        "  " +
+        h +
+        ":" +
+        min +
+        ":" +
+        s
+      );
+    },
+  },
+  methods: {
+    allLength() {
+      let this_ = this;
+      let sql1 =
+        "select COUNT(*) AS COUNT FROM t_cgysjlb UNION ALL SELECT COUNT(*) AS COUNT FROM t_wljsysjlb ";
+      curdPost("sql", sql1).then((res) => {
+        let data = res.variables.data;
+        this_.numtotal = data[0].COUNT + data[1].COUNT;
+      });
+    },
+    loadData(sql) {
+      // 请求表格数据函数
+      let this_ = this;
+      this.listData = [];
+      curdPost("sql", sql).then((res) => {
+        this_.tableData = res.variables.data;
+      });
+    },
+    countLength(sql) {
+      let this_ = this;
+      curdPost("sql", sql).then((res) => {
+        let data = res.variables.data;
+        this_.numtotal = data[0].COUNT;
+      });
+    },
+    filter() {
+      let quyu = this.quyu;
+      let sql = "";
+      let this_ = this;
+      let sql1 = `select wu_liao_ming_chen,wu_liao_bian_ma_,gong_ying_shang_A,pi_hao_,huo_hao_,gui_ge_xing_hao_,shu_liang_,wai_jian_,create_time_ FROM t_cgysjlb WHERE wai_jian_ IN ((select id_ FROM t_yszb WHERE (ding_dan_lei_xing !='换货单/常规' OR ding_dan_lei_xing !='换货单/技术') AND shi_fou_guo_shen_='1' AND gong_ying_shang_ ='${quyu}')) UNION ALL select 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_,id_ AS wai_jian_,create_time_ FROM t_wljsysjlb WHERE gong_ying_shang_ ='${quyu}' ORDER BY create_time_ DESC`;
+      let sql2 = `select COUNT(*) AS COUNT FROM t_cgysjlb WHERE wai_jian_ IN ((select id_ FROM t_yszb WHERE (ding_dan_lei_xing !='换货单/常规' OR ding_dan_lei_xing !='换货单/技术') AND shi_fou_guo_shen_='1' AND gong_ying_shang_ ='${quyu}')) UNION ALL select COUNT(*) AS COUNT FROM t_wljsysjlb WHERE gong_ying_shang_ ='${quyu}'`;
+      if (quyu) {
+        sql = sql1;
+        curdPost("sql", sql2).then((res) => {
+          let data = res.variables.data;
+          this_.numtotal = data[0].COUNT + data[1].COUNT;
+        });
+      } else {
+        this_.allLength();
+        sql = cgSql + jsSql + this.limit;
+      }
+      console.log(sql);
+
+      return sql;
+    },
+    query() {
+      let sql = this.filter();
+      //   this.currentSql = sql;
+      this.loadData(sql);
+    },
+    handleSizeChange(val) {
+      this.limit = val;
+      let splitone = this.currentSql.split("LIMIT");
+      let sql = cgSql + jsSql + this.currentPage + "," + val;
+      this.currentSql = splitone[0] + "LIMIT " + val;
+      this.loadData(sql);
+    },
+    handleCurrentChange(val) {
+      this.currentPage = val;
+      let splitone = this.currentSql.split("LIMIT");
+      let sql = cgSql + jsSql + val + "," + splitone[1];
+      this.loadData(sql);
+    },
+  },
+};
+</script>
+<style lang="scss">
+.tableRowClassName {
+  backface-visibility: #d9eefd;
+}
+.heads {
+  margin-top: 5px;
+  width: 100%;
+  text-align: center;
+  font-weight: 700;
+  background-color: #f9ffff;
+  width: 100%;
+  font-size: 18px;
+}
+.el-table--striped .el-table__body tr.el-table__row--striped td.el-table__cell {
+  background: #d9eefd;
+}
+.more,
+.item {
+  cursor: pointer;
+}
+.more {
+  color: #409eff;
+}
+.el-dropdown-link {
+  cursor: pointer;
+  color: #409eff;
+}
+.el-icon-arrow-down {
+  font-size: 12px;
+}
+</style>