main.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382
  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. verifyTags
  13. } from './util/util'
  14. import * as urls from '@/config/env';
  15. import Element from 'element-ui';
  16. import {
  17. iconfontUrl,
  18. iconfontVersion
  19. } from '@/config/env';
  20. import i18n from './lang'; // Internationalization
  21. import './styles/common.scss';
  22. import basicBlock from './components/basic-block/main';
  23. import basicContainer from './components/basic-container/main';
  24. import thirdRegister from './components/third-register/main';
  25. import avueUeditor from 'avue-plugin-ueditor';
  26. import website from '@/config/website';
  27. import crudCommon from '@/mixins/crud';
  28. import format from 'vue-text-format'; //v-format
  29. import {
  30. getWorkDicts
  31. } from '@/api/system/dictbiz'
  32. import { checkLock, onLock, unLock } from "@/api/lock/lock"
  33. import { submitLock } from "@/api/lock/businessUnlocking"
  34. import './util/directives.js'
  35. import Avue from '@smallwei/avue';
  36. import '@smallwei/avue/lib/index.css';
  37. Vue.use(Avue);
  38. Vue.use(avueUeditor)
  39. //地图回放
  40. import trackPlayback from "@/components/trackPlayback"
  41. //客户选择组件
  42. import selectComponent from '@/components/selectComponent/customerSelect';
  43. // 仓库选择组件
  44. import warehouseSelect from '@/components/warehouseSelect/index';
  45. // 商品选择组件
  46. import goodsSelect from '@/components/goodsSelect/index';
  47. //费用选择组件
  48. import breakdownSelect from '@/components/costBreakdown/costBreakdown';
  49. //用户选择组件
  50. import userSelect from '@/components/selectComponent/userSelect';
  51. //用户选择组件重新封装
  52. import userCom from '@/components/selectComponent/userCom';
  53. //重新封装了客户选择组件
  54. import cropSelect from "@/components/crop-select/main";
  55. // 发送消息㢟
  56. import messagePost from "@/components/messageSend/main"
  57. // 更改审批人
  58. import changeApprove from "@/components/change-approve/main"
  59. //仓库客户组件
  60. import warehousKH from '@/components/warehousKH/main';
  61. //仓库客户组件
  62. import eCropSelect from '@/components/e-crop-select/main';
  63. //配件客户组件
  64. import ypjCorp from '@/components/ypj-corp/main';
  65. //配件字典组件
  66. import dictbizDialog from '@/components/dictbiz-dialog/main';
  67. // 标题跳转组件
  68. import eCropJump from '@/components/e-crop-jump/index';
  69. // 箱费用组件
  70. import boxCost from '@/components/boxCost/index';
  71. //海运进出口费用组件
  72. import seaCost from '@/components/seaCost/index';
  73. //海运进出口费用组件2
  74. import oceanFreight from '@/components/oceanFreight/index';
  75. // 箱信息组件
  76. import boxInformation from '@/components/boxInformation/index';
  77. //枚举列设置名称管理
  78. import {
  79. getColumnName
  80. } from "@/enums/column-name"
  81. import {
  82. getColumnData,
  83. saveColumnData,
  84. delColumnData
  85. } from "@/util/columnSetting"
  86. //查看是否有锁
  87. import {
  88. checkLocks
  89. } from "@/util/lock"
  90. //overdueJudgment
  91. import {
  92. overdueJudgment
  93. } from "@/util/date"
  94. import {
  95. inDetailsKey,
  96. leaveDetailsKey
  97. } from "@/util/keyData"
  98. // 导入弹窗放大样式
  99. import '@/assets/css/form.css'
  100. // 客户调出收发货地址
  101. import { corpAddr } from "@/components/function/corpAddrSelect"
  102. //获取浏览器指纹并生成ID
  103. import Fingerprint2 from 'fingerprintjs2'
  104. Vue.component('trackPlayback', trackPlayback);
  105. Vue.component('boxCost', boxCost);
  106. Vue.component('seaCost', seaCost);
  107. Vue.component('oceanFreight', oceanFreight);
  108. Vue.component('boxInformation', boxInformation);
  109. Vue.component('selectComponent', selectComponent);
  110. Vue.component('warehouseSelect', warehouseSelect);
  111. Vue.component('goodsSelect', goodsSelect);
  112. Vue.component('breakdownSelect', breakdownSelect);
  113. Vue.component('userCom', userCom);
  114. Vue.component('userSelect', userSelect);
  115. Vue.component('cropSelect', cropSelect);
  116. Vue.component('messagePost', messagePost);
  117. Vue.component('changeApprove', changeApprove)
  118. Vue.component('warehousKh', warehousKH)
  119. Vue.component('eCropSelect', eCropSelect)
  120. Vue.component('ypjCorp', ypjCorp)
  121. Vue.component('dictbizDialog', dictbizDialog)
  122. Vue.component('eCropJump', eCropJump)
  123. import portInfo from "@/components/port-info/index";
  124. Vue.component('portInfo', portInfo);
  125. // 注册全局crud驱动
  126. window.$crudCommon = crudCommon;
  127. // 加载Vue拓展
  128. Vue.use(router);
  129. Vue.use(VueAxios, axios);
  130. Vue.use(Element, {
  131. i18n: (key, value) => i18n.t(key, value)
  132. });
  133. Vue.use(window.AVUE, {
  134. size: 'small',
  135. tableSize: 'small',
  136. calcHeight: 65,
  137. i18n: (key, value) => i18n.t(key, value)
  138. });
  139. Vue.use(format); //v-format
  140. // 注册全局容器
  141. Vue.component('basicContainer', basicContainer);
  142. Vue.component('basicBlock', basicBlock);
  143. Vue.component('thirdRegister', thirdRegister);
  144. //此处有个问题,下面这句不能使用
  145. // Vue.component('avueUeditor', avueUeditor);
  146. Vue.use(avueUeditor);
  147. //自定义标题
  148. import containerTitle from './components/titleComponent/main.vue';
  149. Vue.component('containerTitle', containerTitle);
  150. //自定义卡片
  151. import tradeCard from './components/trade-card/main.vue';
  152. Vue.component('tradeCard', tradeCard);
  153. //打印
  154. import Print from 'vue-print-nb'
  155. Vue.use(Print);
  156. //注册echarts图表
  157. import * as echarts from 'echarts';
  158. Vue.prototype.$echarts = echarts
  159. //上传组件upload
  160. import cUpload from './components/upload'
  161. Vue.component('cUpload', cUpload)
  162. //上传组件upload
  163. import cUploadTwo from './components/uploadTwo'
  164. Vue.component('cUploadTwo', cUploadTwo)
  165. // 加载相关url地址
  166. Object.keys(urls).forEach(key => {
  167. Vue.prototype[key] = urls[key];
  168. });
  169. // 加载website
  170. Vue.prototype.website = website;
  171. // 业务字典
  172. Vue.prototype.getWorkDicts = getWorkDicts
  173. // 动态加载阿里云字体库
  174. iconfontVersion.forEach(ele => {
  175. loadStyle(iconfontUrl.replace('$key', ele));
  176. });
  177. //枚举列设置名称管理
  178. Vue.prototype.getColumnName = getColumnName
  179. Vue.prototype.getColumnData = getColumnData
  180. Vue.prototype.saveColumnData = saveColumnData
  181. Vue.prototype.delColumnData = delColumnData
  182. //进入详情页时,保存id和其他参数
  183. Vue.prototype.inDetailsKey = inDetailsKey
  184. //离开详情页时,清除对应key的id和其他参数
  185. Vue.prototype.leaveDetailsKey = leaveDetailsKey
  186. Vue.config.productionTip = false;
  187. Vue.prototype.corpAddr = corpAddr;
  188. // 业务锁
  189. Vue.prototype.checkLock = checkLock;
  190. Vue.prototype.onLock = onLock;
  191. Vue.prototype.unLock = unLock;
  192. Vue.prototype.checkLocks = checkLocks;
  193. //业务上锁
  194. Vue.prototype.submitLock = submitLock;
  195. Vue.prototype.overdueJudgment = overdueJudgment;
  196. //检验标签是否重复
  197. Vue.prototype.verifyTags = verifyTags
  198. new Vue({
  199. router,
  200. store,
  201. i18n,
  202. render: h => h(App)
  203. }).$mount('#app');
  204. Vue.directive("input-limit", {
  205. bind(el, binding) {
  206. var wins_0 = /[^\d]/g //整数判断
  207. var wins_1 = /[^\d^\.]/g //小数判断
  208. var flag = true;
  209. var points = 0;
  210. var lengths = 0
  211. var remainder = 0
  212. var no_int = 0
  213. const target = el instanceof HTMLInputElement ? el : el.querySelector("input");
  214. target.addEventListener("compositionstart", e => {
  215. flag = false;
  216. });
  217. target.addEventListener("compositionend", e => {
  218. flag = true;
  219. });
  220. target.addEventListener("input", e => {
  221. setTimeout(function () {
  222. if (flag) {
  223. if (binding.value == 0) {
  224. if (wins_0.test(e.target.value)) {
  225. e.target.value = e.target.value.replace(wins_0, "");
  226. e.target.dispatchEvent(new Event("input")) //手动更新v-model值
  227. }
  228. }
  229. if (binding.value == 1) {
  230. if (wins_0.test(e.target.value.toString().replace(/\d+\.(\d*)/, '$1'))) {
  231. remainder = true
  232. }
  233. if ((e.target.value.split('.')).length - 1 > 1) {
  234. points = true
  235. }
  236. if (e.target.value.toString().split(".")[1] != undefined) {
  237. if (e.target.value.toString().split(".")[1].length > 1) {
  238. lengths = true
  239. }
  240. }
  241. if (e.target.value.toString().indexOf(".") != -1) {
  242. no_int = false
  243. } else {
  244. no_int = true
  245. }
  246. if (wins_1.test(e.target.value) || lengths || points || remainder) {
  247. if (!no_int) {
  248. e.target.value = e.target.value.replace(wins_1, "").replace('.', '$#$').replace(/\./g, '').replace(
  249. '$#$', '.').replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3').substring(0, e.target.value.indexOf(
  250. ".") + 2)
  251. } else {
  252. e.target.value = e.target.value.replace(wins_0, "")
  253. }
  254. e.target.dispatchEvent(new Event("input"))
  255. }
  256. }
  257. if (binding.value == 2) {
  258. if (wins_0.test(e.target.value.toString().replace(/\d+\.(\d*)/, '$1'))) {
  259. remainder = true
  260. }
  261. if ((e.target.value.split('.')).length - 1 > 1) {
  262. points = true
  263. }
  264. if (e.target.value.toString().split(".")[1] != undefined) {
  265. if (e.target.value.toString().split(".")[1].length > 2) {
  266. lengths = true
  267. }
  268. }
  269. if (e.target.value.toString().indexOf(".") != -1) {
  270. no_int = false
  271. } else {
  272. no_int = true
  273. }
  274. if (wins_1.test(e.target.value) || lengths || points || remainder) {
  275. if (!no_int) {
  276. e.target.value = e.target.value.replace(wins_1, "").replace('.', '$#$').replace(/\./g, '').replace(
  277. '$#$', '.').replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3').substring(0, e.target.value.indexOf(
  278. ".") + 3)
  279. } else {
  280. e.target.value = e.target.value.replace(wins_0, "")
  281. }
  282. e.target.dispatchEvent(new Event("input"))
  283. }
  284. }
  285. if (binding.value == 4) {
  286. if (wins_0.test(e.target.value.toString().replace(/\d+\.(\d*)/, '$1'))) {
  287. remainder = true
  288. }
  289. if ((e.target.value.split('.')).length - 1 > 1) {
  290. points = true
  291. }
  292. if (e.target.value.toString().split(".")[1] != undefined) {
  293. if (e.target.value.toString().split(".")[1].length > 4) {
  294. lengths = true
  295. }
  296. }
  297. if (e.target.value.toString().indexOf(".") != -1) {
  298. no_int = false
  299. } else {
  300. no_int = true
  301. }
  302. if (wins_1.test(e.target.value) || lengths || points || remainder) {
  303. if (!no_int) {
  304. e.target.value = e.target.value.replace(wins_1, "").replace('.', '$#$').replace(/\./g, '').replace(
  305. '$#$', '.').substring(0, e.target.value.indexOf(
  306. ".") + 5)
  307. } else {
  308. e.target.value = e.target.value.replace(wins_0, "")
  309. }
  310. e.target.dispatchEvent(new Event("input"))
  311. }
  312. }
  313. if (binding.value == 5) {
  314. if (wins_0.test(e.target.value.toString().replace(/\d+\.(\d*)/, '$1'))) {
  315. remainder = true
  316. }
  317. if ((e.target.value.split('.')).length - 1 > 1) {
  318. points = true
  319. }
  320. if (e.target.value.toString().split(".")[1] != undefined) {
  321. if (e.target.value.toString().split(".")[1].length > 5) {
  322. lengths = true
  323. }
  324. }
  325. if (e.target.value.toString().indexOf(".") != -1) {
  326. no_int = false
  327. } else {
  328. no_int = true
  329. }
  330. if (wins_1.test(e.target.value) || lengths || points || remainder) {
  331. if (!no_int) {
  332. e.target.value = e.target.value.replace(wins_1, "").replace('.', '$#$').replace(/\./g, '').replace(
  333. '$#$', '.').substring(0, e.target.value.indexOf(
  334. ".") + 6)
  335. } else {
  336. e.target.value = e.target.value.replace(wins_0, "")
  337. }
  338. e.target.dispatchEvent(new Event("input"))
  339. }
  340. }
  341. }
  342. }, 0)
  343. })
  344. }
  345. })
  346. Vue.directive('debounce', { //防抖函数指令
  347. inserted: function (el, binding) {
  348. el.addEventListener("click", () => {
  349. if (!el.disabled)
  350. el.disabled = true
  351. setTimeout(() => {
  352. el.disabled = false
  353. }, binding.value || 1000);
  354. });
  355. }
  356. })
  357. Fingerprint2.get(function (components) {
  358. const values = components.map(function (component, index) {
  359. if (index === 0) {
  360. return component.value.replace(/\bNetType\/\w+\b/, '')
  361. }
  362. return component.value
  363. })
  364. // 生成最终id murmur
  365. let murmur = Fingerprint2.x64hash128(values.join(''), 31)
  366. // 2025-10-16 有时候无指纹??
  367. if (!murmur) {
  368. murmur = Fingerprint2.x64hash128("none", 31)
  369. }
  370. // console.log('Fingerprint2', 'values', values, 'murmur', murmur)
  371. if (localStorage.getItem('browserID') != murmur) {
  372. localStorage.setItem('browserID', murmur)
  373. }
  374. })
  375. //Vue.prototype.$Map = window.TMap
  376. //Vue.prototype.$Location = new window.TMap.Geolocation('CB2BZ-T3IWN-UPWFO-SR2Y6-4YBXQ-SGBKT', '腾讯地图模板')