调整现场部署报错问题
This commit is contained in:
BIN
src/assets/img/lightning.png
Normal file
BIN
src/assets/img/lightning.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.9 KiB |
@@ -1,414 +1,414 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { PropType, VNode } from 'vue'
|
import type { PropType, VNode } from 'vue'
|
||||||
import type { modelValueTypes, InputAttr, InputData } from '@/components/baInput'
|
import type { modelValueTypes, InputAttr, InputData } from '@/components/baInput'
|
||||||
import { createVNode, resolveComponent, defineComponent, computed, reactive } from 'vue'
|
import { createVNode, resolveComponent, defineComponent, computed, reactive } from 'vue'
|
||||||
import { inputTypes } from '@/components/baInput'
|
import { inputTypes } from '@/components/baInput'
|
||||||
import Array from '@/components/baInput/components/array.vue'
|
import Array from '@/components/baInput/components/array.vue'
|
||||||
import RemoteSelect from '@/components/baInput/components/remoteSelect.vue'
|
import RemoteSelect from '@/components/baInput/components/remoteSelect.vue'
|
||||||
import IconSelector from '@/components/baInput/components/iconSelector.vue'
|
import IconSelector from '@/components/baInput/components/iconSelector.vue'
|
||||||
import Editor from '@/components/baInput/components/editor.vue'
|
import Editor from '@/components/baInput/components/editor.vue'
|
||||||
import { getArea } from '@/api/common'
|
// import { getArea } from '@/api/common'
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'baInput',
|
name: 'baInput',
|
||||||
props: {
|
props: {
|
||||||
// 输入框类型,支持的输入框见 inputTypes
|
// 输入框类型,支持的输入框见 inputTypes
|
||||||
type: {
|
type: {
|
||||||
type: String,
|
type: String,
|
||||||
required: true,
|
required: true,
|
||||||
validator: (value: string) => {
|
validator: (value: string) => {
|
||||||
return inputTypes.includes(value)
|
return inputTypes.includes(value)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
// 双向绑定值
|
// 双向绑定值
|
||||||
modelValue: {
|
modelValue: {
|
||||||
type: null,
|
type: null,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
// 输入框的附加属性
|
// 输入框的附加属性
|
||||||
attr: {
|
attr: {
|
||||||
type: Object as PropType<InputAttr>,
|
type: Object as PropType<InputAttr>,
|
||||||
default: () => {},
|
default: () => {},
|
||||||
},
|
},
|
||||||
// 额外数据,radio、checkbox的选项等数据
|
// 额外数据,radio、checkbox的选项等数据
|
||||||
data: {
|
data: {
|
||||||
type: Object as PropType<InputData>,
|
type: Object as PropType<InputData>,
|
||||||
default: () => {},
|
default: () => {},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
emits: ['update:modelValue'],
|
emits: ['update:modelValue'],
|
||||||
setup(props, { emit }) {
|
setup(props, { emit }) {
|
||||||
const onValueUpdate = (value: modelValueTypes) => {
|
const onValueUpdate = (value: modelValueTypes) => {
|
||||||
emit('update:modelValue', value)
|
emit('update:modelValue', value)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 子级元素属性
|
// 子级元素属性
|
||||||
let childrenAttr = props.data && props.data.childrenAttr ? props.data.childrenAttr : {}
|
let childrenAttr = props.data && props.data.childrenAttr ? props.data.childrenAttr : {}
|
||||||
|
|
||||||
// string number textarea password
|
// string number textarea password
|
||||||
const sntp = () => {
|
const sntp = () => {
|
||||||
return () =>
|
return () =>
|
||||||
createVNode(resolveComponent('el-input'), {
|
createVNode(resolveComponent('el-input'), {
|
||||||
type: props.type == 'string' ? 'text' : props.type,
|
type: props.type == 'string' ? 'text' : props.type,
|
||||||
...props.attr,
|
...props.attr,
|
||||||
modelValue: props.modelValue,
|
modelValue: props.modelValue,
|
||||||
'onUpdate:modelValue': onValueUpdate,
|
'onUpdate:modelValue': onValueUpdate,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// radio checkbox
|
// radio checkbox
|
||||||
const rc = () => {
|
const rc = () => {
|
||||||
if (!props.data || !props.data.content) {
|
if (!props.data || !props.data.content) {
|
||||||
console.warn('请传递 ' + props.type + '的 content')
|
console.warn('请传递 ' + props.type + '的 content')
|
||||||
}
|
}
|
||||||
let vNode: VNode[] = []
|
let vNode: VNode[] = []
|
||||||
for (const key in props.data.content) {
|
for (const key in props.data.content) {
|
||||||
vNode.push(
|
vNode.push(
|
||||||
createVNode(
|
createVNode(
|
||||||
resolveComponent('el-' + props.type),
|
resolveComponent('el-' + props.type),
|
||||||
{
|
{
|
||||||
label: key,
|
label: key,
|
||||||
...childrenAttr,
|
...childrenAttr,
|
||||||
},
|
},
|
||||||
() => props.data.content[key]
|
() => props.data.content[key]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
return () => {
|
return () => {
|
||||||
const valueComputed = computed(() => {
|
const valueComputed = computed(() => {
|
||||||
if (props.type == 'radio') {
|
if (props.type == 'radio') {
|
||||||
if (props.modelValue == undefined) return ''
|
if (props.modelValue == undefined) return ''
|
||||||
return '' + props.modelValue
|
return '' + props.modelValue
|
||||||
} else {
|
} else {
|
||||||
let modelValueArr: anyObj = []
|
let modelValueArr: anyObj = []
|
||||||
for (const key in props.modelValue) {
|
for (const key in props.modelValue) {
|
||||||
modelValueArr[key] = '' + props.modelValue[key]
|
modelValueArr[key] = '' + props.modelValue[key]
|
||||||
}
|
}
|
||||||
return modelValueArr
|
return modelValueArr
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return createVNode(
|
return createVNode(
|
||||||
resolveComponent('el-' + props.type + '-group'),
|
resolveComponent('el-' + props.type + '-group'),
|
||||||
{
|
{
|
||||||
...props.attr,
|
...props.attr,
|
||||||
modelValue: valueComputed.value,
|
modelValue: valueComputed.value,
|
||||||
'onUpdate:modelValue': onValueUpdate,
|
'onUpdate:modelValue': onValueUpdate,
|
||||||
},
|
},
|
||||||
() => vNode
|
() => vNode
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// select selects
|
// select selects
|
||||||
const select = () => {
|
const select = () => {
|
||||||
let vNode: VNode[] = []
|
let vNode: VNode[] = []
|
||||||
if (!props.data || !props.data.content) {
|
if (!props.data || !props.data.content) {
|
||||||
console.warn('请传递 ' + props.type + '的 content')
|
console.warn('请传递 ' + props.type + '的 content')
|
||||||
}
|
}
|
||||||
for (const key in props.data.content) {
|
for (const key in props.data.content) {
|
||||||
vNode.push(
|
vNode.push(
|
||||||
createVNode(resolveComponent('el-option'), {
|
createVNode(resolveComponent('el-option'), {
|
||||||
key: key,
|
key: key,
|
||||||
label: props.data.content[key],
|
label: props.data.content[key],
|
||||||
value: key,
|
value: key,
|
||||||
...childrenAttr,
|
...childrenAttr,
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
return () => {
|
return () => {
|
||||||
const valueComputed = computed(() => {
|
const valueComputed = computed(() => {
|
||||||
if (props.type == 'select') {
|
if (props.type == 'select') {
|
||||||
if (props.modelValue == undefined) return ''
|
if (props.modelValue == undefined) return ''
|
||||||
return '' + props.modelValue
|
return '' + props.modelValue
|
||||||
} else {
|
} else {
|
||||||
let modelValueArr: anyObj = []
|
let modelValueArr: anyObj = []
|
||||||
for (const key in props.modelValue) {
|
for (const key in props.modelValue) {
|
||||||
modelValueArr[key] = '' + props.modelValue[key]
|
modelValueArr[key] = '' + props.modelValue[key]
|
||||||
}
|
}
|
||||||
return modelValueArr
|
return modelValueArr
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return createVNode(
|
return createVNode(
|
||||||
resolveComponent('el-select'),
|
resolveComponent('el-select'),
|
||||||
{
|
{
|
||||||
class: 'w100',
|
class: 'w100',
|
||||||
multiple: props.type == 'select' ? false : true,
|
multiple: props.type == 'select' ? false : true,
|
||||||
clearable: true,
|
clearable: true,
|
||||||
...props.attr,
|
...props.attr,
|
||||||
modelValue: valueComputed.value,
|
modelValue: valueComputed.value,
|
||||||
'onUpdate:modelValue': onValueUpdate,
|
'onUpdate:modelValue': onValueUpdate,
|
||||||
},
|
},
|
||||||
() => vNode
|
() => vNode
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// datetime
|
// datetime
|
||||||
const datetime = () => {
|
const datetime = () => {
|
||||||
let valueFormat = 'YYYY-MM-DD HH:mm:ss'
|
let valueFormat = 'YYYY-MM-DD HH:mm:ss'
|
||||||
switch (props.type) {
|
switch (props.type) {
|
||||||
case 'date':
|
case 'date':
|
||||||
valueFormat = 'YYYY-MM-DD'
|
valueFormat = 'YYYY-MM-DD'
|
||||||
break
|
break
|
||||||
case 'year':
|
case 'year':
|
||||||
valueFormat = 'YYYY'
|
valueFormat = 'YYYY'
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
return () =>
|
return () =>
|
||||||
createVNode(resolveComponent('el-date-picker'), {
|
createVNode(resolveComponent('el-date-picker'), {
|
||||||
class: 'w100',
|
class: 'w100',
|
||||||
type: props.type,
|
type: props.type,
|
||||||
'value-format': valueFormat,
|
'value-format': valueFormat,
|
||||||
...props.attr,
|
...props.attr,
|
||||||
modelValue: props.modelValue,
|
modelValue: props.modelValue,
|
||||||
'onUpdate:modelValue': onValueUpdate,
|
'onUpdate:modelValue': onValueUpdate,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// remoteSelect remoteSelects
|
// remoteSelect remoteSelects
|
||||||
const remoteSelect = () => {
|
const remoteSelect = () => {
|
||||||
return () =>
|
return () =>
|
||||||
createVNode(RemoteSelect, {
|
createVNode(RemoteSelect, {
|
||||||
modelValue: props.modelValue,
|
modelValue: props.modelValue,
|
||||||
'onUpdate:modelValue': onValueUpdate,
|
'onUpdate:modelValue': onValueUpdate,
|
||||||
multiple: props.type == 'remoteSelect' ? false : true,
|
multiple: props.type == 'remoteSelect' ? false : true,
|
||||||
...props.attr,
|
...props.attr,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const buildFun = new Map([
|
const buildFun = new Map([
|
||||||
['string', sntp],
|
['string', sntp],
|
||||||
['number', sntp],
|
['number', sntp],
|
||||||
['textarea', sntp],
|
['textarea', sntp],
|
||||||
['password', sntp],
|
['password', sntp],
|
||||||
['radio', rc],
|
['radio', rc],
|
||||||
['checkbox', rc],
|
['checkbox', rc],
|
||||||
[
|
[
|
||||||
'switch',
|
'switch',
|
||||||
() => {
|
() => {
|
||||||
const valueType = computed(() => typeof props.modelValue)
|
const valueType = computed(() => typeof props.modelValue)
|
||||||
const valueComputed = computed(() => {
|
const valueComputed = computed(() => {
|
||||||
if (valueType.value === 'boolean') {
|
if (valueType.value === 'boolean') {
|
||||||
return props.modelValue
|
return props.modelValue
|
||||||
} else {
|
} else {
|
||||||
let valueTmp = parseInt(props.modelValue as string)
|
let valueTmp = parseInt(props.modelValue as string)
|
||||||
return isNaN(valueTmp) || valueTmp <= 0 ? false : true
|
return isNaN(valueTmp) || valueTmp <= 0 ? false : true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return () =>
|
return () =>
|
||||||
createVNode(resolveComponent('el-switch'), {
|
createVNode(resolveComponent('el-switch'), {
|
||||||
...props.attr,
|
...props.attr,
|
||||||
modelValue: valueComputed.value,
|
modelValue: valueComputed.value,
|
||||||
'onUpdate:modelValue': (value: boolean) => {
|
'onUpdate:modelValue': (value: boolean) => {
|
||||||
let newValue: boolean | string | number = value
|
let newValue: boolean | string | number = value
|
||||||
switch (valueType.value) {
|
switch (valueType.value) {
|
||||||
case 'string':
|
case 'string':
|
||||||
newValue = value ? '1' : '0'
|
newValue = value ? '1' : '0'
|
||||||
break
|
break
|
||||||
case 'number':
|
case 'number':
|
||||||
newValue = value ? 1 : 0
|
newValue = value ? 1 : 0
|
||||||
}
|
}
|
||||||
emit('update:modelValue', newValue)
|
emit('update:modelValue', newValue)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
['datetime', datetime],
|
['datetime', datetime],
|
||||||
[
|
[
|
||||||
'year',
|
'year',
|
||||||
() => {
|
() => {
|
||||||
return () => {
|
return () => {
|
||||||
const valueComputed = computed(() => (!props.modelValue ? null : '' + props.modelValue))
|
const valueComputed = computed(() => (!props.modelValue ? null : '' + props.modelValue))
|
||||||
return createVNode(resolveComponent('el-date-picker'), {
|
return createVNode(resolveComponent('el-date-picker'), {
|
||||||
class: 'w100',
|
class: 'w100',
|
||||||
type: props.type,
|
type: props.type,
|
||||||
'value-format': 'YYYY',
|
'value-format': 'YYYY',
|
||||||
...props.attr,
|
...props.attr,
|
||||||
modelValue: valueComputed.value,
|
modelValue: valueComputed.value,
|
||||||
'onUpdate:modelValue': onValueUpdate,
|
'onUpdate:modelValue': onValueUpdate,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
['date', datetime],
|
['date', datetime],
|
||||||
[
|
[
|
||||||
'time',
|
'time',
|
||||||
() => {
|
() => {
|
||||||
const valueComputed = computed(() => {
|
const valueComputed = computed(() => {
|
||||||
if (props.modelValue instanceof Date) {
|
if (props.modelValue instanceof Date) {
|
||||||
return props.modelValue
|
return props.modelValue
|
||||||
} else if (!props.modelValue) {
|
} else if (!props.modelValue) {
|
||||||
return ''
|
return ''
|
||||||
} else {
|
} else {
|
||||||
let date = new Date()
|
let date = new Date()
|
||||||
return new Date(date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() + ' ' + props.modelValue)
|
return new Date(date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() + ' ' + props.modelValue)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return () =>
|
return () =>
|
||||||
createVNode(resolveComponent('el-time-picker'), {
|
createVNode(resolveComponent('el-time-picker'), {
|
||||||
class: 'w100',
|
class: 'w100',
|
||||||
clearable: true,
|
clearable: true,
|
||||||
format: 'HH:mm:ss',
|
format: 'HH:mm:ss',
|
||||||
...props.attr,
|
...props.attr,
|
||||||
modelValue: valueComputed.value,
|
modelValue: valueComputed.value,
|
||||||
'onUpdate:modelValue': onValueUpdate,
|
'onUpdate:modelValue': onValueUpdate,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
['select', select],
|
['select', select],
|
||||||
['selects', select],
|
['selects', select],
|
||||||
[
|
[
|
||||||
'array',
|
'array',
|
||||||
() => {
|
() => {
|
||||||
return () =>
|
return () =>
|
||||||
createVNode(Array, {
|
createVNode(Array, {
|
||||||
modelValue: props.modelValue,
|
modelValue: props.modelValue,
|
||||||
'onUpdate:modelValue': onValueUpdate,
|
'onUpdate:modelValue': onValueUpdate,
|
||||||
...props.attr,
|
...props.attr,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
['remoteSelect', remoteSelect],
|
['remoteSelect', remoteSelect],
|
||||||
['remoteSelects', remoteSelect],
|
['remoteSelects', remoteSelect],
|
||||||
[
|
[
|
||||||
'city',
|
'city',
|
||||||
() => {
|
() => {
|
||||||
type Node = { value?: number; label?: string; leaf?: boolean }
|
type Node = { value?: number; label?: string; leaf?: boolean }
|
||||||
let maxLevel = props.data && props.data.level ? props.data.level - 1 : 2
|
let maxLevel = props.data && props.data.level ? props.data.level - 1 : 2
|
||||||
const lastLazyValue: {
|
const lastLazyValue: {
|
||||||
value: string | number[] | unknown
|
value: string | number[] | unknown
|
||||||
nodes: Node[]
|
nodes: Node[]
|
||||||
key: string
|
key: string
|
||||||
currentRequest: any
|
currentRequest: any
|
||||||
} = reactive({
|
} = reactive({
|
||||||
value: 'ready',
|
value: 'ready',
|
||||||
nodes: [],
|
nodes: [],
|
||||||
key: '',
|
key: '',
|
||||||
currentRequest: null,
|
currentRequest: null,
|
||||||
})
|
})
|
||||||
|
|
||||||
// 请求到的node备份-s
|
// 请求到的node备份-s
|
||||||
let nodeEbak: anyObj = {}
|
let nodeEbak: anyObj = {}
|
||||||
const getNodes = (level: number, key: string) => {
|
const getNodes = (level: number, key: string) => {
|
||||||
if (nodeEbak[level] && nodeEbak[level][key]) {
|
if (nodeEbak[level] && nodeEbak[level][key]) {
|
||||||
return nodeEbak[level][key]
|
return nodeEbak[level][key]
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
const setNodes = (level: number, key: string, nodes: Node[] = []) => {
|
const setNodes = (level: number, key: string, nodes: Node[] = []) => {
|
||||||
if (!nodeEbak[level]) {
|
if (!nodeEbak[level]) {
|
||||||
nodeEbak[level] = {}
|
nodeEbak[level] = {}
|
||||||
}
|
}
|
||||||
nodeEbak[level][key] = nodes
|
nodeEbak[level][key] = nodes
|
||||||
}
|
}
|
||||||
// 请求到的node备份-e
|
// 请求到的node备份-e
|
||||||
|
|
||||||
return () =>
|
return () =>
|
||||||
createVNode(resolveComponent('el-cascader'), {
|
createVNode(resolveComponent('el-cascader'), {
|
||||||
modelValue: props.modelValue,
|
modelValue: props.modelValue,
|
||||||
'onUpdate:modelValue': onValueUpdate,
|
'onUpdate:modelValue': onValueUpdate,
|
||||||
class: 'w100',
|
class: 'w100',
|
||||||
clearable: true,
|
clearable: true,
|
||||||
props: {
|
props: {
|
||||||
lazy: true,
|
lazy: true,
|
||||||
lazyLoad(node: any, resolve: any) {
|
lazyLoad(node: any, resolve: any) {
|
||||||
// lazyLoad会频繁触发,在本地存储请求结果,供重复触发时直接读取
|
// lazyLoad会频繁触发,在本地存储请求结果,供重复触发时直接读取
|
||||||
const { level, pathValues } = node
|
const { level, pathValues } = node
|
||||||
let key = pathValues.join(',')
|
let key = pathValues.join(',')
|
||||||
key = key ? key : 'init'
|
key = key ? key : 'init'
|
||||||
|
|
||||||
let locaNode = getNodes(level, key)
|
let locaNode = getNodes(level, key)
|
||||||
if (locaNode) {
|
if (locaNode) {
|
||||||
return resolve(locaNode)
|
return resolve(locaNode)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lastLazyValue.key == key && lastLazyValue.value == props.modelValue) {
|
if (lastLazyValue.key == key && lastLazyValue.value == props.modelValue) {
|
||||||
if (lastLazyValue.currentRequest) {
|
if (lastLazyValue.currentRequest) {
|
||||||
return lastLazyValue.currentRequest
|
return lastLazyValue.currentRequest
|
||||||
}
|
}
|
||||||
return resolve(lastLazyValue.nodes)
|
return resolve(lastLazyValue.nodes)
|
||||||
}
|
}
|
||||||
|
|
||||||
let nodes: Node[] = []
|
let nodes: Node[] = []
|
||||||
lastLazyValue.key = key
|
lastLazyValue.key = key
|
||||||
lastLazyValue.value = props.modelValue
|
lastLazyValue.value = props.modelValue
|
||||||
lastLazyValue.currentRequest = getArea(pathValues).then((res) => {
|
lastLazyValue.currentRequest = getArea(pathValues).then((res) => {
|
||||||
let toStr = false
|
let toStr = false
|
||||||
if (props.modelValue && typeof (props.modelValue as anyObj)[0] === 'string') {
|
if (props.modelValue && typeof (props.modelValue as anyObj)[0] === 'string') {
|
||||||
toStr = true
|
toStr = true
|
||||||
}
|
}
|
||||||
for (const key in res.data) {
|
for (const key in res.data) {
|
||||||
if (toStr) {
|
if (toStr) {
|
||||||
res.data[key].value = res.data[key].value.toString()
|
res.data[key].value = res.data[key].value.toString()
|
||||||
}
|
}
|
||||||
res.data[key].leaf = level >= maxLevel
|
res.data[key].leaf = level >= maxLevel
|
||||||
nodes.push(res.data[key])
|
nodes.push(res.data[key])
|
||||||
}
|
}
|
||||||
lastLazyValue.nodes = nodes
|
lastLazyValue.nodes = nodes
|
||||||
lastLazyValue.currentRequest = null
|
lastLazyValue.currentRequest = null
|
||||||
setNodes(level, key, nodes)
|
setNodes(level, key, nodes)
|
||||||
resolve(nodes)
|
resolve(nodes)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
...props.attr,
|
...props.attr,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
['image', upload],
|
['image', upload],
|
||||||
['images', upload],
|
['images', upload],
|
||||||
['file', upload],
|
['file', upload],
|
||||||
['files', upload],
|
['files', upload],
|
||||||
[
|
[
|
||||||
'icon',
|
'icon',
|
||||||
() => {
|
() => {
|
||||||
return () =>
|
return () =>
|
||||||
createVNode(IconSelector, {
|
createVNode(IconSelector, {
|
||||||
modelValue: props.modelValue,
|
modelValue: props.modelValue,
|
||||||
'onUpdate:modelValue': onValueUpdate,
|
'onUpdate:modelValue': onValueUpdate,
|
||||||
...props.attr,
|
...props.attr,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'color',
|
'color',
|
||||||
() => {
|
() => {
|
||||||
return () =>
|
return () =>
|
||||||
createVNode(resolveComponent('el-color-picker'), {
|
createVNode(resolveComponent('el-color-picker'), {
|
||||||
modelValue: props.modelValue,
|
modelValue: props.modelValue,
|
||||||
'onUpdate:modelValue': onValueUpdate,
|
'onUpdate:modelValue': onValueUpdate,
|
||||||
...props.attr,
|
...props.attr,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'editor',
|
'editor',
|
||||||
() => {
|
() => {
|
||||||
return () =>
|
return () =>
|
||||||
createVNode(Editor, {
|
createVNode(Editor, {
|
||||||
modelValue: props.modelValue,
|
modelValue: props.modelValue,
|
||||||
'onUpdate:modelValue': onValueUpdate,
|
'onUpdate:modelValue': onValueUpdate,
|
||||||
...props.attr,
|
...props.attr,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'default',
|
'default',
|
||||||
() => {
|
() => {
|
||||||
console.warn('暂不支持' + props.type + '的输入框类型,你可以自行在 BaInput 组件内添加逻辑')
|
console.warn('暂不支持' + props.type + '的输入框类型,你可以自行在 BaInput 组件内添加逻辑')
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
])
|
])
|
||||||
|
|
||||||
let action = buildFun.get(props.type) || buildFun.get('default')
|
let action = buildFun.get(props.type) || buildFun.get('default')
|
||||||
return action!.call(this)
|
return action!.call(this)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.ba-upload-image :deep(.el-upload--picture-card) {
|
.ba-upload-image :deep(.el-upload--picture-card) {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
.ba-upload-file :deep(.el-upload-list) {
|
.ba-upload-file :deep(.el-upload-list) {
|
||||||
margin-left: -10px;
|
margin-left: -10px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -202,6 +202,8 @@ const tableStore: any = new TableStore({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
tableStore.table.params.deptId = dictData.state.area[0].id
|
tableStore.table.params.deptId = dictData.state.area[0].id
|
||||||
|
tableStore.table.params.alarmDayLimit = 5
|
||||||
|
tableStore.table.params.warnDayLimit = 1
|
||||||
const echart = () => {
|
const echart = () => {
|
||||||
percentage.value = {
|
percentage.value = {
|
||||||
color: ['#FF9100'],
|
color: ['#FF9100'],
|
||||||
|
|||||||
@@ -1,54 +1,54 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog v-if="isModal" size="50%" v-model="visibles" @cancel="cancel" v-bind="$attrs" :append-to-body="true">
|
<el-dialog v-if="isModal" size="50%" v-model="visibles" @cancel="cancel" v-bind="$attrs" :append-to-body="true">
|
||||||
<template v-for="slotKey in slotKeys" #[slotKey]>
|
<template v-for="slotKey in slotKeys" #[slotKey]>
|
||||||
<slot :name="slotKey" />
|
<slot :name="slotKey" />
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
<el-drawer v-else size="50%" v-model="visibles" v-bind="$attrs" :append-to-body="true" :footer-style="{ textAlign: 'right' }">
|
<el-drawer v-else size="50%" v-model="visibles" v-bind="$attrs" :append-to-body="true" :footer-style="{ textAlign: 'right' }">
|
||||||
<template v-for="slotKey in slotKeys" #[slotKey]>
|
<template v-for="slotKey in slotKeys" #[slotKey]>
|
||||||
<slot :name="slotKey" />
|
<slot :name="slotKey" />
|
||||||
</template>
|
</template>
|
||||||
</el-drawer>
|
</el-drawer>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapState } from 'pinia'
|
import { mapState } from 'pinia'
|
||||||
import { globalStore } from '@/stores/indexs'
|
// import { globalStore } from '@/stores/indexs'
|
||||||
|
|
||||||
const FormContainerTypeEnum = {
|
const FormContainerTypeEnum = {
|
||||||
DRAWER: 'drawer',
|
DRAWER: 'drawer',
|
||||||
MODAL: 'modal'
|
MODAL: 'modal'
|
||||||
}
|
}
|
||||||
export default {
|
export default {
|
||||||
inheritAttrs: false,
|
inheritAttrs: false,
|
||||||
props: {
|
props: {
|
||||||
visible: {
|
visible: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
required: true
|
required: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(globalStore, ['formStyle']),
|
// ...mapState(globalStore, ['formStyle']),
|
||||||
slotKeys() {
|
slotKeys() {
|
||||||
return Object.keys(this.$slots)
|
return Object.keys(this.$slots)
|
||||||
},
|
},
|
||||||
isModal() {
|
isModal() {
|
||||||
return FormContainerTypeEnum.MODAL === this.formStyle
|
return FormContainerTypeEnum.MODAL === this.formStyle
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
visibles: ''
|
visibles: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
cancel() {
|
cancel() {
|
||||||
this.$emit('close')
|
this.$emit('close')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.visibles = this.visible
|
this.visibles = this.visible
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
label-position="left"
|
label-position="left"
|
||||||
:inline="true"
|
:inline="true"
|
||||||
>
|
>
|
||||||
<el-form-item v-if="datePicker" style="grid-column: span 2; max-width: 620px">
|
<el-form-item v-if="datePicker" style="grid-column: span 2; max-width: 630px">
|
||||||
<template #label>
|
<template #label>
|
||||||
<el-checkbox v-if="showTimeAll" v-model="timeAll" label="时间" />
|
<el-checkbox v-if="showTimeAll" v-model="timeAll" label="时间" />
|
||||||
<span v-else>{{ dateLabel }}</span>
|
<span v-else>{{ dateLabel }}</span>
|
||||||
|
|||||||
@@ -34,7 +34,11 @@
|
|||||||
<div class="divBox">
|
<div class="divBox">
|
||||||
<span class="iconfont icon-qiyezongshu" style="color: #57bc6e"></span>
|
<span class="iconfont icon-qiyezongshu" style="color: #57bc6e"></span>
|
||||||
<span class="divBox_title">监测点总数</span>
|
<span class="divBox_title">监测点总数</span>
|
||||||
<span class="divBox_num text-style" style="color: #57bc6e" @click="totalTable(101, '')">
|
<span
|
||||||
|
class="divBox_num text-style"
|
||||||
|
style="color: #57bc6e"
|
||||||
|
@click="totalTable(100001, '')"
|
||||||
|
>
|
||||||
{{ monitoringPoints.runNum }}
|
{{ monitoringPoints.runNum }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -105,7 +109,7 @@
|
|||||||
<span
|
<span
|
||||||
style="width: 90px; color: #388e3c"
|
style="width: 90px; color: #388e3c"
|
||||||
class="text text-style"
|
class="text text-style"
|
||||||
@click="renderTable(o.detailList, 101, o.citName + '_')"
|
@click="renderTable(o.detailList, 100001, o.citName + '_')"
|
||||||
>
|
>
|
||||||
{{ o.citTotalNum }}
|
{{ o.citTotalNum }}
|
||||||
</span>
|
</span>
|
||||||
@@ -156,7 +160,7 @@
|
|||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</vxe-column>
|
</vxe-column>
|
||||||
<vxe-column field="cit" title="参数地市" width="110px"></vxe-column>
|
<vxe-column field="cit" title="所在地市" width="110px"></vxe-column>
|
||||||
<vxe-column field="company" title="供电公司"></vxe-column>
|
<vxe-column field="company" title="供电公司"></vxe-column>
|
||||||
<vxe-column field="subStation" title="变电站"></vxe-column>
|
<vxe-column field="subStation" title="变电站"></vxe-column>
|
||||||
<vxe-column field="manufacturer" title="终端厂家"></vxe-column>
|
<vxe-column field="manufacturer" title="终端厂家"></vxe-column>
|
||||||
@@ -242,7 +246,6 @@ const runFlagList = [
|
|||||||
{ id: 3, name: '调试' },
|
{ id: 3, name: '调试' },
|
||||||
{ id: 4, name: '退运' }
|
{ id: 4, name: '退运' }
|
||||||
]
|
]
|
||||||
// Statistical_Type
|
|
||||||
|
|
||||||
const segmented = ref('Power_Network')
|
const segmented = ref('Power_Network')
|
||||||
|
|
||||||
@@ -261,7 +264,6 @@ const tableStore = new TableStore({
|
|||||||
tableStore.table.params.statisticalType = segmentedList.filter(item => item.code === segmented.value)[0]
|
tableStore.table.params.statisticalType = segmentedList.filter(item => item.code === segmented.value)[0]
|
||||||
},
|
},
|
||||||
loadCallback: () => {
|
loadCallback: () => {
|
||||||
// tableStore.table.data
|
|
||||||
monitoringPoints.value.runNum = tableStore.table.data.totalNum
|
monitoringPoints.value.runNum = tableStore.table.data.totalNum
|
||||||
monitoringPoints.value.abnormalNum = tableStore.table.data.belowNum
|
monitoringPoints.value.abnormalNum = tableStore.table.data.belowNum
|
||||||
monitoringPoints.value.totalOnlineRate = tableStore.table.data.totalOnlineRate - 0
|
monitoringPoints.value.totalOnlineRate = tableStore.table.data.totalOnlineRate - 0
|
||||||
@@ -272,14 +274,14 @@ const tableStore = new TableStore({
|
|||||||
.map((item: any) => item.detailList)
|
.map((item: any) => item.detailList)
|
||||||
.flat()
|
.flat()
|
||||||
.reduce((map: any, item: any) => {
|
.reduce((map: any, item: any) => {
|
||||||
if (!map.has(item.deviceId)) {
|
if (!map.has(item.lineId)) {
|
||||||
map.set(item.deviceId, item)
|
map.set(item.lineId, item)
|
||||||
}
|
}
|
||||||
return map
|
return map
|
||||||
}, new Map())
|
}, new Map())
|
||||||
.values()
|
.values()
|
||||||
)
|
)
|
||||||
totalTable(101, '')
|
totalTable(100001, '')
|
||||||
echart()
|
echart()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -346,7 +348,7 @@ const echart = () => {
|
|||||||
name: '异常占比',
|
name: '异常占比',
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
barWidth: 13,
|
barWidth: 13,
|
||||||
data: [monitoringPoints.value.totalOnlineRate ==0?'':monitoringPoints.value.totalOnlineRate],
|
data: [monitoringPoints.value.totalOnlineRate == 0 ? '' : monitoringPoints.value.totalOnlineRate],
|
||||||
z: 0,
|
z: 0,
|
||||||
zlevel: 0,
|
zlevel: 0,
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
<div class="divBox">
|
<div class="divBox">
|
||||||
<span class="iconfont icon-qiyezongshu" style="color: #57bc6e"></span>
|
<span class="iconfont icon-qiyezongshu" style="color: #57bc6e"></span>
|
||||||
<span class="divBox_title">终端总数</span>
|
<span class="divBox_title">终端总数</span>
|
||||||
<span class="divBox_num text-style" style="color: #57bc6e" @click="totalTable(101, '')">
|
<span class="divBox_num text-style" style="color: #57bc6e" @click="totalTable(100001, '')">
|
||||||
{{ monitoringPoints.runNum }}
|
{{ monitoringPoints.runNum }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -105,7 +105,7 @@
|
|||||||
<span
|
<span
|
||||||
style="width: 90px; color: #388e3c"
|
style="width: 90px; color: #388e3c"
|
||||||
class="text text-style"
|
class="text text-style"
|
||||||
@click="renderTable(o.detailList, 101, o.citName + '_')"
|
@click="renderTable(o.detailList, 100001, o.citName + '_')"
|
||||||
>
|
>
|
||||||
{{ o.citTotalNum }}
|
{{ o.citTotalNum }}
|
||||||
</span>
|
</span>
|
||||||
@@ -156,7 +156,7 @@
|
|||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</vxe-column>
|
</vxe-column>
|
||||||
<vxe-column field="cit" title="参数地市" width="110px"></vxe-column>
|
<vxe-column field="cit" title="所在地市" width="110px"></vxe-column>
|
||||||
<vxe-column field="company" title="供电公司"></vxe-column>
|
<vxe-column field="company" title="供电公司"></vxe-column>
|
||||||
<vxe-column field="subStation" title="变电站"></vxe-column>
|
<vxe-column field="subStation" title="变电站"></vxe-column>
|
||||||
<vxe-column field="manufacturer" title="终端厂家"></vxe-column>
|
<vxe-column field="manufacturer" title="终端厂家"></vxe-column>
|
||||||
@@ -259,7 +259,6 @@ const tableStore = new TableStore({
|
|||||||
tableStore.table.params.statisticalType = segmentedList.filter(item => item.code === segmented.value)[0]
|
tableStore.table.params.statisticalType = segmentedList.filter(item => item.code === segmented.value)[0]
|
||||||
},
|
},
|
||||||
loadCallback: () => {
|
loadCallback: () => {
|
||||||
// tableStore.table.data
|
|
||||||
monitoringPoints.value.runNum = tableStore.table.data.totalNum
|
monitoringPoints.value.runNum = tableStore.table.data.totalNum
|
||||||
monitoringPoints.value.abnormalNum = tableStore.table.data.belowNum
|
monitoringPoints.value.abnormalNum = tableStore.table.data.belowNum
|
||||||
monitoringPoints.value.totalOnlineRate = tableStore.table.data.totalOnlineRate - 0
|
monitoringPoints.value.totalOnlineRate = tableStore.table.data.totalOnlineRate - 0
|
||||||
@@ -278,7 +277,7 @@ const tableStore = new TableStore({
|
|||||||
.values()
|
.values()
|
||||||
)
|
)
|
||||||
|
|
||||||
totalTable(101, '')
|
totalTable(100001, '')
|
||||||
echart()
|
echart()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -138,7 +138,7 @@
|
|||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</vxe-column>
|
</vxe-column>
|
||||||
<vxe-column field="cit" title="参数地市" width="110px"></vxe-column>
|
<vxe-column field="cit" title="所在地市" width="110px"></vxe-column>
|
||||||
<vxe-column field="company" title="供电公司"></vxe-column>
|
<vxe-column field="company" title="供电公司"></vxe-column>
|
||||||
<vxe-column field="subName" title="变电站"></vxe-column>
|
<vxe-column field="subName" title="变电站"></vxe-column>
|
||||||
<vxe-column field="manufacturer" title="终端厂家"></vxe-column>
|
<vxe-column field="manufacturer" title="终端厂家"></vxe-column>
|
||||||
|
|||||||
Reference in New Issue
Block a user