提交 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 = {
reportUrl: 'https://dev-sc-report.yunqueyi.com/',
// reportUrl: 'https://test1-sc-report.yunqueyi.com/',
// reportUrl: 'https://uat-sc-report.yunqueyi.com/',
excelUrl: 'https://test-file.yunqueyi.com/File/template/onlineExam/',
},
dev: {
baseUrl: 'https://dev-sc.yunqueyi.com/',
......@@ -45,6 +46,7 @@ export const envConfig = {
workApiUrl: 'https://dev-work.yunqueyi.com/web',
workApiSrc: 'https://dev-work.yunqueyi.com',
reportUrl: 'https://dev-sc-report.yunqueyi.com/',
excelUrl: 'https://test-file.yunqueyi.com/File/template/onlineExam/',
},
test: {
baseUrl: 'https://test1-sc.yunqueyi.com/',
......@@ -60,6 +62,7 @@ export const envConfig = {
workApiUrl: 'https://test1-work.yunqueyi.com/web',
workApiSrc: 'https://test1-work.yunqueyi.com',
reportUrl: 'https://test1-sc-report.yunqueyi.com/',
excelUrl: 'https://test-file.yunqueyi.com/File/template/onlineExam/',
},
test2: {
baseUrl: 'https://test2-work.yunqueyi.com/sc/',
......@@ -74,6 +77,7 @@ export const envConfig = {
workApiUrl: 'https://test2-work.yunqueyi.com/web',
workApiSrc: 'https://test2-work.yunqueyi.com',
reportUrl: 'https://test2-sc-report.yunqueyi.com/',
excelUrl: 'https://test-file.yunqueyi.com/File/template/onlineExam/',
},
uat: {
baseUrl: 'https://uat-sc.yunqueyi.com/',
......
......@@ -211,3 +211,8 @@ function getConfigByEnvType(urlType) {
export function getReportUrl(url) {
return getConfigByEnvType('reportUrl') + url
}
// 获取SC服务器域名地址
export function getExeclUrl(url) {
return getConfigByEnvType('excelUrl') + url
}
\ No newline at end of file
......@@ -89,11 +89,18 @@
<span v-if="scope.row.projeceRole == 'L2'">全部地区</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 == 1">{{ scope.row.regions[0] }}</span>
<el-popover 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>
<span
v-if="scope.row.projeceRole == 'L3' && scope.row.regions.length == 1"
>{{ scope.row.regions[0] }}</span>
<el-popover
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>
</el-popover>
</template>
......@@ -272,6 +279,8 @@ import BreadCrumb from "../../components/breadcrumb.vue";
import { create } from "domain";
import { openLoading, closeLoading } from "../../utils/utils";
import * as commonUtil from "../../utils/utils";
import { getExeclUrl } from "@/utils/index";
import { uploadExcel } from "@/utils/education/educationApi";
let vm = null;
export default {
components: {
......@@ -310,6 +319,10 @@ export default {
// label: "内部管理员",
// value: "L1"
// },
{
label: "全部",
value: ""
},
{
label: "项目负责人",
value: "L2"
......@@ -351,7 +364,7 @@ export default {
tagsRegion: [],
doctorId: "",
allSelectedKeys: [],
attachRegionId: "",
attachRegionId: ""
};
},
created() {
......@@ -364,10 +377,48 @@ export default {
},
methods: {
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) {
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() {
this.formInline.pageNo = 1;
......@@ -763,23 +814,24 @@ export default {
attachRegionId: vm.attachRegionId,
doctorId: vm.doctorId,
projectId: vm.formInline.portalProjectId,
scopeOfAdministrative: vm.getScope(),
scopeOfAdministrative: vm.getScope()
};
console.log("req", req);
vm.POST("portal/portalProjectOrRole/insertOrUpdateAttachRegion", req).then(
res => {
vm.POST(
"portal/portalProjectOrRole/insertOrUpdateAttachRegion",
req
).then(res => {
if (res.code == "000000") {
vm.$message({
message: '设置成功',
type: 'success'
message: "设置成功",
type: "success"
});
vm.dialogArea = false;
vm.queryRoleList();
} else {
vm.$message.error(res.message);
}
}
);
});
}
}
};
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册