Merge branch 'master' of http://47.109.37.87:3000/by2025/admin-vben5
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
This commit is contained in:
@@ -1,20 +1,25 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue';
|
||||
import {computed, ref} from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
import { cloneDeep } from '@vben/utils';
|
||||
import {useVbenModal} from '@vben/common-ui';
|
||||
import {$t} from '@vben/locales';
|
||||
import {cloneDeep} from '@vben/utils';
|
||||
|
||||
import { type FormSchemaGetter, useVbenForm } from "#/adapter/form";
|
||||
import { applicationAdd, applicationInfo, applicationUpdate } from '#/api/property/assetManage/application';
|
||||
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
||||
import {type FormSchemaGetter, useVbenForm} from "#/adapter/form";
|
||||
import {
|
||||
applicationAdd,
|
||||
applicationInfo,
|
||||
applicationUpdate
|
||||
} from '#/api/property/assetManage/application';
|
||||
import {defaultFormValueGetter, useBeforeCloseDiff} from '#/utils/popup';
|
||||
|
||||
import { modalSchema } from './data';
|
||||
import { assetTypeselect } from "#/api/property/assetType";
|
||||
import { depotList } from "#/api/property/assetManage/depot";
|
||||
import { suppliersList } from "#/api/property/assetManage/suppliers";
|
||||
import { assetList } from "#/api/property/assetManage/asset";
|
||||
import { userList } from "#/api/system/user";
|
||||
import {modalSchema} from './data';
|
||||
import {assetTypeselect} from "#/api/property/assetType";
|
||||
import {depotList} from "#/api/property/assetManage/depot";
|
||||
import {suppliersList} from "#/api/property/assetManage/suppliers";
|
||||
import {assetList} from "#/api/property/assetManage/asset";
|
||||
import {userList} from "#/api/system/user";
|
||||
import type {AssetVO} from "#/api/property/assetManage/asset/model";
|
||||
|
||||
const emit = defineEmits<{ reload: [] }>();
|
||||
|
||||
@@ -39,7 +44,7 @@ const [BasicForm, formApi] = useVbenForm({
|
||||
wrapperClass: 'grid-cols-2',
|
||||
});
|
||||
|
||||
const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
|
||||
const {onBeforeClose, markInitialized, resetInitialized} = useBeforeCloseDiff(
|
||||
{
|
||||
initializedGetter: defaultFormValueGetter(formApi),
|
||||
currentGetter: defaultFormValueGetter(formApi),
|
||||
@@ -48,15 +53,15 @@ const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
|
||||
|
||||
formApi.getValues().then(setupPackageSelect);
|
||||
|
||||
async function upSelectUser(nickName: string){
|
||||
const list=await userList({
|
||||
nickName:nickName,
|
||||
async function upSelectUser(nickName: string) {
|
||||
const list = await userList({
|
||||
nickName: nickName,
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
});
|
||||
const options=list.map(item=>{
|
||||
item.label=item.userName;
|
||||
item.value=item.id;
|
||||
const options = list.map(item => {
|
||||
item.label = item.userName;
|
||||
item.value = item.id;
|
||||
})
|
||||
fromApi.updateSchema([
|
||||
{
|
||||
@@ -71,15 +76,15 @@ async function upSelectUser(nickName: string){
|
||||
]);
|
||||
}
|
||||
|
||||
async function upSelectAssets(assetsName: string){
|
||||
const list=await assetList({
|
||||
assetsName:assetsName,
|
||||
async function upSelectAssets(assetsName: string) {
|
||||
const list = await assetList({
|
||||
assetsName: assetsName,
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
});
|
||||
const options=list.map(item=>{
|
||||
item.label=item.assetsName;
|
||||
item.value=item.id;
|
||||
const options = list.map(item => {
|
||||
item.label = item.assetsName;
|
||||
item.value = item.id;
|
||||
})
|
||||
fromApi.updateSchema([
|
||||
{
|
||||
@@ -94,15 +99,19 @@ async function upSelectAssets(assetsName: string){
|
||||
]);
|
||||
}
|
||||
|
||||
const assetsData = ref<AssetVO[]>([])
|
||||
|
||||
async function setupPackageSelect() {
|
||||
const users = await userList({
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
pageSize: 1000,
|
||||
});
|
||||
const assets = await assetList({
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
pageSize: 1000,
|
||||
params: {stock: 1} //库存不为0
|
||||
});
|
||||
assetsData.value = assets.rows
|
||||
const options = users.rows.map((item) => ({
|
||||
label: item.nickName,
|
||||
value: item.userId,
|
||||
@@ -121,7 +130,7 @@ async function setupPackageSelect() {
|
||||
},
|
||||
async select(userId) {
|
||||
await upSelectUser(userId);
|
||||
userId=""
|
||||
userId = ""
|
||||
},
|
||||
fieldName: 'userId',
|
||||
},
|
||||
@@ -131,18 +140,31 @@ async function setupPackageSelect() {
|
||||
optionLabelProp: 'label',
|
||||
options: assetOptions,
|
||||
showSearch: true,
|
||||
onChange: async (value: string) => {
|
||||
// 找到选中的服务数据
|
||||
const assetInfo = assetsData.value.find(item => item.id === value);
|
||||
if (assetInfo) {
|
||||
formApi.updateSchema([{
|
||||
componentProps: {
|
||||
max: assetInfo.stock,
|
||||
min: 1
|
||||
},
|
||||
fieldName: 'number',
|
||||
}])
|
||||
}
|
||||
},
|
||||
},
|
||||
async select(assetsId) {
|
||||
await upSelectAssets(assetsId);
|
||||
assetsId=""
|
||||
assetsId = ""
|
||||
},
|
||||
fieldName: 'assetId',
|
||||
},
|
||||
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
const [BasicModal, modalApi] = useVbenModal({
|
||||
// 在这里更改宽度
|
||||
class: 'w-[550px]',
|
||||
@@ -156,7 +178,7 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
}
|
||||
modalApi.modalLoading(true);
|
||||
|
||||
const { id } = modalApi.getData() as { id?: number | string };
|
||||
const {id} = modalApi.getData() as { id?: number | string };
|
||||
isUpdate.value = !!id;
|
||||
|
||||
if (isUpdate.value && id) {
|
||||
@@ -172,7 +194,7 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
async function handleConfirm() {
|
||||
try {
|
||||
modalApi.lock(true);
|
||||
const { valid } = await formApi.validate();
|
||||
const {valid} = await formApi.validate();
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
@@ -197,7 +219,7 @@ async function handleClosed() {
|
||||
|
||||
<template>
|
||||
<BasicModal :title="title">
|
||||
<BasicForm />
|
||||
<BasicForm/>
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
|
@@ -2,65 +2,65 @@ import type { FormSchemaGetter } from '#/adapter/form';
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
import { renderDict } from "#/utils/render";
|
||||
import { DictEnum } from '@vben/constants';
|
||||
import {getDictOptions} from "#/utils/dict";
|
||||
|
||||
|
||||
|
||||
export const querySchema: FormSchemaGetter = () => [
|
||||
// {
|
||||
// component: 'Input',
|
||||
// fieldName: 'assetId',
|
||||
// label: '资产id',
|
||||
// },
|
||||
// {
|
||||
// component: 'Input',
|
||||
// fieldName: 'userId',
|
||||
// label: '领用人id',
|
||||
// },
|
||||
// {
|
||||
// component: 'Input',
|
||||
// fieldName: 'number',
|
||||
// label: '数量',
|
||||
// },
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'assetId',
|
||||
label: '资产id',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'userId',
|
||||
label: '领用人id',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'number',
|
||||
label: '数量',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
component: 'Select',
|
||||
componentProps:{
|
||||
options:getDictOptions(DictEnum.WY_ZCSHZT)
|
||||
},
|
||||
fieldName: 'state',
|
||||
label: '状态',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'acceptanceUserId',
|
||||
label: '审批人id',
|
||||
},
|
||||
{
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
},
|
||||
fieldName: 'acceptanceTime',
|
||||
label: '审批时间',
|
||||
},
|
||||
{
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
},
|
||||
fieldName: 'applicationTime',
|
||||
label: '申请时间',
|
||||
label: '审核状态',
|
||||
},
|
||||
// {
|
||||
// component: 'Input',
|
||||
// fieldName: 'acceptanceUserId',
|
||||
// label: '审批人id',
|
||||
// },
|
||||
// {
|
||||
// component: 'DatePicker',
|
||||
// componentProps: {
|
||||
// showTime: true,
|
||||
// format: 'YYYY-MM-DD HH:mm:ss',
|
||||
// valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
// },
|
||||
// fieldName: 'acceptanceTime',
|
||||
// label: '审批时间',
|
||||
// },
|
||||
// {
|
||||
// component: 'DatePicker',
|
||||
// componentProps: {
|
||||
// showTime: true,
|
||||
// format: 'YYYY-MM-DD HH:mm:ss',
|
||||
// valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
// },
|
||||
// fieldName: 'applicationTime',
|
||||
// label: '申请时间',
|
||||
// },
|
||||
];
|
||||
|
||||
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
|
||||
// export const columns: () => VxeGridProps['columns'] = () => [
|
||||
export const columns: VxeGridProps['columns'] = [
|
||||
{ type: 'checkbox', width: 60 },
|
||||
{
|
||||
title: '主键',
|
||||
field: 'id',
|
||||
},
|
||||
{
|
||||
title: '资产',
|
||||
field: 'assetName',
|
||||
@@ -74,7 +74,11 @@ export const columns: VxeGridProps['columns'] = [
|
||||
field: 'number',
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
title: '申请时间',
|
||||
field: 'applicationTime',
|
||||
},
|
||||
{
|
||||
title: '审核状态',
|
||||
field: 'state',
|
||||
slots: {
|
||||
default: ({ row }) => {
|
||||
@@ -90,14 +94,6 @@ export const columns: VxeGridProps['columns'] = [
|
||||
title: '审批时间',
|
||||
field: 'acceptanceTime',
|
||||
},
|
||||
{
|
||||
title: '申请时间',
|
||||
field: 'applicationTime',
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
field: 'createTime',
|
||||
},
|
||||
{
|
||||
field: 'action',
|
||||
fixed: 'right',
|
||||
@@ -118,19 +114,25 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '资产id',
|
||||
label: '资产',
|
||||
fieldName: 'assetId',
|
||||
component: 'Select',
|
||||
rules:'selectRequired'
|
||||
},
|
||||
{
|
||||
label: '领用人id',
|
||||
label: '领用人',
|
||||
fieldName: 'userId',
|
||||
component: 'Select',
|
||||
rules:'selectRequired'
|
||||
},
|
||||
{
|
||||
label: '数量',
|
||||
fieldName: 'number',
|
||||
component: 'Input',
|
||||
component: 'InputNumber',
|
||||
componentProps:{
|
||||
min:1,
|
||||
},
|
||||
rules:'required'
|
||||
},
|
||||
// {
|
||||
// label: '状态',
|
||||
|
@@ -1,9 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
|
||||
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
|
||||
import { getVxePopupContainer } from '@vben/utils';
|
||||
import {Page, useVbenModal, type VbenFormProps} from '@vben/common-ui';
|
||||
import {getVxePopupContainer} from '@vben/utils';
|
||||
|
||||
import { Modal, Popconfirm, Space } from 'ant-design-vue';
|
||||
import {Modal, Popconfirm, Space} from 'ant-design-vue';
|
||||
|
||||
import {
|
||||
useVbenVxeGrid,
|
||||
@@ -14,14 +14,15 @@ import {
|
||||
import {
|
||||
applicationExport,
|
||||
applicationList,
|
||||
applicationRemove,
|
||||
applicationRemove, applicationVerified,
|
||||
} from '#/api/property/assetManage/application';
|
||||
import type { ApplicationForm } from '#/api/property/assetManage/application/model';
|
||||
import { commonDownloadExcel } from '#/utils/file/download';
|
||||
import type {ApplicationForm} from '#/api/property/assetManage/application/model';
|
||||
import {commonDownloadExcel} from '#/utils/file/download';
|
||||
|
||||
import applicationModal from './application-modal.vue';
|
||||
import { columns, querySchema } from './data';
|
||||
|
||||
import {columns, querySchema} from './data';
|
||||
import {useUserStore} from "@vben/stores";
|
||||
import { cloneDeep } from '@vben/utils';
|
||||
const formOptions: VbenFormProps = {
|
||||
commonConfig: {
|
||||
labelWidth: 80,
|
||||
@@ -50,7 +51,7 @@ const gridOptions: VxeGridProps = {
|
||||
pagerConfig: {},
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }, formValues = {}) => {
|
||||
query: async ({page}, formValues = {}) => {
|
||||
return await applicationList({
|
||||
pageNum: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
@@ -81,7 +82,7 @@ function handleAdd() {
|
||||
}
|
||||
|
||||
async function handleEdit(row: Required<ApplicationForm>) {
|
||||
modalApi.setData({ id: row.id });
|
||||
modalApi.setData({id: row.id});
|
||||
modalApi.open();
|
||||
}
|
||||
|
||||
@@ -90,6 +91,17 @@ async function handleDelete(row: Required<ApplicationForm>) {
|
||||
await tableApi.query();
|
||||
}
|
||||
|
||||
const userStore = useUserStore();
|
||||
|
||||
async function handleAudit(row: Required<ApplicationForm>, status: number) {
|
||||
const info = cloneDeep(row)
|
||||
info.state = status
|
||||
info.acceptanceTime = new Date()
|
||||
info.acceptanceUserId = userStore.userInfo?.userId
|
||||
await applicationVerified(info)
|
||||
await tableApi.query();
|
||||
}
|
||||
|
||||
function handleMultiDelete() {
|
||||
const rows = tableApi.grid.getCheckboxRecords();
|
||||
const ids = rows.map((row: Required<ApplicationForm>) => row.id);
|
||||
@@ -141,12 +153,29 @@ function handleDownloadExcel() {
|
||||
</template>
|
||||
<template #action="{ row }">
|
||||
<Space>
|
||||
<ghost-button
|
||||
v-access:code="['property:application:edit']"
|
||||
@click.stop="handleEdit(row)"
|
||||
<!-- <ghost-button-->
|
||||
<!-- v-access:code="['property:application:edit']"-->
|
||||
<!-- @click.stop="handleEdit(row)"-->
|
||||
<!-- >-->
|
||||
<!-- {{ $t('pages.common.edit') }}-->
|
||||
<!-- </ghost-button>-->
|
||||
<Popconfirm
|
||||
:get-popup-container="getVxePopupContainer"
|
||||
placement="left"
|
||||
title="资产领用审核"
|
||||
@confirm="handleAudit(row,1)"
|
||||
cancelText="不通过"
|
||||
okText="通过"
|
||||
@cancel="handleAudit(row,2)"
|
||||
>
|
||||
{{ $t('pages.common.edit') }}
|
||||
</ghost-button>
|
||||
<ghost-button
|
||||
v-access:code="['property:application:edit']"
|
||||
@click.stop=""
|
||||
:disabled="row.state!=0"
|
||||
>
|
||||
审核
|
||||
</ghost-button>
|
||||
</Popconfirm>
|
||||
<Popconfirm
|
||||
:get-popup-container="getVxePopupContainer"
|
||||
placement="left"
|
||||
@@ -164,6 +193,6 @@ function handleDownloadExcel() {
|
||||
</Space>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<ApplicationModal @reload="tableApi.query()" />
|
||||
<ApplicationModal @reload="tableApi.query()"/>
|
||||
</Page>
|
||||
</template>
|
||||
|
@@ -10,8 +10,6 @@ import { assetAdd, assetInfo, assetUpdate } from '#/api/property/assetManage/ass
|
||||
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
||||
|
||||
import { modalSchema } from './data';
|
||||
import { packageSelectList } from "#/api/system/tenant-package";
|
||||
import { assetTypeselect } from "#/api/property/assetType";
|
||||
import { depotList } from "#/api/property/assetManage/depot";
|
||||
import { suppliersList } from "#/api/property/assetManage/suppliers";
|
||||
|
||||
@@ -25,9 +23,9 @@ const title = computed(() => {
|
||||
const [BasicForm, formApi] = useVbenForm({
|
||||
commonConfig: {
|
||||
// 默认占满两列
|
||||
formItemClass: 'col-span-2',
|
||||
formItemClass: 'col-span-1',
|
||||
// 默认label宽度 px
|
||||
labelWidth: 80,
|
||||
labelWidth: 100,
|
||||
// 通用配置项 会影响到所有表单项
|
||||
componentProps: {
|
||||
class: 'w-full',
|
||||
@@ -45,14 +43,9 @@ const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
|
||||
},
|
||||
);
|
||||
|
||||
async function setupPackageSelect() {
|
||||
const tenantPackageList = await assetTypeselect();
|
||||
async function setupPackageSelect(assetTypeOptions) {
|
||||
const depot = await depotList();
|
||||
const suppliers =await suppliersList();
|
||||
const options = tenantPackageList.rows.map((item) => ({
|
||||
label: item.assetTypeName,
|
||||
value: item.id,
|
||||
}));
|
||||
const depotoptions = depot.rows.map((item) => ({
|
||||
label: item.depotName,
|
||||
value: item.id,
|
||||
@@ -67,7 +60,7 @@ async function setupPackageSelect() {
|
||||
componentProps: {
|
||||
optionFilterProp: 'label',
|
||||
optionLabelProp: 'label',
|
||||
options,
|
||||
options:assetTypeOptions,
|
||||
showSearch: true,
|
||||
},
|
||||
fieldName: 'model',
|
||||
@@ -96,7 +89,7 @@ async function setupPackageSelect() {
|
||||
|
||||
const [BasicModal, modalApi] = useVbenModal({
|
||||
// 在这里更改宽度
|
||||
class: 'w-[550px]',
|
||||
class: 'w-[70%]',
|
||||
fullscreenButton: false,
|
||||
onBeforeClose,
|
||||
onClosed: handleClosed,
|
||||
@@ -108,15 +101,15 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
|
||||
modalApi.modalLoading(true);
|
||||
|
||||
const { id } = modalApi.getData() as { id?: number | string };
|
||||
const { id,assetTypeOptions } = modalApi.getData() as { id?: number | string,assetTypeOptions:any[] };
|
||||
isUpdate.value = !!id;
|
||||
|
||||
if (isUpdate.value && id) {
|
||||
const record = await assetInfo(id);
|
||||
record.type=record.type.toString()
|
||||
await formApi.setValues(record);
|
||||
}
|
||||
await markInitialized();
|
||||
await setupPackageSelect();
|
||||
await setupPackageSelect(assetTypeOptions);
|
||||
modalApi.modalLoading(false);
|
||||
},
|
||||
});
|
||||
|
@@ -6,7 +6,7 @@ import { DictEnum } from '@vben/constants';
|
||||
|
||||
|
||||
|
||||
export const querySchema: FormSchemaGetter = () => [
|
||||
export const querySchema: FormSchemaGetter = (assetTypeOptions) => [
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'name',
|
||||
@@ -14,6 +14,9 @@ export const querySchema: FormSchemaGetter = () => [
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps:{
|
||||
options: assetTypeOptions
|
||||
},
|
||||
fieldName: 'model',
|
||||
label: '资产类型',
|
||||
},
|
||||
@@ -32,54 +35,50 @@ export const querySchema: FormSchemaGetter = () => [
|
||||
// export const columns: () => VxeGridProps['columns'] = () => [
|
||||
export const columns: VxeGridProps['columns'] = [
|
||||
{type: 'checkbox', width: 60},
|
||||
{
|
||||
title: '序号',
|
||||
field: 'id',
|
||||
slots: {
|
||||
default: ({ rowIndex }) => {
|
||||
return (rowIndex + 1).toString();
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '资产名称',
|
||||
field: 'name',
|
||||
minWidth: 180,
|
||||
},
|
||||
{
|
||||
title: '资产类型',
|
||||
field: 'modelName',
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
title: '规格',
|
||||
field: 'specs',
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: '价格',
|
||||
field: 'price',
|
||||
},
|
||||
{
|
||||
title: '库存',
|
||||
field: 'stock',
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: '计量单位',
|
||||
field: 'unit',
|
||||
},
|
||||
{
|
||||
title: '仓库',
|
||||
field: 'depotName',
|
||||
},
|
||||
{
|
||||
title: '描述信息',
|
||||
field: 'msg',
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: '供应商',
|
||||
field: 'suppliersName',
|
||||
width: 180,
|
||||
},
|
||||
{
|
||||
title: '仓库',
|
||||
field: 'depotName',
|
||||
width: 180,
|
||||
},
|
||||
{
|
||||
title: '库存',
|
||||
field: 'stock',
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: '入库时间',
|
||||
field: 'storageTime',
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
title: '固定资产',
|
||||
@@ -89,10 +88,12 @@ export const columns: VxeGridProps['columns'] = [
|
||||
return renderDict(row.type, DictEnum.WY_SF);
|
||||
},
|
||||
},
|
||||
width: 80,
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
field: 'createTime',
|
||||
title: '描述信息',
|
||||
field: 'msg',
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
field: 'action',
|
||||
@@ -117,46 +118,56 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
label: '资产名称',
|
||||
fieldName: 'name',
|
||||
component: 'Input',
|
||||
rules:'required',
|
||||
},
|
||||
{
|
||||
label: '类型',
|
||||
fieldName: 'model',
|
||||
component: 'Select',
|
||||
rules:'selectRequired',
|
||||
},
|
||||
{
|
||||
label: '规格',
|
||||
fieldName: 'specs',
|
||||
component: 'Textarea',
|
||||
component: 'Input',
|
||||
rules:'required',
|
||||
},
|
||||
{
|
||||
label: '价格',
|
||||
fieldName: 'price',
|
||||
component: 'Input',
|
||||
component: 'InputNumber',
|
||||
componentProps:{
|
||||
min:0,
|
||||
precision:2,
|
||||
},
|
||||
rules:'required',
|
||||
},
|
||||
{
|
||||
label: '库存',
|
||||
fieldName: 'stock',
|
||||
component: 'Input',
|
||||
component: 'InputNumber',
|
||||
componentProps:{
|
||||
min:0,
|
||||
},
|
||||
rules:'required',
|
||||
},
|
||||
{
|
||||
label: '计量单位',
|
||||
fieldName: 'unit',
|
||||
component: 'Input',
|
||||
rules:'required',
|
||||
},
|
||||
{
|
||||
label: '仓库',
|
||||
fieldName: 'depotId',
|
||||
component: 'Select',
|
||||
rules:'required',
|
||||
},
|
||||
{
|
||||
label: '描述信息',
|
||||
fieldName: 'msg',
|
||||
component: 'Textarea',
|
||||
},
|
||||
{
|
||||
label: '供应商id',
|
||||
label: '供应商',
|
||||
fieldName: 'suppliersId',
|
||||
component: 'Select',
|
||||
rules:'required',
|
||||
},
|
||||
{
|
||||
label: '入库时间',
|
||||
@@ -167,13 +178,23 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
},
|
||||
rules:'required',
|
||||
},
|
||||
{
|
||||
label: '固定资产类型',
|
||||
label: '是否固定资产',
|
||||
fieldName: 'type',
|
||||
component: 'Select',
|
||||
component: 'RadioGroup',
|
||||
componentProps: {
|
||||
buttonStyle: 'solid',
|
||||
options: getDictOptions('wy_sf'),
|
||||
},
|
||||
defaultValue:'0',
|
||||
rules:'required',
|
||||
},
|
||||
{
|
||||
label: '描述信息',
|
||||
fieldName: 'msg',
|
||||
component: 'Textarea',
|
||||
formItemClass:'col-span-2'
|
||||
},
|
||||
];
|
||||
|
@@ -1,9 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
|
||||
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
|
||||
import { getVxePopupContainer } from '@vben/utils';
|
||||
import {Page, useVbenModal, type VbenFormProps} from '@vben/common-ui';
|
||||
import {getVxePopupContainer} from '@vben/utils';
|
||||
|
||||
import { Modal, Popconfirm, Space } from 'ant-design-vue';
|
||||
import {Modal, Popconfirm, Space} from 'ant-design-vue';
|
||||
|
||||
import {
|
||||
useVbenVxeGrid,
|
||||
@@ -16,22 +16,27 @@ import {
|
||||
assetList,
|
||||
assetRemove,
|
||||
} from '#/api/property/assetManage/asset';
|
||||
import type { AssetForm } from '#/api/property/assetManage/asset/model';
|
||||
import { commonDownloadExcel } from '#/utils/file/download';
|
||||
import type {AssetForm} from '#/api/property/assetManage/asset/model';
|
||||
import {commonDownloadExcel} from '#/utils/file/download';
|
||||
|
||||
import assetModal from './asset-modal.vue';
|
||||
import { columns, querySchema } from './data';
|
||||
import {columns, querySchema} from './data';
|
||||
import {assetTypeList} from "#/api/property/assetManage/assetType";
|
||||
import type {AssertType} from "vitest";
|
||||
import {computed, onMounted, ref} from "vue";
|
||||
|
||||
const formOptions: VbenFormProps = {
|
||||
const assetTypeOptions=ref<AssertType[]>([])
|
||||
|
||||
const formOptions = computed(() => ({
|
||||
commonConfig: {
|
||||
labelWidth: 80,
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
schema: querySchema(),
|
||||
schema: querySchema(assetTypeOptions.value),
|
||||
wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4',
|
||||
};
|
||||
}));
|
||||
|
||||
const gridOptions: VxeGridProps = {
|
||||
checkboxConfig: {
|
||||
@@ -47,7 +52,7 @@ const gridOptions: VxeGridProps = {
|
||||
pagerConfig: {},
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }, formValues = {}) => {
|
||||
query: async ({page}, formValues = {}) => {
|
||||
return await assetList({
|
||||
pageNum: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
@@ -73,12 +78,12 @@ const [AssetModal, modalApi] = useVbenModal({
|
||||
});
|
||||
|
||||
function handleAdd() {
|
||||
modalApi.setData({});
|
||||
modalApi.setData({assetTypeOptions:assetTypeOptions.value});
|
||||
modalApi.open();
|
||||
}
|
||||
|
||||
async function handleEdit(row: Required<AssetForm>) {
|
||||
modalApi.setData({ id: row.id });
|
||||
modalApi.setData({id: row.id,assetTypeOptions:assetTypeOptions.value});
|
||||
modalApi.open();
|
||||
}
|
||||
|
||||
@@ -106,6 +111,24 @@ function handleDownloadExcel() {
|
||||
fieldMappingTime: formOptions.fieldMappingTime,
|
||||
});
|
||||
}
|
||||
|
||||
async function queryAssetType() {
|
||||
let params = {
|
||||
pageSize: 1000,
|
||||
pageNum: 1,
|
||||
}
|
||||
const res = await assetTypeList(params)
|
||||
assetTypeOptions.value = res.rows.map((item) => ({
|
||||
label: item.assetTypeName,
|
||||
value: item.id,
|
||||
}));
|
||||
return assetTypeOptions.value
|
||||
}
|
||||
|
||||
onMounted(()=>{
|
||||
queryAssetType()
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -161,6 +184,6 @@ function handleDownloadExcel() {
|
||||
</Space>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<AssetModal @reload="tableApi.query()" />
|
||||
<AssetModal @reload="tableApi.query()"/>
|
||||
</Page>
|
||||
</template>
|
||||
|
@@ -1,130 +1,137 @@
|
||||
import type { FormSchemaGetter } from '#/adapter/form';
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
import {getDictOptions} from "#/utils/dict";
|
||||
|
||||
|
||||
export const querySchema: FormSchemaGetter = () => [
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'depotId',
|
||||
label: '仓库id',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'assetId',
|
||||
label: '资产id',
|
||||
},
|
||||
// {
|
||||
// component: 'Input',
|
||||
// fieldName: 'depotId',
|
||||
// label: '仓库id',
|
||||
// },
|
||||
// {
|
||||
// component: 'Input',
|
||||
// fieldName: 'assetId',
|
||||
// label: '资产id',
|
||||
// },
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options:getDictOptions('wy_cklzlx')
|
||||
},
|
||||
fieldName: 'type',
|
||||
label: '流转类型',
|
||||
},
|
||||
{
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
},
|
||||
fieldName: 'time',
|
||||
label: '流转时间',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'userId',
|
||||
label: '操作人id',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'state',
|
||||
label: '状态',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'price',
|
||||
label: '价格',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'priceSum',
|
||||
label: '总价',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'number',
|
||||
label: '数量',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'supplierId',
|
||||
label: '供应商id',
|
||||
},
|
||||
// {
|
||||
// component: 'DatePicker',
|
||||
// componentProps: {
|
||||
// showTime: true,
|
||||
// format: 'YYYY-MM-DD HH:mm:ss',
|
||||
// valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
// },
|
||||
// fieldName: 'time',
|
||||
// label: '流转时间',
|
||||
// },
|
||||
// {
|
||||
// component: 'Input',
|
||||
// fieldName: 'userId',
|
||||
// label: '操作人id',
|
||||
// },
|
||||
// {
|
||||
// component: 'Input',
|
||||
// fieldName: 'state',
|
||||
// label: '状态',
|
||||
// },
|
||||
// {
|
||||
// component: 'Input',
|
||||
// fieldName: 'price',
|
||||
// label: '价格',
|
||||
// },
|
||||
// {
|
||||
// component: 'Input',
|
||||
// fieldName: 'priceSum',
|
||||
// label: '总价',
|
||||
// },
|
||||
// {
|
||||
// component: 'Input',
|
||||
// fieldName: 'number',
|
||||
// label: '数量',
|
||||
// },
|
||||
// {
|
||||
// component: 'Input',
|
||||
// fieldName: 'supplierId',
|
||||
// label: '供应商id',
|
||||
// },
|
||||
];
|
||||
|
||||
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
|
||||
// export const columns: () => VxeGridProps['columns'] = () => [
|
||||
export const columns: VxeGridProps['columns'] = [
|
||||
{ type: 'checkbox', width: 60 },
|
||||
{
|
||||
title: '主键',
|
||||
field: 'id',
|
||||
},
|
||||
{
|
||||
title: '仓库id',
|
||||
field: 'depotId',
|
||||
minWidth:150,
|
||||
},
|
||||
{
|
||||
title: '资产id',
|
||||
field: 'assetId',
|
||||
width:180,
|
||||
},
|
||||
{
|
||||
title: '流转类型',
|
||||
field: 'type',
|
||||
width:120,
|
||||
},
|
||||
|
||||
{
|
||||
title: '数量',
|
||||
field: 'number',
|
||||
width:120,
|
||||
},
|
||||
{
|
||||
title: '流转时间',
|
||||
field: 'time',
|
||||
width:150,
|
||||
},
|
||||
{
|
||||
title: '操作人id',
|
||||
field: 'userId',
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
field: 'state',
|
||||
width:150,
|
||||
},
|
||||
{
|
||||
title: '备注',
|
||||
field: 'remark',
|
||||
width:180,
|
||||
},
|
||||
{
|
||||
title: '价格',
|
||||
field: 'price',
|
||||
},
|
||||
{
|
||||
title: '总价',
|
||||
field: 'priceSum',
|
||||
},
|
||||
{
|
||||
title: '数量',
|
||||
field: 'number',
|
||||
},
|
||||
{
|
||||
title: '供应商id',
|
||||
field: 'supplierId',
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
field: 'createTime',
|
||||
},
|
||||
{
|
||||
field: 'action',
|
||||
fixed: 'right',
|
||||
slots: { default: 'action' },
|
||||
title: '操作',
|
||||
width: 180,
|
||||
},
|
||||
// {
|
||||
// title: '状态',
|
||||
// field: 'state',
|
||||
// width:150,
|
||||
// },
|
||||
// {
|
||||
// title: '价格',
|
||||
// field: 'price',
|
||||
// },
|
||||
// {
|
||||
// title: '总价',
|
||||
// field: 'priceSum',
|
||||
// },
|
||||
// {
|
||||
// title: '供应商id',
|
||||
// field: 'supplierId',
|
||||
// },
|
||||
// {
|
||||
// title: '创建时间',
|
||||
// field: 'createTime',
|
||||
// },
|
||||
// {
|
||||
// field: 'action',
|
||||
// fixed: 'right',
|
||||
// slots: { default: 'action' },
|
||||
// title: '操作',
|
||||
// width: 180,
|
||||
// },
|
||||
];
|
||||
|
||||
export const modalSchema: FormSchemaGetter = () => [
|
||||
|
@@ -135,47 +135,47 @@ function handleDownloadExcel() {
|
||||
>
|
||||
{{ $t('pages.common.export') }}
|
||||
</a-button>
|
||||
<a-button
|
||||
:disabled="!vxeCheckboxChecked(tableApi)"
|
||||
danger
|
||||
type="primary"
|
||||
v-access:code="['property:log:remove']"
|
||||
@click="handleMultiDelete">
|
||||
{{ $t('pages.common.delete') }}
|
||||
</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-access:code="['property:log:add']"
|
||||
@click="handleAdd"
|
||||
>
|
||||
{{ $t('pages.common.add') }}
|
||||
</a-button>
|
||||
</Space>
|
||||
</template>
|
||||
<template #action="{ row }">
|
||||
<Space>
|
||||
<ghost-button
|
||||
v-access:code="['property:log: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:log:remove']"
|
||||
@click.stop=""
|
||||
>
|
||||
{{ $t('pages.common.delete') }}
|
||||
</ghost-button>
|
||||
</Popconfirm>
|
||||
<!-- <a-button-->
|
||||
<!-- :disabled="!vxeCheckboxChecked(tableApi)"-->
|
||||
<!-- danger-->
|
||||
<!-- type="primary"-->
|
||||
<!-- v-access:code="['property:log:remove']"-->
|
||||
<!-- @click="handleMultiDelete">-->
|
||||
<!-- {{ $t('pages.common.delete') }}-->
|
||||
<!-- </a-button>-->
|
||||
<!-- <a-button-->
|
||||
<!-- type="primary"-->
|
||||
<!-- v-access:code="['property:log:add']"-->
|
||||
<!-- @click="handleAdd"-->
|
||||
<!-- >-->
|
||||
<!-- {{ $t('pages.common.add') }}-->
|
||||
<!-- </a-button>-->
|
||||
</Space>
|
||||
</template>
|
||||
<!-- <template #action="{ row }">-->
|
||||
<!-- <Space>-->
|
||||
<!-- <ghost-button-->
|
||||
<!-- v-access:code="['property:log: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:log:remove']"-->
|
||||
<!-- @click.stop=""-->
|
||||
<!-- >-->
|
||||
<!-- {{ $t('pages.common.delete') }}-->
|
||||
<!-- </ghost-button>-->
|
||||
<!-- </Popconfirm>-->
|
||||
<!-- </Space>-->
|
||||
<!-- </template>-->
|
||||
</BasicTable>
|
||||
<LogModal @reload="tableApi.query()" />
|
||||
</Page>
|
||||
|
@@ -34,12 +34,47 @@ const isUpdate = ref(false);
|
||||
const title = computed(() => {
|
||||
return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add');
|
||||
});
|
||||
//表单项
|
||||
let formModel = reactive<{
|
||||
id: string;
|
||||
groupId: string;
|
||||
attendanceType: string;
|
||||
dateType: number | undefined;
|
||||
startDate: string;
|
||||
endDate: string;
|
||||
userGroupList: any[];
|
||||
}>({
|
||||
id: '',
|
||||
groupId: '',
|
||||
attendanceType: '', //考勤组类型
|
||||
dateType: undefined, //日期类型:1-单个日期,2-长期有效,3-期间有效
|
||||
// dateSingle: null,
|
||||
// dateLong: null,
|
||||
// dateRange: [null, null],
|
||||
startDate: '', //开始日期
|
||||
endDate: '', //结束日期
|
||||
userGroupList: [
|
||||
// scheduleId:undefined,//排班ID
|
||||
// employeeId:undefined,//员工ID
|
||||
// employeeName:undefined,//员工姓名
|
||||
// deptId:undefined,//部门ID
|
||||
// deptName:undefined,//部门名称
|
||||
], //考勤组人员列表
|
||||
});
|
||||
const formRef = ref();
|
||||
let singleDate = ref(''); //排班日期单个日期
|
||||
let longDate = ref(''); //排班日期从此日起长期有效
|
||||
let rangeDate = ref(['', '']); //排班日期在此期间有效
|
||||
const rules = {
|
||||
groupId: [{ required: true, message: '请选择考勤组' }],
|
||||
attendanceType: [{ required: true }],
|
||||
dateType: [{ required: true, message: '请选择排班日期' }],
|
||||
};
|
||||
const groupOptions = ref<any[]>([]);
|
||||
const groupMap = ref<Record<string, any>>({}); // 用于快速查找
|
||||
const tableData = reactive<
|
||||
let tableData = reactive<
|
||||
{ dept: { unitId: string | number; unitName: string }; users: PersonVO[] }[]
|
||||
>([]);
|
||||
|
||||
>([]); //存放考勤组人员列表数据
|
||||
const columns = [
|
||||
{
|
||||
title: '序号',
|
||||
@@ -108,44 +143,44 @@ function handleRemoveRow(index: number) {
|
||||
}
|
||||
|
||||
function handleTableData(newTableData: any) {
|
||||
tableData.splice(0, tableData.length, ...newTableData);
|
||||
// 如果现有数据为空,直接替换
|
||||
if (tableData.length === 0) {
|
||||
tableData.splice(0, 0, ...newTableData);
|
||||
return;
|
||||
}
|
||||
|
||||
// 如果新数据为空,不做处理
|
||||
if (newTableData.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 处理有数据的情况
|
||||
for (const newItem of newTableData) {
|
||||
// 查找是否已存在相同部门
|
||||
const existingDeptIndex = tableData.findIndex(
|
||||
(item) => item.dept.unitId === newItem.dept.unitId,
|
||||
);
|
||||
|
||||
if (existingDeptIndex !== -1) {
|
||||
// 找到相同部门,检查人员是否有重复
|
||||
const existingDept = tableData[existingDeptIndex];
|
||||
for (const newUser of newItem.users) {
|
||||
// 检查该用户是否已存在
|
||||
const userExists = existingDept?.users.some(
|
||||
(existingUser) => existingUser.id === newUser.id,
|
||||
);
|
||||
if (!userExists) {
|
||||
// 用户不存在,添加到现有部门
|
||||
existingDept?.users.push(newUser);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 部门不存在,直接添加新部门
|
||||
tableData.push(newItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
//表单项
|
||||
const formModel = reactive<{
|
||||
id: string;
|
||||
groupId: string;
|
||||
attendanceType: string;
|
||||
dateType: number | undefined;
|
||||
startDate: string;
|
||||
endDate: string;
|
||||
userGroupList: any[];
|
||||
}>({
|
||||
id: '',
|
||||
groupId: '',
|
||||
attendanceType: '', //考勤组类型
|
||||
dateType: undefined, //日期类型:1-单个日期,2-长期有效,3-期间有效
|
||||
// dateSingle: null,
|
||||
// dateLong: null,
|
||||
// dateRange: [null, null],
|
||||
startDate: '', //开始日期
|
||||
endDate: '', //结束日期
|
||||
userGroupList: [
|
||||
// scheduleId:undefined,//排班ID
|
||||
// employeeId:undefined,//员工ID
|
||||
// employeeName:undefined,//员工姓名
|
||||
// deptId:undefined,//部门ID
|
||||
// deptName:undefined,//部门名称
|
||||
], //考勤组人员列表
|
||||
});
|
||||
const singleDate = ref('');
|
||||
const longDate = ref('');
|
||||
const rangeDate = ref(['', '']);
|
||||
const formRef = ref();
|
||||
const rules = {
|
||||
groupId: [{ required: true, message: '请选择考勤组' }],
|
||||
attendanceType: [{ required: true }],
|
||||
dateType: [{ required: true, message: '请选择排班日期' }],
|
||||
};
|
||||
|
||||
const [BasicForm, formApi] = useVbenForm({
|
||||
commonConfig: {
|
||||
// 默认占满两列
|
||||
@@ -173,7 +208,7 @@ const [UnitPersonModal, unitPersonmodalApi] = useVbenModal({
|
||||
});
|
||||
const [BasicModal, modalApi] = useVbenModal({
|
||||
// 在这里更改宽度
|
||||
class: 'w-[70%]',
|
||||
class: 'w-[85%]',
|
||||
fullscreenButton: false,
|
||||
onBeforeClose,
|
||||
onClosed: handleClosed,
|
||||
@@ -183,7 +218,6 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
return null;
|
||||
}
|
||||
await getGroupList();
|
||||
console.log(getDictOptions('wy_kqlx'));
|
||||
modalApi.modalLoading(true);
|
||||
const { id } = modalApi.getData() as { id?: number | string };
|
||||
isUpdate.value = !!id;
|
||||
@@ -220,7 +254,6 @@ async function getGroupList() {
|
||||
});
|
||||
}
|
||||
function chooseGroup(value: any) {
|
||||
console.log(value);
|
||||
const group = groupMap.value[value];
|
||||
if (group) {
|
||||
formModel.attendanceType = String(group.attendanceType);
|
||||
@@ -232,12 +265,10 @@ async function handleDateTypeChange(value: any) {
|
||||
async function handleConfirm() {
|
||||
try {
|
||||
modalApi.lock(true);
|
||||
// await formRef.value.validate(); // 先校验
|
||||
await formRef.value.validate(); // 先校验
|
||||
const data = formModel;
|
||||
const { id } = modalApi.getData() as { id?: string };
|
||||
data.id = id ? id : '';
|
||||
console.log(data);
|
||||
|
||||
if (data.dateType == 1) {
|
||||
if (singleDate.value) {
|
||||
data.startDate = dayjs(singleDate.value).format('YYYY-MM-DD');
|
||||
@@ -264,10 +295,36 @@ async function handleConfirm() {
|
||||
data.endDate = dayjs(rangeDate.value[1]).format('YYYY-MM-DD');
|
||||
}
|
||||
}
|
||||
// await (isUpdate.value ? arrangementUpdate(data) : arrangementAdd(data));
|
||||
for (const item of tableData) {
|
||||
for (const user of item.users) {
|
||||
data.userGroupList.push({
|
||||
deptId: item.dept.unitId, //部门ID
|
||||
deptName: item.dept.unitName, //部门名称
|
||||
employeeId: user.id, //员工ID
|
||||
employeeName: user.userName, //员工姓名
|
||||
});
|
||||
}
|
||||
}
|
||||
await (isUpdate.value ? arrangementUpdate(data) : arrangementAdd(data));
|
||||
resetInitialized();
|
||||
emit('reload');
|
||||
// 重置表单数据
|
||||
Object.assign(formModel, {
|
||||
id: '',
|
||||
groupId: '',
|
||||
attendanceType: '',
|
||||
dateType: undefined,
|
||||
startDate: '',
|
||||
endDate: '',
|
||||
userGroupList: [],
|
||||
});
|
||||
// 重置其他数据
|
||||
tableData.length = 0;
|
||||
singleDate.value = '';
|
||||
longDate.value = '';
|
||||
rangeDate.value = ['', ''];
|
||||
modalApi.close();
|
||||
await formApi.resetForm();
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
} finally {
|
||||
@@ -276,8 +333,27 @@ async function handleConfirm() {
|
||||
}
|
||||
|
||||
async function handleClosed() {
|
||||
// 重置表单数据
|
||||
Object.assign(formModel, {
|
||||
id: '',
|
||||
groupId: '',
|
||||
attendanceType: '',
|
||||
dateType: undefined,
|
||||
startDate: '',
|
||||
endDate: '',
|
||||
userGroupList: [],
|
||||
});
|
||||
|
||||
// 重置其他数据
|
||||
tableData.length = 0;
|
||||
singleDate.value = '';
|
||||
longDate.value = '';
|
||||
rangeDate.value = ['', ''];
|
||||
|
||||
// 重置表单状态
|
||||
await formApi.resetForm();
|
||||
resetInitialized();
|
||||
modalApi.close();
|
||||
}
|
||||
onMounted(() => {});
|
||||
</script>
|
||||
|
@@ -1,11 +1,13 @@
|
||||
<script lang="ts" setup>
|
||||
import { Radio, Button, Calendar, DatePicker } from 'ant-design-vue';
|
||||
import { Radio, Button, Calendar, DatePicker, message } from 'ant-design-vue';
|
||||
import type { RadioChangeEvent, BadgeProps } from 'ant-design-vue';
|
||||
import { ref } from 'vue';
|
||||
import { ref, onMounted, reactive } from 'vue';
|
||||
import { Dayjs } from 'dayjs';
|
||||
import dayjs from 'dayjs';
|
||||
import arrangementModal from './arrangement-modal.vue';
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
import type { PersonVO } from './type';
|
||||
import { arrangementCalender } from '#/api/property/attendanceManagement/arrangement'; // 导入接口
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'changeView', value: boolean): void;
|
||||
}>();
|
||||
@@ -13,6 +15,57 @@ const props = defineProps<{
|
||||
viewMode: 'calender' | 'schedule';
|
||||
}>();
|
||||
const selectedDate = ref();
|
||||
const calendarData = reactive<any[]>([]);
|
||||
const loading = ref(false);
|
||||
// 查询日历数据
|
||||
const fetchCalendarData = async (month?: string) => {
|
||||
try {
|
||||
loading.value = true;
|
||||
const params = {
|
||||
month:
|
||||
month ||
|
||||
selectedDate.value?.format('YYYY-MM') ||
|
||||
dayjs().format('YYYY-MM'),
|
||||
};
|
||||
const res = await arrangementCalender(params);
|
||||
const currentMonth =
|
||||
month ||
|
||||
selectedDate.value?.format('YYYY-MM') ||
|
||||
dayjs().format('YYYY-MM'); //当前月份的开始日期
|
||||
// 生成日历渲染数据结构
|
||||
for (const row of res.rows) {
|
||||
if (row.endDate) {
|
||||
//当开始时间小于当前月份的开始日期
|
||||
if (row.startDate <= currentMonth) {
|
||||
console.log(row, '小');
|
||||
|
||||
//如果结束时间小于当前月份的结束时间,则生成当前月份开始时间到row.endDate结束时间的n条数据
|
||||
//如果结束时间大于等于当前月份的结束时间,则生成当前月份开始时间到当前月份结束时间(即当前月份天数)的n条数据
|
||||
} else {
|
||||
//当开始时间大于当前月份的开始日期
|
||||
//如果结束时间小于当前月份的结束时间,则生成开始时间到结束时间的n条数据
|
||||
console.log(row, '大');
|
||||
}
|
||||
} else {
|
||||
calendarData.push({
|
||||
data: row.startDate,
|
||||
item: {
|
||||
id: row.id,
|
||||
groupName: row.attendanceGroup.groupName,
|
||||
groupId: row.attendanceGroup.id,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
// if (response) {
|
||||
// calendarData.value = response.data || [];
|
||||
// console.log('日历数据:', calendarData.value);
|
||||
// }
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
// 切换视图模式
|
||||
function handleViewModeChange(e: RadioChangeEvent): void {
|
||||
// 将父组件的isCalenderView变为true
|
||||
@@ -28,13 +81,22 @@ const scheduleData: {
|
||||
{ date: '2025-07-06', list: [{ type: 'success', content: '8月8日事件' }] },
|
||||
// ...
|
||||
];
|
||||
|
||||
const getListData2 = (
|
||||
current: Dayjs,
|
||||
): { type: BadgeProps['status']; content: string }[] => {
|
||||
const dateStr = current.format('YYYY-MM-DD');
|
||||
const found = scheduleData.find((item) => item.date === dateStr);
|
||||
return found ? found.list : [];
|
||||
// 优先使用接口数据
|
||||
if (calendarData.length > 0) {
|
||||
const found = calendarData.find((item) => item.date === dateStr);
|
||||
if (found) {
|
||||
return found.list || [];
|
||||
}
|
||||
}
|
||||
// 如果没有找到数据,返回空数组
|
||||
return [];
|
||||
};
|
||||
|
||||
const getListData = (
|
||||
value: Dayjs,
|
||||
): { type: BadgeProps['status']; content: string }[] => {
|
||||
@@ -84,6 +146,11 @@ function handleAdd() {
|
||||
modalApi.setData({});
|
||||
modalApi.open();
|
||||
}
|
||||
|
||||
// 页面初始化时加载数据
|
||||
onMounted(() => {
|
||||
fetchCalendarData();
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<div class="flex h-full flex-col">
|
||||
@@ -98,7 +165,11 @@ function handleAdd() {
|
||||
</Radio.Group>
|
||||
<div class="my-auto flex gap-1">
|
||||
<div class="my-auto">排班日历</div>
|
||||
<DatePicker picker="month" v-model:value="selectedDate" />
|
||||
<DatePicker
|
||||
picker="month"
|
||||
v-model:value="selectedDate"
|
||||
@change="fetchCalendarData()"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
@@ -110,6 +181,7 @@ function handleAdd() {
|
||||
v-model:value="selectedDate"
|
||||
:mode="'month'"
|
||||
:headerRender="customHeader"
|
||||
:loading="loading"
|
||||
>
|
||||
<template #dateCellRender="{ current }">
|
||||
<ul class="events">
|
||||
@@ -140,7 +212,7 @@ function handleAdd() {
|
||||
</template>
|
||||
</Calendar>
|
||||
</div>
|
||||
<ArrangementModal @reload="" />
|
||||
<ArrangementModal @reload="fetchCalendarData()" />
|
||||
</div>
|
||||
</template>
|
||||
<style scoped>
|
||||
|
@@ -62,10 +62,10 @@ const deptTree = reactive<
|
||||
]);
|
||||
|
||||
//勾选内容
|
||||
const selectedUsers = ref<PersonVO[]>([]);
|
||||
let selectedUsers = ref<PersonVO[]>([]);
|
||||
//已选内容,需要展示到父组件
|
||||
|
||||
const tableData = reactive<
|
||||
let tableData = reactive<
|
||||
{
|
||||
dept: { unitId: string | number; unitName: string };
|
||||
users: PersonVO[];
|
||||
@@ -236,6 +236,8 @@ async function handleConfirm() {
|
||||
console.log(tableData);
|
||||
resetInitialized();
|
||||
emit('reload', tableData);
|
||||
tableData = [];
|
||||
selectedUsers.value =[];
|
||||
modalApi.close();
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
|
@@ -4,11 +4,11 @@ import {renderDict} from "#/utils/render";
|
||||
import {getDictOptions} from "#/utils/dict";
|
||||
|
||||
export const querySchema: FormSchemaGetter = () => [
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'orderTypeNo',
|
||||
label: '工单类型编号',
|
||||
},
|
||||
// {
|
||||
// component: 'Input',
|
||||
// fieldName: 'orderTypeNo',
|
||||
// label: '工单类型编号',
|
||||
// },
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'orderTypeName',
|
||||
@@ -25,7 +25,7 @@ export const querySchema: FormSchemaGetter = () => [
|
||||
];
|
||||
|
||||
export const columns: VxeGridProps['columns'] = [
|
||||
{ type: 'checkbox', width: 60 },
|
||||
// { type: 'checkbox', width: 60 },
|
||||
// {
|
||||
// title: '工单类型编号',
|
||||
// field: 'orderTypeNo',
|
||||
@@ -33,6 +33,8 @@ export const columns: VxeGridProps['columns'] = [
|
||||
{
|
||||
title: '类型名称',
|
||||
field: 'orderTypeName',
|
||||
treeNode: true,
|
||||
minWidth:180,
|
||||
},
|
||||
{
|
||||
title: '运作模式',
|
||||
@@ -42,15 +44,17 @@ export const columns: VxeGridProps['columns'] = [
|
||||
return renderDict(row.operationMode, 'pro_operation_pattern');
|
||||
},
|
||||
},
|
||||
minWidth:'120'
|
||||
width:180,
|
||||
},
|
||||
{
|
||||
title: '排序值',
|
||||
field: 'sort',
|
||||
width:180,
|
||||
},
|
||||
{
|
||||
title: '累计工单数量',
|
||||
field: 'number',
|
||||
width:180,
|
||||
},
|
||||
{
|
||||
title: '是否支持转单',
|
||||
@@ -60,7 +64,7 @@ export const columns: VxeGridProps['columns'] = [
|
||||
return renderDict(row.isTransfers, 'support_transferring_orders');
|
||||
},
|
||||
},
|
||||
minWidth:'120'
|
||||
width:180,
|
||||
},
|
||||
{
|
||||
field: 'action',
|
||||
@@ -87,6 +91,11 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '父级类型',
|
||||
fieldName: 'parentId',
|
||||
component: 'Select',
|
||||
},
|
||||
{
|
||||
label: '运作模式',
|
||||
fieldName: 'operationMode',
|
||||
|
@@ -8,13 +8,14 @@ import {
|
||||
type VxeGridProps
|
||||
} from '#/adapter/vxe-table';
|
||||
import {
|
||||
workOrdersTypeList,
|
||||
workOrdersTypeListAll,
|
||||
workOrdersTypeRemove,
|
||||
} from '#/api/property/businessManagement/workOrdersType';
|
||||
import type { WorkOrdersTypeForm } from '#/api/property/businessManagement/workOrdersType/model';
|
||||
import workOrdersTypeModal from './workOrdersType-modal.vue';
|
||||
import workOrdersTypeDetail from './workOrdersType-detail.vue';
|
||||
import { columns, querySchema } from './data';
|
||||
import {ref} from "vue";
|
||||
|
||||
const formOptions: VbenFormProps = {
|
||||
commonConfig: {
|
||||
@@ -39,21 +40,27 @@ const gridOptions: VxeGridProps = {
|
||||
columns,
|
||||
height: 'auto',
|
||||
keepSource: true,
|
||||
pagerConfig: {},
|
||||
pagerConfig: {
|
||||
enabled:false,
|
||||
},
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }, formValues = {}) => {
|
||||
return await workOrdersTypeList({
|
||||
pageNum: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
query: async (_, formValues = {}) => {
|
||||
const resp = await workOrdersTypeListAll({
|
||||
...formValues,
|
||||
});
|
||||
return { rows: resp };
|
||||
},
|
||||
},
|
||||
},
|
||||
rowConfig: {
|
||||
keyField: 'id',
|
||||
},
|
||||
treeConfig: {
|
||||
parentField: 'parentId',
|
||||
rowField: 'id',
|
||||
transform: true,
|
||||
},
|
||||
// 表格全局唯一表示 保存列配置需要用到
|
||||
id: 'property-workOrdersType-index'
|
||||
};
|
||||
@@ -111,14 +118,14 @@ function handleMultiDelete() {
|
||||
<BasicTable table-title="工单类型列表">
|
||||
<template #toolbar-tools>
|
||||
<Space>
|
||||
<a-button
|
||||
:disabled="!vxeCheckboxChecked(tableApi)"
|
||||
danger
|
||||
type="primary"
|
||||
v-access:code="['property:workOrdersType:remove']"
|
||||
@click="handleMultiDelete">
|
||||
{{ $t('pages.common.delete') }}
|
||||
</a-button>
|
||||
<!-- <a-button-->
|
||||
<!-- :disabled="!vxeCheckboxChecked(tableApi)"-->
|
||||
<!-- danger-->
|
||||
<!-- type="primary"-->
|
||||
<!-- v-access:code="['property:workOrdersType:remove']"-->
|
||||
<!-- @click="handleMultiDelete">-->
|
||||
<!-- {{ $t('pages.common.delete') }}-->
|
||||
<!-- </a-button>-->
|
||||
<a-button
|
||||
type="primary"
|
||||
v-access:code="['property:workOrdersType:add']"
|
||||
|
@@ -30,9 +30,9 @@ async function handleOpenChange(open: boolean) {
|
||||
<template>
|
||||
<BasicModal :footer="false" :fullscreen-button="false" title="工单类型信息" class="w-[70%]">
|
||||
<Descriptions v-if="workOrdersTypeInfoDetail" size="small" :column="2" bordered :labelStyle="{width:'120px'}">
|
||||
<DescriptionsItem label="工单类型编号">
|
||||
{{ workOrdersTypeInfoDetail.orderTypeNo }}
|
||||
</DescriptionsItem>
|
||||
<!-- <DescriptionsItem label="工单类型编号">-->
|
||||
<!-- {{ workOrdersTypeInfoDetail.orderTypeNo }}-->
|
||||
<!-- </DescriptionsItem>-->
|
||||
<DescriptionsItem label="类型名称">
|
||||
{{ workOrdersTypeInfoDetail.orderTypeName }}
|
||||
</DescriptionsItem>
|
||||
|
@@ -1,12 +1,16 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue';
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
import { cloneDeep } from '@vben/utils';
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import { workOrdersTypeAdd, workOrdersTypeInfo, workOrdersTypeUpdate } from '#/api/property/businessManagement/workOrdersType';
|
||||
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
||||
import { modalSchema } from './data';
|
||||
import {computed, ref} from 'vue';
|
||||
import {useVbenModal} from '@vben/common-ui';
|
||||
import {$t} from '@vben/locales';
|
||||
import {cloneDeep} from '@vben/utils';
|
||||
import {useVbenForm} from '#/adapter/form';
|
||||
import {
|
||||
workOrdersTypeAdd,
|
||||
workOrdersTypeInfo, workOrdersTypeListAll,
|
||||
workOrdersTypeUpdate
|
||||
} from '#/api/property/businessManagement/workOrdersType';
|
||||
import {defaultFormValueGetter, useBeforeCloseDiff} from '#/utils/popup';
|
||||
import {modalSchema} from './data';
|
||||
|
||||
const emit = defineEmits<{ reload: [] }>();
|
||||
const isUpdate = ref(false);
|
||||
@@ -31,7 +35,7 @@ const [BasicForm, formApi] = useVbenForm({
|
||||
wrapperClass: 'grid-cols-2',
|
||||
});
|
||||
|
||||
const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
|
||||
const {onBeforeClose, markInitialized, resetInitialized} = useBeforeCloseDiff(
|
||||
{
|
||||
initializedGetter: defaultFormValueGetter(formApi),
|
||||
currentGetter: defaultFormValueGetter(formApi),
|
||||
@@ -40,7 +44,7 @@ const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
|
||||
|
||||
const [BasicModal, modalApi] = useVbenModal({
|
||||
// 在这里更改宽度
|
||||
class: 'w-[60%]',
|
||||
class: 'w-[70%]',
|
||||
fullscreenButton: false,
|
||||
onBeforeClose,
|
||||
onClosed: handleClosed,
|
||||
@@ -50,10 +54,9 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
return null;
|
||||
}
|
||||
modalApi.modalLoading(true);
|
||||
|
||||
const { id } = modalApi.getData() as { id?: number | string };
|
||||
const {id} = modalApi.getData() as { id?: number | string };
|
||||
isUpdate.value = !!id;
|
||||
|
||||
await initTypeOptions(id)
|
||||
if (isUpdate.value && id) {
|
||||
const record = await workOrdersTypeInfo(id);
|
||||
record.operationMode = record.operationMode?.toString();
|
||||
@@ -69,7 +72,7 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
async function handleConfirm() {
|
||||
try {
|
||||
modalApi.lock(true);
|
||||
const { valid } = await formApi.validate();
|
||||
const {valid} = await formApi.validate();
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
@@ -90,11 +93,30 @@ async function handleClosed() {
|
||||
await formApi.resetForm();
|
||||
resetInitialized();
|
||||
}
|
||||
|
||||
async function initTypeOptions(id:string) {
|
||||
let params = {
|
||||
excludeId:id,
|
||||
filterSubNodes: true //过滤子级
|
||||
}
|
||||
const typeList = await workOrdersTypeListAll(params)
|
||||
formApi.updateSchema([{
|
||||
componentProps: () => ({
|
||||
options: typeList,
|
||||
showSearch: true,
|
||||
optionFilterProp: 'orderTypeName',
|
||||
fieldNames: {label: 'orderTypeName', value: 'id'},
|
||||
allowClear: true,
|
||||
}),
|
||||
fieldName: 'parentId',
|
||||
},
|
||||
]);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<BasicModal :title="title">
|
||||
<BasicForm />
|
||||
<BasicForm/>
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
|
@@ -23,8 +23,10 @@ import { resident_unitList } from '#/api/property/resident/unit';
|
||||
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
||||
|
||||
import cleanDetailModal from './clean-detail-modal.vue';
|
||||
import { modalSchema } from './data';
|
||||
// import { modalSchema } from './data';
|
||||
import { communityTree } from '#/api/property/community';
|
||||
import { getDictOptions } from '#/utils/dict';
|
||||
|
||||
const emit = defineEmits<{ reload: [] }>();
|
||||
|
||||
// 计算合计费用
|
||||
@@ -59,7 +61,142 @@ let unitListData: { id: any; name: string }[] = [];
|
||||
const editUnitId = ref('');
|
||||
const editCleanOrderId = ref('');
|
||||
const detailModal = ref(null);
|
||||
|
||||
const modalSchema = [
|
||||
{
|
||||
label: '主键id',
|
||||
fieldName: 'id',
|
||||
component: 'Input',
|
||||
dependencies: {
|
||||
show: () => false,
|
||||
triggerFields: [''],
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '服务地址(房间号)',
|
||||
component: 'TreeSelect',
|
||||
defaultValue: undefined,
|
||||
fieldName: 'location',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '开始时间',
|
||||
fieldName: 'starTime',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
placeholder: '请选择开始时间',
|
||||
},
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '结束时间',
|
||||
fieldName: 'endTime',
|
||||
component: 'DatePicker',
|
||||
componentProps: (values: any) => ({
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
placeholder: !values.starTime
|
||||
? '请先选择开始时间'
|
||||
: `请选择结束时间(结束时间不能早于开始时间)`,
|
||||
disabled: isReadonly.value || !values.starTime, // 没选开始时间时禁用
|
||||
disabledDate: (current: any) => {
|
||||
if (!values.starTime) return false;
|
||||
// 只允许选择大于等于开始时间的日期
|
||||
return current && current < dayjs(values.starTime).startOf('second');
|
||||
},
|
||||
}),
|
||||
rules: 'required',
|
||||
dependencies: {
|
||||
triggerFields: ['starTime'],
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '申请人',
|
||||
fieldName: 'persion',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '联系电话',
|
||||
fieldName: 'phone',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '申请单位',
|
||||
fieldName: 'unitId',
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
api: resident_unitList,
|
||||
resultField: 'rows',
|
||||
labelField: 'name',
|
||||
valueField: 'id',
|
||||
placeholder: '请选择单位',
|
||||
},
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '支付状态',
|
||||
fieldName: 'payState',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options: [
|
||||
{
|
||||
label: '待支付',
|
||||
value: 0,
|
||||
},
|
||||
{
|
||||
label: '已支付',
|
||||
value: 1,
|
||||
},
|
||||
],
|
||||
},
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '保洁类型',
|
||||
fieldName: 'type',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options: getDictOptions('pro_cleaning_type'),
|
||||
},
|
||||
rules: 'selectRequired',
|
||||
},
|
||||
{
|
||||
label: '评价',
|
||||
fieldName: 'serviceEvalua',
|
||||
component: 'Rate',
|
||||
componentProps: {
|
||||
allowHalf: false,
|
||||
count: 5,
|
||||
tooltips: ['1星', '2星', '3星', '4星', '5星'],
|
||||
defaultValue: 0,
|
||||
},
|
||||
dependencies: {
|
||||
show: () => (isReadonly.value ? true : false),
|
||||
triggerFields: [''],
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '评价文本',
|
||||
fieldName: 'serviceEvaluaText',
|
||||
component: 'Input',
|
||||
dependencies: {
|
||||
show: () => (isReadonly.value ? true : false),
|
||||
triggerFields: [''],
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '联系电话',
|
||||
fieldName: 'imgUrl',
|
||||
component: 'Input',
|
||||
dependencies: {
|
||||
show: () => (isReadonly.value ? true : false),
|
||||
triggerFields: [''],
|
||||
},
|
||||
},
|
||||
];
|
||||
const [BasicForm, formApi] = useVbenForm({
|
||||
commonConfig: {
|
||||
// 默认占满两列
|
||||
@@ -71,7 +208,6 @@ const [BasicForm, formApi] = useVbenForm({
|
||||
class: 'w-full',
|
||||
disabled: isReadonly.value,
|
||||
})),
|
||||
schema: modalSchema(isReadonly.value),
|
||||
},
|
||||
// 1. 使用正确的属性名 handleValuesChange
|
||||
handleValuesChange: async (values, fieldsChanged) => {
|
||||
@@ -103,7 +239,10 @@ const [BasicForm, formApi] = useVbenForm({
|
||||
}
|
||||
}
|
||||
},
|
||||
schema: modalSchema(),
|
||||
// schema: computed(() => {
|
||||
// modalSchema(isReadonly.value);
|
||||
// }),
|
||||
schema: modalSchema,
|
||||
showDefaultActions: false,
|
||||
wrapperClass: 'grid-cols-2',
|
||||
});
|
||||
@@ -126,6 +265,8 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
if (!isOpen) {
|
||||
return null;
|
||||
}
|
||||
console.log(isReadonly.value);
|
||||
|
||||
// 查询服务地址树形结构
|
||||
setupCommunitySelect();
|
||||
modalApi.modalLoading(true);
|
||||
@@ -372,6 +513,8 @@ async function handleClosed() {
|
||||
// 获取服务地址
|
||||
async function setupCommunitySelect() {
|
||||
const areaList = await communityTree(4);
|
||||
console.log(areaList);
|
||||
|
||||
// 选中后显示在输入框的值 即父节点 / 子节点
|
||||
// addFullName(areaList, 'areaName', ' / ');
|
||||
const splitStr = '/';
|
||||
|
@@ -5,10 +5,10 @@ import { resident_unitList } from '#/api/property/resident/unit';
|
||||
import { useCleanStore } from '#/store';
|
||||
import type { FormSchema } from '../../../../../../../packages/@core/ui-kit/form-ui/src/types';
|
||||
import dayjs from 'dayjs';
|
||||
import {h} from "vue";
|
||||
import {Rate} from "ant-design-vue";
|
||||
import {getDictOptions} from "#/utils/dict";
|
||||
import {renderDict} from "#/utils/render";
|
||||
import { h } from 'vue';
|
||||
import { Rate } from 'ant-design-vue';
|
||||
import { getDictOptions } from '#/utils/dict';
|
||||
import { renderDict } from '#/utils/render';
|
||||
const cleanStore = useCleanStore();
|
||||
|
||||
export const querySchema: (areaList: any[]) => FormSchema[] = (areaList) => [
|
||||
@@ -120,7 +120,7 @@ export const columns: VxeGridProps['columns'] = [
|
||||
field: 'type',
|
||||
width: 180,
|
||||
slots: {
|
||||
default: ({row}) => {
|
||||
default: ({ row }) => {
|
||||
return renderDict(row.type, 'pro_cleaning_type');
|
||||
},
|
||||
},
|
||||
@@ -130,7 +130,7 @@ export const columns: VxeGridProps['columns'] = [
|
||||
field: 'serviceEvalua',
|
||||
width: 180,
|
||||
slots: {
|
||||
default: ({row}) => {
|
||||
default: ({ row }) => {
|
||||
return h(Rate, {
|
||||
value: row.serviceEvalua || 0,
|
||||
disabled: true,
|
||||
@@ -153,12 +153,13 @@ export const columns: VxeGridProps['columns'] = [
|
||||
fixed: 'right',
|
||||
slots: { default: 'action' },
|
||||
title: '操作',
|
||||
width:'200'
|
||||
width: '200',
|
||||
},
|
||||
|
||||
];
|
||||
|
||||
export const modalSchema: (isReadonly: boolean) => FormSchema[] = (isReadonly) => [
|
||||
export const modalSchema: (isReadonly: boolean) => FormSchema[] = (
|
||||
isReadonly,
|
||||
) => [
|
||||
{
|
||||
label: '主键id',
|
||||
fieldName: 'id',
|
||||
@@ -193,9 +194,11 @@ export const modalSchema: (isReadonly: boolean) => FormSchema[] = (isReadonly) =
|
||||
componentProps: (values) => ({
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
placeholder: !values.starTime?'请先选择开始时间':`请选择结束时间(结束时间不能早于开始时间)`,
|
||||
placeholder: !values.starTime
|
||||
? '请先选择开始时间'
|
||||
: `请选择结束时间(结束时间不能早于开始时间)`,
|
||||
disabled: isReadonly || !values.starTime, // 没选开始时间时禁用
|
||||
disabledDate: (current:any) => {
|
||||
disabledDate: (current: any) => {
|
||||
if (!values.starTime) return false;
|
||||
// 只允许选择大于等于开始时间的日期
|
||||
return current && current < dayjs(values.starTime).startOf('second');
|
||||
@@ -266,8 +269,29 @@ export const modalSchema: (isReadonly: boolean) => FormSchema[] = (isReadonly) =
|
||||
allowHalf: false,
|
||||
count: 5,
|
||||
tooltips: ['1星', '2星', '3星', '4星', '5星'],
|
||||
defaultValue: 0
|
||||
defaultValue: 0,
|
||||
},
|
||||
dependencies: {
|
||||
show: () => (isReadonly ? true : false),
|
||||
triggerFields: [''],
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '评价文本',
|
||||
fieldName: 'serviceEvaluaText',
|
||||
component: 'Input',
|
||||
dependencies: {
|
||||
show: () => (isReadonly ? true : false),
|
||||
triggerFields: [''],
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '联系电话',
|
||||
fieldName: 'imgUrl',
|
||||
component: 'Input',
|
||||
dependencies: {
|
||||
show: () => (isReadonly ? true : false),
|
||||
triggerFields: [''],
|
||||
},
|
||||
rules: 'required',
|
||||
},
|
||||
];
|
||||
|
@@ -135,7 +135,6 @@ function handleView(row: Required<CleanForm>) {
|
||||
function handleAudit(row: any) {
|
||||
// 审核逻辑
|
||||
// TODO: 实现审核功能
|
||||
console.log('审核', row);
|
||||
modalApi.setData({ id: row.id, readonly: true, audit: true, row: row });
|
||||
modalApi.open();
|
||||
}
|
||||
@@ -143,7 +142,6 @@ function handleAudit(row: any) {
|
||||
function handleRefund(row: any) {
|
||||
// 退定逻辑
|
||||
// TODO: 实现退定功能
|
||||
console.log('退定', row);
|
||||
modalApi.setData({ id: row.id, readonly: true, refund: true, row: row });
|
||||
modalApi.open();
|
||||
}
|
||||
|
@@ -7,7 +7,7 @@ import { carChargeAdd } from '#/api/property/carCharge';
|
||||
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
||||
import { addModalSchema } from './data';
|
||||
import { communityTree } from '#/api/property/community';
|
||||
import { cloneDeep,handleNode,getPopupContainer } from '@vben/utils';
|
||||
import { cloneDeep, handleNode, getPopupContainer } from '@vben/utils';
|
||||
|
||||
const emit = defineEmits<{ reload: [] }>();
|
||||
|
||||
@@ -41,11 +41,11 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
onConfirm: handleConfirm,
|
||||
onOpenChange: async (isOpen) => {
|
||||
if (!isOpen) return null;
|
||||
setupCommunitySelect()
|
||||
setupCommunitySelect();
|
||||
modalApi.modalLoading(true);
|
||||
await formApi.resetForm();
|
||||
await markInitialized();
|
||||
await formApi.setValues({costType:'2'});
|
||||
await formApi.setValues({ costType: '2' });
|
||||
modalApi.modalLoading(false);
|
||||
},
|
||||
});
|
||||
@@ -72,12 +72,12 @@ async function handleClosed() {
|
||||
resetInitialized();
|
||||
}
|
||||
async function setupCommunitySelect() {
|
||||
const areaList = await communityTree(4);
|
||||
const areaList = await communityTree(3);
|
||||
// 选中后显示在输入框的值 即父节点 / 子节点
|
||||
// addFullName(areaList, 'areaName', ' / ');
|
||||
const splitStr = '/';
|
||||
handleNode(areaList, 'label', splitStr, function (node: any) {
|
||||
if (node.level != 4) {
|
||||
if (node.level != 3) {
|
||||
node.disabled = true;
|
||||
}
|
||||
});
|
||||
@@ -112,7 +112,7 @@ async function setupCommunitySelect() {
|
||||
<BasicModal :title="title">
|
||||
<BasicForm />
|
||||
</BasicModal>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
/* 使用 :deep() 穿透 scoped 样式,影响子组件 */
|
||||
@@ -126,4 +126,4 @@ async function setupCommunitySelect() {
|
||||
/* 有些浏览器需要这个来覆盖默认颜色 */
|
||||
-webkit-text-fill-color: rgb(0 0 0 / 65%) !important;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
@@ -111,7 +111,6 @@ const schema = [
|
||||
itemId: '',
|
||||
meterTypeId: '',
|
||||
});
|
||||
console.log(await formApi.getValues());
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -216,8 +215,6 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
isUpdate.value = !!id;
|
||||
if (isUpdate.value && id) {
|
||||
const record = await costMeterWaterInfo(id);
|
||||
console.log(1, record);
|
||||
|
||||
const costItemsRes = await costItemSettingList({
|
||||
pageSize: 1000000000,
|
||||
pageNum: 1,
|
||||
@@ -253,7 +250,6 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
},
|
||||
]);
|
||||
await formApi.setValues(record);
|
||||
console.log(2, await formApi.getValues());
|
||||
}
|
||||
await markInitialized();
|
||||
|
||||
@@ -270,8 +266,6 @@ async function handleConfirm() {
|
||||
}
|
||||
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
|
||||
const data = cloneDeep(await formApi.getValues());
|
||||
console.log(data);
|
||||
|
||||
await (isUpdate.value
|
||||
? costMeterWaterUpdate(data)
|
||||
: costMeterWaterAdd(data));
|
||||
|
@@ -4,146 +4,6 @@ import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
import { getDictOptions } from '#/utils/dict';
|
||||
import { renderDict } from '#/utils/render';
|
||||
|
||||
export const querySchema: FormSchemaGetter = () => [
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'userId',
|
||||
label: '用户ID,关联用户表',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'username',
|
||||
label: '申请人姓名',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'departmentId',
|
||||
label: '部门ID,关联部门表',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'departmentName',
|
||||
label: '部门名称',
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
},
|
||||
fieldName: 'leaveType',
|
||||
label: '请假类型',
|
||||
},
|
||||
{
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
},
|
||||
fieldName: 'startTime',
|
||||
label: '开始时间',
|
||||
},
|
||||
{
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
},
|
||||
fieldName: 'endTime',
|
||||
label: '结束时间',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'totalDuration',
|
||||
label: '合计时间,如3天5个小时',
|
||||
},
|
||||
{
|
||||
component: 'Textarea',
|
||||
fieldName: 'reason',
|
||||
label: '请假事由',
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
// 可选从DictEnum中获取 DictEnum.WY_SQZT 便于维护
|
||||
options: getDictOptions('wy_sqzt'),
|
||||
},
|
||||
fieldName: 'status',
|
||||
label: '申请状态',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'searchValue',
|
||||
label: '搜索值',
|
||||
},
|
||||
];
|
||||
|
||||
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
|
||||
// export const columns: () => VxeGridProps['columns'] = () => [
|
||||
export const columns: VxeGridProps['columns'] = [
|
||||
{ type: 'checkbox', width: 60 },
|
||||
{
|
||||
title: '',
|
||||
field: 'id',
|
||||
},
|
||||
{
|
||||
title: '用户ID,关联用户表',
|
||||
field: 'userId',
|
||||
},
|
||||
{
|
||||
title: '申请人姓名',
|
||||
field: 'username',
|
||||
},
|
||||
{
|
||||
title: '部门ID,关联部门表',
|
||||
field: 'departmentId',
|
||||
},
|
||||
{
|
||||
title: '部门名称',
|
||||
field: 'departmentName',
|
||||
},
|
||||
{
|
||||
title: '请假类型',
|
||||
field: 'leaveType',
|
||||
},
|
||||
{
|
||||
title: '开始时间',
|
||||
field: 'startTime',
|
||||
},
|
||||
{
|
||||
title: '结束时间',
|
||||
field: 'endTime',
|
||||
},
|
||||
{
|
||||
title: '合计时间,如3天5个小时',
|
||||
field: 'totalDuration',
|
||||
},
|
||||
{
|
||||
title: '请假事由',
|
||||
field: 'reason',
|
||||
},
|
||||
{
|
||||
title: '申请状态',
|
||||
field: 'status',
|
||||
slots: {
|
||||
default: ({ row }) => {
|
||||
// 可选从DictEnum中获取 DictEnum.WY_SQZT 便于维护
|
||||
return renderDict(row.status, 'wy_sqzt');
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '搜索值',
|
||||
field: 'searchValue',
|
||||
},
|
||||
{
|
||||
field: 'action',
|
||||
fixed: 'right',
|
||||
slots: { default: 'action' },
|
||||
title: '操作',
|
||||
width: 180,
|
||||
},
|
||||
];
|
||||
|
||||
export const modalSchema: FormSchemaGetter = () => [
|
||||
{
|
||||
@@ -156,24 +16,16 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '用户ID,关联用户表',
|
||||
fieldName: 'userId',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '申请人姓名',
|
||||
label: '姓名',
|
||||
fieldName: 'username',
|
||||
component: 'Input',
|
||||
rules:'required'
|
||||
},
|
||||
{
|
||||
label: '部门ID,关联部门表',
|
||||
label: '部门',
|
||||
fieldName: 'departmentId',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '部门名称',
|
||||
fieldName: 'departmentName',
|
||||
component: 'Input',
|
||||
component: 'ApiSelect',
|
||||
rules:'required'
|
||||
},
|
||||
{
|
||||
label: '请假类型',
|
||||
@@ -181,6 +33,7 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
},
|
||||
rules:'required'
|
||||
},
|
||||
{
|
||||
label: '开始时间',
|
||||
@@ -191,6 +44,8 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
},
|
||||
rules:'required'
|
||||
|
||||
},
|
||||
{
|
||||
label: '结束时间',
|
||||
@@ -201,29 +56,19 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
},
|
||||
rules:'required'
|
||||
},
|
||||
{
|
||||
label: '合计时间,如3天5个小时',
|
||||
label: '合计时间',
|
||||
fieldName: 'totalDuration',
|
||||
component: 'Input',
|
||||
disabled:true,
|
||||
rules:'required'
|
||||
},
|
||||
{
|
||||
label: '请假事由',
|
||||
fieldName: 'reason',
|
||||
component: 'Textarea',
|
||||
},
|
||||
{
|
||||
label: '申请状态',
|
||||
fieldName: 'status',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
// 可选从DictEnum中获取 DictEnum.WY_SQZT 便于维护
|
||||
options: getDictOptions('wy_sqzt'),
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '搜索值',
|
||||
fieldName: 'searchValue',
|
||||
component: 'Input',
|
||||
},
|
||||
rules:'required'
|
||||
}
|
||||
];
|
||||
|
@@ -1,188 +1,39 @@
|
||||
<script setup lang="ts">
|
||||
import type { Recordable } from '@vben/types';
|
||||
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
|
||||
import { getVxePopupContainer } from '@vben/utils';
|
||||
|
||||
import { Modal, Popconfirm, Space } from 'ant-design-vue';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import {
|
||||
useVbenVxeGrid,
|
||||
vxeCheckboxChecked,
|
||||
type VxeGridProps,
|
||||
} from '#/adapter/vxe-table';
|
||||
|
||||
import {
|
||||
leaveApplicationExport,
|
||||
leaveApplicationList,
|
||||
leaveApplicationRemove,
|
||||
} from '#/api/property/personalCenter/leaveApplication';
|
||||
import type { LeaveApplicationForm } from '#/api/property/personalCenter/leaveApplication/model';
|
||||
import { commonDownloadExcel } from '#/utils/file/download';
|
||||
|
||||
import leaveApplicationModal from './leaveApplication-modal.vue';
|
||||
import { columns, querySchema } from './data';
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import { useVbenModal} from '@vben/common-ui';
|
||||
import {modalSchema} from "./data";
|
||||
import { useVModel } from '@vueuse/core';
|
||||
|
||||
const formOptions: VbenFormProps = {
|
||||
const [BasicForm, formApi] = useVbenForm({
|
||||
commonConfig: {
|
||||
labelWidth: 80,
|
||||
formItemClass: 'col-span-1',
|
||||
// 默认label宽度 px
|
||||
labelWidth: 160,
|
||||
// 通用配置项 会影响到所有表单项
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
class: 'w-full',
|
||||
},
|
||||
},
|
||||
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'],
|
||||
// ],
|
||||
// ],
|
||||
};
|
||||
|
||||
const gridOptions: VxeGridProps = {
|
||||
checkboxConfig: {
|
||||
// 高亮
|
||||
highlight: true,
|
||||
// 翻页时保留选中状态
|
||||
reserve: true,
|
||||
// 点击行选中
|
||||
// trigger: 'row',
|
||||
},
|
||||
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
|
||||
// columns: columns(),
|
||||
columns,
|
||||
height: 'auto',
|
||||
keepSource: true,
|
||||
pagerConfig: {},
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }, formValues = {}) => {
|
||||
return await leaveApplicationList({
|
||||
pageNum: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
...formValues,
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
rowConfig: {
|
||||
keyField: 'id',
|
||||
},
|
||||
// 表格全局唯一表示 保存列配置需要用到
|
||||
id: 'property-leaveApplication-index',
|
||||
};
|
||||
|
||||
const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||
formOptions,
|
||||
gridOptions,
|
||||
schema: modalSchema(),
|
||||
showDefaultActions: false,
|
||||
wrapperClass: 'grid-cols-2 gap-x-10 gap-y-2',
|
||||
});
|
||||
|
||||
const [LeaveApplicationModal, modalApi] = useVbenModal({
|
||||
connectedComponent: leaveApplicationModal,
|
||||
});
|
||||
|
||||
function handleAdd() {
|
||||
modalApi.setData({});
|
||||
modalApi.open();
|
||||
}
|
||||
|
||||
async function handleEdit(row: Required<LeaveApplicationForm>) {
|
||||
modalApi.setData({ id: row.id });
|
||||
modalApi.open();
|
||||
}
|
||||
|
||||
async function handleDelete(row: Required<LeaveApplicationForm>) {
|
||||
await leaveApplicationRemove(row.id);
|
||||
await tableApi.query();
|
||||
}
|
||||
|
||||
function handleMultiDelete() {
|
||||
const rows = tableApi.grid.getCheckboxRecords();
|
||||
const ids = rows.map((row: Required<LeaveApplicationForm>) => row.id);
|
||||
Modal.confirm({
|
||||
title: '提示',
|
||||
okType: 'danger',
|
||||
content: `确认删除选中的${ids.length}条记录吗?`,
|
||||
onOk: async () => {
|
||||
await leaveApplicationRemove(ids);
|
||||
await tableApi.query();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function handleDownloadExcel() {
|
||||
commonDownloadExcel(
|
||||
leaveApplicationExport,
|
||||
'请假申请数据',
|
||||
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:leaveApplication:export']"
|
||||
@click="handleDownloadExcel"
|
||||
>
|
||||
{{ $t('pages.common.export') }}
|
||||
</a-button>
|
||||
<a-button
|
||||
:disabled="!vxeCheckboxChecked(tableApi)"
|
||||
danger
|
||||
type="primary"
|
||||
v-access:code="['property:leaveApplication:remove']"
|
||||
@click="handleMultiDelete"
|
||||
>
|
||||
{{ $t('pages.common.delete') }}
|
||||
</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-access:code="['property:leaveApplication:add']"
|
||||
@click="handleAdd"
|
||||
>
|
||||
{{ $t('pages.common.add') }}
|
||||
</a-button>
|
||||
</Space>
|
||||
</template>
|
||||
<template #action="{ row }">
|
||||
<Space>
|
||||
<ghost-button
|
||||
v-access:code="['property:leaveApplication: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:leaveApplication:remove']"
|
||||
@click.stop=""
|
||||
>
|
||||
{{ $t('pages.common.delete') }}
|
||||
</ghost-button>
|
||||
</Popconfirm>
|
||||
</Space>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<LeaveApplicationModal @reload="tableApi.query()" />
|
||||
</Page>
|
||||
<div class="p-8">
|
||||
<div class="text-2xl font-bold">请假申请</div>
|
||||
<div class="m-6 bg-white p-4">
|
||||
<BasicForm/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
@@ -1,106 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
import { cloneDeep } from '@vben/utils';
|
||||
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import {
|
||||
leaveApplicationAdd,
|
||||
leaveApplicationInfo,
|
||||
leaveApplicationUpdate,
|
||||
} from '#/api/property/personalCenter/leaveApplication';
|
||||
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
||||
|
||||
import { modalSchema } from './data';
|
||||
|
||||
const emit = defineEmits<{ reload: [] }>();
|
||||
|
||||
const isUpdate = ref(false);
|
||||
const title = computed(() => {
|
||||
return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add');
|
||||
});
|
||||
|
||||
const [BasicForm, formApi] = useVbenForm({
|
||||
commonConfig: {
|
||||
// 默认占满两列
|
||||
formItemClass: 'col-span-2',
|
||||
// 默认label宽度 px
|
||||
labelWidth: 80,
|
||||
// 通用配置项 会影响到所有表单项
|
||||
componentProps: {
|
||||
class: 'w-full',
|
||||
},
|
||||
},
|
||||
schema: modalSchema(),
|
||||
showDefaultActions: false,
|
||||
wrapperClass: 'grid-cols-2',
|
||||
});
|
||||
|
||||
const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
|
||||
{
|
||||
initializedGetter: defaultFormValueGetter(formApi),
|
||||
currentGetter: defaultFormValueGetter(formApi),
|
||||
},
|
||||
);
|
||||
|
||||
const [BasicModal, modalApi] = useVbenModal({
|
||||
// 在这里更改宽度
|
||||
class: 'w-[550px]',
|
||||
fullscreenButton: false,
|
||||
onBeforeClose,
|
||||
onClosed: handleClosed,
|
||||
onConfirm: handleConfirm,
|
||||
onOpenChange: async (isOpen) => {
|
||||
if (!isOpen) {
|
||||
return null;
|
||||
}
|
||||
modalApi.modalLoading(true);
|
||||
|
||||
const { id } = modalApi.getData() as { id?: number | string };
|
||||
isUpdate.value = !!id;
|
||||
|
||||
if (isUpdate.value && id) {
|
||||
const record = await leaveApplicationInfo(id);
|
||||
await formApi.setValues(record);
|
||||
}
|
||||
await markInitialized();
|
||||
|
||||
modalApi.modalLoading(false);
|
||||
},
|
||||
});
|
||||
|
||||
async function handleConfirm() {
|
||||
try {
|
||||
modalApi.lock(true);
|
||||
const { valid } = await formApi.validate();
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
|
||||
const data = cloneDeep(await formApi.getValues());
|
||||
await (isUpdate.value
|
||||
? leaveApplicationUpdate(data)
|
||||
: leaveApplicationAdd(data));
|
||||
resetInitialized();
|
||||
emit('reload');
|
||||
modalApi.close();
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
} finally {
|
||||
modalApi.lock(false);
|
||||
}
|
||||
}
|
||||
|
||||
async function handleClosed() {
|
||||
await formApi.resetForm();
|
||||
resetInitialized();
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<BasicModal :title="title">
|
||||
<BasicForm />
|
||||
</BasicModal>
|
||||
</template>
|
@@ -130,7 +130,6 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
fieldName: 'name',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
|
||||
},
|
||||
{
|
||||
label: '单位类型',
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -549,7 +549,6 @@ onBeforeUnmount(() => {
|
||||
if (timer) {
|
||||
clearInterval(timer);
|
||||
}
|
||||
|
||||
// 从管理器中移除图表
|
||||
if (barChartInstance) {
|
||||
removeChartFromResizeManager(barChartInstance);
|
||||
@@ -600,11 +599,11 @@ onBeforeUnmount(() => {
|
||||
justify-content: space-between;
|
||||
.left {
|
||||
display: flex;
|
||||
width: 14.3125rem;
|
||||
width: 18.3125rem;
|
||||
.left-first {
|
||||
padding-left: 2.3125rem;
|
||||
padding-right: 3.5rem;
|
||||
font-size: 1.875rem;
|
||||
width: 10.5rem;
|
||||
color: #ffffff;
|
||||
}
|
||||
.left-second {
|
||||
|
@@ -862,24 +862,23 @@ onBeforeUnmount(() => {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
.left{
|
||||
display: flex;
|
||||
width: 20.3125rem;
|
||||
.left-first{
|
||||
padding-left: 2.3125rem;
|
||||
padding-right: 3.5rem;
|
||||
font-size: 1.875rem;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
.left-second{
|
||||
width: 6.5rem;
|
||||
font-family: ShiShangZhongHeiJianTi;
|
||||
font-weight: 400;
|
||||
font-size: 1.25rem;
|
||||
color: #FFFFFF;
|
||||
display: flex;
|
||||
}
|
||||
.left {
|
||||
display: flex;
|
||||
width: 18.3125rem;
|
||||
.left-first {
|
||||
padding-left: 2.3125rem;
|
||||
font-size: 1.875rem;
|
||||
width: 10.5rem;
|
||||
color: #ffffff;
|
||||
}
|
||||
.left-second {
|
||||
width: 6.5rem;
|
||||
font-family: ShiShangZhongHeiJianTi;
|
||||
font-weight: 400;
|
||||
font-size: 1.25rem;
|
||||
color: #ffffff;
|
||||
}
|
||||
}
|
||||
.center{
|
||||
font-size: 1.9rem;
|
||||
color: #fff;
|
||||
|
@@ -35,7 +35,7 @@
|
||||
</div>
|
||||
<div class="navigation-body-right">
|
||||
<div @click="goToMonitor()">监控大屏</div>
|
||||
<div @click="goToDigitalIntelligence()">商务中心</div>
|
||||
<div @click="goToDigitalIntelligence()">综合服务中心</div>
|
||||
<div @click="goToHome()">后台管理</div>
|
||||
<!-- <div>能源管理</div>
|
||||
<div>能耗分析</div> -->
|
||||
|
@@ -70,12 +70,30 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="content-center-second">
|
||||
<div class="second-item">
|
||||
<div class="second-item-box1">645</div>
|
||||
<div class="second-item-box2">729</div>
|
||||
<div class="second-item-box3">648</div>
|
||||
<div class="second-item-box4">786</div>
|
||||
<div class="second-item-box5">645</div>
|
||||
<div class="second-item" @click="changeToPersonnelDuty">
|
||||
<div>
|
||||
<div class="second-item-box1">
|
||||
645
|
||||
</div>
|
||||
<div class="second-item-box-label">采购部</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="second-item-box2">729
|
||||
</div>
|
||||
<div class="second-item-box-label">研发部</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="second-item-box3">648</div>
|
||||
<div class="second-item-box-label">安保部</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="second-item-box4">786</div>
|
||||
<div class="second-item-box-label">人事部</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="second-item-box5">645</div>
|
||||
<div class="second-item-box-label">财务部</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -87,15 +105,19 @@
|
||||
<div class="second">
|
||||
<div class="second-box">
|
||||
<div class="box-content">
|
||||
<div class="box-content-label">服务数量</div>
|
||||
<div class="box-content-label">维修</div>
|
||||
<div class="box-content-num">132</div>
|
||||
</div>
|
||||
<div class="box-content">
|
||||
<div class="box-content-label">服务数量</div>
|
||||
<div class="box-content-label">保洁</div>
|
||||
<div class="box-content-num">862</div>
|
||||
</div>
|
||||
<div class="box-content">
|
||||
<div class="box-content-label">服务数量</div>
|
||||
<div class="box-content-label">客服服务</div>
|
||||
<div class="box-content-num">272</div>
|
||||
</div>
|
||||
<div class="box-content">
|
||||
<div class="box-content-label">安保</div>
|
||||
<div class="box-content-num">272</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -187,31 +209,47 @@ const initBarChart = () => {
|
||||
yAxis: {},
|
||||
series: [
|
||||
{
|
||||
name: '销量',
|
||||
name: '数量',
|
||||
type: 'bar',
|
||||
data: [5, 20, 36, 10, 10, 20],
|
||||
},
|
||||
{
|
||||
name: '已处理',
|
||||
type: 'bar',
|
||||
data: [2, 10, 16, 3, 6, 8],
|
||||
},
|
||||
{
|
||||
name: '待处理',
|
||||
type: 'bar',
|
||||
data: [3, 10, 20, 7, 4, 12],
|
||||
},
|
||||
],
|
||||
});
|
||||
};
|
||||
|
||||
// 初始化电力图表
|
||||
// 初始化预约情况图表
|
||||
const initPowerChart = () => {
|
||||
if (!powerChart.value) return;
|
||||
|
||||
const chart = echarts.init(powerChart.value);
|
||||
const option = {
|
||||
tooltip: { trigger: 'axis' },
|
||||
grid: { left: 40, right: 20, top: 32, bottom: 20 },
|
||||
grid: { left: 40, right: 50, top: 62, bottom: 20 },
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: Array.from({ length: 19 }, (_, i) => i + 6),
|
||||
axisLine: { lineStyle: { color: '#3ec6ff' } },
|
||||
axisLabel: { color: '#fff' },
|
||||
name: '小时',
|
||||
nameTextStyle: { color: '#fff' },
|
||||
nameLocation: 'end',
|
||||
nameGap: 5,
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value',
|
||||
name: '',
|
||||
name: '次',
|
||||
nameTextStyle: { color: '#fff' },
|
||||
nameLocation: 'end',
|
||||
nameGap: 10,
|
||||
axisLine: { lineStyle: { color: '#3ec6ff' } },
|
||||
axisLabel: { color: '#fff' },
|
||||
splitLine: { lineStyle: { color: '#1e90ff22' } },
|
||||
@@ -462,6 +500,10 @@ const initPie3DChart = () => {
|
||||
}
|
||||
};
|
||||
|
||||
const changeToPersonnelDuty=()=>{
|
||||
router.push('/property/attendanceManagement/workforceManagement')
|
||||
}
|
||||
|
||||
// 组件挂载时初始化
|
||||
onMounted(() => {
|
||||
updateTime();
|
||||
@@ -530,11 +572,11 @@ onBeforeUnmount(() => {
|
||||
justify-content: space-between;
|
||||
.left {
|
||||
display: flex;
|
||||
width: 14.3125rem;
|
||||
width: 18.3125rem;
|
||||
.left-first {
|
||||
padding-left: 2.3125rem;
|
||||
padding-right: 3.5rem;
|
||||
font-size: 1.875rem;
|
||||
width: 10.5rem;
|
||||
color: #ffffff;
|
||||
}
|
||||
.left-second {
|
||||
@@ -709,6 +751,7 @@ onBeforeUnmount(() => {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
cursor: pointer;
|
||||
.second-item-box1 {
|
||||
width: 7rem;
|
||||
height: 7rem;
|
||||
@@ -722,6 +765,14 @@ onBeforeUnmount(() => {
|
||||
background: url('../../../assets/property/personnel-duty-circle1.png');
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
.second-item-box-label{
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-weight: 400;
|
||||
font-size: 1rem;
|
||||
color: #ffffff;
|
||||
}
|
||||
.second-item-box2 {
|
||||
width: 7rem;
|
||||
height: 7rem;
|
||||
|
@@ -750,23 +750,23 @@ onBeforeUnmount(() => {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
.left{
|
||||
display: flex;
|
||||
width: 14.3125rem;
|
||||
.left-first{
|
||||
padding-left: 2.3125rem;
|
||||
padding-right: 3.5rem;
|
||||
font-size: 1.875rem;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
.left-second{
|
||||
width: 6.5rem;
|
||||
font-family: ShiShangZhongHeiJianTi;
|
||||
font-weight: 400;
|
||||
font-size: 1.25rem;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
.left {
|
||||
display: flex;
|
||||
width: 18.3125rem;
|
||||
.left-first {
|
||||
padding-left: 2.3125rem;
|
||||
font-size: 1.875rem;
|
||||
width: 10.5rem;
|
||||
color: #ffffff;
|
||||
}
|
||||
.left-second {
|
||||
width: 6.5rem;
|
||||
font-family: ShiShangZhongHeiJianTi;
|
||||
font-weight: 400;
|
||||
font-size: 1.25rem;
|
||||
color: #ffffff;
|
||||
}
|
||||
}
|
||||
.center{
|
||||
font-size: 1.9rem;
|
||||
color: #fff;
|
||||
|
0
apps/web-antd/src/views/sis/acAdmin/data.ts
Normal file
0
apps/web-antd/src/views/sis/acAdmin/data.ts
Normal file
200
apps/web-antd/src/views/sis/acAdmin/dp-tree.vue
Normal file
200
apps/web-antd/src/views/sis/acAdmin/dp-tree.vue
Normal file
@@ -0,0 +1,200 @@
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref, toRaw } from 'vue';
|
||||
import { SyncOutlined } from '@ant-design/icons-vue';
|
||||
import { InputSearch, message, Skeleton, Tree } from 'ant-design-vue';
|
||||
import { queryTree } from '#/api/sis/accessControl';
|
||||
import type { TreeNode } from '#/api/common';
|
||||
|
||||
defineOptions({ inheritAttrs: false });
|
||||
|
||||
withDefaults(defineProps<{ showSearch?: boolean }>(), { showSearch: true });
|
||||
|
||||
const emit = defineEmits<{
|
||||
checked: [];
|
||||
/**
|
||||
* 点击节点的事件
|
||||
*/
|
||||
reload: [];
|
||||
select: [];
|
||||
}>();
|
||||
|
||||
const searchValue = defineModel('searchValue', {
|
||||
type: String,
|
||||
default: '',
|
||||
});
|
||||
|
||||
/** 通道数据源 */
|
||||
const channelTree = ref<TreeNode[]>([]);
|
||||
/** 骨架屏加载 */
|
||||
const showTreeSkeleton = ref<boolean>(true);
|
||||
|
||||
async function loadChannelTree() {
|
||||
showTreeSkeleton.value = true;
|
||||
searchValue.value = '';
|
||||
const ret = await queryTree();
|
||||
handleNode(ret, 3);
|
||||
channelTree.value = ret;
|
||||
showTreeSkeleton.value = false;
|
||||
}
|
||||
|
||||
function handleNode(nodes: any[], level: number) {
|
||||
nodes.forEach((node) => {
|
||||
if (node.level < level) {
|
||||
node.disabled = true;
|
||||
}
|
||||
if (node.children) {
|
||||
handleNode(node.children, level);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async function handleReload() {
|
||||
await loadChannelTree();
|
||||
emit('reload');
|
||||
}
|
||||
|
||||
function open() {
|
||||
const acArr = checkNodeData();
|
||||
if (acArr) {
|
||||
console.log(acArr);
|
||||
}
|
||||
}
|
||||
|
||||
function close() {
|
||||
const acArr = checkNodeData();
|
||||
if (acArr) {
|
||||
console.log(acArr);
|
||||
}
|
||||
}
|
||||
|
||||
function alwaysOpen() {
|
||||
const acArr = checkNodeData();
|
||||
if (acArr) {
|
||||
console.log(acArr);
|
||||
}
|
||||
}
|
||||
|
||||
function reSet() {
|
||||
const acArr = checkNodeData();
|
||||
if (acArr) {
|
||||
console.log(acArr);
|
||||
}
|
||||
}
|
||||
|
||||
function checkNodeData() {
|
||||
const arr = Object.keys(checkData);
|
||||
if (!arr || arr.length === 0) {
|
||||
message.error('请先选择门禁');
|
||||
return false;
|
||||
}
|
||||
|
||||
const acArr: any = [];
|
||||
arr.forEach((item) => {
|
||||
const node: any = checkData[item];
|
||||
if (node.level == 5) {
|
||||
acArr.push(node);
|
||||
}
|
||||
});
|
||||
if (!acArr || acArr.length === 0) {
|
||||
message.error('请先选择门禁');
|
||||
return false;
|
||||
}
|
||||
return acArr;
|
||||
}
|
||||
|
||||
const checkData: any = {};
|
||||
|
||||
function onTreeCheck(_keys: any, nodes: any) {
|
||||
const { checked, checkedNodes } = nodes;
|
||||
// 找到需要播放的视频节点
|
||||
checkedNodes.forEach((node: any) => {
|
||||
const nodeData = toRaw(node);
|
||||
const id = nodeData.id;
|
||||
if (checked) {
|
||||
checkData[id] = nodeData;
|
||||
} else {
|
||||
delete checkData[id];
|
||||
}
|
||||
});
|
||||
const nodes = toRaw(checkedNodes);
|
||||
emit('checked', nodes);
|
||||
}
|
||||
|
||||
onMounted(loadChannelTree);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div :class="$attrs.class">
|
||||
<Skeleton
|
||||
:loading="showTreeSkeleton"
|
||||
:paragraph="{ rows: 8 }"
|
||||
active
|
||||
class="p-[8px]"
|
||||
>
|
||||
<div
|
||||
class="bg-background flex h-full flex-col overflow-y-auto rounded-lg pt-[5px]"
|
||||
>
|
||||
<div class="btn-gp">
|
||||
<a-button size="small" @click="open" type="primary">开门</a-button>
|
||||
<a-button size="small" @click="close" type="primary">关门</a-button>
|
||||
<a-button size="small" @click="alwaysOpen" type="primary"
|
||||
>常开
|
||||
</a-button>
|
||||
<a-button size="small" @click="reSet" type="primary"
|
||||
>恢复正常
|
||||
</a-button>
|
||||
</div>
|
||||
<!-- 固定在顶部 必须加上bg-background背景色 否则会产生'穿透'效果 -->
|
||||
<div
|
||||
v-if="showSearch"
|
||||
class="bg-background z-100 sticky left-0 top-0 p-[8px]"
|
||||
>
|
||||
<InputSearch
|
||||
v-model:value="searchValue"
|
||||
:placeholder="$t('pages.common.search')"
|
||||
size="small"
|
||||
>
|
||||
<template #enterButton>
|
||||
<a-button @click="handleReload">
|
||||
<SyncOutlined class="text-primary" />
|
||||
</a-button>
|
||||
</template>
|
||||
</InputSearch>
|
||||
</div>
|
||||
<div class="h-full overflow-x-hidden px-[8px]">
|
||||
<Tree
|
||||
v-bind="$attrs"
|
||||
v-if="channelTree.length > 0"
|
||||
:class="$attrs.class"
|
||||
:show-line="{ showLeafIcon: false }"
|
||||
:tree-data="channelTree"
|
||||
:virtual="false"
|
||||
checkable
|
||||
multiple
|
||||
@select="$emit('select')"
|
||||
@check="onTreeCheck"
|
||||
>
|
||||
<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>
|
||||
</div>
|
||||
</Skeleton>
|
||||
</div>
|
||||
</template>
|
||||
<style scoped>
|
||||
.btn-gp {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
}
|
||||
</style>
|
223
apps/web-antd/src/views/sis/acAdmin/index.vue
Normal file
223
apps/web-antd/src/views/sis/acAdmin/index.vue
Normal file
@@ -0,0 +1,223 @@
|
||||
<template>
|
||||
<Page :auto-content-height="true">
|
||||
<div class="flex h-full gap-[8px]">
|
||||
<DpTree class="h-[87vh] w-[300px]" @check="onNodeChecked" />
|
||||
<div class="bg-background flex-1">
|
||||
<div class="video-play-area flex h-full flex-wrap">
|
||||
<div
|
||||
v-for="i in playerNum"
|
||||
:style="playerStyle"
|
||||
class="player"
|
||||
:class="`layer-${i} ${currentSelectPlayerIndex == i ? selected : ''}`"
|
||||
@click="playerSelect(i)"
|
||||
>
|
||||
<video
|
||||
style="width: 100%; height: 100%"
|
||||
:ref="setItemRef"
|
||||
muted
|
||||
autoplay
|
||||
></video>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Page>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import DpTree from './dp-tree.vue';
|
||||
import { Page } from '@vben/common-ui';
|
||||
import { ref } from 'vue';
|
||||
import mpegts from "mpegts.js";
|
||||
import {addStreamProxy} from "#/api/sis/stream";
|
||||
import {message} from "ant-design-vue";
|
||||
|
||||
/**
|
||||
* 屏幕播放器数量
|
||||
*/
|
||||
const selected = 'selected';
|
||||
const playerNum = ref(4);
|
||||
/**
|
||||
* 屏幕播放器样式
|
||||
*/
|
||||
const playerStyle = ref({
|
||||
width: '50%',
|
||||
height: '50%',
|
||||
});
|
||||
const currentSelectPlayerIndex = ref(-1);
|
||||
|
||||
function playerSelect(index: number) {
|
||||
if (index === currentSelectPlayerIndex.value) {
|
||||
currentSelectPlayerIndex.value = -1;
|
||||
return;
|
||||
}
|
||||
currentSelectPlayerIndex.value = index;
|
||||
}
|
||||
|
||||
const itemRefs = ref<HTMLVideoElement[]>([]);
|
||||
const setItemRef = (el: any) => {
|
||||
if (el) {
|
||||
itemRefs.value.push(el);
|
||||
}
|
||||
};
|
||||
|
||||
function onNodeChecked(nodes: any[]) {
|
||||
console.log(nodes);
|
||||
}
|
||||
|
||||
// 播放器数据, 每一个位置代表页面上行的一个矩形
|
||||
const playerList: any[] = [];
|
||||
|
||||
|
||||
/**
|
||||
* 开始播放视频流
|
||||
* @param nodeData 播放的节点数据
|
||||
* @param index 播放器的索引信息
|
||||
*/
|
||||
function doPlayer(nodeData: any, index: number = 0) {
|
||||
console.log('index=', index);
|
||||
if (mpegts.isSupported()) {
|
||||
let params = {};
|
||||
// if (nodeData.nvrIp) {
|
||||
// params = {
|
||||
// videoIp: nodeData.nvrIp,
|
||||
// videoPort: nodeData.nvrPort,
|
||||
// factoryNo: nodeData.nvrFactoryNo,
|
||||
// account: nodeData.nvrAccount,
|
||||
// pwd: nodeData.nvrPwd,
|
||||
// channelId: nodeData.nvrChannelNo,
|
||||
// };
|
||||
// } else {
|
||||
params = {
|
||||
videoIp: nodeData.deviceIp,
|
||||
videoPort: nodeData.devicePort,
|
||||
factoryNo: nodeData.factoryNo,
|
||||
account: nodeData.deviceAccount,
|
||||
pwd: nodeData.devicePwd,
|
||||
channelId: nodeData.channelNo,
|
||||
};
|
||||
// }
|
||||
addStreamProxy(params).then((res) => {
|
||||
const url = res.wsFlv;
|
||||
// 将url 绑定到 nodeData
|
||||
nodeData.url = url;
|
||||
closePlayer(index);
|
||||
const videoConfig = {
|
||||
type: 'flv',
|
||||
url: url,
|
||||
isLive: true,
|
||||
hasAudio: false,
|
||||
hasVideo: true,
|
||||
enableWorker: true, // 启用分离的线程进行转码
|
||||
enableStashBuffer: false, // 关闭IO隐藏缓冲区
|
||||
stashInitialSize: 256, // 减少首帧显示等待时长
|
||||
};
|
||||
const playerConfig = {
|
||||
enableErrorRecover: true, // 启用错误恢复
|
||||
autoCleanupMaxBackwardDuration: 30,
|
||||
autoCleanupMinBackwardDuration: 10,
|
||||
};
|
||||
const player = mpegts.createPlayer(videoConfig, playerConfig);
|
||||
const videoElement = itemRefs.value[index];
|
||||
if (videoElement) {
|
||||
player.attachMediaElement(videoElement);
|
||||
player.load();
|
||||
player.play();
|
||||
playerList[index] = {
|
||||
player,
|
||||
data: nodeData,
|
||||
};
|
||||
} else {
|
||||
console.log('视频播放元素获取异常');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
message.error('浏览器不支持播放');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function changeElPlayer(playerInfo: any, index: number) {
|
||||
const playerData = playerInfo.data;
|
||||
const oldPlayer = playerInfo.player;
|
||||
if (oldPlayer) {
|
||||
closePlayVieo(oldPlayer);
|
||||
}
|
||||
const videoConfig = {
|
||||
type: 'flv',
|
||||
url: playerData.url,
|
||||
isLive: true,
|
||||
hasAudio: false,
|
||||
hasVideo: true,
|
||||
enableWorker: true, // 启用分离的线程进行转码
|
||||
enableStashBuffer: false, // 关闭IO隐藏缓冲区
|
||||
stashInitialSize: 256, // 减少首帧显示等待时长
|
||||
};
|
||||
const playerConfig = {
|
||||
enableErrorRecover: true, // 启用错误恢复
|
||||
autoCleanupMaxBackwardDuration: 30,
|
||||
autoCleanupMinBackwardDuration: 10,
|
||||
};
|
||||
const player = mpegts.createPlayer(videoConfig, playerConfig);
|
||||
const videoElement = itemRefs.value[index];
|
||||
if (videoElement) {
|
||||
player.attachMediaElement(videoElement);
|
||||
player.load();
|
||||
player.play();
|
||||
playerList[index] = {
|
||||
player,
|
||||
data: playerData,
|
||||
};
|
||||
} else {
|
||||
console.log('视频播放元素获取异常');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function closePlayVieo(plInfo: any) {
|
||||
if (plInfo) {
|
||||
try {
|
||||
plInfo.pause(); // 暂停
|
||||
plInfo.unload(); // 卸载
|
||||
plInfo.destroy(); // 销毁
|
||||
} catch (e) {
|
||||
console.log('播放器关闭失败,e=', e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function closePlayer(index: number) {
|
||||
// 如果播放器存在,尝试关闭
|
||||
const pData = playerList[index];
|
||||
if (pData) {
|
||||
try {
|
||||
const player = pData.player;
|
||||
player.pause(); // 暂停
|
||||
player.unload(); // 卸载
|
||||
player.destroy(); // 销毁
|
||||
playerList[index] = null;
|
||||
} catch (e) {
|
||||
console.log('播放器关闭失败,e=', e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
<style>
|
||||
.player {
|
||||
border: 1px solid #e4e4e7;
|
||||
cursor: pointer;
|
||||
|
||||
video {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: fill;
|
||||
}
|
||||
}
|
||||
|
||||
.player.selected {
|
||||
border: 2px solid deepskyblue;
|
||||
}
|
||||
</style>
|
@@ -14,6 +14,8 @@ import {
|
||||
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
||||
import { communityTree } from '#/api/property/community';
|
||||
import { modalSchema } from './data';
|
||||
import type { DeviceManageQuery } from '#/api/sis/deviceManage/model';
|
||||
import { deviceManageList } from '#/api/sis/deviceManage';
|
||||
|
||||
const emit = defineEmits<{ reload: [] }>();
|
||||
|
||||
@@ -92,15 +94,30 @@ async function handleConfirm() {
|
||||
}
|
||||
|
||||
async function setupCommunitySelect() {
|
||||
const areaList = await communityTree(4);
|
||||
const areaList = await communityTree(3);
|
||||
// 选中后显示在输入框的值 即父节点 / 子节点
|
||||
// addFullName(areaList, 'areaName', ' / ');
|
||||
const splitStr = '/';
|
||||
handleNode(areaList, 'label', splitStr, function (node: any) {
|
||||
if (node.level != 4) {
|
||||
if (node.level != 3) {
|
||||
node.disabled = true;
|
||||
}
|
||||
});
|
||||
// 加载监控
|
||||
const params: DeviceManageQuery = {
|
||||
pageNum: 1,
|
||||
pageSize: 500,
|
||||
deviceType: 1,
|
||||
};
|
||||
const res = await deviceManageList(params);
|
||||
const arr = res.rows.map((item) => {
|
||||
return {
|
||||
label: item.deviceName,
|
||||
value: item.id,
|
||||
deviceIp: item.deviceIp,
|
||||
deviceId: item.id,
|
||||
};
|
||||
});
|
||||
formApi.updateSchema([
|
||||
{
|
||||
componentProps: () => ({
|
||||
@@ -124,6 +141,19 @@ async function setupCommunitySelect() {
|
||||
}),
|
||||
fieldName: 'floorId',
|
||||
},
|
||||
{
|
||||
componentProps: () => ({
|
||||
options: arr,
|
||||
}),
|
||||
fieldName: 'bindDeviceId',
|
||||
},
|
||||
{
|
||||
componentProps: () => ({
|
||||
options: arr,
|
||||
mode: 'multiple', // 关键属性,启用多选模式
|
||||
}),
|
||||
fieldName: 'devicePoint',
|
||||
},
|
||||
]);
|
||||
}
|
||||
|
||||
|
@@ -5,8 +5,6 @@ import { getDictOptions } from '#/utils/dict';
|
||||
import { renderDict } from '#/utils/render';
|
||||
import { communityTree } from '#/api/property/community';
|
||||
import { addFullName } from '@vben/utils';
|
||||
import { deviceManageList } from '#/api/sis/deviceManage';
|
||||
import type { DeviceManageQuery } from '#/api/sis/deviceManage/model';
|
||||
|
||||
export const querySchema: FormSchemaGetter = () => [
|
||||
{
|
||||
@@ -25,9 +23,8 @@ export const querySchema: FormSchemaGetter = () => [
|
||||
children: 'children',
|
||||
},
|
||||
api: async () => {
|
||||
const areaList = await communityTree(4);
|
||||
const areaList = await communityTree(3);
|
||||
addFullName(areaList, 'label', '/');
|
||||
console.log(areaList);
|
||||
return areaList;
|
||||
},
|
||||
},
|
||||
@@ -43,7 +40,7 @@ export const querySchema: FormSchemaGetter = () => [
|
||||
componentProps: {
|
||||
options: getDictOptions('wy_kzklx'),
|
||||
},
|
||||
label: '控制卡类型',
|
||||
label: '接入点',
|
||||
},
|
||||
];
|
||||
|
||||
@@ -72,7 +69,7 @@ export const columns: VxeGridProps['columns'] = [
|
||||
field: 'factoryCode',
|
||||
},
|
||||
{
|
||||
title: '控制卡类型',
|
||||
title: '接入点',
|
||||
field: 'controlType',
|
||||
slots: {
|
||||
default: ({ row }) => {
|
||||
@@ -132,7 +129,7 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '控制卡类型',
|
||||
label: '接入点',
|
||||
fieldName: 'controlType',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
@@ -142,22 +139,15 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
rules: 'selectRequired',
|
||||
},
|
||||
{
|
||||
label: '绑定设备',
|
||||
label: '人脸设备',
|
||||
fieldName: 'bindDeviceId',
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
resultField: 'list', // 根据API返回结构调整
|
||||
labelField: 'deviceName',
|
||||
valueField: 'id',
|
||||
api: async () => {
|
||||
const params: DeviceManageQuery = {
|
||||
pageNum: 1,
|
||||
pageSize: 500,
|
||||
};
|
||||
const res = await deviceManageList(params);
|
||||
return res.rows;
|
||||
},
|
||||
},
|
||||
component: 'Select',
|
||||
defaultValue: undefined,
|
||||
},
|
||||
{
|
||||
label: '监控点',
|
||||
fieldName: 'devicePoint',
|
||||
defaultValue: undefined,
|
||||
component: 'Select',
|
||||
},
|
||||
];
|
||||
|
@@ -1,26 +1,26 @@
|
||||
<script setup lang="ts">
|
||||
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
|
||||
import { getVxePopupContainer } from '@vben/utils';
|
||||
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui'
|
||||
import { getVxePopupContainer } from '@vben/utils'
|
||||
|
||||
import { Modal, Popconfirm, Space } from 'ant-design-vue';
|
||||
import { Modal, Popconfirm, Space } from 'ant-design-vue'
|
||||
|
||||
import {
|
||||
useVbenVxeGrid,
|
||||
vxeCheckboxChecked,
|
||||
type VxeGridProps,
|
||||
} from '#/adapter/vxe-table';
|
||||
} from '#/adapter/vxe-table'
|
||||
|
||||
import {
|
||||
accessControlExport,
|
||||
accessControlList,
|
||||
accessControlRemove,
|
||||
accessControlSync
|
||||
} from '#/api/sis/accessControl';
|
||||
import type { AccessControlForm } from '#/api/sis/accessControl/model';
|
||||
import { commonDownloadExcel } from '#/utils/file/download';
|
||||
} from '#/api/sis/accessControl'
|
||||
import type { AccessControlForm } from '#/api/sis/accessControl/model'
|
||||
import { commonDownloadExcel } from '#/utils/file/download'
|
||||
|
||||
import accessControlModal from './accessControlModal.vue';
|
||||
import { columns, querySchema } from './data';
|
||||
import accessControlModal from './accessControlModal.vue'
|
||||
import { columns, querySchema } from './data'
|
||||
|
||||
const formOptions: VbenFormProps = {
|
||||
commonConfig: {
|
||||
@@ -40,7 +40,7 @@ const formOptions: VbenFormProps = {
|
||||
// ['YYYY-MM-DD 00:00:00', 'YYYY-MM-DD 23:59:59'],
|
||||
// ],
|
||||
// ],
|
||||
};
|
||||
}
|
||||
|
||||
const gridOptions: VxeGridProps = {
|
||||
checkboxConfig: {
|
||||
@@ -64,7 +64,7 @@ const gridOptions: VxeGridProps = {
|
||||
pageNum: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
...formValues,
|
||||
});
|
||||
})
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -73,49 +73,49 @@ const gridOptions: VxeGridProps = {
|
||||
},
|
||||
// 表格全局唯一表示 保存列配置需要用到
|
||||
id: 'property-accessControl-index',
|
||||
};
|
||||
}
|
||||
|
||||
const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||
formOptions,
|
||||
gridOptions,
|
||||
});
|
||||
})
|
||||
|
||||
const [AccessControlModal, modalApi] = useVbenModal({
|
||||
connectedComponent: accessControlModal,
|
||||
});
|
||||
})
|
||||
|
||||
function handleAdd() {
|
||||
modalApi.setData({});
|
||||
modalApi.open();
|
||||
modalApi.setData({})
|
||||
modalApi.open()
|
||||
}
|
||||
|
||||
async function handleEdit(row: Required<AccessControlForm>) {
|
||||
modalApi.setData({ id: row.id });
|
||||
modalApi.open();
|
||||
modalApi.setData({ id: row.id })
|
||||
modalApi.open()
|
||||
}
|
||||
|
||||
async function handleDelete(row: Required<AccessControlForm>) {
|
||||
await accessControlRemove(row.id);
|
||||
await tableApi.query();
|
||||
await accessControlRemove(row.id)
|
||||
await tableApi.query()
|
||||
}
|
||||
|
||||
async function handleSyncE8() {
|
||||
await accessControlSync();
|
||||
await tableApi.query();
|
||||
await accessControlSync()
|
||||
await tableApi.query()
|
||||
}
|
||||
|
||||
function handleMultiDelete() {
|
||||
const rows = tableApi.grid.getCheckboxRecords();
|
||||
const ids = rows.map((row: Required<AccessControlForm>) => row.id);
|
||||
const rows = tableApi.grid.getCheckboxRecords()
|
||||
const ids = rows.map((row: Required<AccessControlForm>) => row.id)
|
||||
Modal.confirm({
|
||||
title: '提示',
|
||||
okType: 'danger',
|
||||
content: `确认删除选中的${ids.length}条记录吗?`,
|
||||
onOk: async () => {
|
||||
await accessControlRemove(ids);
|
||||
await tableApi.query();
|
||||
await accessControlRemove(ids)
|
||||
await tableApi.query()
|
||||
},
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
function handleDownloadExcel() {
|
||||
@@ -126,7 +126,7 @@ function handleDownloadExcel() {
|
||||
{
|
||||
fieldMappingTime: formOptions.fieldMappingTime,
|
||||
},
|
||||
);
|
||||
)
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -136,49 +136,23 @@ function handleDownloadExcel() {
|
||||
<template #toolbar-tools>
|
||||
<Space>
|
||||
<a-button @click="handleSyncE8">同步</a-button>
|
||||
<a-button
|
||||
v-access:code="['property:accessControl:export']"
|
||||
@click="handleDownloadExcel"
|
||||
>
|
||||
<a-button v-access:code="['property:accessControl:export']" @click="handleDownloadExcel">
|
||||
{{ $t('pages.common.export') }}
|
||||
</a-button>
|
||||
<a-button
|
||||
:disabled="!vxeCheckboxChecked(tableApi)"
|
||||
danger
|
||||
type="primary"
|
||||
v-access:code="['property:accessControl:remove']"
|
||||
@click="handleMultiDelete"
|
||||
>
|
||||
<a-button :disabled="!vxeCheckboxChecked(tableApi)" danger type="primary"
|
||||
v-access:code="['property:accessControl:remove']" @click="handleMultiDelete">
|
||||
{{ $t('pages.common.delete') }}
|
||||
</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-access:code="['property:accessControl:add']"
|
||||
@click="handleAdd"
|
||||
>
|
||||
{{ $t('pages.common.add') }}
|
||||
</a-button>
|
||||
</Space>
|
||||
</template>
|
||||
<template #action="{ row }">
|
||||
<Space>
|
||||
<ghost-button
|
||||
v-access:code="['property:accessControl:edit']"
|
||||
@click.stop="handleEdit(row)"
|
||||
>
|
||||
<ghost-button v-access:code="['property:accessControl: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:accessControl:remove']"
|
||||
@click.stop=""
|
||||
>
|
||||
<Popconfirm :get-popup-container="getVxePopupContainer" placement="left" title="确认删除?"
|
||||
@confirm="handleDelete(row)">
|
||||
<ghost-button danger v-access:code="['property:accessControl:remove']" @click.stop="">
|
||||
{{ $t('pages.common.delete') }}
|
||||
</ghost-button>
|
||||
</Popconfirm>
|
||||
|
@@ -60,6 +60,9 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
isUpdate.value = !!id
|
||||
if (isUpdate.value && id) {
|
||||
const record = await authGroupInfo(id)
|
||||
|
||||
checkedKeys.value = (record.acIds || []).concat(record.floorIds || [])
|
||||
|
||||
await formApi.setValues(record)
|
||||
}
|
||||
await markInitialized()
|
||||
@@ -82,9 +85,9 @@ async function handleConfirm() {
|
||||
}
|
||||
|
||||
const data = cloneDeep(await formApi.getValues())
|
||||
data.acIds = acIds.value;
|
||||
data.eleIds = eleIds.value;
|
||||
data.floorIds = floorIds.value;
|
||||
data.acIds = acIds.value
|
||||
data.eleIds = eleIds.value
|
||||
data.floorIds = floorIds.value
|
||||
await (isUpdate.value ? authGroupUpdate(data) : authGroupAdd(data))
|
||||
resetInitialized()
|
||||
emit('reload')
|
||||
@@ -98,6 +101,7 @@ async function handleConfirm() {
|
||||
|
||||
async function handleClosed() {
|
||||
await formApi.resetForm()
|
||||
checkedKeys.value = []
|
||||
resetInitialized()
|
||||
}
|
||||
|
||||
@@ -132,11 +136,9 @@ function handleCheck(checked: Key[] | { checked: Key[]; halfChecked: Key[] }, in
|
||||
info.checkedNodesPositions.forEach((item: any) => {
|
||||
switch (item.node.label) {
|
||||
case 'accessControl':
|
||||
console.log('item.node', item.node)
|
||||
acIds.value = acIds.value.concat(item.node.code)
|
||||
break
|
||||
case 'floor':
|
||||
console.log('item.node', item.node)
|
||||
floorIds.value = floorIds.value.concat(item.node.code)
|
||||
eleIds.value = eleIds.value.concat(item.node.parentCode)
|
||||
break
|
||||
|
@@ -100,6 +100,11 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '设备位置',
|
||||
fieldName: 'floorId',
|
||||
component: 'TreeSelect',
|
||||
},
|
||||
{
|
||||
label: '设备厂商',
|
||||
fieldName: 'factoryNo',
|
||||
|
@@ -1,28 +1,29 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue';
|
||||
import { computed, ref } from 'vue'
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
import { cloneDeep } from '@vben/utils';
|
||||
import { useVbenModal } from '@vben/common-ui'
|
||||
import { $t } from '@vben/locales'
|
||||
import { cloneDeep, getPopupContainer, handleNode } from '@vben/utils'
|
||||
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import { useVbenForm } from '#/adapter/form'
|
||||
import {
|
||||
deviceManageAdd,
|
||||
deviceManageInfo,
|
||||
deviceManageUpdate,
|
||||
} from '#/api/sis/deviceManage';
|
||||
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
||||
} from '#/api/sis/deviceManage'
|
||||
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup'
|
||||
|
||||
import { modalSchema } from './data';
|
||||
import { getDictOptions } from '#/utils/dict';
|
||||
import { DictEnum } from '@vben/constants';
|
||||
import { modalSchema } from './data'
|
||||
import { communityTree } from '#/api/property/community'
|
||||
import { getDictOptions } from '#/utils/dict'
|
||||
import { DictEnum } from '@vben/constants'
|
||||
|
||||
const emit = defineEmits<{ reload: [] }>();
|
||||
const emit = defineEmits<{ reload: [] }>()
|
||||
|
||||
const isUpdate = ref(false);
|
||||
const isUpdate = ref(false)
|
||||
const title = computed(() => {
|
||||
return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add');
|
||||
});
|
||||
return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add')
|
||||
})
|
||||
|
||||
const [BasicForm, formApi] = useVbenForm({
|
||||
commonConfig: {
|
||||
@@ -38,14 +39,14 @@ const [BasicForm, formApi] = useVbenForm({
|
||||
schema: modalSchema(),
|
||||
showDefaultActions: false,
|
||||
wrapperClass: 'grid-cols-2',
|
||||
});
|
||||
})
|
||||
|
||||
const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
|
||||
{
|
||||
initializedGetter: defaultFormValueGetter(formApi),
|
||||
currentGetter: defaultFormValueGetter(formApi),
|
||||
},
|
||||
);
|
||||
)
|
||||
|
||||
const [BasicModal, modalApi] = useVbenModal({
|
||||
// 在这里更改宽度
|
||||
@@ -56,45 +57,88 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
onConfirm: handleConfirm,
|
||||
onOpenChange: async (isOpen) => {
|
||||
if (!isOpen) {
|
||||
return null;
|
||||
return null
|
||||
}
|
||||
modalApi.modalLoading(true);
|
||||
const { id } = modalApi.getData() as { id?: number | string };
|
||||
isUpdate.value = !!id;
|
||||
|
||||
// 加载社区树
|
||||
setupCommunitySelect()
|
||||
|
||||
modalApi.modalLoading(true)
|
||||
const { id } = modalApi.getData() as { id?: number | string }
|
||||
isUpdate.value = !!id
|
||||
|
||||
if (isUpdate.value && id) {
|
||||
const record = await deviceManageInfo(id);
|
||||
await formApi.setValues(record);
|
||||
const record = await deviceManageInfo(id)
|
||||
await formApi.setValues(record)
|
||||
}
|
||||
await markInitialized();
|
||||
await markInitialized()
|
||||
|
||||
modalApi.modalLoading(false);
|
||||
modalApi.modalLoading(false)
|
||||
},
|
||||
});
|
||||
})
|
||||
|
||||
async function handleConfirm() {
|
||||
try {
|
||||
modalApi.lock(true);
|
||||
const { valid } = await formApi.validate();
|
||||
modalApi.lock(true)
|
||||
const { valid } = await formApi.validate()
|
||||
if (!valid) {
|
||||
return;
|
||||
return
|
||||
}
|
||||
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
|
||||
const data = cloneDeep(await formApi.getValues());
|
||||
await (isUpdate.value ? deviceManageUpdate(data) : deviceManageAdd(data));
|
||||
resetInitialized();
|
||||
emit('reload');
|
||||
modalApi.close();
|
||||
const data = cloneDeep(await formApi.getValues())
|
||||
await (isUpdate.value ? deviceManageUpdate(data) : deviceManageAdd(data))
|
||||
resetInitialized()
|
||||
emit('reload')
|
||||
modalApi.close()
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
console.error(error)
|
||||
} finally {
|
||||
modalApi.lock(false);
|
||||
modalApi.lock(false)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化城市
|
||||
*/
|
||||
async function setupCommunitySelect() {
|
||||
const areaList = await communityTree(3)
|
||||
// 选中后显示在输入框的值 即父节点 / 子节点
|
||||
// addFullName(areaList, 'areaName', ' / ');
|
||||
const splitStr = '/'
|
||||
handleNode(areaList, 'label', splitStr, function (node: any) {
|
||||
if (node.level != 3) {
|
||||
node.disabled = true
|
||||
}
|
||||
})
|
||||
formApi.updateSchema([
|
||||
{
|
||||
componentProps: () => ({
|
||||
class: 'w-full',
|
||||
fieldNames: {
|
||||
key: 'id',
|
||||
label: 'label',
|
||||
value: 'code',
|
||||
children: 'children',
|
||||
},
|
||||
getPopupContainer,
|
||||
placeholder: '请选择楼层',
|
||||
showSearch: true,
|
||||
treeData: areaList,
|
||||
treeDefaultExpandAll: true,
|
||||
treeLine: { showLeafIcon: false },
|
||||
// 筛选的字段
|
||||
treeNodeFilterProp: 'label',
|
||||
// 选中后显示在输入框的值
|
||||
treeNodeLabelProp: 'fullName',
|
||||
}),
|
||||
fieldName: 'floorId',
|
||||
},
|
||||
])
|
||||
}
|
||||
|
||||
async function handleClosed() {
|
||||
await formApi.resetForm();
|
||||
resetInitialized();
|
||||
await formApi.resetForm()
|
||||
resetInitialized()
|
||||
}
|
||||
</script>
|
||||
|
||||
|
@@ -105,7 +105,7 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
},
|
||||
{
|
||||
component: 'TreeSelect',
|
||||
fieldName: 'unitId',
|
||||
fieldName: 'buildingId',
|
||||
defaultValue: undefined,
|
||||
label: '社区建筑',
|
||||
rules: 'selectRequired',
|
||||
|
@@ -1,5 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue'
|
||||
import { computed, ref, reactive } from 'vue'
|
||||
import { Tabs, TabPane, Form, FormItem, Space, Input } from 'ant-design-vue'
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui'
|
||||
import { $t } from '@vben/locales'
|
||||
@@ -15,9 +16,11 @@ import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup'
|
||||
|
||||
import { modalSchema } from './data'
|
||||
import { communityTree } from '#/api/property/community'
|
||||
import { queryByBuildingId } from '#/api/property/floor'
|
||||
import type { DeviceManageForm, DeviceManageQuery } from '#/api/sis/deviceManage/model'
|
||||
import { deviceManageList } from '#/api/sis/deviceManage'
|
||||
|
||||
|
||||
const emit = defineEmits<{ reload: [] }>()
|
||||
|
||||
const isUpdate = ref(false)
|
||||
@@ -69,18 +72,26 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
|
||||
if (isUpdate.value && id) {
|
||||
const record = await elevatorInfoInfo(id)
|
||||
record.elevatorControlDeviceId = {
|
||||
value: record.elevatorControlDeviceId.deviceId,
|
||||
deviceIp: record.elevatorControlDeviceId.deviceIp,
|
||||
deviceId: record.elevatorControlDeviceId.deviceId,
|
||||
|
||||
if (record.elevatorControlDeviceId) {
|
||||
record.elevatorControlDeviceId = {
|
||||
value: record.elevatorControlDeviceId.deviceId,
|
||||
deviceIp: record.elevatorControlDeviceId.deviceIp,
|
||||
deviceId: record.elevatorControlDeviceId.deviceId,
|
||||
}
|
||||
}
|
||||
|
||||
record.remoteCallElevatorDeviceId = record.remoteCallElevatorDeviceId.map(item => ({
|
||||
value: item.deviceId,
|
||||
deviceIp: item.deviceIp,
|
||||
deviceId: item.deviceId,
|
||||
}));
|
||||
if (record.remoteCallElevatorDeviceId) {
|
||||
record.remoteCallElevatorDeviceId = record.remoteCallElevatorDeviceId.map(item => {
|
||||
return {
|
||||
value: item.deviceId,
|
||||
deviceIp: item.deviceIp,
|
||||
deviceId: item.deviceId,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
await handleGetFloor(record.buildingId)
|
||||
await formApi.setValues(record)
|
||||
}
|
||||
await markInitialized()
|
||||
@@ -98,7 +109,16 @@ async function handleConfirm() {
|
||||
}
|
||||
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
|
||||
const data = cloneDeep(await formApi.getValues())
|
||||
console.log(data)
|
||||
// 通道信息
|
||||
const filteredChannels = dynamicValidateForm.floor
|
||||
.filter(item => !(item.out.length === 0 && item.in.length === 0))
|
||||
.map(item => ({
|
||||
floorId: item.id,
|
||||
inChannel: item.in,
|
||||
outChannel: item.out
|
||||
}))
|
||||
|
||||
data.channels = filteredChannels
|
||||
await (isUpdate.value ? elevatorInfoUpdate(data) : elevatorInfoAdd(data))
|
||||
resetInitialized()
|
||||
emit('reload')
|
||||
@@ -183,6 +203,9 @@ async function setupCommunitySelect() {
|
||||
value: 'code',
|
||||
children: 'children',
|
||||
},
|
||||
onChange: async (value: any) => {
|
||||
await handleGetFloor(value)
|
||||
},
|
||||
getPopupContainer,
|
||||
placeholder: '请选择建筑',
|
||||
showSearch: true,
|
||||
@@ -194,11 +217,41 @@ async function setupCommunitySelect() {
|
||||
// 选中后显示在输入框的值
|
||||
treeNodeLabelProp: 'fullName',
|
||||
}),
|
||||
fieldName: 'unitId',
|
||||
fieldName: 'buildingId',
|
||||
},
|
||||
])
|
||||
}
|
||||
|
||||
interface floor {
|
||||
out: string
|
||||
in: string
|
||||
num: string | number
|
||||
id: string | number
|
||||
}
|
||||
const floorList = ref<floor[]>([])
|
||||
const dynamicValidateForm = reactive<{ floor: floor[] }>({
|
||||
floor: [],
|
||||
})
|
||||
async function handleGetFloor(unitId: string | number) {
|
||||
try {
|
||||
const res = await queryByBuildingId(unitId)
|
||||
floorList.value = []
|
||||
res.forEach((item) => {
|
||||
floorList.value.push({
|
||||
out: '',
|
||||
in: '',
|
||||
num: item.floorNumber,
|
||||
id: item.id,
|
||||
})
|
||||
})
|
||||
|
||||
dynamicValidateForm.floor = floorList.value
|
||||
} catch (error) {
|
||||
console.error('获取楼层列表失败:', error)
|
||||
floorList.value = []
|
||||
}
|
||||
}
|
||||
|
||||
async function handleClosed() {
|
||||
await formApi.resetForm()
|
||||
resetInitialized()
|
||||
@@ -207,6 +260,23 @@ async function handleClosed() {
|
||||
|
||||
<template>
|
||||
<BasicModal :title="title">
|
||||
<BasicForm />
|
||||
<Tabs style="height: 600px !important">
|
||||
<TabPane key="1" tab="基本信息">
|
||||
<BasicForm />
|
||||
</TabPane>
|
||||
<TabPane key="2" tab="楼层信息">
|
||||
<Form :model="dynamicValidateForm" layout="inline">
|
||||
<Space v-for="(floor, index) in dynamicValidateForm.floor" :key="floor.id"
|
||||
style="display: flex; margin-bottom: 8px" align="baseline">
|
||||
<FormItem :label="'楼层' + (floor.num)" :name="['floor', index, 'out']">
|
||||
<Input v-model:value="floor.out" placeholder="外部按键通道" />
|
||||
</FormItem>
|
||||
<FormItem :name="['floor', index, 'in']">
|
||||
<Input v-model:value="floor.in" placeholder="内部按键通道" />
|
||||
</FormItem>
|
||||
</Space>
|
||||
</Form>
|
||||
</TabPane>
|
||||
</Tabs>
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
@@ -2,7 +2,7 @@
|
||||
<Page class="h-full w-full">
|
||||
<!-- 设备分组区域 -->
|
||||
<div class="flex h-full gap-[8px]">
|
||||
<ChannelTree class="h-[83vh] w-[260px]" @check="onNodeChecked" />
|
||||
<ChannelTree class="h-[83vh] w-[300px]" @check="onNodeChecked" />
|
||||
|
||||
<!-- 设备分组区域 -->
|
||||
<div class="bg-background flex-1">
|
||||
@@ -194,31 +194,26 @@ function onNodeChecked(
|
||||
}
|
||||
// 批量播放 currentSelectPlayerIndex 将不再生效
|
||||
else {
|
||||
checkNode.forEach((item: any) => {
|
||||
// 判断当前摄像数据是否已经在播放,如果在播放则此次不进行播放处理.默认选中最后一个
|
||||
let firstFreePlayerIndex = playerNum.value - 1;
|
||||
// 记录第一个空播放器是否已找到
|
||||
let isRecord = false;
|
||||
// 此次选中的设备是否播放
|
||||
let isPlayer = true;
|
||||
// 如果此次播放数量小于当前播能播放
|
||||
const freeArr: number[] = []; // 空闲播放器数量
|
||||
for (let i = 0; i < playerNum.value; i++) {
|
||||
const playerData = playerList[i];
|
||||
if (!playerData) {
|
||||
freeArr.push(i);
|
||||
}
|
||||
}
|
||||
// 要播放的视频数量,小于等于空闲播放器数量,则填充空闲即可
|
||||
if (checkNode.length <= freeArr.length) {
|
||||
for (let j = 0; j < checkNode.length; j++) {
|
||||
doPlayer(checkNode[j], freeArr[j]);
|
||||
}
|
||||
}
|
||||
// 直接覆盖原有的播放视频
|
||||
else {
|
||||
for (let i = 0; i < playerNum.value; i++) {
|
||||
// 记录第一个出现空播放器的索引
|
||||
const playerData = playerList[i];
|
||||
// 没找到空播放器,并且此次循环播放器为null
|
||||
if (!isRecord && !playerData) {
|
||||
firstFreePlayerIndex = i;
|
||||
isRecord = true;
|
||||
}
|
||||
|
||||
if (playerData && playerData.data.id == item.id) {
|
||||
isRecord = false;
|
||||
break;
|
||||
}
|
||||
doPlayer(checkNode[i], i);
|
||||
}
|
||||
if (isPlayer) {
|
||||
doPlayer(item, firstFreePlayerIndex);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
// 删除
|
||||
@@ -275,16 +270,29 @@ function changeElPlayer(playerInfo: any, index: number) {
|
||||
* @param nodeData 播放的节点数据
|
||||
* @param index 播放器的索引信息
|
||||
*/
|
||||
function doPlayer(nodeData: any, index: number) {
|
||||
function doPlayer(nodeData: any, index: number = 0) {
|
||||
console.log('index=', index);
|
||||
if (mpegts.isSupported()) {
|
||||
const params = {
|
||||
videoIp: nodeData.deviceIp,
|
||||
videoPort: nodeData.devicePort,
|
||||
factoryNo: nodeData.factoryNo,
|
||||
account: nodeData.deviceAccount,
|
||||
pwd: nodeData.devicePwd,
|
||||
channelId: nodeData.channelNo,
|
||||
};
|
||||
let params = {};
|
||||
// if (nodeData.nvrIp) {
|
||||
// params = {
|
||||
// videoIp: nodeData.nvrIp,
|
||||
// videoPort: nodeData.nvrPort,
|
||||
// factoryNo: nodeData.nvrFactoryNo,
|
||||
// account: nodeData.nvrAccount,
|
||||
// pwd: nodeData.nvrPwd,
|
||||
// channelId: nodeData.nvrChannelNo,
|
||||
// };
|
||||
// } else {
|
||||
params = {
|
||||
videoIp: nodeData.deviceIp,
|
||||
videoPort: nodeData.devicePort,
|
||||
factoryNo: nodeData.factoryNo,
|
||||
account: nodeData.deviceAccount,
|
||||
pwd: nodeData.devicePwd,
|
||||
channelId: nodeData.channelNo,
|
||||
};
|
||||
// }
|
||||
addStreamProxy(params).then((res) => {
|
||||
const url = res.wsFlv;
|
||||
// 将url 绑定到 nodeData
|
||||
@@ -367,6 +375,12 @@ onUnmounted(() => {
|
||||
.player {
|
||||
border: 1px solid #e4e4e7;
|
||||
cursor: pointer;
|
||||
|
||||
video {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: fill;
|
||||
}
|
||||
}
|
||||
|
||||
.player.selected {
|
||||
|
@@ -98,7 +98,7 @@
|
||||
<SelectOption value="50">50条/页</SelectOption>
|
||||
</Select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 算法详情弹窗 -->
|
||||
<AlgorithmDetailModal />
|
||||
|
Reference in New Issue
Block a user