main.js 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. import Vue from 'vue';
  2. import axios from './router/axios';
  3. import VueAxios from 'vue-axios';
  4. import App from './App';
  5. import router from './router/router';
  6. import './permission'; // 权限
  7. import './error'; // 日志
  8. import './cache'; //页面缓存
  9. import store from './store';
  10. import {
  11. loadStyle
  12. } from './util/util'
  13. import * as urls from '@/config/env';
  14. import Element from 'element-ui';
  15. import {
  16. iconfontUrl,
  17. iconfontVersion
  18. } from '@/config/env';
  19. import i18n from './lang'; // Internationalization
  20. import './styles/common.scss';
  21. import basicBlock from './components/basic-block/main';
  22. import basicContainer from './components/basic-container/main';
  23. import thirdRegister from './components/third-register/main';
  24. import avueUeditor from 'avue-plugin-ueditor';
  25. import website from '@/config/website';
  26. import crudCommon from '@/mixins/crud';
  27. import format from 'vue-text-format'; //v-format
  28. import {
  29. getWorkDicts
  30. } from '@/api/system/dictbiz'
  31. import { checkLock, onLock, unLock } from "@/api/lock/lock"
  32. import './util/directives.js'
  33. //客户选择组件
  34. import selectComponent from '@/components/selectComponent/customerSelect';
  35. // 仓库选择组件
  36. import warehouseSelect from '@/components/warehouseSelect/index';
  37. // 商品选择组件
  38. import goodsSelect from '@/components/goodsSelect/index';
  39. //费用选择组件
  40. import breakdownSelect from '@/components/costBreakdown/costBreakdown';
  41. //用户选择组件
  42. import userSelect from '@/components/selectComponent/userSelect';
  43. //重新封装了客户选择组件
  44. import cropSelect from "@/components/crop-select/main";
  45. // 发送消息㢟
  46. import messagePost from "@/components/messageSend/main"
  47. //枚举列设置名称管理
  48. import {
  49. getColumnName
  50. } from "@/enums/column-name"
  51. import {
  52. getColumnData,
  53. saveColumnData,
  54. delColumnData
  55. } from "@/util/columnSetting"
  56. // 导入弹窗放大样式
  57. import '@/assets/css/form.css'
  58. // 客户调出收发货地址
  59. import {corpAddr} from "@/components/function/corpAddrSelect"
  60. //获取浏览器指纹并生成ID
  61. import Fingerprint2 from 'fingerprintjs2'
  62. Vue.component('selectComponent', selectComponent);
  63. Vue.component('warehouseSelect', warehouseSelect);
  64. Vue.component('goodsSelect', goodsSelect);
  65. Vue.component('breakdownSelect', breakdownSelect);
  66. Vue.component('userSelect', userSelect);
  67. Vue.component('cropSelect', cropSelect);
  68. Vue.component('messagePost', messagePost);
  69. import portInfo from "@/components/port-info/index";
  70. Vue.component('portInfo', portInfo);
  71. // 注册全局crud驱动
  72. window.$crudCommon = crudCommon;
  73. // 加载Vue拓展
  74. Vue.use(router);
  75. Vue.use(VueAxios, axios);
  76. Vue.use(Element, {
  77. i18n: (key, value) => i18n.t(key, value)
  78. });
  79. Vue.use(window.AVUE, {
  80. size: 'small',
  81. tableSize: 'small',
  82. calcHeight: 65,
  83. i18n: (key, value) => i18n.t(key, value)
  84. });
  85. Vue.use(format); //v-format
  86. // 注册全局容器
  87. Vue.component('basicContainer', basicContainer);
  88. Vue.component('basicBlock', basicBlock);
  89. Vue.component('thirdRegister', thirdRegister);
  90. //此处有个问题,下面这句不能使用
  91. // Vue.component('avueUeditor', avueUeditor);
  92. Vue.use(avueUeditor);
  93. //自定义标题
  94. import containerTitle from './components/titleComponent/main.vue';
  95. Vue.component('containerTitle', containerTitle);
  96. //注册echarts图表
  97. import * as echarts from 'echarts';
  98. Vue.prototype.$echarts = echarts
  99. // 加载相关url地址
  100. Object.keys(urls).forEach(key => {
  101. Vue.prototype[key] = urls[key];
  102. });
  103. // 加载website
  104. Vue.prototype.website = website;
  105. // 业务字典
  106. Vue.prototype.getWorkDicts = getWorkDicts
  107. // 动态加载阿里云字体库
  108. iconfontVersion.forEach(ele => {
  109. loadStyle(iconfontUrl.replace('$key', ele));
  110. });
  111. //枚举列设置名称管理
  112. Vue.prototype.getColumnName = getColumnName
  113. Vue.prototype.getColumnData = getColumnData
  114. Vue.prototype.saveColumnData = saveColumnData
  115. Vue.prototype.delColumnData=delColumnData
  116. Vue.config.productionTip = false;
  117. Vue.prototype.corpAddr = corpAddr;
  118. // 业务锁
  119. Vue.prototype.checkLock = checkLock;
  120. Vue.prototype.onLock = onLock;
  121. Vue.prototype.unLock = unLock;
  122. new Vue({
  123. router,
  124. store,
  125. i18n,
  126. render: h => h(App)
  127. }).$mount('#app');
  128. Vue.directive("input-limit", {
  129. bind(el, binding) {
  130. var wins_0 = /[^\d]/g //整数判断
  131. var wins_1 = /[^\d^\.]/g //小数判断
  132. var flag = true;
  133. var points = 0;
  134. var lengths = 0
  135. var remainder = 0
  136. var no_int = 0
  137. const target = el instanceof HTMLInputElement ? el : el.querySelector("input");
  138. target.addEventListener("compositionstart", e => {
  139. flag = false;
  140. });
  141. target.addEventListener("compositionend", e => {
  142. flag = true;
  143. });
  144. target.addEventListener("input", e => {
  145. setTimeout(function() {
  146. if (flag) {
  147. if (binding.value == 0) {
  148. if (wins_0.test(e.target.value)) {
  149. e.target.value = e.target.value.replace(wins_0, "");
  150. e.target.dispatchEvent(new Event("input")) //手动更新v-model值
  151. }
  152. }
  153. if (binding.value == 1) {
  154. if (wins_0.test(e.target.value.toString().replace(/\d+\.(\d*)/, '$1'))) {
  155. remainder = true
  156. }
  157. if ((e.target.value.split('.')).length - 1 > 1) {
  158. points = true
  159. }
  160. if (e.target.value.toString().split(".")[1] != undefined) {
  161. if (e.target.value.toString().split(".")[1].length > 1) {
  162. lengths = true
  163. }
  164. }
  165. if (e.target.value.toString().indexOf(".") != -1) {
  166. no_int = false
  167. } else {
  168. no_int = true
  169. }
  170. if (wins_1.test(e.target.value) || lengths || points || remainder) {
  171. if (!no_int) {
  172. e.target.value = e.target.value.replace(wins_1, "").replace('.', '$#$').replace(/\./g, '').replace(
  173. '$#$', '.').replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3').substring(0, e.target.value.indexOf(
  174. ".") + 2)
  175. } else {
  176. e.target.value = e.target.value.replace(wins_0, "")
  177. }
  178. e.target.dispatchEvent(new Event("input"))
  179. }
  180. }
  181. if (binding.value == 2) {
  182. if (wins_0.test(e.target.value.toString().replace(/\d+\.(\d*)/, '$1'))) {
  183. remainder = true
  184. }
  185. if ((e.target.value.split('.')).length - 1 > 1) {
  186. points = true
  187. }
  188. if (e.target.value.toString().split(".")[1] != undefined) {
  189. if (e.target.value.toString().split(".")[1].length > 2) {
  190. lengths = true
  191. }
  192. }
  193. if (e.target.value.toString().indexOf(".") != -1) {
  194. no_int = false
  195. } else {
  196. no_int = true
  197. }
  198. if (wins_1.test(e.target.value) || lengths || points || remainder) {
  199. if (!no_int) {
  200. e.target.value = e.target.value.replace(wins_1, "").replace('.', '$#$').replace(/\./g, '').replace(
  201. '$#$', '.').replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3').substring(0, e.target.value.indexOf(
  202. ".") + 3)
  203. } else {
  204. e.target.value = e.target.value.replace(wins_0, "")
  205. }
  206. e.target.dispatchEvent(new Event("input"))
  207. }
  208. }
  209. if (binding.value == 4) {
  210. if (wins_0.test(e.target.value.toString().replace(/\d+\.(\d*)/, '$1'))) {
  211. remainder = true
  212. }
  213. if ((e.target.value.split('.')).length - 1 > 1) {
  214. points = true
  215. }
  216. if (e.target.value.toString().split(".")[1] != undefined) {
  217. if (e.target.value.toString().split(".")[1].length > 4) {
  218. lengths = true
  219. }
  220. }
  221. if (e.target.value.toString().indexOf(".") != -1) {
  222. no_int = false
  223. } else {
  224. no_int = true
  225. }
  226. if (wins_1.test(e.target.value) || lengths || points || remainder) {
  227. if (!no_int) {
  228. e.target.value = e.target.value.replace(wins_1, "").replace('.', '$#$').replace(/\./g, '').replace(
  229. '$#$', '.').substring(0, e.target.value.indexOf(
  230. ".") + 5)
  231. } else {
  232. e.target.value = e.target.value.replace(wins_0, "")
  233. }
  234. e.target.dispatchEvent(new Event("input"))
  235. }
  236. }
  237. }
  238. }, 0)
  239. })
  240. }
  241. })
  242. Fingerprint2.get(function(components) {
  243. const values = components.map(function(component,index) {
  244. if (index === 0) {
  245. return component.value.replace(/\bNetType\/\w+\b/, '')
  246. }
  247. return component.value
  248. })
  249. // 生成最终id murmur
  250. const murmur = Fingerprint2.x64hash128(values.join(''), 31)
  251. console.log(murmur)
  252. })