vue生成模版增加list查询条件初始化
This commit is contained in:
@@ -94,7 +94,7 @@ if(table.isTreeEntity){
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup name="${compNamePrefix}List">
|
<script lang="ts" setup name="${compNamePrefix}List">
|
||||||
import { unref<% if(toBoolean(table.optionMap['isImportExport'])){ %>, ref<% } %><% if(table.isTreeEntity || isNotBlank(table.optionMap['leftTreeRightTableFk'])){ %>, watch<% }
|
import { onMounted<% if(toBoolean(table.optionMap['isImportExport'])){ %>, ref<% } %>, unref<% if(table.isTreeEntity || isNotBlank(table.optionMap['leftTreeRightTableFk'])){ %>, watch<% }
|
||||||
%><% if(table.isTreeEntity){ %>, nextTick<% } %> } from 'vue';
|
%><% if(table.isTreeEntity){ %>, nextTick<% } %> } from 'vue';
|
||||||
<% if(@StringUtils.contains(table.tplCategory, '_route')) { %>
|
<% if(@StringUtils.contains(table.tplCategory, '_route')) { %>
|
||||||
import { useEmitter } from '@jeesite/core/store/modules/user';
|
import { useEmitter } from '@jeesite/core/store/modules/user';
|
||||||
@@ -111,6 +111,7 @@ if(table.isTreeEntity){
|
|||||||
import { router } from '@jeesite/core/router';
|
import { router } from '@jeesite/core/router';
|
||||||
import { Icon } from '@jeesite/core/components/Icon';
|
import { Icon } from '@jeesite/core/components/Icon';
|
||||||
import { BasicTable, BasicColumn, useTable } from '@jeesite/core/components/Table';
|
import { BasicTable, BasicColumn, useTable } from '@jeesite/core/components/Table';
|
||||||
|
import { ${ClassName}, ${className}List } from '@jeesite/${moduleMinus}/api${modulePath}${subModulePath}/${funName}';
|
||||||
import { ${className}Delete, ${className}ListData } from '@jeesite/${moduleMinus}/api${modulePath}${subModulePath}/${funName}';
|
import { ${className}Delete, ${className}ListData } from '@jeesite/${moduleMinus}/api${modulePath}${subModulePath}/${funName}';
|
||||||
<% if(toBoolean(table.optionMap['isHaveDisableEnable'])){ %>
|
<% if(toBoolean(table.optionMap['isHaveDisableEnable'])){ %>
|
||||||
import { ${className}Disable, ${className}Enable } from '@jeesite/${moduleMinus}/api${modulePath}${subModulePath}/${funName}';
|
import { ${className}Disable, ${className}Enable } from '@jeesite/${moduleMinus}/api${modulePath}${subModulePath}/${funName}';
|
||||||
@@ -179,6 +180,7 @@ if(table.isTreeEntity){
|
|||||||
const { t } = useI18n('${moduleName}${subModuleNameDot}.${funName}');
|
const { t } = useI18n('${moduleName}${subModuleNameDot}.${funName}');
|
||||||
const { showMessage } = useMessage();
|
const { showMessage } = useMessage();
|
||||||
const { meta } = unref(router.currentRoute);
|
const { meta } = unref(router.currentRoute);
|
||||||
|
const record = ref<${ClassName}>({} as ${ClassName});
|
||||||
|
|
||||||
const getTitle = {
|
const getTitle = {
|
||||||
icon: meta.icon || 'i-ant-design:book-outlined',
|
icon: meta.icon || 'i-ant-design:book-outlined',
|
||||||
@@ -425,9 +427,7 @@ for(c in table.columnList){
|
|||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
const [registerTable, { reload<% if(table.isTreeEntity){ %>, expandAll, collapseAll, expandCollapse<% } %><%
|
const [registerTable, { reload<% if(table.isTreeEntity){ %>, expandAll, collapseAll, expandCollapse<% } %>, getForm }] = useTable({
|
||||||
if (table.isTreeEntity || isNotBlank(table.optionMap['leftTreeRightTableFk'])
|
|
||||||
|| toBoolean(table.optionMap['isImportExport'])){ %>, getForm<% } %> }] = useTable({
|
|
||||||
api: ${className}ListData,
|
api: ${className}ListData,
|
||||||
beforeFetch: (params) => {
|
beforeFetch: (params) => {
|
||||||
<% if(table.isTreeEntity){ %>
|
<% if(table.isTreeEntity){ %>
|
||||||
@@ -449,6 +449,12 @@ for(c in table.columnList){
|
|||||||
canResize: true,
|
canResize: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
const res = await ${className}List();
|
||||||
|
record.value = (res.${className} || {}) as ${ClassName};
|
||||||
|
await getForm().setFieldsValue(record.value);
|
||||||
|
});
|
||||||
|
|
||||||
<% if(!@StringUtils.contains(table.tplCategory, '_route')) { %>
|
<% if(!@StringUtils.contains(table.tplCategory, '_route')) { %>
|
||||||
const [register${modalOrDrawer}, { open${modalOrDrawer} }] = use${modalOrDrawer}();
|
const [register${modalOrDrawer}, { open${modalOrDrawer} }] = use${modalOrDrawer}();
|
||||||
<% } %>
|
<% } %>
|
||||||
@@ -463,7 +469,7 @@ for(c in table.columnList){
|
|||||||
'${table.optionMap['leftTreeRightTableFk']}': props.treeCodes[0],
|
'${table.optionMap['leftTreeRightTableFk']}': props.treeCodes[0],
|
||||||
});
|
});
|
||||||
<% } %>
|
<% } %>
|
||||||
reload();
|
await reload();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -511,14 +517,14 @@ for(c in table.columnList){
|
|||||||
const params = { ${idParam} };
|
const params = { ${idParam} };
|
||||||
const res = await ${className}Disable(params);
|
const res = await ${className}Disable(params);
|
||||||
showMessage(res.message);
|
showMessage(res.message);
|
||||||
handleSuccess(record);
|
await handleSuccess(record);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handleEnable(record: Recordable) {
|
async function handleEnable(record: Recordable) {
|
||||||
const params = { ${idParam} };
|
const params = { ${idParam} };
|
||||||
const res = await ${className}Enable(params);
|
const res = await ${className}Enable(params);
|
||||||
showMessage(res.message);
|
showMessage(res.message);
|
||||||
handleSuccess(record);
|
await handleSuccess(record);
|
||||||
}
|
}
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
@@ -526,11 +532,11 @@ for(c in table.columnList){
|
|||||||
const params = { ${idParam} };
|
const params = { ${idParam} };
|
||||||
const res = await ${className}Delete(params);
|
const res = await ${className}Delete(params);
|
||||||
showMessage(res.message);
|
showMessage(res.message);
|
||||||
handleSuccess(record);
|
await handleSuccess(record);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleSuccess(record: Recordable) {
|
async function handleSuccess(record: Recordable) {
|
||||||
reload({ record });
|
await reload({ record });
|
||||||
}
|
}
|
||||||
<% if(toBoolean(table.optionMap['isBpmForm'])){ %>
|
<% if(toBoolean(table.optionMap['isBpmForm'])){ %>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user