Merge branch 'master' of http://47.109.37.87:3000/by2025/admin-vben5
Some checks failed
/ Explore-Gitea-Actions (push) Failing after 11m7s

This commit is contained in:
FLL 2025-08-21 14:25:19 +08:00
commit 29df30ee82
12 changed files with 229 additions and 133 deletions

View File

@ -10,28 +10,39 @@ jobs:
- name: 拉取代码仓库
uses: http://git.missmoc.top/mocheng/checkout@v4
- name: Set up Node.js ${{ matrix.node-version }}
- name: Set up Node.js
uses: http://git.missmoc.top/mocheng/setup-node@v3
with:
node-version: 20.x
- name: pnpm
run: npm i pnpm -g
- name: node
run: |
pnpm config set registry https://registry.npmmirror.com
pnpm install
- name: Build
- name: 安装pnpm
run: npm i pnpm -g
- name: 安装依赖
run: pnpm install
continue-on-error: false # 依赖安装失败则终止工作流
- name: 构建项目
run: pnpm build:antd
- name: copy file via ssh password
continue-on-error: false # 构建失败则终止工作流
- name: 检查构建结果
run: |
if [ ! -d "./apps/web-antd/dist" ]; then
echo "构建目录不存在,构建失败"
exit 1
fi
if [ -z "$(ls -A ./apps/web-antd/dist)" ]; then
echo "构建目录为空,构建失败"
exit 1
fi
- name: 通过SSH复制文件
uses: http://git.missmoc.top/mocheng/scp-action@v0.1.7
with:
host: 127.0.0.1
username: ${ { SERVER_NAME } }
password: ${{ SERVER_PWD}}
username: ${{ secrets.SERVER_NAME }} # 使用secrets存储
password: ${{ secrets.SERVER_PWD }} # 使用secrets存储
port: 11001
source: "./apps/web-antd/dist"
target: "/www/wwwroot/183.230.235.66_11010/property"

View File

