修改用户数据添加表单

master
夜笙歌 2 years ago
parent 3e0cff9f47
commit 34ba9a69fb

@ -6,35 +6,36 @@
<div class="head-container"> <div class="head-container">
<el-input <el-input
v-model="deptName" v-model="deptName"
placeholder="请输入部门名称"
clearable clearable
size="small" placeholder="请输入部门名称"
prefix-icon="el-icon-search" prefix-icon="el-icon-search"
size="small"
style="margin-bottom: 20px" style="margin-bottom: 20px"
/> />
</div> </div>
<div class="head-container"> <div class="head-container">
<el-tree <el-tree
ref="tree"
:data="deptOptions" :data="deptOptions"
:props="defaultProps"
:expand-on-click-node="false" :expand-on-click-node="false"
:filter-node-method="filterNode" :filter-node-method="filterNode"
ref="tree" :props="defaultProps"
node-key="id"
default-expand-all default-expand-all
highlight-current highlight-current
node-key="id"
@node-click="handleNodeClick" @node-click="handleNodeClick"
/> />
</div> </div>
</el-col> </el-col>
<!--用户数据--> <!--用户数据-->
<el-col :span="20" :xs="24"> <el-col :span="20" :xs="24">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> <el-form v-show="showSearch" ref="queryForm" :inline="true" :model="queryParams" label-width="68px"
size="small">
<el-form-item label="用户名称" prop="userName"> <el-form-item label="用户名称" prop="userName">
<el-input <el-input
v-model="queryParams.userName" v-model="queryParams.userName"
placeholder="请输入用户名称"
clearable clearable
placeholder="请输入用户名称"
style="width: 240px" style="width: 240px"
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
@ -42,8 +43,8 @@
<el-form-item label="手机号码" prop="phonenumber"> <el-form-item label="手机号码" prop="phonenumber">
<el-input <el-input
v-model="queryParams.phonenumber" v-model="queryParams.phonenumber"
placeholder="请输入手机号码"
clearable clearable
placeholder="请输入手机号码"
style="width: 240px" style="width: 240px"
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
@ -51,8 +52,8 @@
<el-form-item label="状态" prop="status"> <el-form-item label="状态" prop="status">
<el-select <el-select
v-model="queryParams.status" v-model="queryParams.status"
placeholder="用户状态"
clearable clearable
placeholder="用户状态"
style="width: 240px" style="width: 240px"
> >
<el-option <el-option
@ -66,16 +67,16 @@
<el-form-item label="创建时间"> <el-form-item label="创建时间">
<el-date-picker <el-date-picker
v-model="dateRange" v-model="dateRange"
style="width: 240px" end-placeholder="结束日期"
value-format="yyyy-MM-dd"
type="daterange"
range-separator="-" range-separator="-"
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期" style="width: 240px"
type="daterange"
value-format="yyyy-MM-dd"
></el-date-picker> ></el-date-picker>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button> <el-button icon="el-icon-search" size="mini" type="primary" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -83,67 +84,79 @@
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="primary" v-hasPermi="['system:user:add']"
plain
icon="el-icon-plus" icon="el-icon-plus"
plain
size="mini" size="mini"
type="primary"
@click="handleAdd" @click="handleAdd"
v-hasPermi="['system:user:add']" >新增
>新增</el-button> </el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="success" v-hasPermi="['system:user:edit']"
plain :disabled="single"
icon="el-icon-edit" icon="el-icon-edit"
plain
size="mini" size="mini"
:disabled="single" type="success"
@click="handleUpdate" @click="handleUpdate"
v-hasPermi="['system:user:edit']" >修改
>修改</el-button> </el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="danger" v-hasPermi="['system:user:remove']"
plain :disabled="multiple"
icon="el-icon-delete" icon="el-icon-delete"
plain
size="mini" size="mini"
:disabled="multiple" type="danger"
@click="handleDelete" @click="handleDelete"
v-hasPermi="['system:user:remove']" >删除
>删除</el-button> </el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="info" v-hasPermi="['system:user:import']"
plain
icon="el-icon-upload2" icon="el-icon-upload2"
plain
size="mini" size="mini"
type="info"
@click="handleImport" @click="handleImport"
v-hasPermi="['system:user:import']" >导入
>导入</el-button> </el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="warning" v-hasPermi="['system:user:export']"
plain
icon="el-icon-download" icon="el-icon-download"
plain
size="mini" size="mini"
type="warning"
@click="handleExport" @click="handleExport"
v-hasPermi="['system:user:export']" >导出
>导出</el-button> </el-button>
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar> <right-toolbar :columns="columns" :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
<el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="50" align="center" /> <el-table-column align="center" type="selection" width="50"/>
<el-table-column label="用户编号" align="center" key="userId" prop="userId" v-if="columns[0].visible" /> <el-table-column v-if="columns[0].visible" key="userId" align="center" label="用户编号" prop="userId"/>
<el-table-column label="用户名称" align="center" key="userName" prop="userName" v-if="columns[1].visible" :show-overflow-tooltip="true" /> <el-table-column v-if="columns[1].visible" key="userName" :show-overflow-tooltip="true" align="center"
<el-table-column label="用户昵称" align="center" key="nickName" prop="nickName" v-if="columns[2].visible" :show-overflow-tooltip="true" /> label="用户名称"
<el-table-column label="部门" align="center" key="deptName" prop="dept.deptName" v-if="columns[3].visible" :show-overflow-tooltip="true" /> prop="userName"/>
<el-table-column label="手机号码" align="center" key="phonenumber" prop="phonenumber" v-if="columns[4].visible" width="120" /> <el-table-column v-if="columns[2].visible" key="nickName" :show-overflow-tooltip="true" align="center"
<el-table-column label="状态" align="center" key="status" v-if="columns[5].visible"> label="用户昵称"
prop="nickName"/>
<el-table-column v-if="columns[3].visible" key="deptName" :show-overflow-tooltip="true" align="center"
label="部门"
prop="dept.deptName"/>
<el-table-column v-if="columns[4].visible" key="phonenumber" align="center" label="手机号码" prop="phonenumber"
width="120"/>
<el-table-column v-if="columns[5].visible" key="status" align="center" label="状态">
<template slot-scope="scope"> <template slot-scope="scope">
<el-switch <el-switch
v-model="scope.row.status" v-model="scope.row.status"
@ -153,39 +166,44 @@
></el-switch> ></el-switch>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" v-if="columns[6].visible" width="160"> <el-table-column v-if="columns[6].visible" align="center" label="创建时间" prop="createTime" width="160">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span> <span>{{ parseTime(scope.row.createTime) }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
label="操作"
align="center" align="center"
width="160"
class-name="small-padding fixed-width" class-name="small-padding fixed-width"
label="操作"
width="160"
> >
<template slot-scope="scope" v-if="scope.row.userId !== 1"> <template v-if="scope.row.userId !== 1" slot-scope="scope">
<el-button <el-button
v-hasPermi="['system:user:edit']"
icon="el-icon-edit"
size="mini" size="mini"
type="text" type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
v-hasPermi="['system:user:edit']" >修改
>修改</el-button> </el-button>
<el-button <el-button
v-hasPermi="['system:user:remove']"
icon="el-icon-delete"
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPermi="['system:user:remove']" >删除
>删除</el-button> </el-button>
<el-dropdown size="mini" @command="(command) => handleCommand(command, scope.row)" v-hasPermi="['system:user:resetPwd', 'system:user:edit']"> <el-dropdown v-hasPermi="['system:user:resetPwd', 'system:user:edit']" size="mini"
<el-button size="mini" type="text" icon="el-icon-d-arrow-right">更多</el-button> @command="(command) => handleCommand(command, scope.row)">
<el-button icon="el-icon-d-arrow-right" size="mini" type="text">更多</el-button>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item command="handleResetPwd" icon="el-icon-key" <el-dropdown-item v-hasPermi="['system:user:resetPwd']" command="handleResetPwd"
v-hasPermi="['system:user:resetPwd']">重置密码</el-dropdown-item> icon="el-icon-key">重置密码
<el-dropdown-item command="handleAuthRole" icon="el-icon-circle-check" </el-dropdown-item>
v-hasPermi="['system:user:edit']">分配角色</el-dropdown-item> <el-dropdown-item v-hasPermi="['system:user:edit']" command="handleAuthRole"
icon="el-icon-circle-check">分配角色
</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
</template> </template>
@ -194,50 +212,69 @@
<pagination <pagination
v-show="total>0" v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
:page.sync="queryParams.pageNum"
:total="total"
@pagination="getList" @pagination="getList"
/> />
</el-col> </el-col>
</el-row> </el-row>
<!-- 添加或修改用户配置对话框 --> <!-- 添加或修改用户配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body> <el-dialog :title="title" :visible.sync="open" append-to-body width="600px">
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-row>
<el-col :span="12">
<el-form-item label="数据ID" prop="datasourceId">
<el-select
v-model="form.datasourceId"
clearable
multiple
placeholder="请输入数据ID"
>
<el-option
v-for="item in datasourceIdList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="用户昵称" prop="nickName"> <el-form-item label="用户昵称" prop="nickName">
<el-input v-model="form.nickName" placeholder="请输入用户昵称" maxlength="30" /> <el-input v-model="form.nickName" maxlength="30" placeholder="请输入用户昵称"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="归属部门" prop="deptId"> <el-form-item label="归属部门" prop="deptId">
<treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" placeholder="请选择归属部门" /> <treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" placeholder="请选择归属部门"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="手机号码" prop="phonenumber"> <el-form-item label="手机号码" prop="phonenumber">
<el-input v-model="form.phonenumber" placeholder="请输入手机号码" maxlength="11" /> <el-input v-model="form.phonenumber" maxlength="11" placeholder="请输入手机号码"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="邮箱" prop="email"> <el-form-item label="邮箱" prop="email">
<el-input v-model="form.email" placeholder="请输入邮箱" maxlength="50" /> <el-input v-model="form.email" maxlength="50" placeholder="请输入邮箱"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item v-if="form.userId == undefined" label="用户名称" prop="userName"> <el-form-item v-if="form.userId == undefined" label="用户名称" prop="userName">
<el-input v-model="form.userName" placeholder="请输入用户名称" maxlength="30" /> <el-input v-model="form.userName" maxlength="30" placeholder="请输入用户名称"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item v-if="form.userId == undefined" label="用户密码" prop="password"> <el-form-item v-if="form.userId == undefined" label="用户密码" prop="password">
<el-input v-model="form.password" placeholder="请输入用户密码" type="password" maxlength="20" show-password/> <el-input v-model="form.password" maxlength="20" placeholder="请输入用户密码" show-password type="password"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -261,7 +298,8 @@
v-for="dict in dict.type.sys_normal_disable" v-for="dict in dict.type.sys_normal_disable"
:key="dict.value" :key="dict.value"
:label="dict.value" :label="dict.value"
>{{dict.label}}</el-radio> >{{ dict.label }}
</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -273,9 +311,9 @@
<el-option <el-option
v-for="item in postOptions" v-for="item in postOptions"
:key="item.postId" :key="item.postId"
:disabled="item.status == 1"
:label="item.postName" :label="item.postName"
:value="item.postId" :value="item.postId"
:disabled="item.status == 1"
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -286,9 +324,9 @@
<el-option <el-option
v-for="item in roleOptions" v-for="item in roleOptions"
:key="item.roleId" :key="item.roleId"
:disabled="item.status == 1"
:label="item.roleName" :label="item.roleName"
:value="item.roleId" :value="item.roleId"
:disabled="item.status == 1"
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -297,7 +335,7 @@
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="备注"> <el-form-item label="备注">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input> <el-input v-model="form.remark" placeholder="请输入内容" type="textarea"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -309,27 +347,30 @@
</el-dialog> </el-dialog>
<!-- 用户导入对话框 --> <!-- 用户导入对话框 -->
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body> <el-dialog :title="upload.title" :visible.sync="upload.open" append-to-body width="400px">
<el-upload <el-upload
ref="upload" ref="upload"
:limit="1"
accept=".xlsx, .xls"
:headers="upload.headers"
:action="upload.url + '?updateSupport=' + upload.updateSupport" :action="upload.url + '?updateSupport=' + upload.updateSupport"
:auto-upload="false"
:disabled="upload.isUploading" :disabled="upload.isUploading"
:headers="upload.headers"
:limit="1"
:on-progress="handleFileUploadProgress" :on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess" :on-success="handleFileSuccess"
:auto-upload="false" accept=".xlsx, .xls"
drag drag
> >
<i class="el-icon-upload"></i> <i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处<em>点击上传</em></div> <div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>
<div class="el-upload__tip text-center" slot="tip"> <div slot="tip" class="el-upload__tip text-center">
<div class="el-upload__tip" slot="tip"> <div slot="tip" class="el-upload__tip">
<el-checkbox v-model="upload.updateSupport" /> 是否更新已经存在的用户数据 <el-checkbox v-model="upload.updateSupport"/>
是否更新已经存在的用户数据
</div> </div>
<span>仅允许导入xlsxlsx格式文件</span> <span>仅允许导入xlsxlsx格式文件</span>
<el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" @click="importTemplate"></el-link> <el-link :underline="false" style="font-size:12px;vertical-align: baseline;" type="primary"
@click="importTemplate">下载模板
</el-link>
</div> </div>
</el-upload> </el-upload>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
@ -341,17 +382,28 @@
</template> </template>
<script> <script>
import { listUser, getUser, delUser, addUser, updateUser, resetUserPwd, changeUserStatus, deptTreeSelect } from "@/api/system/user"; import {
import { getToken } from "@/utils/auth"; listUser,
getUser,
delUser,
addUser,
updateUser,
resetUserPwd,
changeUserStatus,
deptTreeSelect
} from "@/api/system/user";
import {getToken} from "@/utils/auth";
import Treeselect from "@riophae/vue-treeselect"; import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css"; import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import {getDatasourceIdList} from "@/api/system/userdatasource";
export default { export default {
name: "User", name: "User",
dicts: ['sys_normal_disable', 'sys_user_sex'], dicts: ['sys_normal_disable', 'sys_user_sex'],
components: { Treeselect }, components: {Treeselect},
data() { data() {
return { return {
datasourceIdList: [],
// //
loading: true, loading: true,
// //
@ -399,7 +451,7 @@ export default {
// //
updateSupport: 0, updateSupport: 0,
// //
headers: { Authorization: "Bearer " + getToken() }, headers: {Authorization: "Bearer " + getToken()},
// //
url: process.env.VUE_APP_BASE_API + "/system/user/importData" url: process.env.VUE_APP_BASE_API + "/system/user/importData"
}, },
@ -414,26 +466,26 @@ export default {
}, },
// //
columns: [ columns: [
{ key: 0, label: `用户编号`, visible: true }, {key: 0, label: `用户编号`, visible: true},
{ key: 1, label: `用户名称`, visible: true }, {key: 1, label: `用户名称`, visible: true},
{ key: 2, label: `用户昵称`, visible: true }, {key: 2, label: `用户昵称`, visible: true},
{ key: 3, label: `部门`, visible: true }, {key: 3, label: `部门`, visible: true},
{ key: 4, label: `手机号码`, visible: true }, {key: 4, label: `手机号码`, visible: true},
{ key: 5, label: `状态`, visible: true }, {key: 5, label: `状态`, visible: true},
{ key: 6, label: `创建时间`, visible: true } {key: 6, label: `创建时间`, visible: true}
], ],
// //
rules: { rules: {
userName: [ userName: [
{ required: true, message: "用户名称不能为空", trigger: "blur" }, {required: true, message: "用户名称不能为空", trigger: "blur"},
{ min: 2, max: 20, message: '用户名称长度必须介于 2 和 20 之间', trigger: 'blur' } {min: 2, max: 20, message: '用户名称长度必须介于 2 和 20 之间', trigger: 'blur'}
], ],
nickName: [ nickName: [
{ required: true, message: "用户昵称不能为空", trigger: "blur" } {required: true, message: "用户昵称不能为空", trigger: "blur"}
], ],
password: [ password: [
{ required: true, message: "用户密码不能为空", trigger: "blur" }, {required: true, message: "用户密码不能为空", trigger: "blur"},
{ min: 5, max: 20, message: '用户密码长度必须介于 5 和 20 之间', trigger: 'blur' } {min: 5, max: 20, message: '用户密码长度必须介于 5 和 20 之间', trigger: 'blur'}
], ],
email: [ email: [
{ {
@ -464,6 +516,15 @@ export default {
this.getConfigKey("sys.user.initPassword").then(response => { this.getConfigKey("sys.user.initPassword").then(response => {
this.initPassword = response.msg; this.initPassword = response.msg;
}); });
getDatasourceIdList().then(e => {
console.log(e)
this.datasourceIdList = e.rows.map(val => {
return {
label: val.parkName,
value: val.id
}
})
})
}, },
methods: { methods: {
/** 查询用户列表 */ /** 查询用户列表 */
@ -495,11 +556,11 @@ export default {
// //
handleStatusChange(row) { handleStatusChange(row) {
let text = row.status === "0" ? "启用" : "停用"; let text = row.status === "0" ? "启用" : "停用";
this.$modal.confirm('确认要"' + text + '""' + row.userName + '"用户吗?').then(function() { this.$modal.confirm('确认要"' + text + '""' + row.userName + '"用户吗?').then(function () {
return changeUserStatus(row.userId, row.status); return changeUserStatus(row.userId, row.status);
}).then(() => { }).then(() => {
this.$modal.msgSuccess(text + "成功"); this.$modal.msgSuccess(text + "成功");
}).catch(function() { }).catch(function () {
row.status = row.status === "0" ? "1" : "0"; row.status = row.status === "0" ? "1" : "0";
}); });
}, },
@ -592,29 +653,30 @@ export default {
closeOnClickModal: false, closeOnClickModal: false,
inputPattern: /^.{5,20}$/, inputPattern: /^.{5,20}$/,
inputErrorMessage: "用户密码长度必须介于 5 和 20 之间" inputErrorMessage: "用户密码长度必须介于 5 和 20 之间"
}).then(({ value }) => { }).then(({value}) => {
resetUserPwd(row.userId, value).then(response => { resetUserPwd(row.userId, value).then(response => {
this.$modal.msgSuccess("修改成功,新密码是:" + value); this.$modal.msgSuccess("修改成功,新密码是:" + value);
}); });
}).catch(() => {}); }).catch(() => {
});
}, },
/** 分配角色操作 */ /** 分配角色操作 */
handleAuthRole: function(row) { handleAuthRole: function (row) {
const userId = row.userId; const userId = row.userId;
this.$router.push("/system/user-auth/role/" + userId); this.$router.push("/system/user-auth/role/" + userId);
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm: function() { submitForm: function () {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
if (this.form.userId != undefined) { if (this.form.userId != undefined) {
updateUser(this.form).then(response => { updateUser({...this.form, datasourceId: this.form.datasourceId.toString()}).then(response => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.open = false; this.open = false;
this.getList(); this.getList();
}); });
} else { } else {
addUser(this.form).then(response => { addUser({...this.form, datasourceId: this.form.datasourceId.toString()}).then(response => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");
this.open = false; this.open = false;
this.getList(); this.getList();
@ -626,12 +688,13 @@ export default {
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const userIds = row.userId || this.ids; const userIds = row.userId || this.ids;
this.$modal.confirm('是否确认删除用户编号为"' + userIds + '"的数据项?').then(function() { this.$modal.confirm('是否确认删除用户编号为"' + userIds + '"的数据项?').then(function () {
return delUser(userIds); return delUser(userIds);
}).then(() => { }).then(() => {
this.getList(); this.getList();
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");
}).catch(() => {}); }).catch(() => {
});
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
@ -646,8 +709,7 @@ export default {
}, },
/** 下载模板操作 */ /** 下载模板操作 */
importTemplate() { importTemplate() {
this.download('system/user/importTemplate', { this.download('system/user/importTemplate', {}, `user_template_${new Date().getTime()}.xlsx`)
}, `user_template_${new Date().getTime()}.xlsx`)
}, },
// //
handleFileUploadProgress(event, file, fileList) { handleFileUploadProgress(event, file, fileList) {
@ -658,7 +720,7 @@ export default {
this.upload.open = false; this.upload.open = false;
this.upload.isUploading = false; this.upload.isUploading = false;
this.$refs.upload.clearFiles(); this.$refs.upload.clearFiles();
this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true }); this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", {dangerouslyUseHTMLString: true});
this.getList(); this.getList();
}, },
// //

@ -156,7 +156,7 @@ export default {
name: "Userdatasource", name: "Userdatasource",
data() { data() {
return { return {
operationType:null, operationType: null,
// //
loading: true, loading: true,
// //
@ -273,7 +273,6 @@ export default {
submitForm() { submitForm() {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
console.log(this.operationType)
if (this.operationType === 2) { if (this.operationType === 2) {
updateUserdatasource(this.form).then(response => { updateUserdatasource(this.form).then(response => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
@ -281,7 +280,7 @@ export default {
this.getList(); this.getList();
}); });
} }
if(this.operationType === 1){ if (this.operationType === 1) {
addUserdatasource(this.form).then(response => { addUserdatasource(this.form).then(response => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");
this.open = false; this.open = false;

Loading…
Cancel
Save