parent
2fc58e0ac8
commit
3723d1154b
@ -0,0 +1,62 @@
|
|||||||
|
import request from '@/config/axios';
|
||||||
|
import type { TableData } from './types';
|
||||||
|
|
||||||
|
/** 获取表格数据 */
|
||||||
|
export const getRepIndexSetListApi = (data: any) => {
|
||||||
|
return request.postJson({ url: '/RepIndexSet/spi/dataset/RepIndexSet/RepIndexSetQueryPage', data });
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 批量删除 */
|
||||||
|
export const delRepIndexSetListApi = (list: string[] | number[]): Promise<IResponse> => {
|
||||||
|
const _list = list.map(v => {
|
||||||
|
return {
|
||||||
|
indexsetCode: v.indexsetCode,
|
||||||
|
beginDate: v.beginDate,
|
||||||
|
endDate: v.endDate,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
return request.postJson({
|
||||||
|
url: '/RepIndexSet/spi/dataset/RepIndexSet/RepIndexSetBatchDelete',
|
||||||
|
data: {
|
||||||
|
list: _list,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 删除 */
|
||||||
|
export const delRepIndexSetApi = (indexsetCode?: string, beginDate?: string, endDate?: string): Promise<IResponse> => {
|
||||||
|
return request.postJson({ url: '/RepIndexSet/spi/dataset/RepIndexSet/RepIndexSetDelete', data: { indexsetCode, beginDate, endDate } });
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 保存 */
|
||||||
|
export const saveRepIndexSetApi = (data: Partial<TableData>): Promise<IResponse> => {
|
||||||
|
return request.postJson({ url: '/RepIndexSet/spi/dataset/RepIndexSet/RepIndexSetSave', data });
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 查询单条数据 */
|
||||||
|
export const queryRepIndexSetApi = (indexsetCode?: string, beginDate?: string, endDate?: string): Promise<IResponse> => {
|
||||||
|
return request.postJson({ url: '/RepIndexSet/spi/dataset/RepIndexSet/RepIndexSetQueryOne', data: { indexsetCode, beginDate, endDate } });
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 同步导入 */
|
||||||
|
export const importExcelApiUrl = '/RepIndexSet/sui/dataset/RepIndexSet/RepIndexSetImportExcel';
|
||||||
|
|
||||||
|
/** 异步导入 */
|
||||||
|
export const importExcelAsyncApiUrl = '/RepIndexSet/sui/dataset/RepIndexSet/RepIndexSetImportAsyncExcel';
|
||||||
|
|
||||||
|
/** 导出 */
|
||||||
|
export const exportExcelApi = (params: any) => {
|
||||||
|
return request.doExport({ url: '/RepIndexSet/sdi/dataset/RepIndexSet/RepIndexSetExportXls', params });
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 获取某个字典 */
|
||||||
|
export const getCsckCheckType = ({ paramName, systemCode }): Promise<IResponse> => {
|
||||||
|
return request.postJson({
|
||||||
|
url: '/param/spi/param/systemparam',
|
||||||
|
data: {
|
||||||
|
paramName: paramName,
|
||||||
|
systemCode: systemCode,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,56 @@
|
|||||||
|
/* eslint-disable lines-around-comment */
|
||||||
|
|
||||||
|
export type TableData = {
|
||||||
|
/** 指标集编码 */
|
||||||
|
indexsetCode?: string
|
||||||
|
/** 开始日期 */
|
||||||
|
beginDate?: string
|
||||||
|
/** 结束日期 */
|
||||||
|
endDate?: string
|
||||||
|
/** 指标集名称 */
|
||||||
|
indexsetName?: string
|
||||||
|
/** 机构编码 */
|
||||||
|
organCode?: string
|
||||||
|
/** 频度 */
|
||||||
|
frequency?: string
|
||||||
|
/** 描述 */
|
||||||
|
description?: string
|
||||||
|
/** 指标集类型 */
|
||||||
|
indexsetType?: string
|
||||||
|
/** 数据模型编码 */
|
||||||
|
modelCode?: string
|
||||||
|
/** 创建机构 */
|
||||||
|
createOrgan?: string
|
||||||
|
/** 创建用户 */
|
||||||
|
createUser?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DictItem {
|
||||||
|
dictId: string;
|
||||||
|
dictName: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type FormModel = {
|
||||||
|
/** 指标集编码 */
|
||||||
|
indexsetCode?: string
|
||||||
|
/** 开始日期 */
|
||||||
|
beginDate?: string
|
||||||
|
/** 结束日期 */
|
||||||
|
endDate?: string
|
||||||
|
/** 指标集名称 */
|
||||||
|
indexsetName?: string
|
||||||
|
/** 机构编码 */
|
||||||
|
organCode?: string
|
||||||
|
/** 频度 */
|
||||||
|
frequency?: string
|
||||||
|
/** 描述 */
|
||||||
|
description?: string
|
||||||
|
/** 指标集类型 */
|
||||||
|
indexsetType?: string
|
||||||
|
/** 数据模型编码 */
|
||||||
|
modelCode?: string
|
||||||
|
/** 创建机构 */
|
||||||
|
createOrgan?: string
|
||||||
|
/** 创建用户 */
|
||||||
|
createUser?: string
|
||||||
|
}
|
@ -0,0 +1,62 @@
|
|||||||
|
import request from '@/config/axios';
|
||||||
|
import type { TableData } from './types';
|
||||||
|
|
||||||
|
/** 获取表格数据 */
|
||||||
|
export const getRepStoreParameterListApi = (data: any) => {
|
||||||
|
return request.postJson({ url: '/RepStoreParameter/spi/dataset/RepStoreParameter/RepStoreParameterQueryPage', data });
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 批量删除 */
|
||||||
|
export const delRepStoreParameterListApi = (list: string[] | number[]): Promise<IResponse> => {
|
||||||
|
const _list = list.map(v => {
|
||||||
|
return {
|
||||||
|
modelCode: v.modelCode,
|
||||||
|
ruleId: v.ruleId,
|
||||||
|
field: v.field,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
return request.postJson({
|
||||||
|
url: '/RepStoreParameter/spi/dataset/RepStoreParameter/RepStoreParameterBatchDelete',
|
||||||
|
data: {
|
||||||
|
list: _list,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 删除 */
|
||||||
|
export const delRepStoreParameterApi = (modelCode?: string, ruleId?: string, field?: string): Promise<IResponse> => {
|
||||||
|
return request.postJson({ url: '/RepStoreParameter/spi/dataset/RepStoreParameter/RepStoreParameterDelete', data: { modelCode, ruleId, field } });
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 保存 */
|
||||||
|
export const saveRepStoreParameterApi = (data: Partial<TableData>): Promise<IResponse> => {
|
||||||
|
return request.postJson({ url: '/RepStoreParameter/spi/dataset/RepStoreParameter/RepStoreParameterSave', data });
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 查询单条数据 */
|
||||||
|
export const queryRepStoreParameterApi = (modelCode?: string, ruleId?: string, field?: string): Promise<IResponse> => {
|
||||||
|
return request.postJson({ url: '/RepStoreParameter/spi/dataset/RepStoreParameter/RepStoreParameterQueryOne', data: { modelCode, ruleId, field } });
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 同步导入 */
|
||||||
|
export const importExcelApiUrl = '/RepStoreParameter/sui/dataset/RepStoreParameter/RepStoreParameterImportExcel';
|
||||||
|
|
||||||
|
/** 异步导入 */
|
||||||
|
export const importExcelAsyncApiUrl = '/RepStoreParameter/sui/dataset/RepStoreParameter/RepStoreParameterImportAsyncExcel';
|
||||||
|
|
||||||
|
/** 导出 */
|
||||||
|
export const exportExcelApi = (params: any) => {
|
||||||
|
return request.doExport({ url: '/RepStoreParameter/sdi/dataset/RepStoreParameter/RepStoreParameterExportXls', params });
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 获取某个字典 */
|
||||||
|
export const getCsckCheckType = ({ paramName, systemCode }): Promise<IResponse> => {
|
||||||
|
return request.postJson({
|
||||||
|
url: '/param/spi/param/systemparam',
|
||||||
|
data: {
|
||||||
|
paramName: paramName,
|
||||||
|
systemCode: systemCode,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,40 @@
|
|||||||
|
/* eslint-disable lines-around-comment */
|
||||||
|
|
||||||
|
export type TableData = {
|
||||||
|
/** 模型编码 */
|
||||||
|
modelCode?: string
|
||||||
|
/** 规则编码 */
|
||||||
|
ruleId?: string
|
||||||
|
/** 字段 */
|
||||||
|
field?: string
|
||||||
|
/** 名称 */
|
||||||
|
name?: string
|
||||||
|
/** 默认值 */
|
||||||
|
parameters?: string
|
||||||
|
/** 参数格式化 */
|
||||||
|
format?: string
|
||||||
|
/** 参数类型 */
|
||||||
|
paramType?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DictItem {
|
||||||
|
dictId: string;
|
||||||
|
dictName: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type FormModel = {
|
||||||
|
/** 模型编码 */
|
||||||
|
modelCode?: string
|
||||||
|
/** 规则编码 */
|
||||||
|
ruleId?: string
|
||||||
|
/** 字段 */
|
||||||
|
field?: string
|
||||||
|
/** 名称 */
|
||||||
|
name?: string
|
||||||
|
/** 默认值 */
|
||||||
|
parameters?: string
|
||||||
|
/** 参数格式化 */
|
||||||
|
format?: string
|
||||||
|
/** 参数类型 */
|
||||||
|
paramType?: string
|
||||||
|
}
|
@ -0,0 +1,317 @@
|
|||||||
|
<script setup lang="tsx">
|
||||||
|
import { reactive, ref, unref } from 'vue'
|
||||||
|
import {
|
||||||
|
getRepIndexSetListApi,
|
||||||
|
saveRepIndexSetApi,
|
||||||
|
delRepIndexSetListApi,
|
||||||
|
delRepIndexSetApi,
|
||||||
|
queryRepIndexSetApi,
|
||||||
|
importExcelApiUrl,
|
||||||
|
exportExcelApi
|
||||||
|
} from '@/api/dataset/RepIndexSet'
|
||||||
|
import { TableData } from '@/api/dataset/RepIndexSet/types'
|
||||||
|
import { useTable } from '@/hooks/web/useTable'
|
||||||
|
import { useI18n } from '@/hooks/web/useI18n'
|
||||||
|
import { Table, TableColumn } from '@/components/Table'
|
||||||
|
import { ElButton, ElLink, ElLoading, ElPopconfirm, ElMessage } from 'element-plus'
|
||||||
|
import { Search } from '@/components/Search'
|
||||||
|
import { FormSchema } from '@/components/Form'
|
||||||
|
import { ContentWrap } from '@/components/ContentWrap'
|
||||||
|
import Write from './components/Write.vue'
|
||||||
|
import { Dialog } from '@/components/Dialog'
|
||||||
|
import { getWidth } from '@/utils';
|
||||||
|
import Detail from './components/Detail.vue'
|
||||||
|
import { Upload } from '@/components/Upload'
|
||||||
|
|
||||||
|
const { t } = useI18n()
|
||||||
|
|
||||||
|
const ids = ref<string[]>([])
|
||||||
|
|
||||||
|
const { tableRegister, tableState, tableMethods } = useTable({
|
||||||
|
fetchDataApi: async () => {
|
||||||
|
const { currentPage, pageSize } = tableState
|
||||||
|
const res = await getRepIndexSetListApi({
|
||||||
|
pageIndex: unref(currentPage),
|
||||||
|
pageSize: unref(pageSize),
|
||||||
|
...unref(searchParams)
|
||||||
|
})
|
||||||
|
return {
|
||||||
|
list: res.body.list,
|
||||||
|
total: res.body.total
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fetchDelApi: async () => {
|
||||||
|
const res = await delRepIndexSetListApi(unref(ids));
|
||||||
|
return !!res;
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const { loading, dataList, total, currentPage, pageSize } = tableState
|
||||||
|
const { getList, getElTableExpose, delList, refresh } = tableMethods
|
||||||
|
|
||||||
|
const tableColumns = reactive<TableColumn[]>([
|
||||||
|
{
|
||||||
|
field: 'selection',
|
||||||
|
type: 'selection',
|
||||||
|
fixed: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'indexsetCode',
|
||||||
|
label: '指标集编码'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'beginDate',
|
||||||
|
label: '开始日期'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'endDate',
|
||||||
|
label: '结束日期'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'indexsetName',
|
||||||
|
label: '指标集名称'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'organCode',
|
||||||
|
label: '机构编码'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'frequency',
|
||||||
|
label: '频度'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'description',
|
||||||
|
label: '描述'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'indexsetType',
|
||||||
|
label: '指标集类型'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'modelCode',
|
||||||
|
label: '数据模型编码'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'createOrgan',
|
||||||
|
label: '创建机构'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'createUser',
|
||||||
|
label: '创建用户'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'action',
|
||||||
|
label: t('tableDemo.action'),
|
||||||
|
width: 160,
|
||||||
|
fixed: 'right',
|
||||||
|
slots: {
|
||||||
|
default: (data: any) => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<ElLink type="primary" underline={false} onClick={() => action(data.row, 'edit')}>
|
||||||
|
{t('tableDemo.edit')}
|
||||||
|
</ElLink>
|
||||||
|
<ElPopconfirm
|
||||||
|
title={t('common.delTableMsg')}
|
||||||
|
width={200}
|
||||||
|
v-slots={{
|
||||||
|
reference: () => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<ElLink type="primary" underline={false}>
|
||||||
|
{t('tableDemo.del')}
|
||||||
|
</ElLink>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
onConfirm={() => delData(data.row)}
|
||||||
|
></ElPopconfirm>
|
||||||
|
<ElLink type="primary" underline={false} onClick={() => action(data.row, 'detail')}>
|
||||||
|
{t('tableDemo.detail')}
|
||||||
|
</ElLink>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
].map(item => ({ minWidth: item.label ? getWidth(item.label) : 120, ...item }) as TableColumn))
|
||||||
|
|
||||||
|
const searchSchema = reactive<FormSchema[]>([
|
||||||
|
{
|
||||||
|
field: 'indexsetCode',
|
||||||
|
label: '指标集编码',
|
||||||
|
componentProps: {},
|
||||||
|
component: 'Input'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'indexsetName',
|
||||||
|
label: '指标集名称',
|
||||||
|
componentProps: {},
|
||||||
|
component: 'Input'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'frequency',
|
||||||
|
label: '频度',
|
||||||
|
componentProps: {},
|
||||||
|
component: 'Select'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'indexsetType',
|
||||||
|
label: '指标集类型',
|
||||||
|
componentProps: {},
|
||||||
|
component: 'Select'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'modelCode',
|
||||||
|
label: '数据模型编码',
|
||||||
|
componentProps: {},
|
||||||
|
component: 'Select'
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
|
const searchParams = ref({})
|
||||||
|
const setSearchParams = (data: any) => {
|
||||||
|
searchParams.value = data
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
|
||||||
|
const dialogVisible = ref(false)
|
||||||
|
const dialogTitle = ref('')
|
||||||
|
|
||||||
|
const currentRow = ref()
|
||||||
|
const actionType = ref('')
|
||||||
|
|
||||||
|
const writeRef = ref<ComponentRef<typeof Write>>()
|
||||||
|
|
||||||
|
/**单行查询**/
|
||||||
|
const action = async (row: TableData, type: string) => {
|
||||||
|
let detailLoading = ElLoading.service({
|
||||||
|
background: 'rgba(0, 0, 0, 0.7)'
|
||||||
|
})
|
||||||
|
const res = await queryRepIndexSetApi(row.indexsetCode, row.beginDate, row.endDate)
|
||||||
|
.catch(() => {})
|
||||||
|
.finally(() => {
|
||||||
|
detailLoading.close()
|
||||||
|
})
|
||||||
|
detailLoading.close()
|
||||||
|
if (res) {
|
||||||
|
const data = res.body.result
|
||||||
|
dialogTitle.value = t(type === 'edit' ? 'tableDemo.edit' : 'tableDemo.detail')
|
||||||
|
actionType.value = type
|
||||||
|
currentRow.value = data
|
||||||
|
dialogVisible.value = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const AddAction = () => {
|
||||||
|
dialogTitle.value = t('tableDemo.add')
|
||||||
|
currentRow.value = undefined
|
||||||
|
dialogVisible.value = true
|
||||||
|
actionType.value = 'add'
|
||||||
|
}
|
||||||
|
const saveLoading = ref(false)
|
||||||
|
|
||||||
|
/** 保存 **/
|
||||||
|
const save = async () => {
|
||||||
|
const write = unref(writeRef)
|
||||||
|
const formData = await write?.submit()
|
||||||
|
if (formData) {
|
||||||
|
saveLoading.value = true
|
||||||
|
const res = await saveRepIndexSetApi(formData)
|
||||||
|
.catch(() => {})
|
||||||
|
.finally(() => {
|
||||||
|
saveLoading.value = false
|
||||||
|
})
|
||||||
|
if (res) {
|
||||||
|
dialogVisible.value = false
|
||||||
|
currentPage.value = 1
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const delLoading = ref(false)
|
||||||
|
|
||||||
|
/** 批量删除 **/
|
||||||
|
const delDataBatch = async () => {
|
||||||
|
const elTableExpose = await getElTableExpose()
|
||||||
|
ids.value = elTableExpose?.getSelectionRows().map((v: TableData) => { v.indexsetCode, v.beginDate, v.endDate }) || []
|
||||||
|
delLoading.value = true
|
||||||
|
await delList(unref(ids).length).finally(() => {
|
||||||
|
delLoading.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 单行删除 */
|
||||||
|
const delData = async (row: TableData) => {
|
||||||
|
const res = await delRepIndexSetApi(row.indexsetCode, row.beginDate, row.endDate)
|
||||||
|
if (res) {
|
||||||
|
const { code, errMsg } = res.head
|
||||||
|
if (code === '0') {
|
||||||
|
ElMessage.success('删除成功!')
|
||||||
|
getList()
|
||||||
|
} else {
|
||||||
|
ElMessage.error(errMsg || '删除失败!')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const disabled = ref(true)
|
||||||
|
|
||||||
|
const onSelectionChange = (selection: TableData[]) => {
|
||||||
|
disabled.value = selection.length === 0
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 导出Excel */
|
||||||
|
const exportExcel = async () => {
|
||||||
|
const data = { ...unref(searchParams) }
|
||||||
|
await exportExcelApi(data)
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<ContentWrap>
|
||||||
|
<Search :schema="searchSchema" @reset="setSearchParams" @search="setSearchParams" />
|
||||||
|
|
||||||
|
<Table
|
||||||
|
:columns="tableColumns"
|
||||||
|
v-model:pageSize="pageSize"
|
||||||
|
v-model:currentPage="currentPage"
|
||||||
|
default-expand-all
|
||||||
|
:data="dataList"
|
||||||
|
:loading="loading"
|
||||||
|
:pagination="{
|
||||||
|
total
|
||||||
|
}"
|
||||||
|
@selection-change="onSelectionChange"
|
||||||
|
@register="tableRegister"
|
||||||
|
@refresh="refresh"
|
||||||
|
>
|
||||||
|
<template #buttons>
|
||||||
|
<ElButton type="primary" @click="AddAction">{{ t('tableDemo.add') }}</ElButton>
|
||||||
|
<Upload :url="importExcelApiUrl" :callback="getList"> <ElButton type="primary">导入</ElButton> </Upload>
|
||||||
|
<ElButton type="primary" @click="exportExcel()">导出</ElButton>
|
||||||
|
<ElButton :loading="delLoading" type="primary" :disabled="disabled" @click="delDataBatch()">
|
||||||
|
{{ t('tableDemo.del') }}
|
||||||
|
</ElButton>
|
||||||
|
</template>
|
||||||
|
</Table>
|
||||||
|
</ContentWrap>
|
||||||
|
|
||||||
|
<Dialog v-model="dialogVisible" :title="dialogTitle">
|
||||||
|
<Write
|
||||||
|
v-if="actionType !== 'detail'"
|
||||||
|
ref="writeRef"
|
||||||
|
:current-row="currentRow"
|
||||||
|
:action-type="actionType"
|
||||||
|
/>
|
||||||
|
<Detail v-if="actionType === 'detail'" :current-row="currentRow" />
|
||||||
|
<template #footer>
|
||||||
|
<ElButton v-if="actionType !== 'detail'" type="primary" :loading="saveLoading" @click="save">
|
||||||
|
{{ t('dialogDemo.save') }}
|
||||||
|
</ElButton>
|
||||||
|
<ElButton @click="dialogVisible = false">{{ t('dialogDemo.close') }}</ElButton>
|
||||||
|
</template>
|
||||||
|
</Dialog>
|
||||||
|
</template>
|
@ -0,0 +1,63 @@
|
|||||||
|
<script setup lang="tsx">
|
||||||
|
import { PropType, ref } from 'vue'
|
||||||
|
import { TableData } from '@/api/dataset/RepIndexSet/types'
|
||||||
|
import { Descriptions, DescriptionsSchema } from '@/components/Descriptions'
|
||||||
|
|
||||||
|
const detailSchema = ref<DescriptionsSchema[]>([
|
||||||
|
{
|
||||||
|
field: 'indexsetCode',
|
||||||
|
label: '指标集编码'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'beginDate',
|
||||||
|
label: '开始日期'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'endDate',
|
||||||
|
label: '结束日期'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'indexsetName',
|
||||||
|
label: '指标集名称'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'organCode',
|
||||||
|
label: '机构编码'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'frequency',
|
||||||
|
label: '频度'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'description',
|
||||||
|
label: '描述'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'indexsetType',
|
||||||
|
label: '指标集类型'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'modelCode',
|
||||||
|
label: '数据模型编码'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'createOrgan',
|
||||||
|
label: '创建机构'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'createUser',
|
||||||
|
label: '创建用户'
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
|
defineProps({
|
||||||
|
currentRow: {
|
||||||
|
type: Object as PropType<TableData>,
|
||||||
|
default: () => {}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Descriptions :schema="detailSchema" :data="currentRow || {}" />
|
||||||
|
</template>
|
@ -0,0 +1,151 @@
|
|||||||
|
<script setup lang="tsx">
|
||||||
|
import { Form, FormSchema } from '@/components/Form'
|
||||||
|
import { useForm } from '@/hooks/web/useForm'
|
||||||
|
import { PropType, reactive, watch } from 'vue'
|
||||||
|
import { useValidator } from '@/hooks/web/useValidator'
|
||||||
|
|
||||||
|
const { required } = useValidator()
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
currentRow: {
|
||||||
|
type: Object as PropType<any>,
|
||||||
|
default: () => null
|
||||||
|
},
|
||||||
|
actionType: {
|
||||||
|
type: String,
|
||||||
|
default: 'add'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const { formRegister, formMethods } = useForm()
|
||||||
|
const { setValues, getFormData, getElFormExpose } = formMethods
|
||||||
|
|
||||||
|
const formSchema = reactive<FormSchema[]>([
|
||||||
|
{
|
||||||
|
field: 'indexsetCode',
|
||||||
|
label: '指标集编码',
|
||||||
|
component: 'Input',
|
||||||
|
componentProps: {
|
||||||
|
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'beginDate',
|
||||||
|
label: '开始日期',
|
||||||
|
component: 'Input',
|
||||||
|
componentProps: {
|
||||||
|
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'endDate',
|
||||||
|
label: '结束日期',
|
||||||
|
component: 'Input',
|
||||||
|
componentProps: {
|
||||||
|
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'indexsetName',
|
||||||
|
label: '指标集名称',
|
||||||
|
component: 'Input',
|
||||||
|
componentProps: {
|
||||||
|
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'organCode',
|
||||||
|
label: '机构编码',
|
||||||
|
component: 'Input',
|
||||||
|
componentProps: {
|
||||||
|
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'frequency',
|
||||||
|
label: '频度',
|
||||||
|
component: 'Select',
|
||||||
|
componentProps: {
|
||||||
|
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'description',
|
||||||
|
label: '描述',
|
||||||
|
component: 'Input',
|
||||||
|
componentProps: {
|
||||||
|
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'indexsetType',
|
||||||
|
label: '指标集类型',
|
||||||
|
component: 'Select',
|
||||||
|
componentProps: {
|
||||||
|
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'modelCode',
|
||||||
|
label: '数据模型编码',
|
||||||
|
component: 'Select',
|
||||||
|
componentProps: {
|
||||||
|
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'createOrgan',
|
||||||
|
label: '创建机构',
|
||||||
|
component: 'Input',
|
||||||
|
componentProps: {
|
||||||
|
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'createUser',
|
||||||
|
label: '创建用户',
|
||||||
|
component: 'Input',
|
||||||
|
componentProps: {
|
||||||
|
|
||||||
|
},
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
|
const rules = reactive({
|
||||||
|
indexsetCode: [required()],
|
||||||
|
beginDate: [required()],
|
||||||
|
endDate: [required()],
|
||||||
|
})
|
||||||
|
|
||||||
|
const submit = async () => {
|
||||||
|
const elForm = await getElFormExpose()
|
||||||
|
const valid = await elForm?.validate().catch((err) => {
|
||||||
|
console.log(err)
|
||||||
|
})
|
||||||
|
if (valid) {
|
||||||
|
const formData = await getFormData()
|
||||||
|
return formData
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.currentRow,
|
||||||
|
(currentRow) => {
|
||||||
|
if (!currentRow) return
|
||||||
|
setValues(currentRow)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
deep: true,
|
||||||
|
immediate: true
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
submit
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Form :rules="rules" @register="formRegister" :schema="formSchema" />
|
||||||
|
</template>
|
||||||
|
|
@ -0,0 +1,295 @@
|
|||||||
|
<script setup lang="tsx">
|
||||||
|
import { reactive, ref, unref } from 'vue'
|
||||||
|
import {
|
||||||
|
getRepStoreParameterListApi,
|
||||||
|
saveRepStoreParameterApi,
|
||||||
|
delRepStoreParameterListApi,
|
||||||
|
delRepStoreParameterApi,
|
||||||
|
queryRepStoreParameterApi,
|
||||||
|
importExcelApiUrl,
|
||||||
|
exportExcelApi
|
||||||
|
} from '@/api/dataset/RepStoreParameter'
|
||||||
|
import { TableData } from '@/api/dataset/RepStoreParameter/types'
|
||||||
|
import { useTable } from '@/hooks/web/useTable'
|
||||||
|
import { useI18n } from '@/hooks/web/useI18n'
|
||||||
|
import { Table, TableColumn } from '@/components/Table'
|
||||||
|
import { ElButton, ElLink, ElLoading, ElPopconfirm, ElMessage } from 'element-plus'
|
||||||
|
import { Search } from '@/components/Search'
|
||||||
|
import { FormSchema } from '@/components/Form'
|
||||||
|
import { ContentWrap } from '@/components/ContentWrap'
|
||||||
|
import Write from './components/Write.vue'
|
||||||
|
import { Dialog } from '@/components/Dialog'
|
||||||
|
import { getWidth } from '@/utils';
|
||||||
|
import Detail from './components/Detail.vue'
|
||||||
|
import { Upload } from '@/components/Upload'
|
||||||
|
|
||||||
|
const { t } = useI18n()
|
||||||
|
|
||||||
|
const ids = ref<string[]>([])
|
||||||
|
|
||||||
|
const { tableRegister, tableState, tableMethods } = useTable({
|
||||||
|
fetchDataApi: async () => {
|
||||||
|
const { currentPage, pageSize } = tableState
|
||||||
|
const res = await getRepStoreParameterListApi({
|
||||||
|
pageIndex: unref(currentPage),
|
||||||
|
pageSize: unref(pageSize),
|
||||||
|
...unref(searchParams)
|
||||||
|
})
|
||||||
|
return {
|
||||||
|
list: res.body.list,
|
||||||
|
total: res.body.total
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fetchDelApi: async () => {
|
||||||
|
const res = await delRepStoreParameterListApi(unref(ids));
|
||||||
|
return !!res;
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const { loading, dataList, total, currentPage, pageSize } = tableState
|
||||||
|
const { getList, getElTableExpose, delList, refresh } = tableMethods
|
||||||
|
|
||||||
|
const tableColumns = reactive<TableColumn[]>([
|
||||||
|
{
|
||||||
|
field: 'selection',
|
||||||
|
type: 'selection',
|
||||||
|
fixed: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'modelCode',
|
||||||
|
label: '模型编码'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'ruleId',
|
||||||
|
label: '规则编码'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'field',
|
||||||
|
label: '字段'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'name',
|
||||||
|
label: '名称'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'parameters',
|
||||||
|
label: '默认值'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'format',
|
||||||
|
label: '参数格式化'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'paramType',
|
||||||
|
label: '参数类型'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'action',
|
||||||
|
label: t('tableDemo.action'),
|
||||||
|
width: 160,
|
||||||
|
fixed: 'right',
|
||||||
|
slots: {
|
||||||
|
default: (data: any) => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<ElLink type="primary" underline={false} onClick={() => action(data.row, 'edit')}>
|
||||||
|
{t('tableDemo.edit')}
|
||||||
|
</ElLink>
|
||||||
|
<ElPopconfirm
|
||||||
|
title={t('common.delTableMsg')}
|
||||||
|
width={200}
|
||||||
|
v-slots={{
|
||||||
|
reference: () => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<ElLink type="primary" underline={false}>
|
||||||
|
{t('tableDemo.del')}
|
||||||
|
</ElLink>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
onConfirm={() => delData(data.row)}
|
||||||
|
></ElPopconfirm>
|
||||||
|
<ElLink type="primary" underline={false} onClick={() => action(data.row, 'detail')}>
|
||||||
|
{t('tableDemo.detail')}
|
||||||
|
</ElLink>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
].map(item => ({ minWidth: item.label ? getWidth(item.label) : 120, ...item }) as TableColumn))
|
||||||
|
|
||||||
|
const searchSchema = reactive<FormSchema[]>([
|
||||||
|
{
|
||||||
|
field: 'modelCode',
|
||||||
|
label: '模型编码',
|
||||||
|
componentProps: {},
|
||||||
|
component: 'Input'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'ruleId',
|
||||||
|
label: '规则编码',
|
||||||
|
componentProps: {},
|
||||||
|
component: 'Input'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'name',
|
||||||
|
label: '名称',
|
||||||
|
componentProps: {},
|
||||||
|
component: 'Input'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'paramType',
|
||||||
|
label: '参数类型',
|
||||||
|
componentProps: {},
|
||||||
|
component: 'Select'
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
|
const searchParams = ref({})
|
||||||
|
const setSearchParams = (data: any) => {
|
||||||
|
searchParams.value = data
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
|
||||||
|
const dialogVisible = ref(false)
|
||||||
|
const dialogTitle = ref('')
|
||||||
|
|
||||||
|
const currentRow = ref()
|
||||||
|
const actionType = ref('')
|
||||||
|
|
||||||
|
const writeRef = ref<ComponentRef<typeof Write>>()
|
||||||
|
|
||||||
|
/**单行查询**/
|
||||||
|
const action = async (row: TableData, type: string) => {
|
||||||
|
let detailLoading = ElLoading.service({
|
||||||
|
background: 'rgba(0, 0, 0, 0.7)'
|
||||||
|
})
|
||||||
|
const res = await queryRepStoreParameterApi(row.modelCode, row.ruleId, row.field)
|
||||||
|
.catch(() => {})
|
||||||
|
.finally(() => {
|
||||||
|
detailLoading.close()
|
||||||
|
})
|
||||||
|
detailLoading.close()
|
||||||
|
if (res) {
|
||||||
|
const data = res.body.result
|
||||||
|
dialogTitle.value = t(type === 'edit' ? 'tableDemo.edit' : 'tableDemo.detail')
|
||||||
|
actionType.value = type
|
||||||
|
currentRow.value = data
|
||||||
|
dialogVisible.value = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const AddAction = () => {
|
||||||
|
dialogTitle.value = t('tableDemo.add')
|
||||||
|
currentRow.value = undefined
|
||||||
|
dialogVisible.value = true
|
||||||
|
actionType.value = 'add'
|
||||||
|
}
|
||||||
|
const saveLoading = ref(false)
|
||||||
|
|
||||||
|
/** 保存 **/
|
||||||
|
const save = async () => {
|
||||||
|
const write = unref(writeRef)
|
||||||
|
const formData = await write?.submit()
|
||||||
|
if (formData) {
|
||||||
|
saveLoading.value = true
|
||||||
|
const res = await saveRepStoreParameterApi(formData)
|
||||||
|
.catch(() => {})
|
||||||
|
.finally(() => {
|
||||||
|
saveLoading.value = false
|
||||||
|
})
|
||||||
|
if (res) {
|
||||||
|
dialogVisible.value = false
|
||||||
|
currentPage.value = 1
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const delLoading = ref(false)
|
||||||
|
|
||||||
|
/** 批量删除 **/
|
||||||
|
const delDataBatch = async () => {
|
||||||
|
const elTableExpose = await getElTableExpose()
|
||||||
|
ids.value = elTableExpose?.getSelectionRows().map((v: TableData) => { v.modelCode, v.ruleId, v.field }) || []
|
||||||
|
delLoading.value = true
|
||||||
|
await delList(unref(ids).length).finally(() => {
|
||||||
|
delLoading.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 单行删除 */
|
||||||
|
const delData = async (row: TableData) => {
|
||||||
|
const res = await delRepStoreParameterApi(row.modelCode, row.ruleId, row.field)
|
||||||
|
if (res) {
|
||||||
|
const { code, errMsg } = res.head
|
||||||
|
if (code === '0') {
|
||||||
|
ElMessage.success('删除成功!')
|
||||||
|
getList()
|
||||||
|
} else {
|
||||||
|
ElMessage.error(errMsg || '删除失败!')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const disabled = ref(true)
|
||||||
|
|
||||||
|
const onSelectionChange = (selection: TableData[]) => {
|
||||||
|
disabled.value = selection.length === 0
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 导出Excel */
|
||||||
|
const exportExcel = async () => {
|
||||||
|
const data = { ...unref(searchParams) }
|
||||||
|
await exportExcelApi(data)
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<ContentWrap>
|
||||||
|
<Search :schema="searchSchema" @reset="setSearchParams" @search="setSearchParams" />
|
||||||
|
|
||||||
|
<Table
|
||||||
|
:columns="tableColumns"
|
||||||
|
v-model:pageSize="pageSize"
|
||||||
|
v-model:currentPage="currentPage"
|
||||||
|
default-expand-all
|
||||||
|
:data="dataList"
|
||||||
|
:loading="loading"
|
||||||
|
:pagination="{
|
||||||
|
total
|
||||||
|
}"
|
||||||
|
@selection-change="onSelectionChange"
|
||||||
|
@register="tableRegister"
|
||||||
|
@refresh="refresh"
|
||||||
|
>
|
||||||
|
<template #buttons>
|
||||||
|
<ElButton type="primary" @click="AddAction">{{ t('tableDemo.add') }}</ElButton>
|
||||||
|
<Upload :url="importExcelApiUrl" :callback="getList"> <ElButton type="primary">导入</ElButton> </Upload>
|
||||||
|
<ElButton type="primary" @click="exportExcel()">导出</ElButton>
|
||||||
|
<ElButton :loading="delLoading" type="primary" :disabled="disabled" @click="delDataBatch()">
|
||||||
|
{{ t('tableDemo.del') }}
|
||||||
|
</ElButton>
|
||||||
|
</template>
|
||||||
|
</Table>
|
||||||
|
</ContentWrap>
|
||||||
|
|
||||||
|
<Dialog v-model="dialogVisible" :title="dialogTitle">
|
||||||
|
<Write
|
||||||
|
v-if="actionType !== 'detail'"
|
||||||
|
ref="writeRef"
|
||||||
|
:current-row="currentRow"
|
||||||
|
:action-type="actionType"
|
||||||
|
/>
|
||||||
|
<Detail v-if="actionType === 'detail'" :current-row="currentRow" />
|
||||||
|
<template #footer>
|
||||||
|
<ElButton v-if="actionType !== 'detail'" type="primary" :loading="saveLoading" @click="save">
|
||||||
|
{{ t('dialogDemo.save') }}
|
||||||
|
</ElButton>
|
||||||
|
<ElButton @click="dialogVisible = false">{{ t('dialogDemo.close') }}</ElButton>
|
||||||
|
</template>
|
||||||
|
</Dialog>
|
||||||
|
</template>
|
@ -0,0 +1,47 @@
|
|||||||
|
<script setup lang="tsx">
|
||||||
|
import { PropType, ref } from 'vue'
|
||||||
|
import { TableData } from '@/api/dataset/RepStoreParameter/types'
|
||||||
|
import { Descriptions, DescriptionsSchema } from '@/components/Descriptions'
|
||||||
|
|
||||||
|
const detailSchema = ref<DescriptionsSchema[]>([
|
||||||
|
{
|
||||||
|
field: 'modelCode',
|
||||||
|
label: '模型编码'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'ruleId',
|
||||||
|
label: '规则编码'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'field',
|
||||||
|
label: '字段'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'name',
|
||||||
|
label: '名称'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'parameters',
|
||||||
|
label: '默认值'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'format',
|
||||||
|
label: '参数格式化'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'paramType',
|
||||||
|
label: '参数类型'
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
|
defineProps({
|
||||||
|
currentRow: {
|
||||||
|
type: Object as PropType<TableData>,
|
||||||
|
default: () => {}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Descriptions :schema="detailSchema" :data="currentRow || {}" />
|
||||||
|
</template>
|
@ -0,0 +1,119 @@
|
|||||||
|
<script setup lang="tsx">
|
||||||
|
import { Form, FormSchema } from '@/components/Form'
|
||||||
|
import { useForm } from '@/hooks/web/useForm'
|
||||||
|
import { PropType, reactive, watch } from 'vue'
|
||||||
|
import { useValidator } from '@/hooks/web/useValidator'
|
||||||
|
|
||||||
|
const { required } = useValidator()
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
currentRow: {
|
||||||
|
type: Object as PropType<any>,
|
||||||
|
default: () => null
|
||||||
|
},
|
||||||
|
actionType: {
|
||||||
|
type: String,
|
||||||
|
default: 'add'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const { formRegister, formMethods } = useForm()
|
||||||
|
const { setValues, getFormData, getElFormExpose } = formMethods
|
||||||
|
|
||||||
|
const formSchema = reactive<FormSchema[]>([
|
||||||
|
{
|
||||||
|
field: 'modelCode',
|
||||||
|
label: '模型编码',
|
||||||
|
component: 'Input',
|
||||||
|
componentProps: {
|
||||||
|
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'ruleId',
|
||||||
|
label: '规则编码',
|
||||||
|
component: 'Input',
|
||||||
|
componentProps: {
|
||||||
|
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'field',
|
||||||
|
label: '字段',
|
||||||
|
component: 'Input',
|
||||||
|
componentProps: {
|
||||||
|
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'name',
|
||||||
|
label: '名称',
|
||||||
|
component: 'Input',
|
||||||
|
componentProps: {
|
||||||
|
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'parameters',
|
||||||
|
label: '默认值',
|
||||||
|
component: 'Input',
|
||||||
|
componentProps: {
|
||||||
|
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'format',
|
||||||
|
label: '参数格式化',
|
||||||
|
component: 'Input',
|
||||||
|
componentProps: {
|
||||||
|
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'paramType',
|
||||||
|
label: '参数类型',
|
||||||
|
component: 'Select',
|
||||||
|
componentProps: {
|
||||||
|
|
||||||
|
},
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
|
const rules = reactive({
|
||||||
|
modelCode: [required()],
|
||||||
|
ruleId: [required()],
|
||||||
|
field: [required()],
|
||||||
|
})
|
||||||
|
|
||||||
|
const submit = async () => {
|
||||||
|
const elForm = await getElFormExpose()
|
||||||
|
const valid = await elForm?.validate().catch((err) => {
|
||||||
|
console.log(err)
|
||||||
|
})
|
||||||
|
if (valid) {
|
||||||
|
const formData = await getFormData()
|
||||||
|
return formData
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.currentRow,
|
||||||
|
(currentRow) => {
|
||||||
|
if (!currentRow) return
|
||||||
|
setValues(currentRow)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
deep: true,
|
||||||
|
immediate: true
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
submit
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Form :rules="rules" @register="formRegister" :schema="formSchema" />
|
||||||
|
</template>
|
||||||
|
|
Loading…
Reference in new issue