This commit is contained in:
shijing 2022-06-21 13:32:36 +08:00
parent ec6dec9089
commit 8c17ad4d8d
2 changed files with 18 additions and 83 deletions

View File

@ -38,7 +38,6 @@
apiObj: this.$API.ops.logs.list, apiObj: this.$API.ops.logs.list,
search:{ search:{
id:null, id:null,
page:1
}, },
logLists:[], logLists:[],
infoDrawer:false, infoDrawer:false,
@ -48,6 +47,9 @@
mounted() { mounted() {
}, },
methods: { methods: {
getSearch(){
this.$refs.table.reload(this.search);
},
rowClick(row){ rowClick(row){
this.infoDrawer = true; this.infoDrawer = true;
this.$nextTick(() => { this.$nextTick(() => {

View File

@ -174,18 +174,11 @@
<el-form-item label="手机"> <el-form-item label="手机">
<el-input <el-input
v-model="addForm.phone" v-model="addForm.phone"
placeholder="请输入完整的真实姓名" placeholder="请输入手机号码"
clearable clearable
></el-input> ></el-input>
</el-form-item> </el-form-item>
<!--<el-form-item label="邮箱"> <!--<el-form-item label="所属部门">
<el-input
v-model="addForm.email"
placeholder="请输入邮箱"
clearable
></el-input>
</el-form-item>-->
<el-form-item label="所属部门">
<el-cascader <el-cascader
v-model="addForm.belong_dept" v-model="addForm.belong_dept"
:options="group" :options="group"
@ -194,7 +187,7 @@
clearable clearable
style="width: 100%" style="width: 100%"
></el-cascader> ></el-cascader>
</el-form-item> </el-form-item>-->
<el-form-item label="是否在用"> <el-form-item label="是否在用">
<el-switch v-model="addForm.is_active" /> <el-switch v-model="addForm.is_active" />
</el-form-item> </el-form-item>
@ -231,40 +224,15 @@
id: "", id: "",
username: "", username: "",
name: "", name: "",
email: "", // email: "",
phone: "", phone: "",
belong_dept: [], // belong_dept: [],
is_active:true is_active:true
}, },
// //
rules: { rules: {
username: [{required: true, message: "请输入登录账号"}], username: [{required: true, message: "请输入登录账号"}],
name: [{required: true, message: "请输入真实姓名"}], name: [{required: true, message: "请输入真实姓名"}],
password: [
{required: true, message: "请输入登录密码"},
{
validator: (rule, value, callback) => {
if (this.form.password2 !== "") {
this.$refs.addForm.validateField(
"password2"
);
}
callback();
},
},
],
password2: [
{required: true, message: "请再次输入密码"},
{
validator: (rule, value, callback) => {
if (value !== this.form.password) {
callback(new Error("两次输入密码不一致!"));
} else {
callback();
}
},
},
],
group: [{required: true, message: "请选择所属角色"}], group: [{required: true, message: "请选择所属角色"}],
}, },
// //
@ -298,7 +266,6 @@
}, },
}, },
mounted() { mounted() {
this.getList();
this.getGroup(); this.getGroup();
}, },
methods: { methods: {
@ -324,11 +291,10 @@
this.addForm.name = row.name; this.addForm.name = row.name;
this.addForm.username = row.username; this.addForm.username = row.username;
this.addForm.phone = row.phone; this.addForm.phone = row.phone;
this.addForm.email = row.email; /*
debugger;
console.log();
let belong_dept = this.findParents(this.postList,row.belong_dept); let belong_dept = this.findParents(this.postList,row.belong_dept);
this.addForm.belong_dept=belong_dept.reverse(); this.addForm.belong_dept=belong_dept.reverse();
*/
this.addForm.is_active = row.is_active; this.addForm.is_active = row.is_active;
}, },
findParents(arr,belong_dept){ findParents(arr,belong_dept){
@ -352,15 +318,13 @@
this.addForm.id = row.id; this.addForm.id = row.id;
}, },
// //
async table_del(row, index) { async table_del(row) {
var reqData = {id: row.id}; let res = await this.$API.system.user.delete.req(row.id);
var res = await this.$API.system.user.delete.req(reqData); if (res.err.msg) {
if (res.code == 200) {
// OR /
this.$refs.table.tableData.splice(index, 1);
this.$message.success("删除成功");
} else {
this.$alert(res.message, "提示", {type: "error"}); this.$alert(res.message, "提示", {type: "error"});
} else {
this.$refs.table.refresh();
this.$message.success("删除成功");
} }
}, },
// //
@ -370,7 +334,7 @@
// //
async getGroup() { async getGroup() {
this.showGrouploading = true; this.showGrouploading = true;
var res = await this.$API.system.dept.list.req({page: 0}); let res = await this.$API.system.dept.list.req({page: 0});
this.showGrouploading = false; this.showGrouploading = false;
// var allNode = { id: "", label: "" }; // var allNode = { id: "", label: "" };
// res.data.unshift(allNode); // res.data.unshift(allNode);
@ -414,27 +378,6 @@
upsearch() { upsearch() {
this.$refs.table.upData(this.search); this.$refs.table.upData(this.search);
}, },
//
handleSuccess(data, mode) {
if (mode == "add") {
data.id = new Date().getTime();
this.$refs.table.tableData.unshift(data);
} else if (mode == "edit") {
this.$refs.table.tableData
.filter((item) => item.id === data.id)
.forEach((item) => {
Object.assign(item, data);
});
}
},
getList() {
let that = this;
this.$API.system.user.list.req({page:1,page_size:20}).then((res) => {
debugger;
console.log(res);
that.userList = res.results;
});
},
// //
submit(){ submit(){
debugger; debugger;
@ -442,7 +385,7 @@
if (valid) { if (valid) {
debugger; debugger;
this.isSaveing = true; this.isSaveing = true;
this.addForm.belong_dept = this.addForm.belong_dept[this.addForm.belong_dept.length - 1]; // this.addForm.belong_dept = this.addForm.belong_dept[this.addForm.belong_dept.length - 1];
let res; let res;
if(this.type==='add'){ if(this.type==='add'){
res = await this.$API.system.user.create.req(this.addForm); res = await this.$API.system.user.create.req(this.addForm);
@ -461,16 +404,6 @@
return false; return false;
} }
}) })
},
//
setData(data){
this.addForm.id = data.id;
this.addForm.username = data.username;
this.addForm.avatar = data.avatar;
this.addForm.name = data.name;
this.addForm.group = data.group;
//
//Object.assign(this.form, data)
} }
}, },
}; };