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
12 changed files with 229 additions and 133 deletions

View File

@@ -10,28 +10,39 @@ jobs:
- name: 拉取代码仓库 - name: 拉取代码仓库
uses: http://git.missmoc.top/mocheng/checkout@v4 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 uses: http://git.missmoc.top/mocheng/setup-node@v3
with: with:
node-version: 20.x node-version: 20.x
- name: pnpm
- name: 安装pnpm
run: npm i pnpm -g run: npm i pnpm -g
- name: node
run: | - name: 安装依赖
pnpm config set registry https://registry.npmmirror.com run: pnpm install
pnpm install continue-on-error: false # 依赖安装失败则终止工作流
- name: Build - name: 构建项目
run: pnpm build:antd 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 uses: http://git.missmoc.top/mocheng/scp-action@v0.1.7
with: with:
host: 127.0.0.1 host: 127.0.0.1
username: ${ { SERVER_NAME } } username: ${{ secrets.SERVER_NAME }} # 使用secrets存储
password: ${{ SERVER_PWD}} password: ${{ secrets.SERVER_PWD }} # 使用secrets存储
port: 11001 port: 11001
source: "./apps/web-antd/dist" source: "./apps/web-antd/dist"
target: "/www/wwwroot/183.230.235.66_11010/property" 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) { export function lightInfoRemove(id: ID | IDS) {
return requestClient.deleteWithMsg<void>(`/property/lightInfo/${id}`); 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 * 开关状态01
*/ */
isOn: number; isOn: boolean;
/** /**
* 灯控模块编码 * 灯控模块编码
@@ -62,7 +62,7 @@ export interface LightInfoForm extends BaseEntity {
/** /**
* 开关状态01 * 开关状态01
*/ */
isOn?: number; isOn: boolean;
/** /**
* 灯控模块编码 * 灯控模块编码

View File

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

View File

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

View File

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

View File

@@ -22,7 +22,6 @@ export const columns: VxeGridProps['columns'] = [
title: '位置描述', title: '位置描述',
field: 'locationRemark', field: 'locationRemark',
}, },
{ {
title: '楼 层', title: '楼 层',
field: 'floorName', field: 'floorName',
@@ -30,7 +29,7 @@ export const columns: VxeGridProps['columns'] = [
{ {
title: '开关状态', title: '开关状态',
field: 'isOn', field: 'isOn',
slots: { default: 'isOn' }, slots: { default: 'isOn' },
}, },
{ {
field: 'action', 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"> <script setup lang="ts">
import { TableSwitch } from "#/components/table" 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 { import { ref } from 'vue'
useVbenVxeGrid, import { columns, querySchema } from './data'
vxeCheckboxChecked, import { Modal, Popconfirm, Space } from 'ant-design-vue'
type VxeGridProps import FloorTree from "./floor-tree.vue"
} from '#/adapter/vxe-table'; import lightInfoDrawer from './lightInfo-drawer.vue'
import {
useVbenVxeGrid,
vxeCheckboxChecked,
type VxeGridProps
} from '#/adapter/vxe-table'
import { import {
lightInfoExport,
lightInfoList, lightInfoList,
lightInfoRemove, lightInfoRemove,
} from '#/api/property/meter/lightInfo'; switchSingleLight,
import type { LightInfoForm } from '#/api/property/meter/lightInfo/model'; } from '#/api/property/meter/lightInfo'
import { commonDownloadExcel } from '#/utils/file/download'; 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 = { const formOptions: VbenFormProps = {
commonConfig: { commonConfig: {
@@ -31,16 +36,16 @@ const formOptions: VbenFormProps = {
}, },
schema: querySchema(), schema: querySchema(),
wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4', wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4',
// 处理区间选择器RangePicker时间格式 将一个字段映射为两个字段 搜索/导出会用到 handleReset: async () => {
// 不需要直接删除 selectFloorId.value = []
// fieldMappingTime: [
// [ const { formApi, reload } = tableApi
// 'createTime', await formApi.resetForm()
// ['params[beginTime]', 'params[endTime]'], const formValues = formApi.form.values
// ['YYYY-MM-DD 00:00:00', 'YYYY-MM-DD 23:59:59'], formApi.setLatestSubmissionValues(formValues)
// ], await reload(formValues)
// ], },
}; }
const gridOptions: VxeGridProps = { const gridOptions: VxeGridProps = {
checkboxConfig: { checkboxConfig: {
@@ -60,11 +65,17 @@ const gridOptions: VxeGridProps = {
proxyConfig: { proxyConfig: {
ajax: { ajax: {
query: async ({ page }, formValues = {}) => { query: async ({ page }, formValues = {}) => {
// 部门树选择处理
if (selectFloorId.value.length === 1) {
formValues.floorId = selectFloorId.value[0]
} else {
Reflect.deleteProperty(formValues, 'deptId')
}
return await lightInfoList({ return await lightInfoList({
pageNum: page.currentPage, pageNum: page.currentPage,
pageSize: page.pageSize, pageSize: page.pageSize,
...formValues, ...formValues,
}); })
}, },
}, },
}, },
@@ -73,109 +84,90 @@ const gridOptions: VxeGridProps = {
}, },
// 表格全局唯一表示 保存列配置需要用到 // 表格全局唯一表示 保存列配置需要用到
id: 'property-lightInfo-index' id: 'property-lightInfo-index'
}; }
const [BasicTable, tableApi] = useVbenVxeGrid({ const [BasicTable, tableApi] = useVbenVxeGrid({
formOptions, formOptions,
gridOptions, gridOptions,
}); })
const [LightInfoDrawer, drawerApi] = useVbenDrawer({ const [LightInfoDrawer, drawerApi] = useVbenDrawer({
connectedComponent: lightInfoDrawer, connectedComponent: lightInfoDrawer,
}); })
function handleAdd() { function handleAdd() {
drawerApi.setData({}); drawerApi.setData({})
drawerApi.open(); drawerApi.open()
} }
async function handleEdit(row: Required<LightInfoForm>) { async function handleEdit(row: Required<LightInfoForm>) {
drawerApi.setData({ id: row.id }); drawerApi.setData({ id: row.id })
drawerApi.open(); drawerApi.open()
} }
async function handleDelete(row: Required<LightInfoForm>) { async function handleDelete(row: Required<LightInfoForm>) {
await lightInfoRemove(row.id); await lightInfoRemove(row.id)
await tableApi.query(); await tableApi.query()
} }
function handleMultiDelete() { function handleMultiDelete() {
const rows = tableApi.grid.getCheckboxRecords(); const rows = tableApi.grid.getCheckboxRecords()
const ids = rows.map((row: Required<LightInfoForm>) => row.id); const ids = rows.map((row: Required<LightInfoForm>) => row.id)
Modal.confirm({ Modal.confirm({
title: '提示', title: '提示',
okType: 'danger', okType: 'danger',
content: `确认删除选中的${ids.length}条记录吗?`, content: `确认删除选中的${ids.length}条记录吗?`,
onOk: async () => { onOk: async () => {
await lightInfoRemove(ids); await lightInfoRemove(ids)
await tableApi.query(); await tableApi.query()
}, },
}); })
}
function handleDownloadExcel() {
commonDownloadExcel(lightInfoExport, '灯控开关信息数据', tableApi.formApi.form.values, {
fieldMappingTime: formOptions.fieldMappingTime,
});
} }
</script> </script>
<template> <template>
<Page :auto-content-height="true"> <Page :auto-content-height="true">
<BasicTable table-title="灯控开关信息列表"> <div class="flex h-full gap-[8px]">
<template #toolbar-tools> <FloorTree class="w-[260px]" @reload="() => tableApi.reload()" @select="() => tableApi.reload()"
<Space> v-model:select-floor-id="selectFloorId"></FloorTree>
<a-button <BasicTable class="flex-1 overflow-hidden" table-title="灯控开关信息列表">
v-access:code="['property:lightInfo:export']" <template #toolbar-tools>
@click="handleDownloadExcel" <Space>
> <a-button type="primary" v-access:code="['property:lightInfo:add']" @click="handleAdd">
{{ $t('pages.common.export') }} {{ $t('pages.common.add') }}
</a-button> </a-button>
<a-button <a-button :disabled="!vxeCheckboxChecked(tableApi)" danger type="primary"
:disabled="!vxeCheckboxChecked(tableApi)" v-access:code="['property:lightInfo:remove']" @click="handleMultiDelete">
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=""
>
{{ $t('pages.common.delete') }} {{ $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> </ghost-button>
</Popconfirm> <Popconfirm :get-popup-container="getVxePopupContainer" placement="left" title="确认删除?"
</Space> @confirm="handleDelete(row)">
</template> <ghost-button danger v-access:code="['property:lightInfo:remove']" @click.stop="">
<template #isOn="{ row }"> {{ $t('pages.common.delete') }}
<TableSwitch :checkedValue=true :unCheckedValue=false :value="row.isOn" @reload="() => tableApi.query()" /> </ghost-button>
</template> </Popconfirm>
</BasicTable> </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()" /> <LightInfoDrawer @reload="tableApi.query()" />
</Page> </Page>
</template> </template>

View File

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

View File

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

View File

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