🔨 添加排序字段.
This commit is contained in:
@@ -3,12 +3,14 @@
|
|||||||
search-input-placeholder="输入搜索值"
|
search-input-placeholder="输入搜索值"
|
||||||
:create-card-position="false"
|
:create-card-position="false"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
:field-config="fieldConfig"
|
:field-config="cardFieldConfig"
|
||||||
:list="list"
|
:list="list"
|
||||||
:pagination="pagination"
|
:pagination="pagination"
|
||||||
:card-layout-cols="cardColLayout"
|
:card-layout-cols="cardColLayout"
|
||||||
:filter-count="filterCount"
|
:filter-count="filterCount"
|
||||||
:add-permission="['${package.ModuleName}:${typeHyphen}:create']"
|
:add-permission="['${package.ModuleName}:${typeHyphen}:create']"
|
||||||
|
:query-order="queryOrder"
|
||||||
|
:fields-hook="fieldsHook"
|
||||||
@add="emits('openAdd')"
|
@add="emits('openAdd')"
|
||||||
@reset="reset"
|
@reset="reset"
|
||||||
@search="fetchCardData"
|
@search="fetchCardData"
|
||||||
@@ -118,26 +120,29 @@
|
|||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { ${vue.featureEntity}QueryRequest, ${vue.featureEntity}QueryResponse } from '@/api/${vue.module}/${vue.feature}';
|
import type { ${vue.featureEntity}QueryRequest, ${vue.featureEntity}QueryResponse } from '@/api/${vue.module}/${vue.feature}';
|
||||||
import { useCardPagination, useCardColLayout } from '@/hooks/card';
|
import { useCardPagination, useCardColLayout, useCardFieldConfig } from '@/hooks/card';
|
||||||
import { computed, reactive, ref, onMounted } from 'vue';
|
import { computed, reactive, ref, onMounted } from 'vue';
|
||||||
import useLoading from '@/hooks/loading';
|
import useLoading from '@/hooks/loading';
|
||||||
import { objectTruthKeyCount, resetObject } from '@/utils';
|
import { objectTruthKeyCount, resetObject } from '@/utils';
|
||||||
import fieldConfig from '../types/card.fields';
|
import fieldConfig from '../types/card.fields';
|
||||||
#if($dictMap.entrySet().size() > 0)
|
#if($dictMap.entrySet().size() > 0)
|
||||||
import { #foreach($entry in ${dictMap.entrySet()})${entry.value.keyField}#if($foreach.hasNext), #end#end } from '../types/const';
|
import { TableName, #foreach($entry in ${dictMap.entrySet()})${entry.value.keyField}#if($foreach.hasNext), #end#end } from '../types/const';
|
||||||
#else
|
#else
|
||||||
import {} from '../types/const';
|
import { TableName } from '../types/const';
|
||||||
#end
|
#end
|
||||||
import { delete${vue.featureEntity}, get${vue.featureEntity}Page } from '@/api/${vue.module}/${vue.feature}';
|
import { delete${vue.featureEntity}, get${vue.featureEntity}Page } from '@/api/${vue.module}/${vue.feature}';
|
||||||
import { Message, Modal } from '@arco-design/web-vue';
|
import { Message, Modal } from '@arco-design/web-vue';
|
||||||
#if($dictMap.entrySet().size() > 0)
|
#if($dictMap.entrySet().size() > 0)
|
||||||
import { useDictStore } from '@/store';
|
import { useDictStore } from '@/store';
|
||||||
#end
|
#end
|
||||||
|
import { useQueryOrder, ASC } from '@/hooks/query-order';
|
||||||
|
|
||||||
const emits = defineEmits(['openAdd', 'openUpdate']);
|
const emits = defineEmits(['openAdd', 'openUpdate']);
|
||||||
|
|
||||||
const cardColLayout = useCardColLayout();
|
const cardColLayout = useCardColLayout();
|
||||||
const pagination = useCardPagination();
|
const pagination = useCardPagination();
|
||||||
|
const queryOrder = useQueryOrder(TableName, ASC);
|
||||||
|
const { cardFieldConfig, fieldsHook } = useCardFieldConfig(TableName, fieldConfig);
|
||||||
const { loading, setLoading } = useLoading();
|
const { loading, setLoading } = useLoading();
|
||||||
#if($dictMap.entrySet().size() > 0)
|
#if($dictMap.entrySet().size() > 0)
|
||||||
const { toOptions, getDictValue } = useDictStore();
|
const { toOptions, getDictValue } = useDictStore();
|
||||||
@@ -198,7 +203,7 @@
|
|||||||
const doFetchCardData = async (request: ${vue.featureEntity}QueryRequest) => {
|
const doFetchCardData = async (request: ${vue.featureEntity}QueryRequest) => {
|
||||||
try {
|
try {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
const { data } = await get${vue.featureEntity}Page(request);
|
const { data } = await get${vue.featureEntity}Page(queryOrder.markOrderly(request));
|
||||||
list.value = data.rows;
|
list.value = data.rows;
|
||||||
pagination.total = data.total;
|
pagination.total = data.total;
|
||||||
pagination.current = request.page;
|
pagination.current = request.page;
|
||||||
|
|||||||
@@ -75,6 +75,11 @@
|
|||||||
</a-button>
|
</a-button>
|
||||||
</a-popconfirm>
|
</a-popconfirm>
|
||||||
#end
|
#end
|
||||||
|
<!-- 调整 -->
|
||||||
|
<table-adjust :columns="columns"
|
||||||
|
:columns-hook="columnsHook"
|
||||||
|
:query-order="queryOrder"
|
||||||
|
@query="fetchTableData" />
|
||||||
</a-space>
|
</a-space>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -87,7 +92,7 @@
|
|||||||
#end
|
#end
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
:columns="columns"
|
:columns="tableColumns"
|
||||||
#if($vue.enableRowSelection)
|
#if($vue.enableRowSelection)
|
||||||
:row-selection="rowSelection"
|
:row-selection="rowSelection"
|
||||||
#end
|
#end
|
||||||
@@ -146,25 +151,29 @@
|
|||||||
import useLoading from '@/hooks/loading';
|
import useLoading from '@/hooks/loading';
|
||||||
import columns from '../types/table.columns';
|
import columns from '../types/table.columns';
|
||||||
#if($dictMap.entrySet().size() > 0)
|
#if($dictMap.entrySet().size() > 0)
|
||||||
import { #foreach($entry in ${dictMap.entrySet()})${entry.value.keyField}#if($foreach.hasNext), #end#end } from '../types/const';
|
import { TableName, #foreach($entry in ${dictMap.entrySet()})${entry.value.keyField}#if($foreach.hasNext), #end#end } from '../types/const';
|
||||||
#else
|
#else
|
||||||
import {} from '../types/const';
|
import { TableName } from '../types/const';
|
||||||
#end
|
#end
|
||||||
#if($vue.enableRowSelection)
|
#if($vue.enableRowSelection)
|
||||||
import { useTablePagination, useRowSelection } from '@/hooks/table';
|
import { useTablePagination, useRowSelection, useTableColumns } from '@/hooks/table';
|
||||||
#else
|
#else
|
||||||
import { useTablePagination } from '@/hooks/table';
|
import { useTablePagination, useTableColumns } from '@/hooks/table';
|
||||||
#end
|
#end
|
||||||
#if($dictMap.entrySet().size() > 0)
|
#if($dictMap.entrySet().size() > 0)
|
||||||
import { useDictStore } from '@/store';
|
import { useDictStore } from '@/store';
|
||||||
#end
|
#end
|
||||||
|
import { useQueryOrder, ASC } from '@/hooks/query-order';
|
||||||
|
import TableAdjust from '@/components/app/table-adjust/index.vue';
|
||||||
|
|
||||||
const emits = defineEmits(['openAdd', 'openUpdate']);
|
const emits = defineEmits(['openAdd', 'openUpdate']);
|
||||||
|
|
||||||
const pagination = useTablePagination();
|
|
||||||
#if($vue.enableRowSelection)
|
#if($vue.enableRowSelection)
|
||||||
const rowSelection = useRowSelection();
|
const rowSelection = useRowSelection();
|
||||||
#end
|
#end
|
||||||
|
const pagination = useTablePagination();
|
||||||
|
const queryOrder = useQueryOrder(TableName, ASC);
|
||||||
|
const { tableColumns, columnsHook } = useTableColumns(TableName, columns);
|
||||||
const { loading, setLoading } = useLoading();
|
const { loading, setLoading } = useLoading();
|
||||||
#if($dictMap.entrySet().size() > 0)
|
#if($dictMap.entrySet().size() > 0)
|
||||||
const { toOptions, getDictValue } = useDictStore();
|
const { toOptions, getDictValue } = useDictStore();
|
||||||
@@ -227,7 +236,7 @@
|
|||||||
const doFetchTableData = async (request: ${vue.featureEntity}QueryRequest) => {
|
const doFetchTableData = async (request: ${vue.featureEntity}QueryRequest) => {
|
||||||
try {
|
try {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
const { data } = await get${vue.featureEntity}Page(request);
|
const { data } = await get${vue.featureEntity}Page(queryOrder.markOrderly(request));
|
||||||
tableRenderData.value = data.rows;
|
tableRenderData.value = data.rows;
|
||||||
pagination.total = data.total;
|
pagination.total = data.total;
|
||||||
pagination.current = request.page;
|
pagination.current = request.page;
|
||||||
|
|||||||
Reference in New Issue
Block a user