This commit is contained in:
njdaoyehu 2025-01-03 11:19:45 +08:00
parent f146040e30
commit baea43d692
11 changed files with 257 additions and 103 deletions

View File

@ -64,55 +64,55 @@
color: #AAAAAA; color: #AAAAAA;
} }
:deep(.ant-btn-default) { //:deep(.ant-btn-default) {
font-family: "Noto Sans SC", serif; // font-family: "Noto Sans SC", serif;
font-size: 14px; // font-size: 14px;
color: #FFFFFF; // color: #FFFFFF;
background-color: rgba(58,98,203,0.8); // background-color: rgba(58,98,203,0.8);
box-shadow: inset 0 0 20px 2px #3A62CB; // box-shadow: inset 0 0 20px 2px #3A62CB;
height: 36px; // height: 36px;
border-radius: 6px; // border-radius: 6px;
border: none; // border: none;
} //}
//
//:deep(.ant-btn-default:hover) {
// font-family: "Noto Sans SC", serif;
// font-size: 14px;
// color: #FFFFFF;
// background-color: rgba(58,98,203,0.8);
// box-shadow: inset 0 0 20px 2px #006CC6;
// height: 36px;
// border-radius: 6px;
// border: none;
//}
//
//:deep(.ant-btn-default:disabled),
//:deep(.ant-btn-default:disabled:hover),
//:deep(.ant-btn-default:disabled svg) {
// color: #AAAAAA;
//}
:deep(.ant-btn-default:hover) { //:deep(.ant-btn-primary) {
font-family: "Noto Sans SC", serif; // font-family: "Noto Sans SC", serif;
font-size: 14px; // font-size: 14px;
color: #FFFFFF; // color: #FFFFFF;
background-color: rgba(58,98,203,0.8); // background-color: #3793d4;
box-shadow: inset 0 0 20px 2px #006CC6; // box-shadow: inset 0 0 20px 2px #006CC6;
height: 36px; // height: 36px;
border-radius: 6px; // border-radius: 6px;
border: none; // border: none;
} //}
//
:deep(.ant-btn-default:disabled), //:deep(.ant-btn-primary:hover) {
:deep(.ant-btn-default:disabled:hover), // font-family: "Noto Sans SC", serif;
:deep(.ant-btn-default:disabled svg) { // font-size: 14px;
color: #AAAAAA; // color: #FFFFFF;
} // background-color: rgba(69,175,223,0.8);
// box-shadow: inset 0 0 20px 2px #006CC6;
:deep(.ant-btn-primary) { // height: 36px;
font-family: "Noto Sans SC", serif; // border-radius: 6px;
font-size: 14px; // border: none;
color: #FFFFFF; //}
background-color: #3793d4;
box-shadow: inset 0 0 20px 2px #006CC6;
height: 36px;
border-radius: 6px;
border: none;
}
:deep(.ant-btn-primary:hover) {
font-family: "Noto Sans SC", serif;
font-size: 14px;
color: #FFFFFF;
background-color: rgba(69,175,223,0.8);
box-shadow: inset 0 0 20px 2px #006CC6;
height: 36px;
border-radius: 6px;
border: none;
}
:deep(.vben-basic-table) { :deep(.vben-basic-table) {
background: transparent; background: transparent;
@ -561,3 +561,4 @@
:deep(.ant-descriptions-item-label) { :deep(.ant-descriptions-item-label) {
width: 120px; width: 120px;
} }

View File

@ -25,7 +25,7 @@ export default defineComponent({
return () => { return () => {
const propsData = { ...unref(attrs), ...props, onCancel } as Recordable; const propsData = { ...unref(attrs), ...props, onCancel } as Recordable;
return <Modal {...propsData}>{extendSlots(slots)}</Modal>; return <Modal class="custom-modal" {...propsData}>{extendSlots(slots)}</Modal>;
}; };
}, },
}); });

View File

