yangfeng
2023-11-02 583f5b77640b5dbf7e593e89a0d660f4cacacbe9
src/views/purchaseManage/purchase/index.vue
@@ -22,6 +22,7 @@
              ref="tableListRef"
              :table-list="tableList"
              @selCommonClick="selCommonClick"
              @selTableCol="selTableCol"
          >
            <template slot="tableButton">
              <el-table-column  label="状态" width="120">
@@ -34,7 +35,7 @@
                  <el-button type="text" size="small" @click="editClick(scope.row)" style="margin-right: 5px"
                  >编辑</el-button
                  >
                  <el-button @click="submitClick(scope.row)" type="text" size="small">提交</el-button>
                  <el-button v-if="scope.row.status< 4" @click="submitClick(scope.row)" type="text" size="small">提交</el-button>
                </template>
              </el-table-column>
            </template>
@@ -62,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: {},
@@ -82,14 +84,28 @@
      editConfig: {
        visible: false,
        title: "创建",
        infomation: {}
        infomation: {
          supplierList:[]
        }
      },
      purchaseStatusList: getDataByType("purchaseStatus")
      purchaseStatusList: getDataByType("purchaseStatus"),
      tableColumn: [
        { label: "采购单号", prop: "number", min: 150, isCommonClick: true ,default:true},
        { label: "采购单名称", prop: "name", min: 130, isCommonClick: true },
        { label: "单据类型", prop: "orderType", min: 130 },
        { label: "供应商名称", prop: "contact", min: 130 },
        { label: "采购数量", prop: "quantity", min: 130 },
        { label: "收货仓库", prop: "warehouse", min: 130 },
        { label: "经办人", prop: "handledBy", min: 130 },
        { label: "制单人", prop: "creator", min: 130 }
      ],
      showCol: ['采购单号', '采购单名称', '单据类型', '供应商名称', '采购数量', '收货仓库']
    }
  },
  created() {
    this.setTable()
    this.getData()
    this.getSupplierData()
  },
  methods: {
    getpurchaseStatus(val) {
@@ -103,21 +119,27 @@
        return "--"
      }
    },
    setColumnVisible(showCol){
      return  this.tableColumn.map(ele=>{
        return {
          ...ele,
          isShowColumn:showCol.includes(ele.label)
        }
      })
    },
    setTable() {
      this.tableList = {
        tableInfomation: [],
        selectIndex: true,
        tableColumn: [
          { label: "采购单号", prop: "number", min: 150, isCommonClick: true },
          { label: "采购单名称", prop: "name", min: 130, isCommonClick: true },
          { label: "单据类型", prop: "orderType", min: 130 },
          { label: "供应商名称", prop: "contact", min: 130 },
          { label: "采购数量", prop: "quantity", min: 130 },
          { label: "收货仓库", prop: "warehouse", min: 130 },
          { label: "经办人", prop: "handledBy", min: 130 },
          { label: "制单人", prop: "creator", min: 130 }
        ]
        showcol: this.showCol,
        allcol: [],
        tableColumn:this.setColumnVisible(this.showCol)
      }
      this.tableList.allcol = this.tableList.tableColumn.filter(ele=>!ele.default).map(ele=>ele.label);
    },
    selTableCol(val) {
      this.showcol = val;
      this.tableList.tableColumn = this.setColumnVisible(val);
    },
    // 请求数据
    async getData() {
@@ -137,18 +159,24 @@
          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
        }
      })
    },
    // 搜索
    searchClick(val, content) {
      console.log(val, content)
      this.search = content
      this.getData()
    },
    resetClick() {
      this.search = ""
      this.getData()
    },
    onFilterSearch(searchText){
      this.search = searchText
      this.search = searchText ?? ''
      this.pagerOptions.currPage = 1
      this.getData()
    },
    // 新建
@@ -217,8 +245,9 @@
              this.$message.warning("提交失败")
            }
          })
        },(e)=>{
          console.error(e)
        })
        .catch(() => {})
    },
    // 详情