import Vue from 'vue'; import axios from './router/axios'; import VueAxios from 'vue-axios'; import App from './App'; import router from './router/router'; import './permission'; // 权限 import './error'; // 日志 import './cache'; //页面缓存 import store from './store'; import { loadStyle } from './util/util' import * as urls from '@/config/env'; import Element from 'element-ui'; import { iconfontUrl, iconfontVersion } from '@/config/env'; import i18n from './lang'; // Internationalization import './styles/common.scss'; import basicBlock from './components/basic-block/main'; import basicContainer from './components/basic-container/main'; import thirdRegister from './components/third-register/main'; import avueUeditor from 'avue-plugin-ueditor'; import website from '@/config/website'; import crudCommon from '@/mixins/crud'; import format from 'vue-text-format'; //v-format import { getWorkDicts } from '@/api/system/dictbiz' import { checkLock, onLock, unLock } from "@/api/lock/lock" import './util/directives.js' import Avue from '@smallwei/avue'; import '@smallwei/avue/lib/index.css'; Vue.use(Avue); //地图回放 import trackPlayback from "@/components/trackPlayback" //客户选择组件 import selectComponent from '@/components/selectComponent/customerSelect'; // 仓库选择组件 import warehouseSelect from '@/components/warehouseSelect/index'; // 商品选择组件 import goodsSelect from '@/components/goodsSelect/index'; //费用选择组件 import breakdownSelect from '@/components/costBreakdown/costBreakdown'; //用户选择组件 import userSelect from '@/components/selectComponent/userSelect'; //用户选择组件重新封装 import userCom from '@/components/selectComponent/userCom'; //重新封装了客户选择组件 import cropSelect from "@/components/crop-select/main"; // 发送消息㢟 import messagePost from "@/components/messageSend/main" // 更改审批人 import changeApprove from "@/components/change-approve/main" //仓库客户组件 import warehousKH from '@/components/warehousKH/main'; //仓库客户组件 import eCropSelect from '@/components/e-crop-select/main'; //配件客户组件 import ypjCorp from '@/components/ypj-corp/main'; //配件字典组件 import dictbizDialog from '@/components/dictbiz-dialog/main'; // 标题跳转组件 import eCropJump from '@/components/e-crop-jump/index'; // 箱费用组件 import boxCost from '@/components/boxCost/index'; //海运进出口费用组件 import seaCost from '@/components/seaCost/index'; //海运进出口费用组件2 import oceanFreight from '@/components/oceanFreight/index'; // 箱信息组件 import boxInformation from '@/components/boxInformation/index'; //枚举列设置名称管理 import { getColumnName } from "@/enums/column-name" import { getColumnData, saveColumnData, delColumnData } from "@/util/columnSetting" //查看是否有锁 import { checkLocks } from "@/util/lock" import { inDetailsKey, leaveDetailsKey } from "@/util/keyData" // 导入弹窗放大样式 import '@/assets/css/form.css' // 客户调出收发货地址 import { corpAddr } from "@/components/function/corpAddrSelect" //获取浏览器指纹并生成ID import Fingerprint2 from 'fingerprintjs2' Vue.component('trackPlayback', trackPlayback); Vue.component('boxCost', boxCost); Vue.component('seaCost', seaCost); Vue.component('oceanFreight', oceanFreight); Vue.component('boxInformation', boxInformation); Vue.component('selectComponent', selectComponent); Vue.component('warehouseSelect', warehouseSelect); Vue.component('goodsSelect', goodsSelect); Vue.component('breakdownSelect', breakdownSelect); Vue.component('userCom', userCom); Vue.component('userSelect', userSelect); Vue.component('cropSelect', cropSelect); Vue.component('messagePost', messagePost); Vue.component('changeApprove', changeApprove) Vue.component('warehousKh', warehousKH) Vue.component('eCropSelect', eCropSelect) Vue.component('ypjCorp', ypjCorp) Vue.component('dictbizDialog', dictbizDialog) Vue.component('eCropJump', eCropJump) import portInfo from "@/components/port-info/index"; Vue.component('portInfo', portInfo); // 注册全局crud驱动 window.$crudCommon = crudCommon; // 加载Vue拓展 Vue.use(router); Vue.use(VueAxios, axios); Vue.use(Element, { i18n: (key, value) => i18n.t(key, value) }); Vue.use(window.AVUE, { size: 'small', tableSize: 'small', calcHeight: 65, i18n: (key, value) => i18n.t(key, value) }); Vue.use(format); //v-format // 注册全局容器 Vue.component('basicContainer', basicContainer); Vue.component('basicBlock', basicBlock); Vue.component('thirdRegister', thirdRegister); //此处有个问题,下面这句不能使用 // Vue.component('avueUeditor', avueUeditor); Vue.use(avueUeditor); //自定义标题 import containerTitle from './components/titleComponent/main.vue'; Vue.component('containerTitle', containerTitle); //自定义卡片 import tradeCard from './components/trade-card/main.vue'; Vue.component('tradeCard', tradeCard); //打印 import Print from 'vue-print-nb' Vue.use(Print); //注册echarts图表 import * as echarts from 'echarts'; Vue.prototype.$echarts = echarts //上传组件upload import cUpload from './components/upload' Vue.component('cUpload', cUpload) //上传组件upload import cUploadTwo from './components/uploadTwo' Vue.component('cUploadTwo', cUploadTwo) // 加载相关url地址 Object.keys(urls).forEach(key => { Vue.prototype[key] = urls[key]; }); // 加载website Vue.prototype.website = website; // 业务字典 Vue.prototype.getWorkDicts = getWorkDicts // 动态加载阿里云字体库 iconfontVersion.forEach(ele => { loadStyle(iconfontUrl.replace('$key', ele)); }); //枚举列设置名称管理 Vue.prototype.getColumnName = getColumnName Vue.prototype.getColumnData = getColumnData Vue.prototype.saveColumnData = saveColumnData Vue.prototype.delColumnData = delColumnData //进入详情页时,保存id和其他参数 Vue.prototype.inDetailsKey = inDetailsKey //离开详情页时,清除对应key的id和其他参数 Vue.prototype.leaveDetailsKey = leaveDetailsKey Vue.config.productionTip = false; Vue.prototype.corpAddr = corpAddr; // 业务锁 Vue.prototype.checkLock = checkLock; Vue.prototype.onLock = onLock; Vue.prototype.unLock = unLock; Vue.prototype.checkLocks = checkLocks; new Vue({ router, store, i18n, render: h => h(App) }).$mount('#app'); Vue.directive("input-limit", { bind(el, binding) { var wins_0 = /[^\d]/g //整数判断 var wins_1 = /[^\d^\.]/g //小数判断 var flag = true; var points = 0; var lengths = 0 var remainder = 0 var no_int = 0 const target = el instanceof HTMLInputElement ? el : el.querySelector("input"); target.addEventListener("compositionstart", e => { flag = false; }); target.addEventListener("compositionend", e => { flag = true; }); target.addEventListener("input", e => { setTimeout(function () { if (flag) { if (binding.value == 0) { if (wins_0.test(e.target.value)) { e.target.value = e.target.value.replace(wins_0, ""); e.target.dispatchEvent(new Event("input")) //手动更新v-model值 } } if (binding.value == 1) { if (wins_0.test(e.target.value.toString().replace(/\d+\.(\d*)/, '$1'))) { remainder = true } if ((e.target.value.split('.')).length - 1 > 1) { points = true } if (e.target.value.toString().split(".")[1] != undefined) { if (e.target.value.toString().split(".")[1].length > 1) { lengths = true } } if (e.target.value.toString().indexOf(".") != -1) { no_int = false } else { no_int = true } if (wins_1.test(e.target.value) || lengths || points || remainder) { if (!no_int) { e.target.value = e.target.value.replace(wins_1, "").replace('.', '$#$').replace(/\./g, '').replace( '$#$', '.').replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3').substring(0, e.target.value.indexOf( ".") + 2) } else { e.target.value = e.target.value.replace(wins_0, "") } e.target.dispatchEvent(new Event("input")) } } if (binding.value == 2) { if (wins_0.test(e.target.value.toString().replace(/\d+\.(\d*)/, '$1'))) { remainder = true } if ((e.target.value.split('.')).length - 1 > 1) { points = true } if (e.target.value.toString().split(".")[1] != undefined) { if (e.target.value.toString().split(".")[1].length > 2) { lengths = true } } if (e.target.value.toString().indexOf(".") != -1) { no_int = false } else { no_int = true } if (wins_1.test(e.target.value) || lengths || points || remainder) { if (!no_int) { e.target.value = e.target.value.replace(wins_1, "").replace('.', '$#$').replace(/\./g, '').replace( '$#$', '.').replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3').substring(0, e.target.value.indexOf( ".") + 3) } else { e.target.value = e.target.value.replace(wins_0, "") } e.target.dispatchEvent(new Event("input")) } } if (binding.value == 4) { if (wins_0.test(e.target.value.toString().replace(/\d+\.(\d*)/, '$1'))) { remainder = true } if ((e.target.value.split('.')).length - 1 > 1) { points = true } if (e.target.value.toString().split(".")[1] != undefined) { if (e.target.value.toString().split(".")[1].length > 4) { lengths = true } } if (e.target.value.toString().indexOf(".") != -1) { no_int = false } else { no_int = true } if (wins_1.test(e.target.value) || lengths || points || remainder) { if (!no_int) { e.target.value = e.target.value.replace(wins_1, "").replace('.', '$#$').replace(/\./g, '').replace( '$#$', '.').substring(0, e.target.value.indexOf( ".") + 5) } else { e.target.value = e.target.value.replace(wins_0, "") } e.target.dispatchEvent(new Event("input")) } } if (binding.value == 5) { if (wins_0.test(e.target.value.toString().replace(/\d+\.(\d*)/, '$1'))) { remainder = true } if ((e.target.value.split('.')).length - 1 > 1) { points = true } if (e.target.value.toString().split(".")[1] != undefined) { if (e.target.value.toString().split(".")[1].length > 5) { lengths = true } } if (e.target.value.toString().indexOf(".") != -1) { no_int = false } else { no_int = true } if (wins_1.test(e.target.value) || lengths || points || remainder) { if (!no_int) { e.target.value = e.target.value.replace(wins_1, "").replace('.', '$#$').replace(/\./g, '').replace( '$#$', '.').substring(0, e.target.value.indexOf( ".") + 6) } else { e.target.value = e.target.value.replace(wins_0, "") } e.target.dispatchEvent(new Event("input")) } } } }, 0) }) } }) Vue.directive('debounce', { //防抖函数指令 inserted: function (el, binding) { el.addEventListener("click", () => { if (!el.disabled) el.disabled = true setTimeout(() => { el.disabled = false }, binding.value || 1000); }); } }) Fingerprint2.get(function (components) { const values = components.map(function (component, index) { if (index === 0) { return component.value.replace(/\bNetType\/\w+\b/, '') } return component.value }) // 生成最终id murmur const murmur = Fingerprint2.x64hash128(values.join(''), 31) if (localStorage.getItem('browserID') != murmur) { localStorage.setItem('browserID', murmur) } }) //Vue.prototype.$Map = window.TMap //Vue.prototype.$Location = new window.TMap.Geolocation('CB2BZ-T3IWN-UPWFO-SR2Y6-4YBXQ-SGBKT', '腾讯地图模板')