Merge branch 'master' of http://175.27.215.92:3000/xins/hwmom-ui
commit
e4f7c91769
@ -0,0 +1,77 @@
|
||||
import request from '@/utils/request';
|
||||
import { AxiosPromise } from 'axios';
|
||||
import { MasterDataVO, MasterDataForm, MasterDataQuery } from '@/api/system/masterData/types';
|
||||
|
||||
/**
|
||||
* 查询主数据维护列表
|
||||
* @param query
|
||||
* @returns {*}
|
||||
*/
|
||||
|
||||
export const listMasterData = (query?: MasterDataQuery): AxiosPromise<MasterDataVO[]> => {
|
||||
return request({
|
||||
url: '/system/masterData/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 查询主数据维护详细
|
||||
* @param masterDataId
|
||||
*/
|
||||
export const getMasterData = (masterDataId: string | number): AxiosPromise<MasterDataVO> => {
|
||||
return request({
|
||||
url: '/system/masterData/' + masterDataId,
|
||||
method: 'get'
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 新增主数据维护
|
||||
* @param data
|
||||
*/
|
||||
export const addMasterData = (data: MasterDataForm) => {
|
||||
return request({
|
||||
url: '/system/masterData',
|
||||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 修改主数据维护
|
||||
* @param data
|
||||
*/
|
||||
export const updateMasterData = (data: MasterDataForm) => {
|
||||
return request({
|
||||
url: '/system/masterData',
|
||||
method: 'put',
|
||||
data: data
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 删除主数据维护
|
||||
* @param masterDataId
|
||||
*/
|
||||
export const delMasterData = (masterDataId: string | number | Array<string | number>) => {
|
||||
return request({
|
||||
url: '/system/masterData/' + masterDataId,
|
||||
method: 'delete'
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* 下拉框查询主数据维护列表
|
||||
* @param query
|
||||
* @returns {*}
|
||||
*/
|
||||
export function getSysMasterDataList (query) {
|
||||
return request({
|
||||
url: '/system/masterData/getSysMasterDataList',
|
||||
method: 'get',
|
||||
params: query
|
||||
});
|
||||
};
|
@ -0,0 +1,77 @@
|
||||
import request from '@/utils/request';
|
||||
import { AxiosPromise } from 'axios';
|
||||
import { MasterDataDetailVO, MasterDataDetailForm, MasterDataDetailQuery } from '@/api/system/masterDataDetail/types';
|
||||
|
||||
/**
|
||||
* 查询主数据维护明细列表
|
||||
* @param query
|
||||
* @returns {*}
|
||||
*/
|
||||
|
||||
export const listMasterDataDetail = (query?: MasterDataDetailQuery): AxiosPromise<MasterDataDetailVO[]> => {
|
||||
return request({
|
||||
url: '/system/masterDataDetail/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 查询主数据维护明细详细
|
||||
* @param masterDataDetailId
|
||||
*/
|
||||
export const getMasterDataDetail = (masterDataDetailId: string | number): AxiosPromise<MasterDataDetailVO> => {
|
||||
return request({
|
||||
url: '/system/masterDataDetail/' + masterDataDetailId,
|
||||
method: 'get'
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 新增主数据维护明细
|
||||
* @param data
|
||||
*/
|
||||
export const addMasterDataDetail = (data: MasterDataDetailForm) => {
|
||||
return request({
|
||||
url: '/system/masterDataDetail',
|
||||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 修改主数据维护明细
|
||||
* @param data
|
||||
*/
|
||||
export const updateMasterDataDetail = (data: MasterDataDetailForm) => {
|
||||
return request({
|
||||
url: '/system/masterDataDetail',
|
||||
method: 'put',
|
||||
data: data
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 删除主数据维护明细
|
||||
* @param masterDataDetailId
|
||||
*/
|
||||
export const delMasterDataDetail = (masterDataDetailId: string | number | Array<string | number>) => {
|
||||
return request({
|
||||
url: '/system/masterDataDetail/' + masterDataDetailId,
|
||||
method: 'delete'
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* 下拉框查询主数据维护明细列表
|
||||
* @param query
|
||||
* @returns {*}
|
||||
*/
|
||||
export function getSysMasterDataDetailList(query) {
|
||||
return request({
|
||||
url: '/system/masterDataDetail/getSysMasterDataDetailList',
|
||||
method: 'get',
|
||||
params: query
|
||||
});
|
||||
};
|
@ -0,0 +1,221 @@
|
||||
export interface MasterDataDetailVO {
|
||||
/**
|
||||
* 主键标识
|
||||
*/
|
||||
masterDataDetailId: string | number;
|
||||
|
||||
/**
|
||||
* 主数据ID
|
||||
*/
|
||||
masterDataId: string | number;
|
||||
|
||||
/**
|
||||
* 父级标识
|
||||
*/
|
||||
parentId: string | number;
|
||||
|
||||
/**
|
||||
* 祖级列表
|
||||
*/
|
||||
ancestors: string;
|
||||
|
||||
/**
|
||||
* 主数据明细编号
|
||||
*/
|
||||
dataDetailCode: string;
|
||||
|
||||
/**
|
||||
* 主数据明细名称
|
||||
*/
|
||||
dataDetailName: string;
|
||||
|
||||
/**
|
||||
* 预留字段1数据
|
||||
*/
|
||||
fieldData1: string;
|
||||
|
||||
/**
|
||||
* 预留字段2数据
|
||||
*/
|
||||
fieldData2: string;
|
||||
|
||||
/**
|
||||
* 预留字段3数据
|
||||
*/
|
||||
fieldData3: string;
|
||||
|
||||
/**
|
||||
* 预留字段4数据
|
||||
*/
|
||||
fieldData4: string;
|
||||
|
||||
/**
|
||||
* 预留字段5数据
|
||||
*/
|
||||
fieldData5: string;
|
||||
|
||||
/**
|
||||
* 显示排序
|
||||
*/
|
||||
displaySort: number;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
remark: string;
|
||||
|
||||
/**
|
||||
* 激活标识(1是 0否)
|
||||
*/
|
||||
activeFlag: string;
|
||||
|
||||
}
|
||||
|
||||
export interface MasterDataDetailForm extends BaseEntity {
|
||||
/**
|
||||
* 主键标识
|
||||
*/
|
||||
masterDataDetailId?: string | number;
|
||||
|
||||
/**
|
||||
* 主数据ID
|
||||
*/
|
||||
masterDataId?: string | number;
|
||||
|
||||
/**
|
||||
* 父级标识
|
||||
*/
|
||||
parentId?: string | number;
|
||||
|
||||
/**
|
||||
* 祖级列表
|
||||
*/
|
||||
ancestors?: string;
|
||||
|
||||
/**
|
||||
* 主数据明细编号
|
||||
*/
|
||||
dataDetailCode?: string;
|
||||
|
||||
/**
|
||||
* 主数据明细名称
|
||||
*/
|
||||
dataDetailName?: string;
|
||||
|
||||
/**
|
||||
* 预留字段1数据
|
||||
*/
|
||||
fieldData1?: string;
|
||||
|
||||
/**
|
||||
* 预留字段2数据
|
||||
*/
|
||||
fieldData2?: string;
|
||||
|
||||
/**
|
||||
* 预留字段3数据
|
||||
*/
|
||||
fieldData3?: string;
|
||||
|
||||
/**
|
||||
* 预留字段4数据
|
||||
*/
|
||||
fieldData4?: string;
|
||||
|
||||
/**
|
||||
* 预留字段5数据
|
||||
*/
|
||||
fieldData5?: string;
|
||||
|
||||
/**
|
||||
* 显示排序
|
||||
*/
|
||||
displaySort?: number;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
remark?: string;
|
||||
|
||||
/**
|
||||
* 激活标识(1是 0否)
|
||||
*/
|
||||
activeFlag?: string;
|
||||
|
||||
}
|
||||
|
||||
export interface MasterDataDetailQuery extends PageQuery {
|
||||
|
||||
/**
|
||||
* 主键标识
|
||||
*/
|
||||
masterDataDetailId?: string | number;
|
||||
|
||||
/**
|
||||
* 主数据ID
|
||||
*/
|
||||
masterDataId?: string | number;
|
||||
|
||||
/**
|
||||
* 父级标识
|
||||
*/
|
||||
parentId?: string | number;
|
||||
|
||||
/**
|
||||
* 祖级列表
|
||||
*/
|
||||
ancestors?: string;
|
||||
|
||||
/**
|
||||
* 主数据明细编号
|
||||
*/
|
||||
dataDetailCode?: string;
|
||||
|
||||
/**
|
||||
* 主数据明细名称
|
||||
*/
|
||||
dataDetailName?: string;
|
||||
|
||||
/**
|
||||
* 预留字段1数据
|
||||
*/
|
||||
fieldData1?: string;
|
||||
|
||||
/**
|
||||
* 预留字段2数据
|
||||
*/
|
||||
fieldData2?: string;
|
||||
|
||||
/**
|
||||
* 预留字段3数据
|
||||
*/
|
||||
fieldData3?: string;
|
||||
|
||||
/**
|
||||
* 预留字段4数据
|
||||
*/
|
||||
fieldData4?: string;
|
||||
|
||||
/**
|
||||
* 预留字段5数据
|
||||
*/
|
||||
fieldData5?: string;
|
||||
|
||||
/**
|
||||
* 显示排序
|
||||
*/
|
||||
displaySort?: number;
|
||||
|
||||
/**
|
||||
* 激活标识(1是 0否)
|
||||
*/
|
||||
activeFlag?: string;
|
||||
|
||||
/**
|
||||
* 日期范围参数
|
||||
*/
|
||||
params?: any;
|
||||
}
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,477 @@
|
||||
<template>
|
||||
<div class='p-2'>
|
||||
<transition :enter-active-class='proxy?.animate.searchAnimate.enter'
|
||||
:leave-active-class='proxy?.animate.searchAnimate.leave'>
|
||||
<div v-show='showSearch' class='mb-[10px]'>
|
||||
<el-card shadow='hover'>
|
||||
<el-form ref='queryFormRef' :model='queryParams' :inline='true' >
|
||||
<el-form-item label='所属模块' prop='moduleType'>
|
||||
<el-select v-model='queryParams.moduleType' placeholder='请选择所属模块' clearable>
|
||||
<el-option v-for='dict in sys_module_type' :key='dict.value' :label='dict.label' :value='dict.value' />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label='主数据标题' prop='masterDataTitle' label-width="90px">
|
||||
<el-input v-model='queryParams.masterDataTitle' placeholder='请输入主数据标题' clearable
|
||||
@keyup.enter='handleQuery' />
|
||||
</el-form-item>
|
||||
<el-form-item label='激活标识' prop='activeFlag'>
|
||||
<el-select v-model='queryParams.activeFlag' placeholder='请选择激活标识' clearable>
|
||||
<el-option v-for='dict in active_flag' :key='dict.value' :label='dict.label' :value='dict.value' />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type='primary' icon='Search' @click='handleQuery'>搜索</el-button>
|
||||
<el-button icon='Refresh' @click='resetQuery'>重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</div>
|
||||
</transition>
|
||||
|
||||
<el-card shadow='never'>
|
||||
<template #header>
|
||||
<el-row :gutter='10' class='mb8'>
|
||||
<el-col :span='1.5'>
|
||||
<el-button type='primary' plain icon='Plus' @click='handleAdd' v-hasPermi="['system:masterData:add']">新增
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span='1.5'>
|
||||
<el-button type='success' plain icon='Edit' :disabled='single' @click='handleUpdate()'
|
||||
v-hasPermi="['system:masterData:edit']">修改
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span='1.5'>
|
||||
<el-button type='danger' plain icon='Delete' :disabled='multiple' @click='handleDelete()'
|
||||
v-hasPermi="['system:masterData:remove']">删除
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span='1.5'>
|
||||
<el-button type='warning' plain icon='Download' @click='handleExport'
|
||||
v-hasPermi="['system:masterData:export']">导出
|
||||
</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch='showSearch' :columns='columns' :search='true'
|
||||
@queryTable='getList'></right-toolbar>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<el-table v-loading='loading' :data='masterDataList' @selection-change='handleSelectionChange'>
|
||||
<el-table-column type='selection' width='55' align='center' />
|
||||
<el-table-column label='主键标识' align='center' prop='masterDataId' v-if='columns[0].visible' />
|
||||
<el-table-column label='所属模块' align='center' prop='moduleType' v-if='columns[2].visible'>
|
||||
<template #default='scope'>
|
||||
<dict-tag :options='sys_module_type' :value='scope.row.moduleType' />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label='父级标识' align='center' prop='parentFlag' v-if='columns[3].visible'>
|
||||
<template #default='scope'>
|
||||
<dict-tag :options='active_flag' :value='scope.row.parentFlag' />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label='菜单ID' align='center' prop='menuId' v-if='columns[4].visible' />
|
||||
<el-table-column label='路由参数' align='center' prop='queryParam' v-if='columns[5].visible' />
|
||||
<el-table-column label='主数据标题' align='center' prop='masterDataTitle' v-if='columns[6].visible' width="100"/>
|
||||
<el-table-column label='预留字段1名称' align='center' prop='fieldName1' v-if='columns[7].visible' />
|
||||
<el-table-column label='预留字段1显示标识' align='center' prop='displayFlag1' v-if='columns[8].visible' width="90">
|
||||
<template #default='scope'>
|
||||
<dict-tag :options='active_flag' :value='scope.row.displayFlag1' />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label='预留字段2名称' align='center' prop='fieldName2' v-if='columns[9].visible' />
|
||||
<el-table-column label='预留字段2显示标识' align='center' prop='displayFlag2' v-if='columns[10].visible' width="90">
|
||||
<template #default='scope'>
|
||||
<dict-tag :options='active_flag' :value='scope.row.displayFlag2' />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label='预留字段3名称' align='center' prop='fieldName3' v-if='columns[11].visible' />
|
||||
<el-table-column label='预留字段3显示标识' align='center' prop='displayFlag3' v-if='columns[12].visible' width="90">
|
||||
<template #default='scope'>
|
||||
<dict-tag :options='active_flag' :value='scope.row.displayFlag3' />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label='预留字段4名称' align='center' prop='fieldName4' v-if='columns[13].visible' />
|
||||
<el-table-column label='预留字段4显示标识' align='center' prop='displayFlag4' v-if='columns[14].visible' width="90">
|
||||
<template #default='scope'>
|
||||
<dict-tag :options='active_flag' :value='scope.row.displayFlag4' />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label='预留字段5名称' align='center' prop='fieldName5' v-if='columns[15].visible' />
|
||||
<el-table-column label='预留字段5显示标识' align='center' prop='displayFlag5' v-if='columns[16].visible' width="90">
|
||||
<template #default='scope'>
|
||||
<dict-tag :options='active_flag' :value='scope.row.displayFlag5' />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label='激活标识' align='center' prop='activeFlag' v-if='columns[17].visible'>
|
||||
<template #default='scope'>
|
||||
<dict-tag :options='active_flag' :value='scope.row.activeFlag' />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label='备注' align='center' prop='remark' v-if='columns[18].visible' />
|
||||
<el-table-column label='操作' align='center' class-name='small-padding fixed-width'>
|
||||
<template #default='scope'>
|
||||
<el-tooltip content='修改' placement='top'>
|
||||
<el-button link type='primary' icon='Edit' @click='handleUpdate(scope.row)'
|
||||
v-hasPermi="['system:masterData:edit']"></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content='删除' placement='top'>
|
||||
<el-button link type='primary' icon='Delete' @click='handleDelete(scope.row)'
|
||||
v-hasPermi="['system:masterData:remove']"></el-button>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination v-show='total > 0' :total='total' v-model:page='queryParams.pageNum'
|
||||
v-model:limit='queryParams.pageSize' @pagination='getList' />
|
||||
</el-card>
|
||||
<!-- 添加或修改主数据维护对话框 -->
|
||||
<el-dialog :title='dialog.title' v-model='dialog.visible' width='600px' append-to-body>
|
||||
<el-form ref='masterDataFormRef' :model='form' :rules='rules' label-width='150px'>
|
||||
<el-form-item label='所属模块' prop='moduleType'>
|
||||
<el-radio-group v-model='form.moduleType'>
|
||||
<el-radio
|
||||
v-for='dict in sys_module_type'
|
||||
:key='dict.value'
|
||||
:value='dict.value'
|
||||
>{{ dict.label }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label='父级标识' prop='parentFlag'>
|
||||
<el-radio-group v-model='form.parentFlag'>
|
||||
<el-radio
|
||||
v-for='dict in active_flag'
|
||||
:key='dict.value'
|
||||
:value='dict.value'
|
||||
>{{ dict.label }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label='菜单ID' prop='menuId'>
|
||||
<el-input v-model='form.menuId' placeholder='请输入菜单ID' />
|
||||
</el-form-item>
|
||||
<el-form-item label='路由参数' prop='queryParam'>
|
||||
<el-input v-model='form.queryParam' placeholder='请输入路由参数' />
|
||||
</el-form-item>
|
||||
<el-form-item label='主数据标题' prop='masterDataTitle'>
|
||||
<el-input v-model='form.masterDataTitle' placeholder='请输入主数据标题' />
|
||||
</el-form-item>
|
||||
<el-form-item label='预留字段1名称' prop='fieldName1'>
|
||||
<el-input v-model='form.fieldName1' placeholder='请输入预留字段1名称' />
|
||||
</el-form-item>
|
||||
<el-form-item label='预留字段1显示标识' prop='displayFlag1'>
|
||||
<el-radio-group v-model='form.displayFlag1'>
|
||||
<el-radio
|
||||
v-for='dict in active_flag'
|
||||
:key='dict.value'
|
||||
:value='dict.value'
|
||||
>{{ dict.label }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label='预留字段2名称' prop='fieldName2'>
|
||||
<el-input v-model='form.fieldName2' placeholder='请输入预留字段2名称' />
|
||||
</el-form-item>
|
||||
<el-form-item label='预留字段2显示标识' prop='displayFlag2'>
|
||||
<el-radio-group v-model='form.displayFlag2'>
|
||||
<el-radio
|
||||
v-for='dict in active_flag'
|
||||
:key='dict.value'
|
||||
:value='dict.value'
|
||||
>{{ dict.label }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label='预留字段3名称' prop='fieldName3'>
|
||||
<el-input v-model='form.fieldName3' placeholder='请输入预留字段3名称' />
|
||||
</el-form-item>
|
||||
<el-form-item label='预留字段3显示标识' prop='displayFlag3'>
|
||||
<el-radio-group v-model='form.displayFlag3'>
|
||||
<el-radio
|
||||
v-for='dict in active_flag'
|
||||
:key='dict.value'
|
||||
:value='dict.value'
|
||||
>{{ dict.label }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label='预留字段4名称' prop='fieldName4'>
|
||||
<el-input v-model='form.fieldName4' placeholder='请输入预留字段4名称' />
|
||||
</el-form-item>
|
||||
<el-form-item label='预留字段4显示标识' prop='displayFlag4'>
|
||||
<el-radio-group v-model='form.displayFlag4'>
|
||||
<el-radio
|
||||
v-for='dict in active_flag'
|
||||
:key='dict.value'
|
||||
:value='dict.value'
|
||||
>{{ dict.label }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label='预留字段5名称' prop='fieldName5'>
|
||||
<el-input v-model='form.fieldName5' placeholder='请输入预留字段5名称' />
|
||||
</el-form-item>
|
||||
<el-form-item label='预留字段5显示标识' prop='displayFlag5'>
|
||||
<el-radio-group v-model='form.displayFlag5'>
|
||||
<el-radio
|
||||
v-for='dict in active_flag'
|
||||
:key='dict.value'
|
||||
:value='dict.value'
|
||||
>{{ dict.label }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label='激活标识' prop='activeFlag'>
|
||||
<el-radio-group v-model='form.activeFlag'>
|
||||
<el-radio
|
||||
v-for='dict in active_flag'
|
||||
:key='dict.value'
|
||||
:value='dict.value'
|
||||
>{{ dict.label }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label='备注' prop='remark'>
|
||||
<el-input v-model='form.remark' placeholder='请输入备注' />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class='dialog-footer'>
|
||||
<el-button :loading='buttonLoading' type='primary' @click='submitForm'>确 定</el-button>
|
||||
<el-button @click='cancel'>取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name='MasterData' lang='ts'>
|
||||
import { listMasterData, getMasterData, delMasterData, addMasterData, updateMasterData } from '@/api/system/masterData';
|
||||
import { MasterDataVO, MasterDataQuery, MasterDataForm } from '@/api/system/masterData/types';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const {
|
||||
active_flag,
|
||||
sys_yes_no,
|
||||
sys_module_type
|
||||
} = toRefs<any>(proxy?.useDict('active_flag', 'sys_yes_no', 'sys_module_type'));
|
||||
|
||||
const masterDataList = ref<MasterDataVO[]>([]);
|
||||
const buttonLoading = ref(false);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref<Array<string | number>>([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
|
||||
const queryFormRef = ref<ElFormInstance>();
|
||||
const masterDataFormRef = ref<ElFormInstance>();
|
||||
|
||||
const dialog = reactive<DialogOption>({
|
||||
visible: false,
|
||||
title: ''
|
||||
});
|
||||
|
||||
// 列显隐信息
|
||||
const columns = ref<FieldOption[]>([
|
||||
{ key: 0, label: `主键标识`, visible: false },
|
||||
{ key: 1, label: `租户编号`, visible: false },
|
||||
{ key: 2, label: `所属模块`, visible: true },
|
||||
{ key: 3, label: `父级标识`, visible: true },
|
||||
{ key: 4, label: `菜单ID`, visible: false },
|
||||
{ key: 5, label: `路由参数`, visible: true },
|
||||
{ key: 6, label: `主数据标题`, visible: true },
|
||||
{ key: 7, label: `预留字段1名称`, visible: true },
|
||||
{ key: 8, label: `预留字段1显示标识`, visible: true },
|
||||
{ key: 9, label: `预留字段2名称`, visible: true },
|
||||
{ key: 10, label: `预留字段2显示标识`, visible: true },
|
||||
{ key: 11, label: `预留字段3名称`, visible: true },
|
||||
{ key: 12, label: `预留字段3显示标识`, visible: true },
|
||||
{ key: 13, label: `预留字段4名称`, visible: true },
|
||||
{ key: 14, label: `预留字段4显示标识`, visible: true },
|
||||
{ key: 15, label: `预留字段5名称`, visible: true },
|
||||
{ key: 16, label: `预留字段5显示标识`, visible: true },
|
||||
{ key: 17, label: `激活标识`, visible: true },
|
||||
{ key: 18, label: `备注`, visible: true },
|
||||
{ key: 19, label: `创建部门`, visible: false },
|
||||
{ key: 20, label: `创建人`, visible: false },
|
||||
{ key: 21, label: `创建时间`, visible: false },
|
||||
{ key: 22, label: `更新人`, visible: false },
|
||||
{ key: 23, label: `更新时间`, visible: false }
|
||||
]);
|
||||
|
||||
const initFormData: MasterDataForm = {
|
||||
masterDataId: undefined,
|
||||
moduleType: undefined,
|
||||
parentFlag: '0',
|
||||
menuId: undefined,
|
||||
queryParam: undefined,
|
||||
masterDataTitle: undefined,
|
||||
fieldName1: undefined,
|
||||
displayFlag1: '0',
|
||||
fieldName2: undefined,
|
||||
displayFlag2: '0',
|
||||
fieldName3: undefined,
|
||||
displayFlag3: '0',
|
||||
fieldName4: undefined,
|
||||
displayFlag4: '0',
|
||||
fieldName5: undefined,
|
||||
displayFlag5: '0',
|
||||
activeFlag: '1',
|
||||
remark: undefined
|
||||
};
|
||||
const data = reactive<PageData<MasterDataForm, MasterDataQuery>>({
|
||||
form: { ...initFormData },
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
masterDataId: undefined,
|
||||
moduleType: undefined,
|
||||
parentFlag: undefined,
|
||||
menuId: undefined,
|
||||
queryParam: undefined,
|
||||
masterDataTitle: undefined,
|
||||
fieldName1: undefined,
|
||||
displayFlag1: undefined,
|
||||
fieldName2: undefined,
|
||||
displayFlag2: undefined,
|
||||
fieldName3: undefined,
|
||||
displayFlag3: undefined,
|
||||
fieldName4: undefined,
|
||||
displayFlag4: undefined,
|
||||
fieldName5: undefined,
|
||||
displayFlag5: undefined,
|
||||
activeFlag: undefined,
|
||||
params: {}
|
||||
},
|
||||
rules: {
|
||||
moduleType: [
|
||||
{ required: true, message: '所属模块不能为空', trigger: 'change' }
|
||||
],
|
||||
parentFlag: [
|
||||
{ required: true, message: '父级标识不能为空', trigger: 'change' }
|
||||
],
|
||||
queryParam: [
|
||||
{ required: true, message: '路由参数不能为空', trigger: 'blur' }
|
||||
],
|
||||
masterDataTitle: [
|
||||
{ required: true, message: '主数据标题不能为空', trigger: 'blur' }
|
||||
],
|
||||
displayFlag1: [
|
||||
{ required: true, message: '预留字段1显示标识不能为空', trigger: 'change' }
|
||||
],
|
||||
displayFlag2: [
|
||||
{ required: true, message: '预留字段2显示标识不能为空', trigger: 'change' }
|
||||
],
|
||||
displayFlag3: [
|
||||
{ required: true, message: '预留字段3显示标识不能为空', trigger: 'change' }
|
||||
],
|
||||
displayFlag4: [
|
||||
{ required: true, message: '预留字段4显示标识不能为空', trigger: 'change' }
|
||||
],
|
||||
displayFlag5: [
|
||||
{ required: true, message: '预留字段5显示标识不能为空', trigger: 'change' }
|
||||
],
|
||||
activeFlag: [
|
||||
{ required: true, message: '激活标识不能为空', trigger: 'change' }
|
||||
]
|
||||
}
|
||||
});
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
/** 查询主数据维护列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true;
|
||||
const res = await listMasterData(queryParams.value);
|
||||
masterDataList.value = res.rows;
|
||||
total.value = res.total;
|
||||
loading.value = false;
|
||||
};
|
||||
|
||||
/** 取消按钮 */
|
||||
const cancel = () => {
|
||||
reset();
|
||||
dialog.visible = false;
|
||||
};
|
||||
|
||||
/** 表单重置 */
|
||||
const reset = () => {
|
||||
form.value = { ...initFormData };
|
||||
masterDataFormRef.value?.resetFields();
|
||||
};
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
};
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields();
|
||||
handleQuery();
|
||||
};
|
||||
|
||||
/** 多选框选中数据 */
|
||||
const handleSelectionChange = (selection: MasterDataVO[]) => {
|
||||
ids.value = selection.map(item => item.masterDataId);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
};
|
||||
|
||||
/** 新增按钮操作 */
|
||||
const handleAdd = () => {
|
||||
reset();
|
||||
dialog.visible = true;
|
||||
dialog.title = '添加主数据维护';
|
||||
};
|
||||
|
||||
/** 修改按钮操作 */
|
||||
const handleUpdate = async (row?: MasterDataVO) => {
|
||||
reset();
|
||||
const _masterDataId = row?.masterDataId || ids.value[0];
|
||||
const res = await getMasterData(_masterDataId);
|
||||
Object.assign(form.value, res.data);
|
||||
dialog.visible = true;
|
||||
dialog.title = '修改主数据维护';
|
||||
};
|
||||
|
||||
/** 提交按钮 */
|
||||
const submitForm = () => {
|
||||
masterDataFormRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
buttonLoading.value = true;
|
||||
if (form.value.masterDataId) {
|
||||
await updateMasterData(form.value).finally(() => buttonLoading.value = false);
|
||||
} else {
|
||||
await addMasterData(form.value).finally(() => buttonLoading.value = false);
|
||||
}
|
||||
proxy?.$modal.msgSuccess('操作成功');
|
||||
dialog.visible = false;
|
||||
await getList();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: MasterDataVO) => {
|
||||
const _masterDataIds = row?.masterDataId || ids.value;
|
||||
await proxy?.$modal.confirm('是否确认删除主数据维护编号为"' + _masterDataIds + '"的数据项?').finally(() => loading.value = false);
|
||||
await delMasterData(_masterDataIds);
|
||||
proxy?.$modal.msgSuccess('删除成功');
|
||||
await getList();
|
||||
};
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = () => {
|
||||
proxy?.download('system/masterData/export', {
|
||||
...queryParams.value
|
||||
}, `masterData_${new Date().getTime()}.xlsx`);
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
});
|
||||
</script>
|
@ -0,0 +1,392 @@
|
||||
<template>
|
||||
<div class='p-2'>
|
||||
<transition :enter-active-class='proxy?.animate.searchAnimate.enter'
|
||||
:leave-active-class='proxy?.animate.searchAnimate.leave'>
|
||||
<div v-show='showSearch' class='mb-[10px]'>
|
||||
<el-card shadow='hover'>
|
||||
<el-form ref='queryFormRef' :model='queryParams' :inline='true'>
|
||||
<el-form-item label='主键标识' prop='masterDataDetailId'>
|
||||
<el-input v-model='queryParams.masterDataDetailId' placeholder='请输入主键标识' clearable
|
||||
@keyup.enter='handleQuery' />
|
||||
</el-form-item>
|
||||
<el-form-item label='主数据ID' prop='masterDataId'>
|
||||
<el-input v-model='queryParams.masterDataId' placeholder='请输入主数据ID' clearable
|
||||
@keyup.enter='handleQuery' />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label='父级标识' prop='parentId'>-->
|
||||
<!-- <el-input v-model='queryParams.parentId' placeholder='请输入父级标识' clearable @keyup.enter='handleQuery' />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label='祖级列表' prop='ancestors'>-->
|
||||
<!-- <el-input v-model='queryParams.ancestors' placeholder='请输入祖级列表' clearable @keyup.enter='handleQuery' />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label='主数据明细编号' prop='dataDetailCode'>-->
|
||||
<!-- <el-input v-model='queryParams.dataDetailCode' placeholder='请输入主数据明细编号' clearable-->
|
||||
<!-- @keyup.enter='handleQuery' />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label='主数据明细名称' prop='dataDetailName'>-->
|
||||
<!-- <el-input v-model='queryParams.dataDetailName' placeholder='请输入主数据明细名称' clearable-->
|
||||
<!-- @keyup.enter='handleQuery' />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label='预留字段1数据' prop='fieldData1'>-->
|
||||
<!-- <el-input v-model='queryParams.fieldData1' placeholder='请输入预留字段1数据' clearable-->
|
||||
<!-- @keyup.enter='handleQuery' />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label='预留字段2数据' prop='fieldData2'>-->
|
||||
<!-- <el-input v-model='queryParams.fieldData2' placeholder='请输入预留字段2数据' clearable-->
|
||||
<!-- @keyup.enter='handleQuery' />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label='预留字段3数据' prop='fieldData3'>-->
|
||||
<!-- <el-input v-model='queryParams.fieldData3' placeholder='请输入预留字段3数据' clearable-->
|
||||
<!-- @keyup.enter='handleQuery' />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label='预留字段4数据' prop='fieldData4'>-->
|
||||
<!-- <el-input v-model='queryParams.fieldData4' placeholder='请输入预留字段4数据' clearable-->
|
||||
<!-- @keyup.enter='handleQuery' />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label='预留字段5数据' prop='fieldData5'>-->
|
||||
<!-- <el-input v-model='queryParams.fieldData5' placeholder='请输入预留字段5数据' clearable-->
|
||||
<!-- @keyup.enter='handleQuery' />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label='显示排序' prop='displaySort'>-->
|
||||
<!-- <el-input v-model='queryParams.displaySort' placeholder='请输入显示排序' clearable @keyup.enter='handleQuery' />-->
|
||||
<!-- </el-form-item>-->
|
||||
<el-form-item label='激活标识' prop='activeFlag'>
|
||||
<el-select v-model='queryParams.activeFlag' placeholder='请选择激活标识' clearable>
|
||||
<el-option v-for='dict in active_flag' :key='dict.value' :label='dict.label' :value='dict.value' />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type='primary' icon='Search' @click='handleQuery'>搜索</el-button>
|
||||
<el-button icon='Refresh' @click='resetQuery'>重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</div>
|
||||
</transition>
|
||||
|
||||
<el-card shadow='never'>
|
||||
<template #header>
|
||||
<el-row :gutter='10' class='mb8'>
|
||||
<el-col :span='1.5'>
|
||||
<el-button type='primary' plain icon='Plus' @click='handleAdd' v-hasPermi="['system:masterDataDetail:add']">
|
||||
新增
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span='1.5'>
|
||||
<el-button type='success' plain icon='Edit' :disabled='single' @click='handleUpdate()'
|
||||
v-hasPermi="['system:masterDataDetail:edit']">修改
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span='1.5'>
|
||||
<el-button type='danger' plain icon='Delete' :disabled='multiple' @click='handleDelete()'
|
||||
v-hasPermi="['system:masterDataDetail:remove']">删除
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span='1.5'>
|
||||
<el-button type='warning' plain icon='Download' @click='handleExport'
|
||||
v-hasPermi="['system:masterDataDetail:export']">导出
|
||||
</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch='showSearch' :columns='columns' :search='true'
|
||||
@queryTable='getList'></right-toolbar>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<el-table v-loading='loading' :data='masterDataDetailList' @selection-change='handleSelectionChange'>
|
||||
<el-table-column type='selection' width='55' align='center' />
|
||||
<el-table-column label='主键标识' align='center' prop='masterDataDetailId' v-if='columns[0].visible' />
|
||||
<el-table-column label='主数据ID' align='center' prop='masterDataId' v-if='columns[1].visible' />
|
||||
<el-table-column label='父级标识' align='center' prop='parentId' v-if='columns[2].visible' />
|
||||
<el-table-column label='祖级列表' align='center' prop='ancestors' v-if='columns[3].visible' />
|
||||
<el-table-column label='主数据明细编号' align='center' prop='dataDetailCode' v-if='columns[4].visible' />
|
||||
<el-table-column label='主数据明细名称' align='center' prop='dataDetailName' v-if='columns[5].visible' />
|
||||
<el-table-column label='预留字段1数据' align='center' prop='fieldData1' v-if='columns[6].visible' />
|
||||
<el-table-column label='预留字段2数据' align='center' prop='fieldData2' v-if='columns[7].visible' />
|
||||
<el-table-column label='预留字段3数据' align='center' prop='fieldData3' v-if='columns[8].visible' />
|
||||
<el-table-column label='预留字段4数据' align='center' prop='fieldData4' v-if='columns[9].visible' />
|
||||
<el-table-column label='预留字段5数据' align='center' prop='fieldData5' v-if='columns[10].visible' />
|
||||
<el-table-column label='显示排序' align='center' prop='displaySort' v-if='columns[11].visible' />
|
||||
<el-table-column label='备注' align='center' prop='remark' v-if='columns[12].visible' />
|
||||
<el-table-column label='激活标识' align='center' prop='activeFlag' v-if='columns[13].visible'>
|
||||
<template #default='scope'>
|
||||
<dict-tag :options='active_flag' :value='scope.row.activeFlag' />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label='操作' align='center' class-name='small-padding fixed-width'>
|
||||
<template #default='scope'>
|
||||
<el-tooltip content='修改' placement='top'>
|
||||
<el-button link type='primary' icon='Edit' @click='handleUpdate(scope.row)'
|
||||
v-hasPermi="['system:masterDataDetail:edit']"></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content='删除' placement='top'>
|
||||
<el-button link type='primary' icon='Delete' @click='handleDelete(scope.row)'
|
||||
v-hasPermi="['system:masterDataDetail:remove']"></el-button>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination v-show='total > 0' :total='total' v-model:page='queryParams.pageNum'
|
||||
v-model:limit='queryParams.pageSize' @pagination='getList' />
|
||||
</el-card>
|
||||
<!-- 添加或修改主数据维护明细对话框 -->
|
||||
<el-dialog :title='dialog.title' v-model='dialog.visible' width='500px' append-to-body>
|
||||
<el-form ref='masterDataDetailFormRef' :model='form' :rules='rules' label-width='80px'>
|
||||
<el-form-item label='主键标识' prop='masterDataDetailId'>
|
||||
<el-input v-model='form.masterDataDetailId' placeholder='请输入主键标识' />
|
||||
</el-form-item>
|
||||
<el-form-item label='主数据ID' prop='masterDataId'>
|
||||
<el-input v-model='form.masterDataId' placeholder='请输入主数据ID' />
|
||||
</el-form-item>
|
||||
<el-form-item label='父级标识' prop='parentId'>
|
||||
<el-input v-model='form.parentId' placeholder='请输入父级标识' />
|
||||
</el-form-item>
|
||||
<el-form-item label='祖级列表' prop='ancestors'>
|
||||
<el-input v-model='form.ancestors' placeholder='请输入祖级列表' />
|
||||
</el-form-item>
|
||||
<el-form-item label='主数据明细编号' prop='dataDetailCode'>
|
||||
<el-input v-model='form.dataDetailCode' placeholder='请输入主数据明细编号' />
|
||||
</el-form-item>
|
||||
<el-form-item label='主数据明细名称' prop='dataDetailName'>
|
||||
<el-input v-model='form.dataDetailName' placeholder='请输入主数据明细名称' />
|
||||
</el-form-item>
|
||||
<el-form-item label='预留字段1数据' prop='fieldData1'>
|
||||
<el-input v-model='form.fieldData1' placeholder='请输入预留字段1数据' />
|
||||
</el-form-item>
|
||||
<el-form-item label='预留字段2数据' prop='fieldData2'>
|
||||
<el-input v-model='form.fieldData2' placeholder='请输入预留字段2数据' />
|
||||
</el-form-item>
|
||||
<el-form-item label='预留字段3数据' prop='fieldData3'>
|
||||
<el-input v-model='form.fieldData3' placeholder='请输入预留字段3数据' />
|
||||
</el-form-item>
|
||||
<el-form-item label='预留字段4数据' prop='fieldData4'>
|
||||
<el-input v-model='form.fieldData4' placeholder='请输入预留字段4数据' />
|
||||
</el-form-item>
|
||||
<el-form-item label='预留字段5数据' prop='fieldData5'>
|
||||
<el-input v-model='form.fieldData5' placeholder='请输入预留字段5数据' />
|
||||
</el-form-item>
|
||||
<el-form-item label='显示排序' prop='displaySort'>
|
||||
<el-input v-model='form.displaySort' placeholder='请输入显示排序' />
|
||||
</el-form-item>
|
||||
<el-form-item label='备注' prop='remark'>
|
||||
<el-input v-model='form.remark' placeholder='请输入备注' />
|
||||
</el-form-item>
|
||||
<el-form-item label='激活标识' prop='activeFlag'>
|
||||
<el-radio-group v-model='form.activeFlag'>
|
||||
<el-radio
|
||||
v-for='dict in active_flag'
|
||||
:key='dict.value'
|
||||
:value='dict.value'
|
||||
>{{ dict.label }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class='dialog-footer'>
|
||||
<el-button :loading='buttonLoading' type='primary' @click='submitForm'>确 定</el-button>
|
||||
<el-button @click='cancel'>取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name='MasterDataDetail' lang='ts'>
|
||||
import {
|
||||
listMasterDataDetail,
|
||||
getMasterDataDetail,
|
||||
delMasterDataDetail,
|
||||
addMasterDataDetail,
|
||||
updateMasterDataDetail
|
||||
} from '@/api/system/masterDataDetail';
|
||||
import { MasterDataDetailVO, MasterDataDetailQuery, MasterDataDetailForm } from '@/api/system/masterDataDetail/types';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const { active_flag } = toRefs<any>(proxy?.useDict('active_flag'));
|
||||
|
||||
const masterDataDetailList = ref<MasterDataDetailVO[]>([]);
|
||||
const buttonLoading = ref(false);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref<Array<string | number>>([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
|
||||
const queryFormRef = ref<ElFormInstance>();
|
||||
const masterDataDetailFormRef = ref<ElFormInstance>();
|
||||
|
||||
const dialog = reactive<DialogOption>({
|
||||
visible: false,
|
||||
title: ''
|
||||
});
|
||||
|
||||
// 列显隐信息
|
||||
const columns = ref<FieldOption[]>([
|
||||
{ key: 0, label: `主键标识`, visible: true },
|
||||
{ key: 1, label: `主数据ID`, visible: true },
|
||||
{ key: 2, label: `父级标识`, visible: true },
|
||||
{ key: 3, label: `祖级列表`, visible: true },
|
||||
{ key: 4, label: `主数据明细编号`, visible: true },
|
||||
{ key: 5, label: `主数据明细名称`, visible: true },
|
||||
{ key: 6, label: `预留字段1数据`, visible: true },
|
||||
{ key: 7, label: `预留字段2数据`, visible: true },
|
||||
{ key: 8, label: `预留字段3数据`, visible: true },
|
||||
{ key: 9, label: `预留字段4数据`, visible: true },
|
||||
{ key: 10, label: `预留字段5数据`, visible: true },
|
||||
{ key: 11, label: `显示排序`, visible: true },
|
||||
{ key: 12, label: `备注`, visible: true },
|
||||
{ key: 13, label: `激活标识`, visible: true },
|
||||
{ key: 14, label: `创建部门`, visible: true },
|
||||
{ key: 15, label: `创建人`, visible: true },
|
||||
{ key: 16, label: `创建时间`, visible: true },
|
||||
{ key: 17, label: `更新人`, visible: true },
|
||||
{ key: 18, label: `更新时间`, visible: true }
|
||||
]);
|
||||
|
||||
const initFormData: MasterDataDetailForm = {
|
||||
masterDataDetailId: undefined,
|
||||
masterDataId: undefined,
|
||||
parentId: undefined,
|
||||
ancestors: undefined,
|
||||
dataDetailCode: undefined,
|
||||
dataDetailName: undefined,
|
||||
fieldData1: undefined,
|
||||
fieldData2: undefined,
|
||||
fieldData3: undefined,
|
||||
fieldData4: undefined,
|
||||
fieldData5: undefined,
|
||||
displaySort: undefined,
|
||||
remark: undefined,
|
||||
activeFlag: undefined
|
||||
};
|
||||
const data = reactive<PageData<MasterDataDetailForm, MasterDataDetailQuery>>({
|
||||
form: { ...initFormData },
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
masterDataDetailId: undefined,
|
||||
masterDataId: undefined,
|
||||
parentId: undefined,
|
||||
ancestors: undefined,
|
||||
dataDetailCode: undefined,
|
||||
dataDetailName: undefined,
|
||||
fieldData1: undefined,
|
||||
fieldData2: undefined,
|
||||
fieldData3: undefined,
|
||||
fieldData4: undefined,
|
||||
fieldData5: undefined,
|
||||
displaySort: undefined,
|
||||
activeFlag: undefined,
|
||||
params: {}
|
||||
},
|
||||
rules: {
|
||||
dataDetailCode: [
|
||||
{ required: true, message: '主数据明细编号不能为空', trigger: 'blur' }
|
||||
],
|
||||
dataDetailName: [
|
||||
{ required: true, message: '主数据明细名称不能为空', trigger: 'blur' }
|
||||
],
|
||||
activeFlag: [
|
||||
{ required: true, message: '激活标识不能为空', trigger: 'change' }
|
||||
]
|
||||
}
|
||||
});
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
/** 查询主数据维护明细列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true;
|
||||
const res = await listMasterDataDetail(queryParams.value);
|
||||
masterDataDetailList.value = res.rows;
|
||||
total.value = res.total;
|
||||
loading.value = false;
|
||||
};
|
||||
|
||||
/** 取消按钮 */
|
||||
const cancel = () => {
|
||||
reset();
|
||||
dialog.visible = false;
|
||||
};
|
||||
|
||||
/** 表单重置 */
|
||||
const reset = () => {
|
||||
form.value = { ...initFormData };
|
||||
masterDataDetailFormRef.value?.resetFields();
|
||||
};
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
};
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields();
|
||||
handleQuery();
|
||||
};
|
||||
|
||||
/** 多选框选中数据 */
|
||||
const handleSelectionChange = (selection: MasterDataDetailVO[]) => {
|
||||
ids.value = selection.map(item => item.masterDataDetailId);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
};
|
||||
|
||||
/** 新增按钮操作 */
|
||||
const handleAdd = () => {
|
||||
reset();
|
||||
dialog.visible = true;
|
||||
dialog.title = '添加主数据维护明细';
|
||||
};
|
||||
|
||||
/** 修改按钮操作 */
|
||||
const handleUpdate = async (row?: MasterDataDetailVO) => {
|
||||
reset();
|
||||
const _masterDataDetailId = row?.masterDataDetailId || ids.value[0];
|
||||
const res = await getMasterDataDetail(_masterDataDetailId);
|
||||
Object.assign(form.value, res.data);
|
||||
dialog.visible = true;
|
||||
dialog.title = '修改主数据维护明细';
|
||||
};
|
||||
|
||||
/** 提交按钮 */
|
||||
const submitForm = () => {
|
||||
masterDataDetailFormRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
buttonLoading.value = true;
|
||||
if (form.value.masterDataDetailId) {
|
||||
await updateMasterDataDetail(form.value).finally(() => buttonLoading.value = false);
|
||||
} else {
|
||||
await addMasterDataDetail(form.value).finally(() => buttonLoading.value = false);
|
||||
}
|
||||
proxy?.$modal.msgSuccess('操作成功');
|
||||
dialog.visible = false;
|
||||
await getList();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: MasterDataDetailVO) => {
|
||||
const _masterDataDetailIds = row?.masterDataDetailId || ids.value;
|
||||
await proxy?.$modal.confirm('是否确认删除主数据维护明细编号为"' + _masterDataDetailIds + '"的数据项?').finally(() => loading.value = false);
|
||||
await delMasterDataDetail(_masterDataDetailIds);
|
||||
proxy?.$modal.msgSuccess('删除成功');
|
||||
await getList();
|
||||
};
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = () => {
|
||||
proxy?.download('system/masterDataDetail/export', {
|
||||
...queryParams.value
|
||||
}, `masterDataDetail_${new Date().getTime()}.xlsx`);
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
});
|
||||
</script>
|
@ -0,0 +1,350 @@
|
||||
<template>
|
||||
<div class="p-2">
|
||||
<el-card shadow="never">
|
||||
<el-form label-width="120px" label-position="right" :inline="true" :model="queryForm" class="demo-form-inline">
|
||||
<el-form-item label="字段1">
|
||||
<el-input v-model="queryForm.user" placeholder="字段1" clearable/>
|
||||
</el-form-item>
|
||||
<el-form-item label="字段2">
|
||||
<el-select
|
||||
v-model="queryForm.region"
|
||||
placeholder="字段2"
|
||||
clearable
|
||||
>
|
||||
<el-option label="选项1" value="shanghai"/>
|
||||
<el-option label="选项2" value="beijing"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="字段3">
|
||||
<el-date-picker
|
||||
v-model="queryForm.date"
|
||||
type="date"
|
||||
placeholder="字段3"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="query">查询</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card style="margin-top: 8px" shadow="never">
|
||||
<template #header>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="parentTableAdd">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" plain icon="Edit" :disabled="ids.length !== 1" @click="parentTableUpdate()">修改
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="ids.length < 1" @click="parentTableDelete()">删除
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" :columns="columns" :search="true"
|
||||
@queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
</template>
|
||||
<el-table :data="tableData" style="width: 100%" @cell-click="parentTableCellClick"
|
||||
@selection-change="selectionChange" ref="parentTableRef">
|
||||
<el-table-column type="selection" width="55"/>
|
||||
<el-table-column label="Date" prop="date"/>
|
||||
<el-table-column label="Date" prop="name"/>
|
||||
<el-table-column label="Operations" fixed="right" width="200">
|
||||
<template #default="scope">
|
||||
<el-button size="small" @click.stop="viewDetails(scope.row)">
|
||||
查看
|
||||
</el-button>
|
||||
<el-button size="small" @click.stop="parentTableUpdate(scope.row)">
|
||||
修改
|
||||
</el-button>
|
||||
<el-button
|
||||
size="small"
|
||||
type="danger"
|
||||
@click.stop="parentTableDelete(scope.row)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
|
||||
<el-card style="margin-top: 8px" shadow="never">
|
||||
<el-table :data="tableData1" style="width: 100%">
|
||||
<el-table-column label="Date" prop="date"/>
|
||||
<el-table-column label="Date" prop="name"/>
|
||||
<el-table-column label="Operations" fixed="right" width="200">
|
||||
<template #default="scope">
|
||||
<el-button size="small" @click="handleEdit(scope.$index, scope.row)">
|
||||
查看
|
||||
</el-button>
|
||||
<el-button size="small" @click="handleEdit(scope.$index, scope.row)">
|
||||
修改
|
||||
</el-button>
|
||||
<el-button
|
||||
size="small"
|
||||
type="danger"
|
||||
@click="handleDelete(scope.$index, scope.row)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
|
||||
<el-dialog v-model="dialogVisible" :title="dialogTitle" width="100%" fullscreen>
|
||||
<el-card shadow="never">
|
||||
<el-form :model="dialogForm" :inline="true">
|
||||
<el-form-item label="字段1" label-width="120px">
|
||||
<el-input v-model="dialogForm.name" autocomplete="off"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="字段2" label-width="120px">
|
||||
<el-select v-model="dialogForm.region" placeholder="Please select a zone">
|
||||
<el-option label="Zone No.1" value="shanghai"/>
|
||||
<el-option label="Zone No.2" value="beijing"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
<el-card style="margin-top: 8px" shadow="never">
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="addDialogTableCell">新增</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-table :data="dialogtable" style="width: 100%">
|
||||
<el-table-column label="字段1" prop="date">
|
||||
<template #default="scope">
|
||||
<el-select
|
||||
v-model="scope.row.date"
|
||||
placeholder="Select"
|
||||
size="small"
|
||||
>
|
||||
<el-option
|
||||
label="1"
|
||||
value="1"
|
||||
/>
|
||||
<el-option
|
||||
label="2"
|
||||
value="2"
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="字段2" prop="name">
|
||||
<template #default="scope">
|
||||
<el-input v-model="scope.row.name" style="width: 240px" placeholder="Please input" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="Operations" fixed="right" width="200">
|
||||
<template #default="scope">
|
||||
<el-button size="small" @click="handleEdit(scope.$index, scope.row)">
|
||||
查看
|
||||
</el-button>
|
||||
<el-button size="small" @click="handleEdit(scope.$index, scope.row)">
|
||||
修改
|
||||
</el-button>
|
||||
<el-button
|
||||
size="small"
|
||||
type="danger"
|
||||
@click="handleDelete(scope.$index, scope.row)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">关闭</el-button>
|
||||
<el-button type="primary" @click="dialogSubmit">
|
||||
确定
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="Linkage" lang="ts">
|
||||
|
||||
import {reactive} from 'vue'
|
||||
import {ElMessage, ElMessageBox} from 'element-plus'
|
||||
|
||||
interface User {
|
||||
date: string
|
||||
name: string
|
||||
address: string
|
||||
}
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
const dialogTitle = ref('添加')
|
||||
const dialogForm = reactive({})
|
||||
|
||||
const queryForm = reactive({
|
||||
user: '',
|
||||
region: '',
|
||||
date: '',
|
||||
})
|
||||
const parentTableRef = ref()
|
||||
const tableData = ref([
|
||||
{
|
||||
date: '2016-05-03',
|
||||
name: 'Tom',
|
||||
address: 'No. 189, Grove St, Los Angeles',
|
||||
},
|
||||
{
|
||||
date: '2016-05-02',
|
||||
name: 'Tom',
|
||||
address: 'No. 189, Grove St, Los Angeles',
|
||||
},
|
||||
{
|
||||
date: '2016-05-04',
|
||||
name: 'Tom',
|
||||
address: 'No. 189, Grove St, Los Angeles',
|
||||
},
|
||||
{
|
||||
date: '2016-05-01',
|
||||
name: 'Tom',
|
||||
address: 'No. 189, Grove St, Los Angeles',
|
||||
},
|
||||
])
|
||||
const ids = ref([])
|
||||
const tableData1 = ref([
|
||||
{
|
||||
date: '2016-05-03',
|
||||
name: 'Tom',
|
||||
address: 'No. 189, Grove St, Los Angeles',
|
||||
},
|
||||
{
|
||||
date: '2016-05-02',
|
||||
name: 'Tom',
|
||||
address: 'No. 189, Grove St, Los Angeles',
|
||||
},
|
||||
{
|
||||
date: '2016-05-04',
|
||||
name: 'Tom',
|
||||
address: 'No. 189, Grove St, Los Angeles',
|
||||
},
|
||||
{
|
||||
date: '2016-05-01',
|
||||
name: 'Tom',
|
||||
address: 'No. 189, Grove St, Los Angeles',
|
||||
},
|
||||
])
|
||||
const dialogtable = ref([])
|
||||
|
||||
const onSubmit = () => {
|
||||
console.log('submit!')
|
||||
}
|
||||
|
||||
const handleEdit = (index: number, row: User) => {
|
||||
console.log(index, row)
|
||||
}
|
||||
const handleDelete = (index: number, row: User) => {
|
||||
console.log(index, row)
|
||||
}
|
||||
const query = () => {
|
||||
console.log(queryForm)
|
||||
ids.value = []
|
||||
parentTableRef.value.clearSelection()
|
||||
}
|
||||
|
||||
// 父表格行点击
|
||||
const parentTableCellClick = (e) => {
|
||||
console.log(e.date)
|
||||
tableData1.value = tableData1.value.map(v => {
|
||||
return {
|
||||
...v,
|
||||
date: e.date
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 表格多选
|
||||
const selectionChange = (e) => {
|
||||
ids.value = e.map(v => v.name)
|
||||
console.log(ids.value)
|
||||
}
|
||||
// 查看
|
||||
const viewDetails = (e) => {
|
||||
console.log(e)
|
||||
}
|
||||
|
||||
// 父表格新增
|
||||
const parentTableAdd = () => {
|
||||
dialogVisible.value = true
|
||||
}
|
||||
// 父表格修改
|
||||
const parentTableUpdate = (e) => {
|
||||
let id = ref(null)
|
||||
if (e) {
|
||||
id.value = e.name
|
||||
} else {
|
||||
id.value = ids.value?.[0]
|
||||
}
|
||||
if (!id.value) return
|
||||
dialogVisible.value = true
|
||||
}
|
||||
// 父表格删除
|
||||
const parentTableDelete = (e) => {
|
||||
const delList = ref([])
|
||||
if (e) {
|
||||
delList.value = [e.name]
|
||||
} else {
|
||||
delList.value = ids.value
|
||||
}
|
||||
console.log(delList.value)
|
||||
ElMessageBox.confirm(
|
||||
'确定要删除这些数据吗?',
|
||||
'Warning',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '删除完成',
|
||||
})
|
||||
})
|
||||
.catch(() => {
|
||||
ElMessage({
|
||||
type: 'info',
|
||||
message: '取消',
|
||||
})
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
// 添加子表格行
|
||||
const addDialogTableCell = () => {
|
||||
dialogtable.value.push({})
|
||||
}
|
||||
|
||||
// dialog提交
|
||||
const dialogSubmit = () => {
|
||||
console.log(dialogForm)
|
||||
console.log(dialogtable.value)
|
||||
dialogVisible.value = false
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.demo-form-inline .el-input {
|
||||
--el-input-width: 220px;
|
||||
}
|
||||
|
||||
.demo-form-inline .el-select {
|
||||
--el-select-width: 220px;
|
||||
}
|
||||
</style>
|
Loading…
Reference in New Issue