|
|
|
|
@ -8,14 +8,14 @@ |
|
|
|
|
<pane size="84"> |
|
|
|
|
<el-col> |
|
|
|
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> |
|
|
|
|
<el-form-item label="类型名称" prop="userName"> |
|
|
|
|
<el-input v-model="queryParams.userName" placeholder="请输入类型名称" clearable style="width: 240px" @keyup.enter.native="handleQuery" /> |
|
|
|
|
<el-form-item label="类型名称" prop="name"> |
|
|
|
|
<el-input v-model="queryParams.name" placeholder="请输入类型名称" clearable style="width: 240px" @keyup.enter.native="handleQuery" /> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="状态" prop="status"> |
|
|
|
|
<!-- <el-form-item label="状态" prop="status"> |
|
|
|
|
<el-select v-model="queryParams.status" placeholder="类型状态" clearable style="width: 240px"> |
|
|
|
|
<el-option v-for="dict in dict.type.sys_normal_disable" :key="dict.value" :label="dict.label" :value="dict.value" /> |
|
|
|
|
</el-select> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-form-item> --> |
|
|
|
|
<el-form-item label="创建时间"> |
|
|
|
|
<el-date-picker v-model="dateRange" style="width: 240px" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker> |
|
|
|
|
</el-form-item> |
|
|
|
|
@ -43,23 +43,22 @@ |
|
|
|
|
|
|
|
|
|
<el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange"> |
|
|
|
|
<el-table-column type="selection" width="50" align="center" /> |
|
|
|
|
<el-table-column label="类型编号" align="center" key="userId" prop="userId" v-if="columns[0].visible" /> |
|
|
|
|
<el-table-column label="设备类型名称" align="center" key="userName" prop="userName" v-if="columns[1].visible" :show-overflow-tooltip="true" /> |
|
|
|
|
<el-table-column label="描述" align="center" key="userName" prop="userName" v-if="columns[1].visible" :show-overflow-tooltip="true" /> |
|
|
|
|
<el-table-column label="图片" align="center" key="userName" prop="userName" v-if="columns[1].visible" :show-overflow-tooltip="true" /> |
|
|
|
|
<el-table-column label="创建人" align="center" key="userName" prop="userName" v-if="columns[1].visible" :show-overflow-tooltip="true" /> |
|
|
|
|
<!-- <el-table-column label="状态" align="center" key="status" v-if="columns[5].visible"> |
|
|
|
|
<el-table-column label="类型编号" align="center" key="Id" prop="Id"/> |
|
|
|
|
<el-table-column label="设备类型名称" align="center" key="name" prop="name" :show-overflow-tooltip="true" /> |
|
|
|
|
<el-table-column label="描述" align="center" key="description" prop="description" :show-overflow-tooltip="true" /> |
|
|
|
|
<el-table-column label="图片" align="center" key="image" prop="image" :show-overflow-tooltip="true" > |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<el-switch v-model="scope.row.status" active-value="0" inactive-value="1" @change="handleStatusChange(scope.row)"></el-switch> |
|
|
|
|
<ImagePreview :src="scope.row.image"/> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> --> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="创建人" align="center" key="CreateBy" prop="CreateBy" :show-overflow-tooltip="true" /> |
|
|
|
|
<el-table-column label="创建时间" align="center" prop="createTime" v-if="columns[6].visible" width="160"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<span>{{ parseTime(scope.row.createTime) }}</span> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="操作" align="center" width="160" class-name="small-padding fixed-width"> |
|
|
|
|
<template slot-scope="scope" v-if="scope.row.userId !== 1"> |
|
|
|
|
<template slot-scope="scope" v-if="scope.row.Id !== 1"> |
|
|
|
|
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['device:deviceType:edit']">修改</el-button> |
|
|
|
|
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['device:deviceType:remove']">删除</el-button> |
|
|
|
|
</template> |
|
|
|
|
@ -77,62 +76,20 @@ |
|
|
|
|
<el-row :gutter="20"> |
|
|
|
|
<!-- 类型昵称 + 手机号码 --> |
|
|
|
|
<el-col :span="12"> |
|
|
|
|
<el-form-item label="类型昵称" prop="nickName"> |
|
|
|
|
<el-input v-model="form.nickName" placeholder="请输入类型昵称" maxlength="30" /> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-col> |
|
|
|
|
<el-col :span="12"> |
|
|
|
|
<el-form-item label="手机号码" prop="phonenumber"> |
|
|
|
|
<el-input v-model="form.phonenumber" placeholder="请输入手机号码" maxlength="11" /> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-col> |
|
|
|
|
|
|
|
|
|
<!-- 邮箱 + 类型名称 --> |
|
|
|
|
<el-col :span="12"> |
|
|
|
|
<el-form-item label="邮箱" prop="email"> |
|
|
|
|
<el-input v-model="form.email" placeholder="请输入邮箱" maxlength="50" /> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-col> |
|
|
|
|
<el-col :span="12"> |
|
|
|
|
<el-form-item v-if="form.userId == undefined" label="类型名称" prop="userName"> |
|
|
|
|
<el-input v-model="form.userName" placeholder="请输入类型名称" maxlength="30" /> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-col> |
|
|
|
|
|
|
|
|
|
<!-- 类型密码(仅新增)+ 类型性别 --> |
|
|
|
|
<el-col :span="12"> |
|
|
|
|
<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-form-item> |
|
|
|
|
</el-col> |
|
|
|
|
<el-col :span="12"> |
|
|
|
|
<el-form-item label="类型性别"> |
|
|
|
|
<el-select v-model="form.sex" placeholder="请选择性别" style="width: 100%"> |
|
|
|
|
<el-option v-for="dict in dict.type.sys_user_sex" :key="dict.value" :label="dict.label" :value="dict.value"></el-option> |
|
|
|
|
</el-select> |
|
|
|
|
</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 dict.type.sys_normal_disable" :key="dict.value" :label="dict.value">{{ dict.label }}</el-radio> |
|
|
|
|
</el-radio-group> |
|
|
|
|
<el-form-item label="设备名称" prop="name"> |
|
|
|
|
<el-input v-model="form.name" placeholder="请输入类型昵称" maxlength="30" /> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-col> |
|
|
|
|
<el-col :span="12"> |
|
|
|
|
<el-form-item label="角色"> |
|
|
|
|
<el-select v-model="form.roleIds" multiple placeholder="请选择角色" style="width: 100%"> |
|
|
|
|
<el-option v-for="item in roleOptions" :key="item.roleId" :label="item.roleName" :value="item.roleId" :disabled="item.status == 1"></el-option> |
|
|
|
|
</el-select> |
|
|
|
|
<el-form-item label="设备图片" prop="phonenumber"> |
|
|
|
|
<ImageUpload/> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-col> |
|
|
|
|
|
|
|
|
|
<!-- 备注(单独一行) --> |
|
|
|
|
<el-col :span="24"> |
|
|
|
|
<el-form-item label="备注"> |
|
|
|
|
<el-input v-model="form.remark" type="textarea" :rows="3" placeholder="请输入内容" /> |
|
|
|
|
<el-form-item label="描述"> |
|
|
|
|
<el-input v-model="form.description" type="textarea" :rows="3" placeholder="请输入内容" /> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-col> |
|
|
|
|
</el-row> |
|
|
|
|
@ -238,7 +195,7 @@ export default { |
|
|
|
|
queryParams: { |
|
|
|
|
pageNum: 1, |
|
|
|
|
pageSize: 10, |
|
|
|
|
userName: undefined, |
|
|
|
|
name: undefined, |
|
|
|
|
phonenumber: undefined, |
|
|
|
|
status: undefined, |
|
|
|
|
deptId: undefined |
|
|
|
|
@ -256,11 +213,11 @@ export default { |
|
|
|
|
|
|
|
|
|
// 表单校验 |
|
|
|
|
rules: { |
|
|
|
|
userName: [ |
|
|
|
|
name: [ |
|
|
|
|
{ required: true, message: "类型名称不能为空", trigger: "blur" }, |
|
|
|
|
{ min: 2, max: 20, message: '类型名称长度必须介于 2 和 20 之间', trigger: 'blur' } |
|
|
|
|
], |
|
|
|
|
nickName: [ |
|
|
|
|
name: [ |
|
|
|
|
{ required: true, message: "类型昵称不能为空", trigger: "blur" } |
|
|
|
|
], |
|
|
|
|
password: [ |
|
|
|
|
@ -341,8 +298,8 @@ export default { |
|
|
|
|
// 类型状态修改 |
|
|
|
|
handleStatusChange(row) { |
|
|
|
|
let text = row.status === "0" ? "启用" : "停用" |
|
|
|
|
this.$modal.confirm('确认要"' + text + '""' + row.userName + '"类型吗?').then(function() { |
|
|
|
|
return changeUserStatus(row.userId, row.status) |
|
|
|
|
this.$modal.confirm('确认要"' + text + '""' + row.name + '"类型吗?').then(function() { |
|
|
|
|
return changeUserStatus(row.Id, row.status) |
|
|
|
|
}).then(() => { |
|
|
|
|
this.$modal.msgSuccess(text + "成功") |
|
|
|
|
}).catch(function() { |
|
|
|
|
@ -357,16 +314,16 @@ export default { |
|
|
|
|
// 表单重置 |
|
|
|
|
reset() { |
|
|
|
|
this.form = { |
|
|
|
|
userId: undefined, |
|
|
|
|
Id: undefined, |
|
|
|
|
deptId: undefined, |
|
|
|
|
userName: undefined, |
|
|
|
|
nickName: undefined, |
|
|
|
|
name: undefined, |
|
|
|
|
name: undefined, |
|
|
|
|
password: undefined, |
|
|
|
|
phonenumber: undefined, |
|
|
|
|
email: undefined, |
|
|
|
|
sex: undefined, |
|
|
|
|
status: "0", |
|
|
|
|
remark: undefined, |
|
|
|
|
description: undefined, |
|
|
|
|
postIds: [], |
|
|
|
|
roleIds: [] |
|
|
|
|
} |
|
|
|
|
@ -387,7 +344,7 @@ export default { |
|
|
|
|
}, |
|
|
|
|
// 多选框选中数据 |
|
|
|
|
handleSelectionChange(selection) { |
|
|
|
|
this.ids = selection.map(item => item.userId) |
|
|
|
|
this.ids = selection.map(item => item.Id) |
|
|
|
|
this.single = selection.length != 1 |
|
|
|
|
this.multiple = !selection.length |
|
|
|
|
}, |
|
|
|
|
@ -418,8 +375,8 @@ export default { |
|
|
|
|
/** 修改按钮操作 */ |
|
|
|
|
handleUpdate(row) { |
|
|
|
|
this.reset() |
|
|
|
|
const userId = row.userId || this.ids |
|
|
|
|
getUser(userId).then(response => { |
|
|
|
|
const Id = row.Id || this.ids |
|
|
|
|
getUser(Id).then(response => { |
|
|
|
|
this.form = response.data |
|
|
|
|
this.postOptions = response.posts |
|
|
|
|
this.roleOptions = response.roles |
|
|
|
|
@ -432,7 +389,7 @@ export default { |
|
|
|
|
}, |
|
|
|
|
/** 重置密码按钮操作 */ |
|
|
|
|
handleResetPwd(row) { |
|
|
|
|
this.$prompt('请输入"' + row.userName + '"的新密码', "提示", { |
|
|
|
|
this.$prompt('请输入"' + row.name + '"的新密码', "提示", { |
|
|
|
|
confirmButtonText: "确定", |
|
|
|
|
cancelButtonText: "取消", |
|
|
|
|
closeOnClickModal: false, |
|
|
|
|
@ -444,21 +401,21 @@ export default { |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
}).then(({ value }) => { |
|
|
|
|
resetUserPwd(row.userId, value).then(response => { |
|
|
|
|
resetUserPwd(row.Id, value).then(response => { |
|
|
|
|
this.$modal.msgSuccess("修改成功,新密码是:" + value) |
|
|
|
|
}) |
|
|
|
|
}).catch(() => {}) |
|
|
|
|
}, |
|
|
|
|
/** 分配角色操作 */ |
|
|
|
|
handleAuthRole: function(row) { |
|
|
|
|
const userId = row.userId |
|
|
|
|
this.$router.push("/system/user-auth/role/" + userId) |
|
|
|
|
const Id = row.Id |
|
|
|
|
this.$router.push("/system/user-auth/role/" + Id) |
|
|
|
|
}, |
|
|
|
|
/** 提交按钮 */ |
|
|
|
|
submitForm: function() { |
|
|
|
|
this.$refs["form"].validate(valid => { |
|
|
|
|
if (valid) { |
|
|
|
|
if (this.form.userId != undefined) { |
|
|
|
|
if (this.form.Id != undefined) { |
|
|
|
|
updateUser(this.form).then(response => { |
|
|
|
|
this.$modal.msgSuccess("修改成功") |
|
|
|
|
this.open = false |
|
|
|
|
@ -476,9 +433,9 @@ export default { |
|
|
|
|
}, |
|
|
|
|
/** 删除按钮操作 */ |
|
|
|
|
handleDelete(row) { |
|
|
|
|
const userIds = row.userId || this.ids |
|
|
|
|
this.$modal.confirm('是否确认删除类型编号为"' + userIds + '"的数据项?').then(function() { |
|
|
|
|
return delUser(userIds) |
|
|
|
|
const Ids = row.Id || this.ids |
|
|
|
|
this.$modal.confirm('是否确认删除类型编号为"' + Ids + '"的数据项?').then(function() { |
|
|
|
|
return delUser(Ids) |
|
|
|
|
}).then(() => { |
|
|
|
|
this.getList() |
|
|
|
|
this.$modal.msgSuccess("删除成功") |
|
|
|
|
|