dealer_list.vue 5.6 KB

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