老产品前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

393 lines
10 KiB

4 years ago
<template>
4 years ago
<div class="m-pop">
<div class="wrap">
<cpt-card>
<div class="title">
<img src="@/assets/img/shuju/title-tip.png" />
<span>更多信息</span>
</div>
<div class="btn-close" @click="handleClose">
<img src="@/assets/img/shuju/people/close.png" />
</div>
<div
:key="'fieldSubList' + index"
v-for="(fieldSubList, index) in fieldList"
>
<div class="list">
<div class="item" v-if="index == 0">
<span class="item-field">所属网格</span>
4 years ago
<span>{{ gridName }}</span>
4 years ago
</div>
<div class="item" v-if="index == 0">
<span class="item-field">所属小区</span>
4 years ago
<span>{{ xiaoquName }}</span>
4 years ago
</div>
<div class="item" v-if="index == 0">
<span class="item-field">所属楼宇</span>
4 years ago
<span>{{ louName }}-{{ danyuanName }}</span>
4 years ago
</div>
<div class="item" v-if="index == 0">
<span class="item-field">所属家庭</span>
4 years ago
<span>{{ homeName }}</span>
4 years ago
</div>
<div class="item" :key="field.itemId" v-for="field in fieldSubList">
<span class="item-field">{{ field.label }}</span>
<span
v-if="field.itemType == 'select' || field.itemType == 'radio'"
>{{
info[field.columnName] == null
? "--"
: getOptionLabel(field.options, info[field.columnName])
}}</span
>
<span v-else>{{
info[field.columnName] == null ? "--" : info[field.columnName]
}}</span>
</div>
</div>
<div class="line"></div>
</div>
<div class="tabs">
4 years ago
<div class="tab-btn" @click="subStartGroupIndex" v-if="groupList.length>9">
4 years ago
<img src="@/assets/img/shuju/people/arrow-double-left.png" />
</div>
<div
4 years ago
v-show="index >= startGroupIndex && index < startGroupIndex+9"
4 years ago
class="tab"
:class="groupIndex % groupList.length == index ? 'z-on' : ''"
:key="'tab' + index"
4 years ago
@click="groupIndex = index"
4 years ago
v-for="(item, index) in groupList"
>
{{ item.label }}
</div>
4 years ago
<div class="tab-btn" @click="addStartGroupIndex" v-if="groupList.length>9">
4 years ago
<img src="@/assets/img/shuju/people/arrow-double-right.png" />
</div>
</div>
<div
class="list"
:key="'group' + index"
v-show="groupIndex % groupList.length == index"
v-for="(group, index) in groupList"
>
<div class="item" :key="field.itemId" v-for="field in group.itemList">
<span class="item-field">{{ field.label }}</span>
<span
v-if="field.itemType == 'select' || field.itemType == 'radio'"
>{{
info[field.columnName] == null
? "--"
: getOptionLabel(field.options, info[field.columnName])
}}</span
>
<span v-else>{{
info[field.columnName] == null ? "--" : info[field.columnName]
}}</span>
</div>
</div>
</cpt-card>
</div>
4 years ago
</div>
</template>
<script>
4 years ago
import cptCard from "@/views/modules/visual/cpts/card";
import { requestPost } from "@/js/dai/request";
4 years ago
export default {
4 years ago
name: "peopleMore",
4 years ago
props: {
4 years ago
userId: {
4 years ago
type: String,
4 years ago
default: "",
4 years ago
},
4 years ago
gridName: {
4 years ago
type: String,
4 years ago
default: "",
4 years ago
},
4 years ago
},
4 years ago
components: {
cptCard,
4 years ago
},
4 years ago
data() {
return {
fieldList: [],
groupList: [],
groupIndex: 0,
4 years ago
startGroupIndex: 0,
4 years ago
info: {},
4 years ago
xiaoquList: [],
louList: [],
danyuanList: [],
homeList: [],
4 years ago
};
4 years ago
},
4 years ago
4 years ago
computed: {
xiaoquName() {
const {
xiaoquList,
info: { VILLAGE_ID },
} = this;
if (Array.isArray(xiaoquList) && xiaoquList.length > 0 && VILLAGE_ID) {
let item = xiaoquList.find((item) => item.value == VILLAGE_ID);
if (item) {
return item.label;
}
}
return "";
},
louName() {
const {
louList,
info: { BUILD_ID },
} = this;
if (Array.isArray(louList) && louList.length > 0 && BUILD_ID) {
let item = louList.find((item) => item.value == BUILD_ID);
if (item) {
return item.label;
}
}
return "";
},
danyuanName() {
const {
danyuanList,
info: { UNIT_ID },
} = this;
if (Array.isArray(danyuanList) && danyuanList.length > 0 && UNIT_ID) {
let item = danyuanList.find((item) => item.value == UNIT_ID);
if (item) {
return item.label;
}
}
return "";
},
danyuanName() {
const {
danyuanList,
info: { UNIT_ID },
} = this;
if (Array.isArray(danyuanList) && danyuanList.length > 0 && UNIT_ID) {
let item = danyuanList.find((item) => item.value == UNIT_ID);
if (item) {
return item.label;
}
}
return "";
},
homeName() {
const {
homeList,
info: { HOME_ID },
} = this;
if (Array.isArray(homeList) && homeList.length > 0 && HOME_ID) {
let item = homeList.find((item) => item.value == HOME_ID);
if (item) {
return item.label;
}
}
return "";
},
},
4 years ago
watch: {
4 years ago
userId() {
this.getInfo();
},
4 years ago
},
4 years ago
mounted() {
this.getApiData();
4 years ago
},
4 years ago
4 years ago
methods: {
4 years ago
addStartGroupIndex() {
const { startGroupIndex, groupList } = this;
if (startGroupIndex < groupList.length - 9) {
this.startGroupIndex = startGroupIndex + 1;
} else {
this.startGroupIndex = groupList.length - 9;
}
},
subStartGroupIndex() {
const { startGroupIndex, groupList } = this;
if (startGroupIndex > 0) {
this.startGroupIndex = startGroupIndex - 1;
} else {
this.startGroupIndex = 0;
}
},
4 years ago
handleClose() {
this.$emit("close");
4 years ago
},
4 years ago
4 years ago
async getApiData() {
4 years ago
this.getField();
4 years ago
await this.getInfo();
this.getXiaoquList();
this.getLouList();
this.getDanyuanList();
this.getHomeList();
4 years ago
},
4 years ago
getOptionLabel(options, value) {
if (Array.isArray(options)) {
let item = options.find((item) => item.value == value);
if (item && item.label) {
return item.label;
4 years ago
}
}
4 years ago
return "--";
4 years ago
},
4 years ago
//加载组织数据
async getField() {
const url = "/oper/customize/icform/getcustomerform";
const { data, code, msg } = await requestPost(url, {
dynamic: true,
formCode: "resi_base_info",
});
if (code === 0) {
this.groupList = data.groupList;
this.fieldList = (function (arr) {
let col = [];
let ele = [];
for (let i = 0; i < arr.length; i++) {
let item = arr[i];
if (item.itemType == "divider" || i == arr.length - 1) {
col.push([...ele]);
ele = [];
} else {
ele.push(item);
4 years ago
}
}
4 years ago
return col;
})(data.itemList);
this.fieldList.forEach((subList, index) => {
subList.forEach(async (item, subIndex) => {
if (item.optionSourceType == "remote" && item.optionSourceValue) {
this.fieldList[index][subIndex].options = await this.getOptions(
item.optionSourceValue
);
}
});
});
this.groupList.forEach((subList, index) => {
subList.itemList.forEach(async (item, subIndex) => {
if (item.optionSourceType == "remote" && item.optionSourceValue) {
this.groupList[index].itemList.options = await this.getOptions(
item.optionSourceValue
);
}
});
});
} else {
this.$message.error(msg);
}
4 years ago
},
4 years ago
//加载组织数据
async getInfo() {
const url = "/epmetuser/icresiuser/detail";
4 years ago
4 years ago
const { data, code, msg } = await requestPost(url, {
icResiUserId: this.userId,
formCode: "resi_base_info",
});
4 years ago
4 years ago
if (code === 0) {
this.info = data.ic_resi_user[0];
} else {
this.$message.error(msg);
}
},
4 years ago
4 years ago
//加载组织数据
async getOptions(url) {
if (!url) return [];
4 years ago
4 years ago
const { data, code, msg } = await requestPost(url, {});
4 years ago
4 years ago
if (code === 0) {
return data;
} else {
return [];
}
},
4 years ago
async getXiaoquList() {
const url = "/gov/org/icneighborhood/neighborhoodoption";
const { data, code, msg } = await requestPost(url, {
agencyId: this.info.AGENCY_ID,
gridId: this.info.GRID_ID,
});
if (code === 0) {
this.xiaoquList = data;
} else {
this.$message.error(msg);
}
},
async getLouList() {
const url = "/gov/org/icbuilding/buildingoption";
const { data, code, msg } = await requestPost(url, {
neighborHoodId: this.info.VILLAGE_ID,
});
if (code === 0) {
this.louList = data;
} else {
this.$message.error(msg);
}
},
async getDanyuanList() {
const url = "/gov/org/icbuildingunit/unitoption";
const { data, code, msg } = await requestPost(url, {
buildingId: this.info.BUILD_ID,
});
if (code === 0) {
this.danyuanList = data;
} else {
this.$message.error(msg);
}
},
async getHomeList() {
const url = "/gov/org/ichouse/houseoption";
const { data, code, msg } = await requestPost(url, {
unitId: this.info.UNIT_ID,
});
if (code === 0) {
this.homeList = data;
} else {
this.$message.error(msg);
}
},
4 years ago
},
};
</script>
<style lang="scss" src="@/assets/scss/people.scss" scoped></style>