5 Commits

1 changed files with 58 additions and 87 deletions
Split View
  1. +58
    -87
      src/views/sysuser/index.vue

+ 58
- 87
src/views/sysuser/index.vue View File

@ -5,24 +5,12 @@
<el-col :span="24" :xs="24">
<el-form ref="queryForm" :model="queryParams" :inline="true" label-width="68px">
<el-form-item label="用户名称" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入用户名称"
clearable
size="small"
style="width: 240px"
@keyup.enter.native="handleQuery"
/>
<el-input v-model="queryParams.name" placeholder="请输入用户名称" clearable size="small" style="width: 240px"
@keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="手机号码" prop="phone">
<el-input
v-model="queryParams.phone"
placeholder="请输入手机号码"
clearable
size="small"
style="width: 240px"
@keyup.enter.native="handleQuery"
/>
<el-input v-model="queryParams.phone" placeholder="请输入手机号码" clearable size="small" style="width: 240px"
@keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
@ -31,12 +19,7 @@
</el-form-item>
</el-form>
<el-table
v-loading="loading"
:data="userList"
border
@selection-change="handleSelectionChange"
>
<el-table v-loading="loading" :data="userList" border @selection-change="handleSelectionChange">
<el-table-column type="selection" width="45" align="center" />
<el-table-column label="编号" width="100" align="center" prop="userid" />
<el-table-column label="用户名称" align="center" prop="userid" :show-overflow-tooltip="true" />
@ -44,12 +27,8 @@
<el-table-column label="手机号码" align="center" prop="phone" width="120" />
<el-table-column label="状态" width="60" align="center">
<template slot-scope="scope">
<el-switch
v-model="scope.row.status"
active-value="0"
inactive-value="1"
@change="handleStatusChange(scope.row)"
/>
<el-switch v-model="scope.row.status" active-value="0" inactive-value="1"
@change="handleStatusChange(scope.row)" />
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createdAt" width="165">
@ -57,41 +36,27 @@
<span>{{ parseTime(scope.row.createtime) }}</span>
</template>
</el-table-column>
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<el-table-column label="二维码" align="center" prop="callingcard">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
>修改</el-button>
<el-button
v-if="scope.row.role !== 'admin'"
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除</el-button>
<img style="cursor: pointer; height: 22px;" @click="viewCode(baseUrl+scope.row.callingcard)" v-if="scope.row.callingcard" :src="baseUrl+scope.row.callingcard" />
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">修改</el-button>
<el-button v-if="scope.row.role !== 'admin'" size="mini" type="text" icon="el-icon-delete"
@click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageIndex"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageIndex"
:limit.sync="queryParams.pageSize" @pagination="getList" />
</el-col>
</el-row>
<!-- 添加或修改参数配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="600px">
<el-dialog :title="title" v-if="open":visible.sync="open" width="600px">
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-row>
<el-col :span="12">
@ -107,13 +72,8 @@
<el-col :span="12">
<el-form-item label="角色" prop="role_id">
<el-select v-model="form.role_id" placeholder="请选择" @change="$forceUpdate()">
<el-option
v-for="item in roleOptions"
:key="item.role_id"
:label="item.rolename"
:value="item.role_id"
:disabled="item.status == 1"
/>
<el-option v-for="item in roleOptions" :key="item.role_id" :label="item.rolename" :value="item.role_id"
:disabled="item.status == 1" />
</el-select>
</el-form-item>
</el-col>
@ -127,17 +87,20 @@
<el-input v-model="form.email" placeholder="请输入邮箱" maxlength="50" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="状态">
<el-radio-group v-model="form.status">
<el-radio
v-for="dict in statusOptions"
:key="dict.dictValue"
:label="dict.dictValue"
>{{ dict.dictLabel }}</el-radio>
<el-radio v-for="dict in statusOptions" :key="dict.dictValue" :label="dict.dictValue">{{ dict.dictLabel
}}</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="选择图片">
<input ref="upload" class="input-upload" type="file" accept="image/*" @change="previewUploadImg($event)">
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="备注">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
@ -153,18 +116,9 @@
<!-- 用户导入对话框 -->
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px">
<el-upload
ref="upload"
:limit="1"
accept=".xlsx, .xls"
:headers="upload.headers"
:action="upload.url + '?updateSupport=' + upload.updateSupport"
:disabled="upload.isUploading"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
:auto-upload="false"
drag
>
<el-upload ref="upload" :limit="1" accept=".xlsx, .xls" :headers="upload.headers"
:action="upload.url + '?updateSupport=' + upload.updateSupport" :disabled="upload.isUploading"
:on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="false" drag>
<i class="el-icon-upload" />
<div class="el-upload__text">
将文件拖到此处
@ -188,6 +142,7 @@
import { listUser, getUser, delUser, addUser, updateUser, exportUser, resetUserPwd, changeUserStatus, importTemplate, getUserInit } from '@/api/system/sysuser'
import { getToken } from '@/utils/auth'
import { getCourts } from '@/api/login'
import { addMedia } from '@/api/questionnaire/subject'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
export default {
@ -195,6 +150,7 @@ export default {
// components: { Treeselect },
data() {
return {
baseUrl: process.env.VUE_APP_BASE_API+'/',
//
loading: true,
//
@ -304,6 +260,20 @@ export default {
this.getList()
},
methods: {
viewCode(url){
window.open(url, '_blank')
},
previewUploadImg(el) {
this.upLoadImg(el.target.files[0])
},
upLoadImg(files) {
let uploadData = new FormData();
uploadData.append('media', files);
addMedia(uploadData).then(res => {
this.msgSuccess('上传成功')
this.form.callingcard = res.data
})
},
/** 查询用户列表 */
getList() {
this.loading = true
@ -342,11 +312,11 @@ export default {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function() {
}).then(function () {
return changeUserStatus(row.userid, row.status)
}).then(() => {
this.msgSuccess(text + '成功')
}).catch(function() {
}).catch(function () {
row.status = row.status === '0' ? '1' : '0'
})
},
@ -370,7 +340,8 @@ export default {
remark: undefined,
postIds: undefined,
roleIds: undefined,
role: undefined
role: undefined,
callingcard: undefined
}
this.resetForm('form')
},
@ -444,10 +415,10 @@ export default {
this.msgError(response.msg)
}
})
}).catch(() => {})
}).catch(() => { })
},
/** 提交按钮 */
submitForm: function() {
submitForm: function () {
this.$refs['form'].validate(valid => {
if (valid) {
this.roleOptions.forEach(item => {
@ -489,12 +460,12 @@ export default {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function() {
}).then(function () {
return delUser(userids)
}).then(() => {
this.getList()
this.msgSuccess('删除成功')
}).catch(function() {})
}).catch(function () { })
},
/** 导出按钮操作 */
handleExport() {
@ -503,11 +474,11 @@ export default {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function() {
}).then(function () {
return exportUser(queryParams)
}).then(response => {
this.download(response.msg)
}).catch(function() {})
}).catch(function () { })
},
/** 导入按钮操作 */
handleImport() {


Loading…
Cancel
Save