import Vue from 'vue' import 'normalize.css/normalize.css' // A modern alternative to CSS resets import ElementUI, { MessageBox } from 'element-ui' import { getBasicDataAllSelect } from '@/api/dictionary/dictionary' // import 'element-ui/lib/theme-chalk/index.css' import './assets/css/theme-green/index.css' // 浅绿色主题 import './assets/css/iconfont/index.css' // 阿里巴巴图标库 // import locale from 'element-ui/lib/locale/lang/en' // lang i18n import i18n from './lang' import '@/styles/index.scss' // global css import App from './App' import store from './store' import router from './router' import '@/icons' // icon import '@/permission' // permission control import md5 from 'js-md5' import VueClipboard from 'vue-clipboard2' Vue.use(VueClipboard) // import htmlToPdf from './utils/htmlToPdf' // Vue.use(htmlToPdf) import permission from './utils/permission' import { OSSclient } from './utils/oss' Vue.use(permission) import hasPermi from './directive/permission' Vue.use(hasPermi) // set ElementUI lang to EN // Vue.use(ElementUI, { locale, size: 'medium' }) // 如果想要中文版 element-ui,按如下方式声明 // Vue.use(ElementUI) Vue.use(ElementUI, { i18n: (key, value) => i18n.t(key, value), size: 'medium' }) import adaptive from '@/directive/adaptive/index' // 表格自适应指令 Vue.use(adaptive) import dialogDrag from '@/directive/dialogDrag' // 窗口拖拽 Vue.use(dialogDrag) import { parseTime, resetForm, selectDictLabel, selectDictLabels, handleTree, params } from '@/utils/ruoyi' import { xfHasPermi } from '@/utils/hasPermi' // 字典数据组件 import DictTag from '@/components/DictTag' import DictData from '@/components/DictData' import { getBasicDataSelect } from '@/api/dictionary/dictionary' import { checkConfig } from '@/const/check/index' // 全局方法挂载 var $q = params Vue.prototype.checkConfig = checkConfig Vue.prototype.$q = $q() Vue.prototype.hasPermi = xfHasPermi Vue.prototype.getDicts = getBasicDataSelect Vue.prototype.selectDictLabel = selectDictLabel Vue.prototype.selectDictLabels = selectDictLabels Vue.component('DictTag', DictTag) // 全局方法挂载 Vue.prototype.parseTime = parseTime Vue.prototype.resetForm = resetForm Vue.prototype.selectDictLabel = selectDictLabel // Vue.prototype.download = download Vue.prototype.handleTree = handleTree Vue.prototype.OSSclient = OSSclient Vue.prototype.$validatePassword = (rule, value, callback) => { /* eslint-disable */ var reg1 = eval(process.env.VUE_APP_PASSWORD_FOR_PERMISSION) ? new RegExp(`${process.env.VUE_APP_PASSWORD_FOR_REGULAR}`) : /.*/g; //密码必须是8位以上、必须含有字母、数字、特殊符号 if (!reg1.test(value)) { callback(new Error("密码必须是10位以上、必须含有小写字母、大写字母、数字、特殊符号")); } else { callback(); } } DictData.install() import global_ from './components/Global' Vue.prototype.GLOBAL = global_ Vue.config.productionTip = false var _vm async function VueInit () { var params if (~window.location.href.indexOf('/readingDicoms') || ~window.location.href.indexOf('/noneDicomReading')) { params = $q('TrialReadingCriterionId') } console.log(window.location.href) var res = await getBasicDataAllSelect(params) let d = function (code) { var dictInfo = res.Result try { for (var code in dictInfo) { var dictList = (dictInfo[code] && dictInfo[code].length > 0) ? dictInfo[code].map(dict => { return { id: dict.Id, label: true ? dict.ValueCN : dict.Value, value: dict.DataTypeEnum === 3 ? eval(dict.Code) : dict.IsEnumInt ? parseInt(dict.Code): dict.Code, raw: Object.assign({}, dict), IsBaseLineUse: false, IsFollowVisitUse: false } }) : [] dictInfo[code] = dictList } } catch (e){ console.error(e) } return dictInfo }() Vue.prototype.$d = d Vue.prototype.$fd = function (code, v, type) { type = type || 'value' return d[code].find(i => { return i[type] === v }) ? d[code].find(i => { return i[type] === v }).label : '' } _vm = new Vue({ el: '#app', router, store, i18n, data: { unlock: { my_username: null, my_password: null } }, render: h => h(App) }) var isLock = false if (eval(process.env.VUE_APP_LOGIN_FOR_PERMISSION)) { setInterval(() => { if (_vm.$route.path === '/login' || _vm.$route.path === '/email-recompose' || _vm.$route.path === '/recompose' || _vm.$route.path === '/resetpassword' || _vm.$route.path === '/error') { return } if (_vm.$store.state.user.userId !== zzSessionStorage.getItem('userId')) { window.location.href = `/login` zzSessionStorage.removeItem('lastWorkbench') _vm.$alert('同一浏览器只允许同时登陆一个账户', { type: 'warning', }) } }, 10000) } const waitOperate = (callback, second, callback2, second2) => { let count = 0; let x; let y; let timer; //监听鼠标 document.onmousemove = function (event) { const x1 = event.clientX; const y1 = event.clientY; if (x != x1 || y != y1) { count = 0; } x = x1; y = y1; }; //监听键盘 document.onkeydown = function () { count = 0; }; function countTime() { count++; if (count == second2) { callback2(); } if (count >= second) { callback(); count = 0; // clearInterval(timer); } } var blob = new Blob([document.querySelector('#worker').textContent]); var url = window.URL.createObjectURL(blob); var worker = new Worker(url); worker.onmessage = function (e) { countTime() } } const h = _vm.$createElement /* eslint-disable */ waitOperate(eval(process.env.VUE_APP_LOGOUT_FOR_PERMISSION) ? () => { if (_vm.$route.path === '/login' || _vm.$route.path === '/email-recompose' || _vm.$route.path === '/recompose' || _vm.$route.path === '/resetpassword' || _vm.$route.path === '/error') { return } _vm.$store.dispatch('user/logout').then(res => { window.location.href = `/login` }) _vm.$alert('由于您长时间未操作,为保护您的数据安全已强制将您下线,如果需要继续操作请重新登陆!', { type: 'warning', }) } : () => {}, process.env.VUE_APP_LOGOUT_FOR_TIME, eval(process.env.VUE_APP_LOCK_FOR_PERMISSION) ? () => { if (_vm.$route.path === '/login' || _vm.$route.path === '/email-recompose' || _vm.$route.path === '/recompose' || _vm.$route.path === '/resetpassword' || _vm.$route.path === '/error') { return } zzSessionStorage.setItem('isLock', 'true') if (isLock) { return } isLock = true _vm.$msgbox({ title: '已锁定', confirmButtonText: '解锁', showClose: false, beforeClose: (action, instance, done) => { if (action === 'confirm') { if (!_vm.unlock.my_username) { _vm.$message.error('请输入您的用户名解锁') return } if (!_vm.unlock.my_password) { _vm.$message.error('请输入您的密码解锁') return } var my_username = zzSessionStorage.getItem('my_username') var my_password = zzSessionStorage.getItem('my_password') if (md5(_vm.unlock.my_password) === my_password && my_username === _vm.unlock.my_username) { _vm.$message.success('解锁成功,请继续操作') _vm.unlock = { my_username: null, my_password: null } isLock = false document.querySelector('#my_username').value = null document.querySelector('#my_password').value = null setTimeout(() => { done() }, 500) } else { _vm.$message.error('请输入正确用户名密码') } } }, message: h('div', {} , [ h('el-form', { props: { labelWidth: "80px" } }, [ h('el-form-item', { props: {label: '用户名'}, }, [ h('input',{ props: { value: _vm.unlock.my_username }, attrs: { id: 'my_username', class: 'el-input__inner', autocomplete: 'new-password' }, on: { change: (event) => { _vm.unlock.my_username = event.target.value }, input: (event) => { _vm.unlock.my_username = event.target.value } } }) ]), h('el-form-item', { props: {label: '密码'}, }, [ h('input', { props: { value: _vm.unlock.my_password }, attrs: { id: 'my_password', class: 'el-input__inner', type: 'password', autocomplete: 'new-password' }, on: { change: (event) => { _vm.unlock.my_password = event.target.value }, input: (event) => { _vm.unlock.my_password = event.target.value } } }) ]) ]) ]) }) } : () => {}, process.env.VUE_APP_LOCK_FOR_TIME) } VueInit()