2024-06-27 22:39:41 +08:00
|
|
|
import {dicts} from "@/utils/dicts";
|
|
|
|
|
import axios from 'axios'
|
2024-06-29 13:13:59 +08:00
|
|
|
import Vue from 'vue'
|
2024-06-27 22:39:41 +08:00
|
|
|
|
|
|
|
|
window.axios = axios
|
2024-07-01 02:32:42 +08:00
|
|
|
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`,
|
2024-07-01 18:22:37 +08:00
|
|
|
`${KENGEE_CDN_BASE}/js/d3-array.min.js`,
|
2024-07-01 02:32:42 +08:00
|
|
|
`${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();
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
};
|
2024-07-02 18:25:08 +08:00
|
|
|
window.$glob = {token: "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJoLXVzZXItaWQiOiIxODA4MDM2NzI3NzQzNDU1MjMyIiwiaC1yb2xlLWlkIjoiMTgwODAzNjg5NDQxMjUxMzI4MCIsImV4cCI6MTc1MTQ0NDg0MywibmJmIjoxNzE5OTA4ODQzfQ.Wi6wzArP79mFj3XEzSendOfWHJc1mNuSAlAC1W4zMzI"}
|
2024-06-27 22:39:41 +08:00
|
|
|
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)
|
|
|
|
|
}
|
|
|
|
|
})
|
2024-07-05 17:36:16 +08:00
|
|
|
window.evenRowBGC = (color = "#09265B") => `transparent;background-image: linear-gradient(-45deg, ${color} 0, ${color} 10%, transparent 10%, transparent 50%,${color} 50%, ${color} 60%, transparent 60%, transparent);background-size: 10px 10px;`
|
2024-06-29 13:13:59 +08:00
|
|
|
|
|
|
|
|
Vue.prototype.$marketBoard = Vue.observable({
|
2024-07-02 18:25:08 +08:00
|
|
|
search: {"groupCodeList": ["20011061"], "currentDate": "20240701", "compareDate": "20240630", "hourNum": "18"}
|
2024-06-29 13:13:59 +08:00
|
|
|
})
|
|
|
|
|
Vue.prototype.$multipleStoreBoard = Vue.observable({
|
2024-07-07 11:27:52 +08:00
|
|
|
search: {"groupCodeList": [], "hourNum": "", type: "1"}
|
2024-06-29 13:13:59 +08:00
|
|
|
})
|
|
|
|
|
Vue.prototype.$storeBoard = Vue.observable({
|
|
|
|
|
search: {}
|
|
|
|
|
})
|
2024-06-29 13:30:06 +08:00
|
|
|
Vue.component("tableColumn", {
|
|
|
|
|
props: {
|
|
|
|
|
column: {default: () => ({})}
|
|
|
|
|
},
|
|
|
|
|
render(h) {
|
|
|
|
|
const config = this.$props.column
|
2024-06-30 15:04:47 +08:00
|
|
|
return h('el-table-column', {props: {...config, label: `${config.label}` || "-"}},
|
2024-06-29 13:30:06 +08:00
|
|
|
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] || '')
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}))
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
2024-06-27 22:39:41 +08:00
|
|
|
export default Promise.all([
|
2024-06-21 11:51:14 +08:00
|
|
|
import("./fetch"),
|
2024-07-01 02:32:42 +08:00
|
|
|
...libs.map(url => $loadScript('js', url)),
|
2024-06-21 11:51:14 +08:00
|
|
|
])
|