<template>
|
<div class="committee-box">
|
<v-header
|
title="党委管理"
|
:bar="bar"
|
search
|
@on-search="onSearch"
|
></v-header>
|
<div class="but-boxc">
|
<el-button @click="add()" type="primary">添加</el-button>
|
<el-button @click="showImport" type="primary">导入</el-button>
|
<el-button @click="pbMemberRole" type="primary">下载模板</el-button>
|
</div>
|
<!---->
|
<div>
|
<v-tool-table :trs="trs" :tds="tds">
|
<template v-slot:photoPath="{ scope }">
|
<img
|
class="img"
|
@click="onScaleImage(scope)"
|
:src="scope.photoPath"
|
alt=""
|
/>
|
</template>
|
<template v-slot:type="{ scope }">
|
<span v-if="scope.type === 1">社区党委</span>
|
<span v-if="scope.type === 2">区域党委委员</span>
|
</template>
|
<template v-slot:sex="{ scope }">
|
<span v-if="scope.sex === 1">男</span>
|
<span v-if="scope.sex === 2">女</span>
|
</template>
|
<template v-slot:isReg="{ scope }">
|
{{ scope.isReg === 1 ? "是" : "否" }}
|
</template>
|
<template v-slot:btn="{ scope }">
|
<el-button type="text" @click="edit(scope)">编辑</el-button>
|
<el-button @click="clear(scope.id)" type="text">删除</el-button>
|
</template>
|
</v-tool-table>
|
<v-tool-page :item="paged" @on-page="onPage"></v-tool-page>
|
</div>
|
<!---->
|
<el-dialog
|
:title="dilogTitle"
|
:visible.sync="dialogVisible"
|
width="520px"
|
:modal="false"
|
:close-on-click-modal="false"
|
>
|
<div class="form-box test-1">
|
<el-form ref="form" :model="form" label-width="80px">
|
<el-form-item required label="手机号">
|
<el-input v-model="form.phone"></el-input>
|
</el-form-item>
|
<!---->
|
<el-form-item required label="身份证">
|
<el-input v-model="form.idCard"></el-input>
|
</el-form-item>
|
<!---->
|
<el-form-item required label="姓名">
|
<el-input v-model="form.name"></el-input>
|
</el-form-item>
|
<!---->
|
<el-form-item required label="党委标签">
|
<el-select v-model="form.type" placeholder="请选择活动区域">
|
<el-option label="社区党委" :value="1"></el-option>
|
<el-option label="区域党委委员" :value="2"></el-option>
|
</el-select>
|
</el-form-item>
|
<!---->
|
<el-form-item label="入党日期">
|
<el-date-picker
|
v-model="form.joinTime"
|
type="date"
|
value-format="yyyy-MM-dd"
|
placeholder="选择日期"
|
>
|
</el-date-picker>
|
</el-form-item>
|
<!---->
|
<el-form-item label="转正日期">
|
<el-date-picker
|
v-model="form.employmentTime"
|
type="date"
|
value-format="yyyy-MM-dd"
|
placeholder="选择日期"
|
>
|
</el-date-picker>
|
</el-form-item>
|
<!---->
|
<el-form-item label="职位">
|
<el-input v-model="form.position"></el-input>
|
</el-form-item>
|
<!---->
|
<el-form-item label="职位二">
|
<el-input v-model="form.positionTwo"></el-input>
|
</el-form-item>
|
<!---->
|
<el-form-item label="岗位职责">
|
<el-input v-model="form.jobResponsibilities"></el-input>
|
</el-form-item>
|
<!---->
|
<el-form-item required label="负责党组织">
|
<el-select v-model="form.orgId" placeholder="请选择负责党组织">
|
<el-option
|
v-for="item in OrgAllList"
|
:key="item.id"
|
:label="item.name"
|
:value="item.id"
|
></el-option>
|
</el-select>
|
</el-form-item>
|
<!---->
|
<el-form-item label="报到单位">
|
<el-select v-model="form.checkUnitId" placeholder="请选择报到单位">
|
<el-option
|
v-for="item in checkUnitList"
|
:key="item.id"
|
:label="item.name"
|
:value="item.id"
|
></el-option>
|
</el-select>
|
</el-form-item>
|
<!---->
|
<el-form-item label="职能">
|
<el-input v-model="form.function"></el-input>
|
</el-form-item>
|
<!---->
|
<el-form-item label="特长">
|
<el-input v-model="form.specialtyName">
|
<el-select
|
class="select-box"
|
v-model="form.specialtyCategory"
|
slot="prepend"
|
placeholder="请选择"
|
>
|
<el-option label="体育类" :value="1"></el-option>
|
<el-option label="舞蹈类" :value="2"></el-option>
|
<el-option label="音乐类" :value="3"></el-option>
|
<el-option label="美术类" :value="4"></el-option>
|
<el-option label="其他" :value="5"></el-option>
|
</el-select>
|
</el-input>
|
</el-form-item>
|
<!---->
|
<el-form-item label="照片">
|
<v-upload @path="onPath" :pic="form.photoPath"></v-upload>
|
</el-form-item>
|
</el-form>
|
</div>
|
|
<span slot="footer" class="dialog-footer">
|
<el-button @click="dialogVisible = false">取 消</el-button>
|
<el-button type="primary" @click="sub()">确 定</el-button>
|
</span>
|
</el-dialog>
|
<!---->
|
<el-dialog
|
title="导入"
|
:modal="false"
|
:close-on-click-modal="false"
|
:visible.sync="dialogVisible1"
|
width="30%"
|
>
|
<div>
|
<el-upload
|
name="file"
|
accept=".xls, .xlsx"
|
:headers="{ Authorization: Authorization }"
|
class="upload-demo"
|
:show-file-list="false"
|
:action="$js.api.http + 'communitypartybuilding/importPbMemberRole'"
|
:on-success="success"
|
:on-error="error"
|
multiple
|
>
|
<el-button type="primary" size="small">导入 </el-button>
|
</el-upload>
|
<el-button v-if="errMsg" @click="dowErr" type="text"
|
>下载错误信息</el-button
|
>
|
</div>
|
<span slot="footer" class="dialog-footer">
|
<el-button @click="dialogVisible1 = false">取 消</el-button>
|
<el-button type="primary" @click="dialogVisible1 = false"
|
>确 定</el-button
|
>
|
</span>
|
</el-dialog>
|
</div>
|
</template>
|
<script>
|
import vUpload from "com/upload/upload";
|
export default {
|
props: [],
|
components: { vUpload },
|
data() {
|
return {
|
dilogTitle: "新增社区党委",
|
bar: [
|
{
|
title: "关键字",
|
name: "keyWord",
|
plac: "请输入姓名、手机号、身份证进行查找",
|
width: "400px !important",
|
},
|
{
|
title: "党委标签",
|
name: "type",
|
type: "select",
|
list: [
|
{
|
label: "社区党委",
|
value: 1,
|
},
|
{
|
label: "区域党委委员",
|
value: 2,
|
},
|
],
|
},
|
{
|
title: "性别",
|
name: "sex",
|
type: "select",
|
list: [
|
{
|
label: "男",
|
value: 1,
|
},
|
{
|
label: "女",
|
value: 2,
|
},
|
],
|
},
|
],
|
trs: [
|
{ text: "序号", val: "id", width: "80px" },
|
{ text: "党员姓名", val: "name" },
|
{ text: "党员照片", val: "btn", slot: "photoPath" },
|
{ text: "党员标签", val: "btn", slot: "type" },
|
{ text: "性别", val: "btn", slot: "sex" },
|
{ text: "年龄", val: "age" },
|
{ text: "手机号", val: "phone" },
|
{ text: "是否注册", val: "btn", slot: "isReg" },
|
{ text: "职位", val: "position" },
|
{ text: "岗位职责", val: "jobResponsibilities" },
|
{ text: "负责党组织", val: "orgName" },
|
{ text: "报到单位", val: "checkUnitName" },
|
{ text: "特长", val: "specialtyName" },
|
{ text: "操作", val: "btn", width: "100px" },
|
],
|
tds: [],
|
search: {},
|
paged: { page: 0, total: 0, r: 0, limit: 10 },
|
dialogVisible: false,
|
form: {
|
phone: "",
|
idCard: "",
|
name: "",
|
type: "",
|
joinTime: "",
|
position: "",
|
positionTwo: "",
|
jobResponsibilities: "",
|
orgId: "",
|
checkUnitId: "",
|
specialtyName: "",
|
specialtyCategory: "",
|
},
|
OrgAllList: [],
|
checkUnitList: [],
|
dialogVisible1: false,
|
Authorization: "",
|
errMsg: "", //错误信息代码
|
};
|
},
|
created() {
|
this.Authorization = "Bearer " + demo.$session.get("token") || "";
|
this.getPbOrgAllList();
|
this.getCheckUnitList();
|
},
|
mounted() {},
|
methods: {
|
// 查看大图
|
onScaleImage(v) {
|
this.$store.dispatch("setImage", {
|
time: Date.now(),
|
title: v.name,
|
pic: v.photoPath,
|
tool: true,
|
});
|
},
|
showImport() {
|
this.dialogVisible1 = true;
|
this.errMsg = "";
|
},
|
success(e) {
|
console.log(e);
|
if (e.code === 500) {
|
this.errMsg = e.msg;
|
demo.toast("导入错误");
|
return;
|
}
|
this.errMsg = "";
|
this.dialogVisible1 = false;
|
this.init();
|
},
|
error(err) {
|
console.log(err);
|
demo.toast("导入失败");
|
},
|
dowErr() {
|
//
|
this.$api.get(
|
"communitypartybuilding/download/error/pbMemberRole",
|
{ key: this.errMsg },
|
(res) => {
|
// console.log(res)
|
location.href = res;
|
}
|
);
|
},
|
pbMemberRole() {
|
//下载模板
|
this.$api.get("communitypartybuilding/export/pbMemberRole", "", (res) => {
|
// console.log(res)
|
location.href = res;
|
});
|
},
|
edit(item) {
|
this.form = demo.copy(item);
|
this.dilogTitle = "编辑社区党委";
|
this.dialogVisible = true;
|
},
|
getPbOrgAllList() {
|
//
|
this.$api.get(
|
"communitypartybuilding/listpartyorganization",
|
{},
|
(res) => {
|
this.OrgAllList = res;
|
}
|
);
|
},
|
getCheckUnitList() {
|
this.$api.post("checkUnit/list", {}, (res) => {
|
this.checkUnitList = res;
|
});
|
},
|
sub() {
|
// demo.toast("请输入单位名称");
|
if (!this.form.phone) {
|
return demo.toast("请输入手机号");
|
}
|
if (!this.form.idCard) {
|
return demo.toast("请输入身份证");
|
}
|
if (!this.form.name) {
|
return demo.toast("请输入姓名");
|
}
|
if (!this.form.type) {
|
return demo.toast("请选择党委标签");
|
}
|
if (!this.form.specialtyCategory && this.form.specialtyName) {
|
return demo.toast("请选择特长类别");
|
}
|
if (this.form.specialtyCategory && !this.form.specialtyName) {
|
return demo.toast("请输入特长");
|
}
|
if (!this.form.orgId) {
|
return demo.toast("请选择负责党组织");
|
}
|
|
let data = demo.copy(this.form);
|
let type = data.id ? "put" : "post";
|
let url = data.id
|
? "communitypartybuilding/updatepartycommittee"
|
: "communitypartybuilding/addpartycommittee";
|
if (data.id) {
|
this.$api[type](url, data, (res) => {
|
demo.toast("操作成功");
|
this.dialogVisible = false;
|
this.init();
|
});
|
} else {
|
this.$api.get(
|
"communitypartybuilding/checkMember",
|
{
|
idCard: this.form.idCard,
|
},
|
(val) => {
|
if (!val) {
|
this.$confirm("已存在该党员,是否更新该党员资料?", "提示", {
|
confirmButtonText: "确定",
|
cancelButtonText: "取消",
|
type: "warning",
|
}).then(() => {
|
this.$api[type](url, data, (res) => {
|
demo.toast("操作成功");
|
this.dialogVisible = false;
|
this.init();
|
});
|
});
|
} else {
|
this.$api[type](url, data, (res) => {
|
demo.toast("操作成功");
|
this.dialogVisible = false;
|
this.init();
|
});
|
}
|
}
|
);
|
}
|
},
|
clear(id) {
|
this.$confirm("此操作将永久删除该数据, 是否继续?", "提示", {
|
confirmButtonText: "确定",
|
cancelButtonText: "取消",
|
type: "warning",
|
}).then(() => {
|
this.$api.del(
|
"communitypartybuilding/deletepartycommittee",
|
{ id },
|
(res) => {
|
console.log(res);
|
demo.toast("删除成功");
|
this.init();
|
}
|
);
|
});
|
},
|
onPath(v) {
|
this.form.photoPath = v;
|
},
|
add() {
|
this.dilogTitle = "新增社区党委";
|
for (let key in this.form) {
|
this.form[key] = "";
|
}
|
this.dialogVisible = true;
|
},
|
init() {
|
let v = demo.copy(
|
Object.assign(this.search, {
|
pageNum: this.paged.page,
|
pageSize: this.paged.limit,
|
})
|
);
|
this.$api.post("communitypartybuilding/pagepartycommittee", v, (res) => {
|
// console.log(res)
|
this.tds = res.records || [];
|
this.paged.total = res.total;
|
});
|
},
|
// 搜索
|
onSearch(val) {
|
let v = demo.copy(val);
|
this.search = v;
|
this.paged.page = 1;
|
this.init();
|
},
|
// 分页点击
|
onPage(v) {
|
if (v.page === this.paged.page && v.page && !v.reset) {
|
return 0;
|
}
|
this.paged.page = v.page;
|
this.paged.limit = v.limit;
|
this.init();
|
},
|
},
|
watch: {},
|
computed: {},
|
};
|
</script>
|
<style scoped lang="less">
|
.committee-box {
|
overflow: scroll;
|
.but-boxc {
|
padding-bottom: 20px;
|
}
|
.img {
|
width: 100px !important;
|
height: 100px !important;
|
/*object-fit: cover;*/
|
}
|
.form-box {
|
width: 90%;
|
padding-right: 30px;
|
height: 410px;
|
overflow-y: scroll;
|
.select-box {
|
width: 100px;
|
}
|
}
|
}
|
</style>
|