@ -59,3 +59,21 @@ export function lightInfoUpdate(data: LightInfoForm) {
export function lightInfoRemove(id: ID | IDS) {
return requestClient.deleteWithMsg<void>(`/property/lightInfo/${id}`);
}
/**
*
* @param data
* @returns void
*/
export function switchSingleLight(data: LightInfoForm) {
return requestClient.postWithMsg<void>('/property/lightInfo/switch', data);
}
/**
*
* @param data
* @returns void
*/
export function switchBatchLight(data: LightInfoForm) {
return requestClient.postWithMsg<void>('/property/lightInfo/switch', data);
}

View File

@ -14,7 +14,7 @@ export interface LightInfoVO {
/**
* 01
*/
isOn: number;
isOn: boolean;
/**
*
@ -62,7 +62,7 @@ export interface LightInfoForm extends BaseEntity {
/**
* 01
*/
isOn?: number;
isOn: boolean;
/**
*

View File

@ -1,5 +1,5 @@
<script setup lang="ts">
import {reactive, shallowRef} from 'vue';
import {reactive, ref} from 'vue';
import {useVbenModal} from '@vben/common-ui';
import {questionnaireInfo} from "#/api/property/customerService/questionnaire/questionnaire";
import type {
@ -33,7 +33,7 @@ const [BasicModal, modalApi] = useVbenModal({
},
});
const questionnaireDetail = shallowRef<null | QuestionnaireVO>(null);
const questionnaireDetail = ref<null | QuestionnaireVO>(null);
async function handleOpenChange(open: boolean) {
if (!open) {
@ -44,7 +44,6 @@ async function handleOpenChange(open: boolean) {
questionnaireDetail.value = await questionnaireInfo(id);
if (questionnaireDetail.value.questionnaireQuestionVos) {
questionnaireDetail.value.questionnaireQuestionVos.forEach(item => {
item.answer = ''
if (item.questionnaireQuestionItemVos) {
item.options = item.questionnaireQuestionItemVos.map(item => item.itemContent)
}

View File

@ -35,10 +35,10 @@ async function loadTree() {
showTreeSkeleton.value = false;
}
async function handleReload() {
await loadTree();
emit('reload');
}
// async function handleReload() {
// await loadTree();
// emit('reload');
// }
onMounted(loadTree);
</script>
@ -87,13 +87,6 @@ onMounted(loadTree);
</template>
<style scoped lang="scss">
:deep(html),
:deep(body),
:deep(#app) {
height: 100%;
margin: 0;
padding: 0;
}
.bg-background{
background-color: white;
:deep(.ant-tree){

View File

@ -370,6 +370,7 @@ onBeforeUnmount(() => {
.left-content {
flex: 1;
height: 95vh;
}
.right-content {
@ -468,14 +469,14 @@ onBeforeUnmount(() => {
}
.chart-placeholder {
height: 310px;
height: 36vh;
display: flex;
align-items: center;
justify-content: center;
border-radius: 4px;
}
.power-chart{
height: 47vh;
height: 38vh;
display: flex;
align-items: center;
justify-content: center;

View File

@ -22,7 +22,6 @@ export const columns: VxeGridProps['columns'] = [
title: '位置描述',
field: 'locationRemark',
},
{
title: '楼 层',
field: 'floorName',
@ -30,7 +29,7 @@ export const columns: VxeGridProps['columns'] = [
{
title: '开关状态',
field: 'isOn',
slots: { default: 'isOn' },
slots: { default: 'isOn' },
},
{
field: 'action',

View File

@ -0,0 +1,81 @@
<script setup lang="ts">
import type { PropType } from 'vue'
import { onMounted, ref } from 'vue'
import { handleNode } from '@vben/utils'
import { Empty, Skeleton, Tree } from 'ant-design-vue'
import { communityTree } from "#/api/property/community"
import type { CommunityVO } from "#/api/property/community/model"
defineOptions({ inheritAttrs: false })
withDefaults(defineProps<{ showSearch?: boolean }>(), { showSearch: true })
const emit = defineEmits<{
/**
* 点击刷新按钮的事件
*/
reload: []
/**
* 点击节点的事件
*/
select: []
}>()
const selectFloorId = defineModel('selectFloorId', {
type: Array as PropType<string[]>,
})
const searchValue = defineModel('searchValue', {
type: String,
default: '',
})
type TreeArray = CommunityVO[]
const treeArray = ref<TreeArray>([])
/** 骨架屏加载 */
const showTreeSkeleton = ref<boolean>(true)
async function loadTree() {
showTreeSkeleton.value = true
searchValue.value = ''
selectFloorId.value = []
const ret = await communityTree(3)
const splitStr = '/'
handleNode(ret, 'label', splitStr, function (node: any) {
if (node.level != 3) {
node.disabled = true
}
})
treeArray.value = ret
showTreeSkeleton.value = false
}
onMounted(loadTree);
</script>
<template>
<div :class="$attrs.class">
<Skeleton :loading="showTreeSkeleton" :paragraph="{ rows: 8 }" active class="p-[8px] flex-1 min-h-0">
<div class="bg-background flex h-full flex-col overflow-y-auto rounded-lg">
<div class="h-full overflow-x-hidden px-[8px]">
<Tree v-bind="$attrs" v-if="treeArray.length > 0" v-model:selected-keys="selectFloorId"
:field-names="{ title: 'label', key: 'id' }" :show-line="{ showLeafIcon: false }" :tree-data="treeArray"
:virtual="false" default-expand-all @select="$emit('select')">
<template #title="{ label }">
<span v-if="label.indexOf(searchValue) > -1">
{{ label.substring(0, label.indexOf(searchValue)) }}
<span style="color: #f50">{{ searchValue }}</span>
{{ label.substring(label.indexOf(searchValue) + searchValue.length) }}
</span>
<span v-else>{{ label }}</span>
</template>
</Tree>
<div v-else class="mt-5">
<Empty :image="Empty.PRESENTED_IMAGE_SIMPLE" description="暂无数据" />
</div>
</div>
</div>
</Skeleton>
</div>
</template>

View File

@ -1,26 +1,31 @@
<script setup lang="ts">
import { TableSwitch } from "#/components/table"
import { Page, useVbenDrawer, type VbenFormProps } from '@vben/common-ui';
import { Page, useVbenDrawer, type VbenFormProps } from '@vben/common-ui'
import { getVxePopupContainer } from '@vben/utils';
import { Modal, Popconfirm, Space } from 'ant-design-vue';
import { ref } from 'vue'
import { columns, querySchema } from './data'
import { Modal, Popconfirm, Space } from 'ant-design-vue'
import FloorTree from "./floor-tree.vue"
import lightInfoDrawer from './lightInfo-drawer.vue'
import {
useVbenVxeGrid,
vxeCheckboxChecked,
type VxeGridProps
} from '#/adapter/vxe-table';
} from '#/adapter/vxe-table'
import {
lightInfoExport,
lightInfoList,
lightInfoRemove,
} from '#/api/property/meter/lightInfo';
import type { LightInfoForm } from '#/api/property/meter/lightInfo/model';
import { commonDownloadExcel } from '#/utils/file/download';
switchSingleLight,
} from '#/api/property/meter/lightInfo'
import type { LightInfoForm } from '#/api/property/meter/lightInfo/model'
import lightInfoDrawer from './lightInfo-drawer.vue';
import { columns, querySchema } from './data';
//
const selectFloorId = ref<string[]>([])
const formOptions: VbenFormProps = {
commonConfig: {
@ -31,16 +36,16 @@ const formOptions: VbenFormProps = {
},
schema: querySchema(),
wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4',
// RangePicker /
//
// fieldMappingTime: [
// [
// 'createTime',
// ['params[beginTime]', 'params[endTime]'],
// ['YYYY-MM-DD 00:00:00', 'YYYY-MM-DD 23:59:59'],
// ],
// ],
};
handleReset: async () => {
selectFloorId.value = []
const { formApi, reload } = tableApi
await formApi.resetForm()
const formValues = formApi.form.values
formApi.setLatestSubmissionValues(formValues)
await reload(formValues)
},
}
const gridOptions: VxeGridProps = {
checkboxConfig: {
@ -60,11 +65,17 @@ const gridOptions: VxeGridProps = {
proxyConfig: {
ajax: {
query: async ({ page }, formValues = {}) => {
//
if (selectFloorId.value.length === 1) {
formValues.floorId = selectFloorId.value[0]
} else {
Reflect.deleteProperty(formValues, 'deptId')
}
return await lightInfoList({
pageNum: page.currentPage,
pageSize: page.pageSize,
...formValues,
});
})
},
},
},
@ -73,109 +84,90 @@ const gridOptions: VxeGridProps = {
},
//
id: 'property-lightInfo-index'
};
}
const [BasicTable, tableApi] = useVbenVxeGrid({
formOptions,
gridOptions,
});
})
const [LightInfoDrawer, drawerApi] = useVbenDrawer({
connectedComponent: lightInfoDrawer,
});
})
function handleAdd() {
drawerApi.setData({});
drawerApi.open();
drawerApi.setData({})
drawerApi.open()
}
async function handleEdit(row: Required<LightInfoForm>) {
drawerApi.setData({ id: row.id });
drawerApi.open();
drawerApi.setData({ id: row.id })
drawerApi.open()
}
async function handleDelete(row: Required<LightInfoForm>) {
await lightInfoRemove(row.id);
await tableApi.query();
await lightInfoRemove(row.id)
await tableApi.query()
}
function handleMultiDelete() {
const rows = tableApi.grid.getCheckboxRecords();
const ids = rows.map((row: Required<LightInfoForm>) => row.id);
const rows = tableApi.grid.getCheckboxRecords()
const ids = rows.map((row: Required<LightInfoForm>) => row.id)
Modal.confirm({
title: '提示',
okType: 'danger',
content: `确认删除选中的${ids.length}条记录吗?`,
onOk: async () => {
await lightInfoRemove(ids);
await tableApi.query();
await lightInfoRemove(ids)
await tableApi.query()
},
});
}
function handleDownloadExcel() {
commonDownloadExcel(lightInfoExport, '灯控开关信息数据', tableApi.formApi.form.values, {
fieldMappingTime: formOptions.fieldMappingTime,
});
})
}
</script>
<template>
<Page :auto-content-height="true">
<BasicTable table-title="灯控开关信息列表">
<template #toolbar-tools>
<Space>
<a-button
v-access:code="['property:lightInfo:export']"
@click="handleDownloadExcel"
>
{{ $t('pages.common.export') }}
</a-button>
<a-button
:disabled="!vxeCheckboxChecked(tableApi)"
danger
type="primary"
v-access:code="['property:lightInfo:remove']"
@click="handleMultiDelete">
{{ $t('pages.common.delete') }}
</a-button>
<a-button
type="primary"
v-access:code="['property:lightInfo:add']"
@click="handleAdd"
>
{{ $t('pages.common.add') }}
</a-button>
</Space>
</template>
<template #action="{ row }">
<Space>
<ghost-button
v-access:code="['property:lightInfo:edit']"
@click.stop="handleEdit(row)"
>
{{ $t('pages.common.edit') }}
</ghost-button>
<Popconfirm
:get-popup-container="getVxePopupContainer"
placement="left"
title="确认删除?"
@confirm="handleDelete(row)"
>
<ghost-button
danger
v-access:code="['property:lightInfo:remove']"
@click.stop=""
>
<div class="flex h-full gap-[8px]">
<FloorTree class="w-[260px]" @reload="() => tableApi.reload()" @select="() => tableApi.reload()"
v-model:select-floor-id="selectFloorId"></FloorTree>
<BasicTable class="flex-1 overflow-hidden" table-title="灯控开关信息列表">
<template #toolbar-tools>
<Space>
<a-button type="primary" v-access:code="['property:lightInfo:add']" @click="handleAdd">
{{ $t('pages.common.add') }}
</a-button>
<a-button :disabled="!vxeCheckboxChecked(tableApi)" danger type="primary"
v-access:code="['property:lightInfo:remove']" @click="handleMultiDelete">
{{ $t('pages.common.delete') }}
</a-button>
<a-button :disabled="!vxeCheckboxChecked(tableApi)" danger type="primary">
关灯
</a-button>
<a-button :disabled="!vxeCheckboxChecked(tableApi)" success type="primary">
开灯
</a-button>
</Space>
</template>
<template #action="{ row }">
<Space>
<ghost-button v-access:code="['property:lightInfo:edit']" @click.stop="handleEdit(row)">
{{ $t('pages.common.edit') }}
</ghost-button>
</Popconfirm>
</Space>
</template>
<template #isOn="{ row }">
<TableSwitch :checkedValue=true :unCheckedValue=false :value="row.isOn" @reload="() => tableApi.query()" />
</template>
</BasicTable>
<Popconfirm :get-popup-container="getVxePopupContainer" placement="left" title="确认删除?"
@confirm="handleDelete(row)">
<ghost-button danger v-access:code="['property:lightInfo:remove']" @click.stop="">
{{ $t('pages.common.delete') }}
</ghost-button>
</Popconfirm>
</Space>
</template>
<template #isOn="{ row }">
<TableSwitch :checkedValue=true :unCheckedValue=false v-model:value="row.isOn" checked-children=""
un-checked-children="关" :api="() => switchSingleLight({'id':row.id, 'isOn':row.isOn})"
@reload="() => tableApi.query()" />
</template>
</BasicTable>
</div>
<LightInfoDrawer @reload="tableApi.query()" />
</Page>
</template>

View File

@ -301,6 +301,7 @@ onBeforeUnmount(() => {
.left-content {
flex: 1;
height: 95vh;
}
.right-content {
@ -386,11 +387,11 @@ onBeforeUnmount(() => {
}
.power-chart{
height: 55vh;
height: 45vh;
}
.energy-chart{
height: 240px;
height: 30vh;
}
</style>

View File

@ -137,6 +137,7 @@ const handleAccountLogin = async () => {
type="password"
placeholder="请输入您的密码"
v-model="password"
@keyup.enter="handleAccountLogin"
/>
</div>

View File

@ -187,7 +187,7 @@ catalog:
vue-tippy: ^6.7.0
vue-tsc: 2.2.10
vxe-pc-ui: ^4.5.35
vxe-table: ^4.13.16
vxe-table: 4.13.53
watermark-js-plus: ^1.6.0
zod: ^3.24.3
zod-defaults: ^0.1.3