|
@@ -9,14 +9,21 @@
|
|
<template>
|
|
<template>
|
|
<div class="alert-body__main_content">
|
|
<div class="alert-body__main_content">
|
|
<zz-form :cols="formCols" :data="formData" :rules="formRules" :errors="formErrors" labelWidth="120" ref="form">
|
|
<zz-form :cols="formCols" :data="formData" :rules="formRules" :errors="formErrors" labelWidth="120" ref="form">
|
|
|
|
+ <el-input slot="password" type="password" v-model="formData.password"></el-input>
|
|
|
|
+ <el-input slot="passwordOK" type="password" v-model="formData.passwordOK"></el-input>
|
|
<el-select slot="status" v-model="formData.enableState">
|
|
<el-select slot="status" v-model="formData.enableState">
|
|
<el-option v-for="(item, index) in allStatus" :key="index" :label="item.label" :value="item.id">{{ item.label }}</el-option>
|
|
<el-option v-for="(item, index) in allStatus" :key="index" :label="item.label" :value="item.id">{{ item.label }}</el-option>
|
|
</el-select>
|
|
</el-select>
|
|
<el-input slot="roleId" v-if="noAllRoleId" v-model="formData.roleName" disabled></el-input>
|
|
<el-input slot="roleId" v-if="noAllRoleId" v-model="formData.roleName" disabled></el-input>
|
|
<el-select v-else slot="roleId" v-model="formData.roleId">
|
|
<el-select v-else slot="roleId" v-model="formData.roleId">
|
|
- <el-option v-show="item.roleState" v-for="(item, index) in allRoleId" :key="index" :label="item.roleName" :value="item.id">{{
|
|
|
|
- item.roleName
|
|
|
|
- }}</el-option>
|
|
|
|
|
|
+ <el-option
|
|
|
|
+ v-show="item.roleState"
|
|
|
|
+ v-for="(item, index) in allRoleId"
|
|
|
|
+ :key="index"
|
|
|
|
+ :label="item.roleName"
|
|
|
|
+ :value="item.id"
|
|
|
|
+ >{{ item.roleName }}</el-option
|
|
|
|
+ >
|
|
</el-select>
|
|
</el-select>
|
|
<el-select slot="userType" v-model="formData.userType">
|
|
<el-select slot="userType" v-model="formData.userType">
|
|
<el-option v-for="(item, index) in allUserType" :key="index" :label="item.dictValue" :value="item.dictCode">{{
|
|
<el-option v-for="(item, index) in allUserType" :key="index" :label="item.dictValue" :value="item.dictCode">{{
|
|
@@ -27,7 +34,7 @@
|
|
:props="defaultProps"
|
|
:props="defaultProps"
|
|
slot="companyOrgId"
|
|
slot="companyOrgId"
|
|
class="new-select-tree"
|
|
class="new-select-tree"
|
|
- selectTreeTitle='组织机构'
|
|
|
|
|
|
+ selectTreeTitle="组织机构"
|
|
width="320"
|
|
width="320"
|
|
treeWidth="320"
|
|
treeWidth="320"
|
|
:options="organListCompany"
|
|
:options="organListCompany"
|
|
@@ -39,7 +46,7 @@
|
|
:props="defaultProps"
|
|
:props="defaultProps"
|
|
slot="deptOrgId"
|
|
slot="deptOrgId"
|
|
class="new-select-tree"
|
|
class="new-select-tree"
|
|
- selectTreeTitle='组织机构'
|
|
|
|
|
|
+ selectTreeTitle="组织机构"
|
|
width="320"
|
|
width="320"
|
|
treeWidth="320"
|
|
treeWidth="320"
|
|
:options="organListdepartment"
|
|
:options="organListdepartment"
|
|
@@ -88,6 +95,12 @@
|
|
<script>
|
|
<script>
|
|
import envConfig from '@/config';
|
|
import envConfig from '@/config';
|
|
// import SelectTree from '@/components/common/SelectTree.vue';
|
|
// import SelectTree from '@/components/common/SelectTree.vue';
|
|
|
|
+
|
|
|
|
+const length_null = () => {
|
|
|
|
+ let pattern = /^.{6,20}$/,
|
|
|
|
+ message = `请输入不少于六位数密码且不超过20`;
|
|
|
|
+ return { pattern, required: true, message: message, trigger: 'blur' };
|
|
|
|
+};
|
|
export default {
|
|
export default {
|
|
props: ['params'],
|
|
props: ['params'],
|
|
components: {
|
|
components: {
|
|
@@ -95,11 +108,32 @@ export default {
|
|
},
|
|
},
|
|
|
|
|
|
data() {
|
|
data() {
|
|
|
|
+ var validatePassContrast = (rule, value, callback) => {
|
|
|
|
+ if (value === '') {
|
|
|
|
+ callback(new Error('请输入密码'));
|
|
|
|
+ } else {
|
|
|
|
+ if (this.formData.password !== value) {
|
|
|
|
+ callback(new Error('两次密码不一致'));
|
|
|
|
+ }
|
|
|
|
+ callback();
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+ var validatePass = (rule, value, callback) => {
|
|
|
|
+ if (value === '') {
|
|
|
|
+ callback(new Error('请输入密码'));
|
|
|
|
+ } else {
|
|
|
|
+ if (value.length < 6) {
|
|
|
|
+ callback(new Error('密码位数不得少于6位'));
|
|
|
|
+ }
|
|
|
|
+ callback();
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+
|
|
return {
|
|
return {
|
|
token: {
|
|
token: {
|
|
[localStorage.getItem('SC_token') && 'Authorization']: 'Bearer ' + localStorage.getItem('SC_token')
|
|
[localStorage.getItem('SC_token') && 'Authorization']: 'Bearer ' + localStorage.getItem('SC_token')
|
|
},
|
|
},
|
|
- isLoginUser:false,
|
|
|
|
|
|
+ isLoginUser: false,
|
|
envConfig: envConfig,
|
|
envConfig: envConfig,
|
|
organList: [
|
|
organList: [
|
|
{
|
|
{
|
|
@@ -111,8 +145,8 @@ export default {
|
|
display: true
|
|
display: true
|
|
}
|
|
}
|
|
],
|
|
],
|
|
- organListCompany:[],
|
|
|
|
- organListdepartment:[],
|
|
|
|
|
|
+ organListCompany: [],
|
|
|
|
+ organListdepartment: [],
|
|
|
|
|
|
defaultProps: {
|
|
defaultProps: {
|
|
value: 'id', // 唯一标识
|
|
value: 'id', // 唯一标识
|
|
@@ -128,6 +162,8 @@ export default {
|
|
enableState: '1',
|
|
enableState: '1',
|
|
id: '',
|
|
id: '',
|
|
phone: '',
|
|
phone: '',
|
|
|
|
+ password: '',
|
|
|
|
+ passwordOK: '',
|
|
photo: '',
|
|
photo: '',
|
|
remark: '',
|
|
remark: '',
|
|
roleId: '',
|
|
roleId: '',
|
|
@@ -150,8 +186,8 @@ export default {
|
|
}
|
|
}
|
|
],
|
|
],
|
|
allRoleId: [],
|
|
allRoleId: [],
|
|
- noAllRoleId:false,
|
|
|
|
- noIdInAllRoleId:false,
|
|
|
|
|
|
+ noAllRoleId: false,
|
|
|
|
+ noIdInAllRoleId: false,
|
|
allUserType: [],
|
|
allUserType: [],
|
|
formCols: [
|
|
formCols: [
|
|
[
|
|
[
|
|
@@ -175,6 +211,16 @@ export default {
|
|
prop: 'phone',
|
|
prop: 'phone',
|
|
input: true
|
|
input: true
|
|
},
|
|
},
|
|
|
|
+ {
|
|
|
|
+ label: '密码',
|
|
|
|
+ prop: 'password',
|
|
|
|
+ slot: 'password'
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ label: '确认密码',
|
|
|
|
+ prop: 'passwordOK',
|
|
|
|
+ slot: 'passwordOK'
|
|
|
|
+ },
|
|
{
|
|
{
|
|
label: '状态',
|
|
label: '状态',
|
|
prop: 'enableState',
|
|
prop: 'enableState',
|
|
@@ -241,12 +287,20 @@ export default {
|
|
// deptOrgId: [this.$valid.selectRequired('所属部门')],
|
|
// deptOrgId: [this.$valid.selectRequired('所属部门')],
|
|
username: [this.$valid.inputRequired('用户名')],
|
|
username: [this.$valid.inputRequired('用户名')],
|
|
phone: [this.$valid.patternPhone()],
|
|
phone: [this.$valid.patternPhone()],
|
|
|
|
+ password: [{ required: true, validator: validatePass, trigger: 'blur' }],
|
|
|
|
+ passwordOK: [{ required: true, validator: validatePassContrast, trigger: 'blur' }],
|
|
enableState: [this.$valid.inputRequired('状态')],
|
|
enableState: [this.$valid.inputRequired('状态')],
|
|
- userType: [this.$valid.selectRequired('用户类型')],
|
|
|
|
|
|
+ userType: [this.$valid.selectRequired('用户类型')]
|
|
},
|
|
},
|
|
formErrors: {}
|
|
formErrors: {}
|
|
};
|
|
};
|
|
- },
|
|
|
|
|
|
+ },
|
|
|
|
+ watch: {
|
|
|
|
+ 'formData.passwordOK'(val) {
|
|
|
|
+ if (this.formData.password !== val) {
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
methods: {
|
|
methods: {
|
|
delformphoto() {
|
|
delformphoto() {
|
|
this.formData.photo = '';
|
|
this.formData.photo = '';
|
|
@@ -272,7 +326,7 @@ export default {
|
|
.then(({ status, data, msg }) => {
|
|
.then(({ status, data, msg }) => {
|
|
loading.close();
|
|
loading.close();
|
|
if (0 == status) {
|
|
if (0 == status) {
|
|
- if(this.isLoginUser){
|
|
|
|
|
|
+ if (this.isLoginUser) {
|
|
this.$store.commit('setcCruUserInfo', this.formData);
|
|
this.$store.commit('setcCruUserInfo', this.formData);
|
|
}
|
|
}
|
|
this.$message.success(msg);
|
|
this.$message.success(msg);
|
|
@@ -295,48 +349,46 @@ export default {
|
|
this.formData.photo = response.data;
|
|
this.formData.photo = response.data;
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- selectedcompanyOrgId(e){
|
|
|
|
- this.formData.deptOrgId="";
|
|
|
|
- this.formData.deptOrgName="";
|
|
|
|
|
|
+ selectedcompanyOrgId(e) {
|
|
|
|
+ this.formData.deptOrgId = '';
|
|
|
|
+ this.formData.deptOrgName = '';
|
|
// 获取 部门树e
|
|
// 获取 部门树e
|
|
- this.$http.postForm('/org/getOrgUserTree', { orgType: 'department',id:e }).then(({ status, data, msg }) => {
|
|
|
|
|
|
+ this.$http.postForm('/org/getOrgUserTree', { orgType: 'department', id: e }).then(({ status, data, msg }) => {
|
|
if (status === 0) {
|
|
if (status === 0) {
|
|
- // console.log(data);
|
|
|
|
- this.organListdepartment = data?data:[];
|
|
|
|
|
|
+ // console.log(data);
|
|
|
|
+ this.organListdepartment = data ? data : [];
|
|
}
|
|
}
|
|
});
|
|
});
|
|
-
|
|
|
|
}
|
|
}
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
this.getselectAll();
|
|
this.getselectAll();
|
|
// this.getcompanyTree();
|
|
// this.getcompanyTree();
|
|
- this.formData = JSON.stringify(this.params.data)!== '{}' ? this.params.data : this.formData;
|
|
|
|
|
|
+ this.formData = JSON.stringify(this.params.data) !== '{}' ? this.params.data : this.formData;
|
|
this.organList = this.params.organList ? this.params.organList : this.organList;
|
|
this.organList = this.params.organList ? this.params.organList : this.organList;
|
|
this.organListCompany = this.params.organListCompany ? this.params.organListCompany : this.organListCompany;
|
|
this.organListCompany = this.params.organListCompany ? this.params.organListCompany : this.organListCompany;
|
|
this.organListdepartment = this.params.organListdepartment ? this.params.organListdepartment : this.organListdepartment;
|
|
this.organListdepartment = this.params.organListdepartment ? this.params.organListdepartment : this.organListdepartment;
|
|
this.allRoleId = this.params.allRoleId ? this.params.allRoleId : this.allRoleId;
|
|
this.allRoleId = this.params.allRoleId ? this.params.allRoleId : this.allRoleId;
|
|
this.allUserType = this.params.allUserType ? this.params.allUserType : this.allUserType;
|
|
this.allUserType = this.params.allUserType ? this.params.allUserType : this.allUserType;
|
|
- this.isLoginUser = this.formData.id==this.$store.getters['getCruUserInfo'].id?true:false;
|
|
|
|
- if(this.isLoginUser){
|
|
|
|
|
|
+ this.isLoginUser = this.formData.id == this.$store.getters['getCruUserInfo'].id ? true : false;
|
|
|
|
+ if (this.isLoginUser) {
|
|
this.formCols = this.formColsEdit;
|
|
this.formCols = this.formColsEdit;
|
|
}
|
|
}
|
|
- if(this.allRoleId.length===0){
|
|
|
|
- this.noAllRoleId = true
|
|
|
|
- }else{
|
|
|
|
|
|
+ if (this.allRoleId.length === 0) {
|
|
|
|
+ this.noAllRoleId = true;
|
|
|
|
+ } else {
|
|
// console.log(this.allRoleId);
|
|
// console.log(this.allRoleId);
|
|
-
|
|
|
|
- this.noIdInAllRoleId = this.allRoleId.every((v,i)=>{
|
|
|
|
- return v.id !== this.formData.roleId
|
|
|
|
- })
|
|
|
|
|
|
+
|
|
|
|
+ this.noIdInAllRoleId = this.allRoleId.every((v, i) => {
|
|
|
|
+ return v.id !== this.formData.roleId;
|
|
|
|
+ });
|
|
// console.log(this.noIdInAllRoleId);
|
|
// console.log(this.noIdInAllRoleId);
|
|
- if(this.noIdInAllRoleId){
|
|
|
|
|
|
+ if (this.noIdInAllRoleId) {
|
|
this.allRoleId.push({
|
|
this.allRoleId.push({
|
|
- id:this.formData.roleId,
|
|
|
|
- roleName:this.formData.roleName
|
|
|
|
- })
|
|
|
|
|
|
+ id: this.formData.roleId,
|
|
|
|
+ roleName: this.formData.roleName
|
|
|
|
+ });
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|