|
@@ -19,8 +19,11 @@
|
|
|
size="large"
|
|
|
v-model.trim="modalForm.loginName"
|
|
|
placeholder="请输入账号"
|
|
|
+ :disabled="isEdit"
|
|
|
clearable
|
|
|
- ></Input>
|
|
|
+ >
|
|
|
+ <span slot="prepend" v-if="!isEdit">{{ loginNamePrepend }}</span>
|
|
|
+ </Input>
|
|
|
</FormItem>
|
|
|
<FormItem prop="password" label="密码">
|
|
|
<Input
|
|
@@ -41,11 +44,14 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { updateClientUser } from "@/api";
|
|
|
+import { updateClientUser, orgDetail } from "@/api";
|
|
|
import { password } from "@/plugins/formRules";
|
|
|
|
|
|
const initModalForm = {
|
|
|
id: "",
|
|
|
+ workId: "",
|
|
|
+ role: "",
|
|
|
+ roleName: "",
|
|
|
loginName: "",
|
|
|
password: ""
|
|
|
};
|
|
@@ -65,7 +71,7 @@ export default {
|
|
|
return !!this.instance.id;
|
|
|
},
|
|
|
title() {
|
|
|
- return (this.isEdit ? "编辑" : "新增") + "采集账号";
|
|
|
+ return (this.isEdit ? "编辑" : "新增") + this.instance.roleName + "账号";
|
|
|
}
|
|
|
},
|
|
|
data() {
|
|
@@ -73,6 +79,8 @@ export default {
|
|
|
modalIsShow: false,
|
|
|
isSubmit: false,
|
|
|
modalForm: { ...initModalForm },
|
|
|
+ orgInfo: {},
|
|
|
+ loginNamePrepend: "",
|
|
|
rules: {
|
|
|
loginName: [
|
|
|
{
|
|
@@ -86,20 +94,26 @@ export default {
|
|
|
}
|
|
|
};
|
|
|
},
|
|
|
+ created() {
|
|
|
+ this.getOrgDetail();
|
|
|
+ },
|
|
|
methods: {
|
|
|
initData(val) {
|
|
|
this.$refs.modalFormComp.resetFields();
|
|
|
- if (val.id) {
|
|
|
- this.modalForm = this.$objAssign(initModalForm, val);
|
|
|
- } else {
|
|
|
- this.modalForm = { ...initModalForm };
|
|
|
- }
|
|
|
+ this.modalForm = this.$objAssign(initModalForm, val);
|
|
|
+ this.loginNamePrepend = `${this.orgInfo.abbreviation.toLowerCase()}-${
|
|
|
+ this.modalForm.workId
|
|
|
+ }-`;
|
|
|
},
|
|
|
visibleChange(visible) {
|
|
|
if (visible) {
|
|
|
this.initData(this.instance);
|
|
|
}
|
|
|
},
|
|
|
+ async getOrgDetail() {
|
|
|
+ const organizationId = this.$ls.get("organizationId");
|
|
|
+ this.orgInfo = await orgDetail(organizationId);
|
|
|
+ },
|
|
|
cancel() {
|
|
|
this.modalIsShow = false;
|
|
|
},
|
|
@@ -113,7 +127,10 @@ export default {
|
|
|
if (this.isSubmit) return;
|
|
|
this.isSubmit = true;
|
|
|
let result = true;
|
|
|
- await updateClientUser(this.modalForm).catch(() => {
|
|
|
+ const datas = { ...this.modalForm };
|
|
|
+ if (!this.isEdit)
|
|
|
+ datas.loginName = `${this.loginNamePrepend}${datas.loginName}`;
|
|
|
+ await updateClientUser(datas).catch(() => {
|
|
|
result = false;
|
|
|
});
|
|
|
this.isSubmit = false;
|