import {dicts} from "@/utils/dicts"; import axios from 'axios' import Vue from 'vue' window.axios = axios const KENGEE_CDN_BASE = "http://10.0.97.209/presource/datascreen" const libs = [ `${KENGEE_CDN_BASE}/js/pinyin.min.js`, `${KENGEE_CDN_BASE}/js/dayjs.min.js`, `${KENGEE_CDN_BASE}/js/Tween.js`, `${KENGEE_CDN_BASE}/js/three/three.js`, `${KENGEE_CDN_BASE}/js/d3-array.min.js`, `${KENGEE_CDN_BASE}/js/d3-geo.min.js`, ] window.$loadScript = (type = 'js', url, dom = "body") => { let flag = false; return new Promise((resolve) => { const head = dom == 'head' ? document.getElementsByTagName('head')[0] : document.body; for (let i = 0; i < head.children.length; i++) { let ele = head.children[i] if ((ele.src || '').indexOf(url) !== -1) { flag = true; resolve(); } } if (flag) return; let script; if (type === 'js') { script = document.createElement('script'); script.type = 'text/javascript'; script.src = url; } else if (type === 'css') { script = document.createElement('link'); script.rel = 'stylesheet'; script.type = 'text/css'; script.href = url; } head.appendChild(script); script.onload = function () { resolve(); }; }); }; window.$glob = {} window.$dicts = dicts window.$waitFor = (target, t = 500) => new Promise(resolve => { const interval = setInterval(() => { if (target) { clearInterval(interval) resolve(target) } }, t) if (target) { clearInterval(interval) resolve(target) } }) Vue.prototype.$marketBoard = Vue.observable({ search: {"groupCodeList": ["20001003"], "currentDate": "20240501", "compareDate": "20240430", "hourNum": "18"} }) Vue.prototype.$multipleStoreBoard = Vue.observable({ search: {} }) Vue.prototype.$storeBoard = Vue.observable({ search: {} }) Vue.component("tableColumn", { props: { column: {default: () => ({})} }, render(h) { const config = this.$props.column return h('el-table-column', {props: {...config, label: `${config.label}` || "-"}}, config.children?.map(col => h("tableColumn", {props: {column: col}})) || h('template', { slotScope: { default: ({row}) => { config.custom ? h('div', {style: {color: row.preSaleNum > row.stockNum ? 'red' : '#fff'}}, '周边库存情况') : h('span', row[config.prop] || '') } } })) }, }) export default Promise.all([ import("./fetch"), ...libs.map(url => $loadScript('js', url)), ])