zuozhengqing
2023-11-02 a7f37d5a76f80df4bad37a58ad95ab41ba0be22e
修改采购管理,供应商列表和产品名称列表展示
1个文件已添加
5个文件已修改
123 ■■■■ 已修改文件
src/store/index.js 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/store/modules/getSupplierName.js 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/other/commonDialog/SelectCommonDialog.vue 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/purchaseManage/purchase/components/AddPurchase.vue 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/purchaseManage/purchase/components/SelectSupplierDialog.vue 46 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/purchaseManage/purchase/index.vue 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/store/index.js
@@ -1,5 +1,6 @@
import Vue from 'vue'
import Vuex from 'vuex'
import getSupplierName from "./modules/getSupplierName"
Vue.use(Vuex)
@@ -13,5 +14,6 @@
  actions: {
  },
  modules: {
    getSupplierName
  }
})
src/store/modules/getSupplierName.js
New file
@@ -0,0 +1,25 @@
import { getSupplierList } from "@/api/supplierManage/supplier"
import { Message } from "element-ui"
export default{
  state:{
    supplierList:[],  //供应商列表
  },
  mutations:{
    supplierNameList(state, payload) {
      state.supplierList = payload
    },
  },
  actions:{
    getSupplier(context){
      getSupplierList({page:1,pageSize:50}).then((res) => {
        if (res.data.code == 200) {
          context.commit("supplierNameList", res.data.data.list)
        } else {
          Message.error(res.msg)
        }
      })
    }
  }
}
src/views/other/commonDialog/SelectCommonDialog.vue
@@ -28,7 +28,13 @@
            <el-button type="primary" size="mini" disabled>快速创建</el-button> -->
          </div>
        </div>
        <TableCommonView ref="tableListRef" :table-list="tableList" :select-box="false" @selCommonClick="selNameClick">
        <TableCommonView
          ref="tableListRef"
          :table-list="tableList"
          :select-box="false"
          @selCommonClick="selNameClick"
          @selTableCol="selTableCol"
        >
        </TableCommonView>
        <div slot="footer" class="dialog-footer">
          <!-- <div class="remark">说明:支持多字段模糊查询,仅显示符合条件的前5条数据</div> -->
