|
@@ -139,7 +139,7 @@
|
|
|
placeholder="请选择"
|
|
|
>
|
|
|
<el-option
|
|
|
- v-for="(item, key) in genderObj"
|
|
|
+ v-for="(item, key) in genderObj" :key="key"
|
|
|
:label="item"
|
|
|
:value="parseInt(key)"
|
|
|
></el-option>
|
|
@@ -933,298 +933,6 @@
|
|
|
},
|
|
|
},
|
|
|
};
|
|
|
-=======
|
|
|
-import Treeselect from '@riophae/vue-treeselect'
|
|
|
-import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
|
|
-export default {
|
|
|
- components: {
|
|
|
- Treeselect
|
|
|
- },
|
|
|
- data() {
|
|
|
- return {
|
|
|
- showvisible: false,
|
|
|
- visible: false,
|
|
|
- loading: false,
|
|
|
- btnLoading: false,
|
|
|
- total: 0,
|
|
|
- tableData: [],
|
|
|
- title: '',
|
|
|
- roleList: [{
|
|
|
- value: '选项1',
|
|
|
- label: '黄金糕'
|
|
|
- }, {
|
|
|
- value: '选项2',
|
|
|
- label: '双皮奶'
|
|
|
- }, {
|
|
|
- value: '选项3',
|
|
|
- label: '蚵仔煎'
|
|
|
- }, {
|
|
|
- value: '选项4',
|
|
|
- label: '龙须面'
|
|
|
- }, {
|
|
|
- value: '选项5',
|
|
|
- label: '北京烤鸭'
|
|
|
- }],
|
|
|
- queryParams: {
|
|
|
- size: 10,
|
|
|
- current: 1,
|
|
|
- // username: '',
|
|
|
- name: ''
|
|
|
- },
|
|
|
- labelVal:'',
|
|
|
- departmentList: [],
|
|
|
- positionList:[],
|
|
|
- groupList:[],
|
|
|
- roleList:[],
|
|
|
- genderObj: {
|
|
|
- 0: '女',
|
|
|
- 1: '男'
|
|
|
- },
|
|
|
- positionAndDepartment:{},
|
|
|
- // departmentList: [],
|
|
|
- ruleForm: {
|
|
|
- },
|
|
|
- rules: {
|
|
|
- name: [{ required: true, message: '请输入姓名', trigger: 'blur' },],
|
|
|
- username: [{ required: true, message: '请输入账号', trigger: 'blur' },],
|
|
|
- password: [{ required: true, message: '请输入密码', trigger: 'blur' },],
|
|
|
- mobile:[{required:true,message: "请输入手机号码", trigger: "blur"},
|
|
|
- {pattern:/(^((\+86)|(86))?(1[3-9])\d{9}$)|(^(0\d{2,3})-?(\d{7,8})$)/,
|
|
|
- message: '输入的手机号码格式不正确,请重新输入',trigger:'blur'}],
|
|
|
- email:[{required:true,message: "请输入手机号码", trigger: "blur"},
|
|
|
- {pattern:/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9_\.\-])+\.)+([a-zA-Z0-9]{2,4})+$/,
|
|
|
- message:'请输入正确的邮箱格式',trigger:'blur'}],
|
|
|
- sex: [{ required: true, message: '请选择性别', trigger: 'change' },],
|
|
|
- // position: [{ required: true, message: '请选择职位', trigger: 'change' },],
|
|
|
- // department: [{ required: true, message: '请选择部门', trigger: 'change' },],
|
|
|
- state: [{ required: true, message: '请选择', trigger: 'change' },],
|
|
|
- },
|
|
|
- }
|
|
|
- },
|
|
|
- watch: {
|
|
|
- "positionAndDepartment.department"() {
|
|
|
- if (this.$refs.deptIdCascader) {
|
|
|
- this.$refs.deptIdCascader.dropDownVisible = false
|
|
|
- }
|
|
|
- },
|
|
|
- "ruleForm.email"(val){
|
|
|
- if(val.indexOf('@qq.com')!=-1){
|
|
|
- var index = val.indexOf('@qq.com')
|
|
|
- var str = val.substring(0,index)
|
|
|
- this.ruleForm.qqNumber=str
|
|
|
-
|
|
|
- }else if(val.indexOf('@qq.com')==-1){
|
|
|
-
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
-},
|
|
|
-computed: {
|
|
|
- userinfo() {
|
|
|
- return this.$store.state.admin.userinfo
|
|
|
- }
|
|
|
- },
|
|
|
- mounted() {
|
|
|
- this.getList()
|
|
|
- this.getDepartment()
|
|
|
- this.getPositionList()
|
|
|
- this.getGroupList()
|
|
|
- this.getRoleList()
|
|
|
- },
|
|
|
- methods: {
|
|
|
- change(e) {
|
|
|
- this.$forceUpdate();
|
|
|
- },
|
|
|
- // getqqNumber(val){
|
|
|
- // if(val.indexOf('@qq.com')){
|
|
|
- // var index = val.indexOf('@qq.com')
|
|
|
- // var str = val.substring(0,index)
|
|
|
- // this.ruleForm.qqNumber=str
|
|
|
- // console.log(this.ruleForm.qqNumber,str)
|
|
|
- // }else{
|
|
|
- // this.ruleForm.qqNumber=''
|
|
|
- // }
|
|
|
- // },
|
|
|
- handleClose(index) {
|
|
|
- this.ruleForm.positions.splice(index, 1);
|
|
|
- console.log(this.ruleForm.positions)
|
|
|
- },
|
|
|
- handleChange(val) {
|
|
|
- // console.log(val)
|
|
|
- let res = this.getVal(val, this.departmentList, []);
|
|
|
- console.log(res, res.join("/"));
|
|
|
- this.labelVal = res.join("/");
|
|
|
- },
|
|
|
- getVal(data, options, arr) {
|
|
|
- options.forEach((e) => {
|
|
|
- data.forEach((i) => {
|
|
|
- if (i == e.id) {
|
|
|
- arr.push(e.name||e.position);
|
|
|
- return;
|
|
|
- } else {
|
|
|
- if (e.children) {
|
|
|
- this.getVal([i], e.children, arr);
|
|
|
- } else {
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
- return arr;
|
|
|
-
|
|
|
- },
|
|
|
- normalizer(node) {
|
|
|
-
|
|
|
- if (node.children && !node.children.length) {
|
|
|
- delete node.children;
|
|
|
- }
|
|
|
- return {
|
|
|
- id: node.id,
|
|
|
- label: node.name,
|
|
|
- children: node.children
|
|
|
- };
|
|
|
- },
|
|
|
- handleAdd() {
|
|
|
- this.title = '新增人员'
|
|
|
- this.visible = true
|
|
|
- this.ruleForm = {
|
|
|
- gender: 0,
|
|
|
- state: 1,
|
|
|
- positions:[],
|
|
|
-
|
|
|
- }
|
|
|
- },
|
|
|
- handleEdit(row) {
|
|
|
- this.title = '编辑人员'
|
|
|
- this.visible = true
|
|
|
- this.ruleForm = { ...row }
|
|
|
- },
|
|
|
- handleDetails(row) {
|
|
|
- console.log(row)
|
|
|
- this.title = '人员详情'
|
|
|
- this.showvisible = true
|
|
|
- this.ruleForm.apply = row
|
|
|
- },
|
|
|
- close() {
|
|
|
- this.visible = false
|
|
|
- this.showvisible = false
|
|
|
- },
|
|
|
- getDepartment() {
|
|
|
- this.$api.getDepartmentList().then(response => {
|
|
|
- this.departmentList = response.data
|
|
|
- })
|
|
|
- },
|
|
|
- getPositionList(){
|
|
|
- this.$api.getPositionList().then(response => {
|
|
|
- this.positionList = response.data
|
|
|
- })
|
|
|
- },
|
|
|
- getGroupList(){
|
|
|
- this.$api.getGroupList().then(response => {
|
|
|
- this.groupList = response.data
|
|
|
- })
|
|
|
- },
|
|
|
- getRoleList(){
|
|
|
- this.$api.getRoleList().then(response => {
|
|
|
- this.roleList = response.data
|
|
|
- })
|
|
|
- },
|
|
|
- showInputLabel() {
|
|
|
- console.log(this.positionAndDepartment)
|
|
|
- let departmentName=this.getVal([this.positionAndDepartment.department[this.positionAndDepartment.department.length-1]],this.departmentList,[])
|
|
|
- let positionName=this.getVal([this.positionAndDepartment.position],this.positionList,[])
|
|
|
- this.ruleForm.positions.push({
|
|
|
- position:this.positionAndDepartment.position,
|
|
|
- positionName:positionName[0],
|
|
|
- department:this.positionAndDepartment.department[this.positionAndDepartment.department.length-1],
|
|
|
- departmentName:departmentName[departmentName.length-1]
|
|
|
- })
|
|
|
- console.log(this.ruleForm.positions)
|
|
|
- console.log(this.ruleForm)
|
|
|
- this.positionAndDepartment={}
|
|
|
- this.labelVal=""
|
|
|
- },
|
|
|
- getList() {
|
|
|
- this.loading = true
|
|
|
- this.queryParams.tenant=this.userinfo.tenantId
|
|
|
- this.$api.getPersonnelList(this.queryParams).then(response => {
|
|
|
- this.tableData = response.data
|
|
|
- this.total = response.pageColumn.total
|
|
|
- this.loading = false
|
|
|
- }).catch(error => {
|
|
|
- this.loading = false
|
|
|
- })
|
|
|
- },
|
|
|
- handleCurrentChange(val) {
|
|
|
- this.queryParams.current = val;
|
|
|
- this.getList();
|
|
|
- },
|
|
|
- submit() {
|
|
|
- this.$refs.ruleForm.validate((valid) => {
|
|
|
- if (valid) {
|
|
|
- console.log(this.ruleForm)
|
|
|
- this.btnLoading = true
|
|
|
- if (this.ruleForm.id) {
|
|
|
- this.$api.editPersonnel(this.ruleForm).then(response => {
|
|
|
- this.$message.success('编辑成功')
|
|
|
- this.btnLoading = false
|
|
|
- this.getList()
|
|
|
- this.close()
|
|
|
- }).catch(error => {
|
|
|
- this.btnLoading = false
|
|
|
- })
|
|
|
- } else {
|
|
|
- this.ruleForm.tenant=this.userinfo.tenantId
|
|
|
- this.$api.addPersonnel(this.ruleForm).then(response => {
|
|
|
- this.$message.success('新增成功')
|
|
|
- this.btnLoading = false
|
|
|
- this.getList()
|
|
|
- this.close()
|
|
|
- }).catch(error => {
|
|
|
- this.btnLoading = false
|
|
|
- })
|
|
|
- }
|
|
|
- } else {
|
|
|
- console.log('error submit!!');
|
|
|
- return false;
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
- handleReset(row) {
|
|
|
- this.$confirm('确认将用户密码重置吗?', '提示', {
|
|
|
- confirmButtonText: '确定',
|
|
|
- cancelButtonText: '取消',
|
|
|
- type: 'warning'
|
|
|
- }).then(() => {
|
|
|
- this.loading = true
|
|
|
- this.$api.resetCommonUserPassword({ id: row.id }).then(response => {
|
|
|
- this.$message.success('重置成功')
|
|
|
- this.loading = false
|
|
|
- this.getList()
|
|
|
- }).catch(error => {
|
|
|
- this.loading = false
|
|
|
- })
|
|
|
- })
|
|
|
- },
|
|
|
- handleDelete(row) {
|
|
|
- this.$confirm('确认删除本条数据吗?', '提示', {
|
|
|
- confirmButtonText: '确定',
|
|
|
- cancelButtonText: '取消',
|
|
|
- type: 'warning'
|
|
|
- }).then(() => {
|
|
|
- this.loading = true
|
|
|
- this.$api.deletePersonnel({ id: row.id }).then(response => {
|
|
|
- this.$message.success('删除成功')
|
|
|
- this.loading = false
|
|
|
- this.getList()
|
|
|
- }).catch(error => {
|
|
|
- this.loading = false
|
|
|
- })
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
->>>>>>> zl
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|