|
@@ -12,15 +12,10 @@
|
|
|
<el-input
|
|
|
v-model="formInline.userName"
|
|
|
placeholder="请输入用户名称"
|
|
|
- size="small"
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="角色名称:" prop="roleId">
|
|
|
- <el-select
|
|
|
- v-model="formInline.roleId"
|
|
|
- placeholder="请选择角色"
|
|
|
- size="small "
|
|
|
- >
|
|
|
+ <el-select v-model="formInline.roleId" placeholder="请选择角色">
|
|
|
<el-option
|
|
|
:label="item.roleDescription"
|
|
|
v-for="item in roleList"
|
|
@@ -61,7 +56,7 @@
|
|
|
<el-table-column align="center" label="员工名称" prop="userName">
|
|
|
</el-table-column>
|
|
|
|
|
|
- <el-table-column prop="userName" align="center" label="登录账号">
|
|
|
+ <el-table-column prop="loginName" align="center" label="登录账号">
|
|
|
</el-table-column>
|
|
|
<el-table-column align="center" prop="userPhone" label="手机号">
|
|
|
</el-table-column>
|
|
@@ -140,101 +135,119 @@
|
|
|
<!-- 弹出层 -->
|
|
|
<!-- 新增 /编辑-->
|
|
|
<el-dialog :title="title" :visible.sync="nuedialog" width="500px">
|
|
|
- <el-form
|
|
|
- :model="ruleForm"
|
|
|
- :rules="addUserRules"
|
|
|
- ref="addUserForm"
|
|
|
- label-width="100px"
|
|
|
- class="demo-ruleForm"
|
|
|
- >
|
|
|
- <!-- <el-form-item label="员工名称" prop="userName">
|
|
|
- <el-input v-model="ruleForm.userName"></el-input>
|
|
|
- </el-form-item> -->
|
|
|
- <el-form-item label="电话号码" prop="phone">
|
|
|
- <el-input v-model="ruleForm.phone"></el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="账号名称" prop="userName">
|
|
|
- <el-input v-model="ruleForm.userName" autocomplete="off"></el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="密码" prop="pwd" v-if="title === '新增'">
|
|
|
- <el-input
|
|
|
- v-model="ruleForm.pwd"
|
|
|
- autocomplete="new-password"
|
|
|
- show-password
|
|
|
- ></el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="角色名称:" prop="roleId">
|
|
|
- <el-select
|
|
|
- v-model="ruleForm.roleId"
|
|
|
- placeholder="请选择角色"
|
|
|
- size="small "
|
|
|
- >
|
|
|
- <el-option
|
|
|
- :label="item.roleDescription"
|
|
|
- v-for="item in roleList"
|
|
|
- :value="item.id + ''"
|
|
|
- ></el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
- <span slot="footer" class="dialog-footer">
|
|
|
- <el-button @click="cancel('addUserForm')" size="small">取 消</el-button>
|
|
|
- <el-button
|
|
|
- type="primary"
|
|
|
- @click="submitForm('addUserForm')"
|
|
|
- size="small"
|
|
|
- >确 定</el-button
|
|
|
+ <div v-loading="loadingView" class="views">
|
|
|
+ <el-form
|
|
|
+ :model="ruleForm"
|
|
|
+ :rules="addUserRules"
|
|
|
+ ref="addUserForm"
|
|
|
+ label-width="100px"
|
|
|
+ class="demo-ruleForm"
|
|
|
>
|
|
|
- </span>
|
|
|
+ <el-form-item label="员工名称" prop="userName">
|
|
|
+ <el-input
|
|
|
+ v-model="ruleForm.userName"
|
|
|
+ placeholder="请输入员工名称"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="电话号码" prop="phone">
|
|
|
+ <el-input
|
|
|
+ v-model="ruleForm.phone"
|
|
|
+ placeholder="请输入电话号码"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="账号名称" prop="loginName">
|
|
|
+ <el-input
|
|
|
+ v-model="ruleForm.loginName"
|
|
|
+ placeholder="请输入账号名称"
|
|
|
+ autocomplete="off"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="密码" prop="pwd" v-if="title === '新增'">
|
|
|
+ <el-input
|
|
|
+ v-model="ruleForm.pwd"
|
|
|
+ autocomplete="new-password"
|
|
|
+ show-password
|
|
|
+ placeholder="请输入密码"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="角色名称:" prop="roleId">
|
|
|
+ <el-select
|
|
|
+ v-model="ruleForm.roleId"
|
|
|
+ placeholder="请选择角色"
|
|
|
+ style="width: 100%"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ :label="item.roleDescription"
|
|
|
+ v-for="item in roleList"
|
|
|
+ :value="item.id + ''"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="cancel('addUserForm')" size="small"
|
|
|
+ >取 消</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ @click="submitForm('addUserForm')"
|
|
|
+ size="small"
|
|
|
+ >确 定</el-button
|
|
|
+ >
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
</el-dialog>
|
|
|
<!-- 风场详情 -->
|
|
|
<el-dialog title="修改密码" :visible.sync="unusualdialog" width="500px">
|
|
|
- <el-form
|
|
|
- :model="editUserPassword"
|
|
|
- ref="editUserPassword"
|
|
|
- label-width="100px"
|
|
|
- >
|
|
|
- <el-form-item
|
|
|
- label="旧密码"
|
|
|
- prop="oldPWD"
|
|
|
- :rules="[{ required: true, message: '旧密码不能为空' }]"
|
|
|
+ <div v-loading="loadingView" class="views">
|
|
|
+ <el-form
|
|
|
+ :model="editUserPassword"
|
|
|
+ ref="editUserPassword"
|
|
|
+ label-width="100px"
|
|
|
>
|
|
|
- <el-input
|
|
|
- v-model.number="editUserPassword.oldPWD"
|
|
|
- autocomplete="off"
|
|
|
- show-password
|
|
|
- ></el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item
|
|
|
- label="新密码"
|
|
|
- prop="newPWD"
|
|
|
- :rules="[{ required: true, message: '新密码不能为空' }]"
|
|
|
- >
|
|
|
- <el-input
|
|
|
- v-model.number="editUserPassword.newPWD"
|
|
|
- autocomplete="off"
|
|
|
- show-password
|
|
|
- ></el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
- <span slot="footer" class="dialog-footer">
|
|
|
- <el-button
|
|
|
- @click="
|
|
|
- () => {
|
|
|
- this.$refs['editUserPassword'].resetFields();
|
|
|
- this.unusualdialog = false;
|
|
|
- }
|
|
|
- "
|
|
|
- size="small"
|
|
|
- >取 消</el-button
|
|
|
- >
|
|
|
- <el-button
|
|
|
- type="primary"
|
|
|
- @click="editUserPwd('editUserPassword')"
|
|
|
- size="small"
|
|
|
- >确 定</el-button
|
|
|
- >
|
|
|
- </span>
|
|
|
+ <el-form-item
|
|
|
+ label="旧密码"
|
|
|
+ prop="oldPWD"
|
|
|
+ :rules="[{ required: true, message: '旧密码不能为空' }]"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-model.number="editUserPassword.oldPWD"
|
|
|
+ autocomplete="off"
|
|
|
+ show-password
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item
|
|
|
+ label="新密码"
|
|
|
+ prop="newPWD"
|
|
|
+ :rules="[{ required: true, message: '新密码不能为空' }]"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-model.number="editUserPassword.newPWD"
|
|
|
+ autocomplete="off"
|
|
|
+ show-password
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <el-button
|
|
|
+ @click="
|
|
|
+ () => {
|
|
|
+ this.$refs['editUserPassword'].resetFields();
|
|
|
+ this.unusualdialog = false;
|
|
|
+ this.loadingView = false;
|
|
|
+ }
|
|
|
+ "
|
|
|
+ size="small"
|
|
|
+ >取 消</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ @click="editUserPwd('editUserPassword')"
|
|
|
+ size="small"
|
|
|
+ >确 定</el-button
|
|
|
+ >
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
</el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -264,6 +277,7 @@ export default {
|
|
|
callback();
|
|
|
};
|
|
|
return {
|
|
|
+ loadingView: false,
|
|
|
loading: false, //数据加载中
|
|
|
rules: {
|
|
|
roleId: { trigger: "change" },
|
|
@@ -285,12 +299,14 @@ export default {
|
|
|
pwd: null,
|
|
|
roleId: null,
|
|
|
userName: null,
|
|
|
+ loginName: null,
|
|
|
},
|
|
|
addUserRules: {
|
|
|
phone: [
|
|
|
{ required: true, message: "请输入手机号", trigger: "blur" },
|
|
|
{ validator: validatePhone, trigger: "blur" },
|
|
|
],
|
|
|
+ loginName: { required: true, message: "请输入", trigger: "blur" },
|
|
|
pwd: { required: true, message: "请输入密码", trigger: "blur" },
|
|
|
roleId: { required: true, message: "请选择角色", trigger: "change" },
|
|
|
userName: { required: true, message: "请输入账号", trigger: "blur" },
|
|
@@ -316,6 +332,7 @@ export default {
|
|
|
editUserPwd(formName) {
|
|
|
this.$refs[formName].validate((valid) => {
|
|
|
if (valid) {
|
|
|
+ this.loadingView = true;
|
|
|
updatePWD({ ...this.editUserPassword })
|
|
|
.then((res) => {
|
|
|
this.$message({
|
|
@@ -323,17 +340,19 @@ export default {
|
|
|
type: "success",
|
|
|
});
|
|
|
this.getTableList();
|
|
|
+ this.unusualdialog = false;
|
|
|
+ this.loadingView = false;
|
|
|
})
|
|
|
- .catch(() => {});
|
|
|
+ .catch(() => {
|
|
|
+ this.loadingView = false;
|
|
|
+ });
|
|
|
} else {
|
|
|
- console.log("error submit!!");
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
//分页数据切换
|
|
|
handleCurrentChange(val) {
|
|
|
- console.log(`当前页: ${val}`);
|
|
|
this.formInline.pageNum = val;
|
|
|
this.getTableList();
|
|
|
},
|
|
@@ -362,9 +381,7 @@ export default {
|
|
|
});
|
|
|
this.getTableList();
|
|
|
})
|
|
|
- .catch((error) => {
|
|
|
- console.log(error, "errrr");
|
|
|
- });
|
|
|
+ .catch((error) => {});
|
|
|
break;
|
|
|
default:
|
|
|
return;
|
|
@@ -376,7 +393,6 @@ export default {
|
|
|
...this.formInline,
|
|
|
totalSize: undefined,
|
|
|
});
|
|
|
- console.log(result, "获取用户列表的结果");
|
|
|
this.tableData = result.data.list;
|
|
|
this.formInline.totalSize = result.data.totalSize;
|
|
|
this.loading = false;
|
|
@@ -384,7 +400,6 @@ export default {
|
|
|
async getRoleList() {
|
|
|
const result = await getRoleTableList({ pageNum: 1, pageSize: 100000 });
|
|
|
this.roleList = result.data.list;
|
|
|
- console.log(this.roleList, " this.roleList ");
|
|
|
},
|
|
|
rowStyle() {
|
|
|
return "text-align:center";
|
|
@@ -403,46 +418,49 @@ export default {
|
|
|
submitForm(formName) {
|
|
|
this.$refs[formName].validate((valid) => {
|
|
|
if (valid) {
|
|
|
+ this.loadingView = true;
|
|
|
switch (this.title) {
|
|
|
case "新增":
|
|
|
addUser({ ...this.ruleForm, userId: undefined })
|
|
|
.then((res) => {
|
|
|
- console.log(res, "新增成功");
|
|
|
this.$message({
|
|
|
type: "success",
|
|
|
message: res.msg,
|
|
|
});
|
|
|
this.getTableList();
|
|
|
this.nuedialog = false;
|
|
|
+ this.loadingView = false;
|
|
|
})
|
|
|
- .catch(() => {});
|
|
|
+ .catch(() => {
|
|
|
+ this.loadingView = false;
|
|
|
+ });
|
|
|
|
|
|
break;
|
|
|
case "编辑":
|
|
|
editUser({ ...this.ruleForm })
|
|
|
.then((res) => {
|
|
|
- console.log(res, "编辑成功");
|
|
|
this.$message({
|
|
|
type: "success",
|
|
|
message: res.msg,
|
|
|
});
|
|
|
this.getTableList();
|
|
|
this.nuedialog = false;
|
|
|
+ this.loadingView = false;
|
|
|
})
|
|
|
- .catch(() => {});
|
|
|
+ .catch(() => {
|
|
|
+ this.loadingView = false;
|
|
|
+ });
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
// this.nuedialog = false;
|
|
|
} else {
|
|
|
- // console.log("error submit!!");
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
//点击取消
|
|
|
cancel(formName) {
|
|
|
- console.log("取消");
|
|
|
this.$refs[formName] && this.$refs[formName].resetFields();
|
|
|
this.ruleForm = {
|
|
|
phone: null,
|
|
@@ -450,10 +468,10 @@ export default {
|
|
|
roleId: null,
|
|
|
userName: null,
|
|
|
userId: null,
|
|
|
+ loginName: null,
|
|
|
};
|
|
|
-
|
|
|
- console.log(this.ruleForm, "biaji ");
|
|
|
this.nuedialog = false;
|
|
|
+ this.loadingView = false;
|
|
|
},
|
|
|
//异常详情
|
|
|
particulars(row) {
|
|
@@ -468,15 +486,15 @@ export default {
|
|
|
// 直接替换整个对象,以确保 Vue 的响应式系统能够检测到变化
|
|
|
this.ruleForm = {
|
|
|
phone: userInfo.userPhone,
|
|
|
- pwd: "", // 如果需要重置密码字段
|
|
|
+ pwd: undefined, // 如果需要重置密码字段
|
|
|
roleId: userInfo.roleId.toString(),
|
|
|
userName: userInfo.userName,
|
|
|
userId: userInfo.userId, // 如果需要用户ID
|
|
|
+ loginName: userInfo.loginName,
|
|
|
};
|
|
|
this.nuedialog = true;
|
|
|
this.title = "编辑";
|
|
|
} catch (error) {
|
|
|
- console.error("Error fetching user info:", error);
|
|
|
this.$message.error("获取用户信息失败");
|
|
|
}
|
|
|
},
|
|
@@ -512,8 +530,11 @@ export default {
|
|
|
// 新增
|
|
|
newnuedialog() {
|
|
|
this.cancel("addUserForm");
|
|
|
- this.ruleForm.pwd = "";
|
|
|
- this.ruleForm.userName = "";
|
|
|
+ this.ruleForm = {
|
|
|
+ loginName: "",
|
|
|
+ pwd: "",
|
|
|
+ userName: "",
|
|
|
+ };
|
|
|
this.nuedialog = true;
|
|
|
this.title = "新增";
|
|
|
},
|