Merge branch 'dev' of github.com:jetlinks/jetlinks-ui-vue into dev

This commit is contained in:
jackhoo_98 2023-03-30 18:10:34 +08:00
commit db06aa023b
10 changed files with 143 additions and 128 deletions

View File

@ -211,7 +211,9 @@ const dateChange = (e: any) => {
emit('change', e)
}
myValue.value = props.modelValue
watch(() => props.modelValue, () => {
myValue.value = props.modelValue
}, { immediate: true })
if (props.itemType === 'object') {
objectValue.value = props.modelValue as string

View File

@ -6,6 +6,7 @@
target="iot-card-management-search"
@search="handleSearch"
/>
<FullPage>
<j-pro-table
:scroll="{ x: 1366 }"
ref="cardManageRef"
@ -372,6 +373,7 @@
</j-space>
</template>
</j-pro-table>
</FullPage>
<!-- 批量导入 -->
<Import v-if="importVisible" @close="importVisible = false" @save="importSave"/>
<!-- 批量导出 -->

View File

@ -100,10 +100,11 @@
@change="getTopRang"
/></template>
</Guide>
<FullPage v-if="topList.length !== 0">
<div
v-if="topList.length !== 0"
class="rankingList"
style="min-height: 490px"
>
<div
v-for="(item, index) in topList"
@ -135,6 +136,7 @@
</div>
</div>
</div>
</FullPage>
<div class="empty-body" v-else>
<j-empty :image="Empty.PRESENTED_IMAGE_SIMPLE" />
</div>

View File

@ -2,83 +2,85 @@
<template>
<page-container>
<pro-search :columns="columns" target="platform-search" @search="handleSearch" />
<j-pro-table ref="platformRef" :columns="columns" :request="queryList"
:defaultParams="{ sorts: [{ name: 'createTime', order: 'desc' }] }" :params="params" :gridColumn="3">
<template #headerTitle>
<j-space>
<!-- <j-button type="primary" @click="handleAdd">
<AIcon type="PlusOutlined" />新增
</j-button> -->
<PermissionButton @click="handleAdd" :hasPermission="'iot-card/Platform:add'" type="primary">
<AIcon type="PlusOutlined" />新增
</PermissionButton>
</j-space>
</template>
<template #card="slotProps">
<CardBox :value="slotProps" :actions="getActions(slotProps, 'card')" v-bind="slotProps"
:status="slotProps.state.value" :statusText="slotProps.state.text" :statusNames="{
enabled: 'success',
disabled: 'error',
}">
<template #img>
<slot name="img">
<img :src="getImage('/iot-card/iot-card-bg.png')" />
</slot>
</template>
<template #content>
<h3 style='font-size: 16px;width: calc(100% - 90px)'>
<Ellipsis>
{{ slotProps.name }}
</Ellipsis>
</h3>
<j-row>
<j-col :span="12">
<div class="card-item-content-text">
平台类型
</div>
<div>{{ slotProps.operatorName }}</div>
</j-col>
<j-col :span="12">
<div class="card-item-content-text">说明</div>
<Ellipsis>{{ slotProps.explain }}</Ellipsis>
</j-col>
</j-row>
</template>
<template #actions="item">
<PermissionButton :disabled="item.disabled" :popConfirm="item.popConfirm" :tooltip="{
...item.tooltip,
}" @click="item.onClick" :hasPermission="'iot-card/Platform:' + item.key">
<AIcon type="DeleteOutlined" v-if="item.key === 'delete'" />
<template v-else>
<AIcon :type="item.icon" />
<span>{{ item?.text }}</span>
</template>
</PermissionButton>
</template>
</CardBox>
</template>
<template #state="slotProps">
<j-badge :text="slotProps.state.text" :status="
slotProps.state.value === 'disabled'
? 'error'
: 'success'
" />
</template>
<template #action="slotProps">
<j-space :size="16">
<template v-for="i in getActions(slotProps, 'table')" :key="i.key">
<PermissionButton :disabled="i.disabled" :popConfirm="i.popConfirm" :tooltip="{
...i.tooltip,
}" @click="i.onClick" type="link" style="padding: 0px"
:hasPermission="'iot-card/Platform:' + i.key">
<template #icon>
<AIcon :type="i.icon" />
</template>
</PermissionButton>
</template>
</j-space>
</template>
</j-pro-table>
<FullPage>
<j-pro-table ref="platformRef" :columns="columns" :request="queryList"
:defaultParams="{ sorts: [{ name: 'createTime', order: 'desc' }] }" :params="params" :gridColumn="3">
<template #headerTitle>
<j-space>
<!-- <j-button type="primary" @click="handleAdd">
<AIcon type="PlusOutlined" />新增
</j-button> -->
<PermissionButton @click="handleAdd" :hasPermission="'iot-card/Platform:add'" type="primary">
<AIcon type="PlusOutlined" />新增
</PermissionButton>
</j-space>
</template>
<template #card="slotProps">
<CardBox :value="slotProps" :actions="getActions(slotProps, 'card')" v-bind="slotProps"
:status="slotProps.state.value" :statusText="slotProps.state.text" :statusNames="{
enabled: 'processing',
disabled: 'error',
}">
<template #img>
<slot name="img">
<img :src="getImage('/iot-card/iot-card-bg.png')" />
</slot>
</template>
<template #content>
<h3 style='font-size: 16px;width: calc(100% - 90px)'>
<Ellipsis>
{{ slotProps.name }}
</Ellipsis>
</h3>
<j-row>
<j-col :span="12">
<div class="card-item-content-text">
平台类型
</div>
<div>{{ slotProps.operatorName }}</div>
</j-col>
<j-col :span="12">
<div class="card-item-content-text">说明</div>
<Ellipsis>{{ slotProps.explain }}</Ellipsis>
</j-col>
</j-row>
</template>
<template #actions="item">
<PermissionButton :disabled="item.disabled" :popConfirm="item.popConfirm" :tooltip="{
...item.tooltip,
}" @click="item.onClick" :hasPermission="'iot-card/Platform:' + item.key">
<AIcon type="DeleteOutlined" v-if="item.key === 'delete'" />
<template v-else>
<AIcon :type="item.icon" />
<span>{{ item?.text }}</span>
</template>
</PermissionButton>
</template>
</CardBox>
</template>
<template #state="slotProps">
<j-badge :text="slotProps.state.text" :status="
slotProps.state.value === 'disabled'
? 'error'
: 'success'
" />
</template>
<template #action="slotProps">
<j-space :size="16">
<template v-for="i in getActions(slotProps, 'table')" :key="i.key">
<PermissionButton :disabled="i.disabled" :popConfirm="i.popConfirm" :tooltip="{
...i.tooltip,
}" @click="i.onClick" type="link" style="padding: 0px"
:hasPermission="'iot-card/Platform:' + i.key">
<template #icon>
<AIcon :type="i.icon" />
</template>
</PermissionButton>
</template>
</j-space>
</template>
</j-pro-table>
</FullPage>
</page-container>
</template>

