Commit f3684646 authored by renjintao's avatar renjintao

import plan

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