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

部门,人员添加属性

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