提交 dc20dddb 编写于 作者: guangjun.yang's avatar guangjun.yang

解决选择机构看不到名字的问题

上级 c63ea58d
import fetch from '../fetch';
import { getBaseUrl, getSaasDomain, getSaasApiDomain } from '@/utils/index'
import utils from '@/utils/followup/followupUtils';
const headers = {
// sysCode: 9,
productType: 1, // productType 产品线类型,1 表示云鹊医产品系,2 表示云鹊健康产品系
sourceType: 3, // sourceType 终端来源,1 表示安卓,2 表示 ios,3 表示 web,4 表示 H5 登录,5 表示 admin 后台
}
// 获取 RSA public key
export const getPubKey = (params) => {
return fetch({
headers,
url: getBaseUrl(`account/cipher/key`),
method: 'get',
params: params,
description: 'get public key',
})
};
// 密码登录
export const handleLogin = data => {
return fetch({
headers,
url: getBaseUrl(`account/login`),
method: 'post',
data: data,
description: '密码登录',
})
}
// 密码退出登录
export const handleLogout = data => {
return fetch({
headers,
url: getBaseUrl(`account/logout`),
method: 'get',
data: data,
description: '密码退出登录',
})
}
// 获取图形验证码
export const handleGetCaptcha = data => {
return fetch({
headers,
url: getBaseUrl(`account/account/captcha`),
method: 'get',
data: data,
description: '获取图形验证码',
})
}
// 忘记密码时 获取短信验证码
export const handleGetAuthCode = data => {
return fetch({
headers,
url: getBaseUrl(`account/account/authCode`),
method: 'post',
data: data,
description: '获取短信验证码',
})
}
// 重设密码
export const handleResetPWD = data => {
return fetch({
headers,
url: getBaseUrl(`account/password/reset`),
method: 'post',
data: data,
description: '忘记密码之重设密码',
})
}
// 判断是否同意协议
export const handleAgreement = data => {
return fetch({
headers,
url: getBaseUrl(`api-ws/agreements/consent`),
method: 'get',
params: data,
description: '检查用户同意的协议',
})
}
/**
* 常量定义文件
*
*/
// 分页大小
export const PAGE_SIZE = 10
// 添加动作常量
export const ACTION_TYPE_ADD = 'ACTION_TYPE_ADD'
// 修改动作常量
export const ACTION_TYPE_UPDATE = 'ACTION_TYPE_UPDATE'
// 删除动作常量
export const ACTION_TYPE_DELETE = 'ACTION_TYPE_DELETE'
/* 是否使用Mock数据 */
export const IS_MOCK_DATAS = true
// 通用状态 全部/正常/停用
export const COMMON_STATUS_OPTIONS = [
{
value: '',
label: '启用状态'
}, {
value: 0,
label: '正常'
}, {
value: 1,
label: '停用'
}
]
// 识别状态 全部/未标记/正常/误识
export const RECORD_STATUS_OPTIONS = [
{
value: '',
label: '标记状态'
}, {
value: '0',
label: '未标记'
}, {
value: '1',
label: '正常'
}, {
value: '2',
label: '误识'
}
]
// 用户类型 全部/普通用户/VIP/黑名单
export const USER_TYPE_OPTIONS = [
{
value: '',
label: '用户类型'
}, {
value: 1,
label: '普通用户'
}, {
value: 2,
label: 'VIP'
}, {
value: 3,
label: '黑名单'
}
]
import fetch from '../fetch';
import { getBaseUrl } from '@/utils/index';
export const uploadExcel = (data, projectId) => {
// return utils.checkAuth(()=>{
return fetch({
headers: {
'Content-Type': 'application/json;charset=UTF-8',
sysCode: 12,
token: localStorage.getItem('storageToken'),
},
url: getBaseUrl('portal/v2/role/importRoleFile?projectId=' + projectId),
method: 'post',
data: data,
description: '上传excel文件',
})
// })
}
export const uploadOrgExcel = (data, projectId) => {
// return utils.checkAuth(()=>{
return fetch({
headers: {
'Content-Type': 'application/json;charset=UTF-8',
sysCode: 12,
token: localStorage.getItem('storageToken'),
},
url: getBaseUrl('portal/new/scope/org/v1/' + projectId + '/import'),
method: 'put',
data: data,
description: '上传excel文件',
})
// })
}
export const uploadPersonExcel = (data, projectId) => {
// return utils.checkAuth(()=>{
return fetch({
headers: {
'Content-Type': 'application/json;charset=UTF-8',
sysCode: 12,
token: localStorage.getItem('storageToken'),
},
url: getBaseUrl('portal/new/scope/doctor/v1/' + projectId + '/import'),
method: 'put',
data: data,
description: '上传excel文件',
})
// })
}
\ No newline at end of file
/**
* 环境变量配置文件
*/
export const envConfig = {
development: {
// // baseUrl: 'http://10.177.15.180:10202/',
// // baseUrl: 'http://192.168.140.14:10201/',
// baseUrl: 'https://test1-sc.yunqueyi.com/',
// baseUrl: 'https://uat-sc.yunqueyi.com/',
// baseUrl: 'http://10.177.15.150:10401/',
// baseUrl: 'http://10.177.15.150:11905/',
baseUrl: 'https://dev-sc.yunqueyi.com/',
// baseUrl: 'https://test1-sc.yunqueyi.com/',
// baseUrl: 'https://uat-sc.yunqueyi.com/',
apiUrl: 'https://uat-api.yunqueyi.com/',
qiniuFileUrl: "https://uat-sc.yunqueyi.com/contents/admin/qiniu/token1",
qiniuResourceUrl: "https://test1-videos.yunqueyi.com",
qiniuImgUrl: "https://test1-file.yunqueyi.com",
loginUrl: 'https://uat-saas.yunqueyi.com/pica-login/work_station.html',
innerLoginUrl: 'http://localhost:8090/PICA_SSO_FE/html/pica_index.html',
yuequeyiIndexUrl: 'https://uat-saas.yunqueyi.com/pica_index.html',
followUpSCSoSo: 'http://sosoapi.yunqueyi.com/sosoapi-web/pass/mock/73',
// followUpSC: 'https://uat-sc.yunqueyi.com',
followUpSC: 'https://dev-sc.yunqueyi.com',
saasDomainUrl: 'https://uat-saas.yunqueyi.com/',
workApiUrl: 'https://uat-work.yunqueyi.com/web',
workApiSrc: 'https://uat-work.yunqueyi.com',
// reportUrl: 'http://10.177.15.150:10401/',
// reportUrl: 'http://192.168.140.13:10401/',
// reportUrl: 'https://dev-sc-report.yunqueyi.com/',
reportUrl: 'https://dev-sc-report.yunqueyi.com/',
// reportUrl: 'https://test1-sc-report.yunqueyi.com/',
// reportUrl: 'https://uat-sc-report.yunqueyi.com/',
excelUrl: 'https://uat-file.yunqueyi.com/File/template/portal/',
itemFileUrl: 'http://pica-test-huabei2.oss-cn-beijing.aliyuncs.com/File/template/portal/',
},
dev: {
baseUrl: 'https://dev-sc.yunqueyi.com/',
apiUrl: 'https://dev-api.yunqueyi.com/',
qiniuFileUrl: "https://dev-sc.yunqueyi.com/contents/admin/qiniu/token1",
qiniuResourceUrl: "https://test1-videos.yunqueyi.com",
qiniuImgUrl: "https://test1-file.yunqueyi.com",
loginUrl: 'https://dev-saas.yunqueyi.com/pica-login/work_station.html',
innerLoginUrl: 'https://dev-sso.yunqueyi.com/PICA_SSO_FE/html/pica_index.html',
yuequeyiIndexUrl: 'https://dev-saas.yunqueyi.com/pica_index.html',
followUpSC: 'https://dev-sc.yunqueyi.com',
saasDomainUrl: 'https://dev-saas.yunqueyi.com/',
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/portal/',
itemFileUrl: 'http://pica-test-huabei2.oss-cn-beijing.aliyuncs.com/File/template/portal/',
},
test: {
baseUrl: 'https://test1-sc.yunqueyi.com/',
apiUrl: 'https://test1-api.yunqueyi.com/',
qiniuFileUrl: "https://test1-sc.yunqueyi.com/contents/admin/qiniu/token1",
qiniuResourceUrl: "https://test1-videos.yunqueyi.com",
qiniuImgUrl: "https://test1-file.yunqueyi.com",
loginUrl: 'https://test1.yunqueyi.com/pica-login/work_station.html',
innerLoginUrl: 'https://test1-sso.yunqueyi.com/PICA_SSO_FE/html/pica_index.html',
followUpSC: 'https://test1-sc.yunqueyi.com',
yuequeyiIndexUrl: 'https://test1.yunqueyi.com/pica_index.html',
saasDomainUrl: 'https://test1.yunqueyi.com/',
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/portal/',
itemFileUrl: 'http://pica-test-huabei2.oss-cn-beijing.aliyuncs.com/File/template/portal/',
},
test2: {
baseUrl: 'https://test2-work.yunqueyi.com/sc/',
qiniuFileUrl: "https://test1-sc.yunqueyi.com/contents/admin/qiniu/token1",
qiniuResourceUrl: "https://test1-videos.yunqueyi.com",
qiniuImgUrl: "https://test1-file.yunqueyi.com",
loginUrl: 'https://test1.yunqueyi.com/pica-login/work_station.html',
innerLoginUrl: 'https://test1-sso.yunqueyi.com/PICA_SSO_FE/html/pica_index.html',
followUpSC: 'https://test2-work.yunqueyi.com/sc',
yuequeyiIndexUrl: 'https://test1.yunqueyi.com/pica_index.html',
saasDomainUrl: 'https://test2-work.yunqueyi.com/web/',
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/portal/',
itemFileUrl: 'http://pica-test-huabei2.oss-cn-beijing.aliyuncs.com/File/template/portal/',
},
uat: {
baseUrl: 'https://uat-sc.yunqueyi.com/',
apiUrl: 'https://uat-api.yunqueyi.com/',
qiniuFileUrl: "https://uat-sc.yunqueyi.com/contents/admin/qiniu/token1",
qiniuResourceUrl: "https://test1-videos.yunqueyi.com", // 视频
qiniuImgUrl: "https://test1-file.yunqueyi.com",
loginUrl: 'https://uat.yunqueyi.com/pica-login/work_station.html',
innerLoginUrl: 'https://uat-sso.yunqueyi.com/PICA_SSO_FE/html/pica_index.html',
followUpSC: 'https://uat-sc.yunqueyi.com',
yuequeyiIndexUrl: 'https://uat.yunqueyi.com/pica_index.html',
saasDomainUrl: 'https://uat.yunqueyi.com/',
workApiUrl: 'https://uat-work.yunqueyi.com/web',
workApiSrc: 'https://uat-work.yunqueyi.com',
reportUrl: 'https://uat-sc-report.yunqueyi.com/',
excelUrl: 'https://test-file.yunqueyi.com/File/template/portal/',
itemFileUrl: 'http://pica-test-huabei2.oss-cn-beijing.aliyuncs.com/File/template/portal/',
},
pro: {
baseUrl: 'https://sc.yunqueyi.com/',
apiUrl: 'https://api.yunqueyi.com/',
qiniuFileUrl: "https://sc.yunqueyi.com/contents/admin/qiniu/token1",
qiniuResourceUrl: "https://video.yunqueyi.com",
qiniuImgUrl: "https://files.yunqueyi.com",
loginUrl: 'https://www.yunqueyi.com/pica-login/work_station.html',
innerLoginUrl: 'https://sso.yunqueyi.com/PICA_SSO_FE/html/pica_index.html',
followUpSC: 'https://sc.yunqueyi.com',
yuequeyiIndexUrl: 'https://www.yunqueyi.com/pica_index.html',
saasDomainUrl: 'https://www.yunqueyi.com/',
workApiUrl: 'https://work.yunqueyi.com/web',
workApiSrc: 'https://work.yunqueyi.com',
reportUrl: 'https://sc-report.yunqueyi.com/',
excelUrl: 'https://file.yunqueyi.com/File/template/portal/',
itemFileUrl: 'http://pica-test-huabei2.oss-cn-beijing.aliyuncs.com/File/template/portal/',
}
}
//api路径
import {isNotEmptyUtils} from "./utils";
export default async(url = '', data = {}, type = 'POST', method = 'fetch',server='CONTENT') => {
type = type.toUpperCase();
// url = (server==='WECHAT'?wechatUrl:baseUrl) + url;
if (url.match("^http") == null){
url = localStorage.getItem("Url") + url;
}
console.log("完整url:",url)
if (type == 'GET' && data) {
let dataStr = ''; //数据拼接字符串
Object.keys(data).forEach(key => {
dataStr += key + '=' + data[key] + '&';
})
if (dataStr !== '') {
dataStr = dataStr.substr(0, dataStr.lastIndexOf('&'));
url = url + '?' + dataStr;
// url = encodeURI(url + '?' + dataStr, true);
}
}
if (window.fetch && method == 'fetch') {
let requestConfig = {
credentials: 'include',
method: type,
// mode: "cors",
headers: {
// 'Access-Control-Allow-Origin': '*',
'Accept': '*',
'Content-Type': 'application/json',
'sysCode':'2'
// 'token': localStorage.getItem('token') || null, //固定传header:
// 'system_code': 'todo' //固定传header:系统编号
},
}
if (type == 'POST' || type === 'PUT' || type === 'PATCH' || type === 'DELETE' && data) {
Object.defineProperty(requestConfig, 'body', {
value: JSON.stringify(data)
})
}
try {
const response = await fetch(url, requestConfig);
const responseJson = await response.json();
return responseJson
} catch (error) {
throw new Error(error)
}
} else {
return new Promise((resolve, reject) => {
let requestObj;
if (window.XMLHttpRequest) {
requestObj = new XMLHttpRequest();
} else {
requestObj = new ActiveXObject;
}
let sendData = '';
if (type == 'POST' || type == 'DELETE' || type == 'PUT') {
sendData = JSON.stringify(data);
}
requestObj.open(type, url, true);
requestObj.setRequestHeader("Content-Type", "application/json");
requestObj.setRequestHeader("sysCode", "3");
requestObj.send(sendData);
requestObj.onreadystatechange = () => {
if (requestObj.readyState == 4) {
if (requestObj.status == 200) {
let obj = requestObj.response
if (typeof obj !== 'object' && isNotEmptyUtils(obj)) {
obj = JSON.parse(obj);
}
resolve(obj)
} else {
reject(requestObj)
}
}
}
})
}
}
import axios from 'axios'
import { Loading } from 'element-ui';
import store from '../store'
// import { getHostnameAndPort } from '../utils'
// axios.defaults.withCredentials = true
const service = axios.create({
// baseURL: process.env.BASE_API
timeout: 600000,
withCredentials: false
})
let loadingInstance = () => {
return Loading.service({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
}
let loading;
let needLoadingRequestCount = 0;
let showFullScreenLoading = () => {
if (needLoadingRequestCount === 0) {
loadingInstance();
}
needLoadingRequestCount++;
};
let tryHideFullScreenLoading = () => {
if (needLoadingRequestCount > 0) {
needLoadingRequestCount--;
}
if (needLoadingRequestCount === 0) {
loadingInstance().close();
}
};
// request拦截器
service.interceptors.request.use(config => {
if (config.noLoading) {
}else{
showFullScreenLoading();
}
const noSysCode = config.headers.noSysCode;
if(noSysCode){
delete config.headers.sysCode;
delete config.headers.deviceInfo;
delete config.headers.noSysCode;
delete config.headers.token;
}else{
if( config.headers['sysCode']==undefined) {
config.headers['sysCode'] = 12
}
if( process.env.BUILD_ENV == "development" ){ // 本地开发环境
// console.log('环境变量>>>> ', process.env.BUILD_ENV);
// config.headers['token'] = 'BFD804F3A3194FBBBE113962222839F6';
// config.headers['token'] = 'F8209898391C40A0B8DBC1ED9E157291';
config.headers['token'] = '2E46B77D801C479DBA1C550CE70D348F';
}else{
config.headers['token'] = localStorage.getItem('storageToken')
}
config.headers['deviceInfo'] = JSON.stringify({ "app_channel": "", "app_mac": "", "app_uuid": "", "app_version": "", "device_brand": "", "device_ip": "", "device_model": "", "device_net": "", "device_ops": "", "resolution_wh": "", "system_level": "", "device_type": '10' })
}
// if (config.data && config.data.setEntry) {
// config.headers['sysCode'] = config.data.sysCode || 10
// if(config.data.token){
// config.headers['token'] = config.data.token || '63C3FA92AF8A45A48B31EB7FD97B95EB'
// }
// config.headers['deviceInfo'] = JSON.stringify({ "app_channel": "", "app_mac": "", "app_uuid": "", "app_version": "", "device_brand": "", "device_ip": "", "device_model": "", "device_net": "", "device_ops": "", "resolution_wh": "", "system_level": "", "device_type": '10' })
// }
return config
}, error => {
// logger.debug('service.interceptors.request: ', error)
tryHideFullScreenLoading();
Promise.reject(error)
})
// respone拦截器
service.interceptors.response.use(
response => {
if (response.config.noLoading) {
}else{
tryHideFullScreenLoading()
}
const res = response.data
/*
baseUrl时,返回000000为成功
apiUrl时,返回200为成功
*/
// if (res.code !== '000000') {
// return Promise.reject('error')
// } else {
return response.data
// }
},
error => {
// logger.error('err' + error)
tryHideFullScreenLoading();
return Promise.reject(error)
}
)
export default service
const vueFilter = {
liveDateFilter: (value) => {
if (!value) return '';
return new Date(value).format("yyyy-MM-dd hh:mm:ss");
},
liveFilter: (value) => {
if(value.liveStatus == 1){
return '未开始'
} else if(value.liveStatus == 5) {
return '直播中'
}else if(value.liveStatus == 10 && value.lookBackStatus == 2){
return '已结束(不可回看)'
}else if(value.liveStatus == 10 && value.lookBackStatus == 1) {
return '已结束(可回看)'
}
},
liveStatusFilter: (value) => {
if(value == 1) return "隐藏"
else return "发布"
},
liveTeacherType: (value) => {
let doctorName = []
if(value.length > 3) {
for(let i = 0; i < 3; i++) {
doctorName.push(value[i].doctorName)
}
return doctorName.join("、") + '...'
}else{
for(let i = 0; i < value.length; i++) {
doctorName.push(value[i].doctorName)
}
return doctorName.join("、")
}
},
controlType: (value) => {
if(value == 1) {
return '分页1'
}else if(value == 2) {
return '分页2'
}else if(value == 3) {
return '图片1'
}else if(value == 4) {
return '图片2'
}else if(value == 6) {
return '视频'
}
},
tabControlType: (value) => {
if(value == 3) {
return '图片1'
}else if(value == 4) {
return '图片2'
}else if(value == 6) {
return '视频'
}
},
refreshType: (value) => {
if(value == 1) return "支持"
else return "不支持"
},
moudleType: (value) => {
if(value == 1) return "未激活"
else return "激活"
},
dateFilter: (value) => {
if (!value) return '';
return new Date(value).format("yyyy-MM-dd hh:mm");
},
appColumnStatusFilter: (value) => {
if(value == 1) return "未提交"
else if(value == 4) return "已提交"
},
statusFilter: (value) => {
if(value == 1) return "已创建"
else if(value == 5) return "已发布"
else return "已下架"
},
linkTypeFilter: (value) => { // 跳转类型
if(value == 1) return '链接'
else if(value == 4) return '模块'
else return '无跳转'
},
teacherStatusFilter: (value) => {
if(value == 1) return "已下架"
else return "已发布"
},
moduleTypeFilter: (value,data) => { // 模块类型
for(let key in data) {
if(value == key) {
return data[key]
}
}
},
contentCreatedType: (value,data) => {
for(let i = 0; i< data.length;i++) {
if(value == data[i].id) {
return data[i].name
}
}
},
contentModifiedType: (value,data) => {
for(var i=0; i < data.length;i++) {
if(value == data[i].id) {
return data[i].name
}
}
},
columnPositionType: (value,data) => { // 位置
for(let key in data) {
if(value == key) {
return data[key]
}
}
},
// 项目组件
statusFileter: (value) => {
if(value == 1) {
return '草稿'
}else if(value == 2) {
return '未启用'
}else if(value == 3) {
return '已启用'
}else {
return '已禁用'
}
},
//项目管理
statusProject: (value) => {
//console.log(value)
if(value[0] == 1) {
return '草稿'
}else if(value[0] == 2) {
return '未上架'
}else if(value[0] == 3) {
if(value[1] == 1) {
return '待审核'
} else {
return '审核中'
}
}else if(value[0] == 4) {
return '已上架'
}else if(value[0] == 5) {
return '已下架'
}else if(value[0] == 6) {
return '已拒绝'
}
},
projeceRoleType: (value) => {
if(value == "L1") {
return '内部管理员'
}else if(value == "L2") {
return '项目负责人'
}else if(value == "L3") {
return '次级负责人'
} else if(value == "L0") {
return '普通用户'
}
},
joinStatus: (value) => {
if(value == "0") {
return '未参与'
}else if(value == "1") {
return '参与中'
}else {
return '已完成'
}
},
reportStatus: (value) => {
if(value == 1) {
return '进行中'
}else if(value == 2) {
return '已结束'
}
},
partJoin: (value) => {
if(value == 1) {
return '未参与'
}else {
return '参与'
}
},
partFinish: (value) => {
if(value == 1) {
return '未完成'
}else {
return '完成'
}
},
projectStatus: (value) => {
if(value == 1) {
return '未参与'
}else if(value == 2) {
return '参与中'
}else if(value == 3) {
return '完成项目'
}
},
recordValue: (value) => {
if(value == 1) {
return '无成绩'
}else if(value == 2) {
return '不通过'
}else if(value == 3) {
return '通过'
}
},
exportStatus: (value) => {
if(value == 0) {
return '数据生成中,请稍后---';
}else if(value == 1) {
return '数据生成完成';
} else {
return '文件生成失败 请重新操作导出';
}
},
getAvgTime: (value) => {
let list = [0,0];
let avgTime = '';
if(value != null && value !='') {
list[0] = Math.floor(value / 60);
list[1] = value % 60;
}
if(list[0] == 0 && list[1] == 0) {
avgTime = list[1] + '秒';
} else if(list[0] == 0 && list[1] != 0) {
avgTime = list[1] + '秒';
} else if(list[0] != 0 && list[1] == 0) {
avgTime = list[0] + '分';
} else if(list[0] != 0 && list[1] != 0) {
avgTime = list[0] + '分' + list[1] + '秒';
}
return avgTime;
},
getTotalTime: (value) => {
let time = value +'分钟';
return time;
},
shieldStatus: (value) => {
if(value == 1) {
return '未屏蔽';
} else if(value == 2) {
return '已屏蔽';
}
},
shieldButton: (value) => {
if(value == 1) {
return '屏蔽';
} else if(value == 2) {
return '取消屏蔽';
}
},
areaText: (value) => {
let text = '-';
if(value.regions.length == 0) {
text = '-'
} else if(value.regions.length == 1) {
text = value.regions[0];
} else if(value.regions.length > 1){
let len = value.regions.length;
text = value.regions[0]+'('+len+')';
}
return text;
},
areaList: (value) => {
let list = '';
for(let i=0; i<value.length ; i++) {
list += value[i]+'、';
}
list = list.substring(0, list.length - 1);
return list
},
}
export default vueFilter
\ No newline at end of file
import fetch from '../fetch';
import { getFollowUpApi, getBasicDataApi, getFollowUpSC } from '@/utils/index'
import utils from './followupUtils';
const headers = {
sysCode: 45,
hospitalAuth:true
} /**/
/*工作台*/
export const getTodayAppointsList = (params) => {
return fetch({
headers,
url: getFollowUpSC(`/followup/overView/todayAppoints`),
method: 'get',
params: params,
description: '获取今日预约列表',
})
};
export const getTodayOverview = (params) => {
return fetch({
headers,
url: getFollowUpSC(`/followup/overView/todayOverview`),
method: 'get',
params: params,
description: '获取今日履约、预约、履约人数',
})
};
export const getTodayPlans = (params) => {
return fetch({
headers,
url: getFollowUpSC(`/followup/overView/todayPlans`),
method: 'get',
params: params,
description: '查询今日履约计划',
})
};
/*计划管理*/
export const createFollowPlan = (data) => {
return utils.checkAuth(()=>{
return fetch({
headers,
url: getFollowUpSC(`/followup/plans`),
method: 'post',
data: data,
description: '新增、修改履约计划',
})
})
}
export const getPlanList = (params) => {
// return utils.checkAuth(()=>{
return fetch({
headers,
url: getFollowUpSC(`/followup/plans`),
method: 'get',
params: params,
description: '获取计划列表',
})
// })
};
export const getPlanDetail = (planId) => {
// return utils.checkAuth(()=>{
return fetch({
headers,
url: getFollowUpSC(`/followup/plans/${planId}`),
method: 'get',
description: '获取计划详情',
})
// })
};
export const getNodeTimeList = (planId) => {
// return utils.checkAuth(()=>{
return fetch({
headers,
url: getFollowUpSC(`/followup/plans/${planId}/time`),
method: 'get',
description: '获取履约时间节点列表',
})
// })
};
export const getNodeTimeContent = (planTimeId) => {
// return utils.checkAuth(()=>{
return fetch({
headers,
url: getFollowUpSC(`/followup/plans/time/${planTimeId}`),
method: 'get',
description: '获取节点详情',
})
// })
};
export const getResidentList = (params) => {
// return utils.checkAuth(()=>{
return fetch({
headers,
url: getFollowUpSC(`/followup/planPatient/`),
method: 'get',
params: params,
description: '获取居民列表',
})
// })
};
export const getGroupList = (params) => {
// return utils.checkAuth(()=>{
return fetch({
headers,
url: getFollowUpSC(`/followup/planPatient/group`),
method: 'get',
params: params,
description: '获取分组列表',
})
// })
};
export const getFollowStartTimeList = (planId) => {
// return utils.checkAuth(()=>{
return fetch({
headers,
url: getFollowUpSC(`/followup/planPatient/${planId}/times`),
method: 'get',
description: '获取履约开始时间列表(居民相关)',
})
// })
};
export const getResidentDetail = (planId,patientId,fuPlanPatientId ) => {
// return utils.checkAuth(()=>{
return fetch({
headers,
url: getFollowUpSC(`/followup/planPatient/${planId}/detail/${patientId}?planPatientsId=${fuPlanPatientId}`),
method: 'get',
description: '获取居民详情',
})
// })
};
export const changePlan = (data) => {
return utils.checkAuth(()=>{
return fetch({
headers,
url: getFollowUpSC(`/followup/planPatient/change`),
method: 'put',
data: data,
description: '变更计划',
})
})
};
export const finishPlan = (data) => {
return utils.checkAuth(()=>{
return fetch({
headers,
url: getFollowUpSC(`/followup/planPatient/status`),
method: 'put',
data: data,
description: '变更计划',
})
})
};
export const deletePlan = (planId) => {
return utils.checkAuth(()=>{
return fetch({
headers,
url: getFollowUpSC(`/followup/plans/${planId}`),
method: 'delete',
description: '删除计划',
})
})
};
export const getVerifyStatus = (params) => {
return utils.checkAuth(()=>{
return fetch({
headers,
url: getFollowUpSC(`/followup/plans/validate/status`),
method: 'get',
params: params,
description: '认证校验',
})
})
};
/*预约管理*/
export const getReservationList = (data) => {
return utils.checkAuth(()=>{
return fetch({
headers,
url: getFollowUpSC(`/followup/appoint/appointed/list`),
method: 'post',
data: data,
description: '获取预约列表',
})
})
};
export const getCheckReservation = (data) => {
return utils.checkAuth(()=>{
return fetch({
headers,
url: getFollowUpSC(`/healths/notice/fu/doctor/appoint/pushValid`),
method: 'post',
data: data,
description: '发送预约校验',
})
})
};
export const getReservationPatients = (data) => {
// return utils.checkAuth(()=>{
return fetch({
headers,
url: getFollowUpSC(`/followup/appoint/appointed/count`),
method: 'post',
data: data,
description: '查看预约人数',
})
// })
};
export const changeReservationStatus = (data) => {
return utils.checkAuth(()=>{
return fetch({
headers,
url: getFollowUpSC(`/followup/appoint/status/`),
method: 'post',
data: data,
description: '手动变更预约状态',
})
})
};
export const sendReservation = (data) => {
return utils.checkAuth(()=>{
return fetch({
headers,
url: getFollowUpSC(`/followup/appoint/`),
method: 'post',
data: data,
description: '发送预约',
})
})
};
/*录入管理*/
export const getEnteringList = (data) => {
return utils.checkAuth(()=>{
return fetch({
headers,
url: getFollowUpSC(`/followup/entering/list`),
method: 'post',
data: data,
description: '录入列表查看',
})
})
}
export const changeEnteringStatus = (data) => {
return utils.checkAuth(()=>{
return fetch({
headers,
url: getFollowUpSC(`/followup/entering/status/change`),
method: 'post',
data: data,
description: '变更履约状态',
})
})
}
export const getEnteringInfo = (patientId, fuPlanPatientTimesId) => {
// return utils.checkAuth(()=>{
return fetch({
headers,
url: getFollowUpSC(`/followup/entering/${patientId}/fuInfo/${fuPlanPatientTimesId}`),
method: 'get',
// params: params,
description: '履约单条信息查看',
},)
// })
}
export const getFormList = (planTimesId) => {
// return utils.checkAuth(()=>{
return fetch({
headers,
url: getFollowUpSC(`/followup/entering/scale/${planTimesId}/list`),
method: 'get',
// params: params,
description: '获取量表列表',
},)
// })
}
//获取新建计划居民列表
export const getPlanPatientsList = (data) =>{
// return utils.checkAuth(()=>{
return fetch({
headers:{
sysCode: 9,
hospitalAuth:true
},
url: getFollowUpSC(`/healths/patients/infolist`),
method: 'post',
data: data,
description: '获取新建计划居民列表',
},)
// })
}
// 获取履约计划模板列表
export const getFollowupTemplate = (data) => {
// return utils.checkAuth(()=>{
return fetch({
headers,
url: getFollowUpSC(`/followup/plans/templets`),
method: 'get',
data: data,
description: '获取履约计划模板列表',
})
// })
}
// 获取履约量表固定模板
export const getFollowupTableTemplate = (id) => {
// return utils.checkAuth(()=>{
return fetch({
headers,
url: getFollowUpSC(`/followup/plans/templets/${id}`),
method: 'get',
data: {},
description: '获取履约量表固定模板',
})
// })
}
// 获取量表列表
export const getFormOptions = (data)=>{
// return utils.checkAuth(()=>{
return fetch({
headers,
url: getFollowUpSC(`/followup/entering/scale/list`),
method: 'get',
data: data,
description: '获取量表列表',
})
// })
}
/*常量*/
export const getBasicData = (params) => {
// return utils.checkAuth(()=>{
return fetch({
headers,
url: getFollowUpSC(`/basic-data/constants/`),
method: 'get',
params: params,
description: '获取常量',
})
// })
};
// 获取所有漫画列表
export const getAllEducationComtent = (data) => {
// return utils.checkAuth(()=>{
return fetch({
headers,
url: getFollowUpSC(`/healths/comtent/workstation/list`),
method: 'post',
data: data,
description: '获取所有漫画列表'
})
// })
}
// 获取所有疾病
export const getAllDiseases = (params) => {
// return utils.checkAuth(()=>{
return fetch({
headers,
url: getFollowUpSC(`/healths/patients/diseases/-1`),
method: 'get',
params: params,
description: '获取所有疾病',
})
// })
}
// 获取所有分组
export const getAllLabels = (params) => {
// return utils.checkAuth(()=>{
return fetch({
headers,
url: getFollowUpSC(`/healths/labels/`),
method: 'get',
params: params,
description: '获取所有分组',
})
// })
}
// 获取微信和短信病人数接口
export const getPatientNumber = (data) => {
// return utils.checkAuth(()=>{
return fetch({
headers: {
sysCode: 9,
hospitalAuth:true
},
url: getFollowUpSC(`/healths/patientEducation/getSendPatientTypeNum`),
method: 'post',
data: data,
description: '获取微信和短信病人数接口',
})
// })
}
/*
* 量表相关
*/
// 获取域名白名单
export const getDomain = (data) => {
return fetch({
url: getFollowUpSC(`/followup/route/domain?type=1`),
method: 'get',
data: {},
})
}
// 获取展示的模块
export const getScaleModels = (domain,scaleNo) => {
return fetch({
url: `${domain}/scale/${scaleNo}/models`,
method: 'get',
data: {},
})
}
// 获取量表详情
export const getScaleDetail = (domain,planPatientsTimesId,scaleNo) => {
return fetch({
url: `${domain}/scale/${planPatientsTimesId}/${scaleNo}/info?type=2&isLine=2`,
method: 'get',
data: {},
})
}
// 提交量表
export const postScale = ( domain,data ) => {
return fetch({
url: `${domain}/scale/save`,
method: 'post',
data: JSON.stringify(data),
})
}
// 更新量表状态
export const updateScalesStatus = ( data ) => {
return fetch({
url: getFollowUpSC(`/followup/entering/scale/updateScalesStatus`),
method: 'post',
data: data,
})
}
// 获取量表详情
export const getFirstAccess = () => {
return fetch({
url: getFollowUpSC(`/followup/overView/firstAccess`),
method: 'get',
data: {},
})
}
/**
* Add by Anndy Yang
* 统一验证:量表内是否存在敏感字段、居民是否签署隐私协议、7天内是否发送过授权短信
* @param {[type]} data
{
"scaleNo":"String,量表编号",
// "patientIds":"List<Integer>,医生/居民id集合", // pc端只传这个字段
"planPatientsTimesId": "planPatientsTimesId", // app端只传这个字段
"protocolType":"Integer,协议类型(1:平台用户协议,5:隐私协议)",
"userType":"Integer,用户类型(1:居民,2:医生,3:其他)",
"validateType":"1:3个条件依次校验,2:后面2个条件依次校验"
}
* @return {[type]}
{
"code": "000000",
"message": "成功",
"data": {
"levelType":"类型 1:量表不存在敏感字段,2:居民都已签署协议,3:7天内发送过授权短信,4:7天内未发送过授权短信"
"ids":"List<Integer>,未签署协议的id集合(需要发送授权短信的居民id集合)"
}
}
*/
export const uniteValidate = (data) => {
return fetch({
url: getFollowUpSC(`/followup/protocol/uniteValidate`),
method: 'post',
data: data,
})
};
/**
* Add by Anndy Yang
* [批量]医生给居民发送授权短信
* @param {[type]} data {"patientIds":"List<Integer>,居民id集合"}
* @return {[type]} [description]
*/
export const authMessage = (data) => {
return fetch({
url: getFollowUpSC(`/followup/protocol/authMessage`),
method: 'post',
data: data,
})
};
// 关于权限获取展示的模块信息
export const getScaleModels2 = (domain,scaleNo, params) => {
return fetch({
url: `${domain}/followup/protocol/${scaleNo}/models`,
method: 'get',
params: params,
})
}
// 检查号码是否符合规范,包括长度,类型
function isCardNo(card){
//身份证号码为15位或者18位,15位时全为数字,18位前17位为数字,最后一位是校验位,可能为数字或字符X
var reg = /(^\d{15}$)|(^\d{17}(\d|X|x)$)/;
if(reg.test(card) === false){
return false;
}
return true;
}
// 取身份证前两位,校验省份
function checkProvince(card,vcity){
var province = card.substr(0,2);
if(vcity[province] == undefined){
return false;
}
return true;
}
// 检查生日是否正确
function checkBirthday(card){
var len = card.length;
//身份证15位时,次序为省(3位)市(3位)年(2位)月(2位)日(2位)校验位(3位),皆为数字
if(len == '15'){
var re_fifteen = /^(\d{6})(\d{2})(\d{2})(\d{2})(\d{3})$/;
var arr_data = card.match(re_fifteen);
var year = arr_data[2];
var month = arr_data[3];
var day = arr_data[4];
var birthday = new Date('19'+year+'/'+month+'/'+day);
return verifyBirthday('19'+year,month,day,birthday);
}
//身份证18位时,次序为省(3位)市(3位)年(4位)月(2位)日(2位)校验位(4位),校验位末尾可能为X
if(len == '18'){
var re_eighteen = /^(\d{6})(\d{4})(\d{2})(\d{2})(\d{3})([0-9]|X|x)$/;
var arr_data = card.match(re_eighteen);
var year = arr_data[2];
var month = arr_data[3];
var day = arr_data[4];
var birthday = new Date(year+'/'+month+'/'+day);
return verifyBirthday(year,month,day,birthday);
}
return false;
}
// 校验日期
function verifyBirthday(year,month,day,birthday) {
var now = new Date();
var now_year = now.getFullYear();
//年月日是否合理
if(birthday.getFullYear() == year && (birthday.getMonth() + 1) == month && birthday.getDate() == day)
{
//判断年份的范围(0岁到100岁之间)
var time = now_year - year;
if(time >= 0 && time <= 100)
{
return true;
}
return false;
}
return false;
}
// 校验位的检测
function checkParity(card){
//15位转18位
card = changeFivteenToEighteen(card);
var len = card.length;
if(len == '18'){
var arrInt = new Array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2);
var arrCh = new Array('1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2');
var cardTemp = 0, i, valnum;
for(i = 0; i < 17; i ++) {
cardTemp += card.substr(i, 1) * arrInt[i];
}
valnum = arrCh[cardTemp % 11];
if (valnum == card.substr(17, 1).toLocaleUpperCase())
{
return true;
}
return false;
}
return false;
}
// 15位转18位身份证号
function changeFivteenToEighteen(card){
if(card.length == '15')
{
var arrInt = new Array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2);
var arrCh = new Array('1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2');
var cardTemp = 0, i;
card = card.substr(0, 6) + '19' + card.substr(6, card.length - 6);
for(i = 0; i < 17; i ++)
{
cardTemp += card.substr(i, 1) * arrInt[i];
}
card += arrCh[cardTemp % 11];
return card;
}
return card;
}
//最新的身份证校验规则
function validateIdCard (num) {
num = num.toUpperCase(); //身份证号码为15位或者18位,15位时全为数字,18位前17位为数字,最后一位是校验位,可能为数字或字符X。
if (!(/(^\d{15}$)|(^\d{17}([0-9]|X)$)/.test(num))) {
return false;
}
//验证前2位,城市符合
var aCity={11:"北京",12:"天津",13:"河北",14:"山西",15:"内蒙古",21:"辽宁",22:"吉林",23:"黑龙江 ",31:"上海",32:"江苏",33:"浙江",34:"安徽",35:"福建",36:"江西",37:"山东",41:"河南",42:"湖北",43:"湖南",44:"广东",45:"广西",46:"海南",50:"重庆",51:"四川",52:"贵州",53:"云南",54:"西藏",61:"陕西",62:"甘肃",63:"青海",64:"宁夏",65:"新疆",71:"台湾",81:"香港",82:"澳门",91:"国外"};
if(aCity[parseInt(num.substr(0,2))]==null){
return false;
}
//下面分别分析出生日期和校验位
var len, re; len = num.length;
if (len == 15) {
re = new RegExp(/^(\d{6})(\d{2})(\d{2})(\d{2})(\d{3})$/);
var arrSplit = num.match(re); //检查生日日期是否正确
var dtmBirth = new Date('19' + arrSplit[2] + '/' + arrSplit[3] + '/' + arrSplit[4]);
var bGoodDay; bGoodDay = (dtmBirth.getYear() == Number(arrSplit[2])) && ((dtmBirth.getMonth() + 1) == Number(arrSplit[3])) && (dtmBirth.getDate() == Number(arrSplit[4]));
if (!bGoodDay) { // 身份证号的出生日期不对
return false;
} else { //将15位身份证转成18位 //校验位按照ISO 7064:1983.MOD 11-2的规定生成,X可以认为是数字10。
var arrInt = new Array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2);
var arrCh = new Array('1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2');
var nTemp = 0, i;
num = num.substr(0, 6) + '19' + num.substr(6, num.length - 6);
for(i = 0; i < 17; i ++) {
nTemp += num.substr(i, 1) * arrInt[i];
}
num += arrCh[nTemp % 11];
return true;
}
}
if (len == 18) {
re = new RegExp(/^(\d{6})(\d{4})(\d{2})(\d{2})(\d{3})([0-9]|X)$/);
var arrSplit = num.match(re); //检查生日日期是否正确
var dtmBirth = new Date(arrSplit[2] + "/" + arrSplit[3] + "/" + arrSplit[4]);
var bGoodDay; bGoodDay = (dtmBirth.getFullYear() == Number(arrSplit[2])) && ((dtmBirth.getMonth() + 1) == Number(arrSplit[3])) && (dtmBirth.getDate() == Number(arrSplit[4]));
if (!bGoodDay) { // 身份证号的出生日期不对
return false;
}
else { //检验18位身份证的校验码是否正确。 //校验位按照ISO 7064:1983.MOD 11-2的规定生成,X可以认为是数字10。
var valnum;
var arrInt = new Array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2);
var arrCh = new Array('1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2');
var nTemp = 0, i;
for(i = 0; i < 17; i ++) {
nTemp += num.substr(i, 1) * arrInt[i];
}
valnum = arrCh[nTemp % 11];
if (valnum != num.substr(17, 1)) { // 18位身份证号的校验码不正确
return false;
}
return true;
}
}
return false;
}
export const checkCardNum = (rule, value, callback) => {
// var vcity={ 11:"北京",12:"天津",13:"河北",14:"山西",15:"内蒙古",
// 21:"辽宁",22:"吉林",23:"黑龙江",31:"上海",32:"江苏",
// 33:"浙江",34:"安徽",35:"福建",36:"江西",37:"山东",41:"河南",
// 42:"湖北",43:"湖南",44:"广东",45:"广西",46:"海南",50:"重庆",
// 51:"四川",52:"贵州",53:"云南",54:"西藏",61:"陕西",62:"甘肃",
// 63:"青海",64:"宁夏",65:"新疆",71:"台湾",81:"香港",82:"澳门",91:"国外"
// };
// //是否为空
// if(value === ''){
// callback(new Error('请输入正确的身份证'))
// }
// //校验长度,类型
// if(isCardNo(value) === false){
// callback(new Error('请输入正确的身份证'))
// }
// //检查省份
// if(checkProvince(value,vcity) === false){
// callback(new Error('请输入正确的身份证'))
// }
// //校验生日
// if(checkBirthday(value) === false){
// callback(new Error('请输入正确的身份证'))
// }
// //检验位的检测
// if(checkParity(value) === false){
// callback(new Error('请输入正确的身份证'))
// }
// callback()
if(value === ''){
callback(new Error('请输入正确的身份证'))
}else {
if(validateIdCard(value)) {
callback()
}else {
callback(new Error('请输入正确的身份证'))
}
}
}
import rangeJson from './rangConfig';
// 这个方法,是用户在选择履约轮次(6个月,12个月)后续操作
let checkNeedRule = (val) => {
const needRule = sessionStorage.getItem('needRule');
if( val!='0' && (!val||val=='') && (!needRule || needRule=='true') ){
return true;
}
return false;
}
// 校验范围通用方法
export const checkRange = (rule, value, callback) => {
let min,max;
let val = parseFloat(value);
let res;
// 处理 诸如 01 这种情况
if(value && value.length>1 && value.indexOf('.')<0){
res = (new RegExp(/^[1-9]\d*$/g)).test(value);
}else{
res = true;
}
rangeJson.forEach((item)=>{
if(item.field == rule.field){
min = item.min;
max = item.max;
}
})
const ruless = ( (val >= min) && (val <= max) && res )
// if(ruless || checkNeedRule(val)){
if( !value || ruless ){
callback()
}else{
callback(new Error(`输入范围${min}~${max}`))
}
}
// 校验手机号
export const checkMobile = (rule, value, callback) => {
const reg = /^1[3|4|5|6|7|8|9][0-9]{9}$/; //验证规则
const flag = reg.test(value);
if(flag){
callback()
}else{
callback(new Error(`请输入正确的手机号码`))
}
}
// 校验是否是整数
export const checkIsInteger = (rule, value, callback) => {
const val = parseFloat(value);
const num = Number.isInteger(val);
// const val = Number.parseInt(value);
// const num = /^[0-9]*[1-9][0-9]*$/.test(value);
// if(num || checkNeedRule(val)){
if( !value || num ){
callback()
}else{
callback(new Error(`输入整数`))
}
}
// 校验是否是一位小数
export const checkNumberIsToFixed = (rule, value, callback) => {
const isNum = /^(([1-9][0-9]*)|(([0]\.\d{1,1}|[1-9][0-9]*\.\d{1,1})))$/;
const val = Number(value);
// if(isNum.test(val) || checkNeedRule(val)){
if( !value || isNum.test(val) ){
callback()
}else{
callback(new Error(`最多输入1位小数`))
}
}
// 大于0的正整数
export const checkNormalInt = (rule, value, callback) => {
const val = parseFloat(value);
const isInteger = Number.isInteger(val);
// if((isInteger && val > 0) || checkNeedRule(val)){
if( !value || (isInteger && val > 0) ){
callback()
}else{
callback(new Error(`请输入大于0的正整数`))
}
}
// 校验是否是两位小数
export const checkNumberIsToFixedTwo = (rule, value, callback) => {
const isNum = /^(-)?(0|[1-9]\d*)(\s|$|\.\d{1,2}\b)/;
const val = Number(value);
// if(isNum.test(val) || checkNeedRule(val)){
if( !value || isNum.test(val) ){
callback()
}else{
callback(new Error(`最多输入2位小数`))
}
}
// 只获取指定的参数(浅复制);
function getParams(params, arr) {
const res = Object.create(null);
if (!params) return res;
if (Object.prototype.toString.call(params) === '[object FormData]') { // formData类型直接返回
return params;
}
if (arr && arr.length) { // 只对需要处理的处理下
arr.forEach(item => {
if (item) {
res[item] = params[item] || '';
}
});
return res;
} else {
return params;
}
}
export default {
getParams,
};
import dataConverter from './dataConverter';
import fetch from '@/utils/fetch';
import { getBaseUrl, getSaasDomain, getSaasApiDomain } from '@/utils/index'
import Vue from 'vue';
function getSaasHost(){
var host;
if(location.host.indexOf('dev-work')>-1 || location.host.indexOf('localhost')>-1){
host = 'https://dev-saas.yunqueyi.com'
}else if(location.host.indexOf('test1-work')>-1){
host = 'https://test1.yunqueyi.com'
}else if(location.host.indexOf('uat-work')>-1){
host = 'https://uat.yunqueyi.com'
}else{
host = 'https://www.yunqueyi.com'
}
return host
}
function getWsHost(){
var host;
if(location.host.indexOf('dev-work')>-1 || location.host.indexOf('localhost')>-1){
host = 'https://dev-ws.yunqueyi.com'
}else if(location.host.indexOf('test1-work')>-1){
host = 'https://test1-ws.yunqueyi.com'
}else if(location.host.indexOf('uat-work')>-1){
host = 'https://uat-ws.yunqueyi.com'
}else{
host = 'https://ws.yunqueyi.com'
}
return host
}
const alertMessage = (msg, confirmButtonText, cancelButtonText, callback) => {
Vue.prototype.$confirm(msg, '提醒', {
confirmButtonText: confirmButtonText,
cancelButtonText: cancelButtonText,
customClass: 'check-auth',
showClose: false,
}).then(() => {
callback();
}).catch(() => {
// 关闭弹窗
});
}
export default {
DC: dataConverter,
checkAuth: (callback) => {
return new Promise((resolve, reject) => {
resolve(fetch({
headers: {
token: localStorage.getItem('storageToken')
},
url: getBaseUrl(`/healths/doctor/hospitalAuth`),
method: 'get',
description: '检查用户的机构权限',
}).then(res => {
// 1、未加入 2、审核中 3、加入成功
if (res.code == '000000') {
if (res.data == 1) {
// 点击 去加入,进入加入机构流程
alertMessage('您当前暂无机构,无法使用居民管理、履约管理和群发消息等功能,请在加入机构后重试。','去加入','暂不加入', ()=>{
location.href = getSaasHost() + '/pica-base/pica_join.html'
})
return new Promise((resolve, reject) => {
})
} else if (res.data == 2) {
alertMessage('您创建的机构正在审核中,暂无法使用居民管理、履约管理和群发消息等功能,请在审核通过后重试。','查看审核','取消', ()=>{
location.href = getWsHost() + '/outside/status?tk=' + localStorage.getItem('storageToken')
})
return new Promise((resolve, reject) => {
})
} else if (res.data == 3) {
return callback()
}
}
}))
})
},
checkAuthFunc: ()=>{
return new Promise((resolve, reject) => {
resolve(fetch({
headers: {
token: localStorage.getItem('storageToken')
},
url: getBaseUrl(`healths/doctor/hospitalAuth`),
method: 'get',
description: '检查用户的机构权限',
}).then(res => {
// res.data = 2
if (res.code == '000000') {
if (res.data == 1) {
alertMessage('您当前暂无机构,无法使用居民管理、履约管理和群发消息等功能,请在加入机构后重试。','去加入','暂不加入', ()=>{
location.href = getSaasHost() + '/pica-base/pica_join.html'
})
} else if (res.data == 2) {
alertMessage('您创建的机构正在审核中,暂无法使用居民管理、履约管理和群发消息等功能,请在审核通过后重试。','查看审核','取消', ()=>{
location.href = getWsHost() + '/outside/status?tk=' + localStorage.getItem('storageToken')
})
} else if (res.data == 3) {
}
return new Promise((resolve, reject) => {
resolve(res.data)
})
}
}))
})
}
};
import range from './range';
import rangeHype from './rangeHype';
import rangeDiabetes from './rangeDiabetes';
export default [
...range,
...rangeHype,
...rangeDiabetes
]
// 脑卒中字段校验的配置文件
export default [
{
field: 'fastingBloodGlucose',
name: '空腹血糖',
min: 1,
max: 33.3
},
{
field: 'triglyceride',
name: '甘油三酯',
min: 0,
max: 5
},
{
field: 'cholesterol',
name: '胆固醇',
min: 1,
max: 10
},
{
field: 'cLdl',
name: '低密度脂蛋白胆固醇',
min: 0,
max: 5
},
{
field: 'cHdl',
name: '高密度脂蛋白胆固醇',
min: 0,
max: 5
},
{
field: 'stature',
name: '身高',
min: 100,
max: 200
},
{
field: 'weight',
name: '体重',
min: 35,
max: 200
},
{
field: 'waistline',
name: '腰围',
min: 50,
max: 150
},
{
field: 'firstSystolicPressure',
name: '收缩压SBP',
min: 70,
max: 240
},
{
field: 'firstDiastolicPressure',
name: '舒张压DBP',
min: 50,
max: 130
},
{
field: 'firstPulse',
name: '脉搏',
min: 30,
max: 200
},
{
field: 'secondSystolicPressure',
name: '收缩压SBP',
min: 70,
max: 240
},
{
field: 'secondDiastolicPressure',
name: '舒张压DBP',
min: 50,
max: 130
},
{
field: 'secondPulse',
name: '脉搏',
min: 30,
max: 200
},
]
// 高血压字段校验的配置文件
export default [
{
field: 'systolicBloodPressure',
name: '收缩压SBP',
min: 70,
max: 240
},
{
field: 'diastolicBloodPressure',
name: '舒张压DBP',
min: 50,
max: 130
},
{
field: 'bodyHeight',
name: '身高',
min: 100,
max: 250
},
{
field: 'bodyWeight',
name: '体重',
min: 35,
max: 250
},
{
field: 'nextBodyWeight',
name: '体重',
min: 35,
max: 250
},
{
field: 'fastingBloodSugar',
name: '空腹血糖值',
min: 1,
max: 33.3
},
{
field: 'glycosylatedHemoglobinPercent',
name: '糖化血红蛋白值',
min: 3.00,
max: 20.00
},
{
field: 'smokingAmount',
name: '日吸烟量',
min: 0,
max: 99
},
{
field: 'nextSmokingAmount',
name: '日吸烟量',
min: 0,
max: 99
},
{
field: 'alcoholConsumption',
name: '日饮酒量',
min: 0,
max: 99
},
{
field: 'nextAlcoholConsumption',
name: '日饮酒量',
min: 0,
max: 99
},
{
field: 'workoutOfWeek',
name: '运动情况',
min: 0,
max: 99
},
{
field: 'workoutDuration',
name: '运动情况',
min: 0,
max: 99
},
{
field: 'nextWorkoutOfWeek',
name: '运动情况',
min: 0,
max: 99
},
{
field: 'nextWorkoutDuration',
name: '运动情况',
min: 0,
max: 99
},
{
field: 'nextWorkoutDuration',
name: '运动情况',
min: 0,
max: 99
},
{
field: 'stapleFoodGram',
name: '主食摄入量',
min: 0,
max: 999
},
{
field: 'nextStapleFoodGram',
name: '主食摄入量',
min: 0,
max: 999
},
]
// 高血压字段校验的配置文件
export default [
{
field: 'systolicBloodPressure',
name: '收缩压SBP',
min: 70,
max: 240
},
{
field: 'diastolicBloodPressure',
name: '舒张压DBP',
min: 50,
max: 130
},
{
field: 'bodyHeight',
name: '身高',
min: 100,
max: 250
},
{
field: 'bodyWeight',
name: '体重',
min: 35,
max: 250
},
{
field: 'nextBodyWeight',
name: '下次履约体重',
min: 35,
max: 250
},
{
field: 'heartRate',
name: '心率',
min: 30,
max: 200
},
{
field: 'smokingAmount',
name: '本次日吸烟量',
min: 0,
max: 99
},
{
field: 'nextSmokingAmount',
name: '下次履约日吸烟量',
min: 0,
max: 99
},
{
field: 'alcoholConsumption',
name: '本次日饮酒量',
min: 0,
max: 99
},
{
field: 'nextAlcoholConsumption',
name: '下次履约日饮酒量',
min: 0,
max: 99
},
{
field: 'workoutOfWeek',
name: '本次运动情况',
min: 0,
max: 99
},
{
field: 'workoutDuration',
name: '本次运动情况',
min: 0,
max: 99
},
{
field: 'nextWorkoutOfWeek',
name: '下次履约运动情况',
min: 0,
max: 99
},
{
field: 'nextWorkoutDuration',
name: '下次履约运动情况',
min: 0,
max: 99
},
{
field: 'dosageDay',
name: '用法',
min: 0,
max: 5
},
]
/**
* Created by Anndy Yang on 18/09/18.
*/
import { envConfig } from '@/utils/env-config'
export function setEventByModuleCode(itemData){
let modeCode = itemData.appModuleInfo.code || '';
let paramList = itemData.appModuleInfo.paramList ? itemData.appModuleInfo.paramList : ''
if( modeCode === 'M001' || modeCode === 'M002' || modeCode === 'M003') {
paramList = ''
}else if( modeCode === 'M100' || modeCode === 'M300' ) {
let urlPara = getUrlParmByCode(paramList);
paramList[0] && (paramList[0].value += urlPara);
}else if( modeCode === 'M400') {
let path = paramList[0]['key'];
let v = paramList[0]['value'];
let query = setRouterParm(paramList);
}
if(typeof paramList === 'string' && !paramList){
paramList = []
}
return paramList;
}
function getUrlParmByCode(paramList) {
if ( paramList.length <= 1) {
return ''
}
let dataStr = ''
let list = [];
for( let i = 1; i < paramList.length; i ++) {
list.push(paramList[i].key + '=' + paramList[i].value)
}
dataStr = list.join('&')
if (dataStr !== '') {
return '?' + dataStr
}
return ''
}
// 计算高度
export function resizeHeight(cMinusHeight = 152, iMinuxHeight = 210, refHeightId = 'sidebarWrapperId',
containerHeightId = 'appContainerId', innerHeightId = 'elTableId'){
if (!p_getElm(refHeightId) || !p_getElm(containerHeightId) || !p_getElm(innerHeightId)) {
// window.onresize = null
logger.warn('No certain dom id!!!');
}
let containerHeight = p_getElm(refHeightId).getBoundingClientRect().height - 50
p_getElm(containerHeightId).style.height = containerHeight - cMinusHeight + 'px'
p_getElm(innerHeightId).style.height = containerHeight - iMinuxHeight + 'px'
if(p_getElm('elTableIdInner')){
p_getElm('elTableIdInner').style.height = containerHeight - iMinuxHeight + 'px'
}
window.onresize = function() {
containerHeight = p_getElm(refHeightId).getBoundingClientRect().height - 50
p_getElm(containerHeightId).style.height = containerHeight - cMinusHeight + 'px'
p_getElm(innerHeightId).style.height = containerHeight - iMinuxHeight + 'px'
if (p_getElm('elTableIdInner')) {
p_getElm('elTableIdInner').style.height = containerHeight - iMinuxHeight + 'px'
}
}
}
function p_getElm(elmId) {
return document.getElementById(elmId)
}
export function deepCopy(obj) {
var result = Array.isArray(obj) ? [] : {};
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
if (typeof obj[key] === 'object') {
result[key] = deepCopy(obj[key]); //递归复制
} else {
result[key] = obj[key];
}
}
}
return result;
}
/**
*
* @param {Array} originData 初始数据
* @param {Boolean} isUp true: 升序 false: 降序
* @param {String} sortField 排序字段,如果没有,则直接排序
* @param {Function} converFun 字段对应的数值转换函数
*/
export function arraySort(originData, isUp = true, sortedField, converFun) {
// debugger
let sortedData = originData.slice(), swap, sourceA, sourceB;
for(let i = 0; i < sortedData.length - 1; i ++) {
for(let j = 0; j < sortedData.length - i -1; j++) {
sourceA = sortedData[j]
sourceB = sortedData[j + 1]
if(sortedField && !converFun) {
sourceA = sourceA[sortedField]
sourceB = sourceB[sortedField]
} else if(sortedField && converFun && typeof converFun === 'function'){
if(!sourceA[sortedField] || !sourceB[sortedField]) {
sourceA = 0
sourceB = 0
} else {
sourceA = converFun(sourceA[sortedField])
sourceB = converFun(sourceB[sortedField])
}
}
// if(!sourceA || !sourceB) {
// sourceA = 0
// sourceB = 0
// }
if(isUp) {
if((sourceA - 0) > (sourceB - 0)) {
swap = sortedData[j]
sortedData[j] = sortedData[j + 1]
sortedData[j + 1] = swap
}
} else {
if((sourceA - 0) < (sourceB - 0)) {
swap = sortedData[j]
sortedData[j] = sortedData[j + 1]
sortedData[j + 1] = swap
}
}
}
}
return sortedData
}
export function sortParmData(originData, orderCol, index) {
return originData.sort((a, b) => {
return (a[orderCol] - b[orderCol] ) * -1
})
}
// 获取SC服务器域名地址
export function getBaseUrl(url) {
return getConfigByEnvType('baseUrl') + url
}
// 获取七牛token
export function getQiniuToken1() {
return getConfigByEnvType('qiniuFileUrl')
}
// 登录URL
export function getLoginUrl(param) {
return getConfigByEnvType('loginUrl') + param
}
export function getInnerLoginUrl() {
return getConfigByEnvType('innerLoginUrl')
}
// 云鹊医首页
export function getYunQueYiUrl() {
return getConfigByEnvType('yuequeyiIndexUrl')
}
// 七牛上传视频和图片
export function uploadVideo() {
return getConfigByEnvType('qiniuResourceUrl')
}
export function uploadImg() {
return getConfigByEnvType('qiniuImgUrl')
}
// 获取履约微服务服务器域名地址
export function getFollowUpSC(url) {
return getConfigByEnvType('followUpSC') + url
}
// 获取常量接口域名地址
export function getBasicDataApi(url) {
return getConfigByEnvType('basicDataUrl') + url
}
// 获取saas端域名地址
export function getSaasDomain(url) {
return getConfigByEnvType('saasDomainUrl') + url
}
// 获取saasApi端域名地址
export function getWorkApi(url) {
return getConfigByEnvType('workApiUrl') + url
}
// 获取saas端api域名地址
export function getSaasApiDomain(url) {
return getConfigByEnvType('apiUrl') + url
}
// 获取工作站的域名地址
export function getWorkDomain(url) {
return getConfigByEnvType('workApiSrc') + url
}
// 根据不同环境,生成URL
function getConfigByEnvType(urlType) {
return envConfig[process.env.BUILD_ENV][urlType]
}
// 获取report服务器域名地址
export function getReportUrl(url) {
return getConfigByEnvType('reportUrl') + url
}
// 获取Excel地址
export function getExeclUrl(url) {
return getConfigByEnvType('excelUrl') + url
}
// 获取教培项目文件地址
export function getItemFileUrl(url) {
return getConfigByEnvType('itemFileUrl') + url
}
\ No newline at end of file
import fetch from '@/utils/fetch'
import { getBaseUrl, getReportUrl, getWorkApi } from '@/utils/index'
import { CryptoJS } from '@/plugins/aes'
import 'jsencrypt'
import { getPubKey } from '@/utils/account/accountApi';
let pubKey = "";
module.exports = {
data: function () {
return {
token: null
}
},
created: function () {
// let query = this.$router.query
// this.token = this.getUrlSearch(location.href, 'token') || (query && query.token) || null
// this.token = this.getUrlKey('token') || (query && query.token) || null
},
mounted: function() {
},
methods: {
// generate key
getAesKey(len) {
len = len || 16;
var aesKey = "";
var strList = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
var strLen = strList.length;
for(var i=0; i<len; i++){
aesKey += strList.charAt( Math.floor( Math.random()*strLen ) );
};
return aesKey;
},
// 加密传参,发送请求
sendEncryptRequest(content, cb){
content = JSON.stringify(content); // 后端要求转 string
// debugger;
if(pubKey){ // pubKey获取过就不用再获取了
let params = this.formatContent(content, pubKey);
cb && cb(params);
}else{
this.handleGetPubKey(content, cb);
}
},
// get public key
handleGetPubKey(content, cb){
getPubKey().then(res => {
// console.log('>>>>>>>>>>>>>>>>>>>> publicKey: ', res)
if(res.code == '000000'){
pubKey = res.data;
if(cb){
let params = this.formatContent(content, pubKey);
cb && cb(params);
}
}else{
this.$message({
message: (res && res.message) || '接口出错',
type: 'warning'
});
}
})
},
// format account params
formatContent(content, pubKey) { // obj为具体的json传参
let aesKey = this.getAesKey(16);
// console.log('AES key::::::: ', aesKey)
let params = {
key: '',
content: ''
};
// 开发阶段后端接口还没处理加密,先传 原始json数据 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 后端加密OK后 再用下面的注释代码
// params.content = content;
params.content = this.AesEncrypt(content, aesKey);
params.key = this.RsaEncrypt(aesKey, pubKey);
return params;
},
// AES encrypt
AesEncrypt(content, aesKey) {
let sKey = CryptoJS.enc.Utf8.parse(aesKey);
let sContent = CryptoJS.enc.Utf8.parse(content);
let encrypted = CryptoJS.AES.encrypt(sContent, sKey, {mode:CryptoJS.mode.ECB,padding: CryptoJS.pad.Pkcs7});
return encrypted.toString();
},
// RSA encrypt
RsaEncrypt(aesKey, pubKey){
let _encrypt = new JSEncrypt();
let boss_public_key = pubKey;
_encrypt.setPublicKey(boss_public_key);
let encrypted = _encrypt.encrypt(aesKey);
return encrypted;
},
getUrlPara(obj) {
let dataStr = ''
let list = [];
for (let attr in obj) {
if (obj.hasOwnProperty(attr) && attr != 'data') {
list.push(attr + '=' + obj[attr])
}
}
dataStr = list.join('&')
if (dataStr !== '') {
return '?' + dataStr
}
return ''
},
setRouterParm(paramList){
let parm = {};
if(paramList.length<=1){
return '';
}
for(let i=1;i<paramList.length;i++){
parm[paramList[i].key] = paramList[i].value;
}
return parm;
},
// 拼接多个参数
getUrlParmByCode(paramList) {
if ( paramList.length <= 1) {
return ''
}
let dataStr = ''
let list = [];
for( let i = 1; i < paramList.length; i ++) {
list.push(paramList[i].key + '=' + paramList[i].value)
}
dataStr = list.join('&')
if (dataStr !== '') {
return '?' + dataStr
}
return ''
},
//处理五分钟数据 初始化播放状态
handelFive(d) {
for (let i = 0; i < d.length; i++) {
d[i].play = '0';
}
return d;
},
// 根据条件排序
async searchForOrder(searchCategory = '1', searchValue = '', sortItem = 1, pageSize = 10, sourceData = []) {
if(pageSize <=0 ) return;
let str2 = (searchValue || '').replace(/[\-\_\,\!\|\~\`\(\)\#\$\%\^\&\*\{\}\:\;\"\L\<\>\?]/g, '');// 去掉特殊字符
let _this = this,
para = {
searchCategory: searchCategory,
searchValue: str2,
keywordColor: 'rgba(244,122,72,1)',
sortItem: sortItem,
pageNo: 1,
pageSize: pageSize,
token: _this.token,
setEntry: 'headers',
}
let url = 'contents/searchKeyword/searchContent'
let csourceData = await this.GET(url, para).then(res => {
// _this.searchText = ''
if (res.code == '000000') {
// 课程
if(searchCategory.indexOf('1') >= 0) {
sourceData = (res.data && res.data.contentAppModels) || []
}
if(searchCategory.indexOf('2') >= 0) {
// sourceData = []
sourceData = this.handelFive(res.data.fiveMinutesMedicalContentList || [])
}
if(searchCategory.indexOf('3') >= 0) {
sourceData = (res.data && res.data.pCourseDoctorModels) || []
}
if(searchCategory.indexOf('4') >= 0) {
sourceData = res.data.educationContents
}
}
return sourceData || []
})
return csourceData
},
setEventByModuleCode(itemData){
let modeCode = itemData.appModuleInfo.code || '';
let paramList = itemData.appModuleInfo.paramList ? itemData.appModuleInfo.paramList : ''
if( modeCode === 'M001' || modeCode === 'M002' || modeCode === 'M003') {
paramList = ''
}else if( modeCode === 'M100' || modeCode === 'M300' ) {
// 支持多个参数
let urlPara = this.getUrlParmByCode(paramList);
if(paramList[0]){
if( paramList[0].value.indexOf("?") == -1){
paramList[0].value += urlPara
}
}
} else if (modeCode === 'M400') {
// debugger
let path = paramList[0]['key'];
let v = paramList[0]['value'];
let query = this.setRouterParm(paramList);
paramList = [{
url:v,
query:query
}]
this.$router.push({
path: v,
query: query
})
//alert(this.token);
return 'NO'
}
if(typeof paramList === 'string' && !paramList){
paramList = []
}
return paramList;
},
// 通用GET请求
GET(api, para, callback,str) {
// para.token = para.token || this.token || "343BCABC890349ACAF357FA79122F9FE"
let url = api + this.getUrlPara(para)
url = encodeURI(url);
return fetch({
url: getBaseUrl(url),
method: 'get',
data: para
})
},
reportGET(api, para, callback,str) {
// para.token = para.token || this.token || "343BCABC890349ACAF357FA79122F9FE"
let url = api + this.getUrlPara(para)
url = encodeURI(url);
return fetch({
url: getReportUrl(url),
method: 'get',
data: para
})
},
// saas-GET请求
saasGET(api, para) {
// para.token = para.token || this.token || "343BCABC890349ACAF357FA79122F9FE"
return fetch({
headers: {
sysCode: 9,
},
url: getWorkApi(api),
method: 'get',
params: para
})
},
// 通用DELETE请求
DELETE(api, para, callback,str) {
// para.token = para.token || this.token || "343BCABC890349ACAF357FA79122F9FE"
let url = api + this.getUrlPara(para)
return fetch({
url: getBaseUrl(url),
method: 'delete',
data: para
})
},
// 通用PUT请求
PUT(api, para, callback) {
// para.token = para.token || this.token || "343BCABC890349ACAF357FA79122F9FE"
return fetch({
url: getBaseUrl(api),
method: 'put',
data: para
})
},
// 通用POST请求
POST(api, para, callback) {
// para.token = para.token || this.token || "343BCABC890349ACAF357FA79122F9FE"
return fetch({
url: getBaseUrl(api),
method: 'post',
data: para
})
},
reportPOST(api, para, callback) {
// para.token = para.token || this.token || "343BCABC890349ACAF357FA79122F9FE"
return fetch({
url: getReportUrl(api),
method: 'post',
data: para
})
},
// 通用saas-POST请求
saasPOST(api, para, cType) {
// para.token = para.token || this.token || "343BCABC890349ACAF357FA79122F9FE"
let header = {}
if(cType) {
header['Content-Type'] = cType;
}
return fetch({
headers: {
sysCode: 9,
...header
},
url: getWorkApi(api),
method: 'post',
data: para
})
},
// 通用saas-PUT请求
saasPUT(api, para) {
return fetch({
headers: {
sysCode: 9,
},
url: getWorkApi(api),
method: 'put',
data: para
})
},
// 从html参数
getUrlKey(name) {
if (decodeURIComponent && location.href) {
return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.href) || [, ""])[1].replace(/\+/g, '%20')) || null
} else {
return null
}
},
getUrlSearch(url, name) {
if (typeof name == 'undefined') {
name = url
url = location.href
}
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = url.slice(url.indexOf('?') + 1).match(reg);
if (r != null) {
try {
return decodeURIComponent(r[2]);
} catch (_e) {
return null
}
}
return null
}
}
}
let tableOrganization = [{
name: "上海市第一人民医院",
grade: "一甲医院",
province: "上海市",
city: "上海市",
district: "浦东新区",
street: "张江街道"
}, {
name: "上海市第二人民医院",
grade: "二甲医院",
province: "上海市",
city: "上海市",
district: "浦东新区",
street: "张江街道"
}, {
name: "上海市第三人民医院",
grade: "三甲医院",
province: "上海市",
city: "上海市",
district: "浦东新区",
street: "张江街道"
}];
let tablePerson = [{
name: "云小鹊",
hospital: "上海市第一人民医院",
department: "全科",
province: "上海市",
city: "上海市",
district: "浦东新区"
}, {
name: "云小鹊",
hospital: "上海市第二人民医院",
department: "全科",
province: "上海市",
city: "上海市",
district: "长宁区"
}, {
name: "云小鹊",
hospital: "上海市第三人民医院",
department: "全科",
province: "上海市",
city: "上海市",
district: "南汇区"
}];
let treeData = [
{
id: 11,
name: "一级 1",
label: "一级 1",
isLeaf: "true",
children: [
{
id: 1,
label: "一级 1",
isLeaf: "true",
children: [
{
id: 4,
label: "二级 1-1",
children: [
{
id: 9,
label: "三级 1-1-1"
},
{
id: 10,
label: "三级 1-1-2"
}
]
}
]
},
{
id: 2,
label: "一级 2",
children: [
{
id: 5,
label: "二级 2-1",
children: [],
},
{
id: 6,
label: "二级 2-2",
isLeaf: false,
}
]
},
{
id: 4,
label: "一级 4",
isLeaf: false,
},
{
id: 3,
label: "一级 3",
children: [
{
id: 7,
label: "二级 3-1"
},
{
id: 8,
label: "二级 3-2"
}
]
}
]
}
];
// 按钮type类型: 0-编辑
// 1-暂存 2-完成 3-上架 4-通过 5-下架 6-拒绝
// 7- 提醒审核 8(2)-取消审核 9-删除
let buttonStatusIn = [
//L1 内部管理员 L2项目负责人 L3次级负责人
//草稿
{ L1: "09", L2: "", L3: "" },
//未上架
{ L1: "039", L2: "039", L3: "0" },
//待审核、审批中
{ L1: "46", L2: "78", L3: "" },
//已上架
{ L1: "05", L2: "05", L3: "0" },
//已下架
{ L1: "039", L2: "039", L3: "0" },
//已拒绝/未上架
{ L1: "039", L2: "039", L3: "0" },
];
let buttonStatusOut = [
//L1 内部管理员 L2项目负责人 L3次级负责人
//草稿
{ L1: "", L2: "09", L3: "" },
//未上架
{ L1: "09", L2: "039", L3: "0" },
//待审核、审批中
{ L1: "46", L2: "78", L3: "" },
//已上架
{ L1: "05", L2: "05", L3: "0" },
//已下架
{ L1: "039", L2: "039", L3: "0" },
//已拒绝/未上架
{ L1: "09", L2: "039", L3: "0" },
];
export function returnData() {
let data = {};
data.tableOrganization = tableOrganization;
data.tablePerson = tablePerson;
data.treeData = treeData;
data.buttonStatusIn = buttonStatusIn;
data.buttonStatusOut = buttonStatusOut;
return data;
}
\ No newline at end of file
//求并集
export function getUnion(a, b) {
if (a.constructor === Array && b.constructor === Array) {
let set1 = new Set(a);
let set2 = new Set(b);
return Array.from(new Set([...set1, ...set2]));
}
return null;
}
//求差集
export function getDifference(a, b) {
if (a.constructor === Array && b.constructor === Array) {
let set1 = new Set(a);
let set2 = new Set(b);
return Array.from(new Set([...set1].filter(x => !set2.has(x))));
}
return null;
}
//求交集
export function getIntersect(a, b) {
if (a.constructor === Array && b.constructor === Array) {
let set1 = new Set(a);
let set2 = new Set(b);
return Array.from(new Set([...set1].filter(x => set2.has(x))));
}
return null;
}
//获取id的list
export function getIdList(data) {
let list = [];
if (typeof data === 'undefined') {
return list;
}
if (data.constructor === Array) {
for (let i = 0; i < data.length; i++) {
list.push(data[i].id);
}
}
return list;
}
//区域
export function getDivision(data) {
if (data === null || data == 'NaN') {
let empty = [];
return empty;
}
let list = data.split('|');
let num = [];
for (let i = 0; i < list.length; i++) {
num[i] = parseInt(list[i]);
}
//console.log(list);
return num;
}
export function getLevelList(data) {
let level = [];
level[0] = {
id: '-1',
label: '全部医院等级',
}
for (let i = 0; i < data.length; i++) {
let obj = {
id: data[i].no,
label: data[i].value,
}
level.push(obj);
}
//console.log(level);
return level;
}
function inTags(id, tags) {
let flag = false;
for (let i = 0; i < tags.length; i++) {
if (tags[i].key == id) {
flag = true;
}
}
return flag;
}
export function inOrganization(list, id) {
let flag = false;
if (list.length == 0) {
flag = true;
}
for (let i = 0; i < list.length; i++) {
if (list[i].id != id) {
flag = true;
}
}
return flag;
}
export function initTags(value) {
let tags = [];
for (let j = 0; j < value.length; j++) {
let tagsComponent = {};
tagsComponent.value = value.value;
tagsComponent[j].name = this.optionsComponent[j].label;
}
return tags;
}
//机构列表
export function getOrganizationList(data) {
let list = [];
list[0] = {
value: '0',
label: '全部机构',
};
for (let i = 0; i < data.length; i++) {
let obj = {
value: data[i].key,
label: data[i].name,
}
list.push(obj);
}
return list;
}
//机构列表
export function getHospitalList(data) {
let list = [];
list[0] = {
value: 0,
label: '全部医院',
};
for (let i = 0; i < data.length; i++) {
let obj = {
value: data[i].id,
label: data[i].name,
}
list.push(obj);
}
//console.log(list);
return list;
}
//拼树
export function changeTags(option) {
let list = [];
// for(let i=0;i<option.length;i++) {
// console.log(option[i].label);
// let obj = {
// name: option[i].name,
// key: option[i].key,
// }
// list.push(obj);
// }
console.log(option);
return option;
}
// 递归删除多余的节点
function handlerAction(treeData, selData) {
treeData.forEach((elem, index) => {
if (!isValuable(elem.value, selData)) {
treeData.splice(index, 1)
handlerAction(treeData, selData)
} else {
if (elem.children) {
handlerAction(elem.children, selData)
}
}
})
return treeData;
}
function isValuable(val, selData) {
for (let i = 0; i < selData.length; i++) {
if (selData[i]['value'].indexOf(val) >= 0) {
return true
}
}
return false
}
function changeTreeKey(oData, orgKey, targetKey) {
oData = [...oData]
oData.forEach(elem => {
elem[targetKey] = elem[orgKey]
delete elem[orgKey]
if (elem.children) {
changeTreeKey(elem.children, orgKey, targetKey)
}
})
return oData
}
function deleteTreeKey(oData, delKeys) {
oData = [...oData]
oData.forEach(elem => {
delKeys.forEach(key => {
delete elem[key]
})
if (elem.children) {
deleteTreeKey(elem.children, delKeys)
}
})
return oData
}
function deleteEmptyChild(oData) {
oData = [...oData]
oData.forEach(elem => {
if (elem.children && elem.children.length == 0) {
delete elem.children
} else if (elem.children) {
deleteEmptyChild(elem.children)
}
})
return oData
}
function addEmpty(data) {
let after = [];
after[0] = {
label: "全部地区",
value: "0",
}
for (let i = 0; i < data.length; i++) {
after.push(data[i]);
}
return after;
}
export function treeHandler(treeData, selData) {
//console.log('treeData',treeData,'selData',selData);
treeData = deleteTreeKey(treeData, ['status', 'disabled'])
treeData = changeTreeKey(treeData, 'id', 'value')
selData = changeTreeKey(selData, 'name', 'label')
selData = changeTreeKey(selData, 'key', 'value')
let endData = deleteEmptyChild(handlerAction(treeData, selData));
// console.log(treeData, selData)
//return handlerAction(treeData, selData);
let returnData = addEmpty(endData);
return returnData;
}
//小生态
export function getEcologyList() {
let dataList = [{
id: '123',
name: '上海第一人民医院',
hospitalLevelName: '二甲医院',
provinceName: '上海市',
cityName: '上海市',
countyName: '浦东新区',
townName: '--',
}, {
id: '124',
name: '上海第二人民医院',
hospitalLevelName: '二甲医院',
provinceName: '上海市',
cityName: '上海市',
countyName: '浦东新区',
townName: '--',
}, {
id: '125',
name: '上海第三人民医院',
hospitalLevelName: '二甲医院',
provinceName: '上海市',
cityName: '上海市',
countyName: '浦东新区',
townName: '--',
}]
return dataList;
}
export function getEcologySelect(data) {
// let ecologyist = [{
// label: '上海小生态',
// value: '1',
// },{
// label: '北京小生态',
// value: '2',
// }];
let ecologyist = [];
for (let i = 0; i < data.length; i++) {
let obj = {
label: data[i].name,
value: data[i].id,
}
ecologyist.push(obj);
}
return ecologyist;
}
export function isOverlap(startA, endA, startB, endB) {
let maxStart = Math.max(startA, startB);
let minEnd = Math.min(endA, endB);
console.log('maxStart', maxStart, 'minEnd', minEnd);
if (maxStart <= minEnd) {
return true;
} else {
return false;
}
}
export function setRegionOption(data) {
let option = [];
option[0] = { id: 0, value: 0, label: "全部", leaf: true };
for (let i = 0; i < data.length; i++) {
let obj = data[i];
obj.label = data[i].provinceName;
obj.value = data[i].provinceId;
option.push(obj);
}
return option;
}
export function setRegionOption2(data) {
let option = [];
option[0] = { id: 0, value: '0', label: "全部地区", leaf: true };
for (let i = 0; i < data.length; i++) {
let obj = data[i];
obj.label = data[i].provinceName;
obj.value = data[i].provinceId;
option.push(obj);
}
return option;
}
export function setAdministrativeId(value) {
let areaId = '000';
for (let i = 0; i < value.length; i++) {
areaId += '_' + value[i];
}
return areaId;
}
export function getRegionOption() {
let option = [{
value: 1,
label: '浙江',
children: [{
value: 2,
label: '杭州',
children: [{
value: 120115000000,
label: '西湖区'
}, {
value: 5,
label: '东湖区'
}]
}]
}];
return option;
}
export function getLearnOrganization(data) {
if (data.length == 0) {
let arr = [];
return arr;
}
let organization = [
{
label: "全部",
value: 0
},
];
for (let i = 0; i < data.length; i++) {
let obj = {
label: data[i].hospital_name,
value: data[i].hospital_id,
index: i,
};
organization.push(obj);
}
return organization;
}
export function getPicOption(title, legendData, colorData, seriesData) {
let option = {
title: {
text: title,
x: "center",
top: "3%",
},
tooltip: {
trigger: 'item',
formatter: "{a} <br/>{b} : {c} ({d}%)"
},
legend: {
orient: "vertical",
top: "3%",
left: "left",
data: legendData
},
grid: {
left: "30%",
right: "0%",
bottom: "10%",
containLabel: true
},
color: colorData,
backgroundColor: '#F3F3F3',
series: [
{
name: "",
type: "pie",
radius: "55%",
center: ["60%", "65%"],
data: seriesData,
}
]
};
return option;
}
export function getBarOption(xAxisData, seriesData) {
let option = {
title: {
text: "用户年龄发布",
x: "center",
top: "3%",
},
color: ['#3398DB'],
backgroundColor: '#F3F3F3',
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: [
{
type: 'category',
data: xAxisData,
axisLabel: {
interval: 0
}
// axisTick: {
// alignWithLabel: true
// }
}
],
yAxis: [
{
type: 'value'
}
],
series: [
{
name: '',
type: 'bar',
barWidth: 30,
data: seriesData,
}
]
};
return option;
}
export function getRank(xAxisData, seriesData) {
let option = {
color: ["#1E90FF", "#32CD32"],
title: {
text: "排行榜",
x: "left",
textStyle: {
//主标题文本样式{"fontSize": 18,"fontWeight": "bolder","color": "#333"}
fontSize: 20,
fontStyle: "normal",
fontWeight: "normal",
color: "#000"
}
},
tooltip: {
trigger: "axis",
formatter: '{b0}<br/>{a0}: {c0}%',
axisPointer: {
// 坐标轴指示器,坐标轴触发有效
type: "shadow" // 默认为直线,可选为:'line' | 'shadow'
}
},
legend: {
data: ["完成人数"],
bottom: 0
},
grid: {
left: "3%",
right: "4%",
bottom: "10%",
containLabel: true
},
xAxis: [
{
type: "category",
data: xAxisData,
}
],
yAxis: [
{
type: "value",
axisLabel: {
show: true,
interval: 'auto',
formatter: '{value}%'
},
}
],
series: [
{
name: "完成通过率",
type: "bar",
stack: "完成通过率",
barMaxWidth: "50",
data: seriesData,
},
// {
// name: "参与人数",
// type: "bar",
// stack: "人数",
// barMaxWidth: "80",
// data: [220, 182, 191, 220, 182, 191]
// }
]
};
return option;
}
export function getSearchType(formData, checkAll) {
let type = 0;
if (formData.region.length == 1 || formData.region.length == 2) {
type = formData.region.length;
if (formData.region.length == 1 && formData.region[0] == 0) {
type = 6;
}
} else if (formData.region.length == 3) {
if (formData.organization.length == 0 || checkAll === true) {
type = 3;
} else {
type = 4;
}
} else if (formData.region.length == 4) {
if (formData.organization.length == 0 || checkAll === true) {
type = 5;
} else {
type = 4;
}
}
return type;
}
export function hasAll(data) {
let flag = false;
for (let i = 0; i < data.length; i++) {
if (data[i] == 0) {
flag = true;
return flag
}
}
return flag;
}
export function getIds(formData, organizationList, checkAll) {
let ids = '';
if (formData.organization.length == 0) {
//地区id
ids = formData.region[formData.region.length - 1];
} else {
//机构id 选了'全部'
if (checkAll === true) {
// for (let i = 0; i < organizationList.length; i++) {
// if (organizationList[i].value != 0) {
// ids += organizationList[i].value + ',';
// }
// }
ids = formData.region[formData.region.length - 1];
} else {
for (let i = 0; i < formData.organization.length; i++) {
if (formData.organization[i] != 0) {
ids += formData.organization[i] + ',';
}
}
ids = ids.substring(0, ids.length - 1);
}
}
return ids;
}
//获取id的list
export function getDoctorIdList(data) {
let list = [];
if (typeof data === 'undefined') {
return list;
}
if (data.constructor === Array) {
for (let i = 0; i < data.length; i++) {
list.push(data[i].doctorId);
}
}
return list;
}
export function getAjustmentList(data) {
let idList = "";
for (let i = 0; i < data.length; i++) {
idList += data[i] + ',';
}
idList = idList.substring(0, idList.length - 1);
return idList;
}
export function removeZero(data) {
let list = [];
for (let i = 0; i < data.length; i++) {
if (data[i].value != 0) {
list.push(data[i]);
}
}
return list;
}
export function initRank(data) {
let list = [{ gradeFlag: -1, gradeName: "全部" }];
for (let i = 0; i < data.length; i++) {
list.push(data[i]);
}
return list;
}
export function getAvgTime(data) {
let list = [0, 0];
if (data != null && data != '') {
list[0] = Math.floor(data / 60);
list[1] = data % 60;
}
return list;
}
export function getComponent(data) {
let list = [];
for (let i = 0; i < data.length; i++) {
list.push(data[i].value);
}
return list;
}
export function getSimpleCheckedNodes(store) {
const checkedNodes = [];
const traverse = function (node) {
const childNodes = node.root ? node.root.childNodes : node.childNodes;
childNodes.forEach(child => {
if (child.checked) {
checkedNodes.push(child.data);
}
if (child.indeterminate) {
traverse(child);
}
});
};
traverse(store)
return checkedNodes;
}
export function setSelectedKeys(checkedKeys, halfCheckedKeys) {
let selected = [];
for (let i = 0; i < checkedKeys.length; i++) {
let obj = {
key: checkedKeys[i].id,
type: 1,
};
selected.push(obj);
}
for (let j = 0; j < halfCheckedKeys.length; j++) {
let obj = {
key: halfCheckedKeys[j],
type: 2,
};
selected.push(obj);
}
return selected;
}
\ No newline at end of file
// 检查号码是否符合规范,包括长度,类型
export const isCardNo = (card) =>{
//身份证号码为15位或者18位,15位时全为数字,18位前17位为数字,最后一位是校验位,可能为数字或字符X
// var reg = /(^\d{15}$)|(^\d{17}(\d|X|x)$)/;
let reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
if(reg.test(card) === false){
return false;
}
return true;
}
// 取身份证前两位,校验省份
export const checkProvince = (card,vcity) =>{
var province = card.substr(0,2);
if(vcity[province] == undefined){
return false;
}
return true;
}
// 检查生日是否正确
export const checkBirthday = (card) =>{
var len = card.length;
//身份证15位时,次序为省(3位)市(3位)年(2位)月(2位)日(2位)校验位(3位),皆为数字
if(len == '15'){
var re_fifteen = /^(\d{6})(\d{2})(\d{2})(\d{2})(\d{3})$/;
var arr_data = card.match(re_fifteen);
var year = arr_data[2];
var month = arr_data[3];
var day = arr_data[4];
var birthday = new Date('19'+year+'/'+month+'/'+day);
return verifyBirthday('19'+year,month,day,birthday);
}
//身份证18位时,次序为省(3位)市(3位)年(4位)月(2位)日(2位)校验位(4位),校验位末尾可能为X
if(len == '18'){
var re_eighteen = /^(\d{6})(\d{4})(\d{2})(\d{2})(\d{3})([0-9]|X|x)$/;
var arr_data = card.match(re_eighteen);
var year = arr_data[2];
var month = arr_data[3];
var day = arr_data[4];
var birthday = new Date(year+'/'+month+'/'+day);
return verifyBirthday(year,month,day,birthday);
}
return false;
}
// 校验日期
function verifyBirthday(year,month,day,birthday) {
var now = new Date();
var now_year = now.getFullYear();
//年月日是否合理
if(birthday.getFullYear() == year && (birthday.getMonth() + 1) == month && birthday.getDate() == day)
{
//判断年份的范围(0岁到100岁之间)
var time = now_year - year;
if(time >= 0 && time <= 100)
{
return true;
}
return false;
}
return false;
}
// 校验位的检测
export const checkParity = (card)=>{
//15位转18位
card = changeFivteenToEighteen(card);
var len = card.length;
if(len == '18'){
var arrInt = new Array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2);
var arrCh = new Array('1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2');
var cardTemp = 0, i, valnum;
for(i = 0; i < 17; i ++) {
cardTemp += card.substr(i, 1) * arrInt[i];
}
valnum = arrCh[cardTemp % 11];
if (valnum == card.substr(17, 1).toLocaleUpperCase())
{
return true;
}
return false;
}
return false;
}
// 15位转18位身份证号
function changeFivteenToEighteen(card){
if(card.length == '15')
{
var arrInt = new Array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2);
var arrCh = new Array('1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2');
var cardTemp = 0, i;
card = card.substr(0, 6) + '19' + card.substr(6, card.length - 6);
for(i = 0; i < 17; i ++)
{
cardTemp += card.substr(i, 1) * arrInt[i];
}
card += arrCh[cardTemp % 11];
return card;
}
return card;
}
export const validateIdCard = (num)=> {
num = num.toUpperCase(); //身份证号码为15位或者18位,15位时全为数字,18位前17位为数字,最后一位是校验位,可能为数字或字符X。
if (!(/(^\d{15}$)|(^\d{17}([0-9]|X)$)/.test(num))) {
return false;
}
//验证前2位,城市符合
var aCity={11:"北京",12:"天津",13:"河北",14:"山西",15:"内蒙古",21:"辽宁",22:"吉林",23:"黑龙江 ",31:"上海",32:"江苏",33:"浙江",34:"安徽",35:"福建",36:"江西",37:"山东",41:"河南",42:"湖北",43:"湖南",44:"广东",45:"广西",46:"海南",50:"重庆",51:"四川",52:"贵州",53:"云南",54:"西藏",61:"陕西",62:"甘肃",63:"青海",64:"宁夏",65:"新疆",71:"台湾",81:"香港",82:"澳门",91:"国外"};
if(aCity[parseInt(num.substr(0,2))]==null){
return false;
}
//下面分别分析出生日期和校验位
var len, re; len = num.length;
if (len == 15) {
re = new RegExp(/^(\d{6})(\d{2})(\d{2})(\d{2})(\d{3})$/);
var arrSplit = num.match(re); //检查生日日期是否正确
var dtmBirth = new Date('19' + arrSplit[2] + '/' + arrSplit[3] + '/' + arrSplit[4]);
var bGoodDay; bGoodDay = (dtmBirth.getYear() == Number(arrSplit[2])) && ((dtmBirth.getMonth() + 1) == Number(arrSplit[3])) && (dtmBirth.getDate() == Number(arrSplit[4]));
if (!bGoodDay) { // 身份证号的出生日期不对
return false;
} else { //将15位身份证转成18位 //校验位按照ISO 7064:1983.MOD 11-2的规定生成,X可以认为是数字10。
var arrInt = new Array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2);
var arrCh = new Array('1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2');
var nTemp = 0, i;
num = num.substr(0, 6) + '19' + num.substr(6, num.length - 6);
for(i = 0; i < 17; i ++) {
nTemp += num.substr(i, 1) * arrInt[i];
}
num += arrCh[nTemp % 11];
return true;
}
}
if (len == 18) {
re = new RegExp(/^(\d{6})(\d{4})(\d{2})(\d{2})(\d{3})([0-9]|X)$/);
var arrSplit = num.match(re); //检查生日日期是否正确
var dtmBirth = new Date(arrSplit[2] + "/" + arrSplit[3] + "/" + arrSplit[4]);
var bGoodDay; bGoodDay = (dtmBirth.getFullYear() == Number(arrSplit[2])) && ((dtmBirth.getMonth() + 1) == Number(arrSplit[3])) && (dtmBirth.getDate() == Number(arrSplit[4]));
if (!bGoodDay) { // 身份证号的出生日期不对
return false;
}
else { //检验18位身份证的校验码是否正确。 //校验位按照ISO 7064:1983.MOD 11-2的规定生成,X可以认为是数字10。
var valnum;
var arrInt = new Array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2);
var arrCh = new Array('1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2');
var nTemp = 0, i;
for(i = 0; i < 17; i ++) {
nTemp += num.substr(i, 1) * arrInt[i];
}
valnum = arrCh[nTemp % 11];
if (valnum != num.substr(17, 1)) { // 18位身份证号的校验码不正确
return false;
}
return true;
}
}
return false;
}
// export const checkCardNum = (rule, value, callback) => {
// var vcity={ 11:"北京",12:"天津",13:"河北",14:"山西",15:"内蒙古",
// 21:"辽宁",22:"吉林",23:"黑龙江",31:"上海",32:"江苏",
// 33:"浙江",34:"安徽",35:"福建",36:"江西",37:"山东",41:"河南",
// 42:"湖北",43:"湖南",44:"广东",45:"广西",46:"海南",50:"重庆",
// 51:"四川",52:"贵州",53:"云南",54:"西藏",61:"陕西",62:"甘肃",
// 63:"青海",64:"宁夏",65:"新疆",71:"台湾",81:"香港",82:"澳门",91:"国外"
// };
// //是否为空
// // if(value === ''){
// // callback(new Error('请输入正确的身份证'))
// // }
// if(value) {
// //校验长度,类型
// if(isCardNo(value) === false){
// callback(new Error('请输入正确的身份证'))
// }
// //检查省份
// if(checkProvince(value,vcity) === false){
// callback(new Error('请输入正确的身份证'))
// }
// //校验生日
// if(checkBirthday(value) === false){
// callback(new Error('请输入正确的身份证'))
// }
// //检验位的检测
// if(checkParity(value) === false){
// callback(new Error('请输入正确的身份证'))
// }
// }else {
// callback()
// }
// }
// 校验手机号
export const checkMobile = (rule, value, callback) => {
var reg = /^1[3|4|5|6|7|8|9][0-9]{9}$/; //验证规则
const flag = reg.test(value);
if(flag){
callback()
}else{
callback(new Error(`请输入正确的手机号码`))
}
}
import fetch from '../fetch';
import { getBaseUrl, getSaasDomain, getSaasApiDomain } from '@/utils/index'
import utils from '@/utils/followup/followupUtils';
const headers = {
sysCode: 9,
hospitalAuth:true
}
/*常量API*/
export const getConstants = (params) => {
// return utils.checkAuth(()=>{
return fetch({
headers,
url: getBaseUrl(`basic-data/constants/`),
method: 'get',
params: params,
description: '获取常量',
})
// })
};
/*获取省市县乡列表*/
export const getProvinceList = (params) => {
// return utils.checkAuth(()=>{
return fetch({
headers,
url: getBaseUrl(`basic-data/position/provinces`),
method: 'get',
params: params,
description: '获取省列表',
})
// })
};
export const getCityList = (params) => {
// return utils.checkAuth(()=>{
return fetch({
headers,
url: getBaseUrl(`basic-data/position/cities`),
method: 'get',
params: params,
description: '获取市列表',
})
// })
};
export const getCountyList = (params) => {
// return utils.checkAuth(()=>{
return fetch({
headers,
url: getBaseUrl(`basic-data/position/counties`),
method: 'get',
params: params,
description: '获取区县列表',
})
// })
};
export const getTownList = (params) => {
// return utils.checkAuth(()=>{
return fetch({
headers,
url: getBaseUrl(`basic-data/position/towns`),
method: 'get',
params: params,
description: '获取乡镇列表',
})
// })
};
/*居民管理*/
export const getPatientList = (data) => {
return utils.checkAuth(()=>{
return fetch({
headers,
url: getBaseUrl(`healths/patients/infolist`),
method: 'post',
data: data,
description: '获取居民列表',
})
})
};
export const getDiseasesList = (params) => {
// return utils.checkAuth(()=>{
return fetch({
headers,
url: getBaseUrl(`healths/patients/diseases/-1`),
method: 'get',
params: params,
description: '获取所有疾病',
})
// })
};
// 新增居民
export const getQRCode = data => {
return utils.checkAuth(()=>{
return fetch({
headers,
url: getBaseUrl(`healths/qrcodes/get`),
method: 'post',
data: data,
description: '获取二维码',
})
})
}
export const getUploadHistory = params => {
return utils.checkAuth(()=>{
return fetch({
headers,
url: getBaseUrl(`healths/docImpPat/import/records`),
method: 'get',
params: params,
description: '获取上传历史记录',
})
})
}
export const refreshCode = data => {
return utils.checkAuth(()=>{
return fetch({
headers,
url: getBaseUrl(`healths/qrcodes/refresh`),
method: 'post',
data: data,
description: '刷新二维码有效期',
})
})
}
export const getLabelsInfo = params => {
// return utils.checkAuth(()=>{
return fetch({
headers,
url: getBaseUrl(`healths/qrcodes/getLabelsInfo`),
method: 'get',
params: params,
description: '获取分组信息',
})
// })
}
export const downloadQRCode = data => {
return utils.checkAuth(()=>{
return fetch({
headers,
url: getBaseUrl(`healths/qrcodes/shareUrl`),
method: 'post',
data: data,
description: '下载二维码',
})
})
}
export const uploadExcel = data => {
// return utils.checkAuth(()=>{
return fetch({
headers: {
noSysCode: true,
// hospitalAuth:true
},
url: getSaasDomain('web/patientManages/import'),
method: 'post',
data: data,
description: '上传excel文件',
})
// })
}
// 分组管理
export const getLabelList = (params) => {
// return utils.checkAuth(()=>{
return fetch({
headers,
url: getBaseUrl(`healths/labels/`),
method: 'get',
params: params,
description: '获取分组列表',
})
// })
}
export const createNewLabel = (data) => {
return utils.checkAuth(()=>{
return fetch({
url: getBaseUrl(`healths/labels/`),
headers: {
"Content-Type": 'application/json',
hospitalAuth:true
},
method: 'post',
data: data,
description: '新增分组',
})
})
}
export const changeLabelName = (data) => {
return utils.checkAuth(()=>{
return fetch({
url: getBaseUrl(`healths/labels/`),
headers,
method: 'put',
data: data,
description: '修改分组名',
})
})
}
export const getLabelDetail = (labelId, params) => {
// return utils.checkAuth(()=>{
return fetch({
headers,
url: getBaseUrl(`healths/labels/v2/${labelId}/patients`),
method: 'get',
params: params,
description: '获取分组详情',
})
// })
}
export const deleteCurrentLabel = (data) => {
return utils.checkAuth(()=>{
return fetch({
headers,
url: getBaseUrl(`healths/labels/`),
method: 'delete',
data: data,
description: '删除分组',
})
})
}
export const deleteCurrentPatients = data => {
return utils.checkAuth(()=>{
return fetch({
headers,
url: getBaseUrl(`healths/labels/patients`),
method: 'delete',
data: data,
description: '删除分组下的居民',
})
})
}
export const saveLabelsForPatient = (labelId, data) => {
return utils.checkAuth(()=>{
return fetch({
headers,
url: getBaseUrl(`healths/labels/v2/${labelId}/patients`),
method: 'post',
data: data,
description: '分组中添加居民',
})
})
}
// 获取七牛上传token
export const getQiniuToken = (params) => {
return utils.checkAuth(()=>{
return fetch({
headers,
url: getBaseUrl(`file/image/token`),
method: 'get',
params: params,
})
})
};
// 意见反馈 getSaasApiDomain
export const submitFeedback = (data) => {
// return utils.checkAuth(()=>{
return fetch({
headers: {
noSysCode: true,
"Content-Type": 'application/json'
},
url: getSaasApiDomain(`web/companys/feedback`),
method: 'post',
data: data,
})
// })
};
/*资料不全居民*/
export const getNotCompleteList = (params) => {
// return utils.checkAuth(()=>{
return fetch({
headers,
url: getBaseUrl(`healths/patients/uncomplate/${params.pageNo}/${params.pageSize}`),
method: 'get',
description: '获取资料不全居民列表',
})
// })
};
export const sendCompleteMessage = (data) => {
return utils.checkAuth(()=>{
return fetch({
headers,
url: getBaseUrl(`healths/patients/remind`),
method: 'post',
data: data,
description: '提醒居民完善信息',
})
})
};
export const sendCompleteMessageList = (data) => {
return utils.checkAuth(()=>{
return fetch({
headers,
url: getBaseUrl(`healths/patients/list/remind`),
method: 'post',
data: data,
description: '批量提醒居民完善信息',
})
})
};
export const getNotCompleteCount = (params) => {
// return utils.checkAuth(()=>{
return fetch({
headers,
url: getBaseUrl(`healths/patients/uncomplate/counts`),
method: 'get',
params: params,
description: '获取未完善居民人数',
})
// })
};
export const getRedNum = (params) => {
// 这个方法暂不做权限校验
return fetch({
headers,
url: getBaseUrl(`healths/patients/uncompleted/last/counts`),
method: 'get',
params: params,
description: '获取小红点数据',
})
};
export const getPatientDetail = (patientId) => {
// return utils.checkAuth(()=>{
return fetch({
headers,
url: getBaseUrl(`healths/patients/${patientId}`),
method: 'get',
// params: params,
description: '获取居民详情',
})
// })
};
export const deletePatient = (data) => {
return utils.checkAuth(()=>{
return fetch({
headers,
url: getBaseUrl(`healths/patients/batch`),
method: 'delete',
data: data,
description: '删除居民',
})
})
};
export const getRemindPatient = (data) => {
return utils.checkAuth(()=>{
return fetch({
headers,
url: getBaseUrl(`healths/patients/remind`),
method: 'post',
data: data,
description: '提醒居民绑定微信',
})
})
};
// 保存并新增
export const savePatientInfo = (data) => {
return utils.checkAuth(()=>{
return fetch({
headers,
url: getBaseUrl(`healths/patients/update`),
method: 'post',
data: data,
description: '保存居民信息',
})
})
};
export const getNationsList = (params) => {
// return utils.checkAuth(()=>{
return fetch({
headers,
url: getBaseUrl(`resident/constants/nations`),
method: 'get',
params: params,
description: '获取56个民族列表',
})
// })
};
export const getHealthRecordList = (data) => {
// return utils.checkAuth(()=>{
return fetch({
headers,
url: getBaseUrl(`followup/entering/health/records`),
method: 'post',
data: data,
description: '健康档案记录列表',
})
// })
};
/*新的获取居民接口,搜索条件有变化*/
export const getPatientInfoList = (data) => {
return utils.checkAuth(()=>{
return fetch({
headers,
url: getBaseUrl(`healths/patients/v2/infolist`),
method: 'post',
data: data,
description: '获取居民列表',
})
})
};
// 添加诊断:获取常用诊断列表
export const getCommonDiagnoseList = params => {
return fetch({
headers,
url: getBaseUrl(`medicineDictionary/icdCommonDiagnosis`),
method: 'get',
params: params,
description: '获取常用诊断列表',
})
}
// 添加诊断:搜索
export const goToSearch = params => {
return fetch({
headers,
url: getBaseUrl(`medicineDictionary/icdContents`),
method: 'get',
params: params,
description: '常用诊断搜索',
})
}
// 选择或搜索诊断
export const getIcdList = params => {
return fetch({
headers,
url: getBaseUrl(`healths/icd/list`),
// url: 'http://sosoapi.yunqueyi.com/sosoapi-web/pass/mock/46/healths/icd/list',
method: 'get',
params: params,
description: '选择或搜索诊断',
})
}
//手动添加埋点
export const postTrace = (actionName, viewPath) => {
let para = {
"datas": [
{
"pseudo_session": "",
"pseudo_id": "",
"class_name": "test-compontens",
"action": actionName, //"ACTION_WEB_ENTER"
"view_path": viewPath,//"http://10.177.11.248:8080/"
"created": new Date().getTime(),//"1568685179301"
"user_token": "",
"mobile": "",
"doctor_id": "",
"device_brand": "",
"device_model": "",
"app_version": "",
"device_type": "1",
"device_ip": "",
"web_data": {
},
"alternate_info": "",
"extra_info": "",
"web_data_type": "2"
}
]
}
return fetch({
headers,
url: getBaseUrl(`file/log/trace1`),
method: 'post',
data: para,
description: '手动添加埋点',
})
}
import {isEmptyUtils, isNotEmptyUtils, subString} from "./utils";
import fetchQiniu from './fetch-qiniu.js';
import { getQiniuToken1, uploadVideo, uploadImg } from './index'
let fileApiUrl = getQiniuToken1()
//该对象有一个 unsubscribe 方法取消订阅,同时终止上传行为。
let subscription = null;
//上传返回结果
let result = {
key: null,//文件保存在空间中的资源名
path: null,//保存到db的路径(不带域名)
fullPath: null,//文件网络路径(文件url)
size: null,//资源尺寸,单位为字节
name: null,//原始文件名
ext: null//上传资源的后缀名,通过自动检测的mimeType 或者原文件的后缀来获取
};
//上传状态
// var status = false;
//FIXME 请注意vue里面不要使用全局变量
let domain = uploadVideo() // 视频
let domain1 = uploadImg() // 图片
let errorCode = new Map([
[298,'部分操作执行成功'],
[400,'请求报文格式错误'],
[401,'认证授权失败'],
[403,'权限不足,拒绝访问。'],
[404,'资源不存在'],
[405,'请求方式错误'],
[406,'上传的数据 CRC32 校验错误'],
[413,'请求资源大小大于指定的最大值'],
[419,'用户账号被冻结'],
[478,'镜像回源失败'],
[502,'错误网关'],
[503,'服务端不可用'],
[504,'服务端操作超时'],
[573,'单个资源访问频率过高'],
[579,'上传成功但是回调失败'],
[599,'服务端操作失败'],
[608,'资源内容被修改'],
[612,'指定资源不存在或已被删除'],
[614,'目标资源已存在'],
[630,'已创建的空间数量达到上限,无法创建新空间。'],
[631,'指定空间不存在'],
[640,'调用列举资源(list)接口时,指定非法的marker参数。'],
[701,'在断点续上传过程中,后续上传接收地址不正确或ctx信息已过期。']
]);
let qiniuErrorCheck = function (code) {
errorCode.forEach(function (value, key, map) {
if (code === key){
console.error(key+':'+value)
}
})
}
//用来限制上传文件类型,为 null 时表示不对文件类型限制;限制类型放到数组里: ["image/png", "image/jpeg", "image/gif"]
let mimeTypeArray = null;
export const createFilePath = (file, fileName) => {
if (isEmptyUtils(file)) {
return null;
}
let arr = fileName.split('_');
if(arr.length != 4){
alert('上传视频文件名格式不正确');
return null;
}
let arr4 = arr[3].split('.');
//文件全路径(文件路径 + 文件名) 扩展名​/年/月/日/
let filePath = arr[0] + "/" + arr[1] + "/" + arr[2] + "_" + arr4[0] + '.'+arr4[1];
console.log(filePath);
return filePath;
};
/**
* 获取七牛上传凭证
*
* @return {Promise} token 七牛上传凭证
* */
const doQiniuAction1 = (fileType) => {
console.log('send---'+fileApiUrl);
return new Promise(function (resolve, reject) {
// if(isEmptyUtils(localStorage.getItem('qiniuToken'))){
fetchQiniu(fileApiUrl, {"fileType": fileType}, 'GET').then(function (result) {
let token = null;
if (isNotEmptyUtils(result) && result.code == "000000") {
token = result.data.qiniuToken;
resolve(token);
console.log('七牛临时授权成功');
localStorage.setItem('qiniuToken',token);
} else {
reject(result);
console.error('七牛临时授权失败:', result);
}
}).catch(function (error) {
reject();
console.error('七牛临时授权失败:', error);
});
// }else{
// console.log('从localStorage获取token:'+localStorage.getItem('qiniuToken'))
// resolve(localStorage.getItem('qiniuToken'));
// }
});
};
/**
*
* @param self
* @param file
* @param filePath
* @param previewId
* @param progressId
* @returns {Promise}
*/
export const qiniuUpload = (self, file, filePath, previewId, progressId) => {
// var deferred = $q.defer();
return new Promise(function (resolve, reject) {
if (isEmptyUtils(file) || isEmptyUtils(filePath)) {
console.error('七牛上传失败:非法参数');
reject();
}
let key = filePath ? filePath : getFilePath(file);
//修改状态为上传
self.qiniuUploadStatus = true;
// let token = "BRVB4TpxVFA5Wo6lIpfltmWKOltzGar46tvC3BlR:UHn0LDElwjP4jEZTXdq_1qV6_hw=:eyJzY29wZSI6InBpY2EtdGVzdCIsInJldHVybkJvZHkiOiJ7XCJrZXlcIjpcIiQoa2V5KVwiLFwiaGFzaFwiOlwiJChldGFnKVwiLFwiYnVja2V0XCI6XCIkKGJ1Y2tldClcIixcImZzaXplXCI6JChmc2l6ZSksXCJmbmFtZVwiOiQoZm5hbWUpLFwiZXh0XCI6JChleHQpfSIsImRlYWRsaW5lIjoxNTI5NDk0MTc1fQ==";
doQiniuAction().then(function (token) {
let putExtra = {
fname: file.name, //原文件名
params: {}, //用来放置自定义变量
mimeType: mimeTypeArray || null //null || array,用来限制上传文件类型,为 null 时表示不对文件类型限制;限制类型放到数组里: ["image/png", "image/jpeg", "image/gif"]
};
let config = {
useCdnDomain: true, //表示是否使用 cdn 加速域名,为布尔值,true 表示使用,默认为 false。
region: null //选择上传域名区域;当为 null 或 undefined 时,自动分析上传域名区域
};
/*
* qiniu.upload 返回一个 observable 对象用来控制上传行为,observable 对像通过 subscribe 方法可以被 observer 所订阅,
* 订阅同时会开始触发上传,同时返回一个 subscription 对象,该对象有一个 unsubscribe 方法取消订阅,同时终止上传行为。
* */
let observable = qiniu.upload(file, key, token, putExtra, config);
/**
* 接收上传进度信息,res 参数是一个带有 total 字段的 object,包含loaded、total、percent三个属性,提供上传进
* total.loaded: number,已上传大小,单位为字节。
* total.total: number,本次上传的总量控制信息,单位为字节,注意这里的 total 跟文件大小并不一致。
* total.percent: number,当前上传进度,范围:0~100
* */
let next = function (res) {
//res值{"total":{"loaded":18184,"size":18185,"percent":99.99450096233159}}
//获取百分比进度
let progress = res.total.percent.toFixed(2);
self.uploadProgress = Number(progress);
console.log('Progress: ' + progress);
//如果有进度条
/*if (isNotEmptyUtils(progressId)) {
let obj = $("#" + progressId);
//开始上传时,显示进度条
if (isNotEmptyUtils(obj.parent())) {
//修改状态为上传
// status = true;
self.qiniuUploadStatus = true;
obj.parent().removeClass("hidden");
obj.fadeIn("fast");
}
obj.css("width", progress + '%');
obj.text(progress + '%');
//上传完成,2秒后淡出进度条
if (progress === "100.00") {
//修改状态为非上传
// status = false;
self.qiniuUploadStatus = true;
obj.fadeOut(2000);
}
}*/
};
/**
* 接收上传完成后的后端返回信息,res 参数为一个 object, 为上传成功后后端返回的信息
* ,具体返回结构取决于后端sdk的配置,可参考上传策略(https://developer.qiniu.com/kodo/manual/1206/put-policy)
* */
let complete = function (res) {
console.log("七牛上传完成");
setTimeout(function(){
result.key = res.key;
result.path = '/' + res.key;
result.fullPath = domain + '/' + res.key + '?v=' + new Date().getTime();
result.size = res.fsize;
result.name = res.fname ;
result.ext = res.ext;
// deferred.resolve(result);
resolve(result);
// self.model.qCloudUrl = result.fullPath;
// $("#introVideoLecture").attr("src", self.model.qCloudUrl);
//修改状态为非上传
// status = false;
self.qiniuUploadStatus = false;
if (isNotEmptyUtils(previewId)) {
let address = domain + result.path;
console.log('文件路径: ' + address);
//显示图片
let $img = $('<img>').attr("src", address);
let obj = $("#" + previewId);
obj.empty().append($img);
obj.css('max-width', '100%');
}
},2000);
};
/**
* 上传错误后触发,当不是 xhr 请求错误时,会把当前错误产生原因直接抛出,诸如 JSON 解析异常等;当产生 xhr 请求错误时,参数 err 为一个包含 code、message、isRequestError 三个属性的 object:
* err.isRequestError: 用于区分是否 xhr 请求错误;当 xhr 请求出现错误并且后端通过 HTTP 状态码返回了错误信息时,该参数为 true;否则为 undefined 。
* err.reqId: string,xhr请求错误的 X-Reqid。
* err.code: number,请求错误状态码,只有在 err.isRequestError 为 true 的时候才有效,可查阅码值对应说明。
* err.message: string,错误信息,包含错误码,当后端返回提示信息时也会有相应的错误信息。
* */
let error = function (err) {
//修改状态为非上传
// status = false;
self.qiniuUploadStatus = false
localStorage.removeItem('qiniuToken');
console.log("七牛上传失败,详细信息请参考:https://developer.qiniu.com/kodo/api/3928/error-responses");
//输出简略错误信息
if (err.isRequestError){
qiniuErrorCheck(err.code)
}else {
console.error(err);
}
/*modalClick("提示", "上传失败!", "确定", function () {
$('#model-modify').modal('hide');
}, "", null);*/
// deferred.reject(new Error('七牛上传失败'));
// return deferred.promise;
return reject(new Error('七牛上传失败'));
};
// 上传开始
subscription = observable.subscribe(next, error, complete);
});
// return deferred.promise;
});
};
/**
* 获取时间戳
* @param {Date} [date]日期对象,为空时,返回当前时间戳
* @return {String} timeStamp时间戳 格式:yyyyMMddhhmmssS
*/
const timeStamp = (date) => {
if (isEmptyUtils(date)) {
return new Date().format('yyyyMMddhhmmssS');
}
return date.format('yyyyMMddhhmmssS');
}
/**
* 获取全局唯一标识符(GUID,Globally Unique Identifier)
* @return {String} guid
*/
const guid = () => {
/**
* @return {String}
*/
function S4() {
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
}
return (S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4());
};
/**
* 文件重命名--七牛图片 2018 11
* @param {File} [file] 上传文件对象
* @param {String} [fileName] 指定文件名
* @param {String} [folder] 指定文件夹
* @return {String} fileName
*/
export const getFilePath = (file,fileName,folder) => {
if (isEmptyUtils(file)) {
return null;
}
//文件类型
var ext = file.type;
//后缀名
var suffix = file.name.substring(file.name.lastIndexOf(".") + 1);
//若为空则从name中获取---对wps格式的文件获取不到file.type
if (isEmptyUtils(ext)) {
ext = suffix;
}
//获取当前日期对象
var date = new Date();
if (isEmptyUtils(fileName)) {
//重命名后的文件名
fileName = timeStamp(date) + "-" + subString(guid(), 8) + "." + suffix;
}
//文件全路径(文件路径 + 文件名) 扩展名​/年/月/日/
// var filePath = ext + "/" + date.format('yyyy/MM/dd') + "/" + (isEmptyUtils(folder) ? "" : (folder + "/")) + fileName;
//var filePath = ext + "/" + "common/" + file.name.split('.')[0] + '-' + timeStamp(date) + "." + suffix;
var filePath = ext + "/" + "protal/project/" + timeStamp(date) + "." + suffix;
console.log('filePath==============',filePath);
return filePath;
}
/**
*七牛上传图片、视频、文件 2018 11 hws
* @param self
* @param file
* @param filePath
* @param previewId
* @param progressId
* @param fileType 1--图片和文件 空为视频
* @returns {Promise}
*/
export const doUpload = (self,file, filePath, previewId,progressId, fileType) => {
// var deferred = $q.defer();
return new Promise(function (resolve, reject) {
if (isEmptyUtils(file) || isEmptyUtils(filePath)) {
console.error('七牛上传失败:非法参数');
reject();
}
let key = filePath ? filePath : getFilePath(file);
//修改状态为上传
self.qiniuUploadStatus = true;
// let token = "BRVB4TpxVFA5Wo6lIpfltmWKOltzGar46tvC3BlR:UHn0LDElwjP4jEZTXdq_1qV6_hw=:eyJzY29wZSI6InBpY2EtdGVzdCIsInJldHVybkJvZHkiOiJ7XCJrZXlcIjpcIiQoa2V5KVwiLFwiaGFzaFwiOlwiJChldGFnKVwiLFwiYnVja2V0XCI6XCIkKGJ1Y2tldClcIixcImZzaXplXCI6JChmc2l6ZSksXCJmbmFtZVwiOiQoZm5hbWUpLFwiZXh0XCI6JChleHQpfSIsImRlYWRsaW5lIjoxNTI5NDk0MTc1fQ==";
doQiniuAction1(fileType).then(function (token) {
let putExtra = {
fname: file.name, //原文件名
params: {}, //用来放置自定义变量
mimeType: mimeTypeArray || null //null || array,用来限制上传文件类型,为 null 时表示不对文件类型限制;限制类型放到数组里: ["image/png", "image/jpeg", "image/gif"]
};
let config = {
useCdnDomain: true, //表示是否使用 cdn 加速域名,为布尔值,true 表示使用,默认为 false。
region: null //选择上传域名区域;当为 null 或 undefined 时,自动分析上传域名区域
};
/*
* qiniu.upload 返回一个 observable 对象用来控制上传行为,observable 对像通过 subscribe 方法可以被 observer 所订阅,
* 订阅同时会开始触发上传,同时返回一个 subscription 对象,该对象有一个 unsubscribe 方法取消订阅,同时终止上传行为。
* */
let observable = qiniu.upload(file, key, token, putExtra, config);
/**
* 接收上传进度信息,res 参数是一个带有 total 字段的 object,包含loaded、total、percent三个属性,提供上传进
* total.loaded: number,已上传大小,单位为字节。
* total.total: number,本次上传的总量控制信息,单位为字节,注意这里的 total 跟文件大小并不一致。
* total.percent: number,当前上传进度,范围:0~100
* */
let next = function (res) {
//res值{"total":{"loaded":18184,"size":18185,"percent":99.99450096233159}}
//获取百分比进度
let progress = res.total.percent.toFixed(2);
self.uploadProgress = Number(progress);
if(progressId == 'uploadProgress1') {
self.uploadProgress1 = Number(progress);
}
if(progressId == 'uploadProgress2') {
self.uploadProgress2 = Number(progress);
}
console.log('Progress: ' + progress);
//如果有进度条
/*if (isNotEmptyUtils(progressId)) {
let obj = $("#" + progressId);
//开始上传时,显示进度条
if (isNotEmptyUtils(obj.parent())) {
//修改状态为上传
// status = true;
self.qiniuUploadStatus = true;
obj.parent().removeClass("hidden");
obj.fadeIn("fast");
}
obj.css("width", progress + '%');
obj.text(progress + '%');
//上传完成,2秒后淡出进度条
if (progress === "100.00") {
//修改状态为非上传
// status = false;
self.qiniuUploadStatus = true;
obj.fadeOut(2000);
}
}*/
};
/**
* 接收上传完成后的后端返回信息,res 参数为一个 object, 为上传成功后后端返回的信息
* ,具体返回结构取决于后端sdk的配置,可参考上传策略(https://developer.qiniu.com/kodo/manual/1206/put-policy)
* */
let complete = function (res) {
console.log("七牛上传完成");
setTimeout(function(){
result.key = res.key;
result.path = '/' + res.key;
// result.fullPath = domain + '/' + res.key + '_' + new Date().getTime();
if(!fileType) { // 图片 文件
console.log('---domain-------',domain)
result.fullPath = domain + '/' + res.key;
}else{ // 视频
console.log('----domain1------',domain1)
result.fullPath = domain1 + '/' + res.key;
}
result.size = res.fsize;
result.name = res.fname ;
result.ext = res.ext;
// deferred.resolve(result);
resolve(result);
// self.model.qCloudUrl = result.fullPath;
// $("#introVideoLecture").attr("src", self.model.qCloudUrl);
//修改状态为非上传
// status = false;
self.qiniuUploadStatus = false;
// if (isNotEmptyUtils(previewId)) {
// let address = domain + result.path;
// console.log('文件路径: ' + address);
// //显示图片
// let uplodImg = $('<img>').attr("src", address);
// let obj = $("#" + previewId);
// obj.empty().append(uplodImg);
// obj.css('max-width', '100%');
// }
},500);
};
/**
* 上传错误后触发,当不是 xhr 请求错误时,会把当前错误产生原因直接抛出,诸如 JSON 解析异常等;当产生 xhr 请求错误时,参数 err 为一个包含 code、message、isRequestError 三个属性的 object:
* err.isRequestError: 用于区分是否 xhr 请求错误;当 xhr 请求出现错误并且后端通过 HTTP 状态码返回了错误信息时,该参数为 true;否则为 undefined 。
* err.reqId: string,xhr请求错误的 X-Reqid。
* err.code: number,请求错误状态码,只有在 err.isRequestError 为 true 的时候才有效,可查阅码值对应说明。
* err.message: string,错误信息,包含错误码,当后端返回提示信息时也会有相应的错误信息。
* */
let error = function (err) {
//修改状态为非上传
// status = false;
self.qiniuUploadStatus = false
localStorage.removeItem('qiniuToken');
console.log("七牛上传失败,详细信息请参考:https://developer.qiniu.com/kodo/api/3928/error-responses");
//输出简略错误信息
if (err.isRequestError){
qiniuErrorCheck(err.code)
}else {
console.error(err);
}
/*modalClick("提示", "上传失败!", "确定", function () {
$('#model-modify').modal('hide');
}, "", null);*/
// deferred.reject(new Error('七牛上传失败'));
// return deferred.promise;
return reject(new Error('七牛上传失败'));
};
// 上传开始
subscription = observable.subscribe(next, error, complete);
});
// return deferred.promise;
});
};
(function(doc, win) {
var docEl = doc.documentElement || doc.body,
htmlDom = doc.getElementsByTagName('html')[0],
resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
recalc = function() {
var clientWidth = docEl.clientWidth
if (!clientWidth) return
// docEl.style.fontSize = 20 * (clientWidth / 320) + 'px';
htmlDom.style.fontSize = clientWidth / 10 + 'px'
};
if (!doc.addEventListener) return
win.addEventListener(resizeEvt, recalc, false)
doc.addEventListener('DOMContentLoaded', recalc, false)
})(document, window)
\ No newline at end of file
import axios from 'axios';
// 对象的合并
export const containObject = function(...obj1) {
let obj = Object.assign(...obj1)
return obj
}
// 获取页面自适应高度
export function resizeHeight(cMinusHeight = 152, iMinuxHeight = 210, refHeightId = 'slidebar-container',
containerHeightId = 'screenSet'){
let containerHeight = p_getElm(refHeightId).getBoundingClientRect().height - 15
p_getElm(containerHeightId).style.height = containerHeight - cMinusHeight + 'px'
window.onresize = function() {
containerHeight = p_getElm(refHeightId).getBoundingClientRect().height - 15
p_getElm(containerHeightId).style.height = containerHeight - cMinusHeight + 'px'
}
}
function p_getElm(elmId){
return document.getElementById(elmId)
}
//共通函数
Array.prototype.contains = function (obj) {
if (this.length > 0) {
for (let i = 0; i < this.length; i++) {
if (obj === this[i]) {
return true;
}
}
}
return false;
};
Array.prototype.remove = function (obj) {
if (this.contains(obj)) {
for (let i = 0; i < this.length; i++) {
if (obj === this[i]) {
this.splice(i, 1);
break;
}
}
}
return this;
};
// 时间处理
Date.prototype.format = function (fmt) { // author: meizz
let o = {
"M+": this.getMonth() + 1, // 月份
"d+": this.getDate(), // 日
"h+": this.getHours(), // 小时
"m+": this.getMinutes(), // 分
"s+": this.getSeconds(), // 秒
"q+": Math.floor((this.getMonth() + 3) / 3), // 季度
"S": this.getMilliseconds()
// 毫秒
};
if (/(y+)/.test(fmt))
fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "")
.substr(4 - RegExp.$1.length));
for (let k in o)
if (new RegExp("(" + k + ")").test(fmt))
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
return fmt;
};
/**
* base64编码
* @param {Object} str
*/
export const base64encode = (str) => {
let base64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
let out, i, len;
let c1, c2, c3;
len = str.length;
i = 0;
out = "";
while (i < len) {
c1 = str.charCodeAt(i++) & 0xff;
if (i == len) {
out += base64EncodeChars.charAt(c1 >> 2);
out += base64EncodeChars.charAt((c1 & 0x3) << 4);
out += "==";
break;
}
c2 = str.charCodeAt(i++);
if (i == len) {
out += base64EncodeChars.charAt(c1 >> 2);
out += base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
out += base64EncodeChars.charAt((c2 & 0xF) << 2);
out += "=";
break;
}
c3 = str.charCodeAt(i++);
out += base64EncodeChars.charAt(c1 >> 2);
out += base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
out += base64EncodeChars.charAt(((c2 & 0xF) << 2) | ((c3 & 0xC0) >> 6));
out += base64EncodeChars.charAt(c3 & 0x3F);
}
return out;
};
/**
* base64解码
* @param {Object} str
*/
export const base64decode = (str) => {
let base64DecodeChars = new Array(-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1);
let c1, c2, c3, c4;
let i, len, out;
len = str.length;
i = 0;
out = "";
while (i < len) {
/* c1 */
do {
c1 = base64DecodeChars[str.charCodeAt(i++) & 0xff];
}
while (i < len && c1 == -1);
if (c1 == -1)
break;
/* c2 */
do {
c2 = base64DecodeChars[str.charCodeAt(i++) & 0xff];
}
while (i < len && c2 == -1);
if (c2 == -1)
break;
out += String.fromCharCode((c1 << 2) | ((c2 & 0x30) >> 4));
/* c3 */
do {
c3 = str.charCodeAt(i++) & 0xff;
if (c3 == 61)
return out;
c3 = base64DecodeChars[c3];
}
while (i < len && c3 == -1);
if (c3 == -1)
break;
out += String.fromCharCode(((c2 & 0XF) << 4) | ((c3 & 0x3C) >> 2));
/* c4 */
do {
c4 = str.charCodeAt(i++) & 0xff;
if (c4 == 61)
return out;
c4 = base64DecodeChars[c4];
}
while (i < len && c4 == -1);
if (c4 == -1)
break;
out += String.fromCharCode(((c3 & 0x03) << 6) | c4);
}
return out;
};
/**
* 时间秒数格式化
* @param s 时间戳(单位:秒)
* @returns {*} 格式化后的时分秒
*/
export const secToTime = (s) => {
let t = "";
if (s > -1) {
// let hour = Math.floor(s/3600);
let min = Math.floor(s / 60) % 60;
let sec = s % 60;
// if(hour < 10) {
// t = '0'+ hour + ":";
// } else {
// t = hour + ":";
// }
if (min < 10) {
t += "0";
}
t += min + ":";
if (sec < 10) {
t += "0";
}
t += sec.toFixed(0);
}
return t;
};
/**
* 校验对象是否为空
* */
export const isNotEmptyUtils = (obj) => {
if ("" == obj || null == obj || undefined == obj || "null" == obj) {
return false;
}
return true;
};
/**
* 校验对象是否为空
* */
export const isEmptyUtils = (obj) => {
return !isNotEmptyUtils(obj);
};
/**
* 校验数组是否为空
* */
export const isEmptyList = (list) => {
return (isEmptyUtils(list) || !(list instanceof Array) || list.length === 0);
};
/**
* 校验数组是否为空
* */
export const isNotEmptyList = (list) => {
return !isEmptyList(list);
};
/**
* 校验对象是否只包含数字0~9
* * @param {String} [obj] 校验对象
* */
export const isNumber = (obj) => {
return (obj != null && obj.toString().match('^[0-9]*$') != null);
};
// 获取用户系统信息start
const detectOS = () => {
let sUserAgent = navigator.userAgent;
let isWin = (navigator.platform == "Win32")
|| (navigator.platform == "Windows");
let isMac = (navigator.platform == "Mac68K")
|| (navigator.platform == "MacPPC")
|| (navigator.platform == "Macintosh")
|| (navigator.platform == "MacIntel");
if (isMac)
return "Mac";
let isUnix = (navigator.platform == "X11") && !isWin && !isMac;
if (isUnix)
return "Unix";
let isLinux = (String(navigator.platform).indexOf("Linux") > -1);
if (isLinux)
return "Linux";
let isIos = (sUserAgent.indexOf("Mac OS X") > -1);
if (isIos)
return "Mac";
if (isWin) {
let isWinXP = sUserAgent.indexOf("Windows NT 5.1") > -1
|| sUserAgent.indexOf("Windows XP") > -1;
if (isWinXP)
return "WinXP";
let isWinVista = sUserAgent.indexOf("Windows NT 6.0") > -1
|| sUserAgent.indexOf("Windows Vista") > -1;
if (isWinVista)
return "WinVista";
let isWin7 = sUserAgent.indexOf("Windows NT 6.1") > -1
|| sUserAgent.indexOf("Windows 7") > -1;
if (isWin7)
return "Win7";
let isWin8_1 = sUserAgent.indexOf("Windows NT 6.2") > -1
|| sUserAgent.indexOf("Windows 8") > -1;
let isWin8_2 = sUserAgent.indexOf("Windows NT 6.3") > -1
|| sUserAgent.indexOf("Windows 8.1") > -1;
if (isWin8_1 || isWin8_2)
return "Win8";
let isWin10_1 = sUserAgent.indexOf("Windows NT 6.4") > -1
|| sUserAgent.indexOf("Windows 10") > -1;
let isWin10_2 = sUserAgent.indexOf("Windows NT 10.0") > -1
|| sUserAgent.indexOf("Windows 10") > -1;
if (isWin10_1 || isWin10_2)
return "Win10";
}
return "other";
};
// 获取用户浏览器信息
const getBrowser = () => {
let OsObject = "未知";
if (navigator.userAgent.indexOf("MSIE") > 0 && navigator.userAgent.indexOf("compatible") > -1) { //<ie11
return "IE";
}
if (navigator.userAgent.indexOf("Trident") > 0 && navigator.userAgent.indexOf("rv:11.0") > -1) { //ie11
return "IE";
}
if (navigator.userAgent.indexOf("Firefox") > 0) {
return "Firefox";
}
if (navigator.userAgent.indexOf("Chrome") > 0) {
return "Chrome";
}
if (navigator.userAgent.indexOf("Safari") > 0) {
return "Safari";
}
if (navigator.userAgent.indexOf("Gecko") > 0) {
return "Firefox";
}
if (navigator.userAgent.indexOf("360") > 0) {
return "360";
}
return OsObject;
};
const GetLocalIPAddress = () => {
// let url ='http://counter.sina.com.cn/ip/';
// let url ='http://chaxun.1616.net/s.php?type=ip&output=json&callback=?&_='+Math.random();
// let ip = "";
// $.getJSON(url, function(data){
// localStorage.setItem("ipAddress",data.Ip);
// // check();
// });
// $.getScript('http://pv.sohu.com/cityjson?ie=utf-8', function () {
return returnCitySN["cip"];
// });
// return ip;
};
// 获取用户终端信息
const getTerminalType = () => {
let brow = "unknown";
// alert(navigator.userAgent);
if (navigator.userAgent.indexOf('iPad') > -1) {
// alert("iPad");
return brow = "iPad";
}
if (navigator.userAgent.indexOf('Android') > -1
|| navigator.userAgent.indexOf('Linux') > -1) {
// alert("Android");
return brow = "android";
}
if (navigator.userAgent.indexOf('iPhone') > -1
// || navigator.userAgent.indexOf('Mac') > -1
) {
// alert("iPhone");
return brow = "iPhone";
}
if (navigator.userAgent.indexOf('Trident') > -1) {
// alert("Trident");
return brow = "PC";
}
if (navigator.userAgent.indexOf('Presto') > -1) {
// alert("Presto");
return brow = "PC";
}
if (navigator.userAgent.indexOf('Chrome') > -1) {
// alert("Chrome");
return brow = "PC";
}
if (navigator.userAgent.indexOf('AppleWebKit') > -1) {
// alert("AppleWebKit");
return brow = "iPad";
}
if (navigator.userAgent.indexOf('Gecko') > -1
&& navigator.userAgent.indexOf('KHTML') == -1) {
// alert("Gecko");
return brow = "PC";
}
if (navigator.userAgent.indexOf("Mac OS X") > -1) {
// alert("ios");
return brow = "ios";
}
if (navigator.userAgent.indexOf('Safari') == -1) {
// alert("Safari");
return brow = "PC";
}
return brow;
};
const initEnvironment = () => {
let OS = detectOS();
let browser = getBrowser();
let ip = GetLocalIPAddress();
let terminalType = getTerminalType();
localStorage.setItem("OS", OS);
localStorage.setItem("browser", browser);
localStorage.setItem("ipAddress", ip);
localStorage.setItem("terminalType", terminalType);
};
/**
* str数据字符串,split分隔符
* @param {String} [str] 当前vue对象
* @param {String} [split] 当前vue对象
* @return{Array} [array]
* */
export const stringToArr = (str, split) => {
if (isEmptyUtils(str) || isEmptyUtils(split) || str.indexOf(split) === -1) {
return [str];
} else {
return str.split(split);
}
};
//单点登录--start
/**
* str数据字符串,split分隔符
* @param {String} [str] url参数部分
* @param {String} [split] 分隔符
* @return{Array} [parArr] 返回键值对list
* */
const getUrlParams = (str, split) => {
let parArr = [];
if (isEmptyUtils(str) || isEmptyUtils(split) || str.indexOf(split) === -1) {
return parArr;
} else {
let parMapArray = str.split(split);
if (parMapArray.length > 0) {
for (let i = 0; i < parMapArray.length; i++) {
if (parMapArray[i].indexOf("=") > -1) {
let item = parMapArray[i].split("=");
let par = {};
par[item[0]] = item[1];
parArr.push(par);
}
}
}
return parArr;
}
};
/**
* str数据字符串,split分隔符
* @param {String} [str] url参数部分
* @param {String} [split] 分隔符
* @return{Map} [parMap] 返回键值对Map
* */
export const getUrlParamsMap = (str, split) => {
let parMap = new Map();
if (isEmptyUtils(str) || isEmptyUtils(split) || str.indexOf(split) === -1) {
return parMap;
} else {
let parMapArray = str.split(split);
if (parMapArray.length > 0) {
for (let i = 0; i < parMapArray.length; i++) {
if (parMapArray[i].indexOf("=") > -1) {
let item = parMapArray[i].split("=");
parMap[item[0]] = item[1];
}
}
}
return parMap;
}
};
export const ssoLogin = (href, paramMap) => {
console.log("ssoLogin开始");
if (isNotEmptyUtils(paramMap)) {
if (isNotEmptyUtils(paramMap)) {
for (var param in paramMap) {
localStorage.setItem(param, paramMap[param]);
}
}
//获取用户系统信息
initEnvironment();
}
};
export const ssoLogin2 = () => { //单独部署不走saas端登录
console.log("ssoLogin2开始");
//获取用户系统信息
initEnvironment();
};
export const getDeviceInfo = () => { //系统信息,获取验证码时有用到
return {
device_brand: localStorage.getItem('terminalType'),
device_type: 1,
system_level: localStorage.getItem('OS'),
device_ip: localStorage.getItem('ipAddress'),
browser_ver: localStorage.getItem('browser')
}
};
//单点登录--end
//退出登录,跳转到登录页面
export const logout = () => {
let url = localStorage.getItem("Url");
let logoutUrl = localStorage.getItem("logoutUrl");
let ssoLoginUrl = localStorage.getItem("ssoLogin");
let ssoOriginUrl = localStorage.getItem("ssoOrigin");
console.log('logoutUrl:'+logoutUrl)
/* alert("ssoLogin Url:"+ ssoLoginUrl)
alert("logOut url:" + logoutUrl)
alert("ssoOrigin url:" + ssoOriginUrl);*/
localStorage.clear();
localStorage.setItem("Url", url);
localStorage.setItem("logoutUrl", logoutUrl);
localStorage.setItem("ssoLogin", ssoLoginUrl);
localStorage.setItem("ssoOrigin", ssoOriginUrl);
if (isEmptyUtils(logoutUrl)) {
if(isEmptyUtils(ssoLoginUrl)){
window.location.href = localStorage.getItem("ssoOrigin")
+ "/PICA_SSO_FE/html/pica_login.html";
}else{
window.location.href = localStorage.getItem("ssoLogin");
}
} else {
// window.location.href = logoutUrl;
window.location.href = localStorage.getItem("ssoOrigin")
+ "/PICA_SSO_FE/html/pica_login.html";
}
};
/**
* 消息提示 确定或取消
* @param {Object} [self] 当前vue对象
* @param {String} [title] 标题
* @param {String} [content] 内容
* @param {String} [confirmButton] 确认按钮文字
* @param {Function} [confirmFunction] 按下确按钮认时,执行的函数
* @param {String} [cancelButton] 取消按钮文字
* @param {Function} [cancelFunction] 按取消按钮认时,执行的函数
* @param {String} [messageType] 消息类型 success,info,warning,error
* */
export const messageBox = (self, title, content, confirmButton, confirmFunction, cancelButton, cancelFunction, messageType) => {
let titleText = title ? title : '提示';
let contentText = content ? content : '';
let confirmButtonText = confirmButton ? confirmButton : '确定';
let type = messageType ? messageType : 'info';
let typeArray = ["error", "warning", "info", "success"];
if (!typeArray.contains(type)) {
type = "info";
}
if (isNotEmptyUtils(cancelButton)) {
self.$confirm(contentText, titleText, {
confirmButtonText: confirmButtonText,
cancelButtonText: cancelButton,
type: type
}).then(() => {
// self.$message({
// type: 'success',
// message: '删除成功!'
// });
if (confirmFunction instanceof Function) {
confirmFunction();
}
}).catch(() => {
// self.$message({
// type: 'info',
// message: '已取消删除'
// });
if (cancelFunction instanceof Function) {
cancelFunction();
}
});
} else {
self.$alert(contentText, titleText, {
confirmButtonText: confirmButtonText,
type: type,
callback: action => {
// self.$message({
// type: 'info',
// message: `action: ${ action }`
// });
if (confirmFunction instanceof Function) {
confirmFunction();
}
}
});
}
};
/**
* 消息提示(支持html内容) 确定或取消
* @param {Object} [self] 当前vue对象
* @param {String} [title] 标题
* @param {String} [content] 内容
* @param {String} [confirmButton] 确认按钮文字
* @param {Function} [confirmFunction] 按下确按钮认时,执行的函数
* @param {String} [cancelButton] 取消按钮文字
* @param {Function} [cancelFunction] 按取消按钮认时,执行的函数
* @param {String} [messageType] 消息类型 success,info,warning,error
* */
export const htmlMessageBox = (self, title, content, confirmButton, confirmFunction, cancelButton, cancelFunction, messageType) => {
let titleText = title ? title : '提示';
let contentText = content ? content : '';
let confirmButtonText = confirmButton ? confirmButton : '确定';
let type = messageType ? messageType : 'info';
let typeArray = ["error", "warning", "info", "success"];
if (!typeArray.contains(type)) {
type = "info";
}
// debugger
if (isNotEmptyUtils(cancelButton)) {
self.$confirm(contentText, titleText, {
confirmButtonText: confirmButtonText,
cancelButtonText: cancelButton,
dangerouslyUseHTMLString: true,//是否将 message 属性作为 HTML 片段处理
type: type
}).then(() => {
if (confirmFunction instanceof Function) {
confirmFunction();
}
}).catch(() => {
if (cancelFunction instanceof Function) {
cancelFunction();
}
});
} else {
self.$alert(contentText, titleText, {
confirmButtonText: confirmButtonText,
dangerouslyUseHTMLString: true,//是否将 message 属性作为 HTML 片段处理
type: type,
callback: action => {
// self.$message({
// type: 'info',
// message: `action: ${ action }`
// });
if (confirmFunction instanceof Function) {
confirmFunction();
}
}
});
}
};
/**
*请求失败时判断
*
* @param {Object} [error] 后台返回的信息
* @param {Object} [self] 当前vue对象
* */
export const errorResponseCheck = (error, self) => {
closeLoading(self);
console.log(error);
setTimeout(function () {
let code = error ? (error.response ? error.response.data : 0) : 0;
// console.log("请求失败:%s", code);
if (code == '40011') {
messageBox(self, "登录", "登录失效,请重新登录!", "是", function () {
logout();
}, "", null);
setTimeout(function () {
logout();
}, 2000);
} else if (code == '40013') {
messageBox(self, "提示", "刷新太过频繁,休息一下!", "是", function () {
}, "", null);
// setTimeout(function () {
//
// }, 2000);
} else {
//sendErrorReport(code);
// messageBox(self, "提示", "操作失败!", "确定", function () {
//
// }, "", null, "error");
self.$message.error("操作失败");
}
}, 100)
};
//截位
export const subString = (obj, int) => {
if (isEmptyUtils(obj) || isEmptyUtils(int)) {
return "";
}
if (obj.length <= int) {
return obj;
} else {
obj = obj.substring(0, int);
}
return obj;
};
/**
* 打开loading
* @param {Object} [self] 当前this对象
* @return 当前loading对象
* */
export const openLoading = (self) => {
const options = {
lock: true,
text: 'Loading',
// target:'#bodyContent',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
};
self.elLoadingId = self.$loading(options);
return self.elLoadingId;
};
/**
* 关闭loading
* @param {Object} [self] 当前this对象
* @return 当前loading对象
* */
export const closeLoading = (self) => {
if (self.elLoadingId) {
self.elLoadingId.close();
}
};
/**
* 获取常量集合
*
*
* @param {Object} [self] 当前this对象
* @param {Object} [codeObject] 例如:codeObject={list1:"P097",list2:"P097"}
* */
export const getConstantList = (self, codeObject) => {
if (!codeObject instanceof Object) {
return;
}
let req = {
params: {
numMap: JSON.stringify(codeObject)
}
};
self.$axios.get(
localStorage.getItem("msUrl") + "constants"
, req
).then(function (res) {
let map = JSON.parse(JSON.stringify(res.data.data));//通过这个实现深拷贝
for (let key in map) {
self[key] = map[key];
}
});
};
export const initDepartment = (self, obj, type) => {
if (!obj instanceof Object) {
return;
}
var num = {
id: obj,
type: type
}
axios.create().post(
localStorage.getItem("kfUrl") + "PICAAddressHospitalServiceImpl/postDepartmentList",
num
).then(function (res) {
let list = JSON.parse(JSON.stringify(res.data.departmentList));//通过这个实现深拷贝
if (obj == -1) {
self.departmentListP = list;
} else {
self.departmentList = list;
}
if (type == 'childGetChildList') {
self.departmentPid = getPdepartmentId(self,'model','departmentId');
}
});
};
export const getPdepartmentId = (self) =>{
if(isNotEmptyList(self.model.departmentId)
|| !self.departmentList instanceof Array) {
return null;
}
if(self.departmentList.length>0) {
return self.departmentList[0].parent_id;
}else{
return -1;
}
};
export const getObjectIdsStr = (list, key) => {
if (isEmptyUtils(list)) {
return ''
}
let strRet = '';
for (let temp of list) {
strRet = strRet + temp[key] + ',';
}
return strRet;
}
export const getPositionList = (provinceId,cityId,countyId,townId) => {
return new Promise(function (resolve, reject) {
var num = {
provinceId,
cityId,
countyId,
townId
}
axios.create().post(
localStorage.getItem("kfUrl") + "combineHospital/getPositionList",
num
).then(function (res) {
resolve(res);
}).then(function (res) {
reject(res);
});
});
};
export const setOptionLabel = (self,selfModel,selfEId,selfEName,list,listEId,listEName) => {
if (isEmptyList(list) || isEmptyUtils(listEId) || isEmptyUtils(listEName)) {
return ;
}
for (let i = 0; i < list.length; i++) {
if(list[i][listEId] == self[selfModel][selfEId]){
self[selfModel][selfEName] = list[i][listEName];
break;
}
}
return;
};
/**
* 添加自定义的验证规则
*/
export function isvalidUsername(str) {
const valid_map = ['admin', 'editor']
return valid_map.indexOf(str.trim()) >= 0
}
/* 合法uri*/
export function validateURL(textval) {
const urlregex = /^(https?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$/
return urlregex.test(textval)
}
/* 小写字母*/
export function validateLowerCase(str) {
const reg = /^[a-z]+$/
return reg.test(str)
}
/* 大写字母*/
export function validateUpperCase(str) {
const reg = /^[A-Z]+$/
return reg.test(str)
}
/* 大小写字母*/
export function validatAlphabets(str) {
const reg = /^[A-Za-z]+$/
return reg.test(str)
}
// 2-150个中英文字符
export function validateWord150(rule, value, callback, message) {
if(!/^[\u4e00-\u9fffa-zA-Z]{2,150}$/.test(value)) {
callback(new Error(message))
} else {
callback()
}
}
// 考试30个中英文字符
export function validateWord30(value,message) {
if(!/^[\u4e00-\u9fffa-zA-Z]{0,30}$/.test(value)) {
callback(new Error('考试名称长度不超过30个中文字符长度'))
} else {
callback()
}
}
/* 通用密码验证(数字、字母、下划线或特殊字符且长度为0-150位) */
export function isValidPassword(rule, value, callback, message) {
if (!/^(?:\d+|[a-zA-Z]+|[!@#$%^&*]+){0,150}$/.test(value)) {
callback(new Error(message))
} else {
callback()
}
}
\ No newline at end of file
...@@ -120,8 +120,8 @@ ...@@ -120,8 +120,8 @@
</template> </template>
<script> <script>
import { openLoading, closeLoading } from "../../utils/utils"; import { openLoading, closeLoading } from "../../utils-o/utils";
import * as operationData from "../../utils/operation"; import * as operationData from "../../utils-o/operation";
let vm; let vm;
export default { export default {
props: { props: {
......
...@@ -51,8 +51,8 @@ ...@@ -51,8 +51,8 @@
</template> </template>
<script> <script>
import BreadCrumb from "../../components/breadcrumb.vue"; import BreadCrumb from "../../components/breadcrumb.vue";
import * as commonUtil from "../../utils/utils"; import * as commonUtil from "../../utils-o/utils";
import { openLoading, closeLoading } from "../../utils/utils"; import { openLoading, closeLoading } from "../../utils-o/utils";
import axios from "axios"; import axios from "axios";
let vm = null; let vm = null;
export default { export default {
......
...@@ -65,8 +65,8 @@ ...@@ -65,8 +65,8 @@
</template> </template>
<script> <script>
import { create } from "domain"; import { create } from "domain";
import * as operationData from "../../utils/operation"; import * as operationData from "../../utils-o/operation";
import { openLoading, closeLoading } from "../../utils/utils"; import { openLoading, closeLoading } from "../../utils-o/utils";
let vm = null; let vm = null;
export default { export default {
props: { props: {
......
...@@ -30,9 +30,9 @@ ...@@ -30,9 +30,9 @@
import BreadCrumb from "../../components/breadcrumb.vue"; import BreadCrumb from "../../components/breadcrumb.vue";
import { create } from "domain"; import { create } from "domain";
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
import { openLoading, closeLoading } from "../../utils/utils"; import { openLoading, closeLoading } from "../../utils-o/utils";
import * as commonUtil from "../../utils/utils"; import * as commonUtil from "../../utils-o/utils";
import * as operationData from "../../utils/operation"; import * as operationData from "../../utils-o/operation";
import echarts from "echarts"; import echarts from "echarts";
import { setTimeout } from "timers"; import { setTimeout } from "timers";
let vm = null; let vm = null;
......
...@@ -52,9 +52,9 @@ ...@@ -52,9 +52,9 @@
<script> <script>
import { log } from 'util'; import { log } from 'util';
import * as operationData from "../../utils/operation"; import * as operationData from "../../utils-o/operation";
import { openLoading, closeLoading } from "../../utils/utils"; import { openLoading, closeLoading } from "../../utils-o/utils";
import * as commonUtil from "../../utils/utils"; import * as commonUtil from "../../utils-o/utils";
let vm let vm
export default { export default {
props: { props: {
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
</template> </template>
<script> <script>
import { openLoading, closeLoading } from "../../utils/utils"; import { openLoading, closeLoading } from "../../utils-o/utils";
import * as commonUtil from "../../utils/utils"; import * as commonUtil from "../../utils-o/utils";
const echarts = require("echarts"); const echarts = require("echarts");
export default { export default {
data() { data() {
......
...@@ -132,9 +132,9 @@ import LearningEffect from "./item-learning-effect.vue"; ...@@ -132,9 +132,9 @@ import LearningEffect from "./item-learning-effect.vue";
import DataAlignment from "./data-alignment.vue"; import DataAlignment from "./data-alignment.vue";
import { create } from "domain"; import { create } from "domain";
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
import { openLoading, closeLoading } from "../../utils/utils"; import { openLoading, closeLoading } from "../../utils-o/utils";
import * as commonUtil from "../../utils/utils"; import * as commonUtil from "../../utils-o/utils";
import * as operationData from "../../utils/operation"; import * as operationData from "../../utils-o/operation";
import { log } from "util"; import { log } from "util";
let vm = null; let vm = null;
......
...@@ -46,9 +46,9 @@ ...@@ -46,9 +46,9 @@
</template> </template>
<script> <script>
import { openLoading, closeLoading } from "../../utils/utils"; import { openLoading, closeLoading } from "../../utils-o/utils";
import * as commonUtil from "../../utils/utils"; import * as commonUtil from "../../utils-o/utils";
import * as operationData from "../../utils/operation"; import * as operationData from "../../utils-o/operation";
import echarts from "echarts"; import echarts from "echarts";
import { setTimeout } from "timers"; import { setTimeout } from "timers";
let vm = null; let vm = null;
......
...@@ -115,9 +115,9 @@ ...@@ -115,9 +115,9 @@
import BreadCrumb from "../../components/breadcrumb.vue"; import BreadCrumb from "../../components/breadcrumb.vue";
import { create } from "domain"; import { create } from "domain";
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
import { openLoading, closeLoading } from "../../utils/utils"; import { openLoading, closeLoading } from "../../utils-o/utils";
import * as commonUtil from "../../utils/utils"; import * as commonUtil from "../../utils-o/utils";
import * as operationData from "../../utils/operation"; import * as operationData from "../../utils-o/operation";
let vm = null; let vm = null;
export default { export default {
components: { components: {
......
...@@ -76,8 +76,8 @@ ...@@ -76,8 +76,8 @@
</template> </template>
<script> <script>
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
import { openLoading, closeLoading } from "../../utils/utils"; import { openLoading, closeLoading } from "../../utils-o/utils";
import * as commonUtil from "../../utils/utils"; import * as commonUtil from "../../utils-o/utils";
import BreadCrumb from "../../components/breadcrumb.vue"; import BreadCrumb from "../../components/breadcrumb.vue";
let vm = null; let vm = null;
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册