Files
kengee-data-screen/src/utils/inject.js

60 lines
1.7 KiB
JavaScript
Raw Normal View History

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-06-21 11:51:14 +08:00
const KENGEE_CDN_BASE = "http://10.0.97.209/presource/datascreen/"
2024-06-30 15:04:47 +08:00
const libs = [`${KENGEE_CDN_BASE}/js/pinyin.min.js`, `${KENGEE_CDN_BASE}/js/dayjs.min.js`]
2024-06-27 22:39:41 +08:00
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)
}
})
2024-06-29 13:13:59 +08:00
Vue.prototype.$marketBoard = Vue.observable({
2024-06-30 16:34:29 +08:00
search: {"groupCodeList": ["20001003"], "currentDate": "20240501", "compareDate": "20240430", "hourNum": "18"}
2024-06-29 13:13:59 +08:00
})
Vue.prototype.$multipleStoreBoard = Vue.observable({
search: {}
})
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"),
...libs.map(url => new Promise(resolve => {
const script = document.createElement("script")
script.src = url
document.head.appendChild(script)
script.onload = () => resolve()
})),
])