list.vue 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  1. <template>
  2. <div class="app-container">
  3. <div class="title-container">
  4. <breadcrumb id="breadcrumb-container" class="breadcrumb-container"/>
  5. </div>
  6. <y-page-list-layout :page-list="pageData" :page-para="listQuery" :get-page-list="getList">
  7. <template slot="left">
  8. <PermissionButton
  9. menu-code="_views_market_customer_add"
  10. class-name="filter-item"
  11. type="primary"
  12. name
  13. size="mini"
  14. :page-jump="true"
  15. round
  16. style="float: left"
  17. />
  18. <el-input
  19. v-model="listQuery.name"
  20. placeholder="客户名字"
  21. clearable
  22. style="margin-left: 20px;width: 320px;float: left;">
  23. </el-input>
  24. <el-select clearable style="margin-left: 20px;width: 200px;float: left;" v-model="listQuery.level" placeholder="客户等级">
  25. <el-option v-for="(item, index) in AllEnum['客户等级']" :key="index" :label="item" :value="item"/>
  26. </el-select>
  27. <el-button
  28. class="filter-item"
  29. style="margin-left: 10px;float: left;"
  30. type="primary"
  31. @click="searchList"
  32. round
  33. >搜索
  34. </el-button>
  35. <el-button
  36. class="filter-item"
  37. style="float: left;"
  38. round
  39. type="warning"
  40. @click="resetSearch()"
  41. >重置
  42. </el-button>
  43. </template>
  44. <template slot="right">
  45. <PermissionButton
  46. menu-code="_views_customer_template"
  47. class-name="filter-item"
  48. round
  49. icon="el-icon-download"
  50. name="下载模板"
  51. @click="handleDownload"
  52. />
  53. <PermissionButton
  54. menu-code="_views_customer_import"
  55. class-name="filter-item"
  56. round
  57. type="text"
  58. name=""
  59. style="padding: 0; margin-bottom: 10px"
  60. >
  61. <excelImport
  62. ref="uploadControl"
  63. flag="customer/importExcel"
  64. :style-type="1"
  65. title="导入"
  66. @fath="getList"
  67. />
  68. </PermissionButton>
  69. </template>
  70. <parentTable
  71. v-loading="listLoading"
  72. :data="pageData.records"
  73. slot="table"
  74. style="width: 100%;"
  75. >
  76. <el-table-column label="客户名字" align="center">
  77. <template slot-scope="{row}">
  78. <span>{{ row.name }}</span>
  79. </template>
  80. </el-table-column>
  81. <el-table-column label="市" align="center" width="120">
  82. <template slot-scope="{row}">
  83. <span>{{ row.firstCity }}</span>
  84. </template>
  85. </el-table-column>
  86. <el-table-column label="区/县" align="center" width="120">
  87. <template slot-scope="{row}">
  88. <span>{{ row.secCity }}</span>
  89. </template>
  90. </el-table-column>
  91. <el-table-column label="部门" align="center" width="120">
  92. <template slot-scope="{row}">
  93. <span>{{ row.department }}</span>
  94. </template>
  95. </el-table-column>
  96. <el-table-column label="职位" align="center" width="120">
  97. <template slot-scope="{row}">
  98. <span>{{ row.position }}</span>
  99. </template>
  100. </el-table-column>
  101. <el-table-column label="科室" align="center" width="120">
  102. <template slot-scope="{row}">
  103. <span>{{ row.section }}</span>
  104. </template>
  105. </el-table-column>
  106. <el-table-column label="联系电话" align="center" width="120">
  107. <template slot-scope="{row}">
  108. <span>{{ row.mobile }}</span>
  109. </template>
  110. </el-table-column>
  111. <el-table-column label="微信号" align="center" width="120">
  112. <template slot-scope="{row}">
  113. <span>{{ row.wechatNo }}</span>
  114. </template>
  115. </el-table-column>
  116. <el-table-column label="QQ号" align="center" width="120">
  117. <template slot-scope="{row}">
  118. <span>{{ row.qq }}</span>
  119. </template>
  120. </el-table-column>
  121. <el-table-column label="客户等级" align="center" width="120">
  122. <template slot-scope="{row}">
  123. <span v-if=" row.level==='重点客户' " style="color: red">{{row.level}}</span>
  124. <span v-if=" row.level==='普通客户' " style="color: sandybrown">{{row.level}}</span>
  125. <span v-if=" row.level==='一般客户' " style="color: green">{{row.level}}</span>
  126. </template>
  127. </el-table-column>
  128. <el-table-column label="客户地址" align="center" width="120">
  129. <template slot-scope="{row}">
  130. <span>{{ row.address }}</span>
  131. </template>
  132. </el-table-column>
  133. <el-table-column label="客户经理" align="center" width="120">
  134. <template slot-scope="{row}">
  135. <span>{{ row.userName }}</span>
  136. </template>
  137. </el-table-column>
  138. <el-table-column label="操作" align="center" width="200">
  139. <template slot-scope="{row}">
  140. <PermissionButton
  141. menu-code="_views_market_customer_detail"
  142. class-name="filter-item"
  143. name=""
  144. type="primary"
  145. :page-jump="true"
  146. :page-query="{id: row.id}"
  147. round
  148. size="mini"
  149. />
  150. <PermissionButton
  151. menu-code="_views_market_customer_remove"
  152. class-name="filter-item"
  153. name=""
  154. type="danger"
  155. round
  156. size="mini"
  157. @click="deleteInfo(row.id)"
  158. />
  159. </template>
  160. </el-table-column>
  161. </parentTable>
  162. </y-page-list-layout>
  163. </div>
  164. </template>
  165. <script>
  166. import YPageListLayout from '@/components/YPageListLayout'
  167. import Breadcrumb from '@/components/Breadcrumb'
  168. import PermissionButton from '@/components/PermissionButton/PermissionButton'
  169. export default {
  170. name: 'ViewsMarketCustomerList',
  171. components: {
  172. Breadcrumb,
  173. YPageListLayout,
  174. PermissionButton,
  175. },
  176. filters: {
  177. statusFilter(status) {
  178. const statusMap = {
  179. published: 'success',
  180. draft: 'info',
  181. deleted: 'danger',
  182. }
  183. return statusMap[status]
  184. },
  185. },
  186. data() {
  187. return {
  188. isDisable:false,
  189. tableKey: 0,
  190. pageData: { records: [] },
  191. total: 20,
  192. listLoading: true,
  193. listQuery: {
  194. page: 1,
  195. size: 10,
  196. descs: 'id',
  197. },
  198. listQueryKey: 'keyword',
  199. importLoading: false,
  200. name:null,
  201. city:null,
  202. county:null,
  203. AllEnum:[],
  204. }
  205. },
  206. created() {
  207. const that = this;
  208. that.getAllEnum();
  209. that.getList();
  210. },
  211. methods: {
  212. handleDownload() {
  213. this.$utils.exportUtil('/customer/download/importTemplate', {}, '模板下载')
  214. },
  215. getAllEnum() {
  216. const that = this;
  217. that.$api.globalConfig.getAllEnum().then(data => {
  218. if (data.code === 200) {
  219. that.AllEnum = data.data
  220. } else {
  221. this.$message({
  222. type: 'error',
  223. message: data.msg
  224. })
  225. }
  226. })
  227. },
  228. resetSearch() {
  229. this.listQuery = {
  230. current: 1,
  231. size: 10,
  232. descs: 'id',
  233. }
  234. this.getList()
  235. },
  236. removeHandle(row) {
  237. // console.log(data)
  238. const that = this
  239. that
  240. .$confirm('确认删除当前记录吗?', '警告', {
  241. confirmButtonText: '确认',
  242. cancelButtonText: '取消',
  243. type: 'warning',
  244. })
  245. .then(async () => {
  246. this.$api.customer.delete(row.id).then((res) => {
  247. if (res.code === 200) {
  248. this.$message({
  249. type: 'success',
  250. message: '删除成功',
  251. })
  252. this.getList()
  253. }
  254. })
  255. })
  256. .catch((err) => {
  257. console.error(err)
  258. })
  259. },
  260. searchList() {
  261. // 重置分页
  262. this.listQuery.page = 1
  263. this.listQuery.size = 10
  264. this.getList()
  265. },
  266. getList() {
  267. const that = this
  268. this.listLoading = true
  269. // console.log(that.listQuery)
  270. const key = {}
  271. key[this.listQueryKey] = this.listQuery.description
  272. this.$api.customer
  273. .list(Object.assign({}, that.listQuery, key))
  274. .then((res) => {
  275. that.pageData = res.data
  276. setTimeout(() => {
  277. that.listLoading = false
  278. }, 200)
  279. })
  280. .catch(() => {
  281. that.listLoading = false
  282. })
  283. },
  284. deleteInfo(id) {
  285. const that = this
  286. that.$confirm('请确认是否删除该数据?', '提示', {
  287. confirmButtonText: '确定',
  288. cancelButtonText: '取消',
  289. type: 'warning',
  290. center: true
  291. }).then(() => {
  292. that.$api.customer.delete(id).then(data => {
  293. that.loading = false
  294. if (data.code === 200) {
  295. that.getList()
  296. } else {
  297. this.$message({
  298. type: 'error',
  299. message: data.msg
  300. })
  301. }
  302. })
  303. }).catch(() => {
  304. })
  305. }
  306. },
  307. }
  308. </script>
  309. <style lang="scss" scoped>
  310. .right {
  311. flex: 1;
  312. .title {
  313. font-size: 16px;
  314. font-weight: 500;
  315. color: rgba(51, 51, 51, 1);
  316. line-height: 35px;
  317. margin-bottom: 8px;
  318. }
  319. .menu-2-box {
  320. display: flex;
  321. flex-wrap: wrap;
  322. width: 100%;
  323. }
  324. .menu-2-item {
  325. display: flex;
  326. align-items: center;
  327. color: #656565;
  328. font-size: 12px;
  329. width: 230px;
  330. height: 101px;
  331. background: rgb(255, 185, 129);
  332. border-radius: 3px;
  333. padding-left: 20px;
  334. margin-right: 10px;
  335. margin-bottom: 10px;
  336. cursor: pointer;
  337. box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12), 0 0 6px rgba(0, 0, 0, 0.04);
  338. .text {
  339. margin-left: 16px;
  340. }
  341. }
  342. }
  343. </style>