<template>
|
<div class="page_member">
|
<div class="nav">
|
<h3>报到单位管理</h3>
|
<el-tree
|
:props="defaultProps"
|
:load="loadNode"
|
node-key="id"
|
lazy
|
:expand-on-click-node="false"
|
:default-expanded-keys="defaultExpandedKeys"
|
@check-change="handleCheckChange"
|
@node-click="handleNodeClick"
|
>
|
</el-tree>
|
</div>
|
<div class="main">
|
<v-header :title="''" search :bar="bar" @on-search="onSearch"></v-header>
|
<!-- 按钮区 -->
|
<div class="tool" v-if="isZuZhibuUser">
|
<el-button size="medium" type="primary" @click="add">新增</el-button>
|
<!-- <el-button size="medium" type="primary" @click="send">导入</el-button>
|
<el-button size="medium" type="primary" @click="out">导出</el-button> -->
|
</div>
|
<!-- 正文 -->
|
<div class="cen">
|
<!-- list列表 -->
|
<!-- <div class="list">
|
<p class="text_overflow">党组织名称</p>
|
<v-tool-scroll ids="member-list-scroll" class="lists">
|
<ul>
|
<li
|
v-for="(i, j) in list"
|
:key="j"
|
class="text_overflow"
|
:class="{ active: listIndex === j }"
|
@click.stop="onList(i, j)"
|
>
|
{{ i.name }}
|
</li>
|
</ul>
|
</v-tool-scroll>
|
</div> -->
|
<!-- 表格+分页 -->
|
<div class="tab_data">
|
<div class="tab">
|
<v-table :trs="trs" :tds="tds" :height="450">
|
<template v-slot:btn="item">
|
<div class="table_flex">
|
<el-button type="text" size="small" @click="edit(item.scope)" v-if="backstageType != 1"
|
>编辑</el-button
|
>
|
<!-- <span @click="detail(item.scope)">查看</span> -->
|
<el-button type="text" size="small"
|
@click="del(item.scope)"
|
v-if="backstageType != 1 && backstageType != 4"
|
>删除</el-button
|
>
|
<el-button type="text" size="small"
|
@click="addAccount(item.scope)"
|
v-if="backstageType != 1 && backstageType != 4"
|
>添加账号</el-button
|
>
|
<el-button type="text" size="small"
|
@click="addProject(item.scope)"
|
v-if="backstageType != 1 && backstageType != 4"
|
>关联项目</el-button
|
>
|
</div>
|
</template>
|
<template v-slot:pic="item">
|
<div class="table_flex">
|
<img
|
:src="item.scope.photoPath || '/static/image/dh.jpg'"
|
@click="onScaleImage(item.scope)"
|
/>
|
</div>
|
</template>
|
<template v-slot:acc="item">
|
<div class="table_flex">
|
<b class="col_primary unline">{{ item.scope.phone }}</b>
|
</div>
|
</template>
|
</v-table>
|
</div>
|
<div class="page">
|
<v-tool-page :item="paged" @on-page="onPage"></v-tool-page>
|
</div>
|
</div>
|
</div>
|
</div>
|
<el-dialog
|
:close-on-click-modal="false"
|
:title="dialogTitle"
|
:visible.sync="dialogVisible"
|
:before-close="handleClose"
|
center
|
append-to-body
|
>
|
<el-form
|
:model="formInfo"
|
:rules="rules"
|
label-position="right"
|
ref="ruleForm"
|
label-width="130px"
|
class="demo-ruleForm"
|
>
|
<div>
|
<el-form-item label="登录账号" prop="account">
|
<el-input
|
style="width: 300px"
|
class="input-width"
|
maxlength="16"
|
placeholder="请输入4-16位字母的组合"
|
v-model.trim="formInfo.account"
|
></el-input>
|
</el-form-item>
|
<el-form-item label="登录密码" prop="password">
|
<el-input
|
type="password"
|
style="width: 300px"
|
class="input-width"
|
maxlength="20"
|
placeholder="请输入8-16位,且包含字母、数字、字符"
|
v-model.trim="formInfo.password"
|
>
|
</el-input>
|
</el-form-item>
|
<el-form-item label="确认密码" prop="confirmPssword">
|
<el-input
|
type="password"
|
style="width: 300px"
|
maxlength="20"
|
placeholder="请输入8-16位,且包含字母、数字、字符"
|
v-model.trim="formInfo.confirmPssword"
|
></el-input>
|
</el-form-item>
|
</div>
|
</el-form>
|
<div class="fl-cen">
|
<el-button @click="handleClose">取 消</el-button>
|
<el-button type="primary" @click="handleSubmit" :loading="btnloading"
|
>提交</el-button
|
>
|
</div>
|
</el-dialog>
|
</div>
|
</template>
|
|
<script>
|
import { mapState } from "vuex";
|
import { areaAccountReturn } from "../../../utils/common";
|
const REX_VAL = /^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\W_!@#$%^&*.`~()-+=]+$)(?![a-z0-9]+$)(?![a-z\W_!@#$%^&.*`~()-+=]+$)(?![0-9\W_!@#$%^.&*`~()-+=]+$)[a-zA-Z0-9\W_!@#$%^&.*`~()-+=]{8,16}$/;
|
export default {
|
props: {},
|
components: {},
|
data() {
|
const USER_NAME = (rule, value, callback) => {
|
const regExp = /^[A-Za-z]{4,16}$/;
|
if (!value) return callback(new Error("不能为空"));
|
if (regExp.test(value) === false) {
|
callback(new Error("请输入4-16位字母的组合"));
|
} else {
|
callback();
|
}
|
};
|
const VALIDATE_PASSWOID = (rule, value, callback) => {
|
const regExp = REX_VAL;
|
if (!value) return callback(new Error("不能为空"));
|
if (regExp.test(value) === false) {
|
callback(new Error("请输入4-请输入8-16位,且包含字母、数字、字符"));
|
} else {
|
callback();
|
}
|
};
|
const COMFIRM_PASSWOID = (rule, value, callback) => {
|
if (!value) return callback(new Error("不能为空"));
|
if (value !== this.formInfo.password) {
|
callback(new Error("两次密码不一样"));
|
} else {
|
callback();
|
}
|
};
|
|
return {
|
bar: [
|
{
|
title: "关键字",
|
name: "keyWord",
|
plac: "单位名称、党组织负责人、党组织负责人电话",
|
width: "320px !important"
|
},
|
{
|
title: "职能特长及服务意愿",
|
name: "specialtyName",
|
plac: "请选择",
|
type: "select",
|
list: [
|
{ label: "党建指导", value: 1, checkType: false },
|
{ label: "政策宣讲", value: 2, checkType: false },
|
{ label: "教育培训", value: 3, checkType: false },
|
{ label: "就业服务", value: 4, checkType: false },
|
{ label: "志愿服务", value: 5, checkType: false },
|
{ label: "维修服务", value: 6, checkType: false },
|
{ label: "家政服务", value: 7, checkType: false },
|
{ label: "其他", value: 8, checkType: false }
|
]
|
},
|
{
|
title: "所属党组织",
|
name: "orgName",
|
plac: "请选择",
|
type: "select",
|
list: []
|
},
|
{
|
title: "单位归属",
|
name: "belongTo",
|
plac: "请选择",
|
type: "select",
|
list: [
|
{
|
label: "市直属",
|
value: "市直属"
|
},
|
{
|
label: "西区",
|
value: "西区"
|
},
|
{
|
label: "东区",
|
value: "东区"
|
},
|
{
|
label: "仁和区",
|
value: "仁和区"
|
},
|
{
|
label: "盐边县",
|
value: "盐边县"
|
},
|
{
|
label: "米易县",
|
value: "米易县"
|
},
|
{
|
label: "钒钛高新区",
|
value: "钒钛高新区"
|
}
|
]
|
}
|
],
|
skillList: [],
|
total: 0,
|
os: { keyWord: "", account: "", name: "" },
|
paged: { page: 0, total: 0, r: 0, limit: 10 },
|
listIndex: -1,
|
areaType: false,
|
backstageType: "",
|
formInfo: {
|
account: "",
|
password: "",
|
confirmPssword: ""
|
}, // 表单
|
rules: {
|
account: [
|
{
|
required: true,
|
trigger: "blur",
|
validator: USER_NAME
|
}
|
],
|
password: [
|
{
|
required: true,
|
trigger: "blur",
|
validator: VALIDATE_PASSWOID
|
}
|
],
|
confirmPssword: [
|
{
|
required: true,
|
trigger: "blur",
|
validator: COMFIRM_PASSWOID
|
}
|
]
|
}, // 表单验证
|
trs: [
|
// {
|
// text: "账号",
|
// val: "btn",
|
// slot: "acc",
|
// color: true,
|
// table_status: [{ val: 0, key: "#38f" }],
|
// },
|
{ text: "序号", val: "id" , width: "200px"},
|
{ text: "所属党组织", val: "orgName" , width: "150px"},
|
{ text: "单位归属", val: "belongTo" , width: "100px"},
|
{ text: "单位名称", val: "name" , width: "100px"},
|
{ text: "单位性质", val: "natureName" , width: "100px"},
|
{ text: "服务社区", val: "helpCommunityName" , width: "100px"},
|
{
|
text: "下沉服务小区(网格)院落",
|
val: "villageName",
|
width: "220px"
|
},
|
{ text: "社区联系人", val: "helpCommunityContactsName" , width: "100px" },
|
{
|
text: "社区联系人电话",
|
val: "helpCommunityContacts",
|
width: "150px"
|
},
|
{ text: "党组织负责人", val: "contacts" , width: "120px"},
|
{ text: "党组织负责人电话", val: "phone", width: "180px" },
|
{ text: "职能特长及服务意愿", val: "specialtyName", width: "200px" },
|
// { text: "单位管理员", val: "adminName" },
|
// { text: "管理员手机号", val: "adminPhone" },
|
// { text: "党员照片", val: "btn", slot: "pic" },
|
// { text: "党员类型", val: "btn", slot: "type" },
|
// { text: "手机号", val: "phone" },
|
// { text: "常住社区", val: "communityName" },
|
// { text: "小区院落", val: "villageName" },
|
// { text: "职能特长及服务意愿", val: "specialtyName" },
|
// { text: "工作单位", val: "checkUnitName" },
|
// { text: "报到社区", val: "communityName" },
|
// {
|
// text: "状态",
|
// val: "status",
|
// },
|
{ text: "操作", val: "btn", width: "300px" ,fixed:"right"}
|
],
|
tds: [],
|
list: [],
|
isZuZhibuUser: false,
|
dialogVisible: false,
|
btnloading: false,
|
dialogTitle: "新增账号",
|
isUnitUser: "",
|
communityList: ["东区", "仁和区", "米易县", "盐边县", "西区"],
|
treeData: [],
|
defaultProps: {
|
children: "children",
|
label: "name"
|
},
|
count: 1,
|
defaultExpandedKeys: []
|
};
|
},
|
computed: {
|
...mapState({ vuex_page: "pageReset" })
|
},
|
watch: {
|
vuex_page: {
|
handler(n) {
|
if (n.page === this.$route.path) {
|
this.paged.page = 1;
|
this.init();
|
}
|
},
|
deep: true
|
}
|
},
|
methods: {
|
handleCheckChange(data, checked, indeterminate) {
|
console.log(data, checked, indeterminate);
|
},
|
handleNodeClick(data, node) {
|
console.log(data, node);
|
switch (node.level) {
|
case 2:
|
this.paged.page = 1;
|
this.paged.limit = 10;
|
this.os.belongTo = data.name;
|
this.init();
|
break;
|
case 3:
|
this.paged.page = 1;
|
this.paged.limit = 10;
|
this.os.orgName = data.name;
|
this.init();
|
break;
|
case 4:
|
this.paged.page = 1;
|
this.paged.limit = 10;
|
this.os.keyWord = data.name;
|
this.init();
|
break;
|
default:
|
break;
|
}
|
},
|
async loadNode(node, resolve) {
|
console.log(node);
|
const { level } = node;
|
let data = [];
|
let results = [];
|
switch (level) {
|
case 0:
|
data = [{ name: "组织部", id: "001" }];
|
resolve(data);
|
this.defaultExpandedKeys = ["001"];
|
break;
|
case 1:
|
data = [
|
{
|
name: "市直属",
|
id: "001001"
|
},
|
{
|
name: "西区",
|
id: "001002"
|
},
|
{
|
name: "东区",
|
id: "001003"
|
},
|
{
|
name: "仁和区",
|
id: "001004"
|
},
|
{
|
name: "盐边县",
|
id: "001005"
|
},
|
{
|
name: "米易县",
|
id: "001006"
|
},
|
{
|
name: "钒钛高新区",
|
id: "001007"
|
}
|
];
|
resolve(data);
|
break;
|
case 2:
|
results = await this.getTreeList({ name: node.data.name });
|
if (results) {
|
data = results
|
.filter(i => i.orgName && i.orgName)
|
.map(v => {
|
return { name: v.orgName, id: v.id };
|
});
|
}
|
resolve(data);
|
break;
|
case 3:
|
results = await this.getTreeList({ orgName: node.data.name });
|
if (results) {
|
data = results
|
.filter(i => i.name && i.name)
|
.map(v => {
|
return { name: v.name, id: v.id };
|
});
|
}
|
resolve(data);
|
break;
|
case 4:
|
resolve(data);
|
break;
|
default:
|
resolve(data);
|
break;
|
}
|
},
|
getTreeList(parameter) {
|
return new Promise((resolve, reject) => {
|
this.$api.post(
|
"checkUnit/treeList",
|
parameter,
|
res => {
|
resolve(res);
|
},
|
err => {
|
console.log(err);
|
reject([]);
|
}
|
);
|
});
|
},
|
// 所属党组织列表
|
getOrgnameList() {
|
// comPbCheckUnit/orgList
|
this.$api.get(
|
"checkUnit/orgList",
|
{},
|
res => {
|
const data = res.map(i => {
|
return { label: i.orgName, value: i.orgName };
|
});
|
for (let i = 0; i < this.bar.length; i++) {
|
if (this.bar[i].name == "orgName") {
|
this.bar[i].list = data;
|
break;
|
}
|
}
|
},
|
err => {
|
console.log(err);
|
}
|
);
|
},
|
// 查看大图
|
onScaleImage(v) {
|
this.$store.dispatch("setImage", {
|
time: Date.now(),
|
title: v.name,
|
pic: v.photoPath,
|
tool: true
|
});
|
},
|
addAccount(row) {
|
console.log(row.id);
|
this.formInfo.checkUnitId = row.id;
|
this.dialogVisible = true;
|
},
|
addProject(row) {
|
console.log(row.id);
|
this.$router.push(
|
"/unitProjectList?id=" + row.id + "&communityId=" + row.communityId
|
);
|
},
|
handleClose() {
|
this.$refs.ruleForm.resetFields(); // 重置form表单
|
this.formInfo = {
|
account: "",
|
password: "",
|
confirmPssword: ""
|
};
|
this.dialogVisible = false;
|
this.btnloading = false;
|
},
|
handleSubmit() {
|
this.$refs.ruleForm.validate(val => {
|
if (val) {
|
this.btnloading = true;
|
this.$api.post("checkUnit/addComPbCheckUser", this.formInfo, () => {
|
this.btnloading = false;
|
demo.toast(this.dialogTitle + "成功");
|
this.handleClose();
|
});
|
}
|
});
|
},
|
// 分页点击
|
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();
|
},
|
// 获取数据
|
init() {
|
let v = demo.copy(
|
Object.assign(this.os, {
|
pageNum: this.paged.page,
|
pageSize: this.paged.limit
|
})
|
);
|
console.log(v);
|
if (!this.isZuZhibuUser) {
|
v.communityId = demo.$session.get("user").communityId;
|
}
|
this.$api.post("checkUnit/page", v, e => {
|
this.paged.total = e.total;
|
this.paged.r++;
|
this.tds = e.records || [];
|
});
|
},
|
// 删除
|
del(v) {
|
let t = this;
|
t.$js.model("删除单位", "是否删除单位[" + v.name + "]", res => {
|
if (res) {
|
t.$api.get(
|
"/checkUnit/delete",
|
{
|
id: v.id
|
},
|
e => {
|
demo.toast("删除成功");
|
t.$nextTick(() => {
|
t.init();
|
});
|
}
|
);
|
}
|
});
|
},
|
// 档案
|
detail(v) {
|
demo.$session.set("member-detail", v);
|
this.$router.push(this.$nav.url("/unitInformation/" + v.id));
|
},
|
_open(type, title, data) {
|
let data2 = {
|
type,
|
title,
|
data
|
};
|
this.$store.dispatch("setFixed", {
|
event: "add",
|
data: {
|
type,
|
title,
|
data
|
},
|
time: Date.now()
|
});
|
},
|
// 编辑
|
edit(v) {
|
this.$router.push("/addUnit?id=" + v.id);
|
// v.orgId = v.orgId || "";
|
// this._open("member-add", "编辑", v);
|
},
|
// 新增
|
add() {
|
// this._open("member-add", "新增", { id: 0 });
|
this.$router.push("/addUnit");
|
},
|
// 导入
|
send() {
|
this._open("member-import");
|
},
|
out() {
|
this.$api.post("communitypartybuilding/member/export", this.os, e => {
|
// demo.location(e, { target: "open" });
|
window.location.href = e;
|
});
|
},
|
// 查询
|
onSearch(v) {
|
this.os = v;
|
this.paged.page = 1;
|
// this.listIndex = -1;
|
this.init();
|
},
|
// 点击党组织
|
onList(i, j) {
|
this.listIndex = j;
|
this.os.orgName = i.name;
|
this.init();
|
},
|
setlist() {
|
// this.$api.get(
|
// "communitypartybuilding/listpartyorganization",
|
// {
|
// communityId: demo.$session.get("user").communityId,
|
// },
|
// (e) => {
|
// this.list = e;
|
// }
|
// );
|
// this.$api.party((e) => {
|
// this.list = e;
|
// });
|
}
|
},
|
mounted() {
|
this.isZuZhibuUser = demo.$session.get("user").account == "zuzhibu";
|
this.isUnitUser = demo.$session.get("user").bindingCheckUnitId;
|
this.backstageType = demo.$session.get("user").backstageType;
|
this.is_community = this.communityList.indexOf(
|
demo.$session.get("user").name
|
);
|
this.areaType = areaAccountReturn(demo.$session.get("user").name);
|
if (this.areaType) {
|
this.bar.splice(2, 1);
|
}
|
this.setlist();
|
this.getOrgnameList();
|
// this.$api.post(
|
// "neighbor/pageNeighborTopicByAdmin",
|
// { pageNum: 1, pageSize: 9999 },
|
// (e) => {
|
// e.records.forEach((item) => {
|
// item.label = item.name;
|
// item.value = item.name;
|
// });
|
// this.bar[1].list = e.records;
|
// }
|
// );
|
}
|
};
|
</script>
|
<style lang="less" scoped>
|
.page_member {
|
display: flex;
|
overflow-y: auto;
|
padding-top: 20px;
|
.nav {
|
width: 252px;
|
height: 100%;
|
overflow: auto;
|
> h3 {
|
padding-bottom: 16px;
|
}
|
/deep/ .el-tree-node__label {
|
white-space: nowrap;
|
overflow: hidden;
|
text-overflow: ellipsis;
|
}
|
}
|
|
.main {
|
margin-left: 16px;
|
width: calc(100% - 252px - 16px);
|
}
|
|
.tool {
|
margin: 5px 0 15px;
|
}
|
.cen {
|
display: flex;
|
height: 500px;
|
> div {
|
height: 100%;
|
position: relative;
|
}
|
.list {
|
width: 160px;
|
p {
|
background-color: #f2f2f2;
|
font-size: 14px;
|
font-weight: 650;
|
}
|
.lists {
|
height: calc(~"100% - 40px");
|
}
|
p,
|
li {
|
height: 40px;
|
line-height: 40px;
|
}
|
li {
|
cursor: pointer;
|
transition: all 0.2s;
|
font-size: 13px;
|
text-indent: 5px;
|
}
|
li.active {
|
background-color: #1890ff;
|
color: #fff;
|
}
|
}
|
.tab_data {
|
width:100%;
|
|
.tab {
|
height: calc(~"100% - 50px");
|
width:100%;
|
}
|
.page {
|
height: 50px;
|
box-sizing: border-box;
|
padding-top: 10px;
|
}
|
}
|
}
|
}
|
</style>
|