@ -1,5 +1,4 @@
import type { AppRouteRecordRaw } from '/@/router/types'; import type { AppRouteRecordRaw } from '/@/router/types';
import { t } from '/@/hooks/web/useI18n';
import { import {
REDIRECT_NAME, REDIRECT_NAME,
LAYOUT, LAYOUT,

View File

@ -1,7 +1,6 @@
import type { AppRouteModule } from '/src/router/types'; import type { AppRouteModule } from '@/router/types';
import { LAYOUT } from '/src/router/constant'; import { t } from '@/hooks/web/useI18n';
import { t } from '/src/hooks/web/useI18n';
const about: AppRouteModule = { const about: AppRouteModule = {
path: '/dashboard', path: '/dashboard',

View File

@ -3,7 +3,6 @@ import type { AppRouteRecordRaw, AppRouteModule } from '/@/router/types';
import { PAGE_NOT_FOUND_ROUTE, REDIRECT_ROUTE } from '/@/router/routes/basic'; import { PAGE_NOT_FOUND_ROUTE, REDIRECT_ROUTE } from '/@/router/routes/basic';
import { PageEnum } from '/@/enums/pageEnum'; import { PageEnum } from '/@/enums/pageEnum';
import { t } from '/@/hooks/web/useI18n';
// import.meta.glob() 直接引入所有的模块 Vite 独有的功能 // import.meta.glob() 直接引入所有的模块 Vite 独有的功能
const modules = import.meta.glob('./modules/**/*.ts', { eager: true }); const modules = import.meta.glob('./modules/**/*.ts', { eager: true });

View File

@ -56,7 +56,7 @@
await action(data); await action(data);
closeDrawer(); closeDrawer();
emit('success'); emit('success');
} finally { } catch {} finally {
setDrawerProps({ confirmLoading: false }); setDrawerProps({ confirmLoading: false });
} }
} }

View File

