提交 8c9175f6 编写于 作者: yi.li's avatar yi.li

Merge branch 'dev-patients-20190513' of...

Merge branch 'dev-patients-20190513' of 192.168.110.53:com.pica.cloud.education.frontend/pica.cloud.web-education-admin into dev-patients-20190513
......@@ -5,7 +5,6 @@
display: flex;
flex-direction: column;
&.upload-history-wrap{
margin-top: 30px;
margin: 0;
padding: 0;
.septal-line{
......
......@@ -6,6 +6,9 @@
.top-title{
border: 0 !important;
}
.screenSet{
background: #fff;
}
.upload-record{
width: 100%;
font-size: 20px;
......
......@@ -114,6 +114,28 @@ export const getLabelsInfo = params => {
})
}
export const downloadQRCode = data => {
return fetch({
headers,
url: getBaseUrl(`healths/qrcodes/shareUrl`),
method: 'post',
data: data,
description: '下载二维码',
})
}
export const uploadExcel = data => {
return fetch({
headers: {
noSysCode: true,
},
url: getSaasDomain('web/patientManages/import'),
method: 'post',
data: data,
description: '上传excel文件',
})
}
// 分组管理
export const getLabelList = (params) => {
return fetch({
......
......@@ -58,9 +58,11 @@
<el-upload
class="upload-file"
drag
:action="uploadUrl"
action="#"
accept=".xlsx"
:headers="uploadHeaders"
:file-list="files"
:before-upload="getPostData"
:on-change="changeFile"
:on-error="uploadError"
:on-success="uploadSuccess"
......@@ -82,40 +84,34 @@
class="upload-table"
style="width: 100%">
<el-table-column
header-align="center"
align="center"
align="left"
prop="fileName"
label="文件名"
width="180">
</el-table-column>
<el-table-column
header-align="center"
align="center"
align="left"
prop="uploadTime"
label="上传时间"
width="180">
</el-table-column>
<el-table-column
header-align="center"
align="center"
align="left"
prop="insertCount"
label="新导入居民数">
</el-table-column>
<el-table-column
header-align="center"
align="center"
align="left"
prop="updateCount"
label="更新居民资料数">
</el-table-column>
<el-table-column
header-align="center"
align="center"
align="left"
prop="status"
label="处理状态">
</el-table-column>
<el-table-column
header-align="center"
align="center"
align="left"
prop="address"
label="关闭理由">
</el-table-column>
......@@ -138,12 +134,13 @@
import { getSaasDomain } from '@/utils/index';
import {
getUploadHistory,
uploadExcel,
} from "@/utils/patients/patientsapi";
export default {
data() {
return {
uploadUrl: `${getSaasDomain('web/patientManages/import')}`,
// uploadUrl: `${getSaasDomain('web/patientManages/import')}`,
searchData: {
pageNo: 1, // 第几页
pageSize: 10, // 每页条数
......@@ -154,12 +151,74 @@
token: localStorage.getItem('token')
},
files: [],
postData: {axx: 1},
}
},
created() {
this.goToGetUploadHistory();
},
methods: {
getPostData(file) {
let self = this;
let arr = file.type.split('/');
let ext = "." + arr[1];
let reader = new FileReader();
reader.onload = function (e) {
self.$message('开始导入');
let fileJson = {
fileName: file.name,
file: e.target.result.substr(e.target.result.indexOf("base64,") + 7),
ext: ext
};
let fileArray = [{
type: 'patient',
base64: fileJson
}];
// openLoading(self);
let req = {
// token: localStorage.getItem("token"),
token: 'F868A5F84DD9433E93E00E3952A16364',
fileArray: fileArray,
import_type: 2,
};
//
// console.log('req ', req);
console.log('string req ', JSON.stringify(req))
// self.postData = req;
self.postData = JSON.stringify(req);
uploadExcel(self.postData).then(res => {
console.log('%c res >> ','color: red;', res)
})
// self.$axios.post(localStorage.getItem("Url") + 'importServiceImpl/importToQuestionPool'
// , JSON.stringify(req)
// ).then(function (res) {
// closeLoading(self);
// let data = JSON.parse(JSON.stringify(res.data));//通过这个实现深拷贝
// if (data.flag) {
// self.$message('导入成功' + data.successNum + '条(重复的题目不会导入!)');
// self.getLabelList();
// self.search();
// } else {
// self.$message.error('导入题目失败');
// let errorList = data.errorList;
// let message = "";
// if (isNotEmptyUtils(errorList)) {
// for (let i = 0; i < errorList.length; i++) {
// message += "第" + errorList[i].index + "行:" + errorList[i].name + '<br>';
// }
// }
// htmlMessageBox(self, "警告", message, "确定", function () {
// }, "", null, "warning");
// }
// }).catch(function (error) {
// self.$message.error('导入题目失败');
// errorResponseCheck(error, self);
// });
};
reader.readAsDataURL(file);
},
handleDownloadDemo(){
window.location.href = 'https://file.yunqueyi.com/File/template/居民导入模板.xlsx';
},
......
......@@ -83,6 +83,7 @@
refreshCode,
getLabelList,
getLabelsInfo,
downloadQRCode,
} from "@/utils/patients/patientsapi";
export default {
......@@ -103,6 +104,7 @@
currentLabelList: [],
labelNameList: [],
choosedLabelList: [],
forDownloadInfo: {}, // 下载用的信息
}
},
created() {
......@@ -126,19 +128,47 @@
this.showChooseLabelModal = false;
},
// 二维码录入
goToGetQRCode(params){
goToGetQRCode(params, cb){
let justDownload = false;
if(params.hasOwnProperty('justDownload')){
justDownload = true;
delete params.justDownload;
}
getQRCode(params).then(res => {
if(res.code == '000000'){
let data = res.data;
this.qrCodeInfo = data;
if(data.labelIds != ''){
let temp = data.labelIds.split(',');
this.currentLabelList = this.formatList(temp);
if( !justDownload ){ // 非下载二维码时
this.qrCodeInfo = data;
if(data.labelIds != ''){
let temp = data.labelIds.split(',');
this.currentLabelList = this.formatList(temp);
}
this.calculateQRCode(data.qrcodeUrl);
this.handleGetLabelsInfo({
labelIds: data.labelIds,
});
}else{ // 下载二维码时,不用更新页面中的二维码信息
this.forDownloadInfo = data;
let { id, beginTime, endTime, forever } = this.forDownloadInfo;
let obj = {
id,
beginTime,
endTime,
forever,
labels: [], // ["高血压","糖尿病","脑卒中"]
};
let idArr = params.labelIds.split(','); // [1,3,55]
let checkArr = this.labelNameList;
for(let i=0; i<idArr.length; i++) {
for(let j=0; j<checkArr.length; j++) {
if( idArr[i] == checkArr[j].labelId ) {
obj.labels.push( checkArr[j].labelName );
}
}
}
console.log('obj.labels: ', obj.labels);
cb && cb(obj);
}
this.calculateQRCode(data.qrcodeUrl);
this.handleGetLabelsInfo({
labelIds: data.labelIds,
});
}else{
this.$message({
message: '获取二维码失败,请重新再试',
......@@ -156,6 +186,11 @@
getLabelsInfo(params).then(res => {
if(res.code == '000000'){
this.labelsInfoList = res.data;
}else{
this.$message({
message: '获取标签信息失败',
type: 'warning'
});
}
})
},
......@@ -210,7 +245,7 @@
});
return;
}
if( this.showDownloadQRModal == false ){
if( this.showDownloadQRModal == false ){ // 选择分组时
this.showChooseLabelModal = false;
this.goToGetQRCode({
labelIds: this.choosedLabelList.join(','),
......@@ -218,11 +253,33 @@
first: false,
});
this.choosedLabelList = [];
}else{
alert('去下载二维码。。。')
}else{ // 下载二维码时
// 获取最新二维码参数,但不影响之前的二维码参数
this.goToGetQRCode({
labelIds: this.choosedLabelList.join(','),
id: '',
first: false,
justDownload: true,
}, this.goToDownloadQRCode);
}
},
goToDownloadQRCode(params) {
// 下载二维码
downloadQRCode(params).then(res => {
if(res.code == '000000'){
// window.location.href = res.data;
this.downloadFile(res.data);
}else{
this.$message({
message: '下载二维码失败',
type: 'warning'
});
}
})
},
handleClearSelect() {
this.choosedLabelList = [];
},
......@@ -244,8 +301,6 @@
console.log('error: ', err)
});
},
handleGoToLabelManage(){
let routeUrl = this.$router.resolve({
path: '/patients-manage/labels-manage/labels-list',
......@@ -257,6 +312,19 @@
this.showReloadLabelModal = false;
this.goToGetGroupList();
},
downloadFile(src) {
debugger;
var eleLink = document.createElement('a');
eleLink.download = src;
eleLink.style.display = 'none';
// // 字符内容转变成blob地址
eleLink.href = src;
// // 触发点击
document.body.appendChild(eleLink);
eleLink.click();
// // 然后移除
document.body.removeChild(eleLink);
}
},
......
......@@ -55,6 +55,18 @@
BatchImport,
},
created() {
let tabIndex = this.$route.query.tab;
if((typeof tabIndex == 'undefined') || (tabIndex == '')){
return;
}
tabIndex = parseInt(tabIndex);
let numArr = [1, 2, 3];
let tabList = ['first', 'second', 'third'];
if( numArr.indexOf(tabIndex) > -1 ){
this.activeName2 = tabList[tabIndex-1];
}else{
this.activeName2 = 'first';
}
},
// 挂载到Dom完成时
mounted() {
......@@ -95,7 +107,7 @@
}
</script>
<style lang="less" scoped>
<style lang="less">
@import "../../../style/patient-manager/new-patient/new-patient-wrap.less";
</style>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册