Commit a8ef4795 authored by zxw's avatar zxw

质量参数页面

parent ce2f8577
<template>
<BasicModal min-height="100" width="30%" v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit">
<div class="modalBody">
<div class="title">导入文件选择</div>
<a-button style="margin-right: 10px" >下载模板</a-button>
<a-button style="margin-right: 10px" type="primary" >选择</a-button>
<div style="width: 200px">只能导入单个Excel文件,且单次导入不超过100000条数据</div>
</div>
<div>
<span style="padding-right: 20px">敏感类型重名</span>
<RadioGroup v-model:value="value" name="radioGroup">
<Radio value="1">全部放弃</Radio>
<Radio value="2">全部替换</Radio>
<Radio value="3">自动重命名</Radio>
</RadioGroup>
</div>
</BasicModal>
</template>
<script lang="ts" setup>
import {Radio,RadioGroup} from 'ant-design-vue'
import {ref, computed, unref, reactive} from 'vue';
import { BasicModal, useModalInner } from '@/components/Modal';
import { BasicForm, useForm } from '@/components/Form';
// import { formSchema } from './gradingResults.data';
import Icon from '@/components/Icon/Icon.vue';
import { useMessage } from '@/hooks/web/useMessage';
defineOptions({ name: 'AccountModal' });
const emit = defineEmits(['success', 'register']);
const { createMessage } = useMessage();
const isUpdate = ref(true);
const rowId = ref('');
const value = ref<string>('1');
//获取接口数据并放在下拉框里(这里是打开了一个弹框)
//初始化表单
const [registerForm, { setFieldsValue, updateSchema, resetFields, validate }] = useForm({
labelWidth: 100,
baseColProps: { lg: 24, md: 24 },
// schemas: formSchema,
showActionButtonGroup: false,
actionColOptions: {
span: 23,
},
});
//初始化弹框
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
resetFields();
setModalProps({ confirmLoading: false });
isUpdate.value = !!data?.isUpdate;
if (unref(isUpdate)) {
// 通过id获取行详情信息
// 塞值
setFieldsValue({
...data.record,
});
}
});
const getTitle = computed(() => ( '分类分级导入'));
async function handleSubmit() {
try {
const values = await validate();
setModalProps({ confirmLoading: true });
// TODO custom api
closeModal();
emit('success', { isUpdate: unref(isUpdate), values: { ...values, id: rowId.value } });
} finally {
setModalProps({ confirmLoading: false });
}
}
</script>
<style lang="scss" scoped>
.modalBody{
display: flex;
align-items: center;
.title{
padding-right: 15px;
}
}
</style>
<template>
<PageWrapper dense contentFullHeight fixedHeight contentClass="flex">
<BasicTable @register="registerTable" :searchInfo="searchInfo" :rowSelection="rowSelection">
<template #toolbar>
<a-button type="primary" @click="handleImport">导入</a-button>
<a-button :disabled="getRowSelection().selectedRowKeys <=0" type="primary" @click="handleExport">导出</a-button>
<a-button type="primary" @click="handleCreate">新建</a-button>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'action'">
<TableAction
:actions="[
{
icon: 'clarity:note-edit-line',
label: '编辑',
onClick: handleEdit.bind(null, record),
},
{
icon: 'ant-design:delete-outlined',
color: 'error',
label: '删除',
popConfirm: {
title: '是否确认删除',
placement: 'left',
confirm: handleDelete.bind(null, record),
},
},
]"
/>
</template>
</template>
</BasicTable>
<sensitiveTypeModal @register="registerModal" @success="handleSuccess" />
<importModal @register="registerImport" @success="handleImportSuccess" />
</PageWrapper>
</template>
<script lang="ts" setup>
import { reactive, onMounted,ref } from 'vue';
import { BasicTable, useTable, TableAction } from '@/components/Table';
import { PageWrapper } from '@/components/Page';
import { useMessage } from '@/hooks/web/useMessage';
import { useModal } from '@/components/Modal';
import sensitiveTypeModal from './parameterTypeModal.vue';
import importModal from './importModal.vue';
import { columns, searchFormSchema } from './parameterType.data';
import {tableList} from "@/views/dataQuality/dataSheet/rule/parameter/mock";
import { useRoute, onBeforeRouteLeave } from 'vue-router';
import { router } from '@/router';
defineOptions({ name: 'safetyLevelManage' });
const { createMessage,createConfirm } = useMessage();
const route = useRoute();
const [registerModal, { openModal }] = useModal();
const [registerImport, { openModal: openImportModal }] = useModal();
const searchInfo = reactive<Recordable>({});
const [registerTable, { reload, updateTableDataRecord, getSearchInfo, getForm,getRowSelection }] = useTable({
showIndexColumn:false,
title: '质量参数',
api: async (params) => {
const response = {
pageNu: "1",
pageSize: "10",
pages: "1",
total: tableList.length,
code:'',
message:'',
data: tableList,
};
return { ...response};
},
rowKey: 'businessId',
rowSelection: true,
columns,
formConfig: {
labelWidth: 120,
schemas: searchFormSchema,
autoSubmitOnEnter: true,
resetFunc: () => {
searchInfo.deptId = '';
},
},
useSearchForm: true,
showTableSetting: false,
bordered: true,
handleSearchInfoFn(info) {
console.log('handleSearchInfoFn', info);
return info;
},
actionColumn: {
width: 120,
title: '操作',
dataIndex: 'action',
// slots: { customRender: 'action' },
},
});
function handleImport() {
openImportModal(true, {
});
}
/** 新增按钮*/
function handleCreate() {
openModal(true, {
isUpdate: false,
});
}
/** 编辑按钮*/
function handleEdit(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
});
}
/** 重置密码弹窗确定按钮*/
/** 删除按钮*/
function handleDelete(record: Recordable) {
const rowSelection = getRowSelection().selectedRowKeys;
console.log('11111111111',rowSelection);
createMessage.success('删除成功!');
reload();
}
/** 新增/编辑成功*/
function handleSuccess({ isUpdate, values }) {
if (isUpdate) {
// 演示不刷新表格直接更新内部数据。
// 注意:updateTableDataRecord要求表格的rowKey属性为string并且存在于每一行的record的keys中
const result = updateTableDataRecord(values.id, values);
console.log(result);
reload();
} else {
reload();
}
}
onMounted(() => {
});
</script>
export const tableList: any[] = [
{
"name" : "参数测试1",
businessId: 309,
"describe" : "说明文档",
"type" : "数值类",
"ParameterValues" : "12",
},
]
import { getAllRoleList } from '@/api/system/role/role';
import { BasicColumn, FormSchema } from '@/components/Table';
import { h } from 'vue';
import { Switch } from 'ant-design-vue';
import { useMessage } from '@/hooks/web/useMessage';
import { changeFlagApi } from '@/api/system/user/user';
// 引入开关组件
type CheckedType = boolean | string | number;
/** 列表筛选项*/
export const searchFormSchema: FormSchema[] = [
{
field: 'name',
label: '',
icon: 'clarity:note-edit-line',
icon: 'ant-design:file-search-outlined',
component: 'Input',
colProps: { span: 4 },
componentProps: {
placeholder: '搜索关键字',
},
},
];
/** 列表展示字段*/
export const columns: BasicColumn[] = [
{
title: '参数名称',
dataIndex: 'name',
width: 120,
},
{
title: '参数说明',
dataIndex: 'describe',
width: 120,
},
{
title: '参数类型',
dataIndex: 'type',
width: 120,
},
{
title: '参数值',
dataIndex: 'ParameterValues',
width: 140,
},
];
/** 新增编辑表单字段*/
export const formSchema: any[] = [
{
field: 'name',
label: '名称',
component: 'Input',
rules: [
{
required: true,
message: '请输入名称',
},
],
},
{
field: 'describe',
component: 'InputTextArea',
label: '描述',
componentProps: {
placeholder: '请输入描述',
rows: 4,
},
},
{
field: 'sort',
label: '最低安全分级',
component: 'Select',
componentProps: {
options: [
{ label: 'G1', value: 'G1' },
{ label: 'G2', value: 'G2' },
{ label: 'G3', value: 'G3' },
],
},
rules: [
{
required: true,
message: '请选择推荐保护动作',
},
],
},
{
field: 'protectAction',
label: '推荐脱敏算法',
component: 'Select',
componentProps: {
options: [
{ label: 'BlockFront', value: 'BlockFront' },
{ label: 'Delete', value: 'Delete' },
{ label: 'Mask', value: 'Mask' },
{ label: 'Base64', value: 'Base64' },
],
},
rules: [
{
required: true,
message: '请选择推荐保护动作',
},
],
},
{
field: 'params',
label: '算法参数',
component: 'Input',
},
]
<template>
<BasicModal width="40%" v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit">
<BasicForm @register="registerForm" />
</BasicModal>
</template>
<script lang="ts" setup>
import {ref, computed, unref, reactive} from 'vue';
import { BasicModal, useModalInner } from '@/components/Modal';
import { BasicForm, useForm } from '@/components/Form';
import { formSchema } from './parameterType.data';
import { useMessage } from '@/hooks/web/useMessage';
defineOptions({ name: 'AccountModal' });
const emit = defineEmits(['success', 'register']);
const { createMessage } = useMessage();
const isUpdate = ref(true);
const rowId = ref('');
//获取接口数据并放在下拉框里(这里是打开了一个弹框)
//初始化表单
const [registerForm, { setFieldsValue, updateSchema, resetFields, validate }] = useForm({
labelWidth: 100,
baseColProps: { lg: 24, md: 24 },
schemas: formSchema,
showActionButtonGroup: false,
actionColOptions: {
span: 23,
},
});
//初始化弹框
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
resetFields();
setModalProps({ confirmLoading: false });
isUpdate.value = !!data?.isUpdate;
if (unref(isUpdate)) {
// 通过id获取行详情信息
// 塞值
setFieldsValue({
...data.record,
});
}
});
const getTitle = computed(() => (!unref(isUpdate) ? '新建敏感类型' : '编辑敏感类型'));
async function handleSubmit() {
try {
const values = await validate();
setModalProps({ confirmLoading: true });
// TODO custom api
closeModal();
emit('success', { isUpdate: unref(isUpdate), values: { ...values, id: rowId.value } });
} finally {
setModalProps({ confirmLoading: false });
}
}
</script>
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