|
@@ -8,33 +8,58 @@
|
|
|
:visible.sync="showDialog"
|
|
:visible.sync="showDialog"
|
|
|
:title="title"
|
|
:title="title"
|
|
|
:modal-append-to-body="false"
|
|
:modal-append-to-body="false"
|
|
|
- style="text-align:left;"
|
|
|
|
|
|
|
+ style="text-align: left"
|
|
|
@close="closeDialog"
|
|
@close="closeDialog"
|
|
|
:close-on-click-modal="false"
|
|
:close-on-click-modal="false"
|
|
|
>
|
|
>
|
|
|
<div class="user-panel" v-loading="loading">
|
|
<div class="user-panel" v-loading="loading">
|
|
|
- <el-form ref="form" :model="formModel" :rules="ruleValidate" :label-width="'100px'">
|
|
|
|
|
|
|
+ <el-form
|
|
|
|
|
+ ref="form"
|
|
|
|
|
+ :model="formModel"
|
|
|
|
|
+ :rules="ruleValidate"
|
|
|
|
|
+ :label-width="'100px'"
|
|
|
|
|
+ >
|
|
|
<el-form-item label="用户名" prop="userName">
|
|
<el-form-item label="用户名" prop="userName">
|
|
|
- <el-input v-model="formModel.userName" placeholder="请输入用户名" style="width:300px"></el-input>
|
|
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="formModel.userName"
|
|
|
|
|
+ placeholder="请输入用户名"
|
|
|
|
|
+ style="width: 300px"
|
|
|
|
|
+ ></el-input>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<el-form-item label="真实名称" prop="realName">
|
|
<el-form-item label="真实名称" prop="realName">
|
|
|
- <el-input v-model="formModel.realName" placeholder="请输入真实名称" style="width:300px"></el-input>
|
|
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="formModel.realName"
|
|
|
|
|
+ placeholder="请输入真实名称"
|
|
|
|
|
+ style="width: 300px"
|
|
|
|
|
+ ></el-input>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
- <el-form-item v-show="ruleValidate.password[0].required" label="密码" prop="password">
|
|
|
|
|
|
|
+ <el-form-item
|
|
|
|
|
+ v-show="ruleValidate.password[0].required"
|
|
|
|
|
+ label="密码"
|
|
|
|
|
+ prop="password"
|
|
|
|
|
+ >
|
|
|
<el-input
|
|
<el-input
|
|
|
type="password"
|
|
type="password"
|
|
|
v-model="formModel.password"
|
|
v-model="formModel.password"
|
|
|
placeholder="请输入密码"
|
|
placeholder="请输入密码"
|
|
|
- style="width:300px"
|
|
|
|
|
|
|
+ style="width: 300px"
|
|
|
></el-input>
|
|
></el-input>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
+ <el-form-item label="所属企业" prop="companyId">
|
|
|
|
|
+ <el-select-tree
|
|
|
|
|
+ :props="companyProps"
|
|
|
|
|
+ :options="companyResult"
|
|
|
|
|
+ v-model="formModel.companyId"
|
|
|
|
|
+ size="mediumn"
|
|
|
|
|
+ ></el-select-tree>
|
|
|
|
|
+ </el-form-item>
|
|
|
<el-form-item label="分配角色" prop="roles">
|
|
<el-form-item label="分配角色" prop="roles">
|
|
|
<el-select
|
|
<el-select
|
|
|
v-model="formModel.roles"
|
|
v-model="formModel.roles"
|
|
|
filterable
|
|
filterable
|
|
|
multiple
|
|
multiple
|
|
|
placeholder="请选择"
|
|
placeholder="请选择"
|
|
|
- style="width:300px"
|
|
|
|
|
|
|
+ style="width: 300px"
|
|
|
>
|
|
>
|
|
|
<el-option
|
|
<el-option
|
|
|
v-for="role in roleList"
|
|
v-for="role in roleList"
|
|
@@ -50,7 +75,9 @@
|
|
|
</div>
|
|
</div>
|
|
|
<span slot="footer" class="dialog-footer">
|
|
<span slot="footer" class="dialog-footer">
|
|
|
<el-button @click="closeDialog">取 消</el-button>
|
|
<el-button @click="closeDialog">取 消</el-button>
|
|
|
- <el-button type="primary" @click="handleSubmit" :loading="submitting">确 定</el-button>
|
|
|
|
|
|
|
+ <el-button type="primary" @click="handleSubmit" :loading="submitting"
|
|
|
|
|
+ >确 定</el-button
|
|
|
|
|
+ >
|
|
|
</span>
|
|
</span>
|
|
|
</el-dialog>
|
|
</el-dialog>
|
|
|
</template>
|
|
</template>
|
|
@@ -58,34 +85,40 @@
|
|
|
import Constant from "@/constant";
|
|
import Constant from "@/constant";
|
|
|
import userApi from "@/api/sys/user";
|
|
import userApi from "@/api/sys/user";
|
|
|
import roleApi from "@/api/sys/role";
|
|
import roleApi from "@/api/sys/role";
|
|
|
|
|
+import companyApi from "@/api/base/company";
|
|
|
|
|
+import SelectTree from "@/components/SelectTree";
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
|
- props: ["businessKey", "title"],
|
|
|
|
|
|
|
+ props: ["businessKey", "title","companyResult"],
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
showPwd: true,
|
|
showPwd: true,
|
|
|
ruleValidate: {
|
|
ruleValidate: {
|
|
|
userName: [
|
|
userName: [
|
|
|
- { required: true, message: "用户名不能为空", trigger: "blur" }
|
|
|
|
|
|
|
+ { required: true, message: "用户名不能为空", trigger: "blur" },
|
|
|
],
|
|
],
|
|
|
realName: [
|
|
realName: [
|
|
|
- { required: true, message: "真实名称不能为空", trigger: "blur" }
|
|
|
|
|
|
|
+ { required: true, message: "真实名称不能为空", trigger: "blur" },
|
|
|
],
|
|
],
|
|
|
companyId: [
|
|
companyId: [
|
|
|
- { required: true, message: "单位不能为空", trigger: "blur" }
|
|
|
|
|
|
|
+ { required: true, message: "单位不能为空", trigger: "blur" },
|
|
|
],
|
|
],
|
|
|
password: [
|
|
password: [
|
|
|
- { required: true, message: "密码不能为空", trigger: "blur" }
|
|
|
|
|
|
|
+ { required: true, message: "密码不能为空", trigger: "blur" },
|
|
|
],
|
|
],
|
|
|
roles: [
|
|
roles: [
|
|
|
- { required: true, message: "分配角色不能为空", trigger: "blur" }
|
|
|
|
|
- ]
|
|
|
|
|
|
|
+ { required: true, message: "分配角色不能为空", trigger: "blur" },
|
|
|
|
|
+ ],
|
|
|
},
|
|
},
|
|
|
roleList: [],
|
|
roleList: [],
|
|
|
formModel: {},
|
|
formModel: {},
|
|
|
showDialog: true,
|
|
showDialog: true,
|
|
|
loading: false,
|
|
loading: false,
|
|
|
- submitting: false
|
|
|
|
|
|
|
+ submitting: false,
|
|
|
|
|
+ companyProps: {
|
|
|
|
|
+ value: "id",
|
|
|
|
|
+ label: "name",
|
|
|
|
|
+ },
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
@@ -95,9 +128,9 @@ export default {
|
|
|
handleSubmit() {
|
|
handleSubmit() {
|
|
|
var self = this;
|
|
var self = this;
|
|
|
|
|
|
|
|
- this.$refs["form"].validate(valid => {
|
|
|
|
|
|
|
+ this.$refs["form"].validate((valid) => {
|
|
|
if (valid) {
|
|
if (valid) {
|
|
|
- (function() {
|
|
|
|
|
|
|
+ (function () {
|
|
|
var id = self.formModel.id;
|
|
var id = self.formModel.id;
|
|
|
|
|
|
|
|
if (id == null || id.length == 0) {
|
|
if (id == null || id.length == 0) {
|
|
@@ -106,20 +139,20 @@ export default {
|
|
|
self.formModel.password = null;
|
|
self.formModel.password = null;
|
|
|
return userApi.update(self.formModel);
|
|
return userApi.update(self.formModel);
|
|
|
}
|
|
}
|
|
|
- })().then(function(response) {
|
|
|
|
|
|
|
+ })().then(function (response) {
|
|
|
var jsonData = response.data;
|
|
var jsonData = response.data;
|
|
|
|
|
|
|
|
if (jsonData.result) {
|
|
if (jsonData.result) {
|
|
|
self.$message({
|
|
self.$message({
|
|
|
message: "保存成功!",
|
|
message: "保存成功!",
|
|
|
- type: "success"
|
|
|
|
|
|
|
+ type: "success",
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- self.$emit("close",true);
|
|
|
|
|
|
|
+ self.$emit("close", true);
|
|
|
} else {
|
|
} else {
|
|
|
self.$message({
|
|
self.$message({
|
|
|
message: jsonData.message + "",
|
|
message: jsonData.message + "",
|
|
|
- type: "warning"
|
|
|
|
|
|
|
+ type: "warning",
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
self.$emit("close", false);
|
|
self.$emit("close", false);
|
|
@@ -127,18 +160,18 @@ export default {
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
- }
|
|
|
|
|
|
|
+ },
|
|
|
},
|
|
},
|
|
|
async mounted() {
|
|
async mounted() {
|
|
|
var self = this;
|
|
var self = this;
|
|
|
self.loading = true;
|
|
self.loading = true;
|
|
|
|
|
|
|
|
// 不需要先加载列表值,再加载选中值了
|
|
// 不需要先加载列表值,再加载选中值了
|
|
|
- await roleApi.selectAll().then(response => {
|
|
|
|
|
|
|
+ await roleApi.selectAll().then((response) => {
|
|
|
this.roleList = response.data.data;
|
|
this.roleList = response.data.data;
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- (function() {
|
|
|
|
|
|
|
+ (function () {
|
|
|
if (self.businessKey != null && self.businessKey.length > 0) {
|
|
if (self.businessKey != null && self.businessKey.length > 0) {
|
|
|
self.ruleValidate.password[0].required = false;
|
|
self.ruleValidate.password[0].required = false;
|
|
|
return userApi.edit(self.businessKey);
|
|
return userApi.edit(self.businessKey);
|
|
@@ -147,7 +180,7 @@ export default {
|
|
|
return userApi.create();
|
|
return userApi.create();
|
|
|
}
|
|
}
|
|
|
})()
|
|
})()
|
|
|
- .then(response => {
|
|
|
|
|
|
|
+ .then((response) => {
|
|
|
var jsonData = response.data;
|
|
var jsonData = response.data;
|
|
|
|
|
|
|
|
if (jsonData.result) {
|
|
if (jsonData.result) {
|
|
@@ -159,10 +192,13 @@ export default {
|
|
|
|
|
|
|
|
self.loading = false;
|
|
self.loading = false;
|
|
|
})
|
|
})
|
|
|
- .catch(error => {
|
|
|
|
|
|
|
+ .catch((error) => {
|
|
|
self.$message.error(error + "");
|
|
self.$message.error(error + "");
|
|
|
self.loading = false;
|
|
self.loading = false;
|
|
|
});
|
|
});
|
|
|
- }
|
|
|
|
|
|
|
+ },
|
|
|
|
|
+ components: {
|
|
|
|
|
+ "el-select-tree": SelectTree
|
|
|
|
|
+ },
|
|
|
};
|
|
};
|
|
|
</script>
|
|
</script>
|