ba-user-list.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345
  1. <template>
  2. <div v-loading="loading">
  3. <div class="white-box">
  4. <div class="filter-box">
  5. <filter-user :filter-types="filterTypes" @select-value="handleFilterUser"></filter-user>
  6. </div>
  7. <el-table ref="wrapper" :data="tableData" stripe style="width: 100%;" @selection-change="handleSelectionChange" :height="tool.getTableHeight()">
  8. <el-table-column fixed type="selection" width="55" v-if="tableHeaders"></el-table-column>
  9. <el-table-column v-for="(tableHeader, key) in tableHeaders" :key="key" :label="tableHeader.header"
  10. :width="tableHeader.other.width ? tableHeader.other.width : ''" :fixed="tableHeader.index=='USER_NAME' || tableHeader.index=='REAL_NAME' ?true:false">
  11. <template slot-scope="scope">
  12. <template v-if="scope.row[tableHeader.index].other.tag">
  13. <el-tag
  14. :type="scope.row[tableHeader.index].other.tag.type ? scope.row[tableHeader.index].other.tag.type : null"
  15. :size="scope.row[tableHeader.index].other.tag.size ? scope.row[tableHeader.index].other.tag.size : null"
  16. :class="scope.row[tableHeader.index].other.tag.class ? scope.row[tableHeader.index].other.tag.class : null">
  17. {{scope.row[tableHeader.index].value}}
  18. </el-tag>
  19. </template>
  20. <template v-else>
  21. <template v-if="tableHeader.index === 'USER_NAME'">
  22. <el-dropdown v-if="permission.hasPermission(`user/login-to-frontend`)">
  23. <span class="el-dropdown-link">
  24. {{scope.row.USER_NAME.value}} <i class="el-icon-arrow-down el-icon--right"></i>
  25. </span>
  26. <el-dropdown-menu slot="dropdown">
  27. <el-dropdown-item command="login" v-show="scope.row.BTF_URL !== null">
  28. <a :href="`${frontendServer}/#/login-by-backend?${scope.row.BTF_URL}`" target="_blank" style="color:#606266;">
  29. Quick logon<!-- 快速登录 -->
  30. </a>
  31. </el-dropdown-item>
  32. </el-dropdown-menu>
  33. </el-dropdown>
  34. <el-tag type="primary" size="small" class="no-border" v-if="!permission.hasPermission(`user/login-to-frontend`)">
  35. {{scope.row.USER_NAME.value}}
  36. </el-tag>
  37. </template>
  38. <template v-else>
  39. <div v-html="scope.row[tableHeader.index].value"></div>
  40. </template>
  41. </template>
  42. </template>
  43. </el-table-column>
  44. <el-table-column fixed="right" label="Action" width="180"><!-- 操作 -->
  45. <template slot-scope="scope">
  46. <el-dropdown size="small" trigger="click">
  47. <el-button type="primary" size="small" @click.stop="">
  48. Action<!-- 操作该数据 --><i class="el-icon-arrow-down el-icon--right"></i>
  49. </el-button>
  50. <el-dropdown-menu slot="dropdown">
  51. <el-dropdown-item @click.native="handleModifyPassword(scope.row)" v-if="permission.hasPermission(`user/ba-modify-password`)">
  52. Change Password<!-- 修改密码 -->
  53. </el-dropdown-item>
  54. <el-dropdown-item @click.native="handleModifyProfile(scope.row)" v-if="permission.hasPermission(`user/ba-modify-profile`)">
  55. Modify personal data<!-- 修改个人资料 -->
  56. </el-dropdown-item>
  57. <el-dropdown-item @click.native="handleStatusActive(scope.row)" v-if="permission.hasPermission(`user/ba-modify-status`)">
  58. Status activation<!-- 状态激活 -->
  59. </el-dropdown-item>
  60. <el-dropdown-item @click.native="handleStatusLock(scope.row)" v-if="permission.hasPermission(`user/ba-modify-status`)">
  61. Status lock<!-- 状态锁定 -->
  62. </el-dropdown-item>
  63. <el-dropdown-item @click.native="handleIsModifyPassword(scope.row, 1)" v-if="permission.hasPermission(`user/ba-is-modify-password-status`)">
  64. Open password modification<!-- 开启密码修改 -->
  65. </el-dropdown-item>
  66. <el-dropdown-item @click.native="handleIsModifyPassword(scope.row, 0)" v-if="permission.hasPermission(`user/ba-is-modify-password-status`)">
  67. Turn off password modification<!-- 关闭密码修改 -->
  68. </el-dropdown-item>
  69. </el-dropdown-menu>
  70. </el-dropdown>
  71. </template>
  72. </el-table-column>
  73. </el-table>
  74. <div class="white-box-footer">
  75. <el-button type="success" size="small" @click="handleExport" v-show="permission.hasPermission(`user/ba-user-list`)">
  76. Export Excel
  77. </el-button>
  78. <pagination :total="totalCount" :page_size="pageSize" @size-change="handleSizeChange" @current-change="handleCurrentChange"></pagination>
  79. </div>
  80. </div>
  81. <el-dialog :title="formModifyPassword.typeName" :visible.sync="dialogModifyPasswordVisible" width="50%">
  82. <el-form ref="form" :model="formModifyPassword" label-width="120px" class="form-dialog">
  83. <el-form-item label="type"><!-- 类型 -->
  84. <el-select v-model="formModifyPassword.passwordType" placeholder="Please select a type"><!-- 请选择类型 -->
  85. <el-option v-for="(item,key) in passwordType" :label="item.label" :value="item.type" :key="key"></el-option>
  86. </el-select>
  87. </el-form-item>
  88. <el-form-item label="password"><!-- 密码 -->
  89. <el-input placeholder="password" v-model="formModifyPassword.password"><!-- 密码 --></el-input>
  90. </el-form-item>
  91. <el-form-item>
  92. <el-button type="primary" @click="handleModifyPasswordSubmit" :loading="submitPasswordButtonStat">Submit<!-- 提交 --></el-button>
  93. </el-form-item>
  94. </el-form>
  95. </el-dialog>
  96. <el-dialog :title="formModifyProfile.typeName" :visible.sync="dialogModifyProfileVisible" width="50%">
  97. <el-form ref="form" :model="formModifyProfile" label-width="150px" class="form-dialog">
  98. <el-form-item label="Member name"><!-- 会员姓名 -->
  99. <el-input v-model="formModifyProfile.realName"></el-input>
  100. </el-form-item>
  101. <!-- <el-form-item label="Identity No.">&lt;!&ndash; 身份证号 &ndash;&gt;-->
  102. <!-- <el-input v-model="formModifyProfile.idCard"></el-input>-->
  103. <!-- </el-form-item>-->
  104. <el-form-item label="Phone Number"><!-- 手机号 -->
  105. <el-input v-model="formModifyProfile.mobile"></el-input>
  106. </el-form-item>
  107. <!-- <el-form-item label="Bank name">&lt;!&ndash; 银行名称 &ndash;&gt;-->
  108. <!-- <el-select v-model="formModifyProfile.openBank" placeholder="Please select a bank name">&lt;!&ndash; 请选择银行名称 &ndash;&gt;-->
  109. <!-- <el-option v-for="(item,index) in allOpenBank" :key="index" :label="item.BANK_NAME" :value="item.BANK_CODE"></el-option>-->
  110. <!-- </el-select>-->
  111. <!-- </el-form-item>-->
  112. <!-- <el-form-item label="Bank Address">&lt;!&ndash; 开户行地址 &ndash;&gt;-->
  113. <!-- <el-input v-model="formModifyProfile.bankAddress"></el-input>-->
  114. <!-- </el-form-item>-->
  115. <!-- <el-form-item label="Bank account number">&lt;!&ndash; 银行帐号 &ndash;&gt;-->
  116. <!-- <el-input v-model="formModifyProfile.bankNo"></el-input>-->
  117. <!-- </el-form-item>-->
  118. <el-form-item>
  119. <el-button type="primary" @click="handleModifyProfileSubmit" :loading="submitProfileButtonStat">
  120. Submit<!-- 提交 -->
  121. </el-button>
  122. </el-form-item>
  123. </el-form>
  124. </el-dialog>
  125. </div>
  126. </template>
  127. <script>
  128. import network from '../../utils/network'
  129. import tool from '../../utils/tool'
  130. import {FRONTEND_SERVER} from '@/utils/config'
  131. import baseInfo from '@/utils/baseInfo'
  132. import FilterUser from '../../components/FilterUser'
  133. import store from '../../utils/vuexStore'
  134. import permission from '@/utils/permission'
  135. import Pagination from '@/components/Pagination'
  136. import filterHelper from '../../utils/filterHelper'
  137. export default {
  138. name: 'ba-user-list',
  139. components: {FilterUser, Pagination},
  140. mounted () {
  141. let _this = this
  142. _this.getData()
  143. store.state.socket.onMessageCallback = this.onMessageCallback
  144. },
  145. data () {
  146. return {
  147. tableHeaders: null,
  148. tableData: null,
  149. loading: true,
  150. multipleSelection: [],
  151. currentPage: 1,
  152. totalPages: 1,
  153. totalCount: 1,
  154. pageSize: 20,
  155. frontendServer: FRONTEND_SERVER,
  156. tool: tool,
  157. permission: permission,
  158. filterTypes: null,
  159. filterModel: {},
  160. dialogVisible: false,
  161. formCloseLogin: {
  162. userName: null,
  163. typeName: 'Login management', // 登录管理
  164. type: null,
  165. isClose: 0,
  166. remark: '',
  167. areaSelected: null
  168. },
  169. regionDataPlus: store.state.regionInfo.regionData,
  170. apps: null,
  171. closeSwitch: null,
  172. submitButtonStat: false,
  173. dialogDecVisible: false,
  174. dialogModifyPasswordVisible: false,
  175. dialogModifyProfileVisible: false,
  176. formCloseDec: {
  177. userName: null,
  178. typeName: 'Manage entry', // 管理报单
  179. type: null,
  180. isClose: 0,
  181. remark: '',
  182. areaSelected: null
  183. },
  184. formModifyPassword: {
  185. userId: '',
  186. password: '',
  187. typeName: 'Change Password', // 修改密码
  188. passwordType: 'password'
  189. // remark: '',
  190. },
  191. formModifyProfile: {
  192. userId: '',
  193. typeName: 'Modify personal data', // 修改个人资料
  194. // nation: '',
  195. realName: '',
  196. // idCard: '',
  197. mobile: '',
  198. // openBank: '',
  199. // bankAddress: '',
  200. // bankNo: ''
  201. },
  202. passwordType: [
  203. {
  204. type: 'password',
  205. label: 'login password' // 登录密码
  206. },
  207. {
  208. type: 'payPassword',
  209. label: 'Payment password' // 支付密码
  210. }
  211. ],
  212. // allOpenBank: null,
  213. // allNation: null,
  214. submitDecButtonStat: false,
  215. submitPasswordButtonStat: false,
  216. submitProfileButtonStat: false,
  217. transferPropForm: {
  218. userIds: [],
  219. allowTransfer: true,
  220. transferProp: 100,
  221. withdrawProp: 0,
  222. remark: ''
  223. },
  224. closeUserData: null
  225. }
  226. },
  227. methods: {
  228. handleSelectionChange (val) {
  229. this.multipleSelection = val
  230. },
  231. handleCurrentChange (page) {
  232. this.getData(page, this.pageSize)
  233. },
  234. handleSizeChange (pageSize) {
  235. this.getData(this.currentPage, pageSize)
  236. },
  237. handleAdd () {
  238. this.$router.push('/user/ba-user-add')
  239. },
  240. handleFilterUser (filterData) {
  241. filterHelper.handleFilterUser(this, filterData)
  242. },
  243. handleFilter () {
  244. this.getData()
  245. },
  246. getData (page, pageSize, isLoading = true) {
  247. network.getPageData(this, 'user/ba-user-list', page, pageSize, this.filterModel, response => {
  248. this.filterTypes = response.filterTypes
  249. }, isLoading)
  250. },
  251. handleExport () {
  252. this.$confirm(`Are you sure you want to export the current data?`, 'Hint', { // (`确定要导出当前数据吗?`, '提示',
  253. confirmButtonText: 'confirm', // 确定
  254. cancelButtonText: 'cancel', // 取消
  255. type: 'warning'
  256. }).then(() => {
  257. return network.getData(`user/ba-user-list-export`, this.filterModel)
  258. }).then(response => {
  259. this.$message({
  260. message: response,
  261. type: 'success'
  262. })
  263. }).catch(response => {
  264. })
  265. },
  266. onMessageCallback (data) {
  267. },
  268. handleModifyPassword (row) {
  269. this.formModifyPassword.userId = row.USER_ID
  270. this.dialogModifyPasswordVisible = true
  271. },
  272. handleModifyProfile (row) {
  273. this.dialogModifyProfileVisible = true
  274. let vueObj = this
  275. network.getData('user/ba-profile-get', {id: row.USER_ID}).then(response => {
  276. vueObj.formModifyProfile = response.userInfo
  277. // vueObj.allOpenBank = response.allOpenBank
  278. // vueObj.allNation = response.allNation
  279. })
  280. },
  281. handleStatusActive (row) {
  282. network.postData('user/ba-modify-status',{userId: row.USER_ID, status: 1}).then(response => {
  283. this.$message({
  284. message: response,
  285. type: 'success'
  286. })
  287. this.getData(this.currentPage, this.pageSize)
  288. })
  289. },
  290. handleStatusLock (row) {
  291. network.postData('user/ba-modify-status',{userId: row.USER_ID, status: 0}).then(response => {
  292. this.$message({
  293. message: response,
  294. type: 'success'
  295. })
  296. this.getData(this.currentPage, this.pageSize)
  297. })
  298. },
  299. handleIsModifyPassword (row, status) {
  300. network.postData('user/ba-is-modify-password-status',{userId: row.USER_ID, status: status}).then(response => {
  301. this.$message({
  302. message: response,
  303. type: 'success'
  304. })
  305. this.getData(this.currentPage, this.pageSize)
  306. })
  307. },
  308. handleModifyPasswordSubmit () {
  309. this.submitPasswordButtonStat = true
  310. let path = 'user/ba-modify-password'
  311. network.postData(path, this.formModifyPassword).then(response => {
  312. this.$message({
  313. message: response,
  314. type: 'success'
  315. })
  316. this.getData(this.currentPage, this.pageSize)
  317. this.submitPasswordButtonStat = false
  318. this.dialogModifyPasswordVisible = false
  319. }).catch(response => {
  320. this.submitPasswordButtonStat = false
  321. })
  322. },
  323. handleModifyProfileSubmit () {
  324. this.submitProfileButtonStat = true
  325. let path = 'user/ba-modify-profile'
  326. network.postData(path, this.formModifyProfile).then(response => {
  327. this.$message({
  328. message: response,
  329. type: 'success'
  330. })
  331. this.getData(this.currentPage, this.pageSize)
  332. this.submitProfileButtonStat = false
  333. this.dialogModifyProfileVisible = false
  334. }).catch(response => {
  335. this.submitProfileButtonStat = false
  336. })
  337. }
  338. }
  339. }
  340. </script>