@@ -127,9 +133,17 @@
      }
    },
    selTableCol(val) {
      this.showcol = val
      this.tableList.tableColumn = this.setColumnVisible(val)
      this.showcol = val;
      this.tableList.tableColumn = this.setColumnVisible(val);
    },
    // setColumnVisible(showCol){
    //   return  this.tableColumn.map(ele=>{
    //     return {
    //       ...ele,
    //       isShowColumn:showCol.includes(ele.label)
    //     }
    //   })
    // },
    // 请求数据
    async getData() {
      this.loading = true
src/views/purchaseManage/purchase/components/AddPurchase.vue
@@ -59,7 +59,7 @@
                      v-model="editConfig.infomation.supplierName"
                      :fetch-suggestions="
                        (queryString, callback) => {
                          querySearchAsync(queryString, callback, 'client');
                          querySearchAsync(queryString, callback, 'supplier');
                        }
                      "
                      value-key="name"
@@ -358,8 +358,12 @@
  },
  created() {
    this.handleGetBomKindDictList();
    this.$store.dispatch("getSupplier")
  },
  computed: {
    supplierList() {
      return this.$store.state.getSupplierName.supplierList
    }
  },
  watch:{
    'editCommonConfig.visible':{
@@ -557,8 +561,8 @@
    // 选择客户相关方法
    querySearchAsync(queryString, cb, value) {
      var restaurants = [];
      if (value === "client") {
        restaurants = this.clientList;
      if (value === "supplier") {
        restaurants = this.supplierList;
      } 
      var results = queryString
        ? restaurants.filter(this.createStateFilter(queryString))
src/views/purchaseManage/purchase/components/SelectSupplierDialog.vue
@@ -27,6 +27,7 @@
          :table-list="tableList"
          :select-box="false"
          @selCommonClick="selNameClick"
          @selTableCol="selTableCol"
        >
        </TableCommonView>
        <div slot="footer" class="dialog-footer">
@@ -66,34 +67,54 @@
      loading: false,
      searchOptions: [],
      tableList: {},
      search_map: {}
      search_map: {},
      tableColumn: [
        { label: "供应商编号", prop: "number", min: 190, isCommonClick: true },
        { label: "供应商名称", prop: "name", min: 130 },
        { label: "供应商类型", prop: "supplierType", min: 130 },
        { label: "所属行业", prop: "industry", min: 130 },
        { label: "联系人", prop: "contact", min: 130 },
        { label: "联系电话", prop: "phone", min: 130 },
        { label: "状态", prop: "status_name", min: 130 },
        { label: "创建时间", prop: "member_name", min: 130 }
      ],
      showCol: ['供应商编号', '供应商名称', '供应商类型', '所属行业', '联系人', '联系电话','状态','创建时间']
    }
  },
  created() {
    this.setTable()
    this.getData()
  },
  mounted(){
  },
  methods: {
    setTable() {
      this.tableList = {
        tableInfomation: [],
        tableColumn: [
         { label: "供应商编号", prop: "number", min: 190, isCommonClick: true },
          { label: "供应商名称", prop: "name", min: 130 },
          { label: "供应商类型", prop: "supplierType", min: 130 },
          { label: "所属行业", prop: "industry", min: 130 },
          { label: "联系人", prop: "contact", min: 130 },
          { label: "联系电话", prop: "phone", min: 130 },
          { label: "状态", prop: "status_name", min: 130 },
          { label: "创建时间", prop: "member_name", min: 130 }
        ]
        tableColumn:this.setColumnVisible(this.showCol),
        showcol: this.showCol,
        allcol:[]
      }
      this.tableList.allcol = this.tableList.tableColumn.filter(ele=>!ele.default).map(ele=>ele.label);
      this.searchOptions = []
      for (let i = 0; i < this.tableList.tableColumn.length; i++) {
        const label = this.tableList.tableColumn[i].label
        const value = this.tableList.tableColumn[i].prop
        this.searchOptions.push({ value: value, label: label })
      }
    },
    selTableCol(val) {
      this.showcol = val;
      this.tableList.tableColumn = this.setColumnVisible(val);
    },
    setColumnVisible(showCol){
      return  this.tableColumn.map(ele=>{
        return {
          ...ele,
          isShowColumn:showCol.includes(ele.label)
        }
      })
    },
    handleClose() {
      this.editConfig.editVisible = false
@@ -115,7 +136,8 @@
                  status_name: item.status === 0 ? "未启用" : "启用"
                }
              })
              this.tableList.tableInfomation = list.slice(0, 5) || []
              // this.tableList.tableInfomation = list.slice(0, 5) || []
              this.tableList.tableInfomation = list
            } else {
              this.tableList.tableInfomation = []
            }
src/views/purchaseManage/purchase/index.vue
@@ -63,6 +63,7 @@
import DetailSupplier from "@/views/purchaseManage/purchase/DetailSupplier"
import AddPurchase from "@/views/purchaseManage/purchase/components/AddPurchase"
import { getDataByType } from "@/api/data"
import { getSupplierList } from "@/api/supplierManage/supplier"
export default {
  name: "SupplierManage",
  props: {},
@@ -83,7 +84,9 @@
      editConfig: {
        visible: false,
        title: "创建",
        infomation: {}
        infomation: {
          supplierList:[]
        }
      },
      purchaseStatusList: getDataByType("purchaseStatus"),
      tableColumn: [
@@ -102,6 +105,7 @@
  created() {
    this.setTable()
    this.getData()
    this.getSupplierData()
  },
  methods: {
    getpurchaseStatus(val) {
@@ -155,6 +159,20 @@
          console.log(err)
        })
    },
    // 获取供应商数据
    async getSupplierData() {
      await getSupplierList({
        // [val]: content,
        page:1,
        pageSize: 10
      })
      .then((res) => {
        if (res.data.code == 200) {
          this.editConfig.infomation.supplierList=res.data.data.list
        }
      })
    },
    // 搜索
    onFilterSearch(searchText){
      this.search = searchText ?? ''