Browse Source

Merge branch 'master' of http://120.26.116.243:3000/root/alert-front into cjl-dev

pull/35/head
CJL6015 3 weeks ago
parent
commit
a0b0d26f7a
  1. 5
      pnpm-lock.yaml
  2. 3
      src/api/system/config/Company.ts
  3. 9
      src/views/exa/HistoryLine.vue
  4. 4
      src/views/exa/config/HistoryModal.vue
  5. 25
      src/views/exa/config/index.vue
  6. 9
      src/views/exa/exa.data.ts
  7. 17
      src/views/exa/history/PointModal.vue
  8. 2
      src/views/exa/history/index.vue
  9. 11
      src/views/run/instant/index.vue
  10. 61
      src/views/system/config/Company/Company.ts
  11. 10
      src/views/system/config/Company/CompanyModal.vue
  12. 27
      src/views/system/config/Company/index.vue
  13. 79
      src/views/system/unit/Company/Company.ts

5
pnpm-lock.yaml

@ -5,7 +5,6 @@ settings:
excludeLinksFromLockfile: false
importers:
.:
dependencies:
'@ant-design/colors':
@ -290,7 +289,6 @@ importers:
version: 1.8.22(typescript@5.2.2)
packages:
'@aashutoshrathi/word-wrap@1.2.6':
resolution: {integrity: sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==}
engines: {node: '>=0.10.0'}
@ -5565,7 +5563,6 @@ packages:
resolution: {integrity: sha512-OFXkDJKcrlx5su2XbzJvj/34Q3m6PvyCZkVPHGYpcCJ52ek4U/ymZyfuV1nKE23AyBJ51E/6Yr0mhZ7xGTO4ag==}
snapshots:
'@aashutoshrathi/word-wrap@1.2.6': {}
'@ampproject/remapping@2.2.1':
@ -11558,4 +11555,4 @@ snapshots:
zrender@5.6.1:
dependencies:
tslib: 2.3.0
tslib: 2.3.0

3
src/api/system/unit/Company.ts → src/api/system/config/Company.ts

@ -2,15 +2,14 @@ import { defHttp } from '@/utils/http/axios'
export interface CompanyVO {
id?: number
num: number// 集团序号
name: string // 集团名称
short: string // 集团简称
status: number // 状态
createTime: Date // 创建时间
}
export interface CompanyPageReqVO {
name?: string
status?: number
}
// 查询集团列表

9
src/views/exa/HistoryLine.vue