View File

@ -2,6 +2,7 @@
<template>
<page-container>
<pro-search :columns="columns" target="recharge-search" @search="handleSearch" />
<FullPage>
<j-pro-table
ref="rechargeRef"
:columns="columns"
@ -62,6 +63,7 @@
</j-space>
</template>
</j-pro-table>
</FullPage>
<!-- 充值 -->
<Save v-if="visible" @change="saveChange" />
<Detail v-if="detailVisible" :data="current" @close="close" />

View File

@ -6,29 +6,31 @@
target="record-search"
@search="handleSearch"
/>
<j-pro-table
ref="RecordRef"
:columns="columns"
:request="queryList"
:defaultParams="{
pageSize: 10,
sorts: [{ name: 'time', order: 'desc' }],
}"
:pagination="{
showSizeChanger: true,
pageSizeOptions: ['10', '20', '50', '100'],
}"
:params="params"
:model="'TABLE'"
>
<template #time="slotProps">
{{
slotProps.time
? moment(slotProps.time).format('YYYY-MM-DD HH:mm:ss')
: ''
}}
</template>
</j-pro-table>
<FullPage>
<j-pro-table
ref="RecordRef"
:columns="columns"
:request="queryList"
:defaultParams="{
pageSize: 10,
sorts: [{ name: 'time', order: 'desc' }],
}"
:pagination="{
showSizeChanger: true,
pageSizeOptions: ['10', '20', '50', '100'],
}"
:params="params"
:model="'TABLE'"
>
<template #time="slotProps">
{{
slotProps.time
? moment(slotProps.time).format('YYYY-MM-DD HH:mm:ss')
: ''
}}
</template>
</j-pro-table>
</FullPage>
</page-container>
</template>

