<template>
|
<div class='sys_config'>
|
<v-header title="系统配置信息"></v-header>
|
<div class="fm">
|
<section class="sec">
|
<p class="label">居民专享政策标签:</p>
|
<article class="flex">
|
<span
|
v-for="(i,j) in list"
|
:key="j+'-list-user'"
|
>
|
<b v-if="i.id>=0">{{i.tagName}}</b>
|
<el-input
|
v-else
|
size="small"
|
v-model="i.tagName"
|
@keyup.native.13="enter"
|
class="bor"
|
></el-input>
|
<i
|
class="close el-icon-close"
|
@click="del(i)"
|
></i>
|
</span>
|
<span
|
class="circle"
|
@click="add"
|
><i class="el-icon-plus"></i></span>
|
</article>
|
</section>
|
<section
|
class="sec"
|
data-error="不同类型以逗号隔开"
|
>
|
<p class="label">建筑类型:</p>
|
<article>
|
<el-input
|
size="small"
|
placeholder="医疗/生活/便民/娱乐/其他"
|
v-model.trim="val"
|
></el-input>
|
</article>
|
</section>
|
<section class="sec">
|
<p class="label">生存认证方式:</p>
|
<article>
|
<div class="t">
|
<el-radio
|
label="2"
|
v-model="rz"
|
>人脸认证</el-radio>
|
<el-radio
|
label="1"
|
v-model="rz"
|
>视频认证</el-radio>
|
</div>
|
</article>
|
</section>
|
<section class="sec">
|
<p class="label">养老认证方式:</p>
|
<article>
|
<div class="t">
|
<el-radio
|
label="2"
|
v-model="yl"
|
>人脸认证</el-radio>
|
<el-radio
|
label="1"
|
v-model="yl"
|
>视频认证</el-radio>
|
</div>
|
</article>
|
</section>
|
<section class="sec">
|
<p class="label">可发布议事投票:</p>
|
<article class="checkbox-margin">
|
<el-checkbox-group v-model="voteUser">
|
<el-checkbox v-for="type in voteUserList" :label="type.value" :key="type.value">{{type.label}}</el-checkbox>
|
</el-checkbox-group>
|
</article>
|
</section>
|
</div>
|
<div class="btn">
|
<el-button
|
type="primary"
|
size="small"
|
@click="sub"
|
>确认</el-button>
|
<!-- <el-button
|
size="small"
|
@click="close"
|
>取消</el-button> -->
|
</div>
|
<router-link
|
v-if="false"
|
to="/pc_config"
|
class="col_info link"
|
>本地配置</router-link>
|
</div>
|
</template>
|
|
<script>
|
export default {
|
props: {},
|
components: {},
|
data() {
|
return {
|
list: [],
|
city: [],
|
val: "",
|
now: "",
|
rz: "",
|
drz: "",
|
yl:'',
|
voteUser:[],
|
voteUserList:[
|
{
|
label:"全部",
|
value:1,
|
},
|
{
|
label:"党员",
|
value:2,
|
},
|
{
|
label:"志愿者",
|
value:3,
|
},
|
{
|
label:"社区工作人员",
|
value:4
|
},
|
]
|
};
|
},
|
watch: {
|
rz(n) {
|
if (+this.drz === +n) return 0;
|
if (n === undefined || n === "undefined") return 0;
|
this.drz = n;
|
this.$api.put("eldersauthrecords/authType/" + n, {}, (e) => {
|
// demo.toast("保存成功");
|
});
|
},
|
yl(n) {
|
this.$api.put("eldersauth/pensionAuthRecords/authType/" + n, {}, (e) => {
|
// demo.toast("保存成功");
|
});
|
}
|
},
|
methods: {
|
init() {
|
this.$api.get("systemmanagement/config", {}, (e) => {
|
this.list = e.comMngUserTagVOList || [];
|
this.city = e.comMngStructBuildTypeVOList || [];
|
this.val = this.city
|
.map((k) => {
|
return k.name;
|
})
|
.join(",");
|
});
|
this.$api.get("eldersauthrecords/authtype", {}, (e) => {
|
this.rz = this.drz = e + "";
|
});
|
this.$api.get("eldersauth/pensionAuthRecords/authtype", {}, (e) => {
|
this.yl = e;
|
});
|
this.$api.get("discuss/jurisdiction/get", {}, (e) => {
|
this.voteUser = (e?e.split(','):[]).map(Number)
|
});
|
},
|
enter() {
|
this.validate(() => {});
|
},
|
sub() {
|
let t = this;
|
let list = t.list.map((k) => {
|
if (k.id >= t.now) {
|
k.id = 0;
|
}
|
return k;
|
});
|
if(t.val.charAt(t.val.length-1)===','){
|
return demo.toast("请输入正确的建筑类型");
|
}
|
if(!t.voteUser.length) {
|
return demo.toast("请选择可发布议事投票人员")
|
} else {
|
this.$api.put(`discuss/jurisdiction/set/${this.voteUser}`, os, (e) => {
|
demo.toast("设置成功");
|
});
|
}
|
let city = t.val.split(",");
|
let v = t.city.map((k) => {
|
return k.name;
|
});
|
let q = [];
|
let r = [];
|
if (city.length) {
|
city.forEach((k) => {
|
if (v.indexOf(k) < 0) {
|
q.push({ id: 0, name: k });
|
}
|
});
|
t.city.forEach((k) => {
|
if (city.indexOf(k.name) >= 0) {
|
r.push(k);
|
}
|
});
|
}
|
let os = {
|
comMngUserTagVOList: list,
|
comMngStructBuildTypeVOList: r.concat(q),
|
};
|
this.$api.put("systemmanagement/config", os, (e) => {
|
demo.toast("设置成功");
|
});
|
},
|
|
del(i) {
|
this.list = this.list.filter((k) => {
|
return k.id !== i.id;
|
});
|
},
|
validate(fn) {
|
let v = this.list.filter((k) => {
|
return (k.tagName + "").split(" ").join("") === "";
|
});
|
if (v.length) {
|
demo.toast("请输入用户标签");
|
return 0;
|
}
|
this.list = this.list.map((k) => {
|
if (k.id < 0) {
|
k.id *= -1;
|
}
|
return k;
|
});
|
fn();
|
},
|
add() {
|
this.validate(() => {
|
this.list.push({ id: -Date.now(), tagName: "" });
|
});
|
},
|
},
|
mounted() {
|
this.now = demo.timeout("", "zero");
|
this.init();
|
},
|
};
|
</script>
|
<style lang="less">
|
.sys_config {
|
.el-input__inner:focus {
|
border-color: #c0c4cc !important;
|
}
|
.bor .el-input__inner {
|
border: 0 !important;
|
}
|
}
|
</style>
|
<style lang='less' scoped>
|
.sys_config {
|
overflow-y: auto;
|
.checkbox-margin {
|
line-height: 40px;
|
padding-left: 10px;
|
}
|
.el-input {
|
max-width: 300px;
|
}
|
.btn {
|
margin: 10px 0;
|
padding: 30px 0;
|
}
|
.label {
|
line-height: 40px;
|
width: 140px;
|
}
|
.flex {
|
display: flex;
|
flex-wrap: wrap;
|
span {
|
position: relative;
|
box-sizing: border-box;
|
line-height: 33px;
|
height: 35px;
|
border: 1px solid #666;
|
padding: 0 10px;
|
font-size: 14px;
|
border-radius: 5px;
|
margin: 6px 20px 6px 0;
|
.el-input {
|
transform: translateY(-1px);
|
}
|
.close {
|
position: absolute;
|
right: -8px;
|
top: -8px;
|
background-color: #fff;
|
width: 16px;
|
height: 16px;
|
text-align: center;
|
color: tomato;
|
border: 1px solid tomato;
|
box-sizing: border-box;
|
border-radius: 50%;
|
cursor: pointer;
|
transition: all 0.3s;
|
opacity: 0;
|
transform: scale(0);
|
}
|
&:hover {
|
.close {
|
opacity: 1;
|
transform: scale(1);
|
}
|
}
|
&.circle {
|
cursor: pointer;
|
width: 30px;
|
height: 30px;
|
font-size: 20px;
|
text-align: center;
|
border-radius: 50%;
|
line-height: 28px;
|
margin: 8px 0;
|
padding: 0;
|
}
|
}
|
}
|
.link {
|
font-size: 12px;
|
}
|
.t {
|
padding: 10px 0 0 10px;
|
}
|
}
|
</style>
|