提交 82de5d95 编写于 作者: zhentian.jia's avatar zhentian.jia

数据导入问题

上级 2fb52c45
...@@ -6,6 +6,7 @@ export const uploadExcel = (data,projectId) => { ...@@ -6,6 +6,7 @@ export const uploadExcel = (data,projectId) => {
// return utils.checkAuth(()=>{ // return utils.checkAuth(()=>{
return fetch({ return fetch({
headers: { headers: {
'Content-Type': 'application/json;charset=UTF-8',
sysCode: 12, sysCode: 12,
token: localStorage.getItem('storageToken'), token: localStorage.getItem('storageToken'),
}, },
......
...@@ -93,6 +93,7 @@ export const envConfig = { ...@@ -93,6 +93,7 @@ export const envConfig = {
workApiUrl: 'https://uat-work.yunqueyi.com/web', workApiUrl: 'https://uat-work.yunqueyi.com/web',
workApiSrc: 'https://uat-work.yunqueyi.com', workApiSrc: 'https://uat-work.yunqueyi.com',
reportUrl: 'https://uat-sc-report.yunqueyi.com/', reportUrl: 'https://uat-sc-report.yunqueyi.com/',
excelUrl: 'https://test-file.yunqueyi.com/File/template/onlineExam/',
}, },
pro: { pro: {
baseUrl: 'https://sc.yunqueyi.com/', baseUrl: 'https://sc.yunqueyi.com/',
...@@ -108,5 +109,6 @@ export const envConfig = { ...@@ -108,5 +109,6 @@ export const envConfig = {
workApiUrl: 'https://work.yunqueyi.com/web', workApiUrl: 'https://work.yunqueyi.com/web',
workApiSrc: 'https://work.yunqueyi.com', workApiSrc: 'https://work.yunqueyi.com',
reportUrl: 'https://sc-report.yunqueyi.com/', reportUrl: 'https://sc-report.yunqueyi.com/',
excelUrl: 'https://test-file.yunqueyi.com/File/template/onlineExam/',
} }
} }
...@@ -224,7 +224,12 @@ ...@@ -224,7 +224,12 @@
:limit="1" :limit="1"
:before-upload="beforeUpload" :before-upload="beforeUpload"
> >
<el-button type="primary" size="small">重新导入</el-button> <el-button
stype="position: absolute;top: -14px;"
type="primary"
size="small"
@click="updateAgain()"
>重新导入</el-button>
</el-upload> </el-upload>
</span> </span>
</el-dialog> </el-dialog>
...@@ -348,10 +353,11 @@ export default { ...@@ -348,10 +353,11 @@ export default {
dialogFull: false, dialogFull: false,
scopeRow: {}, scopeRow: {},
activeUser: "", activeUser: "",
updateNum: 50, updateNum: 0,
dialogSuccess: false, dialogSuccess: false,
failType: 2, failType: 2,
failNum: 2, failNum: 2,
failExcelUrl: "",
dialogFail: false, dialogFail: false,
defaultProps: { defaultProps: {
...@@ -376,6 +382,9 @@ export default { ...@@ -376,6 +382,9 @@ export default {
commonUtil.resizeHeight(); commonUtil.resizeHeight();
}, },
methods: { methods: {
updateAgain() {
vm.dialogFail = false;
},
download(type) { download(type) {
let downloadUrl = ""; let downloadUrl = "";
if (type == "model") { if (type == "model") {
...@@ -383,6 +392,7 @@ export default { ...@@ -383,6 +392,7 @@ export default {
"%E5%AF%BC%E5%85%A5%E9%A2%98%E7%9B%AE%E6%A8%A1%E6%9D%BF.xlsx" "%E5%AF%BC%E5%85%A5%E9%A2%98%E7%9B%AE%E6%A8%A1%E6%9D%BF.xlsx"
); );
} else if (type == "fail") { } else if (type == "fail") {
downloadUrl = vm.failExcelUrl;
} }
console.log("下载", type, downloadUrl); console.log("下载", type, downloadUrl);
setTimeout(() => { setTimeout(() => {
...@@ -390,6 +400,8 @@ export default { ...@@ -390,6 +400,8 @@ export default {
}, 500); }, 500);
}, },
beforeUpload(file) { beforeUpload(file) {
vm.dialogFail = false;
console.log(file); console.log(file);
let arr = file.type.split("/"); let arr = file.type.split("/");
let ext = "." + arr[1]; let ext = "." + arr[1];
...@@ -403,7 +415,7 @@ export default { ...@@ -403,7 +415,7 @@ export default {
}; };
let fileArray = [ let fileArray = [
{ {
type: "", type: 6,
base64: fileJson base64: fileJson
} }
]; ];
...@@ -414,7 +426,36 @@ export default { ...@@ -414,7 +426,36 @@ export default {
console.log("req", req); console.log("req", req);
let reqStr = JSON.stringify(req); let reqStr = JSON.stringify(req);
console.log("reqStr", reqStr); console.log("reqStr", reqStr);
openLoading(vm);
uploadExcel(reqStr, projectId).then(res => { uploadExcel(reqStr, projectId).then(res => {
closeLoading(vm);
if (res.code == "000000") {
if (res.data.success == true) {
//导入成功
vm.dialogSuccess = true;
vm.updateNum = res.data.total;
vm.queryRoleList();
} else {
if (res.data.outCount == true) {
//导入数据超5000
vm.failType = 1;
vm.dialogFail = true;
vm.failNum = res.data.total;
vm.failExcelUrl = res.data.url;
} else {
//导入失败
setTimeout(function() {
vm.failType = 2;
vm.dialogFail = true;
vm.failNum = res.data.total;
vm.failExcelUrl = res.data.url;
}, 700);
}
}
} else {
//接口失败
vm.$message.error(res.message);
}
console.log(res); console.log(res);
}); });
}; };
...@@ -442,7 +483,8 @@ export default { ...@@ -442,7 +483,8 @@ export default {
vm.tableData = res.data.projectRoleInfoModels; vm.tableData = res.data.projectRoleInfoModels;
vm.totalRows = res.data.total; vm.totalRows = res.data.total;
vm.activeUser = res.data.activeUser; vm.activeUser = res.data.activeUser;
console.log("activeUser", vm.activeUser); vm.creator = res.data.creator;
console.log("activeUser", vm.activeUser, "vm.creator", vm.creator);
//this.roleList = setRoleList(res.data.roleList); //this.roleList = setRoleList(res.data.roleList);
this.organizationList = res.data.organizationList; this.organizationList = res.data.organizationList;
this.departmentsList = res.data.departmentsList; this.departmentsList = res.data.departmentsList;
...@@ -527,6 +569,11 @@ export default { ...@@ -527,6 +569,11 @@ export default {
if (projeceRole == "L2" || projeceRole == "L3") { if (projeceRole == "L2" || projeceRole == "L3") {
flag = true; flag = true;
} }
} else if (row.projeceRole == "L2" && vm.creator == true) {
//创建项目项目管理员可以修改其他项目管理员
if (projeceRole == "L0") {
flag = true;
}
} }
} else if (vm.activeUser == "L3") { } else if (vm.activeUser == "L3") {
//当前次级负责人 //当前次级负责人
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册