提交 2fb52c45 编写于 作者: zhentian.jia's avatar zhentian.jia

导入模板和下载导入模板问题

上级 3a99537f
import fetch from '../fetch';
import { getBaseUrl } from '@/utils/index';
export const uploadExcel = (data,projectId) => {
// return utils.checkAuth(()=>{
return fetch({
headers: {
sysCode: 12,
token: localStorage.getItem('storageToken'),
},
url: getBaseUrl('portal/portalProjectOrRole/importRoleFile?projectId='+projectId),
method: 'post',
data: data,
description: '上传excel文件',
})
// })
}
\ No newline at end of file
...@@ -30,6 +30,7 @@ export const envConfig = { ...@@ -30,6 +30,7 @@ export const envConfig = {
reportUrl: 'https://dev-sc-report.yunqueyi.com/', reportUrl: 'https://dev-sc-report.yunqueyi.com/',
// reportUrl: 'https://test1-sc-report.yunqueyi.com/', // reportUrl: 'https://test1-sc-report.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/',
}, },
dev: { dev: {
baseUrl: 'https://dev-sc.yunqueyi.com/', baseUrl: 'https://dev-sc.yunqueyi.com/',
...@@ -45,6 +46,7 @@ export const envConfig = { ...@@ -45,6 +46,7 @@ export const envConfig = {
workApiUrl: 'https://dev-work.yunqueyi.com/web', workApiUrl: 'https://dev-work.yunqueyi.com/web',
workApiSrc: 'https://dev-work.yunqueyi.com', workApiSrc: 'https://dev-work.yunqueyi.com',
reportUrl: 'https://dev-sc-report.yunqueyi.com/', reportUrl: 'https://dev-sc-report.yunqueyi.com/',
excelUrl: 'https://test-file.yunqueyi.com/File/template/onlineExam/',
}, },
test: { test: {
baseUrl: 'https://test1-sc.yunqueyi.com/', baseUrl: 'https://test1-sc.yunqueyi.com/',
...@@ -60,6 +62,7 @@ export const envConfig = { ...@@ -60,6 +62,7 @@ export const envConfig = {
workApiUrl: 'https://test1-work.yunqueyi.com/web', workApiUrl: 'https://test1-work.yunqueyi.com/web',
workApiSrc: 'https://test1-work.yunqueyi.com', workApiSrc: 'https://test1-work.yunqueyi.com',
reportUrl: 'https://test1-sc-report.yunqueyi.com/', reportUrl: 'https://test1-sc-report.yunqueyi.com/',
excelUrl: 'https://test-file.yunqueyi.com/File/template/onlineExam/',
}, },
test2: { test2: {
baseUrl: 'https://test2-work.yunqueyi.com/sc/', baseUrl: 'https://test2-work.yunqueyi.com/sc/',
...@@ -74,6 +77,7 @@ export const envConfig = { ...@@ -74,6 +77,7 @@ export const envConfig = {
workApiUrl: 'https://test2-work.yunqueyi.com/web', workApiUrl: 'https://test2-work.yunqueyi.com/web',
workApiSrc: 'https://test2-work.yunqueyi.com', workApiSrc: 'https://test2-work.yunqueyi.com',
reportUrl: 'https://test2-sc-report.yunqueyi.com/', reportUrl: 'https://test2-sc-report.yunqueyi.com/',
excelUrl: 'https://test-file.yunqueyi.com/File/template/onlineExam/',
}, },
uat: { uat: {
baseUrl: 'https://uat-sc.yunqueyi.com/', baseUrl: 'https://uat-sc.yunqueyi.com/',
......
...@@ -210,4 +210,9 @@ function getConfigByEnvType(urlType) { ...@@ -210,4 +210,9 @@ function getConfigByEnvType(urlType) {
// 获取report服务器域名地址 // 获取report服务器域名地址
export function getReportUrl(url) { export function getReportUrl(url) {
return getConfigByEnvType('reportUrl') + url return getConfigByEnvType('reportUrl') + url
}
// 获取SC服务器域名地址
export function getExeclUrl(url) {
return getConfigByEnvType('excelUrl') + url
} }
\ No newline at end of file
...@@ -89,11 +89,18 @@ ...@@ -89,11 +89,18 @@
<span v-if="scope.row.projeceRole == 'L2'">全部地区</span> <span v-if="scope.row.projeceRole == 'L2'">全部地区</span>
<span v-if="scope.row.projeceRole == 'L4'">-</span> <span v-if="scope.row.projeceRole == 'L4'">-</span>
<span v-if="scope.row.projeceRole == 'L3' && scope.row.regions.length == 0">-</span> <span v-if="scope.row.projeceRole == 'L3' && scope.row.regions.length == 0">-</span>
<span v-if="scope.row.projeceRole == 'L3' && scope.row.regions.length == 1">{{ scope.row.regions[0] }}</span> <span
<el-popover v-if="scope.row.projeceRole == 'L3' && scope.row.regions.length > 1" placement="bottom" title width="200" trigger="hover" class="more-text"> v-if="scope.row.projeceRole == 'L3' && scope.row.regions.length == 1"
<p class="more-text"> >{{ scope.row.regions[0] }}</span>
{{ scope.row.regions | areaList }} <el-popover
</p> v-if="scope.row.projeceRole == 'L3' && scope.row.regions.length > 1"
placement="bottom"
title
width="200"
trigger="hover"
class="more-text"
>
<p class="more-text">{{ scope.row.regions | areaList }}</p>
<p slot="reference">{{ scope.row | areaText }}</p> <p slot="reference">{{ scope.row | areaText }}</p>
</el-popover> </el-popover>
</template> </template>
...@@ -272,6 +279,8 @@ import BreadCrumb from "../../components/breadcrumb.vue"; ...@@ -272,6 +279,8 @@ import BreadCrumb from "../../components/breadcrumb.vue";
import { create } from "domain"; import { create } from "domain";
import { openLoading, closeLoading } from "../../utils/utils"; import { openLoading, closeLoading } from "../../utils/utils";
import * as commonUtil from "../../utils/utils"; import * as commonUtil from "../../utils/utils";
import { getExeclUrl } from "@/utils/index";
import { uploadExcel } from "@/utils/education/educationApi";
let vm = null; let vm = null;
export default { export default {
components: { components: {
...@@ -310,6 +319,10 @@ export default { ...@@ -310,6 +319,10 @@ export default {
// label: "内部管理员", // label: "内部管理员",
// value: "L1" // value: "L1"
// }, // },
{
label: "全部",
value: ""
},
{ {
label: "项目负责人", label: "项目负责人",
value: "L2" value: "L2"
...@@ -351,7 +364,7 @@ export default { ...@@ -351,7 +364,7 @@ export default {
tagsRegion: [], tagsRegion: [],
doctorId: "", doctorId: "",
allSelectedKeys: [], allSelectedKeys: [],
attachRegionId: "", attachRegionId: ""
}; };
}, },
created() { created() {
...@@ -364,10 +377,48 @@ export default { ...@@ -364,10 +377,48 @@ export default {
}, },
methods: { methods: {
download(type) { download(type) {
console.log("下载", type); let downloadUrl = "";
if (type == "model") {
downloadUrl = getExeclUrl(
"%E5%AF%BC%E5%85%A5%E9%A2%98%E7%9B%AE%E6%A8%A1%E6%9D%BF.xlsx"
);
} else if (type == "fail") {
}
console.log("下载", type, downloadUrl);
setTimeout(() => {
window.open(downloadUrl);
}, 500);
}, },
beforeUpload(file) { beforeUpload(file) {
console.log(file); console.log(file);
let arr = file.type.split("/");
let ext = "." + arr[1];
let name = file.name;
let reader = new FileReader();
reader.onload = function(e) {
let fileJson = {
fileName: file.name,
file: e.target.result.substr(e.target.result.indexOf("base64,") + 7),
ext: ext
};
let fileArray = [
{
type: "",
base64: fileJson
}
];
let req = {
fileArray: fileArray
};
let projectId = vm.formInline.portalProjectId;
console.log("req", req);
let reqStr = JSON.stringify(req);
console.log("reqStr", reqStr);
uploadExcel(reqStr, projectId).then(res => {
console.log(res);
});
};
reader.readAsDataURL(file);
}, },
searchList() { searchList() {
this.formInline.pageNo = 1; this.formInline.pageNo = 1;
...@@ -629,7 +680,7 @@ export default { ...@@ -629,7 +680,7 @@ export default {
return { type: 2, key: key }; return { type: 2, key: key };
}), }),
allSelectedKeys = savedCheckedKeys.concat(savedHalfCheckedKeys); allSelectedKeys = savedCheckedKeys.concat(savedHalfCheckedKeys);
// console.log('allSelectedKeys值:',allSelectedKeys) // console.log('allSelectedKeys值:',allSelectedKeys)
return allSelectedKeys; return allSelectedKeys;
}, },
// 递归删除列表中所有子节点 // 递归删除列表中所有子节点
...@@ -763,23 +814,24 @@ export default { ...@@ -763,23 +814,24 @@ export default {
attachRegionId: vm.attachRegionId, attachRegionId: vm.attachRegionId,
doctorId: vm.doctorId, doctorId: vm.doctorId,
projectId: vm.formInline.portalProjectId, projectId: vm.formInline.portalProjectId,
scopeOfAdministrative: vm.getScope(), scopeOfAdministrative: vm.getScope()
}; };
console.log("req", req); console.log("req", req);
vm.POST("portal/portalProjectOrRole/insertOrUpdateAttachRegion", req).then( vm.POST(
res => { "portal/portalProjectOrRole/insertOrUpdateAttachRegion",
if (res.code == "000000") { req
vm.$message({ ).then(res => {
message: '设置成功', if (res.code == "000000") {
type: 'success' vm.$message({
}); message: "设置成功",
vm.dialogArea = false; type: "success"
vm.queryRoleList(); });
} else { vm.dialogArea = false;
vm.$message.error(res.message); vm.queryRoleList();
} } else {
vm.$message.error(res.message);
} }
); });
} }
} }
}; };
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册