dealer_list.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. <template>
  2. <div class="app-container">
  3. <div v-if="isShow">
  4. <!-- 筛选条件 -->
  5. <div>
  6. <el-form
  7. ref="searchForm"
  8. :model="searchForm"
  9. label-width="70px"
  10. size="small"
  11. label-position="left"
  12. >
  13. <el-row :gutter="20">
  14. <el-col :xs="24" :sm="12" :lg="6">
  15. <el-form-item label="名称" prop="keyword">
  16. <el-input
  17. v-model="searchForm.keyword"
  18. placeholder="请输入名称"
  19. ></el-input>
  20. </el-form-item>
  21. </el-col>
  22. <el-col :xs="24" :sm="12" :lg="18" class="tr">
  23. <el-form-item label="">
  24. <el-button size="small" @click="clearFn">清空</el-button>
  25. <el-button size="small" type="primary" @click="searchFn"
  26. >搜索</el-button
  27. >
  28. </el-form-item>
  29. </el-col>
  30. </el-row>
  31. </el-form>
  32. </div>
  33. <!-- 按钮 -->
  34. <div class="btn-group clearfix">
  35. <div class="fr">
  36. <ExportButton :exUrl="'/customer/export'" :exParams="exParams" />
  37. </div>
  38. </div>
  39. <div class="mymain-container">
  40. <div class="table">
  41. <el-table
  42. v-loading="listLoading"
  43. :data="dataList"
  44. element-loading-text="Loading"
  45. border
  46. fit
  47. highlight-current-row
  48. stripe
  49. >
  50. <el-table-column
  51. align="center"
  52. label="客户编码"
  53. prop="number"
  54. min-width="160"
  55. label-class-name="bianma"
  56. class-name="fontstyle"
  57. ></el-table-column>
  58. <el-table-column
  59. align="center"
  60. label="客户名称"
  61. prop="name"
  62. min-width="160"
  63. show-overflow-tooltip
  64. ></el-table-column>
  65. <el-table-column
  66. align="center"
  67. label="简称"
  68. prop="shortName"
  69. min-width="160"
  70. show-overflow-tooltip
  71. ></el-table-column>
  72. <el-table-column
  73. prop="forbidStatus"
  74. align="center"
  75. label="禁用状态"
  76. min-width="160"
  77. show-overflow-tooltip
  78. >
  79. <template slot-scope="scope">
  80. <el-tag type="success" v-if="scope.row.forbidStatus === 'A'"
  81. >正常</el-tag
  82. >
  83. <el-tag type="danger" v-else-if="scope.row.flag === 'B'"
  84. >禁用</el-tag
  85. >
  86. </template>
  87. </el-table-column>
  88. <el-table-column
  89. align="center"
  90. label="使用组织"
  91. prop="useOrgName"
  92. min-width="160"
  93. show-overflow-tooltip
  94. ></el-table-column>
  95. <el-table-column
  96. align="center"
  97. label="更新人"
  98. prop="updateBy"
  99. min-width="160"
  100. show-overflow-tooltip
  101. ></el-table-column>
  102. <el-table-column
  103. align="center"
  104. label="更新时间"
  105. prop="updateTime"
  106. min-width="160"
  107. show-overflow-tooltip
  108. ></el-table-column>
  109. <el-table-column
  110. align="center"
  111. label="操作"
  112. prop="caozuo"
  113. min-width="160"
  114. show-overflow-tooltip
  115. fixed="right"
  116. >
  117. <template slot-scope="scope">
  118. <el-button
  119. type="text"
  120. class="textColor"
  121. @click="editFn(scope.row.id)"
  122. >详情</el-button
  123. >
  124. </template>
  125. </el-table-column>
  126. </el-table>
  127. </div>
  128. <!-- 分页 -->
  129. <div class="fr">
  130. <el-pagination
  131. @size-change="handleSizeChange"
  132. @current-change="handleCurrentChange"
  133. :current-page="currentPage"
  134. :page-sizes="[10, 20, 30, 50]"
  135. :page-size="10"
  136. layout="total, sizes, prev, pager, next, jumper"
  137. :total="listTotal"
  138. >
  139. </el-pagination>
  140. </div>
  141. </div>
  142. </div>
  143. <DealerListDetail :infoList="inforList" v-else />
  144. </div>
  145. </template>
  146. <script>
  147. import { getDealerList, getDealerInfo } from "@/api/basic_data/dealer";
  148. import DealerListDetail from "./components/dealer_list-detail.vue";
  149. export default {
  150. data() {
  151. return {
  152. isShow: true,
  153. dataList: [], // 列表数据
  154. listLoading: false, // 列表加载loading
  155. screenForm: {},
  156. currentPage: 1, // 当前页码
  157. pageSize: 10, // 每页数量
  158. listTotal: 0, // 列表总数
  159. searchForm: {
  160. keyword: "",
  161. },
  162. inforList: {},
  163. };
  164. },
  165. components: {
  166. DealerListDetail,
  167. },
  168. async created() {
  169. await this.getList({ pageNum: 1, pageSize: 10 });
  170. },
  171. computed: {
  172. exParams() {
  173. return {
  174. keyword: this.searchForm.keyword,
  175. };
  176. },
  177. },
  178. methods: {
  179. // 提交筛选表单
  180. submitScreenForm() {
  181. this.currentPage = 1;
  182. this.getList({ pageNum: 1, pageSize: 10 });
  183. },
  184. // 重置筛选表单
  185. resetScreenForm() {
  186. this.$refs.screenForm.resetFields();
  187. this.currentPage = 1;
  188. this.getList({ pageNum: 1, pageSize: 10 });
  189. },
  190. // 更改每页数量
  191. handleSizeChange(val) {
  192. this.pageSize = val;
  193. this.currentPage = 1;
  194. this.getList({ pageNum: 1, pageSize: this.pageSize });
  195. },
  196. // 更改当前页
  197. handleCurrentChange(val) {
  198. this.currentPage = val;
  199. this.getList({ pageNum: val, pageSize: 10 });
  200. },
  201. //搜索功能
  202. async searchFn() {
  203. console.log(this.searchForm);
  204. await this.getList({ ...this.searchForm, pageNum: 1, pageSize: 10 });
  205. },
  206. //重置
  207. clearFn() {
  208. console.log(this.$refs.searchForm);
  209. this.$refs.searchForm.resetFields();
  210. },
  211. //获取列表数据
  212. async getList(data) {
  213. const res = await getDealerList(data);
  214. console.log(res);
  215. this.dataList = res.data.records;
  216. this.listTotal = res.data.total;
  217. },
  218. async editFn(id) {
  219. this.isShow = false;
  220. const res = await getDealerInfo({ id });
  221. this.inforList = res.data;
  222. },
  223. },
  224. };
  225. </script>
  226. <style lang="scss" scoped></style>