zuozhengqing
2023-11-18 65bc5629504c5e138d8540cdf9b0eb3796842d4a
fix:采购管理-产品列表与供应商列表关联
3个文件已修改
41 ■■■■ 已修改文件
src/common/untils/request.js 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/makepager/CommonFormTableView.vue 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/purchaseManage/purchase/components/AddPurchase.vue 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/common/untils/request.js
@@ -11,12 +11,18 @@
/* //POST传参序列化(添加请求拦截器) */
Axios.interceptors.request.use(
  (config) => {
    // 若是有做鉴权token , 就给头部带上token
    // let token = util.cookies.get("token");
    // if (token != undefined) {
    //   config.headers.Authorization = "Bearer " + token;
    // }
    // // 若是有做鉴权token , 就给头部带上token
    // // let token = util.cookies.get("token");
    // // if (token != undefined) {
    // //   config.headers.Authorization = "Bearer " + token;
    // // }
    let token = document.cookie.replace(
      /(?:(?:^|.*;\s*)token\s*=\s*([^;]*).*$)|^.*$/,
      "$1",
    );
    if (token) {
      config.headers.Authorization = "Bearer " + token;
    }
    return config
  },
  (error) => {
src/components/makepager/CommonFormTableView.vue
@@ -188,6 +188,7 @@
      type: Object,
      default: () => {
        return {
          tableProductList:[],
          disabled:false,
          tableData: [], // 接口返回数据
          tableColumn: [
@@ -237,7 +238,7 @@
  watch: {
    productTableList() {
      this.tableList = this.productTableList
    }
    },
  },
  methods: {
    // 产品名称
@@ -359,7 +360,7 @@
    },
    // 选择产品名称相关方法
    querySearchAsync(queryString, cb) {
      var restaurants = this.productList
      var restaurants = this.productTableList.tableProductList
      var results = queryString ? restaurants.filter(this.createStateFilter(queryString)) : restaurants
      cb(results)
    },
src/views/purchaseManage/purchase/components/AddPurchase.vue
@@ -278,6 +278,7 @@
<script>
import CommonFormTableView from "@/components/makepager/CommonFormTableView";
import BomDialog from "@/components/makepager/BomDialog";
import { getProductList } from "@/api/productManage/product"
import {
  addPurchase,
@@ -571,6 +572,7 @@
    },
    // 选择客户相关方法
    querySearchAsync(queryString, cb, value) {
      this.productTableList.tableProductList=[]
      var restaurants = [];
      if (value === "supplier") {
        restaurants = this.supplierList;
@@ -587,11 +589,22 @@
        );
      };
    },
    handleSelectClient(value, item) {
    async handleSelectClient(value, item) {
      this.productTableList.supplierId=item.ID
      if (value === "client") {
        this.supplierId = item.id;
        this.editConfig.infomation.supplierId=item.ID
      }
      await getProductList({
        supplierId:item.ID,
        page:1,
        pageSize:100
      }).then((res)=>{
        if(res.data.code===200){
          this.productTableList.tableProductList = res.data.data.list
          console.log(this.productTableList.tableProductList,"pop")
        }
      })
    },
    selClientClick() {
      this.editSelectSupplierConfig.editVisible = true;
@@ -604,6 +617,7 @@
    },
    // 清除已选择用户
    clearupClient(value) {
      this.emptyProductClick()
      if (value == "client") {
        this.$set(this.editConfig.infomation, "supplierName", "");
        this.supplierId = null;
@@ -634,6 +648,8 @@
        // });
      }
      this.productTableList = {
        tableProductList:[],
        supplierId:undefined,
        tableData: this.tableData,
        disabled:this.editConfig.isDisabled,
        tableColumn: [