修复模板报错,整理模板
This commit is contained in:
parent
4dcad4a403
commit
0c27fb620f
@ -202,40 +202,33 @@
|
||||
import { onMounted, reactive, ref } from 'vue';
|
||||
import { ElMessageBox, ElMessage } from "element-plus";
|
||||
import { useUserInfo } from '/@@/stores/userInfo';
|
||||
|
||||
import { VxeGridInstance, VxeGridListeners, VxeGridPropTypes } from 'vxe-table';
|
||||
import { useVxeTable } from '/@@/hooks/useVxeTableOptionsHook';
|
||||
import { Local } from '/@@/utils/storage';
|
||||
import { auth } from '/@@/utils/authFunction';
|
||||
import EditDialog from '/@@/views/@(@Model.PagePath)/@(@Model.LowerClassName)/component/editDialog.vue';
|
||||
import ModifyRecord from '/@@/components/table/modifyRecord.vue';
|
||||
|
||||
@if(@Model.TableField.Any(x=>x.EffectType == "DatePicker")){
|
||||
@:// 日历控件
|
||||
@:import { formatDate } from '/@@/utils/formatTime';
|
||||
}
|
||||
|
||||
@if(@Model.PrintType != "off"){
|
||||
@:// 推荐设置操作 width 为 200
|
||||
@://打印控件
|
||||
@:import { hiprint } from 'vue-plugin-hiprint';
|
||||
@:import { SysPrintApi } from '/@@/api-services/api';
|
||||
@:import { SysPrint } from '/@@/api-services/models';
|
||||
}
|
||||
// 子窗口
|
||||
@if(@Model.PrintType != "off") {
|
||||
@:import { SysPrintApi } from '/@@/api-monkey/api';
|
||||
@:import { SysPrint } from '/@@/api-monkey/models';
|
||||
@:import PrintDialog from '/@@/views/system/print/component/hiprint/preview.vue';
|
||||
}
|
||||
import EditDialog from '/@@/views/@(@Model.PagePath)/@(@Model.LowerClassName)/component/editDialog.vue';
|
||||
import ModifyRecord from '/@@/components/table/modifyRecord.vue';
|
||||
|
||||
@if (@Model.IsApiService) {
|
||||
// 接口函数
|
||||
@://接口控件
|
||||
@:import { getAPI } from '/@@/utils/axios-utils';
|
||||
|
||||
// 接口
|
||||
@:import { @(@Model.ClassName)Api } from '/@@/api-services/api';
|
||||
|
||||
// 模型
|
||||
@:import { @(@Model.ClassName), @(@Model.ClassName)Input, @(@Model.ClassName)Output } from '/@@/api-services/models';
|
||||
|
||||
} else {
|
||||
//下面这个是废弃的
|
||||
@:import { page@(@Model.ClassName), delete@(@Model.ClassName), get@(@Model.ClassName)TotalSum } from '/@@/api/@(@Model.PagePath)/@(@Model.LowerClassName)';
|
||||
foreach (var column in Model.QueryWhetherList){
|
||||
if(@column.EffectType == "ForeignKey"){
|
||||
@ -247,24 +240,26 @@ foreach (var column in Model.QueryWhetherList){
|
||||
}
|
||||
}
|
||||
|
||||
// 子窗口对象
|
||||
//基础变量
|
||||
const xGrid = ref<VxeGridInstance>();
|
||||
@if(@Model.PrintType != "off") {
|
||||
@:const printDialogRef = ref<InstanceType<typeof PrintDialog>>();
|
||||
}
|
||||
const editDialogRef = ref<InstanceType<typeof EditDialog>>();
|
||||
const userStore = useUserInfo();
|
||||
|
||||
@if(@Model.PrintType != "off") {
|
||||
@://打印控件
|
||||
@:const printDialogRef = ref<InstanceType<typeof PrintDialog>>();
|
||||
}
|
||||
@if(@Model.TableField.Any(x=>x.EffectType == "ConstSelector")){
|
||||
@://常量控件
|
||||
@:const codeToName = userStore.codeToName;
|
||||
}
|
||||
@if(@Model.TableField.Any(x=>x.EffectType == "DictSelector") || @Model.TableField.Any(x=>x.EffectType == "EnumSelector")){
|
||||
@//字典枚举控件
|
||||
@:const dc = userStore.getDictItemByValue;
|
||||
@:const dv = userStore.getDictItemByLabel;
|
||||
@:const dl = userStore.getDictDataByCode;
|
||||
}
|
||||
|
||||
// 变量
|
||||
// 变量赋值
|
||||
const state = reactive({
|
||||
showAdvanceQueryUI: false,
|
||||
queryParams: {
|
||||
@ -339,7 +334,7 @@ const checkTableColumnVisible = (tableColumnName: any) => {
|
||||
}
|
||||
}
|
||||
@if(@Model.TableField.Any(t => t.ColumnName == "CreateTime") && @Model.TableField.Any(t => t.ColumnName == "UpdateTime") && @Model.TableField.Any(t => t.ColumnName == "CreateUserId")){
|
||||
@:{ title: '修改记录', width: 100, showOverflow: 'tooltip', slots: { default: 'row_record' } },
|
||||
@:{ field: 'record', title: '修改记录', width: 100, showOverflow: 'tooltip', slots: { default: 'row_record' } },
|
||||
}
|
||||
{ field: 'buttons', title: '操作', fixed: 'right', width: 180, showOverflow: true, slots: { default: 'row_buttons' } },
|
||||
],
|
||||
@ -427,6 +422,7 @@ const listhandleQuery= async (qparams: any) => {
|
||||
if(qparams) state.queryParams=qparams;
|
||||
await handleQuery(true);
|
||||
};
|
||||
|
||||
// 重置操作
|
||||
const resetQuery = async () => {
|
||||
state.queryParams.searchKey = undefined;
|
||||
@ -569,13 +565,3 @@ const listClick = (row: any,column:any) => {
|
||||
defineExpose({ listhandleQuery });
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
:deep(.el-input),
|
||||
:deep(.el-select),
|
||||
:deep(.el-input-number) {
|
||||
width: 100%;
|
||||
}
|
||||
:deep(.el-slider .el-input-number){
|
||||
width: auto;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -179,9 +179,9 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
<!-- <template #row_record="{ row }">
|
||||
<template #row_record="{ row }">
|
||||
<ModifyRecord :data="row" />
|
||||
</template> -->
|
||||
</template>
|
||||
<template #row_buttons="{ row }">
|
||||
@if(@Model.PrintType != "off") {
|
||||
<el-tooltip content="打印" placement="top">
|
||||
@ -203,43 +203,34 @@
|
||||
<EditDialog ref="editDialogRef" :title="state.title" @@reloadTable="handleQuery" />
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup name="@(@Model.LowerClassName)list">
|
||||
<script lang="ts" setup name="@(@Model.LowerClassName)">
|
||||
import { onMounted, reactive, ref } from 'vue';
|
||||
import { ElMessageBox, ElMessage } from "element-plus";
|
||||
import { useUserInfo } from '/@@/stores/userInfo';
|
||||
|
||||
import { VxeGridInstance, VxeGridListeners, VxeGridPropTypes } from 'vxe-table';
|
||||
import { useVxeTable } from '/@@/hooks/useVxeTableOptionsHook';
|
||||
import { Local } from '/@@/utils/storage';
|
||||
|
||||
@if(@Model.TableField.Any(x=>x.EffectType == "DatePicker")){
|
||||
@:import { formatDate } from '/@@/utils/formatTime';
|
||||
}
|
||||
|
||||
@if(@Model.PrintType != "off"){
|
||||
@:// 推荐设置操作 width 为 200
|
||||
@:import { hiprint } from 'vue-plugin-hiprint';
|
||||
@:import { SysPrintApi } from '/@@/api-services/api';
|
||||
@:import { SysPrint } from '/@@/api-services/models';
|
||||
}
|
||||
// 子窗口
|
||||
@if(@Model.PrintType != "off") {
|
||||
@:import PrintDialog from '/@@/views/system/print/component/hiprint/preview.vue';
|
||||
}
|
||||
import EditDialog from '/@@/views/@(@Model.PagePath)/@(@Model.LowerClassName)/component/editDialog.vue';
|
||||
import ModifyRecord from '/@@/components/table/modifyRecord.vue';
|
||||
|
||||
@if(@Model.TableField.Any(x=>x.EffectType == "DatePicker")){
|
||||
@://日期控件
|
||||
@:import { formatDate } from '/@@/utils/formatTime';
|
||||
}
|
||||
@if(@Model.PrintType != "off"){
|
||||
@:// 推荐设置操作 width 为 200
|
||||
@:import { hiprint } from 'vue-plugin-hiprint';
|
||||
@:import { SysPrintApi } from '/@@/api-monkey/api';
|
||||
@:import { SysPrint } from '/@@/api-monkey/models';
|
||||
@:import PrintDialog from '/@@/views/system/print/component/hiprint/preview.vue';
|
||||
}
|
||||
@if (@Model.IsApiService) {
|
||||
// 接口函数
|
||||
@:// 接口函数
|
||||
@:import { getAPI } from '/@@/utils/axios-utils';
|
||||
|
||||
// 接口
|
||||
@:import { @(@Model.ClassName)Api } from '/@@/api-services/api';
|
||||
|
||||
// 模型
|
||||
@:import { @(@Model.ClassName), @(@Model.ClassName)Input, @(@Model.ClassName)Output } from '/@@/api-services/models';
|
||||
|
||||
} else {
|
||||
@://HJ: 废弃,没有使用和适配
|
||||
@:import { treelist@(@Model.ClassName), delete@(@Model.ClassName) } from '/@@/api/@(@Model.PagePath)/@(@Model.LowerClassName)';
|
||||
@:import { @(@Model.ClassName) } from '/@@/api/models/@(@Model.LowerClassName)';
|
||||
foreach (var column in Model.QueryWhetherList){
|
||||
@ -251,15 +242,13 @@ foreach (var column in Model.QueryWhetherList){
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 子窗口对象
|
||||
const xGrid = ref<VxeGridInstance>();
|
||||
const editDialogRef = ref<InstanceType<typeof EditDialog>>();
|
||||
const userStore = useUserInfo();
|
||||
@if(@Model.PrintType != "off") {
|
||||
@:const printDialogRef = ref<InstanceType<typeof PrintDialog>>();
|
||||
}
|
||||
const editDialogRef = ref<InstanceType<typeof EditDialog>>();
|
||||
const userStore = useUserInfo();
|
||||
|
||||
@if(@Model.TableField.Any(x=>x.EffectType == "ConstSelector")){
|
||||
@:const codeToName = userStore.codeToName;
|
||||
}
|
||||
@ -269,7 +258,7 @@ const userStore = useUserInfo();
|
||||
@:const dl = userStore.getDictDataByCode;
|
||||
}
|
||||
|
||||
// 变量
|
||||
// 变量初始化
|
||||
const state = reactive({
|
||||
showAdvanceQueryUI: false,
|
||||
treeData: [] as Array<@(@Model.ClassName)>, // 树所有数据
|
||||
@ -343,9 +332,9 @@ const checkTableColumnVisible = (tableColumnName: any) => {
|
||||
}
|
||||
}
|
||||
@if(@Model.TableField.Any(t => t.ColumnName == "CreateTime") && @Model.TableField.Any(t => t.ColumnName == "UpdateTime") && @Model.TableField.Any(t => t.ColumnName == "CreateUserId")){
|
||||
@:{ title: '修改记录', width: 100, showOverflow: 'tooltip', slots: { default: 'row_record' } },
|
||||
@:{ field: 'record',title: '修改记录', width: 100, showOverflow: 'tooltip', slots: { default: 'row_record' } },
|
||||
}
|
||||
{ title: '操作', fixed: 'right', width: 180, showOverflow: true, slots: { default: 'row_buttons' } },
|
||||
{ field: 'buttons',title: '操作', fixed: 'right', width: 180, showOverflow: true, slots: { default: 'row_buttons' } },
|
||||
],
|
||||
},
|
||||
// vxeGrid配置参数(此处可覆写任何参数),参考vxe-table官方文档
|
||||
@ -393,12 +382,14 @@ const handleQuery = async (updateTree: boolean = false) => {
|
||||
options.loading = false;
|
||||
// 是否更新左侧树
|
||||
if (updateTree == true) {
|
||||
emits('list-reload');
|
||||
//HJ 暂无该功能 emits('list-reload');
|
||||
}
|
||||
// 若无选择节点并且查询条件为空时,更新编辑页面机构列表树
|
||||
if (state.queryParams.id == 0 && state.queryParams.name == undefined && state.queryParams.code == undefined && state.queryParams.type == undefined && updateTree == false)
|
||||
state.treeData = res.data.result ?? [];
|
||||
};
|
||||
|
||||
// 列表点击事件
|
||||
const listhandleQuery= async (qparams: any,key:string,val:any) => {
|
||||
console.log('listhandleQuery--', JSON.stringify(qparams));
|
||||
state.key=key;
|
||||
@ -406,6 +397,7 @@ const listhandleQuery= async (qparams: any,key:string,val:any) => {
|
||||
if(qparams) state.queryParams=qparams;
|
||||
await handleQuery(true);
|
||||
};
|
||||
|
||||
// 重置操作
|
||||
const resetQuery = async () => {
|
||||
state.queryParams.searchKey = undefined;
|
||||
@ -483,6 +475,7 @@ const handleDelete = (row: any) => {
|
||||
})
|
||||
.catch(() => {});
|
||||
};
|
||||
|
||||
// 表格事件
|
||||
@if (@Model.IsApiService) {
|
||||
@:const gridEvents: VxeGridListeners<@(@Model.ClassName)> = {
|
||||
@ -537,6 +530,7 @@ const handleDelete = (row: any) => {
|
||||
@:get@(@column.FkEntityName)TreeData();
|
||||
}
|
||||
}
|
||||
|
||||
// 全部展开
|
||||
const handleExpand = () => {
|
||||
xGrid.value?.setAllTreeExpand(true);
|
||||
@ -546,22 +540,13 @@ const handleExpand = () => {
|
||||
const handleFold = () => {
|
||||
xGrid.value?.clearTreeExpand();
|
||||
};
|
||||
|
||||
// 与父组件的交互逻辑
|
||||
const emits = defineEmits(['list-click']);
|
||||
const listClick = (row: any,column:any) => {
|
||||
emits('list-click', row,column);
|
||||
};
|
||||
|
||||
// 将属性或者函数暴露给父组件
|
||||
defineExpose({ listhandleQuery });
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
:deep(.el-input),
|
||||
:deep(.el-select),
|
||||
:deep(.el-input-number) {
|
||||
width: 100%;
|
||||
}
|
||||
:deep(.el-slider .el-input-number){
|
||||
width: auto;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -134,7 +134,7 @@
|
||||
@::src="state.ruleForm.@(@column.LowerPropertyName)"
|
||||
@:@@click="state.ruleForm.@(@column.LowerPropertyName)=''"
|
||||
@:style="width: 100%; height: 100%; object-fit: contain"/>
|
||||
@:<el-icon v-else><Plus /></el-icon>
|
||||
@:<el-icon v-else></el-icon>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@ -170,35 +170,25 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
:deep(.el-select),
|
||||
:deep(.el-input-number) {
|
||||
width: 100%;
|
||||
}
|
||||
:deep(.el-slider .el-input-number){
|
||||
width: auto;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script lang="ts" setup>
|
||||
<script lang="ts" setup name="@(@Model.LowerClassName)">
|
||||
import { ref,onMounted, reactive } from "vue";
|
||||
import { ElMessage } from "element-plus";
|
||||
import type { FormRules } from "element-plus";
|
||||
import { useUserInfo } from '/@@/stores/userInfo';
|
||||
|
||||
//HJ:添加富文本插件
|
||||
@if(@Model.TableField.Any(x=>x.EffectType == "RichTextEditor")){
|
||||
@://HJ:添加富文本插件
|
||||
@:import Editor from '/@@/components/editor/index.vue';
|
||||
}
|
||||
|
||||
@if (@Model.IsApiService) {
|
||||
// 接口函数
|
||||
@://接口控件
|
||||
@:import { getAPI } from '/@@/utils/axios-utils';
|
||||
// 接口
|
||||
@:import { @(@Model.ClassName)Api } from '/@@/api-services/api';
|
||||
// 模型
|
||||
@:import { Update@(@Model.ClassName)Input } from '/@@/api-services/models';
|
||||
} else {
|
||||
}
|
||||
else{
|
||||
@://HJ:废弃,不要用这个接口 Begin
|
||||
@:import {
|
||||
@if(Model.RemoteVerify){
|
||||
@:exists@(RemoteField),
|
||||
@ -212,14 +202,16 @@ import { useUserInfo } from '/@@/stores/userInfo';
|
||||
@:add@(@Model.ClassName),
|
||||
@:update@(@Model.ClassName),
|
||||
@:detail@(@Model.ClassName) } from "/@@/api/@(@Model.PagePath)/@(@Model.LowerClassName)";
|
||||
|
||||
if(@Model.TableField.Any(x=>x.EffectType == "Upload")){
|
||||
@:import { Plus } from "@@element-plus/icons-vue";
|
||||
@:import { UploadRequestOptions } from "element-plus";
|
||||
@:import { @string.Join(",",Model.TableField.Where(x=>x.EffectType == "Upload").Select(x=>"upload"+x.PropertyName).ToList()) } from '/@@/api/@(@Model.PagePath)/@(@Model.LowerClassName)';
|
||||
}
|
||||
@://HJ:废弃,不要用这个接口 END
|
||||
}
|
||||
|
||||
@if(@Model.TableField.Any(x=>x.EffectType == "DatePicker")){
|
||||
@://日期控件
|
||||
@:import { formatDate } from '/@@/utils/formatTime';
|
||||
}
|
||||
@foreach (var column in Model.TableField){
|
||||
@ -228,6 +220,7 @@ if(@column.EffectType == "ApiTreeSelector" && !definedObjects.ContainsKey("impor
|
||||
}
|
||||
}
|
||||
@if(@Model.TableField.Any(x=>x.EffectType == "EnumSelector")){
|
||||
@://枚举控件
|
||||
@:import { SysEnumApi } from '/@@/api-services/api';
|
||||
}
|
||||
|
||||
|
||||
@ -25,10 +25,9 @@
|
||||
|
||||
<script lang="ts" setup name="@(@Model.LowerClassName)">
|
||||
import { onMounted, reactive, ref } from 'vue';
|
||||
import { ElMessageBox, ElMessage } from "element-plus";
|
||||
import IndexList from '/@@/views/@(@Model.PagePath)/@(@Model.LowerClassName)/component/@(@Model.LowerClassName)List.vue';
|
||||
const indexListRef = ref<InstanceType<typeof IndexList>>();
|
||||
// 变量
|
||||
// 变量初始化
|
||||
const state = reactive({
|
||||
queryParams: {
|
||||
searchKey: undefined,
|
||||
@ -39,10 +38,9 @@ const state = reactive({
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 页面初始化
|
||||
// 页面初始化,列表控件初始化不请求数据,这里要请求一下
|
||||
onMounted(() => {
|
||||
indexListRef.value?.listhandleQuery(state.queryParams);//列表控件初始化不请求数据,这里要请求一下
|
||||
indexListRef.value?.listhandleQuery(state.queryParams);
|
||||
});
|
||||
// 主表List组件点击
|
||||
const handleIndexChange = async (row: any,column: any) => {
|
||||
@ -51,13 +49,3 @@ const handleIndexChange = async (row: any,column: any) => {
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
:deep(.el-input),
|
||||
:deep(.el-select),
|
||||
:deep(.el-input-number) {
|
||||
width: 100%;
|
||||
}
|
||||
:deep(.el-slider .el-input-number){
|
||||
width: auto;
|
||||
}
|
||||
</style>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user