dealer_list.vue 6.1 KB

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