提交 b9db5289 authored 作者: kxjia's avatar kxjia

首页配置

上级 d3c2cf30
<template>
<div>
<div style="height: 100%;">
<!--引用表格-->
<BasicTable @register="registerTable" @edit-end="handleEditEnd" @edit-cancel="handleEditCancel" :beforeEditSubmit="beforeEditSubmit">
<BasicTable @register="registerTable"
@edit-end="handleEditEnd"
@edit-cancel="handleEditCancel"
:beforeEditSubmit="beforeEditSubmit"
style="height:100%;"
>
<!--插槽:table标题-->
<template #tableTitle>
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
......@@ -16,6 +21,8 @@
</BasicTable>
<!-- 表单区域 -->
<PageTitleconfigModal @register="registerModal" @success="handleSuccess"></PageTitleconfigModal>
<!-- 关联指标弹窗 -->
<TplItemModal @register="registerTplItemModal" style="height: 90%;"></TplItemModal>
</div>
</template>
......@@ -25,6 +32,7 @@
import {useModal} from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage'
import PageTitleconfigModal from './components/PageTitleconfigModal.vue'
import TplItemModal from './components/TplItemModal.vue'
import {columns, searchFormSchema} from './PageTitleconfig.data';
import {list, deleteOne, batchDelete, saveOrUpdate} from './PageTitleconfig.api';
import { JEllipsis } from '/@/components/Form';
......@@ -34,15 +42,20 @@
const dataList = ref([])
const [registerModal, {openModal}] = useModal();
const [registerTplItemModal, {openModal: openTplItemModal}] = useModal();
const { prefixCls,tableContext } = useListPage({
tableProps:{
title: '首页配置-生产指标',
title: '首页配置',
api:list,
columns,
canResize:false,
pagination:true,
useSearchForm:false,
showIndexColumn:true,
scroll: {
y: 'calc(100vh - 200px)',
},
formConfig: {
schemas: searchFormSchema,
autoSubmitOnEnter:true,
......@@ -82,7 +95,6 @@
}
function handleDetail(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
......@@ -90,6 +102,14 @@
});
}
function handleAssociate(record: Recordable) {
openTplItemModal(true, {
record,
title: '关联指标',
showFooter: false,
});
}
async function handleDelete(record) {
await deleteOne({id: record.id}, handleSuccess);
......@@ -111,6 +131,10 @@
{
label: '编辑',
onClick: handleEdit.bind(null, record),
},
{
label: '关联指标',
onClick: handleAssociate.bind(null, record),
}
]
}
......@@ -156,7 +180,6 @@
}
</script>
<style scoped>
</style>
\ No newline at end of file
......@@ -14,8 +14,6 @@ enum Api {
queryFxcTplTree = '/page/pageTitleconfig/queryFxcTplTree',
pagetitleall = '/page/pageTitleconfig/pagetitleall',
queryItemDtById = '/fxc/fxcTplItemDt/queryById',
}
/**
......
......@@ -113,16 +113,6 @@ export const formSchema: FormSchema[] = [
component: 'Input',
required: true,
},
{
label: '数据来源',
field: 'tplItemDtId',
component: 'JSelectFxcTplTree',
componentProps: {
labelKey: 'title',
rowKey: 'id',
},
ifShow: false,
},
{
label: '显示顺序',
field: 'showSort',
......
<template>
<BasicModal v-bind="$attrs"
@register="registerModal"
destroyOnClose
:centered="true"
:title="title" width="70%">
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<template #tableTitle>
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined">
设置
</a-button>
</template>
</BasicTable>
</BasicModal>
</template>
<script lang="ts" name="baosong-baosongTplItem" setup>
import { ref, computed, unref } from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { BasicModal, useModalInner } from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage';
import { list } from '/@/views/baosong/tpl/BaosongTplItem.api';
import { saveOrUpdate } from '../PageTitleconfig.api';
// Emits声明
const emit = defineEmits(['register', 'success']);
// 定义表格列
const columns = [
{
title: '模板名称',
dataIndex: 'tplName',
key: 'tplName',
width: 130,
},
{
title: '父编码',
dataIndex: 'pcode',
key: 'pcode',
width: 100,
},
{
title: '编码',
dataIndex: 'code',
key: 'code',
width: 100,
},
{
title: '名称',
dataIndex: 'title',
key: 'title',
width: 200,
},
];
// 定义搜索表单
const searchFormSchema = [
{
field: 'tplName',
label: '模板名称',
component: 'Input',
colProps: {
span: 8,
},
},
{
field: 'title',
label: '名称',
component: 'Input',
colProps: {
span: 8,
},
},
];
// 注册table数据
const { tableContext } = useListPage({
tableProps: {
title: '报送模板项',
api: list,
columns,
canResize: true,
useSearchForm: true,
showActionColumn: false,
showIndexColumn: true,
rowSelection: {
type: 'radio',
},
beforeFetch(params) {
params['tp'] = 'number'
},
scroll: {
y: 'calc(100vh - 100px)',
},
formConfig: {
schemas: searchFormSchema,
autoSubmitOnEnter: true,
showAdvancedButton: true,
fieldMapToNumber: [],
fieldMapToTime: [],
},
defSort: {
column: 'tplName,pcode,code',
order: 'asc,asc,asc',
},
},
});
const curdata = ref({});
const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext
// 模态框配置
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
curdata.value = data.record;
// 重置表格
await reload();
// 设置模态框属性
setModalProps({
confirmLoading: false,
showCancelBtn: false,
showOkBtn: false,
footer: null
});
});
// 设置标题
const title = computed(() => {
return '关联指标';
});
function handleAdd() {
const tplItem = rowSelection.selectedRows[0];
if(!tplItem){
console.error('请选择指标');
return;
}
saveOrUpdate({
id: curdata.value.id,
tplItemId: tplItem.id,
tplItemName: tplItem.title,
unit: tplItem.unit,
tplName:tplItem.tplName,
tplId:tplItem.tplid,
}, true);
emit('success');
}
function handleSuccess() {
emit('success');
}
</script>
<style scoped>
</style>
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论