Commit 8d92f0b7 authored by 仇晓婷's avatar 仇晓婷

部门,人员添加属性

parent bd367f50
......@@ -106,7 +106,7 @@ export default {
organization_Id: this.entity.organization_Id, //组织类型 [id]
location: this.entity.location, //省市县
isProduction: this.entity.isProduction, //是否生产班组:1是,0否
property: this.entity.property //属性
property: this.entity.property.join() //属性
};
Api.create(paramsdata)
.then(r => {
......
......@@ -102,7 +102,7 @@ export default {
organization_Id: this.entity.organization_Id, //组织类型 [id]
location: location, //省市县
isProduction: this.entity.isProduction, //是否生产班组:1是,0否
property: this.entity.property //属性
property: this.entity.property.join() //属性
};
Api.create(paramsdata)
.then(r => {
......
......@@ -101,7 +101,7 @@ export default {
organization_Id: this.entity.organization_Id, //组织类型 [id]
location: this.city_level.join(","), //省市县
isProduction: this.entity.isProduction, //是否生产班组:1是,0否
property: this.entity.property //属性
property: this.entity.property.join() //属性
};
Api.update(paramsdata)
.then(r => {
......
......@@ -68,6 +68,11 @@
<Dictionary code="User.base.workLicense" v-model="entity.licensedToWork"></Dictionary>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('property')">
<Checkbox v-model="entity.property">排产资源</Checkbox>
</FormItem>
</Col>
<Col :span="24">
<FormItem :label="l('remark')" prop="remark">
<Input v-model="entity.remark" type="textarea" :rows="3"></Input>
......@@ -82,28 +87,28 @@
</div>
</template>
<script>
import Api from './api'
import Api from "./api";
const valideTel = (rule, value, callback) => {
var re = /^1[3-9]{1}[0-9]{9}/
if (value === '' || value === null) {
callback(new Error('请输入手机号'))
var re = /^1[3-9]{1}[0-9]{9}/;
if (value === "" || value === null) {
callback(new Error("请输入手机号"));
} else if (!re.test(value)) {
callback(new Error('请输入正确手机号'))
callback(new Error("请输入正确手机号"));
} else {
callback()
callback();
}
}
};
export default {
name: 'Edit',
name: "Edit",
data() {
return {
disabled: false,
showDeptTree: false,
entity: {},
rules: {
userName: [{ required: true, message: '必填', trigger: 'blur' }],
departmentTitle: [{ required: true, message: '必选', trigger: 'blur' }],
userName: [{ required: true, message: "必填", trigger: "blur" }],
departmentTitle: [{ required: true, message: "必选", trigger: "blur" }],
//cardNo: [{ required: true, message: '必填', trigger: 'blur' }],
// birthday: [{ required: true, message: '必填', trigger: 'change' }],
// degreeId: [
......@@ -112,29 +117,34 @@ export default {
// email: [
// { required: true, message: '必填', trigger: 'blur', type: 'email' }
// ],
phone: [{ validator: valideTel, required: true, trigger: 'blur' }]
}
phone: [{ validator: valideTel, required: true, trigger: "blur" }]
}
};
},
props: {
eid: Number
},
methods: {
load(v) {
Api.get({ id: v }).then((r) => {
this.entity = r.result
this.$emit('on-load')
})
Api.get({ id: v }).then(r => {
this.entity = r.result;
if (r.result.property == 2) {
this.entity.property = true;
} else {
this.entity.property = false;
}
this.$emit("on-load");
});
},
handleSubmit() {
this.$refs.form.validate((v) => {
this.$refs.form.validate(v => {
if (v) {
this.disabled = true
this.disabled = true;
Api.update(this.entity)
.then((r) => {
this.disabled = false
.then(r => {
this.disabled = false;
if (r.success) {
this.$Message.success('保存成功')
this.$Message.success("保存成功");
//账户同步操作start
if (this.entity.accountId > 0) {
//账户已同步的情况下
......@@ -144,17 +154,15 @@ export default {
loginName: this.entity.phone, //用户电话
status: this.entity.status,
tanantCode: this.$store.state.userInfo.tanantCode //商户号
}
Api.authAccount(parms2).then((res) => {
};
Api.authAccount(parms2).then(res => {
//同步电话信息等
if (res.success) {
this.$Message.success('账户同步成功')
}
else
{
this.$Message.error('账户同步失败')
this.$Message.success("账户同步成功");
} else {
this.$Message.error("账户同步失败");
}
})
});
} else {
//账户新建后还未同步成功的情况下
let parms = {
......@@ -162,64 +170,64 @@ export default {
loginName: this.entity.phone, //用户电话
status: this.entity.status,
tanantCode: this.$store.state.userInfo.tanantCode //商户号
}
Api.authAccount(parms).then((res1) => {
};
Api.authAccount(parms).then(res1 => {
if (res1.success) {
this.$Message.success('账户同步成功')
this.$Message.success("账户同步成功");
//修改用户表的accountId start
let parms1 = {
userId: parms.userId,
accountId: res1.result //账户同步成功后返回的accountId
}
Api.updateAccount(parms1).then((res2) => {
};
Api.updateAccount(parms1).then(res2 => {
if (res2.success) {
this.$Message.success('操作成功')
this.$Message.success("操作成功");
} else {
this.$Message.error('操作失败')
this.$Message.error("操作失败");
}
})
});
//修改用户表的accountId end
}
})
});
}
//账户同步操作end
this.$emit('on-ok')
this.$emit("on-ok");
} else {
this.$Message.error('保存失败')
this.$Message.error("保存失败");
}
})
.catch((err) => {
this.disabled = false
this.$Message.error('保存失败')
console.warn(err)
})
.catch(err => {
this.disabled = false;
this.$Message.error("保存失败");
console.warn(err);
});
}
})
});
},
handleClose() {
this.$emit('on-close')
this.$emit("on-close");
},
l(key) {
key = 'user' + '.' + key
return this.$t(key)
key = "user" + "." + key;
return this.$t(key);
},
setDepartmentTitle(v, item) {
if (item) {
this.entity.departmentTitle = item.name
this.entity.departmentTitle = item.name;
}
},
getBirthday(value) {
this.entity.birthday = value
this.entity.birthday = value;
}
},
watch: {
eid(v) {
if (v != 0) {
this.load(v)
this.load(v);
}
}
}
}
};
</script>
<style lang="less">
.addUser {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment