删除无用字段

master
mabo 2021-08-06 14:12:30 +08:00
parent c75bd5208b
commit ba7e711a88
1 changed files with 19 additions and 27 deletions

View File

@ -3,7 +3,7 @@
<Card> <Card>
<Row @keydown.enter.native="handleSearch"> <Row @keydown.enter.native="handleSearch">
<Form ref="searchForm" :model="searchForm" inline :label-width="70" class="search-form"> <Form ref="searchForm" :model="searchForm" inline :label-width="70" class="search-form">
<Form-item label="用户名" prop="username"> <Form-item label="用户名">
<Input <Input
type="text" type="text"
v-model="searchForm.username" v-model="searchForm.username"
@ -12,7 +12,7 @@
style="width: 200px" style="width: 200px"
/> />
</Form-item> </Form-item>
<Form-item label="联系方式" prop="mobile"> <Form-item label="联系方式">
<Input <Input
type="text" type="text"
v-model="searchForm.mobile" v-model="searchForm.mobile"
@ -22,16 +22,9 @@
/> />
</Form-item> </Form-item>
<Form-item label="部门" prop="department" > <Form-item label="部门">
<department-choose @on-change="handleSelectDep" style="width: 150px;" ref="dep"></department-choose> <department-choose @on-change="handleSelectDep" style="width: 150px;" ref="dep"></department-choose>
</Form-item> </Form-item>
<Form-item label="用户状态" prop="status">
<Select v-model="searchForm.status" placeholder="请选择" clearable style="width: 150px">
<Option value="true">启用</Option>
<Option value="false">禁用</Option>
</Select>
</Form-item>
<Button @click="handleSearch" type="primary" icon="ios-search" class="search-btn">搜索</Button> <Button @click="handleSearch" type="primary" icon="ios-search" class="search-btn">搜索</Button>
</Form> </Form>
</Row> </Row>
@ -143,8 +136,6 @@ export default {
username: "", username: "",
departmentId: "", departmentId: "",
mobile: "", mobile: "",
type: "",
status: "",
pageNumber: 1, pageNumber: 1,
pageSize: 10, pageSize: 10,
sort: "createTime", sort: "createTime",
@ -158,7 +149,6 @@ export default {
mobile: "", mobile: "",
email: "", email: "",
sex: "", sex: "",
type: 0,
roles: [], roles: [],
departmentId: "", departmentId: "",
departmentTitle: "" departmentTitle: ""
@ -388,13 +378,6 @@ export default {
getUserList() { getUserList() {
// //
this.loading = true; this.loading = true;
//
if (!this.searchForm.type) {
this.searchForm.type = "";
}
if (!this.searchForm.status) {
this.searchForm.status = "";
}
getUserListData(this.searchForm).then(res => { getUserListData(this.searchForm).then(res => {
this.loading = false; this.loading = false;
if (res.success) { if (res.success) {
@ -461,21 +444,21 @@ export default {
if (valid) { if (valid) {
if (this.modalType == 0) { if (this.modalType == 0) {
// id // id
delete this.form.id; const params = JSON.parse(JSON.stringify(this.form))
delete this.form.status; delete params.id;
if (this.form.password == "" || this.form.password == undefined) { delete params.status;
if (params.password == "" || params.password == undefined) {
this.errorPass = "密码不能为空"; this.errorPass = "密码不能为空";
return; return;
} }
if (this.form.password.length < 6) { if (params.password.length < 6) {
this.errorPass = "密码长度不得少于6位"; this.errorPass = "密码长度不得少于6位";
return; return;
} }
//todo //todo
this.form.password = this.md5(this.form.password) params.password = this.md5(params.password)
this.submitLoading = true; this.submitLoading = true;
addUser(this.form).then(res => { addUser(params).then(res => {
this.submitLoading = false; this.submitLoading = false;
if (res.success) { if (res.success) {
this.$Message.success("操作成功"); this.$Message.success("操作成功");
@ -503,6 +486,15 @@ export default {
this.modalType = 0; this.modalType = 0;
this.modalTitle = "添加用户"; this.modalTitle = "添加用户";
this.$refs.form.resetFields(); this.$refs.form.resetFields();
this.form = { //
username: "",
mobile: "",
email: "",
sex: "",
roles: [],
departmentId: "",
departmentTitle: ""
},
this.$refs.depTree.setData("", ""); this.$refs.depTree.setData("", "");
this.userModalVisible = true; this.userModalVisible = true;
}, },