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) emit('change', e)
} }
myValue.value = props.modelValue watch(() => props.modelValue, () => {
myValue.value = props.modelValue
}, { immediate: true })
if (props.itemType === 'object') { if (props.itemType === 'object') {
objectValue.value = props.modelValue as string objectValue.value = props.modelValue as string

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -75,16 +75,18 @@ const formModel = reactive({
functionData: props.functionParameters functionData: props.functionParameters
}) })
const handlePropertiesOptions = (propertiesItem: any) => { const handlePropertiesOptions = (propertiesValueType: any) => {
const _type = propertiesItem?.valueType.type const _type = propertiesValueType?.type
if (_type === 'boolean') { if (_type === 'boolean') {
return [ return [
{ label: propertiesItem.valueType.falseText || '是', value: propertiesItem.valueType.falseValue || false }, { label: propertiesValueType?.falseText || '是', value: propertiesValueType?.falseValue || false },
{ label: propertiesItem.valueType.trueText || '否', value: propertiesItem.valueType.trueValue || true }, { 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 = [] const arrCache = []
if (functionItem) { if (functionItem) {
const properties = functionItem.valueType ? functionItem.valueType.properties : functionItem.inputs; const properties = functionItem.input?.properties || functionItem.inputs;
for (const datum of properties) { for (const datum of properties) {
arrCache.push({ arrCache.push({
id: datum.id, id: datum.id,
name: datum.name, name: datum.name,
type: datum.valueType ? datum.valueType.type : '-', type: datum.valueType?.type || '-',
format: datum.valueType ? datum.valueType.format : undefined, format: datum.valueType?.format || undefined,
options: handlePropertiesOptions(datum), options: handlePropertiesOptions(datum.valueType),
value: undefined, value: undefined,
}); });
} }
@ -113,12 +115,10 @@ const functionData = computed(() => {
const rules = [{ const rules = [{
validator(_: string, value: any) { validator(_: string, value: any) {
console.log(value)
if (!value?.length && functionData.value.length) { if (!value?.length && functionData.value.length) {
return Promise.reject('请输入功能值') return Promise.reject('请输入功能值')
} else { } else {
let hasValue = value.find((item: { name: string, value: any}) => item.value === undefined) let hasValue = value.find((item: { name: string, value: any}) => item.value === undefined)
console.log('hasValue', hasValue)
if (hasValue) { if (hasValue) {
const functionItem = functionData.value.find((item: any) => item.id === hasValue.name) const functionItem = functionData.value.find((item: any) => item.id === hasValue.name)
return Promise.reject(functionItem?.name ? `请输入${functionItem?.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 writeForm = ref()
const _value = 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 callDataOptions = computed(() => {
const _valueKeys = Object.keys(props.value) const _valueKeys = Object.keys(props.value)
if (_valueKeys.length) { if (_valueKeys.length) {
return _valueKeys.map(key => { return _valueKeys.map(key => {
const item: any = props.properties.find((p: any) => p.id === key) const item: any = props.properties.find((p: any) => p.id === key)
console.log(item, props.value, key)
if (item) { if (item) {
const _options = handleOptions(item, item.valueType?.type)
return { return {
id: item.id, id: item.id,
name: item.name, name: item.name,
type: item.valueType ? item.valueType.type : '-', type: item.valueType ? item.valueType.type : '-',
format: item.valueType ? item.valueType.format : undefined, format: item.valueType ? item.valueType.format : undefined,
options: item.valueType ? item.valueType.element : undefined, options: _options,
value: props.value[key] value: props.value[key]
} }
} }
@ -96,7 +110,7 @@ const callDataOptions = computed(() => {
type: '', type: '',
format: undefined, format: undefined,
options: undefined, options: undefined,
value: props.value[key] value: undefined
} }
}) })
} }

View File

@ -35,7 +35,7 @@
<ValueItem <ValueItem
v-model:modelValue='record.value' v-model:modelValue='record.value'
:itemType="record.type" :itemType="record.type"
:options="handleOptions(record)" :options="record.options"
@change='valueChange' @change='valueChange'
/> />
</div> </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 valueChange = () => {
const _value = dataSource.value.map(item => { const _value = dataSource.value.map(item => {
return { return {

View File

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