registeredUser.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. <template>
  2. <div class="registeredUser-baseInfo">
  3. <a-page-header :ghost="false" title="注册用户" :backIcon="false" class="registeredUser-back">
  4. <template slot="subTitle">
  5. <a href="javascript:;" @click="handleBack" id="registeredUser-handleBack">
  6. <a-icon type="left"></a-icon> 返回上页
  7. </a>
  8. </template>
  9. </a-page-header>
  10. <a-card size="small" :bordered="false">
  11. <a-spin :spinning="spinning" tip="Loading...">
  12. <div ref="tableSearch" class="table-page-search-wrapper">
  13. <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
  14. <a-row :gutter="15">
  15. <a-col :md="5" :sm="24">
  16. <a-form-item label="注册时间">
  17. <rangeDate ref="rangeDate" v-model="time" @change="dateChange" />
  18. </a-form-item>
  19. </a-col>
  20. <a-col :md="5" :sm="24">
  21. <a-form-item label="手机号码">
  22. <a-input id="registeredUser-mobile" v-model.trim="queryParam.mobile" allowClear placeholder="请输入手机号码"/>
  23. </a-form-item>
  24. </a-col>
  25. <a-col :md="4" :sm="24">
  26. <a-form-item label="用户类型">
  27. <v-select id="registeredUser-sysUserFlag" code="USER_TYPE" v-model="queryParam.sysUserFlag" allowClear placeholder="请选择用户类型"></v-select>
  28. </a-form-item>
  29. </a-col>
  30. <a-col :md="5" :sm="24">
  31. <a-form-item label="汽车修理厂">
  32. <storeList ref="storeList" @change="storeChange" id="registeredUser-storeChange"></storeList>
  33. </a-form-item>
  34. </a-col>
  35. <template v-if="advanced">
  36. <a-col :md="4" :sm="24">
  37. <a-form-item label="职位">
  38. <v-select id="registeredUser-storeManagerFlag" code="USER_JOB" v-model="queryParam.storeManagerFlag" allowClear placeholder="请选择职位"></v-select>
  39. </a-form-item>
  40. </a-col>
  41. <a-col :md="5" :sm="24">
  42. <a-form-item label="配件经销商">
  43. <dealerList ref="dealerList" @change="dealerChange" id="registeredUser-dealerChange"></dealerList>
  44. </a-form-item>
  45. </a-col>
  46. </template>
  47. <a-col :md="4" :sm="24" style="margin-bottom: 10px;">
  48. <a-button type="primary" @click="$refs.table.refresh(true)" id="registeredUser-refresh">查询</a-button>
  49. <a-button type="" @click="reset" style="margin-left: 10px;" id="registeredUser-reset">重置</a-button>
  50. <a @click="advanced=!advanced" style="margin-left: 8px">
  51. {{ advanced ? '收起' : '展开' }}
  52. <a-icon :type="advanced ? 'up' : 'down'"/>
  53. </a>
  54. </a-col>
  55. </a-row>
  56. </a-form>
  57. </div>
  58. <div class="table-operator" v-if="countData">
  59. <a-alert type="info">
  60. <div slot="message" class="total-bar">
  61. <div>
  62. 用户数量:<strong>{{ countData.userTotal||0 }}</strong>;
  63. 累计vin扫描次数合计:<strong>{{ countData.vinCount||0 }}</strong>;
  64. </div>
  65. </div>
  66. </a-alert>
  67. </div>
  68. <s-table
  69. class="sTable fixPagination"
  70. ref="table"
  71. :style="{ height: tableHeight+84.5+'px', wordBreak: 'break-all' }"
  72. size="small"
  73. rowKey="id"
  74. :columns="columns"
  75. :data="loadData"
  76. :scroll="{ y: tableHeight }"
  77. :defaultLoadData="false"
  78. bordered>
  79. <span slot="customTitle">
  80. <a-popover>
  81. <template slot="content">
  82. 表示以用户身份的vin扫描次数,<br>而不是用户所在门店的vin扫描次数
  83. </template>
  84. <a-icon type="question-circle" theme="twoTone" />
  85. </a-popover>
  86. 累计vin扫描次数
  87. </span>
  88. </s-table>
  89. </a-spin>
  90. </a-card>
  91. </div>
  92. </template>
  93. <script>
  94. import { STable, VSelect } from '@/components'
  95. import rangeDate from '@/views/common/rangeDate.vue'
  96. import { registerUserQueryPage, queryStatistics } from '@/api/report.js'
  97. import dealerList from '@/views/common/dealerList.vue'
  98. import storeList from '@/views/common/storeList.vue'
  99. import { toThousands } from '@/libs/tools.js'
  100. export default {
  101. name: 'UserList',
  102. components: { STable, VSelect, rangeDate, dealerList, storeList },
  103. data () {
  104. return {
  105. spinning: false,
  106. advanced: false,
  107. tableHeight: 0,
  108. time: [],
  109. // 查询参数
  110. queryParam: {
  111. beginDate: '',
  112. endDate: '',
  113. mobile: '',
  114. storeManagerFlag: undefined,
  115. sysUserFlag: undefined,
  116. dealerSn: undefined,
  117. storeSn: undefined
  118. },
  119. showModal: false,
  120. itemData: null, // 编辑行数据
  121. openStatusModal: false, // 货架状态弹窗初始状态
  122. countData: null,
  123. // 表头
  124. columns: [
  125. { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
  126. { title: '注册时间', dataIndex: 'registerDate', width: '15%', align: 'left', customRender: function (text) { return text || '--' } },
  127. { title: '手机号码', dataIndex: 'mobile', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  128. { title: '用户类型', dataIndex: 'sysUserFlagDictValue', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  129. { title: '汽车修理厂', dataIndex: 'storeName', width: '20%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  130. { title: '职位', dataIndex: 'storeManagerFlagDictValue', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  131. { title: '配件经销商', dataIndex: 'dealerName', width: '20%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  132. { slots: { title: 'customTitle' }, dataIndex: 'vinCount', width: '10%', align: 'center', customRender: function (text) { return toThousands(text, 2) || '--' } }
  133. ],
  134. // 加载数据方法 必须为 Promise 对象
  135. loadData: parameter => {
  136. this.spinning = true
  137. const params = Object.assign(parameter, this.queryParam)
  138. return registerUserQueryPage(params).then(res => {
  139. let data
  140. if (res.status == 200) {
  141. data = res.data
  142. const no = (data.pageNo - 1) * data.pageSize
  143. for (let i = 0; i < data.list.length; i++) {
  144. const _item = data.list[i]
  145. _item.no = no + i + 1
  146. }
  147. }
  148. this.getCount(params)
  149. this.spinning = false
  150. return data
  151. })
  152. }
  153. }
  154. },
  155. methods: {
  156. handleBack () {
  157. this.$router.go(-1)
  158. },
  159. getCount (params) {
  160. queryStatistics(params).then(res => {
  161. this.countData = res.data || null
  162. })
  163. },
  164. // 时间 change
  165. dateChange (date) {
  166. this.queryParam.beginDate = date[0]
  167. this.queryParam.endDate = date[1]
  168. },
  169. // 经销商 change
  170. dealerChange (obj) {
  171. this.queryParam.dealerSn = obj.key || undefined
  172. },
  173. // 汽车修理厂 change
  174. storeChange (obj) {
  175. this.queryParam.storeSn = obj.key || undefined
  176. },
  177. // 重置
  178. reset () {
  179. this.queryParam = {
  180. beginDate: '',
  181. endDate: '',
  182. mobile: '',
  183. storeManagerFlag: undefined,
  184. sysUserFlag: undefined,
  185. dealerSn: undefined,
  186. storeSn: undefined
  187. }
  188. this.time = []
  189. this.$refs.rangeDate.resetDate('')
  190. this.$refs.table.refresh(true)
  191. if (this.advanced) {
  192. this.$refs.dealerList.resetForm()
  193. }
  194. this.$refs.storeList.resetForm()
  195. },
  196. pageInit () {
  197. const _this = this
  198. this.$nextTick(() => { // 页面渲染完成后的回调
  199. _this.setTableH()
  200. _this.reset()
  201. })
  202. },
  203. setTableH () {
  204. const tableSearchH = this.$refs.tableSearch.offsetHeight
  205. this.tableHeight = window.innerHeight - tableSearchH - 255
  206. }
  207. },
  208. watch: {
  209. advanced (newValue, oldValue) {
  210. const _this = this
  211. this.$nextTick(() => { // 页面渲染完成后的回调
  212. _this.setTableH()
  213. })
  214. },
  215. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  216. this.setTableH()
  217. }
  218. },
  219. mounted () {
  220. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  221. this.pageInit()
  222. }
  223. },
  224. activated () {
  225. // 如果是新页签打开,则重置当前页面
  226. if (this.$store.state.app.isNewTab) {
  227. this.pageInit()
  228. }
  229. }
  230. }
  231. </script>
  232. <style lang="less">
  233. .registeredUser-baseInfo{
  234. .registeredUser-back{
  235. margin-bottom: 6px;
  236. }
  237. }
  238. </style>