diff --git a/.github/workflows/mirror.yml b/.github/workflows/mirror.yml new file mode 100644 index 0000000000000000000000000000000000000000..939c191431d74863ccd4567627e4cc7a96321970 --- /dev/null +++ b/.github/workflows/mirror.yml @@ -0,0 +1,18 @@ +name: 同步代码 + +on: + push: + branches: [ master,jdk17 ] + pull_request: + branches: [ master,jdk17 ] + +jobs: + sync: + runs-on: ubuntu-latest + steps: + - uses: wearerequired/git-mirror-action@master #同步至 gitee + env: + SSH_PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} + with: + source-repo: "git@github.com:pig-mesh/pig-ui.git" + destination-repo: "git@gitee.com:log4j/pig-ui.git" diff --git a/src/hooks/table.ts b/src/hooks/table.ts index e46e767cd71172e37c0fe2ec59aa61cffa24d6e2..d4693d135f4112c36bb0ac78c8dbb7a5de9440c9 100644 --- a/src/hooks/table.ts +++ b/src/hooks/table.ts @@ -31,12 +31,15 @@ export interface BasicTableProps { ascs?: string[]; // props属性对象,类型为any props?: any; + // 合并行列,类型为函数 + spanMethod?: Function } /** * 表格样式。 */ export interface TableStyle { + rowStyle: CellStyle; cellStyle: CellStyle; headerCellStyle: CellStyle; } @@ -58,7 +61,7 @@ export interface Pagination { } export function useTable(options?: BasicTableProps) { - const defaultOptions: BasicTableProps = { + const defaultOptions: { createdIsNeed: boolean; pagination: Pagination; queryForm: {}; loading: boolean; dataListSelections: any[]; ascs: any[]; props: { item: string; totalCount: string }; selectObjs: any[]; descs: any[]; dataListLoading: boolean; dataList: any[]; isPage: boolean } = { // 列表数据是否正在加载中,默认为false dataListLoading: false, // 是否需要自动请求创建接口来获取表格数据,默认为true @@ -121,7 +124,12 @@ export function useTable(options?: BasicTableProps) { try { // 开始加载数据,设置state.loading为true state.loading = true; - + // 参数排除空字段 + for (let key in state.queryForm) { + if (state.queryForm[key] === "" || state.queryForm[key] === null) { + delete state.queryForm[key] + } + } // 调用state.pageList方法发起分页查询 const res = await state.pageList({ ...state.queryForm, @@ -133,6 +141,10 @@ export function useTable(options?: BasicTableProps) { // 设置表格展示的数据数组 state.dataList = state.isPage ? res.data[state.props.item] : res.data; + // 处理合并 + if (state.spanMethod){ + state.spanMethod() + } // 设置分页信息中的总数据条数 state.pagination!.total = state.isPage ? res.data[state.props.totalCount] : 0; } catch (err: any) { @@ -233,6 +245,7 @@ export function useTable(options?: BasicTableProps) { background: 'var(--el-table-row-hover-bg-color)', color: 'var(--el-text-color-primary)', }, + rowStyle: { textAlign: 'center' }, }; return { diff --git a/src/views/gen/table/index.vue b/src/views/gen/table/index.vue index 444fc65426872d576da4317e5fe89f7c0cf50568..166a12ebc599b05b832d4a74e437ab0c6b000433 100644 --- a/src/views/gen/table/index.vue +++ b/src/views/gen/table/index.vue @@ -92,7 +92,9 @@ onMounted(() => { list().then((res) => { datasourceList.value = res.data; // 默认去第一个数据源 - state.queryForm.dsName =datasourceList.value.length>0?datasourceList.value[0].name:state.queryForm.dsName; + if (datasourceList.value.length > 0) { + state.queryForm.dsName = datasourceList.value[0].name; + } getDataList(); }); });