Commit 8421802e by e

111

parent e94d4945
Showing with 34 additions and 55 deletions
......@@ -42,7 +42,6 @@
readonly
clickable
v-model="obj.infoRegisteredResidence"
label="户口性质"
placeholder="请选择"
@click="showCategory = true"
......@@ -52,7 +51,6 @@
readonly
clickable
v-model="obj.unitPreSocialStatus"
label="前期社保状态"
placeholder="请选择"
@click="showSocialStatus = true"
......@@ -62,7 +60,6 @@
readonly
clickable
v-model="obj.unitPrePaymentType"
label="前期缴费种类"
placeholder="请选择"
@click="showPaymentType = true"
......@@ -72,7 +69,6 @@
readonly
clickable
v-model="obj.unitPreSocialCity"
label="原社保缴纳省市"
placeholder="请选择"
@click="showSocialCity = true"
......@@ -84,7 +80,6 @@
readonly
clickable
v-model="obj.unitRelationUnit"
label="与原单位关系"
placeholder="请选择"
@click="showRelationUnit = true"
......@@ -94,7 +89,6 @@
readonly
clickable
v-model="obj.unitPreEmploymentStatus"
label="前期就业状态"
placeholder="请选择"
@click="showEmploymentStatus = true"
......@@ -187,7 +181,8 @@ import { Component } from "vue-property-decorator";
export default class socialInfo extends Vue {
private obj: any = {};
private city: any = {};
private main_city: any = [];
private parents: any = [];
private childrens: any = [];
private show: boolean = false;
private showCategory: boolean = false;
private showSocialStatus: boolean = false;
......@@ -257,61 +252,45 @@ export default class socialInfo extends Vue {
private getCityList(): void {
this.$server.EmployeeService.getCityList({})
.then(res => {
console.log("citylist", JSON.stringify(res));
console.log("citylist", res);
this.city = res;
for (let i = 0; i < this.city.length; i++) {
if (this.city[i].parentId == 0) {
this.main_city.push(this.city[i].name);
this.parents.push(this.city[i]);
}
if (this.city[i].parentId != 0) {
this.childrens.push(this.city[i]);
}
}
console.log(this.main_city);
// let attr = {
// id: "id",
// parentId: "parentId",
// name: "name",
// rootId: 1
// };
// function toTreeData(data, attr) {
// let tree = [];
// let resData = data;
// for (let i = 0; i < resData.length; i++) {
// if (resData[i].parentId === attr.rootId) {
// let obj = {
// id: resData[i][attr.id],
// name: resData[i][attr.name],
// children: []
// };
// tree.push(obj);
// resData.splice(i, 1);
// i--;
// }
// }
// var run = function(treeArrs) {
// if (resData.length > 0) {
// for (let i = 0; i < treeArrs.length; i++) {
// for (let j = 0; j < resData.length; j++) {
// if (treeArrs[i].id === resData[j][attr.parentId]) {
// let obj = {
// id: resData[j][attr.id],
// name: resData[j][attr.name],
// children: []
// };
// treeArrs[i].children.push(obj);
// resData.splice(j, 1);
// j--;
// }
// }
// run(treeArrs[i].children);
// }
//没有父节点的数据
console.log(this.parents);
//有父节点的数据
console.log(this.childrens);
//遍历父节点数据
// this.parents.forEach((parent: any) => {
// //遍历子节点数据
// this.childrens.forEach((current: any, index: any) => {
// //此时找到父节点对应的一个子节点
// if (current.parentId === parent.id) {
// //对子节点数据进行深复制,这里只支持部分类型的数据深复制,对深复制不了解的童靴可以先去了解下深复制
// let temp = JSON.parse(JSON.stringify(children));
// //让当前子节点从temp中移除,temp作为新的子节点数据,这里是为了让递归时,子节点的遍历次数更少,如果父子关系的层级越多,越有利
// temp.splice(index, 1);
// //让当前子节点作为唯一的父节点,去递归查找其对应的子节点
// translator([current], temp);
// //把找到子节点放入父节点的children属性中
// typeof parent.children !== "0"
// ? parent.children.push(current)
// : (parent.children = [current]);
// }
// };
// run(tree);
// return tree;
// }
// let arr = toTreeData(allDatas, attr);
// console.log(arr);
// });
// });
})
.catch(error => {
console.log(error);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment