Commit 0a141e52 authored by 曹泽华's avatar 曹泽华

数仓开发 策略指标

parent 1262279f
...@@ -13,7 +13,9 @@ ...@@ -13,7 +13,9 @@
style="width: 150px; margin-left: 10px" style="width: 150px; margin-left: 10px"
:options="typeOptions" :options="typeOptions"
/> />
<a-button type="link"><PlusOutlined style="color: #9396a4" /></a-button> <a-button type="link" @click="handleAdd"
><PlusOutlined style="color: #9396a4"
/></a-button>
</div> </div>
</template> </template>
<template #strategicName="{ text, record }"> <template #strategicName="{ text, record }">
...@@ -32,13 +34,23 @@ ...@@ -32,13 +34,23 @@
<!-- ><PlusOutlined style="color: #9396a4"--> <!-- ><PlusOutlined style="color: #9396a4"-->
<!-- /></a-button>--> <!-- /></a-button>-->
<div class="w-3/4"> <div class="w-3/4">
<div v-if="titleName !== null" style="display: flex; justify-content: space-between"> <div v-if="titleType !== null" style="display: flex; justify-content: space-between">
<div style="font-size: 16px; font-weight: 650; margin: 0 0 20px 20px">{{ <div style="font-size: 16px; font-weight: 650; margin: 0 0 20px 20px">{{
titleName titleName
}}</div> }}</div>
<div><a-button type="primary" @click="handleSubmit">保存</a-button></div> <div>
<a-button type="primary" @click="handleDelete">删除</a-button>
<a-button type="primary" @click="handleSubmit">保存</a-button>
</div>
</div> </div>
<BasicForm v-show="titleName === '一致性检查默认策略'" @register="registerCheck"> <div v-if="isAdd">
<div style="text-align: right">
<a-button type="primary" @click="handleSubmit">保存</a-button>
</div>
<BasicForm @register="registerAdd" />
</div>
<BasicForm v-show="titleType === '一致性检查策略“'" @register="registerCheck">
<template #strategicType="{ field, model }"> <template #strategicType="{ field, model }">
<Select v-model:value="model[field]" :options="typeOptions" /> <Select v-model:value="model[field]" :options="typeOptions" />
<Alert <Alert
...@@ -56,13 +68,13 @@ ...@@ -56,13 +68,13 @@
</template> </template>
</BasicForm> </BasicForm>
<BasicForm <BasicForm
v-show="titleName !== null && titleName !== '一致性检查默认策略'" v-show="titleType !== null && titleType !== '一致性检查策略'"
@register="registerForm" @register="registerForm"
> >
<template #strategicType="{ field, model }"> <template #strategicType="{ field, model }">
<div <div
v-if="titleName === 'DB-DB源端DDL处理默认策略'" v-if="titleType === 'DB-DB源端DDL处理策略'"
v-show="titleName === 'DB-DB源端DDL处理默认策略'" v-show="titleType === 'DB-DB源端DDL处理策略'"
> >
<Select v-model:value="model[field]" :options="typeOptions" /> <Select v-model:value="model[field]" :options="typeOptions" />
<Alert <Alert
...@@ -73,8 +85,8 @@ ...@@ -73,8 +85,8 @@
/> />
</div> </div>
<div <div
v-if="titleName === 'DB-Kafka源端DDL处理默认策略'" v-if="titleType === 'DB-Kafka源端DDL处理策略'"
v-show="titleName === 'DB-Kafka源端DDL处理默认策略'" v-show="titleType === 'DB-Kafka源端DDL处理策略'"
> >
<Select v-model:value="model[field]" :options="typeOptions" /> <Select v-model:value="model[field]" :options="typeOptions" />
<Alert <Alert
...@@ -84,10 +96,7 @@ ...@@ -84,10 +96,7 @@
message="含义:源端表对象进行DDL,任务应对策略配置。" message="含义:源端表对象进行DDL,任务应对策略配置。"
/> />
</div> </div>
<div <div v-if="titleType === '系统异常策略'" v-show="titleType === '系统异常策略'">
v-if="titleName === '系统异常默认策略'"
v-show="titleName === '系统异常默认策略'"
>
<Select v-model:value="model[field]" :options="typeOptions" /> <Select v-model:value="model[field]" :options="typeOptions" />
<Alert <Alert
style="margin-top: 20px" style="margin-top: 20px"
...@@ -97,10 +106,7 @@ ...@@ -97,10 +106,7 @@
/> />
<SystemStrategic /> <SystemStrategic />
</div> </div>
<div <div v-if="titleType === '数据异常策略'" v-show="titleType === '数据异常策略'">
v-if="titleName === '目标端数据异常默认策略'"
v-show="titleName === '目标端数据异常默认策略'"
>
<Select v-model:value="model[field]" :options="typeOptions" /> <Select v-model:value="model[field]" :options="typeOptions" />
<Alert <Alert
style="margin-top: 20px" style="margin-top: 20px"
...@@ -116,10 +122,7 @@ ...@@ -116,10 +122,7 @@
/> />
<ErrorStrategic /> <ErrorStrategic />
</div> </div>
<div <div v-if="titleType === '数据积压策略'" v-show="titleType === '数据积压策略'">
v-if="titleName === '数据积压默认策略'"
v-show="titleName === '数据积压默认策略'"
>
<Select v-model:value="model[field]" :options="typeOptions" /> <Select v-model:value="model[field]" :options="typeOptions" />
<Alert <Alert
style="margin-top: 20px" style="margin-top: 20px"
...@@ -170,6 +173,7 @@ ...@@ -170,6 +173,7 @@
errorFormSchema, errorFormSchema,
backlogFormSchema, backlogFormSchema,
checkFormSchema, checkFormSchema,
addFormSchema,
} from './strategic.data'; } from './strategic.data';
import { useForm } from '@/components/Form'; import { useForm } from '@/components/Form';
import SystemStrategic from '@/views/realTimeSync/strategicIndicators/systemStrategic.vue'; import SystemStrategic from '@/views/realTimeSync/strategicIndicators/systemStrategic.vue';
...@@ -179,6 +183,7 @@ ...@@ -179,6 +183,7 @@
const searchInfo = reactive<Recordable>({}); const searchInfo = reactive<Recordable>({});
const tabsKey = ref('1'); const tabsKey = ref('1');
const isAdd = ref(false);
const typeOptions = [ const typeOptions = [
{ {
...@@ -214,6 +219,24 @@ ...@@ -214,6 +219,24 @@
span: 24, span: 24,
}, },
}); });
const [
registerAdd,
{
setFieldsValue: addsetFieldsValue,
updateSchema: addupdateSchema,
resetSchema: addresetSchema,
resetFields: addresetFields,
validate: addvalidate,
},
] = useForm({
labelWidth: 150,
schemas: addFormSchema,
showActionButtonGroup: false,
actionColOptions: {
span: 24,
},
});
const [registerCheck, { setFieldsValue: checkSetFieldsValue, updateSchema: checkUpdateSchema }] = const [registerCheck, { setFieldsValue: checkSetFieldsValue, updateSchema: checkUpdateSchema }] =
useForm({ useForm({
labelWidth: 150, labelWidth: 150,
...@@ -236,6 +259,7 @@ ...@@ -236,6 +259,7 @@
getRowSelection, getRowSelection,
setSelectedRows, setSelectedRows,
clearSelectedRowKeys, clearSelectedRowKeys,
setSelectedRowKeys,
}, },
] = useTable({ ] = useTable({
title: '', title: '',
...@@ -262,12 +286,17 @@ ...@@ -262,12 +286,17 @@
autoSubmitOnEnter: true, autoSubmitOnEnter: true,
showActionButtonGroup: false, showActionButtonGroup: false,
}, },
rowSelection: {
type: 'radio',
onChange: handleSelect,
},
clickToRowSelect: true,
useSearchForm: false, useSearchForm: false,
striped: false, striped: false,
showTableSetting: false, showTableSetting: false,
bordered: false, bordered: false,
pagination: false, pagination: false,
rowSelection: { onSelect: handleSelect }, // rowSelection: { onSelect: handleSelect },
handleSearchInfoFn(info) { handleSearchInfoFn(info) {
return info; return info;
}, },
...@@ -279,9 +308,14 @@ ...@@ -279,9 +308,14 @@
} as BasicTableProps); } as BasicTableProps);
function handleRow(record) { function handleRow(record) {
titleName.value = record.strategicName; handleab();
const index = TreeSystem.findIndex((item) => item.strategicId === record.strategicId);
if (index !== -1) {
titleName.value = TreeSystem[index].strategicName;
titleType.value = TreeSystem[index].strategicType;
}
console.log('record', record); console.log('record', record);
setSelectedRows([{ strategicId: record.strategicId }]); // setSelectedRows({ strategicId: record.strategicId });、
if (record.strategicId === 101) { if (record.strategicId === 101) {
console.log('被调用1'); console.log('被调用1');
resetSchema([...backlogFormSchema]); resetSchema([...backlogFormSchema]);
...@@ -304,22 +338,37 @@ ...@@ -304,22 +338,37 @@
} }
} }
const titleName = ref(null); const titleName = ref(null);
const titleType = ref(null);
function handleSelect(record) { function handleSelect(record) {
console.log('record', record); console.log('record', record);
titleName.value = record.strategicName; // nextTick(() => {
nextTick(() => { // setSelectedRows({ strategicId: record.strategicId });
setSelectedRows([{ strategicId: record.strategicId }]); // });
}); handleRow({ strategicId: record[0] });
console.log('getRowSelection', getRowSelection()); console.log('getRowSelection', getRowSelection());
} }
onMounted(() => {}); onMounted(() => {});
function handleAdd() {} function handleAdd() {
titleType.value = null;
isAdd.value = true;
}
function handleab() {
isAdd.value = false;
}
function handleSubmit() {} function handleSubmit() {}
function handleDelete() {}
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.hover1 { .hover1 {
cursor: pointer; cursor: pointer;
} }
.select-class {
background-color: #e0f1ff;
}
::v-deep .ant-table-cell {
padding: 0;
}
</style> </style>
...@@ -573,3 +573,39 @@ export const clearFormSchema: FormSchema[] = [ ...@@ -573,3 +573,39 @@ export const clearFormSchema: FormSchema[] = [
colProps: { lg: 24, md: 24 }, colProps: { lg: 24, md: 24 },
}, },
]; ];
export const addFormSchema: FormSchema[] = [
{
field: 'strategicName',
label: '策略名称',
component: 'Input',
colProps: { lg: 13, md: 13 },
required: true,
},
{
field: 'description',
label: '描述',
component: 'InputTextArea',
componentProps: {
rows: 4,
},
colProps: { lg: 13, md: 13 },
},
{
field: 'strategicType',
label: '策略类型',
component: 'Select',
componentProps: {
placeholder: '策略类型',
options: [
{ label: 'DB-DB源端DDL处理策略', value: 'DB-DB源端DDL处理策略' },
{ label: 'DB-Kafka源端DDL处理策略', value: 'DB-Kafka源端DDL处理策略' },
{ label: '系统异常处理策略', value: '系统异常处理策略' },
{ label: '异常数据处理策略', value: '异常数据处理策略' },
{ label: '数据积压策略', value: '数据积压策略' },
{ label: '—致性检查策略', value: '致性检查策略' },
],
},
colProps: { lg: 13, md: 13 },
},
];
...@@ -12,7 +12,7 @@ export const TreeSystem: any[] = [ ...@@ -12,7 +12,7 @@ export const TreeSystem: any[] = [
{ {
strategicId: 103, strategicId: 103,
strategicName: 'DB-DB源端DDL处理默认策略', strategicName: 'DB-DB源端DDL处理默认策略',
strategicType: 'DB-DB源DDL处理策略', strategicType: 'DB-DB源DDL处理策略',
}, },
{ {
strategicId: 104, strategicId: 104,
...@@ -22,7 +22,7 @@ export const TreeSystem: any[] = [ ...@@ -22,7 +22,7 @@ export const TreeSystem: any[] = [
{ {
strategicId: 105, strategicId: 105,
strategicName: '一致性检查默认策略', strategicName: '一致性检查默认策略',
strategicType: '致性检查策略', strategicType: '致性检查策略',
}, },
{ {
strategicId: 106, strategicId: 106,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment