forked from qiushanhe/dm-manage-web
eslint
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
<el-input v-model="deptName" placeholder="请输入部门名称" clearable size="small" prefix-icon="el-icon-search" style="margin-bottom: 20px" />
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-tree :data="deptOptions" :props="defaultProps" :expand-on-click-node="false" :filter-node-method="filterNode" ref="tree" default-expand-all highlight-current @node-click="handleNodeClick" />
|
||||
<el-tree ref="tree" :data="deptOptions" :props="defaultProps" :expand-on-click-node="false" :filter-node-method="filterNode" default-expand-all highlight-current @node-click="handleNodeClick" />
|
||||
</div>
|
||||
</el-col>
|
||||
<!--用户数据-->
|
||||
@@ -98,7 +98,7 @@
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item label="权重" prop="weight">
|
||||
<el-input v-model="form.weight" placeholder="权重,1-100" type="number"></el-input>
|
||||
<el-input v-model="form.weight" placeholder="权重,1-100" type="number" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -143,7 +143,7 @@
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="最大线索数">
|
||||
<el-input v-model="form.maxClueNum"></el-input>
|
||||
<el-input v-model="form.maxClueNum" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -202,12 +202,13 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import empAPi from '@/api/system/employee'
|
||||
import { deptTreeSelect } from "@/api/system/dept";
|
||||
import { getRoleOptions } from '@/api/system/role'
|
||||
import Treeselect from '@riophae/vue-treeselect'
|
||||
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
||||
import editor from '@/components/Editor'
|
||||
import empAPi from '@/api/system/employee';
|
||||
import { deptTreeSelect } from '@/api/system/dept';
|
||||
import { getRoleOptions } from '@/api/system/role';
|
||||
import { resetUserPwd } from '@/api/system/user';
|
||||
import Treeselect from '@riophae/vue-treeselect';
|
||||
import '@riophae/vue-treeselect/dist/vue-treeselect.css';
|
||||
import editor from '@/components/Editor';
|
||||
|
||||
export default {
|
||||
name: 'Employee',
|
||||
@@ -241,7 +242,7 @@ export default {
|
||||
form: {},
|
||||
defaultProps: {
|
||||
children: 'children',
|
||||
label: 'label',
|
||||
label: 'label'
|
||||
},
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
@@ -251,151 +252,143 @@ export default {
|
||||
status: '0',
|
||||
orgId: undefined,
|
||||
roleId: undefined,
|
||||
hiredate: [],
|
||||
hiredate: []
|
||||
},
|
||||
// 表单校验
|
||||
rules: {
|
||||
employeeName: [
|
||||
{ required: true, message: '姓名不能为空', trigger: 'blur' },
|
||||
],
|
||||
employeeName: [{ required: true, message: '姓名不能为空', trigger: 'blur' }],
|
||||
roleIdList: [
|
||||
{
|
||||
required: true,
|
||||
type: 'array',
|
||||
message: '角色不能为空',
|
||||
trigger: 'blur,change',
|
||||
},
|
||||
trigger: 'blur,change'
|
||||
}
|
||||
],
|
||||
orgId: [
|
||||
{
|
||||
required: true,
|
||||
message: '归属部门不能为空',
|
||||
trigger: 'blur,change',
|
||||
},
|
||||
trigger: 'blur,change'
|
||||
}
|
||||
],
|
||||
areaList: [
|
||||
{
|
||||
required: true,
|
||||
message: '所属区域不能为空',
|
||||
trigger: 'blur,change',
|
||||
},
|
||||
trigger: 'blur,change'
|
||||
}
|
||||
],
|
||||
weight: [
|
||||
{
|
||||
required: true,
|
||||
message: '权重不能为空',
|
||||
trigger: 'blur,change',
|
||||
},
|
||||
trigger: 'blur,change'
|
||||
}
|
||||
],
|
||||
phone: [
|
||||
{ required: true, message: '手机号码不能为空', trigger: 'blur' },
|
||||
{
|
||||
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
|
||||
message: '请输入正确的手机号码',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
},
|
||||
userOptions: [],
|
||||
areaOptions: [],
|
||||
}
|
||||
areaOptions: []
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
// 根据名称筛选部门树
|
||||
deptName(val) {
|
||||
this.$refs.tree.filter(val)
|
||||
},
|
||||
this.$refs.tree.filter(val);
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
this.getList();
|
||||
this.getDeptTree();
|
||||
this._getRoleOptions()
|
||||
this._getRoleOptions();
|
||||
this.getDicts('sys_normal_disable').then((response) => {
|
||||
this.statusOptions = response.data
|
||||
})
|
||||
this.statusOptions = response.data;
|
||||
});
|
||||
this.getDicts('sys_user_sex').then((response) => {
|
||||
this.sexOptions = response.data
|
||||
})
|
||||
this.sexOptions = response.data;
|
||||
});
|
||||
|
||||
this.getDicts('dm_area').then((response) => {
|
||||
this.areaOptions = response.data
|
||||
})
|
||||
this.areaOptions = response.data;
|
||||
});
|
||||
this.getConfigKey('sys.user.initPassword').then((response) => {
|
||||
this.initPassword = response.msg
|
||||
})
|
||||
this.initPassword = response.msg;
|
||||
});
|
||||
empAPi.getEmployee().then((resp) => {
|
||||
if (resp.code === 200) {
|
||||
this.userOptions = resp.data
|
||||
this.userOptions = resp.data;
|
||||
// this.userOptions.push({
|
||||
// id: '6ce3239c8c154f83befb9eb7441a01c7',
|
||||
// name: 'DM',
|
||||
// })
|
||||
}
|
||||
})
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
/** 查询用户列表 */
|
||||
getList() {
|
||||
this.loading = true
|
||||
empAPi.pageList(this.queryParams).then(
|
||||
(response) => {
|
||||
this.userList = response.rows
|
||||
this.total = response.total
|
||||
this.loading = false
|
||||
}
|
||||
)
|
||||
this.loading = true;
|
||||
empAPi.pageList(this.queryParams).then((response) => {
|
||||
this.userList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
_getRoleOptions() {
|
||||
getRoleOptions().then((resp) => {
|
||||
this.roleOptions = resp.data
|
||||
})
|
||||
this.roleOptions = resp.data;
|
||||
});
|
||||
},
|
||||
/** 查询部门下拉树结构 */
|
||||
getDeptTree() {
|
||||
deptTreeSelect().then(response => {
|
||||
deptTreeSelect().then((response) => {
|
||||
this.deptOptions = response.data;
|
||||
});
|
||||
},
|
||||
// 筛选节点
|
||||
filterNode(value, data) {
|
||||
if (!value) return true
|
||||
return data.label.indexOf(value) !== -1
|
||||
if (!value) return true;
|
||||
return data.label.indexOf(value) !== -1;
|
||||
},
|
||||
// 节点单击事件
|
||||
handleNodeClick(data) {
|
||||
this.queryParams.orgId = data.id
|
||||
this.getList()
|
||||
this.queryParams.orgId = data.id;
|
||||
this.getList();
|
||||
},
|
||||
// 用户状态修改
|
||||
handleStatusChange(row) {
|
||||
const text = row.status === '0' ? '启用' : '停用'
|
||||
this.$confirm(
|
||||
'确认要"' + text + '""' + row.userName + '"用户吗?',
|
||||
'警告',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}
|
||||
)
|
||||
const text = row.status === '0' ? '启用' : '停用';
|
||||
this.$confirm('确认要"' + text + '""' + row.userName + '"用户吗?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(function () {
|
||||
let model = {
|
||||
const model = {
|
||||
employeeId: row.employeeId,
|
||||
status: row.status
|
||||
}
|
||||
return empAPi.update(model)
|
||||
};
|
||||
return empAPi.update(model);
|
||||
})
|
||||
.then(() => {
|
||||
this.msgSuccess(text + '成功')
|
||||
this.msgSuccess(text + '成功');
|
||||
})
|
||||
.catch(function () {
|
||||
row.status = row.status === '0' ? '1' : '0'
|
||||
})
|
||||
row.status = row.status === '0' ? '1' : '0';
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false
|
||||
this.reset()
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
@@ -415,69 +408,69 @@ export default {
|
||||
areaList: [],
|
||||
weight: undefined,
|
||||
count: true
|
||||
}
|
||||
this.resetForm('form')
|
||||
};
|
||||
this.resetForm('form');
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.page = 1
|
||||
this.getList()
|
||||
this.queryParams.page = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm('queryForm')
|
||||
this.handleQuery()
|
||||
this.resetForm('queryForm');
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset()
|
||||
this.reset();
|
||||
this.getDeptTree();
|
||||
this.open = true
|
||||
this.title = '添加员工'
|
||||
this.open = true;
|
||||
this.title = '添加员工';
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset()
|
||||
this.reset();
|
||||
this.getDeptTree();
|
||||
this.form = Object.assign({}, row)
|
||||
this.open = true
|
||||
this.title = '修改员工'
|
||||
this.form = Object.assign({}, row);
|
||||
this.open = true;
|
||||
this.title = '修改员工';
|
||||
},
|
||||
/** 重置密码按钮操作 */
|
||||
handleReset(row) {
|
||||
resetUserPwd({ employeeId: row.employeeId }).then((response) => {
|
||||
if (response.code === 200) {
|
||||
this.msgSuccess('重置密码成功!')
|
||||
this.msgSuccess('重置密码成功!');
|
||||
}
|
||||
})
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm: function () {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.$set(this.form, 'deptId', this.$store.getters.schoolId)
|
||||
this.$set(this.form, 'deptId', this.$store.getters.schoolId);
|
||||
if (this.form.employeeId) {
|
||||
empAPi.update(this.form).then((response) => {
|
||||
if (response.code === 200) {
|
||||
this.$message.success('修改成功');
|
||||
this.open = false
|
||||
this.getList()
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}
|
||||
})
|
||||
});
|
||||
} else {
|
||||
empAPi.add(this.form).then((response) => {
|
||||
if (response.code === 200) {
|
||||
this.$message.success('新增成功');
|
||||
this.open = false
|
||||
this.getList()
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
Reference in New Issue
Block a user