Commit f3684646 authored by renjintao's avatar renjintao

import plan

parent e2597f34
......@@ -61,6 +61,7 @@
<script>
import XLSX from "xlsx";
import Api from '@/plugins/request'
import {
Switch
} from "view-design";
......@@ -82,6 +83,7 @@ export default {
formatList: ["xlsx"],
columnsImport: [],
departArr: [], //部门list
usersArr: [],
sheetNames: [], //excel的表明
workBook: {},
openDatas: [],
......@@ -129,9 +131,21 @@ export default {
this.$api.get(`${systemUrl}/Department/GetDepartments`).then((r) => {
this.departArr = r.result.items;
});
this.$api.get(`${systemUrl}/user/getuserlist`)
.then((r) => {
if (r.success) {
this.usersArr = r.result
}
})
//导出对列表头进行预加载end
},
async fetch({
store,
params
}) {
await store.dispatch("loadDictionary"); // 加载数据字典
await store.dispatch("loadUsers"); // 加载数据字典
},
mounted() {
//if (this.eid > 0) {
// this.load(this.eid);
......@@ -144,6 +158,7 @@ export default {
this.tdHeightExcel = window.screenHeight - 180;
})();
};
},
methods: {
//重新处理colum
......@@ -198,6 +213,8 @@ export default {
temData = this.$u.clone(this.$refs.comExcel.excelData);
}
let arrTitleUse = []; ////使用数据字典的字段
let arrUseName = []; ////使用单个用户字段
let arrUseNames = []; ////使用多用户字段
temColPage.forEach((elCode) => {
if (elCode.code) {
arrTitleUse.push({
......@@ -205,6 +222,18 @@ export default {
code: elCode.code,
});
}
if (elCode.type == "user") {
arrUseName.push({
key: elCode.key,
code: elCode.type,
});
}
if (elCode.type == "users") {
arrUseNames.push({
key: elCode.key,
code: elCode.type,
});
}
});
let useData = []; //重新组织list列表数据
temData.forEach((elData, index) => {
......@@ -215,7 +244,7 @@ export default {
useData.push(objTm);
});
//对列表里的部门及数据字典项进行处理
//对列表里的部门及数据字典项、用户等进行处理
useData.forEach((eles) => {
//如果导入文件没有departmentid,但存在departmentTitle的话,通过title获取id
if (
......@@ -247,7 +276,32 @@ export default {
}
});
}
//人员名称转换为userid,如果查不到此人员,则为空
arrUseName.forEach((euser) => {
if (eles[euser.key] && eles[euser.key] != "" && eles[euser.key] != null) {
this.usersArr.forEach(eluser => {
if (eles[euser.key] == eluser.name) {
eles[euser.key] = eluser.id
}
})
}
});
//多个名称转换为数组
arrUseNames.forEach((eusers) => {
if (eles[eusers.key] && eles[eusers.key] != "" && eles[eusers.key] != null) {
let arruserstemp = this.$u.clone(eles[eusers.key].split(',') || eles[eusers.key].split(','))
let tempUserIds = []
arruserstemp.forEach(eltempUsers => {
this.usersArr.forEach(elusers => {
if (eltempUsers == elusers.name) {
tempUserIds.push(elusers.id)
}
})
})
eles[eusers.key] = tempUserIds
}
});
arrTitleUse.forEach((elem) => {
if (
eles[elem.key] &&
......@@ -436,6 +490,7 @@ export default {
this.dataIm = formatList;
this.batchImportUrl = url;
},
l(key) {
key = "user" + "." + key;
return this.$t(key);
......
......@@ -1824,7 +1824,8 @@ export default {
type: '类型',
attachment: '附件',
executor: '执行人',
upTitle:'上级名称'
upTitle:'上级名称',
deliverable:"交付物",
},
project_main: {
creationTime: '创建时间',
......@@ -2022,6 +2023,7 @@ document_category: {
deliverable:"交付物",
upId: '父级',
title: '标题',
upTitle:'上级名称',
status: '状态',
note: '描述',
startDate: '开始日期',
......
......@@ -489,7 +489,7 @@ export default {
startDate: ele.startDate ? ele.startDate : "", //?
endDate: ele.endDate ? ele.endDate : "", //?
direction: ele.direction ? ele.direction : 0,
executor: ele.executor ? ele.executor : null, //?
executor: ele.executor ? ele.executor : [], //?
};
if (ele.title && ele.title != '') {
......
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