list.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  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="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.resignState" 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. <parentTable
  45. v-loading="listLoading"
  46. :data="pageData.records"
  47. slot="table"
  48. style="width: 100%;"
  49. >
  50. <el-table-column label="客户名称" align="center">
  51. <template slot-scope="{row}">
  52. <span>{{ row.name }}</span>
  53. </template>
  54. </el-table-column>
  55. <el-table-column label="市" align="center" width="120">
  56. <template slot-scope="{row}">
  57. <span>{{ row.city }}</span>
  58. </template>
  59. </el-table-column>
  60. <el-table-column label="区/县" align="center" width="120">
  61. <template slot-scope="{row}">
  62. <span>{{ row.county }}</span>
  63. </template>
  64. </el-table-column>
  65. <el-table-column label="部门" align="center" width="120">
  66. <template slot-scope="{row}">
  67. <span>{{ row.department }}</span>
  68. </template>
  69. </el-table-column>
  70. <el-table-column label="职位" align="center" width="120">
  71. <template slot-scope="{row}">
  72. <span>{{ row.position }}</span>
  73. </template>
  74. </el-table-column>
  75. <el-table-column label="科室" align="center" width="120">
  76. <template slot-scope="{row}">
  77. <span>{{ row.section }}</span>
  78. </template>
  79. </el-table-column>
  80. <el-table-column label="联系电话" align="center" width="120">
  81. <template slot-scope="{row}">
  82. <span>{{ row.mobile }}</span>
  83. </template>
  84. </el-table-column>
  85. <el-table-column label="微信号" align="center" width="120">
  86. <template slot-scope="{row}">
  87. <span>{{ row.wechatNo }}</span>
  88. </template>
  89. </el-table-column>
  90. <el-table-column label="QQ号" align="center" width="120">
  91. <template slot-scope="{row}">
  92. <span>{{ row.qq }}</span>
  93. </template>
  94. </el-table-column>
  95. <el-table-column label="客户等级" align="center" width="120">
  96. <template slot-scope="{row}">
  97. <span>{{ row.level }}</span>
  98. </template>
  99. </el-table-column>
  100. <el-table-column label="客户地址" align="center" width="120">
  101. <template slot-scope="{row}">
  102. <span>{{ row.address }}</span>
  103. </template>
  104. </el-table-column>
  105. <el-table-column label="操作" align="center">
  106. <template slot-scope="{row}">
  107. <PermissionButton
  108. menu-code="_views_market_customer_detail"
  109. class-name="filter-item"
  110. name=""
  111. type="primary"
  112. :page-jump="true"
  113. :page-query="{id: row.id}"
  114. round
  115. size="mini"
  116. />
  117. <PermissionButton
  118. menu-code="_views_market_customer_remove"
  119. class-name="filter-item"
  120. name=""
  121. type="danger"
  122. round
  123. size="mini"
  124. @click="deleteInfo(row.id)"
  125. />
  126. </template>
  127. </el-table-column>
  128. </parentTable>
  129. </y-page-list-layout>
  130. </div>
  131. </template>
  132. <script>
  133. import YPageListLayout from '@/components/YPageListLayout'
  134. import Breadcrumb from '@/components/Breadcrumb'
  135. import PermissionButton from '@/components/PermissionButton/PermissionButton'
  136. export default {
  137. name: 'ViewsStaffList',
  138. components: {
  139. Breadcrumb,
  140. YPageListLayout,
  141. PermissionButton,
  142. },
  143. filters: {
  144. statusFilter(status) {
  145. const statusMap = {
  146. published: 'success',
  147. draft: 'info',
  148. deleted: 'danger',
  149. }
  150. return statusMap[status]
  151. },
  152. },
  153. data() {
  154. return {
  155. isDisable:false,
  156. tableKey: 0,
  157. pageData: { records: [] },
  158. total: 20,
  159. listLoading: true,
  160. listQuery: {
  161. page: 1,
  162. size: 10,
  163. descs: 'id',
  164. },
  165. listQueryKey: 'keyword',
  166. importLoading: false,
  167. name:null,
  168. city:null,
  169. county:null
  170. }
  171. },
  172. created() {
  173. const that = this;
  174. that.getAllEnum();
  175. that.getList();
  176. },
  177. methods: {
  178. getAllEnum() {
  179. const that = this;
  180. that.$api.globalConfig.getAllEnum().then(data => {
  181. if (data.code === 200) {
  182. that.AllEnum = data.data
  183. } else {
  184. this.$message({
  185. type: 'error',
  186. message: data.msg
  187. })
  188. }
  189. })
  190. },
  191. resetSearch() {
  192. this.listQuery = {
  193. current: 1,
  194. size: 10,
  195. descs: 'id',
  196. }
  197. this.getList()
  198. },
  199. removeHandle(row) {
  200. // console.log(data)
  201. const that = this
  202. that
  203. .$confirm('确认删除当前记录吗?', '警告', {
  204. confirmButtonText: '确认',
  205. cancelButtonText: '取消',
  206. type: 'warning',
  207. })
  208. .then(async () => {
  209. this.$api.customer.delete(row.id).then((res) => {
  210. if (res.code === 200) {
  211. this.$message({
  212. type: 'success',
  213. message: '删除成功',
  214. })
  215. this.getList()
  216. }
  217. })
  218. })
  219. .catch((err) => {
  220. console.error(err)
  221. })
  222. },
  223. searchList() {
  224. // 重置分页
  225. this.listQuery.page = 1
  226. this.listQuery.size = 10
  227. this.getList()
  228. },
  229. getList() {
  230. const that = this
  231. this.listLoading = true
  232. // console.log(that.listQuery)
  233. const key = {}
  234. key[this.listQueryKey] = this.listQuery.description
  235. this.$api.customer
  236. .list(Object.assign({}, that.listQuery, key))
  237. .then((res) => {
  238. that.pageData = res.data
  239. setTimeout(() => {
  240. that.listLoading = false
  241. }, 200)
  242. })
  243. .catch(() => {
  244. that.listLoading = false
  245. })
  246. },
  247. deleteInfo(id) {
  248. const that = this
  249. that.$confirm('请确认是否删除该数据?', '提示', {
  250. confirmButtonText: '确定',
  251. cancelButtonText: '取消',
  252. type: 'warning',
  253. center: true
  254. }).then(() => {
  255. that.$api.customer.delete(id).then(data => {
  256. that.loading = false
  257. if (data.code === 200) {
  258. that.getList()
  259. } else {
  260. this.$message({
  261. type: 'error',
  262. message: data.msg
  263. })
  264. }
  265. })
  266. }).catch(() => {
  267. })
  268. }
  269. },
  270. }
  271. </script>
  272. <style lang="scss" scoped>
  273. .right {
  274. flex: 1;
  275. .title {
  276. font-size: 16px;
  277. font-weight: 500;
  278. color: rgba(51, 51, 51, 1);
  279. line-height: 35px;
  280. margin-bottom: 8px;
  281. }
  282. .menu-2-box {
  283. display: flex;
  284. flex-wrap: wrap;
  285. width: 100%;
  286. }
  287. .menu-2-item {
  288. display: flex;
  289. align-items: center;
  290. color: #656565;
  291. font-size: 12px;
  292. width: 230px;
  293. height: 101px;
  294. background: rgb(255, 185, 129);
  295. border-radius: 3px;
  296. padding-left: 20px;
  297. margin-right: 10px;
  298. margin-bottom: 10px;
  299. cursor: pointer;
  300. box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12), 0 0 6px rgba(0, 0, 0, 0.04);
  301. .text {
  302. margin-left: 16px;
  303. }
  304. }
  305. }
  306. </style>