@ -3,6 +3,7 @@ import type { Ref } from 'vue'
import { onMounted, ref, watch } from 'vue'
import type { YAXisOption } from 'echarts/types/dist/shared'
import moment from 'moment'
import { Empty } from 'ant-design-vue'
import { useECharts } from '@/hooks/web/useECharts'
import { propTypes } from '@/utils/propTypes'
@ -85,7 +86,7 @@ watch(
x: '2%',
y: '5%',
x2: '2%',
y2: '30%',
y2: '10%',
containLabel: false,
// width: {totalWidth} - x - x2,
// height: {totalHeight} - y - y2,
@ -185,5 +186,9 @@ watch(
</script>
<template>
<div ref="chartRef" :style="{ width, height }" />
<div v-if="name.length === 0" :style="{ width, height, display: 'flex', justifyContent: 'center', alignItems: 'center' }">
<Empty />
</div>
<div v-else ref="chartRef" :style="{ width, height }" />
</template>

4
src/views/exa/config/HistoryModal.vue

@ -80,10 +80,10 @@ async function handleSubmitR() {
</script>
<template>
<BasicModal v-bind="$attrs" title="历史曲线" width="80%" @register="registerHistoryModal">
<BasicModal :min-height="300" v-bind="$attrs" title="历史曲线" width="60%" @register="registerHistoryModal">
<BasicForm @register="registerForm" @submit="handleSubmitR" />
<Card :loading="loading">
<HistoryLine :data="historyData" :name="legendName" height="500px" />
<HistoryLine :data="historyData" :name="legendName" height="40vh" />
</Card>
</BasicModal>
</template>

25
src/views/exa/config/index.vue

@ -1,5 +1,6 @@
<script lang="ts" setup>
import { onMounted, onUnmounted, ref } from 'vue'
import { Space } from 'ant-design-vue'
import { columns, searchFormSchema } from '../exa.data'
import EXAModal from './EXAModal.vue'
import CreateBatchModal from './CreateBatchModal.vue'
@ -21,7 +22,6 @@ const [registerModal, { openModal }] = useModal()
const [registerCreateBatchModal, { openModal: openCreateBatchModal }] = useModal()
const [registerHistoryModal, { openModal: openHistoryModal }] = useModal()
const [registerTable, { getForm, reload, getDataSource, updateTableDataRecord }] = useTable({
title: '测点列表',
api: getEXAPage,
@ -33,23 +33,19 @@ const [registerTable, { getForm, reload, getDataSource, updateTableDataRecord }]
schemas: searchFormSchema,
showResetButton: false,
actionColOptions: {
span: 2,
span: 6,
},
},
useSearchForm: true,
showTableSetting: true,
showIndexColumn: false,
actionColumn: {
width: 140,
width: 80,
title: t('common.action'),
dataIndex: 'action',
fixed: 'right',
},
})
// function handleQuery() {
// getForm().setFieldsValue({ condition: '' })
// reload()
// }
async function getNow() {
const params = getDataSource()
@ -109,6 +105,17 @@ async function handleDelete(record: Recordable) {
<template>
<div>
<BasicTable @register="registerTable">
<template #form-advanceBefore>
<Space style="margin-right: 10%;">
<a-button v-auth="['system:role:create']" type="primary" :pre-icon="IconEnum.ADD" @click="handleCreate">
{{ t('action.create') }}
</a-button>
<a-button v-auth="['system:role:create']" type="primary" :pre-icon="IconEnum.ADDS" @click="handleCreateBatch">
{{ t('action.createBatch') }}
</a-button>
</Space>
</template>
<template #value="{ record }">
<a class="click-status" @click="handleHistory(record)">
{{ record.value }}
@ -116,12 +123,12 @@ async function handleDelete(record: Recordable) {
<!-- <SlidersOutlined class="click-status" /> -->
</template>
<template #toolbar>
<a-button v-auth="['system:role:create']" type="primary" :pre-icon="IconEnum.ADD" @click="handleCreate">
<!-- <a-button v-auth="['system:role:create']" type="primary" :pre-icon="IconEnum.ADD" @click="handleCreate">
{{ t('action.create') }}
</a-button>
<a-button v-auth="['system:role:create']" type="primary" :pre-icon="IconEnum.ADDS" @click="handleCreateBatch">
{{ t('action.createBatch') }}
</a-button>
</a-button> -->
<!-- <a-button v-auth="['system:role:create']" :pre-icon="IconEnum.EXPORT" @click="handleExport">
{{ t('action.export') }}
</a-button> -->

9
src/views/exa/exa.data.ts

@ -6,7 +6,7 @@ export const columns: BasicColumn[] = [
{
title: '编号',
dataIndex: 'serialNumber',
width: 80,
width: 50,
},
{
title: '测点编码',
@ -16,12 +16,12 @@ export const columns: BasicColumn[] = [
{
title: '测点名称',
dataIndex: 'descriptor',
width: 200,
width: 170,
},
{
title: '实时值',
dataIndex: 'value',
width: 90,
width: 55,
className: 'value',
slots: { customRender: 'value' },
@ -29,7 +29,7 @@ export const columns: BasicColumn[] = [
{
title: '单位',
dataIndex: 'engUnits',
width: 30,
width: 35,
},
{
title: '组别',
@ -48,6 +48,7 @@ export const searchFormSchema: FormSchema[] = [
required: true,
colProps: { span: 8 },
},
]
export const formSchema: FormSchema[] = [

17
src/views/exa/history/PointModal.vue

@ -55,7 +55,7 @@ const [registerTable] = useTable({
schemas: searchFormSchema,
showResetButton: false,
actionColOptions: {
span: 2,
span: 3,
},
},
rowKey: 'serialNumber',
@ -109,7 +109,7 @@ const [registerSelectedTable] = useTable({
useSearchForm: false,
showIndexColumn: false,
actionColumn: {
width: 140,
width: 80,
title: t('common.action'),
dataIndex: 'action',
fixed: 'right',
@ -183,14 +183,15 @@ function onCanel() {
</script>
<template>
<BasicModal v-bind="$attrs" title="测点配置" width="1000px" @cancel="onCanel" @register="registerPointModal" @ok="handleOk">
<BasicModal v-bind="$attrs" :min-height="500" title="测点配置" width="850px" @cancel="onCanel" @register="registerPointModal" @ok="handleOk">
<BasicTable
ref="tableRef" :can-resize="false" title="RefTable示例" title-help-message="使用Ref调用表格内方法"
ref="tableRef" title="所有测点" :can-resize="false"
:row-selection="rowSelection" size="small" @register="registerTable"
/>
<BasicTable
ref="tableRef1" :pagination="false" size="small" :data-source="selectedData" :can-resize="false"
title="已选中测点" title-help-message="使用Ref调用表格内方法" @register="registerSelectedTable"
ref="tableRef1"
:pagination="false" size="small" :data-source="selectedData" :can-resize="false"
title="已选中测点" @register="registerSelectedTable"
>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'action'">
@ -221,3 +222,7 @@ function onCanel() {
</BasicTable>
</BasicModal>
</template>
<style>
</style>

2
src/views/exa/history/index.vue

@ -2,7 +2,7 @@
import { onMounted, reactive, ref } from 'vue'
import type { Dayjs } from 'dayjs'
import moment from 'moment'
import { Button, Card, Form, FormItem, RangePicker, Space, message } from 'ant-design-vue'
import { Button, Card, Empty, Form, FormItem, RangePicker, Space, message } from 'ant-design-vue'
import HistoryLine from '../HistoryLine.vue'
import PointModal from './PointModal.vue'
import { getExaHistorys } from '@/api/alert/exa'

11
src/views/run/instant/index.vue

@ -35,7 +35,7 @@ const [registerTable, { getForm, reload, getDataSource, updateTableDataRecord }]
schemas: searchFormSchema,
showResetButton: false,
actionColOptions: {
span: 2,
span: 3,
},
},
@ -141,6 +141,12 @@ function handleWarnConfig(record: Recordable) {
<template>
<div>
<BasicTable @register="registerTable">
<template #form-advanceBefore>
<a-button v-auth="['run:instant:create']" type="primary" :pre-icon="IconEnum.ADD" @click="handleCreate">
{{ t('action.create') }}
</a-button>
</template>
<template #detail="{ record }">
<a class="click-status" @click="handleDetail(record)">
{{ record.mpName }}
@ -178,9 +184,6 @@ function handleWarnConfig(record: Recordable) {
:class="countData?.stop === 0 ? 'runningStatus' : 'runningStatus alarm'" color="black" text="模型停运"
@click="getTableData('stop')"
/>
<a-button v-auth="['run:instant:create']" type="primary" :pre-icon="IconEnum.ADD" @click="handleCreate">
{{ t('action.create') }}
</a-button>
</template>
<template #runStatus="{ record }">
<div v-if="record.runningLog === '模式已停运'">

61
src/views/system/config/Company/Company.ts

@ -0,0 +1,61 @@
import dayjs from 'dayjs'
import utc from 'dayjs/plugin/utc'
import type { BasicColumn, FormSchema } from '@/components/Table'
// 初始化 UTC 插件
dayjs.extend(utc)
export const columns: BasicColumn[] = [
{
title: '集团序号',
dataIndex: 'num',
width: 120,
},
{
title: '集团名称',
dataIndex: 'name',
width: 260,
},
{
title: '集团简称',
dataIndex: 'shortName',
width: 60,
},
{
title: '创建时间',
dataIndex: 'createTime',
width: 180,
// 推荐的新写法(Ant Design Vue 2.2+)
customRender: ({ text }) => {
// 假设 text 是 UTC 时间(如 "2025-05-28T17:02:44")
return dayjs.utc(text).local().format('YYYY-MM-DD HH:mm:ss')
},
},
]
export const formSchema: FormSchema[] = [
{
label: '编号',
field: 'id',
show: false,
component: 'Input',
},
{
label: '集团序号',
field: 'num',
required: true,
component: 'Input',
},
{
label: '集团名称',
field: 'name',
required: true,
component: 'Input',
},
{
label: '集团简称',
field: 'shortName',
required: true,
component: 'Input',
},
]

10
src/views/system/unit/Company/CompanyModal.vue → src/views/system/config/Company/CompanyModal.vue

@ -5,7 +5,7 @@ import { useI18n } from '@/hooks/web/useI18n'
import { useMessage } from '@/hooks/web/useMessage'
import { BasicForm, useForm } from '@/components/Form'
import { BasicModal, useModalInner } from '@/components/Modal'
import { createCompany, getCompany, updateCompany } from '@/api/system/unit/Company'
import { createCompany, getCompany, updateCompany } from '@/api/system/config/Company'
defineOptions({ name: 'CompanyModal' })
@ -40,7 +40,6 @@ async function handleSubmit() {
await updateCompany(values)
else
await createCompany(values)
closeModal()
emit('success')
createMessage.success(t('common.saveSuccessText'))
@ -53,11 +52,12 @@ async function handleSubmit() {
<template>
<BasicModal
v-bind="$attrs" :title="isUpdate ? t('action.edit') : t('action.create')" @register="registerModal"
v-bind="$attrs" :title="isUpdate ? t('action.edit') : t('action.create')" :width="600"
:auto-height="true"
:style="{ maxHeight: '500px' }"
@register="registerModal"
@ok="handleSubmit"
>
<BasicForm @register="registerForm" />
</BasicModal>
</template>
./Company
@/api/system/unit/Company

27
src/views/system/unit/Company/index.vue → src/views/system/config/Company/index.vue

@ -1,12 +1,12 @@
<script lang="ts" setup>
import CompanyModal from './CompanyModal.vue'
import { columns, searchFormSchema } from './Company'
import { columns } from './Company'
import { useI18n } from '@/hooks/web/useI18n'
import { useMessage } from '@/hooks/web/useMessage'
import { useModal } from '@/components/Modal'
import { IconEnum } from '@/enums/appEnum'
import { BasicTable, TableAction, useTable } from '@/components/Table'
import { deleteCompany, getCompanyPage } from '@/api/system/unit/Company'
import { deleteCompany, getCompanyPage } from '@/api/system/config/Company'
defineOptions({ name: 'UnitCompany' })
@ -20,9 +20,9 @@ const [register, { getForm, reload }] = useTable({
api: getList,
columns,
rowKey: 'id',
formConfig: { labelWidth: 120, schemas: searchFormSchema },
formConfig: { labelWidth: 120 },
pagination: true,
useSearchForm: true,
useSearchForm: false,
showTableSetting: true,
showIndexColumn: false,
actionColumn: {
@ -54,10 +54,10 @@ async function handleDelete(record: Recordable) {
</script>
<template>
<div>
<div style="height: calc(100vh - 200px); overflow: auto;">
<BasicTable @register="register">
<template #toolbar>
<a-button v-auth="['system:unit:create']" type="primary" :pre-icon="IconEnum.ADD" @click="handleCreate">
<a-button v-auth="['system:company:create']" type="primary" :pre-icon="IconEnum.ADD" @click="handleCreate">
{{ t('action.create') }}
</a-button>
</template>
@ -65,12 +65,12 @@ async function handleDelete(record: Recordable) {
<template v-if="column.key === 'action'">
<TableAction
:actions="[
{ icon: IconEnum.EDIT, label: t('action.edit'), auth: 'system:unit:update', onClick: handleEdit.bind(null, record) },
{ icon: IconEnum.EDIT, label: t('action.edit'), auth: 'system:company:update', onClick: handleEdit.bind(null, record) },
{
icon: IconEnum.DELETE,
danger: true,
label: t('action.delete'),
auth: 'system:unit:delete',
auth: 'system:company:delete',
popConfirm: {
title: t('common.delMessage'),
placement: 'left',
@ -85,5 +85,12 @@ async function handleDelete(record: Recordable) {
<CompanyModal @register="registerModal" @success="reload()" />
</div>
</template>
./Company
@/api/system/unit/Company
<style scoped>
/* 深度选择器覆盖 Ant Design 内部样式 */
:deep(.ant-table-body) {
height: auto !important;
min-height: 200px;
max-height: 300 !important;
}
</style>

79
src/views/system/unit/Company/Company.ts

@ -1,79 +0,0 @@
import type { BasicColumn, FormSchema } from '@/components/Table'
import { useRender } from '@/components/Table'
import { DICT_TYPE, getDictOptions } from '@/utils/dict'
export const columns: BasicColumn[] = [
{
title: '集团名称',
dataIndex: 'name',
width: 260,
},
{
title: '集团简称',
dataIndex: 'shortName', // 注意:后端是 shortName,不是 short!
width: 60,
},
{
title: '状态',
dataIndex: 'status',
width: 180,
customRender: ({ text }) => {
return useRender.renderDict(text, DICT_TYPE.COMMON_STATUS)
},
},
{
title: '创建时间',
dataIndex: 'createTime',
width: 180,
customRender: ({ text }) => {
return useRender.renderDate(text)
},
},
]
export const searchFormSchema: FormSchema[] = [
{
label: '集团名称',
field: 'name',
component: 'Input',
colProps: { span: 8 },
},
{
label: '状态',
field: 'status',
component: 'Select',
componentProps: {
options: getDictOptions(DICT_TYPE.COMMON_STATUS),
},
colProps: { span: 8 },
},
]
export const formSchema: FormSchema[] = [
{
label: '编号',
field: 'id',
show: false,
component: 'Input',
},
{
label: '集团名称',
field: 'name',
required: true,
component: 'Input',
},
{
label: '集团简称',
field: 'shortName', // 注意:后端是 shortName,不是 short!
required: true,
component: 'Input',
},
{
label: '集团状态',
field: 'status',
component: 'Select',
componentProps: {
options: getDictOptions(DICT_TYPE.COMMON_STATUS),
},
},
]
Loading…
Cancel
Save