supplier_list.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <template>
  2. <div class="app-container">
  3. <div v-if="isShow">
  4. <!-- 筛选条件 -->
  5. <div>
  6. <el-form ref="searchForm" :model="searchForm" label-width="70px" size="small" label-position="left">
  7. <el-row :gutter="20">
  8. <el-col :xs="24" :sm="12" :lg="6">
  9. <el-form-item label="名称" prop="name">
  10. <el-input v-model="searchForm.name" placeholder="请输入名称"></el-input>
  11. </el-form-item>
  12. </el-col>
  13. <el-col :xs="24" :sm="12" :lg="18" class="tr">
  14. <el-form-item label="">
  15. <el-button size="small" @click="clearFn">清空</el-button>
  16. <el-button size="small" type="primary" @click="searchFn">搜索</el-button>
  17. </el-form-item>
  18. </el-col>
  19. </el-row>
  20. </el-form>
  21. </div>
  22. <!-- 表格 -->
  23. <div class="mymain-container">
  24. <div class="table">
  25. <el-table v-loading="listLoading" :data="dataList" element-loading-text="Loading" border fit highlight-current-row stripe>
  26. <el-table-column align="center" label="编码" prop="number" min-width="60" label-class-name="bianma" class-name="fontstyle"></el-table-column>
  27. <el-table-column align="center" label="使用组织" prop="useOrgName" min-width="160"></el-table-column>
  28. <el-table-column align="center" label="名称" prop="name" min-width="200"></el-table-column>
  29. <el-table-column align="center" label="简称" prop="shortName" min-width="160"></el-table-column>
  30. <el-table-column align="center" label="供应商分组" prop="groupName" min-width="160"></el-table-column>
  31. <el-table-column align="center" label="操作" prop="caozuo" min-width="160" show-overflow-tooltip fixed="right">
  32. <template slot-scope="scope">
  33. <el-button type="text" class="textColor" @click="editFn(scope.row.id)">详情</el-button>
  34. </template>
  35. </el-table-column>
  36. </el-table>
  37. </div>
  38. <div class="fr">
  39. <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage" :page-sizes="[10, 20, 30, 50]" :page-size="10" layout="total, sizes, prev, pager, next, jumper" :total="listTotal">
  40. </el-pagination>
  41. </div>
  42. </div>
  43. </div>
  44. <SupplierListDetail :infoList="infoList" v-else />
  45. </div>
  46. </template>
  47. <script>
  48. import { getList, getInfoApi } from "@/api/basic_data/supplier";
  49. import SupplierListDetail from "./components/supplier_list-detail.vue";
  50. export default {
  51. data() {
  52. return {
  53. currentPage: 1, // 当前页码
  54. pageSize: 10, // 每页数量
  55. listTotal: 0, // 列表总数
  56. listLoading: false, // 加载
  57. screenForm: {}, // 筛选表单数据
  58. dataList: [], // 表格数据
  59. isShow: true,
  60. searchForm: {
  61. // 筛选表单数据
  62. name: "",
  63. },
  64. dataList: [],
  65. infoList: {},
  66. };
  67. },
  68. components: {
  69. SupplierListDetail,
  70. },
  71. async created() {
  72. await this.getList({ pageSize: 10, pageNum: 1 });
  73. },
  74. methods: {
  75. async getList(data) {
  76. const res = await getList(data);
  77. console.log(res);
  78. this.dataList = res.data.records;
  79. this.listTotal = res.data.total;
  80. },
  81. //搜索功能
  82. async searchFn() {
  83. console.log(this.searchForm);
  84. await this.getList({ ...this.searchForm, pageNum: 1, pageSize: 10 });
  85. },
  86. //重置
  87. clearFn() {
  88. console.log(this.$refs.searchForm);
  89. this.$refs.searchForm.resetFields();
  90. },
  91. // 更改每页数量
  92. handleSizeChange(val) {
  93. this.pageSize = val;
  94. this.currentPage = 1;
  95. this.getList({ pageNum: 1, pageSize: this.pageSize });
  96. },
  97. // 更改当前页
  98. handleCurrentChange(val) {
  99. this.currentPage = val;
  100. this.getList({ pageNum: val, pageSize: 10 });
  101. },
  102. async editFn(id) {
  103. this.isShow = false;
  104. const res = await getInfoApi({ id });
  105. this.infoList = res.data;
  106. },
  107. async getList(data) {
  108. let res = await getList(data);
  109. console.log(res);
  110. this.dataList = res.data.records;
  111. this.listTotal = res.data.total;
  112. },
  113. // 更改每页数量
  114. handleSizeChange(val) {
  115. this.pageSize = val;
  116. this.currentPage = 1;
  117. this.getList({ pageNum: 1, pageSize: this.pageSize });
  118. },
  119. // 更改当前页
  120. handleCurrentChange(val) {
  121. this.currentPage = val;
  122. this.getList({ pageNum: val, pageSize: 10 });
  123. },
  124. },
  125. };
  126. </script>
  127. <style lang="scss" scoped>
  128. .base {
  129. padding: 20px;
  130. }
  131. .fr {
  132. margin-top: 20px;
  133. }
  134. </style>