|
@ -17,192 +17,137 @@ export default { |
|
|
VueOfficeExcel, |
|
|
VueOfficeExcel, |
|
|
}, |
|
|
}, |
|
|
template: html` |
|
|
template: html` |
|
|
<el-row> |
|
|
<div v-loading="tableLoading"> |
|
|
<el-col> |
|
|
<el-row> |
|
|
<app-form |
|
|
<el-col> |
|
|
inline |
|
|
<app-form |
|
|
mode="query" |
|
|
inline |
|
|
label-position="left" |
|
|
mode="query" |
|
|
:schema="queryFromSchema" |
|
|
label-position="left" |
|
|
v-model="data.query" |
|
|
:schema="queryFromSchema" |
|
|
@submit="load" |
|
|
v-model="data.query" |
|
|
:hideButton="true" |
|
|
@submit="load" |
|
|
:isQueryForm="true" |
|
|
:hideButton="true" |
|
|
v-if="queryFromSchema" |
|
|
:isQueryForm="true" |
|
|
/> |
|
|
v-if="queryFromSchema" |
|
|
</el-col> |
|
|
/> |
|
|
</el-row> |
|
|
</el-col> |
|
|
<el-row style="padding-bottom:20px;"> |
|
|
</el-row> |
|
|
<el-col> |
|
|
<el-row style="padding-bottom:20px;"> |
|
|
<template v-for="item in buttons"> |
|
|
<el-col> |
|
|
<el-button |
|
|
<template v-for="item in buttons"> |
|
|
:class="item.meta.htmlClass??'el-button--primary'" |
|
|
<el-button |
|
|
v-if="item.meta.isTop" |
|
|
:class="item.meta.htmlClass??'el-button--primary'" |
|
|
@click="click(item,selectedRows)" |
|
|
v-if="item.meta.isTop" |
|
|
> |
|
|
@click="click(item,selectedRows)" |
|
|
<el-icon v-if="item.meta.icon"><svg-icon :name="item.meta.icon" /></el-icon> |
|
|
> |
|
|
<span>{{item.meta.title}}</span> |
|
|
<el-icon v-if="item.meta.icon"><svg-icon :name="item.meta.icon" /></el-icon> |
|
|
|
|
|
<span>{{item.meta.title}}</span> |
|
|
|
|
|
</el-button> |
|
|
|
|
|
</template> |
|
|
|
|
|
<el-button @click="click('filter',selectedRows)"> |
|
|
|
|
|
<el-icon><ep-filter /></el-icon> |
|
|
|
|
|
<span>{{$t('筛选')}}</span> |
|
|
</el-button> |
|
|
</el-button> |
|
|
</template> |
|
|
<slot name="tableButtons" :rows="selectedRows"></slot> |
|
|
<el-button @click="queryDialog=true"> |
|
|
</el-col> |
|
|
<el-icon><ep-filter /></el-icon> |
|
|
</el-row> |
|
|
<span>{{$t('高级筛选')}}</span> |
|
|
<el-row> |
|
|
</el-button> |
|
|
<el-col> |
|
|
<slot name="tableButtons" :rows="selectedRows"></slot> |
|
|
<el-scrollbar> |
|
|
</el-col> |
|
|
<el-table |
|
|
</el-row> |
|
|
ref="tableRef" |
|
|
<el-row> |
|
|
:tree-props="treeProps" |
|
|
<el-col> |
|
|
:data="tableData" |
|
|
<el-scrollbar> |
|
|
@selection-change="handleSelectionChange" |
|
|
<el-table |
|
|
@sort-change="sortChange" |
|
|
ref="tableRef" |
|
|
:header-cell-class-name="getClass" |
|
|
:v-loading="tableLoading" |
|
|
row-key="id" |
|
|
:tree-props="treeProps" |
|
|
table-layout="auto" |
|
|
:data="tableData" |
|
|
border |
|
|
@selection-change="handleSelectionChange" |
|
|
fit |
|
|
@sort-change="sortChange" |
|
|
> |
|
|
:header-cell-class-name="getClass" |
|
|
<el-table-column fixed="left" type="selection" /> |
|
|
row-key="id" |
|
|
<el-table-column type="index" :label="$t('rowIndex')"> |
|
|
table-layout="auto" |
|
|
<template #default="scope"> {{ (data.pageIndex - 1) * data.pageSize + scope.$index + 1 }} </template> |
|
|
border |
|
|
</el-table-column> |
|
|
fit |
|
|
<template v-for="(item,key) in tableSchema.properties"> |
|
|
> |
|
|
<template v-if="key==='properties'"> |
|
|
<el-table-column fixed="left" type="selection" /> |
|
|
<el-table-column :label="subKey" v-for="(subItem,subKey) in item.properties"> |
|
|
<el-table-column type="index" :label="$t('rowIndex')"> |
|
|
<template #default="scope">{{ scope.row[key][subKey] }} </template> |
|
|
<template #default="scope"> {{ (data.pageIndex - 1) * data.pageSize + scope.$index + 1 }} </template> |
|
|
</el-table-column> |
|
|
</el-table-column> |
|
|
</template> |
|
|
<template v-for="(item,key) in tableSchema.properties"> |
|
|
<template v-else-if="item.navigation"> |
|
|
<template v-if="key==='properties'"> |
|
|
<el-table-column :prop="key" :label="item.title"> |
|
|
<el-table-column :label="subKey" v-for="(subItem,subKey) in item.properties"> |
|
|
<template #default="scope">{{getProp(scope.row,item.navigation)}}</template> |
|
|
<template #default="scope">{{ scope.row[key][subKey] }} </template> |
|
|
</el-table-column> |
|
|
</el-table-column> |
|
|
</template> |
|
|
</template> |
|
|
<template v-else-if="item.oneToMany"> |
|
|
<template v-else-if="item.navigation"> |
|
|
<el-table-column :prop="key" :label="item.title"> |
|
|
<el-table-column :prop="key" :label="item.title"> |
|
|
|
|
|
<template #default="scope">{{getProp(scope.row,item.navigation)}}</template> |
|
|
|
|
|
</el-table-column> |
|
|
|
|
|
</template> |
|
|
|
|
|
<template v-else-if="item.oneToMany"> |
|
|
|
|
|
<el-table-column :prop="key" :label="item.title"> |
|
|
|
|
|
<template #default="scope"> |
|
|
|
|
|
<el-link type="primary" @click="showList(scope.row[key],item.oneToMany)"> |
|
|
|
|
|
<app-form-input :isReadOnly="true" :schema="item" :prop="key" v-model="scope.row" /> |
|
|
|
|
|
</el-link> |
|
|
|
|
|
</template> |
|
|
|
|
|
</el-table-column> |
|
|
|
|
|
</template> |
|
|
|
|
|
<template v-else> |
|
|
|
|
|
<template v-if="showColumn(item,key)"> |
|
|
|
|
|
<el-table-column :prop="key" sortable="custom" :sort-orders="['descending', 'ascending', null]"> |
|
|
|
|
|
<template #header="scope">{{item.title}}</template> |
|
|
|
|
|
<template #default="scope"> |
|
|
<template #default="scope"> |
|
|
<app-form-input :isReadOnly="true" :schema="item" :prop="key" v-model="scope.row" /> |
|
|
<el-link type="primary" @click="showList(scope.row[key],item.oneToMany)"> |
|
|
|
|
|
<app-form-input :isReadOnly="true" :schema="item" :prop="key" v-model="scope.row" /> |
|
|
|
|
|
</el-link> |
|
|
</template> |
|
|
</template> |
|
|
</el-table-column> |
|
|
</el-table-column> |
|
|
</template> |
|
|
</template> |
|
|
</template> |
|
|
<template v-else> |
|
|
</template> |
|
|
<template v-if="showColumn(item,key)"> |
|
|
<slot name="columns"></slot> |
|
|
<el-table-column :prop="key" sortable="custom" :sort-orders="['descending', 'ascending', null]"> |
|
|
<el-table-column fixed="right"> |
|
|
<template #header="scope">{{item.title}}</template> |
|
|
<template #header> |
|
|
<template #default="scope"> |
|
|
<el-button @click="filterDrawer = true"> |
|
|
<app-form-input :isReadOnly="true" :schema="item" :prop="key" v-model="scope.row" /> |
|
|
{{$t('operations')}} |
|
|
</template> |
|
|
<el-icon class="el-icon--right"><ep-filter /></el-icon> |
|
|
</el-table-column> |
|
|
</el-button> |
|
|
|
|
|
</template> |
|
|
|
|
|
<template #default="scope"> |
|
|
|
|
|
<div class="flex"> |
|
|
|
|
|
<template v-for="item in buttons"> |
|
|
|
|
|
<el-button |
|
|
|
|
|
:class="item.meta.htmlClass??'el-button--primary'" |
|
|
|
|
|
v-if="!item.meta.isTop" |
|
|
|
|
|
@click="click(item,[scope.row])" |
|
|
|
|
|
> |
|
|
|
|
|
<el-icon v-if="item.meta.icon"><svg-icon :name="item.meta.icon" /></el-icon> |
|
|
|
|
|
<span>{{item.meta.title}}</span> |
|
|
|
|
|
</el-button> |
|
|
|
|
|
</template> |
|
|
</template> |
|
|
<slot name="rowButtons" :rows="[scope.row]"></slot> |
|
|
</template> |
|
|
</div> |
|
|
|
|
|
</template> |
|
|
</template> |
|
|
</el-table-column> |
|
|
<slot name="columns"></slot> |
|
|
</el-table> |
|
|
<el-table-column fixed="right"> |
|
|
</el-scrollbar> |
|
|
<template #header> |
|
|
</el-col> |
|
|
<el-button @click="filterDrawer = true"> |
|
|
</el-row> |
|
|
{{$t('operations')}} |
|
|
<el-row> |
|
|
<el-icon class="el-icon--right"><ep-filter /></el-icon> |
|
|
<el-col> |
|
|
</el-button> |
|
|
<el-pagination |
|
|
</template> |
|
|
v-if="tableData.length&&data.pageSize<data.totalCount" |
|
|
<template #default="scope"> |
|
|
v-model:currentPage="data.pageIndex" |
|
|
<div class="flex"> |
|
|
v-model:page-size="data.pageSize" |
|
|
<template v-for="item in buttons"> |
|
|
:total="data.totalCount" |
|
|
<el-button |
|
|
:page-sizes="[20, 50, 100]" |
|
|
:class="item.meta.htmlClass??'el-button--primary'" |
|
|
class="justify-end" |
|
|
v-if="!item.meta.isTop" |
|
|
:background="true" |
|
|
@click="click(item,[scope.row])" |
|
|
layout="total, sizes, prev, pager, next, jumper" |
|
|
> |
|
|
@size-change="onPageSizeChange" |
|
|
<el-icon v-if="item.meta.icon"><svg-icon :name="item.meta.icon" /></el-icon> |
|
|
@current-change="onPageIndexChange" |
|
|
<span>{{item.meta.title}}</span> |
|
|
style="margin-top:20px" |
|
|
</el-button> |
|
|
/> |
|
|
</template> |
|
|
</el-col> |
|
|
<slot name="rowButtons" :rows="[scope.row]"></slot> |
|
|
</el-row> |
|
|
</div> |
|
|
<el-dialog v-model="queryDialog" align-center destroy-on-close> |
|
|
</template> |
|
|
<template #header> <span class="el-dialog__title"> {{$t('高级筛选')}} </span> </template> |
|
|
</el-table-column> |
|
|
<el-row> |
|
|
</el-table> |
|
|
<el-col style="max-height:calc(100vh - 180px );"> |
|
|
|
|
|
<el-scrollbar> |
|
|
|
|
|
<el-row :gutter="20" v-for="(item,index) in queryList" style="margin-top:20px;"> |
|
|
|
|
|
<el-col :span="6"> |
|
|
|
|
|
<el-select v-model="item.property" :placeholder="$t('字段')"> |
|
|
|
|
|
<el-option v-for="(value, prop) in queryFromSchema.properties">{{value.title}}</el-option> |
|
|
|
|
|
</el-select> |
|
|
|
|
|
</el-col> |
|
|
|
|
|
<el-col :span="6"> |
|
|
|
|
|
<el-select v-model="item.operator" :placeholder="$t('操作符')"> |
|
|
|
|
|
<el-option>{{$t('等于')}}</el-option> |
|
|
|
|
|
<el-option>{{$t('不等于')}}</el-option> |
|
|
|
|
|
<el-option>{{$t('大于')}}</el-option> |
|
|
|
|
|
<el-option>{{$t('大于等于')}}</el-option> |
|
|
|
|
|
<el-option>{{$t('小于')}}</el-option> |
|
|
|
|
|
<el-option>{{$t('小于等于')}}</el-option> |
|
|
|
|
|
<el-option>{{$t('包含')}}</el-option> |
|
|
|
|
|
<el-option>{{$t('不包含')}}</el-option> |
|
|
|
|
|
</el-select> |
|
|
|
|
|
</el-col> |
|
|
|
|
|
<el-col :span="6"> |
|
|
|
|
|
<el-input v-model="item.value" :placeholder="$t('值')" /> |
|
|
|
|
|
</el-col> |
|
|
|
|
|
<el-col :span="4"> |
|
|
|
|
|
<el-select v-model="item.logical" :placeholder="$t('关系')"> |
|
|
|
|
|
<el-option>{{$t('且')}}</el-option> |
|
|
|
|
|
<el-option>{{$t('或')}}</el-option> |
|
|
|
|
|
</el-select> |
|
|
|
|
|
</el-col> |
|
|
|
|
|
<el-col :span="2"> |
|
|
|
|
|
<el-space style="height:32px"> |
|
|
|
|
|
<el-icon class="cursor-pointer" @click="queryList.splice(index, 1)"> |
|
|
|
|
|
<ep-close /> |
|
|
|
|
|
</el-icon> |
|
|
|
|
|
</el-space> |
|
|
|
|
|
</el-col> |
|
|
|
|
|
</el-row> |
|
|
|
|
|
<el-row> |
|
|
|
|
|
<el-col> |
|
|
|
|
|
<el-space style="height:32px;"> |
|
|
|
|
|
<el-icon class="cursor-pointer" @click="pushQueryList"><ep-plus /></el-icon> |
|
|
|
|
|
</el-space> |
|
|
|
|
|
</el-col> |
|
|
|
|
|
</el-row> |
|
|
|
|
|
</el-scrollbar> |
|
|
</el-scrollbar> |
|
|
</el-col> |
|
|
</el-col> |
|
|
</el-row> |
|
|
</el-row> |
|
|
<template #footer> |
|
|
<el-row> |
|
|
<span class="dialog-footer"> |
|
|
<el-col> |
|
|
<el-button type="primary" @click="queryDialog=false"> {{$t('confirm')}} </el-button> |
|
|
<el-pagination |
|
|
</span> |
|
|
v-if="tableData.length&&data.pageSize<data.totalCount" |
|
|
</template> |
|
|
v-model:currentPage="data.pageIndex" |
|
|
</el-dialog> |
|
|
v-model:page-size="data.pageSize" |
|
|
|
|
|
:total="data.totalCount" |
|
|
|
|
|
:page-sizes="[20, 50, 100]" |
|
|
|
|
|
class="justify-end" |
|
|
|
|
|
:background="true" |
|
|
|
|
|
layout="total, sizes, prev, pager, next, jumper" |
|
|
|
|
|
@size-change="onPageSizeChange" |
|
|
|
|
|
@current-change="onPageIndexChange" |
|
|
|
|
|
style="margin-top:20px" |
|
|
|
|
|
/> |
|
|
|
|
|
</el-col> |
|
|
|
|
|
</el-row> |
|
|
|
|
|
</div> |
|
|
<el-drawer v-model="filterDrawer" destroy-on-close @close="tableRef.doLayout()"> |
|
|
<el-drawer v-model="filterDrawer" destroy-on-close @close="tableRef.doLayout()"> |
|
|
<template #header> <span class="el-dialog__title"> {{$t('filter')}} </span> </template> |
|
|
<template #header> <span class="el-dialog__title"> {{$t('filter')}} </span> </template> |
|
|
<el-scrollbar> |
|
|
<el-scrollbar> |
|
@ -245,23 +190,100 @@ export default { |
|
|
</span> |
|
|
</span> |
|
|
</template> |
|
|
</template> |
|
|
</el-drawer> |
|
|
</el-drawer> |
|
|
<el-dialog v-model="dialogVisible" align-center destroy-on-close width="700"> |
|
|
<el-dialog v-model="dialogVisible" align-center destroy-on-close v-loading="editFormloading"> |
|
|
<template #header> <span class="el-dialog__title"> {{editFormTitle}} </span> </template> |
|
|
<template #header> <span class="el-dialog__title"> {{editFormTitle}} </span> </template> |
|
|
<el-row> |
|
|
<el-row> |
|
|
<el-col style="max-height:calc(100vh - 180px );"> |
|
|
<el-col style="max-height:calc(100vh - 180px );min-height:100%;"> |
|
|
<el-scrollbar> |
|
|
<el-scrollbar> |
|
|
<app-form |
|
|
<template v-if="editFormMode==='create'||editFormMode==='update'||editFormMode==='details'"> |
|
|
v-loading="editFormloading" |
|
|
<app-form |
|
|
:disabled="editFormMode==='details'" |
|
|
:disabled="editFormMode==='details'" |
|
|
:mode="editFormMode" |
|
|
:mode="editFormMode" |
|
|
ref="editFormRef" |
|
|
ref="editFormRef" |
|
|
inline |
|
|
inline |
|
|
label-position="left" |
|
|
label-position="left" |
|
|
:hideButton="true" |
|
|
:hideButton="true" |
|
|
:schema="editFormSchema" |
|
|
:schema="editFormSchema" |
|
|
v-model="editFormModel" |
|
|
v-model="editFormModel" |
|
|
v-if="editFormMode!=='import'" |
|
|
v-if="editFormSchema&&editFormMode" |
|
|
/> |
|
|
/> |
|
|
|
|
|
</template> |
|
|
|
|
|
<template v-else-if="editFormMode==='export'"> |
|
|
|
|
|
<el-form :model="exportModel" style="height:100%;"> |
|
|
|
|
|
<el-form-item :label="$t('全部')"> |
|
|
|
|
|
<el-switch v-model="exportModel.includeAll" /> |
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
<el-form-item :label="$t('已删除')"> |
|
|
|
|
|
<el-switch v-model="exportModel.includeDeleted" /> |
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
</el-form> |
|
|
|
|
|
</template> |
|
|
|
|
|
<template v-else-if="editFormMode==='import'"> |
|
|
|
|
|
<el-form :model="exportModel" style="height:100%;"> |
|
|
|
|
|
<el-form-item :label="$t('部分成功')"> |
|
|
|
|
|
<el-switch v-model="exportModel.includeAll" /> |
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
<el-form-item :label="$t('只更新')"> |
|
|
|
|
|
<el-switch v-model="exportModel.includeDeleted" /> |
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
</el-form> |
|
|
|
|
|
</template> |
|
|
|
|
|
<template v-else-if="editFormMode==='filter'"> |
|
|
|
|
|
<el-form :model="queryList" inline> |
|
|
|
|
|
<el-row v-for="(item,index) in queryList" style="padding:10px;"> |
|
|
|
|
|
<el-col :span="6"> |
|
|
|
|
|
<el-select v-model="item.property" :placeholder="$t('字段')"> |
|
|
|
|
|
<el-option |
|
|
|
|
|
v-for="(value, prop) in queryFromSchema.properties" |
|
|
|
|
|
:value="prop" |
|
|
|
|
|
:label="value.title" |
|
|
|
|
|
/> |
|
|
|
|
|
</el-select> |
|
|
|
|
|
</el-col> |
|
|
|
|
|
<el-col :span="6"> |
|
|
|
|
|
<el-select v-model="item.operator" :placeholder="$t('操作符')"> |
|
|
|
|
|
<el-option value="{0}=@0" :label="$t('等于')" /> |
|
|
|
|
|
<el-option value="{0}!=@0" :label="$t('不等于')" /> |
|
|
|
|
|
<el-option value="{0}>@0" :label="$t('大于')" /> |
|
|
|
|
|
<el-option value="{0}>=@0" :label="$t('大于等于')" /> |
|
|
|
|
|
<el-option value="{0}<@0" :label="$t('小于')" /> |
|
|
|
|
|
<el-option value="{0}<=@0" :label="$t('小于等于')" /> |
|
|
|
|
|
<el-option value="{0}.Contains(@0)" :label="$t('包含')" /> |
|
|
|
|
|
<el-option value="{0}.StartsWith(@0)" :label="$t('开始于')" /> |
|
|
|
|
|
<el-option value="{0}.StartsWith(@0)" :label="$t('结束于')" /> |
|
|
|
|
|
</el-select> |
|
|
|
|
|
</el-col> |
|
|
|
|
|
<el-col :span="6"> |
|
|
|
|
|
<el-input v-model="item.value" :placeholder="$t('值')" /> |
|
|
|
|
|
</el-col> |
|
|
|
|
|
<el-col :span="4"> |
|
|
|
|
|
<el-select v-model="item.logic" :placeholder="$t('关系')"> |
|
|
|
|
|
<el-option value="and" :label="$t('且')" /> |
|
|
|
|
|
<el-option value="or" :label="$t('或')" /> |
|
|
|
|
|
</el-select> |
|
|
|
|
|
</el-col> |
|
|
|
|
|
<el-col :span="2"> |
|
|
|
|
|
<el-button circle @click="queryList.splice(index, 1)" style="margin-left:10px;"> |
|
|
|
|
|
<template #icon> |
|
|
|
|
|
<ep-close /> |
|
|
|
|
|
</template> |
|
|
|
|
|
</el-button> |
|
|
|
|
|
</el-col> |
|
|
|
|
|
</el-row> |
|
|
|
|
|
<el-row> |
|
|
|
|
|
<el-col> |
|
|
|
|
|
<el-button circle @click="pushQueryList" style="margin-left:10px;"> |
|
|
|
|
|
<template #icon> |
|
|
|
|
|
<ep-plus /> |
|
|
|
|
|
</template> |
|
|
|
|
|
</el-button> |
|
|
|
|
|
</el-col> |
|
|
|
|
|
</el-row> |
|
|
|
|
|
</el-form> |
|
|
|
|
|
</template> |
|
|
|
|
|
<template v-else> |
|
|
|
|
|
<slot :name="editFormMode"></slot> |
|
|
|
|
|
</template> |
|
|
</el-scrollbar> |
|
|
</el-scrollbar> |
|
|
</el-col> |
|
|
</el-col> |
|
|
</el-row> |
|
|
</el-row> |
|
@ -287,7 +309,7 @@ export default { |
|
|
const filterDrawer = ref(false); |
|
|
const filterDrawer = ref(false); |
|
|
const subDrawer = ref(false); |
|
|
const subDrawer = ref(false); |
|
|
const subListQuery = ref({}); |
|
|
const subListQuery = ref({}); |
|
|
const tableLoading = ref(false); |
|
|
const tableLoading = ref(true); |
|
|
const selectedRows = ref([]); |
|
|
const selectedRows = ref([]); |
|
|
const dialogVisible = ref(false); |
|
|
const dialogVisible = ref(false); |
|
|
const route = useRoute(); |
|
|
const route = useRoute(); |
|
@ -301,15 +323,14 @@ export default { |
|
|
const schema = ref(props.schema); |
|
|
const schema = ref(props.schema); |
|
|
const queryFromSchema = ref(null); |
|
|
const queryFromSchema = ref(null); |
|
|
const queryList = ref([]); |
|
|
const queryList = ref([]); |
|
|
const queryDialog = ref(false); |
|
|
|
|
|
const tableSchema = ref({}); |
|
|
const tableSchema = ref({}); |
|
|
const tableData = ref([]); |
|
|
const tableData = ref([]); |
|
|
const editFormRef = ref(null); |
|
|
const editFormRef = ref(null); |
|
|
const editFormloading = ref(false); |
|
|
const editFormloading = ref(false); |
|
|
const editFormMode = ref(null); |
|
|
const editFormMode = ref(null); |
|
|
const editFormTitle = ref(""); |
|
|
const editFormTitle = ref(""); |
|
|
const editFormSchema = reactive({}); |
|
|
const editFormSchema = ref(null); |
|
|
const editFormModel = reactive({}); |
|
|
const editFormModel = ref(null); |
|
|
const exportModel = reactive({ |
|
|
const exportModel = reactive({ |
|
|
includeAll: false, |
|
|
includeAll: false, |
|
|
includeDeleted: false, |
|
|
includeDeleted: false, |
|
@ -363,6 +384,7 @@ export default { |
|
|
tableLoading.value = true; |
|
|
tableLoading.value = true; |
|
|
try { |
|
|
try { |
|
|
const postData = JSON.parse(JSON.stringify(data.value)); |
|
|
const postData = JSON.parse(JSON.stringify(data.value)); |
|
|
|
|
|
postData.filters = queryList.value.filter((o) => o.property && o.value); |
|
|
delete postData.query["items"]; |
|
|
delete postData.query["items"]; |
|
|
delete postData.query["id"]; |
|
|
delete postData.query["id"]; |
|
|
const listData = (await post(url, postData)).data; |
|
|
const listData = (await post(url, postData)).data; |
|
@ -380,33 +402,28 @@ export default { |
|
|
const onPageIndexChange = async () => await load(indexUrl); |
|
|
const onPageIndexChange = async () => await load(indexUrl); |
|
|
const onPageSizeChange = async () => await load(indexUrl); |
|
|
const onPageSizeChange = async () => await load(indexUrl); |
|
|
const click = async (item, rows) => { |
|
|
const click = async (item, rows) => { |
|
|
editFormMode.value = item.path; |
|
|
editFormMode.value = item.path ?? item; |
|
|
context.emit("command", item, rows); |
|
|
context.emit("command", item, rows); |
|
|
if (item.path === "index") { |
|
|
if (item.path === "index") { |
|
|
//list
|
|
|
//list
|
|
|
await load(indexUrl); |
|
|
await load(indexUrl); |
|
|
} else if (item.path === "details") { |
|
|
} else if (item.path === "details") { |
|
|
//details
|
|
|
//details
|
|
|
const detailsUrl = `${baseUrl}/${item.path}?${qs.stringify({ id: rows[0].id })}`; |
|
|
const url = `${baseUrl}/${item.path}?${qs.stringify({ id: rows[0].id })}`; |
|
|
Object.assign(editFormSchema, schema.value.properties.items.items); |
|
|
editFormSchema.value = (await get(url)).data; |
|
|
Object.assign(editFormModel, (await post(detailsUrl)).data); |
|
|
editFormModel.value = (await post(url)).data; |
|
|
editFormTitle.value = `${t("details")}${schema.value?.title}`; |
|
|
editFormTitle.value = `${schema.value?.title}${t("details")}`; |
|
|
dialogVisible.value = true; |
|
|
dialogVisible.value = true; |
|
|
} else if (item.path === "create") { |
|
|
} else if (item.path === "create" || item.path === "update") { |
|
|
//create
|
|
|
//create
|
|
|
const url = `${baseUrl}/${item.path}`; |
|
|
let url = `${baseUrl}/${item.path}`; |
|
|
|
|
|
if (item.path === "update") { |
|
|
|
|
|
url = `${url}?${qs.stringify({ id: rows[0].id })}`; |
|
|
|
|
|
} |
|
|
const vm = (await get(url)).data; |
|
|
const vm = (await get(url)).data; |
|
|
Object.assign(editFormSchema, schema.value); |
|
|
editFormSchema.value = vm.schema; |
|
|
Object.assign(editFormModel, vm.model); |
|
|
editFormModel.value = vm.model; |
|
|
editFormTitle.value = `${t("create")}${schema.value?.title}`; |
|
|
editFormTitle.value = `${t(item.path)}${schema.value?.title}`; |
|
|
dialogVisible.value = true; |
|
|
|
|
|
} else if (item.path === "update") { |
|
|
|
|
|
//update
|
|
|
|
|
|
const url = `${baseUrl}/${item.path}`; |
|
|
|
|
|
const vm = (await get(url, { id: rows[0].id })).data; |
|
|
|
|
|
Object.assign(editFormSchema, schema.value); |
|
|
|
|
|
Object.assign(editFormModel, vm.model); |
|
|
|
|
|
editFormTitle.value = `${t("update")}${schema.value?.title}`; |
|
|
|
|
|
dialogVisible.value = true; |
|
|
dialogVisible.value = true; |
|
|
} else if (item.path === "delete") { |
|
|
} else if (item.path === "delete") { |
|
|
//delete
|
|
|
//delete
|
|
@ -421,14 +438,15 @@ export default { |
|
|
await load(indexUrl); |
|
|
await load(indexUrl); |
|
|
} else if (item.path === "export") { |
|
|
} else if (item.path === "export") { |
|
|
//export
|
|
|
//export
|
|
|
const url = `${baseUrl}/${item.path}`; |
|
|
dialogVisible.value = true; |
|
|
const exportUrl = `${url}?${qs.stringify(exportModel)}`; |
|
|
|
|
|
await load(exportUrl); |
|
|
|
|
|
} else if (item.path === "import") { |
|
|
} else if (item.path === "import") { |
|
|
//import
|
|
|
//import
|
|
|
const url = `${baseUrl}/${item.path}`; |
|
|
const url = `${baseUrl}/${item.path}`; |
|
|
editFormTitle.value = `${t("import")}${schema.value?.title}`; |
|
|
editFormTitle.value = `${t("import")}${schema.value?.title}`; |
|
|
dialogVisible.value = true; |
|
|
dialogVisible.value = true; |
|
|
|
|
|
} else if (item === "filter") { |
|
|
|
|
|
editFormTitle.value = t("自定义查询"); |
|
|
|
|
|
dialogVisible.value = true; |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
const submit = async () => { |
|
|
const submit = async () => { |
|
@ -448,7 +466,7 @@ export default { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} catch (error) { |
|
|
} catch (error) { |
|
|
console.error(error); |
|
|
console.log(error); |
|
|
} finally { |
|
|
} finally { |
|
|
editFormloading.value = false; |
|
|
editFormloading.value = false; |
|
|
} |
|
|
} |
|
@ -456,6 +474,14 @@ export default { |
|
|
await load(indexUrl); |
|
|
await load(indexUrl); |
|
|
editFormMode.value = null; |
|
|
editFormMode.value = null; |
|
|
dialogVisible.value = false; |
|
|
dialogVisible.value = false; |
|
|
|
|
|
} else if (editFormMode.value === "export") { |
|
|
|
|
|
const url = `${baseUrl}/${item.path}?${qs.stringify(exportModel)}`; |
|
|
|
|
|
// await load(exportUrl);
|
|
|
|
|
|
} else if (editFormMode.value === "filter") { |
|
|
|
|
|
alert(JSON.stringify(queryList.value)); |
|
|
|
|
|
//const url = `${baseUrl}/${item.path}?${qs.stringify(exportModel)}`;
|
|
|
|
|
|
// await load(exportUrl);
|
|
|
|
|
|
dialogVisible.value = false; |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
const showList = (value, nav) => { |
|
|
const showList = (value, nav) => { |
|
@ -483,12 +509,13 @@ export default { |
|
|
const pushQueryList = () => { |
|
|
const pushQueryList = () => { |
|
|
queryList.value.push({ |
|
|
queryList.value.push({ |
|
|
property: "", |
|
|
property: "", |
|
|
operator: "等于", |
|
|
operator: "{0}=@0", |
|
|
value: "", |
|
|
value: "", |
|
|
logical: "且", |
|
|
logic: "or", |
|
|
}); |
|
|
}); |
|
|
}; |
|
|
}; |
|
|
onMounted(async () => { |
|
|
onMounted(async () => { |
|
|
|
|
|
pushQueryList(); |
|
|
const vm = (await get(indexUrl)).data; |
|
|
const vm = (await get(indexUrl)).data; |
|
|
schema.value = vm.schema; |
|
|
schema.value = vm.schema; |
|
|
queryFromSchema.value = vm.schema.properties.query; |
|
|
queryFromSchema.value = vm.schema.properties.query; |
|
@ -512,7 +539,6 @@ export default { |
|
|
dialogVisible, |
|
|
dialogVisible, |
|
|
selectedRows, |
|
|
selectedRows, |
|
|
queryFromSchema, |
|
|
queryFromSchema, |
|
|
queryDialog, |
|
|
|
|
|
queryList, |
|
|
queryList, |
|
|
tableSchema, |
|
|
tableSchema, |
|
|
buttons, |
|
|
buttons, |
|
@ -522,6 +548,7 @@ export default { |
|
|
sortChange, |
|
|
sortChange, |
|
|
getProp, |
|
|
getProp, |
|
|
editFormRef, |
|
|
editFormRef, |
|
|
|
|
|
editFormloading, |
|
|
editFormMode, |
|
|
editFormMode, |
|
|
editFormTitle, |
|
|
editFormTitle, |
|
|
editFormSchema, |
|
|
editFormSchema, |
|
|