first commit
This commit is contained in:
@@ -0,0 +1,472 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
<div id="app" v-cloak>
|
||||
<el-card shadow="never">
|
||||
<search @search="doSearch">
|
||||
<search-item label="所属单位">
|
||||
<el-select clearable filterable placeholder="请选择所属单位" style="width: 100%" v-model="pageForm.searchUnit" @change="doSearch">
|
||||
<el-option :key="item.id" :label="item.name" :value="item.id" v-for="item in units"></el-option>
|
||||
</el-select>
|
||||
<!-- <el-cascader :props="props" v-model="parentUnitSearch" placeholder="请选择单位" clearable filterable></el-cascader>-->
|
||||
</search-item>
|
||||
<search-item>
|
||||
<el-input placeholder="请输入内容" v-model="pageForm.searchKeyword" @keyup.enter.native="doSearch">
|
||||
<el-select v-model="pageForm.searchName" slot="prepend" placeholder="查询类型" style="width: 120px">
|
||||
<el-option label="工号" value="loginname"></el-option>
|
||||
<el-option label="姓名" value="username"></el-option>
|
||||
</el-select>
|
||||
<el-button slot="append" icon="el-icon-search" @click="doSearch"></el-button>
|
||||
</el-input>
|
||||
</search-item>
|
||||
</search>
|
||||
</el-card>
|
||||
|
||||
<el-card shadow="never">
|
||||
<table-tool>
|
||||
<el-button size="small" @click="openAdd" type="primary">
|
||||
<i class="ti-plus"></i>
|
||||
新建用户
|
||||
</el-button>
|
||||
</table-tool>
|
||||
<el-table
|
||||
:key="tableKey"
|
||||
:data="tableData"
|
||||
@sort-change="pageOrder"
|
||||
header-align="center"
|
||||
:default-sort="{prop: 'createdAt', order: 'descending'}"
|
||||
style="width: 100%"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" width="35"></el-table-column>
|
||||
<el-table-column sortable prop="loginname" label="工号" header-align="center"></el-table-column>
|
||||
<el-table-column prop="username" label="姓名" header-align="center" :show-overflow-tooltip="true"></el-table-column>
|
||||
<el-table-column prop="sex" label="性别" header-align="center" :show-overflow-tooltip="true"></el-table-column>
|
||||
<el-table-column prop="unitName" label="所属单位" header-align="center" align="center" :show-overflow-tooltip="true"></el-table-column>
|
||||
<!-- <el-table-column sortable prop="disabled" label="帐号状态" header-align="center" align="center" :show-overflow-tooltip="true">-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- <i v-if="scope.row.disabled" class="fa fa-circle text-danger ml5"></i>-->
|
||||
<!-- <i v-if="!scope.row.disabled" class="fa fa-circle text-success ml5"></i>-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<!-- <el-table-column sortable prop="userOnline" label="在线状态" header-align="center" align="center" :show-overflow-tooltip="true">-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- <i v-if="scope.row.userOnline" class="text-success ml5">在线</i>-->
|
||||
<!-- <i v-if="!scope.row.userOnline" class="text-danger ml5">离线</i>-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<el-table-column prop="userOnline" label="操作" width="120">
|
||||
<template slot-scope="scope">
|
||||
<el-dropdown @command="dropdownCommand">
|
||||
<el-button size="mini">
|
||||
<i class="ti-settings"></i>
|
||||
<span class="ti-angle-down"></span>
|
||||
</el-button>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item :command="{type:'role',id:scope.row.id,loginname:scope.row.loginname}">查看权限</el-dropdown-item>
|
||||
<el-dropdown-item :command="{type:'reset',id:scope.row.id,loginname:scope.row.loginname}">重置密码</el-dropdown-item>
|
||||
<el-dropdown-item divided :command="{type:'enable',id:scope.row.id,row:scope.row}">启用</el-dropdown-item>
|
||||
<el-dropdown-item :command="{type:'disable',id:scope.row.id,row:scope.row}">禁用</el-dropdown-item>
|
||||
<el-dropdown-item divided :command="{type:'edit',id:scope.row.id}">修改</el-dropdown-item>
|
||||
<el-dropdown-item
|
||||
:command="{type:'delete',id:scope.row.id,loginname:scope.row.loginname}"
|
||||
v-if="scope.row.loginname!='superadmin'"
|
||||
>
|
||||
删除
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--#include("/layouts/pagination.html"){}#-->
|
||||
</el-card>
|
||||
|
||||
<el-dialog title="新建用户" :visible.sync="addDialogVisible" :close-on-click-modal="false" width="40%">
|
||||
<el-form :model="formData" ref="addForm" :rules="formRules" size="small" label-width="80px">
|
||||
<el-form-item class="is-required" prop="parentUnit" label="所属单位" label-width="80px">
|
||||
<el-cascader :props="props" v-model="parentUnit" placeholder="请选择单位" filterable style="width: 100%"></el-cascader>
|
||||
</el-form-item>
|
||||
<el-form-item prop="loginname" label="工号">
|
||||
<el-input maxlength="100" placeholder="工号" v-model="formData.loginname" auto-complete="off" tabindex="2" type="text"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="username" label="姓名">
|
||||
<el-input maxlength="20" placeholder="姓名" v-model="formData.username" auto-complete="off" tabindex="3" type="text"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="password" label="登录密码">
|
||||
<el-input
|
||||
maxlength="20"
|
||||
placeholder="登录密码"
|
||||
v-model="formData.password"
|
||||
auto-complete="off"
|
||||
tabindex="4"
|
||||
type="password"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="passwordAgain" label="确认密码">
|
||||
<el-input
|
||||
maxlength="20"
|
||||
placeholder="再输一次密码"
|
||||
v-model="formData.passwordAgain"
|
||||
auto-complete="off"
|
||||
tabindex="5"
|
||||
type="password"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="mobile" label="手机号码">
|
||||
<el-input maxlength="20" placeholder="手机号码" v-model="formData.mobile" auto-complete="off" tabindex="6" type="text"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="disabled" label="启用状态">
|
||||
<el-switch v-model="formData.disabled" active-color="#ff4949" inactive-color="#13ce66"></el-switch>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="addDialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="doAdd">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
<el-dialog title="编辑用户" :visible.sync="editDialogVisible" :close-on-click-modal="false" width="40%">
|
||||
<el-form :model="formData" ref="editForm" :rules="editRules" size="small" label-width="80px">
|
||||
<el-form-item prop="loginname" label="工号">
|
||||
<el-input maxlength="100" placeholder="工号" v-model="formData.loginname" disabled tabindex="2" type="text"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="username" label="姓名">
|
||||
<el-input maxlength="20" placeholder="姓名" v-model="formData.username" auto-complete="off" tabindex="3" type="text"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="mobile" label="手机号码">
|
||||
<el-input maxlength="20" placeholder="手机号码" v-model="formData.mobile" auto-complete="off" tabindex="6" type="text"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="disabled" label="启用状态">
|
||||
<el-switch v-model="formData.disabled" active-color="#ff4949" inactive-color="#13ce66"></el-switch>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="editDialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="doEdit">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
<el-dialog :title="roleDialogTitle" :visible.sync="roleDialogVisible" width="70%">
|
||||
<el-table :data="roleTableData" style="width: 100%" size="small" :highlight-current-row="true" row-key="id" lazy :load="loadRoleChild">
|
||||
<el-table-column
|
||||
label="菜单名称"
|
||||
header-align="center"
|
||||
prop="name"
|
||||
width="200"
|
||||
:show-overflow-tooltip="true"
|
||||
align="left"
|
||||
></el-table-column>
|
||||
|
||||
<el-table-column label="URL" header-align="center" prop="href" :show-overflow-tooltip="true"></el-table-column>
|
||||
|
||||
<el-table-column label="资源类型" header-align="center" prop="type" :show-overflow-tooltip="true" align="center">
|
||||
<template slot-scope="scope">
|
||||
<i v-if="scope.row.type=='menu'" style="font-weight: bold">菜单</i>
|
||||
<i v-if="scope.row.type=='data'">数据</i>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="权限标识" header-align="center" prop="permission" :show-overflow-tooltip="true"></el-table-column>
|
||||
</el-table>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="roleDialogVisible = false">关 闭</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
<script nonce="${cspNonce!}">
|
||||
new Vue({
|
||||
el: "#app",
|
||||
mixins: [initTableMixins],
|
||||
data() {
|
||||
const self = this
|
||||
const validateLoginname = function (rule, value, callback) {
|
||||
const regex = new RegExp("^[a-zA-Z0-9][a-zA-Z0-9]{1,19}$")
|
||||
if (!regex.test(value)) {
|
||||
callback(new Error("工号以字母开头2-20字,允许使用字母/数字"))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
const validatePass = function (rule, value, callback) {
|
||||
if (value !== self.formData.password) {
|
||||
callback(new Error("两次输入密码不一致!"))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
const validateUnit = function (rule, value, callback) {
|
||||
if (
|
||||
self.parentUnit.length < 1 ||
|
||||
self.parentUnit[self.parentUnit.length - 1] === "" ||
|
||||
self.parentUnit[self.parentUnit.length - 1] === "root"
|
||||
) {
|
||||
callback(new Error("请选择所属单位!"))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
return {
|
||||
addDialogVisible: false,
|
||||
editDialogVisible: false,
|
||||
roleDialogVisible: false,
|
||||
treeData: {
|
||||
label: "name",
|
||||
children: "zones",
|
||||
id: "id",
|
||||
isLeaf: "leaf"
|
||||
},
|
||||
tableData: [],
|
||||
tableKey: "",
|
||||
options: [],
|
||||
parentUnit: [],
|
||||
parentUnitSearch: [],
|
||||
pageForm: {
|
||||
searchUnit: "",
|
||||
searchName: "",
|
||||
searchKeyword: "",
|
||||
pageNumber: 1,
|
||||
pageSize: 10,
|
||||
totalCount: 0,
|
||||
pageOrderName: "",
|
||||
pageOrderBy: ""
|
||||
},
|
||||
formData: {
|
||||
id: "",
|
||||
unitId: "",
|
||||
disabled: false
|
||||
},
|
||||
formRules: {
|
||||
parentUnit: [{ validator: validateUnit, trigger: ["blur", "change"] }],
|
||||
loginname: [
|
||||
{ required: true, message: "工号", trigger: ["blur", "change"] },
|
||||
{ validator: validateLoginname, trigger: ["blur", "change"] }
|
||||
],
|
||||
username: [{ required: true, message: "姓名", trigger: ["blur", "change"] }],
|
||||
email: [
|
||||
{ required: false, message: "邮箱地址", trigger: ["blur", "change"] },
|
||||
{ type: "email", message: "请输入正确的邮箱地址", trigger: ["blur", "change"] }
|
||||
],
|
||||
mobile: [
|
||||
{ required: false, message: "手机号码", trigger: ["blur", "change"] },
|
||||
{ pattern: /^1[3456789]\d{9}$/, message: "请输入正确的手机号码" }
|
||||
],
|
||||
password: [
|
||||
{ required: true, message: "请输入密码", trigger: "blur" },
|
||||
{
|
||||
pattern: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*()\-_=+{}[\]|;:'",.<>/?]).{8,20}$/,
|
||||
message: "密码必须同时包含大小写字母、数字、特殊符号,且长度在8到20位之间",
|
||||
trigger: "change"
|
||||
},
|
||||
{ min: 8, max: 20, message: "密码长度必须是8-20位", trigger: "change" }
|
||||
],
|
||||
passwordAgain: [
|
||||
{ required: true, message: "请再次输入新密码", trigger: "blur" },
|
||||
{
|
||||
pattern: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*()\-_=+{}[\]|;:'",.<>/?]).{8,20}$/,
|
||||
message: "密码必须同时包含大小写字母、数字、特殊符号,且长度在8到20位之间",
|
||||
trigger: "change"
|
||||
},
|
||||
{ validator: validatePass, trigger: "change" }
|
||||
]
|
||||
},
|
||||
editRules: {
|
||||
username: [{ required: true, message: "姓名", trigger: ["blur", "change"] }],
|
||||
email: [
|
||||
{ required: false, message: "邮箱地址", trigger: ["blur", "change"] },
|
||||
{ type: "email", message: "请输入正确的邮箱地址", trigger: ["blur", "change"] }
|
||||
],
|
||||
mobile: [
|
||||
{ required: false, message: "手机号码", trigger: ["blur", "change"] },
|
||||
{ pattern: /^1[3456789]\d{9}$/, message: "请输入正确的手机号码" }
|
||||
]
|
||||
},
|
||||
roleDialogTitle: "查看用户权限",
|
||||
roleTableData: [], //treeTable后台取出的数据
|
||||
userId: "", //当前用户ID
|
||||
multipleSelection: [],
|
||||
props: {
|
||||
lazy: true,
|
||||
checkStrictly: true,
|
||||
multiple: false,
|
||||
value: "id",
|
||||
label: "name",
|
||||
lazyLoad: function (node, resolve) {
|
||||
const url = base + "/platform/sys/unit/tree"
|
||||
self.$axios.post(url, { pid: node.value }).then((res) => {
|
||||
if (res.code === 0) {
|
||||
let filteredData = res.data;
|
||||
if (node.level === 0 && res.data && res.data.length > 0) {
|
||||
filteredData = res.data.slice(1); // 移除第一个元素
|
||||
}
|
||||
resolve(filteredData);
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
units: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
formatAt: function (val) {
|
||||
if (val > 0) return moment(val).format("YYYY-MM-DD HH:mm")
|
||||
return ""
|
||||
},
|
||||
doSearch: function () {
|
||||
// let unit = this.parentUnitSearch[this.parentUnitSearch.length - 1]
|
||||
// if ("root" === unit) {
|
||||
// unit = ""
|
||||
// }
|
||||
// this.pageForm.searchUnit = unit
|
||||
this.pageForm.pageNumber = 1
|
||||
this.pageData()
|
||||
},
|
||||
openAdd() {
|
||||
this.addDialogVisible = true
|
||||
this.formData = {} //打开新增窗口,表单先清空
|
||||
if (this.$refs["addForm"]) this.$refs["addForm"].resetFields()
|
||||
},
|
||||
doAdd() {
|
||||
this.$refs["addForm"].validate((valid) => {
|
||||
if (valid) {
|
||||
this.formData.unitId = this.parentUnit[this.parentUnit.length - 1] || ""
|
||||
this.$axios.post("/platform/sys/user/addDo", this.formData).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$message.success(res.msg)
|
||||
this.parentUnitSearch = []
|
||||
this.doSearch()
|
||||
this.addDialogVisible = false
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
doEdit() {
|
||||
this.$refs["editForm"].validate((valid) => {
|
||||
if (valid) {
|
||||
this.$axios.post("/platform/sys/user/editDo", this.formData).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$message.success(res.msg)
|
||||
this.doSearch()
|
||||
this.editDialogVisible = false
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
initRoleTreeTable() {
|
||||
this.$axios.post("/platform/sys/user/menu/" + self.userId, { pid: "" }).then((res) => {
|
||||
if (res.code === 0) {
|
||||
self.roleTableData = res.data
|
||||
}
|
||||
})
|
||||
},
|
||||
loadRoleChild(tree, treeNode, resolve) {
|
||||
this.$axios.post("/platform/sys/user/menu/" + this.userId, { pid: tree.id }).then((res) => {
|
||||
if (res.code === 0) {
|
||||
resolve(res.data)
|
||||
}
|
||||
})
|
||||
},
|
||||
dropdownCommand(command) {
|
||||
//监听下拉框事件
|
||||
if ("role" === command.type) {
|
||||
this.roleDialogVisible = true
|
||||
this.roleDialogTitle = "查看用户 " + command.loginname + " 的权限"
|
||||
this.userId = command.id
|
||||
this.initRoleTreeTable()
|
||||
}
|
||||
if ("reset" === command.type) {
|
||||
this.$confirm("确定重置用户" + command.loginname + "的密码", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
})
|
||||
.then(() => {
|
||||
this.$axios.post("/platform/sys/user/resetPwd/" + command.id, {}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$alert("新密码为 " + res.data, "新密码", {
|
||||
confirmButtonText: "确定"
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
.catch(() => {})
|
||||
}
|
||||
if ("enable" === command.type || "disable" === command.type) {
|
||||
this.$axios.post("/platform/sys/user/" + command.type + "/" + command.id, {}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$message.success(res.msg)
|
||||
if ("disable" === command.type) {
|
||||
command.row.disabled = true
|
||||
}
|
||||
if ("enable" === command.type) {
|
||||
command.row.disabled = false
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
if ("edit" === command.type) {
|
||||
this.$axios.post(base + "/platform/sys/user/edit/" + command.id, {}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.formData = res.data //加载后台表单数据
|
||||
this.editDialogVisible = true //打开编辑窗口
|
||||
}
|
||||
})
|
||||
}
|
||||
if ("delete" === command.type) {
|
||||
this.$confirm("此操作将删除 " + command.loginname, "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
this.$axios.post("/platform/sys/user/delete/" + command.id, {}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$message.success(res.msg)
|
||||
this.doSearch()
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
batchCommand(command) {
|
||||
if ("delete" === command.type) {
|
||||
if (this.multipleSelection.length === 0) {
|
||||
this.$message.warning("请选择要删除的用户")
|
||||
return
|
||||
}
|
||||
const loginnames = []
|
||||
const ids = []
|
||||
this.multipleSelection.forEach(function (val) {
|
||||
loginnames.push(val.loginname)
|
||||
ids.push(val.id)
|
||||
})
|
||||
this.$confirm("此操作将删除用户 " + loginnames.toString(), "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
this.$axios.post("/platform/sys/user/delete", { ids: ids.toString() }).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$message.success(res.msg)
|
||||
this.doSearch()
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
if ("export" === command.type) {
|
||||
this.$downLoad.post("/platform/sys/user/export", this.pageForm)
|
||||
}
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
this.multipleSelection = val
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
this.pageData()
|
||||
this.units = await this.$businessTool.listUnit()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -0,0 +1,116 @@
|
||||
<div id="passApp">
|
||||
<div class="el-dialog__header">
|
||||
<button type="button" data-dismiss="modal" aria-hidden="true" aria-label="Close" class="el-dialog__headerbtn">
|
||||
<i class="el-dialog__close el-icon el-icon-close"></i>
|
||||
</button>
|
||||
<h4 class="modal-title">${msg['index.user.password']}</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<el-form :model="passForm" ref="passForm" :rules="passRules" label-width="100px">
|
||||
<el-form-item label="${msg['index.user.oldpass']}" prop="oldPassword">
|
||||
<el-input
|
||||
size="small"
|
||||
maxlength="20"
|
||||
placeholder="${msg['index.user.oldpass']}"
|
||||
v-model="passForm.oldPassword"
|
||||
auto-complete="off"
|
||||
tabindex="1"
|
||||
type="password"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="输入新密码" prop="newPassword">
|
||||
<el-input
|
||||
size="small"
|
||||
maxlength="20"
|
||||
placeholder="${msg['index.user.newpass']}"
|
||||
v-model="passForm.newPassword"
|
||||
auto-complete="off"
|
||||
tabindex="2"
|
||||
type="password"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="确认新密码" prop="passwordAgain">
|
||||
<el-input
|
||||
size="small"
|
||||
maxlength="20"
|
||||
placeholder="${msg['index.user.rightpass']}"
|
||||
v-model="passForm.passwordAgain"
|
||||
auto-complete="off"
|
||||
tabindex="3"
|
||||
type="password"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<div class="el-dialog__footer">
|
||||
<span class="dialog-footer">
|
||||
<button type="button" class="el-button el-button--default" data-dismiss="modal">
|
||||
<span>${msg['system.cancel']}</span>
|
||||
</button>
|
||||
<button type="button" class="el-button el-button--primary" @click="doPass">
|
||||
<span>${msg['system.confirm']}</span>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<script nonce="${cspNonce!}" type="text/javascript">
|
||||
new Vue({
|
||||
el: "#passApp",
|
||||
data: function () {
|
||||
var self = this
|
||||
var validatePass = function (rule, value, callback) {
|
||||
if (value !== self.passForm.newPassword) {
|
||||
callback(new Error("两次输入密码不一致!"))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
return {
|
||||
passForm: {
|
||||
oldPassword: "",
|
||||
newPassword: "",
|
||||
passwordAgain: ""
|
||||
},
|
||||
passRules: {
|
||||
oldPassword: [{ required: true, message: "请输入原密码", trigger: "blur" }],
|
||||
newPassword: [
|
||||
{ required: true, message: "请输入新密码", trigger: "blur" },
|
||||
{ min: 3, max: 20, message: "密码长度必须是3-20位", trigger: "change" }
|
||||
],
|
||||
passwordAgain: [
|
||||
{ required: true, message: "请再次输入新密码", trigger: "blur" },
|
||||
{ validator: validatePass, trigger: "change" }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
doPass: function () {
|
||||
var self = this
|
||||
self.$refs["passForm"].validate(function (valid) {
|
||||
if (valid) {
|
||||
$.post(
|
||||
base + "/platform/sys/user/doChangePassword",
|
||||
self.passForm,
|
||||
function (data) {
|
||||
if (data.code == 0) {
|
||||
$("#homeDetail").modal("hide")
|
||||
self.$message({
|
||||
message: data.msg,
|
||||
type: "success"
|
||||
})
|
||||
} else {
|
||||
self.$message({
|
||||
message: data.msg,
|
||||
type: "error"
|
||||
})
|
||||
}
|
||||
},
|
||||
"json"
|
||||
)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
Reference in New Issue
Block a user