Newer
Older
smartKitchenFront / src / views / supplier / supplierList.vue
liuyangyingjie on 26 Oct 2022 6 KB first commit
<template>
  <div class="product_container">
    <div class="productFun">
      <div class="productInput">
        供应商编号
        <div class="inputBox" style="width: 120px">
          <el-input
            placeholder="请输入编号"
            v-model="selectInfo.supplierCode"
            clearable
            class="product-input"
          >
          </el-input>
        </div>
        供应商名称
        <div class="inputBox" style="width: 144px">
          <el-input
            placeholder="请输入名称"
            v-model="selectInfo.supplierName"
            clearable
            class="product-input"
          >
          </el-input>
        </div>
        供应商
        <div class="inputBox" style="width: 144px">
          <input-vue title="商机状态" class="inputWidth">
              <el-select
                v-model="selectInfo.supplierStatus"
                filterable
                clearable 
                placeholder="商机状态"
                style="width: 200px"
              >
                <el-option
                  v-for="item in options"
                  :key="item.supplierStatus"
                  :label="item.supplierStatusName"
                  :value="item.supplierStatus"
                >
                </el-option> </el-select
            ></input-vue>
        </div>
      </div>
      <div class="productBtn">
        <el-button type="primary" icon="el-icon-search" class="btnItem"
          @click="selectData">查询</el-button>
        <el-button type="primary" icon="el-icon-refresh-right" class="btnItem"
         @click="reset" >重置</el-button>
         <el-button type="primary" icon="el-icon-folder-opened" class="btnItem"
          @click="exportToExcel">导出</el-button
        >
      </div>
    </div>
    <el-table
     ref="multipleTable"
      :data="tableData.rows"
      :row-class-name="tableRowClassName"
      :header-cell-style="{
        'text-align': 'center',
        background: '  #2483b3',
        color: 'white',
      }"
      :row-style="{ 'text-align': 'center' }"
      style="width: 100%"
    >
      <!-- <el-table-column type="selection" width="55"> </el-table-column> -->
      <el-table-column prop="index" label="序号"> </el-table-column>
      <el-table-column prop="supplierCode" label="供应商编号"> </el-table-column>
      <el-table-column prop="supplierName" label="供应商名称"> </el-table-column>
      <el-table-column prop="supplierStatusName" label="供应商状态"> </el-table-column>
      <el-table-column prop="preReviewResultName" label="资料预审结果"> </el-table-column>
      <el-table-column prop="preReviewResult" label="录库评审结果"> </el-table-column>
      <el-table-column prop="latestQuarterlyEvaluateResultName" label="最近赛季评价结果"> </el-table-column>
      <el-table-column prop="inputReviewResultName" label="最新年度考核结果"> </el-table-column>
      <el-table-column label="操作">
        <template slot-scope="scope">
          <el-button @click="handleClick(scope.row)" type="text" size="small"
            >详情</el-button
          >
          <!-- <el-button type="text" size="small">编辑</el-button> -->
        </template>
      </el-table-column>
    </el-table>
   <!-- 分页组件 -->
   <group-page :limit ="limit" :total="total" :offset="offset" :count="tableData.total" @setOffset="setOffset"  @setLimit ="setLimit" v-model="isFristPage" />
    <!-- 新增弹框 -->
    <!-- <category-add-dialog  :isShowInfo="isShowAdd"  @close ="closeAdd"></category-add-dialog> -->
    <supplier-info-dialog :isShowInfo="isShowAdd"  @close ="closeAdd" :dataInfo="dataInfo"></supplier-info-dialog>
    
  </div>
</template>

<script>
//组件
import GroupPage from '../../components/mycomponent/groupPage.vue';
import SupplierInfoDialog from '../../components/mycomponent/dialog/salesDialog/supplierInfoDialog.vue';
//逻辑
import { tableRowClassName } from "../../utils/myUtils/changeTableTr";
import { listMixin} from '../../utils/myUtils/mixins/listPage'
import {  listPage,S_list} from '../../api/supplier/supplier'
import { outToExcel } from '../../utils/myUtils/exportToExcel'
export default {
  mixins:[listMixin],  // 加入分页逻辑
  components: {
    SupplierInfoDialog,
    GroupPage
  },
  data() {
    return {
      isShowAdd:false,//显示新增功能
      selectInfo :{   
        supplierCode: "",
        supplierName	:"",
        supplierStatus	:""
      },
      options:[],
      dataInfo:''
    };
  },
  mounted(){
    S_list().then(res => {
      console.log(res);
      this.options =res
    })
  },
  methods: {
    tableRowClassName: tableRowClassName,
    closeAdd(){
      this.isShowAdd=false
    },
    handleClick(row){
      this.isShowAdd=true
      
      this.dataInfo = row
    },
     // 获取指定页面
     getListPage(limit,offset){
     
      listPage(`limit=${limit}&offset=${offset}`,this.queryInfo).then(res => {
      // 得到相关数据
      res.rows.forEach((item,index)=>{
        item.index =(index+1)+((offset-1)*10)
      })
      this.tableData = res 
     })
    },
    reset(){
      this.selectInfo ={   
        distributorCode: "",
        distributorName	:""
      }
    },
    exportToExcel(){
      listPage('limit=1000000000&offset=1', {}).then(res => {
        outToExcel(res.rows)
      })
    }
  
  },
};
</script>

<style lang="scss" scoped>
.product_container {
  position: relative;
  width: 100%;
  min-height: 700px;
  overflow: auto;
  .productData {
    width: 100%;
    display: flex;
    justify-content: center;
    .middle {
      margin: 0 30px;
    }
  }
  .productFun {
    margin: 30px 0;
    display: flex;
    justify-content: space-between;
    .productInput {
      display: flex;
      align-items: center;
      .inputBox {
        margin: 0 50px 0 10px;
      }
    }
    .productBtn {
      .btnItem {
        margin-right: 10px;
        border-radius: 5px;
        // height: 32px;
        // width: 84px;
        font-size: 16px;
      }
      
    }
  }
  .footer {
    display: flex;
    justify-content: space-between;
    color: #6666;
    margin: 30px 10px;
  }
}
</style>