Commit d87fcd76 authored by renjintao's avatar renjintao

部门导入page

parent b8520f72
This diff is collapsed.
...@@ -152,12 +152,23 @@ export default { ...@@ -152,12 +152,23 @@ export default {
//重新处理colum //重新处理colum
loadColum(columns) { loadColum(columns) {
let tempCol = this.$u.clone(columns); let tempCol = this.$u.clone(columns);
let doCol = []
tempCol.forEach((ele, index) => { tempCol.forEach((ele, index) => {
if (ele.key == "action" || ele.type == "selection" || ele.key == "ico") { if (ele.key == "action" || ele.type == "selection" || ele.key == "ico") {
ele.hide = true; ele.hide = true;
} }
if (ele.import) {
ele.hide = false
}
let temColObj = {
key: ele.key,
title: ele.title,
align: ele.align ? ele.align : 'left',
hide: ele.hide ? ele.hide : false,
}
doCol.push(temColObj)
}); });
this.colsIm = tempCol; this.colsIm = doCol;
this.colsIm.unshift({ this.colsIm.unshift({
type: 'index', type: 'index',
width: 80, width: 80,
...@@ -350,6 +361,9 @@ export default { ...@@ -350,6 +361,9 @@ export default {
let imData = []; let imData = [];
let imDataError = [] let imDataError = []
this.dataIm.forEach(ele => { this.dataIm.forEach(ele => {
if (ele.parent_Id && ele.parentTitle) { //部门管理导入暂时处置
ele.parent_Id = null
}
if (!ele.ico) { if (!ele.ico) {
imData.push(ele) imData.push(ele)
} else { } else {
......
...@@ -432,6 +432,7 @@ export default { ...@@ -432,6 +432,7 @@ export default {
location:'省市县', location:'省市县',
parent_Id:'上级部门', parent_Id:'上级部门',
property:'属性', property:'属性',
parentTitle:'上级部门'
}, },
instance: { instance: {
id: '主键', id: '主键',
......
...@@ -164,7 +164,7 @@ henq.getDepartAllName = (list,id) => { ...@@ -164,7 +164,7 @@ henq.getDepartAllName = (list,id) => {
list.map(u => { list.map(u => {
if(id==u.id) if(id==u.id)
{ {
names=u.name+"-"+names names=u.name+"/"+names
if (u.parent_Id>0) { if (u.parent_Id>0) {
getDepartAllName(list, u.parent_Id) getDepartAllName(list, u.parent_Id)
} }
......
...@@ -71,6 +71,11 @@ export default { ...@@ -71,6 +71,11 @@ export default {
aId: 0, aId: 0,
rowData: null, rowData: null,
columns: [{ columns: [{
key: "name",
title: this.l("name"),
align: "left",
},
{
key: "parent_Id", key: "parent_Id",
title: this.l("parent_Id"), title: this.l("parent_Id"),
align: "left", align: "left",
...@@ -83,11 +88,6 @@ export default { ...@@ -83,11 +88,6 @@ export default {
) )
} }
}, },
{
key: "name",
title: this.l("name"),
align: "left",
},
{ {
key: "code", key: "code",
title: this.l("code"), title: this.l("code"),
...@@ -101,7 +101,7 @@ export default { ...@@ -101,7 +101,7 @@ export default {
import: true, import: true,
render: (h, params) => { render: (h, params) => {
return h("span", {}, return h("span", {},
this.getCity(params.row.location ? params.row.location : 0)) this.getCityName(params.row.location ? params.row.location : 0))
} }
}, },
{ {
...@@ -277,7 +277,7 @@ export default { ...@@ -277,7 +277,7 @@ export default {
}) })
}, },
//根据value获取当前cityname //根据value获取当前cityname
getCity(val) { getCityName(val) {
let cities = this.$u.clone(this.cityDatas) let cities = this.$u.clone(this.cityDatas)
let label = ""; let label = "";
cities.forEach(ele => { cities.forEach(ele => {
...@@ -287,12 +287,32 @@ export default { ...@@ -287,12 +287,32 @@ export default {
}) })
return label return label
}, },
//根据Id获取上级到本级的部门名称 getCityValue(val) {
let cities = this.$u.clone(this.cityDatas)
let value = "";
cities.forEach(ele => {
if (val == ele.label) {
value = ele.value
}
})
return value
},
//根据Id获取上级的部门名称
getParentDepart(val) { getParentDepart(val) {
let departList = this.$u.clone(this.treeList) let departList = this.$u.clone(this.treeList)
return this.$u.getDepartAllName(departList, val) return this.$u.getDepartAllName(departList, val)
}, },
//根据名称获取上级部门的ID
getParentDepartName(val) {
let departList = this.$u.clone(this.treeList)
let value = null
departList.forEach(ele => {
if (val == ele.name) {
value = ele.id
}
})
return value
},
ok() { ok() {
this.init(); this.init();
this.modal = false; this.modal = false;
...@@ -340,7 +360,7 @@ export default { ...@@ -340,7 +360,7 @@ export default {
); );
}); });
tempCol1.forEach((ele1) => { tempCol1.forEach((ele1) => {
e[ele1.key] = this.getCity(e[ele1.key]); e[ele1.key] = this.getCityName(e[ele1.key]);
}); });
tempCol2.forEach((ele2) => { tempCol2.forEach((ele2) => {
e[ele2.key] = this.getParentDepart(e[ele2.key]); e[ele2.key] = this.getParentDepart(e[ele2.key]);
...@@ -374,12 +394,12 @@ export default { ...@@ -374,12 +394,12 @@ export default {
let tempList = []; let tempList = [];
tempData.forEach((ele) => { tempData.forEach((ele) => {
let obj = { let obj = {
parentTitle: ele.parentTitle ? ele.parentTitle : '', parentTitle: ele.parent_Id ? ele.parent_Id : '',
name: ele.name ? ele.name : '', //部门名称 name: ele.name ? ele.name : '', //部门名称
parent_Id: ele.parent_Id ? ele.parent_Id : 0, //上级部门 [id] parent_Id: ele.parent_Id ? ele.parent_Id : '', //上级部门 [id]
code: ele.code ? ele.code : '', //部门编号 code: ele.code ? ele.code : '', //部门编号
location: ele.location ? ele.location : '', //省市县 location: ele.location ? this.getCityValue(ele.location) : '', //省市县
isProduction: 1, //是否生产班组:1是,0否 isProduction: 0, //是否生产班组:1是,0否
property: ele.property ? ele.property : '' //属性 property: ele.property ? ele.property : '' //属性
}; };
if (ele.name && ele.name != '') { if (ele.name && ele.name != '') {
......
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 to comment