dealer_list.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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="keyword">
  10. <el-input v-model="searchForm.keyword" 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="btn-group clearfix">
  24. <div class="fr">
  25. <ExportButton :exUrl="'/customer/export'" :exParams="exParams" />
  26. </div>
  27. </div>
  28. <div class="mymain-container">
  29. <div class="table">
  30. <el-table v-loading="listLoading" :data="dataList" element-loading-text="Loading" border fit highlight-current-row stripe>
  31. <el-table-column align="center" label="客户编码" prop="number" min-width="100"></el-table-column>
  32. <el-table-column align="center" label="客户名称" prop="name" min-width="260" show-overflow-tooltip></el-table-column>
  33. <el-table-column align="center" label="简称" prop="shortName" min-width="200" show-overflow-tooltip></el-table-column>
  34. <el-table-column prop="forbidStatus" align="center" label="禁用状态" min-width="100" show-overflow-tooltip>
  35. <template slot-scope="scope">
  36. <el-tag type="success" v-if="scope.row.forbidStatus === 'A'">正常</el-tag>
  37. <el-tag type="danger" v-else-if="scope.row.flag === 'B'">禁用</el-tag>
  38. </template>
  39. </el-table-column>
  40. <el-table-column align="center" label="使用组织" prop="useOrgName" min-width="160" show-overflow-tooltip></el-table-column>
  41. <el-table-column align="center" label="更新人" prop="updateBy" min-width="160" show-overflow-tooltip></el-table-column>
  42. <el-table-column align="center" label="更新时间" prop="updateTime" min-width="160" show-overflow-tooltip></el-table-column>
  43. <el-table-column align="center" label="操作" prop="caozuo" min-width="160" show-overflow-tooltip fixed="right">
  44. <template slot-scope="scope">
  45. <el-button type="text" class="textColor" @click="editFn(scope.row.id)">详情</el-button>
  46. </template>
  47. </el-table-column>
  48. </el-table>
  49. </div>
  50. <!-- 分页 -->
  51. <div class="fr">
  52. <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">
  53. </el-pagination>
  54. </div>
  55. </div>
  56. </div>
  57. <DealerListDetail :infoList="inforList" v-else />
  58. </div>
  59. </template>
  60. <script>
  61. import { getDealerList, getDealerInfo } from "@/api/basic_data/dealer";
  62. import DealerListDetail from "./components/dealer_list-detail.vue";
  63. export default {
  64. data() {
  65. return {
  66. isShow: true,
  67. dataList: [], // 列表数据
  68. listLoading: false, // 列表加载loading
  69. screenForm: {},
  70. currentPage: 1, // 当前页码
  71. pageSize: 10, // 每页数量
  72. listTotal: 0, // 列表总数
  73. searchForm: {
  74. keyword: "",
  75. },
  76. inforList: {},
  77. };
  78. },
  79. components: {
  80. DealerListDetail,
  81. },
  82. async created() {
  83. await this.getList({ pageNum: 1, pageSize: 10 });
  84. },
  85. computed: {
  86. exParams() {
  87. return {
  88. keyword: this.searchForm.keyword,
  89. };
  90. },
  91. },
  92. methods: {
  93. // 提交筛选表单
  94. submitScreenForm() {
  95. this.currentPage = 1;
  96. this.getList({ pageNum: 1, pageSize: 10 });
  97. },
  98. // 重置筛选表单
  99. resetScreenForm() {
  100. this.$refs.screenForm.resetFields();
  101. this.currentPage = 1;
  102. this.getList({ pageNum: 1, pageSize: 10 });
  103. },
  104. // 更改每页数量
  105. handleSizeChange(val) {
  106. this.pageSize = val;
  107. this.currentPage = 1;
  108. this.getList({ pageNum: 1, pageSize: this.pageSize });
  109. },
  110. // 更改当前页
  111. handleCurrentChange(val) {
  112. this.currentPage = val;
  113. this.getList({ pageNum: val, pageSize: 10 });
  114. },
  115. //搜索功能
  116. async searchFn() {
  117. console.log(this.searchForm);
  118. await this.getList({ ...this.searchForm, pageNum: 1, pageSize: 10 });
  119. },
  120. //重置
  121. clearFn() {
  122. console.log(this.$refs.searchForm);
  123. this.$refs.searchForm.resetFields();
  124. },
  125. //获取列表数据
  126. async getList(data) {
  127. const res = await getDealerList(data);
  128. console.log(res);
  129. this.dataList = res.data.records;
  130. this.listTotal = res.data.total;
  131. },
  132. async editFn(id) {
  133. this.isShow = false;
  134. const res = await getDealerInfo({ id });
  135. this.inforList = res.data;
  136. },
  137. },
  138. };
  139. </script>
  140. <style lang="scss" scoped></style>