<template>
|
<div class="member_add">
|
<section class="sec" :data-error="isV && !os.name ? '请输入党员姓名' : ''">
|
<p class="label start start2">姓名:</p>
|
<article>
|
<el-input size="small" placeholder="请输入党员姓名" v-model="os.name">
|
</el-input>
|
</article>
|
</section>
|
<section class="sec">
|
<p class="label start">手机号:</p>
|
<article>
|
<el-input
|
size="small"
|
placeholder="请输入党员手机号"
|
v-model="os.phone"
|
>
|
</el-input>
|
</article>
|
</section>
|
<!-- <section class="sec">
|
<p class="label">报到社区:</p>
|
<article>
|
<el-select
|
v-model="os.communityId"
|
filterable
|
placeholder="请选择"
|
size="small"
|
>
|
<el-option
|
v-for="item in communityList"
|
:key="item.communityId"
|
:label="item.name"
|
:value="item.communityId"
|
>
|
</el-option>
|
</el-select>
|
</article>
|
</section> -->
|
<section class="sec">
|
<p class="label">报到单位:</p>
|
<article>
|
<el-select
|
v-model="os.checkUnitId"
|
filterable
|
placeholder="请选择"
|
size="small"
|
>
|
<el-option
|
v-for="item in CheckUnitList"
|
:key="item.id"
|
:label="item.name"
|
:value="item.id"
|
>
|
</el-option>
|
</el-select>
|
</article>
|
</section>
|
<section class="sec">
|
<p class="label">所属党组织:</p>
|
<article>
|
<el-input
|
size="small"
|
placeholder="请输入所属党组织"
|
v-model="os.orgName"
|
>
|
</el-input>
|
</article>
|
</section>
|
<section class="sec">
|
<p class="label start5">技能特长:</p>
|
<article>
|
<div>
|
<el-select
|
slot="prepend"
|
v-model="specialtyNameValue"
|
clearable
|
multiple
|
placeholder="请选择"
|
@change="specialtyChange"
|
>
|
<el-option
|
v-for="(it, ix) in skillList"
|
:key="ix"
|
:label="it.name"
|
:value="it.name"
|
></el-option>
|
</el-select>
|
</div>
|
</article>
|
</section>
|
<!---->
|
<!-- <section class="sec">
|
<p class="label">党员照片:</p>
|
<article>
|
<div class="avatar">
|
<v-upload @path="onPath" :pic="os.photoPath"></v-upload>
|
</div>
|
</article>
|
</section> -->
|
</div>
|
</template>
|
|
<script>
|
import vUpload from "com/upload/upload";
|
export default {
|
props: {
|
door: {
|
type: Object,
|
default: () => {
|
return {};
|
},
|
},
|
item: {
|
type: Object,
|
default: () => {
|
return {};
|
},
|
},
|
},
|
components: { vUpload },
|
data() {
|
return {
|
value: "",
|
skillList: [],
|
options: [],
|
specialtyNameValue: [],
|
communityList: [], //报到单位
|
CheckUnitList: [], //报到单位
|
listType: false,
|
isV: false,
|
os: {
|
communityId: "",
|
communityName: "",
|
employmentTime: "",
|
id: 0,
|
idCard: "",
|
joinTime: "",
|
name: "",
|
orgId: "",
|
orgName: "",
|
partyAge: 0,
|
phone: "",
|
photoPath: "",
|
status: "",
|
checkUnitId: "",
|
function: "",
|
specialtyName: "",
|
specialtyCategory: "",
|
type: "",
|
},
|
};
|
},
|
watch: {
|
"os.orgId"(n) {
|
let v = this.options.filter((k) => {
|
return k.id === n;
|
});
|
if (v.length) {
|
this.os.orgName = v[0].name;
|
}
|
},
|
door: {
|
handler(n) {
|
if (n.r) {
|
this.save(n.t);
|
}
|
},
|
deep: true,
|
},
|
item: {
|
handler(n) {
|
this.checkItem(n);
|
},
|
deep: true,
|
},
|
},
|
methods: {
|
specialtyChange(val) {
|
if (val) {
|
this.os.specialtyName = val.join(",");
|
} else {
|
this.os.specialtyName = "";
|
}
|
},
|
checkItem(v) {
|
if (v.id) {
|
this.specialtyNameValue = v.specialtyName
|
? v.specialtyName.split(",")
|
: [];
|
this.os = demo.copy(v);
|
} else {
|
for (let i in this.os) {
|
this.os[i] = "";
|
}
|
this.os.id = 0;
|
this.os.partyAge = 0;
|
}
|
},
|
onPath(v) {
|
this.os.photoPath = v;
|
},
|
reset(type) {
|
// for (let k in this.os) {
|
// this.os[k] = "";
|
// }
|
this.isV = false;
|
this.$nextTick(() => {
|
this.$store.dispatch("setFixed", {
|
event: "del",
|
type: type,
|
time: Date.now(),
|
});
|
this.$store.dispatch("setPageReset", "/com_member");
|
});
|
},
|
save(type) {
|
let t = this;
|
if (!this.os.name) return this.$message.error("请输入党员姓名");
|
if (!this.os.phone) return this.$message.error("请输入党员手机号");
|
// if (!this.os.idCard) return this.$message.error("请输入党员身份证");
|
|
// if (!this.os.type) return this.$message.error("请选择党员类型");
|
// if (!this.os.joinTime) return this.$message.error("请选择入党日期");
|
// if (!this.os.employmentTime && this.os.type == 2)
|
// return this.$message.error("请选择转正日期");
|
// if (!this.os.orgName) return this.$message.error("请选择所属党组织");
|
// if (!this.os.position) return this.$message.error("请输入职位");
|
// if (!this.os.checkUnitId) return this.$message.error("请选择报到单位");
|
// if (!this.os.function) return this.$message.error("请输入职能");
|
// if (!this.os.photoPath) return this.$message.error("请上传党员照片");
|
// let s = t.os.joinTime;
|
// let e = t.os.employmentTime;
|
// if (new Date(s).getTime() > new Date(e).getTime() && this.os.type == 2) {
|
// return demo.toast("转正日期不能大于入党日期");
|
// }
|
// if (!t.os.specialtyCategory && t.os.specialtyName) {
|
// return demo.toast("请选择特长类别");
|
// }
|
if (!t.os.specialtyName) {
|
return demo.toast("请选择特长");
|
}
|
if (t.os.type == 1) {
|
t.os.employmentTime = " ";
|
}
|
t.$api.load();
|
if (t.os.id > 0) {
|
// 编辑
|
t.$api.put(
|
"communitypartybuilding/updatepartybuildingmember",
|
t.os,
|
() => {
|
demo.toast("编辑成功");
|
t.reset(type);
|
}
|
);
|
} else {
|
t.$api.post(
|
"communitypartybuilding/addpartybuildingmember",
|
t.os,
|
() => {
|
demo.toast("添加成功");
|
t.reset(type);
|
}
|
);
|
}
|
},
|
setCheckUnitList() {
|
this.$api.post("checkUnit/list", {}, (res) => {
|
// console.log(res)
|
this.CheckUnitList = res.records || [];
|
});
|
},
|
},
|
mounted() {
|
this.$nextTick(() => {
|
this.$api.party((e) => {
|
this.options = e;
|
}, true);
|
this.checkItem(this.item);
|
this.setCheckUnitList();
|
this.$api.post(
|
"neighbor/pageNeighborTopicByAdmin",
|
{ pageNum: 1, pageSize: 9999 },
|
(e) => {
|
this.skillList = e.records;
|
}
|
);
|
this.$api.get("communityactivity/community/list", {}, (e) => {
|
this.communityList = e;
|
});
|
});
|
},
|
};
|
</script>
|
<style lang='less' scoped>
|
.member_add {
|
.el-input--small .el-input__inner {
|
width: 320px;
|
}
|
}
|
.start {
|
position: relative;
|
}
|
.start::before {
|
position: absolute;
|
content: "*";
|
color: red;
|
left: 36px;
|
top: 0;
|
}
|
.start5::before {
|
position: absolute;
|
content: "*";
|
color: red;
|
left: 21px;
|
top: 0;
|
}
|
.start2::before {
|
position: absolute;
|
content: "*";
|
color: red;
|
left: 48px;
|
top: 0;
|
}
|
.start3::before {
|
position: absolute;
|
content: "*";
|
color: red;
|
left: 22px;
|
top: 0;
|
}
|
.start4::before {
|
position: absolute;
|
content: "*";
|
color: red;
|
left: 8px;
|
top: 0;
|
}
|
</style>
|
<style>
|
.input-box {
|
width: 120px !important;
|
}
|
</style>
|