@ -12,10 +12,10 @@
</BasicForm> </BasicForm>
<BasicTable @register="registerTable"> <BasicTable @register="registerTable">
<template #toolbar> <template #toolbar>
<a-button type="primary" @click="handleCreate" :icon="h(PlusOutlined)"></a-button> <a-button type="primary" @click="handleCreate" :icon="h(PlusOutlined)"> </a-button>
<div style="width: 5px" /> <div style="width: 5px" />
<a-button type="primary" :icon="h(EyeOutlined)" @click="handleOpenFileDialog">OCR识别</a-button> <a-button type="primary" :icon="h(EyeOutlined)" @click="handleOpenFileDialog">OCR识别</a-button>
<input type="file" ref="fileInput" accept="image/bmp,image/jpeg,image/jpg,image/png" @change="handleFileChange" style="display: none;" /> <input type="file" ref="fileInput" aria-hidden="true" accept="image/bmp,image/jpeg,image/jpg,image/png" @change="handleFileChange" style="display: none;" />
<div style="width: 5px" /> <div style="width: 5px" />
</template> </template>
<template #bodyCell="{ column, record }"> <template #bodyCell="{ column, record }">
@ -44,7 +44,7 @@
</template> </template>
</template> </template>
</BasicTable> </BasicTable>
<Modal @register="register" /> <Modal @register="register" @success="updateParamData" />
</BasicDrawer> </BasicDrawer>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
@ -97,7 +97,7 @@ const columns = [
}, },
]; ];
const paramData = ref([]); const paramData = ref<any>([]);
const emit = defineEmits(['success', 'register']); const emit = defineEmits(['success', 'register']);
const isUpdate = ref(true); const isUpdate = ref(true);
@ -114,7 +114,11 @@ const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (
setDrawerProps({ confirmLoading: false }); setDrawerProps({ confirmLoading: false });
isUpdate.value = !!data?.isUpdate; isUpdate.value = !!data?.isUpdate;
entity.value = data?.record; entity.value = data?.record;
paramData.value = entity.value && entity.value.paramJson ? JSON.parse(entity.value.paramJson) : []; paramData.value = [];
const items = entity.value && entity.value.paramJson ? JSON.parse(entity.value.paramJson) : [];
items.forEach((d: any, index: number) => {
paramData.value.push({ index, ...d });
});
await setFieldsValue({ await setFieldsValue({
...data.record, ...data.record,
}); });
@ -162,16 +166,17 @@ async function handleSubmit() {
await action(data); await action(data);
closeDrawer(); closeDrawer();
emit('success'); emit('success');
} finally { } catch {} finally {
setDrawerProps({ confirmLoading: false }); setDrawerProps({ confirmLoading: false });
} }
}; }
const handleCreate = () => { const handleCreate = () => {
openModal(true, { isUpdate: false }); openModal(true, { isUpdate: false });
}; };
const handleEdit = (record: Recordable) => { const handleEdit = (record: Recordable, index: number) => {
openModal(true, { record, isUpdate: true });
}; };
const handleDelete = (record: Recordable) => { const handleDelete = (record: Recordable) => {
@ -203,6 +208,10 @@ const handleImport = (base64ImageString: any) => {
WebViewService.setMessage("数据导入失败!", "error").then(() => {}); WebViewService.setMessage("数据导入失败!", "error").then(() => {});
}); });
}; };
const updateParamData = (data: any) => {
paramData.value[data.index] = { ...data };
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@use '@/assets/custom.scss'; @use '@/assets/custom.scss';

View File

@ -6,10 +6,10 @@
</div> </div>
<BasicTable @register="registerTable"> <BasicTable @register="registerTable">
<template #toolbar> <template #toolbar>
<a-button type="primary" @click="handleCreate" :icon="h(PlusOutlined)"></a-button> <a-button type="primary" @click="handleCreate" :icon="h(PlusOutlined)"> </a-button>
<div style="width: 5px" /> <div style="width: 5px" />
<a-button type="default" :icon="h(ImportOutlined)" @click="handleOpenFileDialog">导入数据</a-button> <a-button type="default" :icon="h(ImportOutlined)" @click="handleOpenFileDialog">导入数据</a-button>
<input type="file" ref="fileInput" accept="image/bmp,image/jpeg,image/jpg,image/png" @change="handleFileChange" style="display: none;" /> <input type="file" ref="fileInput" accept="image/bmp,image/jpeg,image/jpg,image/png" aria-hidden="true" @change="handleFileChange" style="display: none;" />
<div style="width: 5px" /> <div style="width: 5px" />
<a-button type="default" @click="handleDownload" :icon="h(DownloadOutlined)" :disabled="checkedKeys.length === 0">下发数据</a-button> <a-button type="default" @click="handleDownload" :icon="h(DownloadOutlined)" :disabled="checkedKeys.length === 0">下发数据</a-button>
<a-button type="default" @click="handleSync" :icon="h(SyncOutlined)" :disabled="checkedKeys.length === 0">同步数据</a-button> <a-button type="default" @click="handleSync" :icon="h(SyncOutlined)" :disabled="checkedKeys.length === 0">同步数据</a-button>

View File

@ -1,38 +1,194 @@
<template> <template>
<!-- 你的模板代码 --> <BasicModal v-bind="$attrs" @register="register" :closable="false" showFooter :title="getTitle" width="400px" @ok="handleSubmit">
<BasicModal v-bind="$attrs" title="Modal Title" :helpMessage="['提示1', '提示2']"> <BasicForm @register="registerForm" />
Modal Info.
</BasicModal> </BasicModal>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import BasicModal from "@/components/Modal/src/BasicModal.vue"; import { BasicModal, useModalInner } from "@/components/Modal";
// import { ref } from "vue"; import { computed, defineEmits, ref, unref } from "vue";
// const showModal = ref(false); import { BasicForm, FormSchema, useForm } from "@/components/Form";
//
// const handleOpen = () => { const entity = ref();
// showModal.value = true; const isUpdate = ref(true);
// }; const emit = defineEmits(['success', 'register']);
// const getTitle = computed(() => (!unref(isUpdate) ? '新增' : '编辑'));
// const handleClose = () => {
// showModal.value = false; const [register, { closeModal, setModalProps }] = useModalInner(async (data) => {
// }; await resetFields();
setModalProps({ confirmLoading: false });
isUpdate.value = !!data?.isUpdate;
entity.value = data?.record;
await setFieldsValue({
...data.record,
});
});
const paramSchema: FormSchema[] = [
{
colProps: { span: 24 },
field: "code",
label: "预埋件编号",
componentProps: {
allowClear: false,
placeholder: '预埋件编号',
},
component: "Input",
defaultValue: undefined,
rules: [{ required: true, message: '请输入预埋件编号!' }],
},
{
colProps: { span: 24 },
field: "type",
label: "类型",
componentProps: {
allowClear: false,
placeholder: '类型',
},
component: "Input",
defaultValue: undefined,
rules: [{ required: true, message: '请输入类型!' }],
},
{
colProps: { span: 24 },
field: "x",
label: "X(mm)",
componentProps: {
allowClear: false,
placeholder: 'X(mm)',
},
component: "Input",
defaultValue: undefined,
rules: [{ required: true, message: '请输入X(mm)' }],
},
{
colProps: { span: 24 },
field: "y",
label: "Y(mm)",
componentProps: {
allowClear: false,
placeholder: 'Y(mm)',
},
component: "Input",
defaultValue: undefined,
rules: [{ required: true, message: '请输入Y(mm)' }],
},
{
colProps: { span: 24 },
field: "w",
label: "W(mm)",
componentProps: {
allowClear: false,
placeholder: 'W(mm)',
},
component: "Input",
defaultValue: undefined,
rules: [{ required: true, message: '请输入W(mm)' }],
},
{
colProps: { span: 24 },
field: "h",
label: "H(mm)",
componentProps: {
allowClear: false,
placeholder: 'H(mm)',
},
component: "Input",
defaultValue: undefined,
rules: [{ required: true, message: '请输入H(mm)' }],
},
];
const [registerForm, { resetFields, setFieldsValue, validate }] = useForm({
labelWidth: 90,
schemas: paramSchema,
showActionButtonGroup: false,
});
async function handleSubmit() {
try {
const values = await validate();
setModalProps({ confirmLoading: true });
const {
...rest
} = values;
closeModal();
const data = Object.assign({},
{
...unref(entity),
...rest,
});
emit('success', data);
} catch {} finally {
setModalProps({ confirmLoading: false });
}
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@use '@/assets/custom.scss'; @use '@/assets/custom.scss';
</style> </style>
<!--// Modal.vue--> <style>
<!--<template>--> .custom-modal .ant-modal-content {
background-color: #13265a;
}
.ant-modal-header {
background-color: #13265a !important;
}
.vben-basic-title {
font-family: "Noto Sans SC", serif;
font-size: 16px;
color: #ffffff !important;
}
<!--</template>--> .ant-btn-primary {
<!--<script lang="ts">--> font-family: "Noto Sans SC", serif;
<!--import { defineComponent } from 'vue';--> font-size: 14px;
<!--import { BasicModal } from '/@/components/Modal';--> color: #FFFFFF;
<!--export default defineComponent({--> background-color: #3793d4;
<!-- components: { BasicModal },--> box-shadow: inset 0 0 20px 2px #006CC6;
<!-- setup() {--> height: 36px;
<!-- return {};--> border-radius: 6px;
<!-- },--> border: none;
<!--});--> }
<!--</script>-->
.ant-btn-primary:hover {
font-family: "Noto Sans SC", serif;
font-size: 14px;
color: #FFFFFF;
background-color: rgba(69,175,223,0.8);
box-shadow: inset 0 0 20px 2px #006CC6;
height: 36px;
border-radius: 6px;
border: none;
}
.ant-btn-default {
font-family: "Noto Sans SC", serif;
font-size: 14px;
color: #FFFFFF;
background-color: rgba(58,98,203,0.8);
box-shadow: inset 0 0 20px 2px #3A62CB;
height: 36px;
border-radius: 6px;
border: none;
}
.ant-btn-default:hover {
font-family: "Noto Sans SC", serif;
font-size: 14px;
color: #FFFFFF;
background-color: rgba(58,98,203,0.8);
box-shadow: inset 0 0 20px 2px #006CC6;
height: 36px;
border-radius: 6px;
border: none;
}
.ant-btn-default:disabled,
.ant-btn-default:disabled:hover,
.ant-btn-default:disabled svg {
color: #AAAAAA;
}
</style>

View File

@ -8,24 +8,15 @@
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { useGo } from '@/hooks/web/usePage';
import { usePermission } from '@/hooks/web/usePermission';
import { BasicTable, useTable } from '@/components/Table'; import { BasicTable, useTable } from '@/components/Table';
import { isObject } from '@/utils/is'; import { isObject } from '@/utils/is';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import * as LogApi from '@/api/system/logApi'; import * as LogApi from '@/api/system/logApi';
import { useDrawer } from '@/components/Drawer';
import { columns, searchFormSchema } from './schema'; import { columns, searchFormSchema } from './schema';
import { useMessage } from "@/hooks/web/useMessage";
import {SvgIcon} from "@/components/Icon"; import {SvgIcon} from "@/components/Icon";
import {onMounted} from "vue"; import {onMounted} from "vue";
const { createMessage } = useMessage(); const [registerTable] = useTable({
const { hasPermission } = usePermission();
const go = useGo();
const [registerDrawer, { openDrawer }] = useDrawer();
const [registerTable, { reload, setSelectedRowKeys }] = useTable({
api: (params) => LogApi.search(handleParams(params)), api: (params) => LogApi.search(handleParams(params)),
columns, columns,
formConfig: { formConfig: {

View File

@ -114,7 +114,7 @@ async function handleSubmit() {
} }
closeDrawer(); closeDrawer();
emit('success'); emit('success');
} finally { } catch {} finally {
setDrawerProps({ confirmLoading: false }); setDrawerProps({ confirmLoading: false });
} }
} }