View File

@ -75,16 +75,18 @@ const formModel = reactive({
functionData: props.functionParameters
})
const handlePropertiesOptions = (propertiesItem: any) => {
const _type = propertiesItem?.valueType.type
const handlePropertiesOptions = (propertiesValueType: any) => {
const _type = propertiesValueType?.type
if (_type === 'boolean') {
return [
{ label: propertiesItem.valueType.falseText || '是', value: propertiesItem.valueType.falseValue || false },
{ label: propertiesItem.valueType.trueText || '否', value: propertiesItem.valueType.trueValue || true },
{ label: propertiesValueType?.falseText || '是', value: propertiesValueType?.falseValue || false },
{ label: propertiesValueType?.trueText || '否', value: propertiesValueType?.trueValue || true },
]
} else if (_type === 'enum') {
return propertiesValueType?.elements?.map((a: any) => ({ ...a, label: a.text }))
}
return propertiesItem.valueType?.elements
return propertiesValueType?.elements
}
/**
@ -95,14 +97,14 @@ const functionData = computed(() => {
const arrCache = []
if (functionItem) {
const properties = functionItem.valueType ? functionItem.valueType.properties : functionItem.inputs;
const properties = functionItem.input?.properties || functionItem.inputs;
for (const datum of properties) {
arrCache.push({
id: datum.id,
name: datum.name,
type: datum.valueType ? datum.valueType.type : '-',
format: datum.valueType ? datum.valueType.format : undefined,
options: handlePropertiesOptions(datum),
type: datum.valueType?.type || '-',
format: datum.valueType?.format || undefined,
options: handlePropertiesOptions(datum.valueType),
value: undefined,
});
}
@ -113,12 +115,10 @@ const functionData = computed(() => {
const rules = [{
validator(_: string, value: any) {
console.log(value)
if (!value?.length && functionData.value.length) {
return Promise.reject('请输入功能值')
} else {
let hasValue = value.find((item: { name: string, value: any}) => item.value === undefined)
console.log('hasValue', hasValue)
if (hasValue) {
const functionItem = functionData.value.find((item: any) => item.id === hasValue.name)
return Promise.reject(functionItem?.name ? `请输入${functionItem?.name}` : '请输入功能值')

View File

@ -75,18 +75,32 @@ const callData = ref<Array<{ id: string, value: string | undefined }>>()
const writeForm = ref()
const _value = ref([])
const handleOptions = (item: any, type: string) => {
if (type === 'enum') {
return item.valueType.elements?.map((a: any) => ({ ...a, label: a.text }))
} else if (type === 'boolean') {
return [
{ label: item.valueType.trueText, value: item.valueType.trueValue },
{ label: item.valueType.falseText, value: item.valueType.falseValue },
]
}
return undefined
}
const callDataOptions = computed(() => {
const _valueKeys = Object.keys(props.value)
if (_valueKeys.length) {
return _valueKeys.map(key => {
const item: any = props.properties.find((p: any) => p.id === key)
console.log(item, props.value, key)
if (item) {
const _options = handleOptions(item, item.valueType?.type)
return {
id: item.id,
name: item.name,
type: item.valueType ? item.valueType.type : '-',
format: item.valueType ? item.valueType.format : undefined,
options: item.valueType ? item.valueType.element : undefined,
options: _options,
value: props.value[key]
}
}
@ -96,7 +110,7 @@ const callDataOptions = computed(() => {
type: '',
format: undefined,
options: undefined,
value: props.value[key]
value: undefined
}
})
}

View File

@ -35,7 +35,7 @@
<ValueItem
v-model:modelValue='record.value'
:itemType="record.type"
:options="handleOptions(record)"
:options="record.options"
@change='valueChange'
/>
</div>
@ -87,17 +87,6 @@ const columns = [
},
]
const handleOptions = (record: any) => {
switch(record.type) {
case 'enum':
return (record?.options?.elements || []).map((item: any) => ({ label: item.text, value: item.value }))
case 'boolean':
return record?.options
default:
return undefined
}
}
const valueChange = () => {
const _value = dataSource.value.map(item => {
return {

View File

@ -38,7 +38,7 @@
保存
</PermissionButton>
</div>
<FullPage>
</FullPage>
</page-container>
</template>