| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345 |
- <template>
- <div v-loading="loading">
- <div class="white-box">
- <div class="filter-box">
- <filter-user :filter-types="filterTypes" @select-value="handleFilterUser"></filter-user>
- </div>
- <el-table ref="wrapper" :data="tableData" stripe style="width: 100%;" @selection-change="handleSelectionChange" :height="tool.getTableHeight()">
- <el-table-column fixed type="selection" width="55" v-if="tableHeaders"></el-table-column>
- <el-table-column v-for="(tableHeader, key) in tableHeaders" :key="key" :label="tableHeader.header"
- :width="tableHeader.other.width ? tableHeader.other.width : ''" :fixed="tableHeader.index=='USER_NAME' || tableHeader.index=='REAL_NAME' ?true:false">
- <template slot-scope="scope">
- <template v-if="scope.row[tableHeader.index].other.tag">
- <el-tag
- :type="scope.row[tableHeader.index].other.tag.type ? scope.row[tableHeader.index].other.tag.type : null"
- :size="scope.row[tableHeader.index].other.tag.size ? scope.row[tableHeader.index].other.tag.size : null"
- :class="scope.row[tableHeader.index].other.tag.class ? scope.row[tableHeader.index].other.tag.class : null">
- {{scope.row[tableHeader.index].value}}
- </el-tag>
- </template>
- <template v-else>
- <template v-if="tableHeader.index === 'USER_NAME'">
- <el-dropdown v-if="permission.hasPermission(`user/login-to-frontend`)">
- <span class="el-dropdown-link">
- {{scope.row.USER_NAME.value}} <i class="el-icon-arrow-down el-icon--right"></i>
- </span>
- <el-dropdown-menu slot="dropdown">
- <el-dropdown-item command="login" v-show="scope.row.BTF_URL !== null">
- <a :href="`${frontendServer}/#/login-by-backend?${scope.row.BTF_URL}`" target="_blank" style="color:#606266;">
- Quick logon<!-- 快速登录 -->
- </a>
- </el-dropdown-item>
- </el-dropdown-menu>
- </el-dropdown>
- <el-tag type="primary" size="small" class="no-border" v-if="!permission.hasPermission(`user/login-to-frontend`)">
- {{scope.row.USER_NAME.value}}
- </el-tag>
- </template>
- <template v-else>
- <div v-html="scope.row[tableHeader.index].value"></div>
- </template>
- </template>
- </template>
- </el-table-column>
- <el-table-column fixed="right" label="Action" width="180"><!-- 操作 -->
- <template slot-scope="scope">
- <el-dropdown size="small" trigger="click">
- <el-button type="primary" size="small" @click.stop="">
- Action<!-- 操作该数据 --><i class="el-icon-arrow-down el-icon--right"></i>
- </el-button>
- <el-dropdown-menu slot="dropdown">
- <el-dropdown-item @click.native="handleModifyPassword(scope.row)" v-if="permission.hasPermission(`user/ba-modify-password`)">
- Change Password<!-- 修改密码 -->
- </el-dropdown-item>
- <el-dropdown-item @click.native="handleModifyProfile(scope.row)" v-if="permission.hasPermission(`user/ba-modify-profile`)">
- Modify personal data<!-- 修改个人资料 -->
- </el-dropdown-item>
- <el-dropdown-item @click.native="handleStatusActive(scope.row)" v-if="permission.hasPermission(`user/ba-modify-status`)">
- Status activation<!-- 状态激活 -->
- </el-dropdown-item>
- <el-dropdown-item @click.native="handleStatusLock(scope.row)" v-if="permission.hasPermission(`user/ba-modify-status`)">
- Status lock<!-- 状态锁定 -->
- </el-dropdown-item>
- <el-dropdown-item @click.native="handleIsModifyPassword(scope.row, 1)" v-if="permission.hasPermission(`user/ba-is-modify-password-status`)">
- Open password modification<!-- 开启密码修改 -->
- </el-dropdown-item>
- <el-dropdown-item @click.native="handleIsModifyPassword(scope.row, 0)" v-if="permission.hasPermission(`user/ba-is-modify-password-status`)">
- Turn off password modification<!-- 关闭密码修改 -->
- </el-dropdown-item>
- </el-dropdown-menu>
- </el-dropdown>
- </template>
- </el-table-column>
- </el-table>
- <div class="white-box-footer">
- <el-button type="success" size="small" @click="handleExport" v-show="permission.hasPermission(`user/ba-user-list`)">
- Export Excel
- </el-button>
- <pagination :total="totalCount" :page_size="pageSize" @size-change="handleSizeChange" @current-change="handleCurrentChange"></pagination>
- </div>
- </div>
- <el-dialog :title="formModifyPassword.typeName" :visible.sync="dialogModifyPasswordVisible" width="50%">
- <el-form ref="form" :model="formModifyPassword" label-width="120px" class="form-dialog">
- <el-form-item label="type"><!-- 类型 -->
- <el-select v-model="formModifyPassword.passwordType" placeholder="Please select a type"><!-- 请选择类型 -->
- <el-option v-for="(item,key) in passwordType" :label="item.label" :value="item.type" :key="key"></el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="password"><!-- 密码 -->
- <el-input placeholder="password" v-model="formModifyPassword.password"><!-- 密码 --></el-input>
- </el-form-item>
- <el-form-item>
- <el-button type="primary" @click="handleModifyPasswordSubmit" :loading="submitPasswordButtonStat">Submit<!-- 提交 --></el-button>
- </el-form-item>
- </el-form>
- </el-dialog>
- <el-dialog :title="formModifyProfile.typeName" :visible.sync="dialogModifyProfileVisible" width="50%">
- <el-form ref="form" :model="formModifyProfile" label-width="150px" class="form-dialog">
- <el-form-item label="Member name"><!-- 会员姓名 -->
- <el-input v-model="formModifyProfile.realName"></el-input>
- </el-form-item>
- <!-- <el-form-item label="Identity No."><!– 身份证号 –>-->
- <!-- <el-input v-model="formModifyProfile.idCard"></el-input>-->
- <!-- </el-form-item>-->
- <el-form-item label="Phone Number"><!-- 手机号 -->
- <el-input v-model="formModifyProfile.mobile"></el-input>
- </el-form-item>
- <!-- <el-form-item label="Bank name"><!– 银行名称 –>-->
- <!-- <el-select v-model="formModifyProfile.openBank" placeholder="Please select a bank name"><!– 请选择银行名称 –>-->
- <!-- <el-option v-for="(item,index) in allOpenBank" :key="index" :label="item.BANK_NAME" :value="item.BANK_CODE"></el-option>-->
- <!-- </el-select>-->
- <!-- </el-form-item>-->
- <!-- <el-form-item label="Bank Address"><!– 开户行地址 –>-->
- <!-- <el-input v-model="formModifyProfile.bankAddress"></el-input>-->
- <!-- </el-form-item>-->
- <!-- <el-form-item label="Bank account number"><!– 银行帐号 –>-->
- <!-- <el-input v-model="formModifyProfile.bankNo"></el-input>-->
- <!-- </el-form-item>-->
- <el-form-item>
- <el-button type="primary" @click="handleModifyProfileSubmit" :loading="submitProfileButtonStat">
- Submit<!-- 提交 -->
- </el-button>
- </el-form-item>
- </el-form>
- </el-dialog>
- </div>
- </template>
- <script>
- import network from '../../utils/network'
- import tool from '../../utils/tool'
- import {FRONTEND_SERVER} from '@/utils/config'
- import baseInfo from '@/utils/baseInfo'
- import FilterUser from '../../components/FilterUser'
- import store from '../../utils/vuexStore'
- import permission from '@/utils/permission'
- import Pagination from '@/components/Pagination'
- import filterHelper from '../../utils/filterHelper'
- export default {
- name: 'ba-user-list',
- components: {FilterUser, Pagination},
- mounted () {
- let _this = this
- _this.getData()
- store.state.socket.onMessageCallback = this.onMessageCallback
- },
- data () {
- return {
- tableHeaders: null,
- tableData: null,
- loading: true,
- multipleSelection: [],
- currentPage: 1,
- totalPages: 1,
- totalCount: 1,
- pageSize: 20,
- frontendServer: FRONTEND_SERVER,
- tool: tool,
- permission: permission,
- filterTypes: null,
- filterModel: {},
- dialogVisible: false,
- formCloseLogin: {
- userName: null,
- typeName: 'Login management', // 登录管理
- type: null,
- isClose: 0,
- remark: '',
- areaSelected: null
- },
- regionDataPlus: store.state.regionInfo.regionData,
- apps: null,
- closeSwitch: null,
- submitButtonStat: false,
- dialogDecVisible: false,
- dialogModifyPasswordVisible: false,
- dialogModifyProfileVisible: false,
- formCloseDec: {
- userName: null,
- typeName: 'Manage entry', // 管理报单
- type: null,
- isClose: 0,
- remark: '',
- areaSelected: null
- },
- formModifyPassword: {
- userId: '',
- password: '',
- typeName: 'Change Password', // 修改密码
- passwordType: 'password'
- // remark: '',
- },
- formModifyProfile: {
- userId: '',
- typeName: 'Modify personal data', // 修改个人资料
- // nation: '',
- realName: '',
- // idCard: '',
- mobile: '',
- // openBank: '',
- // bankAddress: '',
- // bankNo: ''
- },
- passwordType: [
- {
- type: 'password',
- label: 'login password' // 登录密码
- },
- {
- type: 'payPassword',
- label: 'Payment password' // 支付密码
- }
- ],
- // allOpenBank: null,
- // allNation: null,
- submitDecButtonStat: false,
- submitPasswordButtonStat: false,
- submitProfileButtonStat: false,
- transferPropForm: {
- userIds: [],
- allowTransfer: true,
- transferProp: 100,
- withdrawProp: 0,
- remark: ''
- },
- closeUserData: null
- }
- },
- methods: {
- handleSelectionChange (val) {
- this.multipleSelection = val
- },
- handleCurrentChange (page) {
- this.getData(page, this.pageSize)
- },
- handleSizeChange (pageSize) {
- this.getData(this.currentPage, pageSize)
- },
- handleAdd () {
- this.$router.push('/user/ba-user-add')
- },
- handleFilterUser (filterData) {
- filterHelper.handleFilterUser(this, filterData)
- },
- handleFilter () {
- this.getData()
- },
- getData (page, pageSize, isLoading = true) {
- network.getPageData(this, 'user/ba-user-list', page, pageSize, this.filterModel, response => {
- this.filterTypes = response.filterTypes
- }, isLoading)
- },
- handleExport () {
- this.$confirm(`Are you sure you want to export the current data?`, 'Hint', { // (`确定要导出当前数据吗?`, '提示',
- confirmButtonText: 'confirm', // 确定
- cancelButtonText: 'cancel', // 取消
- type: 'warning'
- }).then(() => {
- return network.getData(`user/ba-user-list-export`, this.filterModel)
- }).then(response => {
- this.$message({
- message: response,
- type: 'success'
- })
- }).catch(response => {
- })
- },
- onMessageCallback (data) {
- },
- handleModifyPassword (row) {
- this.formModifyPassword.userId = row.USER_ID
- this.dialogModifyPasswordVisible = true
- },
- handleModifyProfile (row) {
- this.dialogModifyProfileVisible = true
- let vueObj = this
- network.getData('user/ba-profile-get', {id: row.USER_ID}).then(response => {
- vueObj.formModifyProfile = response.userInfo
- // vueObj.allOpenBank = response.allOpenBank
- // vueObj.allNation = response.allNation
- })
- },
- handleStatusActive (row) {
- network.postData('user/ba-modify-status',{userId: row.USER_ID, status: 1}).then(response => {
- this.$message({
- message: response,
- type: 'success'
- })
- this.getData(this.currentPage, this.pageSize)
- })
- },
- handleStatusLock (row) {
- network.postData('user/ba-modify-status',{userId: row.USER_ID, status: 0}).then(response => {
- this.$message({
- message: response,
- type: 'success'
- })
- this.getData(this.currentPage, this.pageSize)
- })
- },
- handleIsModifyPassword (row, status) {
- network.postData('user/ba-is-modify-password-status',{userId: row.USER_ID, status: status}).then(response => {
- this.$message({
- message: response,
- type: 'success'
- })
- this.getData(this.currentPage, this.pageSize)
- })
- },
- handleModifyPasswordSubmit () {
- this.submitPasswordButtonStat = true
- let path = 'user/ba-modify-password'
- network.postData(path, this.formModifyPassword).then(response => {
- this.$message({
- message: response,
- type: 'success'
- })
- this.getData(this.currentPage, this.pageSize)
- this.submitPasswordButtonStat = false
- this.dialogModifyPasswordVisible = false
- }).catch(response => {
- this.submitPasswordButtonStat = false
- })
- },
- handleModifyProfileSubmit () {
- this.submitProfileButtonStat = true
- let path = 'user/ba-modify-profile'
- network.postData(path, this.formModifyProfile).then(response => {
- this.$message({
- message: response,
- type: 'success'
- })
- this.getData(this.currentPage, this.pageSize)
- this.submitProfileButtonStat = false
- this.dialogModifyProfileVisible = false
- }).catch(response => {
- this.submitProfileButtonStat = false
- })
- }
- }
- }
- </script>
|