888 lines
32 KiB
Plaintext
888 lines
32 KiB
Plaintext
<template>
|
|
<div class="JNPF-common-layout">
|
|
@if(Model.Type == 2)
|
|
{
|
|
@:<div class="JNPF-common-layout-left">
|
|
@:<div class="JNPF-common-title">
|
|
@:<h2>@Model.TreeTitle</h2>
|
|
@:</div>
|
|
@:<el-tree :data="treeData" :props="treeProps" default-expand-all highlight-current ref="treeBox" :expand-on-click-node="false" @@node-click="handleNodeClick" class="JNPF-common-el-tree" node-key="@(@Model.TreePropsValue)">
|
|
@:<span class="custom-tree-node" slot-scope="{node,data}">
|
|
@:<i :class="data.icon"></i>
|
|
@:<span class="text">{{node.label}}</span>
|
|
@:</span>
|
|
@:</el-tree>
|
|
@:</div>
|
|
}
|
|
<div class="JNPF-common-layout-center">
|
|
<el-row class="JNPF-common-search-box" :gutter="16">
|
|
<el-form @@submit.native.prevent>
|
|
@foreach (var item in @Model.SearchColumnDesign)
|
|
{
|
|
@if(item.Index == 3)
|
|
{
|
|
@:<template v-if="showAll">
|
|
}
|
|
@:<el-col :span="6">
|
|
@:<el-form-item label="@(@item.Label)">
|
|
@if(item.QueryControlsKey != null)
|
|
{
|
|
@switch(item.QueryControlsKey)
|
|
{
|
|
case "inputList":
|
|
@:<el-input v-model="query.@(@item.Name)" placeholder="@(@item.Label)" @(@item.Clearable)/>
|
|
break;
|
|
case "dateList":
|
|
@:<el-date-picker v-model="query.@(@item.Name)" start-placeholder="开始日期" end-placeholder="结束日期" value-format="timestamp" format="yyyy-MM-dd" type="daterange" />
|
|
break;
|
|
case "selectList":
|
|
@:<el-select v-model="query.@(@item.Name)" placeholder="@(@item.Label)" @(@item.Clearable)>
|
|
@:<el-option v-for="(item, index) in @(@item.OriginalName)Options" :key="index" :label="item.@(@item.Props.label)" :value="item.@(item.Props.value)" />
|
|
@:</el-select>
|
|
break;
|
|
case "timePickerList":
|
|
@:<el-time-picker v-model="query.@(@item.Name)" start-placeholder="开始时间" end-placeholder="结束时间" @(@item.Clearable)value-format="@(@item.ValueFormat)" format="@(@item.Format)" is-range />
|
|
break;
|
|
case "numRangeList":
|
|
@:<num-range v-model="query.@(@item.Name)"></num-range>
|
|
break;
|
|
case "datePickerList":
|
|
@:<el-date-picker v-model="query.@(@item.Name)" type="@(@item.Type)range" value-format="@(@item.ValueFormat)" format="@(@item.Format)" start-placeholder="开始日期" end-placeholder="结束日期">
|
|
@:</el-date-picker>
|
|
break;
|
|
case "userSelectList":
|
|
@:<userSelect v-model="query.@(@item.Name)" placeholder="请选择@(@item.Label)" @(@item.SelectType)@(@item.IsCustomSelect ? @item.AbleDepIds + @item.AblePosIds + @item.AbleUserIds + @item.AbleRoleIds + @item.AbleGroupIds : "")/>
|
|
break;
|
|
case "usersSelectList":
|
|
@:<usersSelect v-model="query.@(@item.Name)" placeholder="请选择@(@item.Label)" @(@item.SelectType)@(@item.IsCustomSelect ? @item.AbleIds : "")/>
|
|
break;
|
|
case "organizeList":
|
|
@:<depSelect v-model="query.@(@item.Name)" placeholder="请选择@(@item.Label)" :lastLevel="false" />
|
|
break;
|
|
case "comSelectList":
|
|
@:<comSelect v-model="query.@(@item.Name)" placeholder="请选择@(@item.Label)" />
|
|
break;
|
|
case "depSelectList":
|
|
@:<depSelect v-model="query.@(@item.Name)" placeholder="请选择@(@item.Label)" @(@item.SelectType)@(@item.IsCustomSelect ? @item.AbleDepIds + @item.AblePosIds + @item.AbleUserIds + @item.AbleRoleIds + @item.AbleGroupIds : "")/>
|
|
break;
|
|
case "posSelectList":
|
|
@:<posSelect v-model="query.@(@item.Name)" placeholder="请选择@(@item.Label)" @(@item.SelectType)@(@item.IsCustomSelect ? @item.AbleDepIds + @item.AblePosIds + @item.AbleUserIds + @item.AbleRoleIds + @item.AbleGroupIds : "")/>
|
|
break;
|
|
case "useCascaderList":
|
|
@:<el-cascader v-model="query.@(@item.Name)" :options="@(@item.OriginalName)Options" @(@item.Clearable):show-all-levels="@(@item.ShowAllLevels)" :props="@(@item.OriginalName)Props" placeholder="请选择@(@item.Label)"></el-cascader>
|
|
break;
|
|
case "JNPFAddressList":
|
|
@:<JNPFAddress v-model="query.@(@item.Name)" placeholder="请选择@(@item.Label)" level="@(@item.Level)" @(@item.Clearable)/>
|
|
break;
|
|
case "treeSelectList":
|
|
@:<JNPF-TreeSelect v-model="query.@(@item.Name)" placeholder="请选择@(@item.Label)" :options="@(@item.OriginalName)Options" :props='@(@item.OriginalName)Props' @(@item.Clearable)/>
|
|
break;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
@:<@(@item.Tag) v-model="query.@(@item.Name)" placeholder="@(@item.Label)" @(@item.Clearable)/>
|
|
}
|
|
@:</el-form-item>
|
|
@:</el-col>
|
|
}
|
|
@if(Model.SearchColumnDesign.Count >= 4)
|
|
{
|
|
@:</template>
|
|
}
|
|
<el-col :span="6">
|
|
<el-form-item>
|
|
<el-button type="primary" icon="el-icon-search" @@click="search()">查询</el-button>
|
|
<el-button icon="el-icon-refresh-right" @@click="reset()">重置</el-button>
|
|
@if(Model.SearchColumnDesign.Count >= 4)
|
|
{
|
|
@:<el-button type="text" icon="el-icon-arrow-down" @@click="showAll=true" v-if="!showAll">展开</el-button>
|
|
@:<el-button type="text" icon="el-icon-arrow-up" @@click="showAll=false" v-else>收起</el-button>
|
|
}
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-form>
|
|
</el-row>
|
|
<div class="JNPF-common-layout-main JNPF-flex-main">
|
|
<div class="JNPF-common-head">
|
|
<div>
|
|
@foreach (var item in @Model.TopButtonDesign)
|
|
{
|
|
@if(Model.UseBtnPermission)
|
|
{
|
|
@:<el-button type="@(@item.Type)" icon="@(@item.Icon)" @@click="@(@item.Method)" v-has="'btn_@(@item.Value)'">@(@item.Label)</el-button>
|
|
}
|
|
else
|
|
{
|
|
@:<el-button type="@(@item.Type)" icon="@(@item.Icon)" @@click="@(@item.Method)">@(@item.Label)</el-button>
|
|
}
|
|
}
|
|
</div>
|
|
<div class="JNPF-common-head-right">
|
|
@if(Model.HasSuperQuery)
|
|
{
|
|
@:<el-tooltip content="高级查询" placement="top" >
|
|
@:<el-link icon="icon-ym icon-ym-filter JNPF-common-head-icon" :underline="false" @@click="openSuperQuery()" />
|
|
@:</el-tooltip>
|
|
}
|
|
<el-tooltip effect="dark" content="刷新" placement="top">
|
|
<el-link icon="icon-ym icon-ym-Refresh JNPF-common-head-icon" :underline="false" @@click="reset()" />
|
|
</el-tooltip>
|
|
</div>
|
|
</div>
|
|
|
|
@switch(Model.IndexDataType)
|
|
{
|
|
case 3:
|
|
@:<JNPF-table v-loading="listLoading" :data="list" @(@Model.IsSort ? "@sort-change='sortChange' ":"")@(@Model.IsBatchRemoveDel ? "has-c @selection-change='handleSelectionChange' ":"")@(@Model.IsChildTableShow ? ":span-method='arraySpanMethod' ":"") row-key="@Model.PrimaryKey" default-expand-all :tree-props="{children: 'children', hasChildren: ''}" :hasNO="false">
|
|
@:<el-table-column type="index" width="50" label="序号" align="center" @(Model.ChildTableStyle == 1 ? "fixed='left'" : "")/>
|
|
break;
|
|
default:
|
|
@:<JNPF-table v-loading="listLoading" :data="list" @(@Model.IsSort ? "@sort-change='sortChange' ":"")@(@Model.IsBatchRemoveDel ? "has-c @selection-change='handleSelectionChange' ":"")@(@Model.IsChildTableShow ? ":span-method='arraySpanMethod' ":"") :hasNO="false">
|
|
@:<el-table-column type="index" width="50" label="序号" align="center" @(Model.IsFixed ? "fixed='left'" : "")/>
|
|
break;
|
|
}
|
|
@*折叠面板优先生成子表*@
|
|
@switch(Model.ChildTableStyle)
|
|
{
|
|
case 2:
|
|
@:<el-table-column type="expand" width="40">
|
|
@:<template slot-scope="scope">
|
|
@:<el-tabs v-model="scope.row.activeName">
|
|
@foreach (var item in Model.ColumnDesign)
|
|
{
|
|
@if(item.IsChildTable)
|
|
{
|
|
@:<el-tab-pane label="@(item.Label)">
|
|
@:<el-table :data="scope.row.@(item.Name)" stripe size='mini'>
|
|
@foreach (var childs in item.ChildTableDesigns)
|
|
{
|
|
@:<el-table-column prop="@(childs.Name)" label="@(@childs.Label)" @(@Model.UseColumnPermission ? "v-if=\"jnpf.hasP('" + @item.Name + "-" + childs.Name + "')\" " : "")/>
|
|
}
|
|
@:</el-table>
|
|
@:</el-tab-pane>
|
|
}
|
|
}
|
|
@:</el-tabs>
|
|
@:</template>
|
|
@:</el-table-column>
|
|
break;
|
|
}
|
|
@foreach (var item in Model.ColumnDesign)
|
|
{
|
|
if(Model.IndexDataType == 3 && item.LowerName == Model.GroupField)
|
|
{
|
|
continue;
|
|
}
|
|
if(Model.IndexDataType == 3 && item.LowerName == Model.GroupShowField)
|
|
{
|
|
@:<el-table-column label="@(@item.Label)" prop="@(@item.Name)" align="left"@(item.Fixed != null || Model.IsFixed ? " fixed='left'" : "")>
|
|
@:<template slot-scope="scope">
|
|
@:<span v-if="scope.row.top" style="font-weight:bold;">{{scope.row.@(@item.Name)}}【{{scope.row.children.length}}】</span>
|
|
@:<span v-else>{{scope.row.@(@item.Name)}}</span>
|
|
@:</template>
|
|
@:</el-table-column>
|
|
continue;
|
|
}
|
|
@switch(Model.ChildTableStyle)
|
|
{
|
|
case 1:
|
|
if(item.IsChildTable)
|
|
{
|
|
@:<el-table-column label="@(@item.Label)" prop="@(@item.Name)" align="center">
|
|
@:<el-table-column prop="@(@item.Name)-child-first" width="1px" label-class-name="table-child-first" class-name="child-table-box">
|
|
@if(Model.IndexDataType == 3)
|
|
{
|
|
@:<template slot-scope="scope" v-if="!scope.row.top">
|
|
}else{
|
|
@:<template slot-scope="scope">
|
|
}
|
|
@:<div class="child-table-column">
|
|
@:<template v-if="!scope.row.@(@item.Name)Expand">
|
|
@:<tr v-for="(item, index) in scope.row.@(@item.Name).slice(0, 3)" class="child-table__row" :key="index">
|
|
@:<td class="td-child-first">
|
|
@:<div class="cell"></div>
|
|
@:</td>
|
|
@foreach (var childs in item.ChildTableDesigns)
|
|
{
|
|
@if(@childs.Width != "0")
|
|
{
|
|
@:<td :style="{width:`${@(childs.Width)-1}px`}" @(@Model.UseColumnPermission ? "v-if=\"jnpf.hasP('" + @item.Name + "-" + childs.Name + "')\"" : "")>
|
|
@:<div class="cell">
|
|
@if(childs.IsAutomatic)
|
|
{
|
|
@:{{ item.@(@childs.Name) | toDate() }}
|
|
}else{
|
|
@:{{ item.@(@childs.Name) }}
|
|
}
|
|
@:</div>
|
|
@:</td>
|
|
}else{
|
|
@:<td class="td-flex-1" @(@Model.UseColumnPermission ? "v-if=\"jnpf.hasP('" + @item.Name + "-" + childs.Name + "')\"" : "")>
|
|
@:<div class="cell">
|
|
@if(childs.IsAutomatic)
|
|
{
|
|
@:{{ item.@(@childs.Name) | toDate() }}
|
|
}else{
|
|
@:{{ item.@(@childs.Name) }}
|
|
}
|
|
@:</div>
|
|
</td>
|
|
}
|
|
}
|
|
@:</tr>
|
|
@:</template>
|
|
@:<template v-if="scope.row.@(@item.Name)Expand">
|
|
@:<tr v-for="(item, index) in scope.row.@(@item.Name)" class="child-table__row" :key="index">
|
|
@:<td class="td-child-first">
|
|
@:<div class="cell"></div>
|
|
@:</td>
|
|
@foreach (var childs in item.ChildTableDesigns)
|
|
{
|
|
@if(@childs.Width != "0")
|
|
{
|
|
@:<td :style="{width:`${@(childs.Width)-1}px`}" @(@Model.UseColumnPermission ? "v-if=\"jnpf.hasP('" + @item.Name + "-" + childs.Name + "')\"" : "")>
|
|
@:<div class="cell">
|
|
@if(item.IsAutomatic)
|
|
{
|
|
@:{{ item.@(@childs.Name) | toDate() }}
|
|
}else{
|
|
@:{{ item.@(@childs.Name) }}
|
|
}
|
|
@:</div>
|
|
@:</td>
|
|
}else{
|
|
@:<td class="td-flex-1" @(@Model.UseColumnPermission ? "v-if=\"jnpf.hasP('" + @item.Name + "-" + childs.Name + "')\"" : "")>
|
|
@:<div class="cell">
|
|
@if(item.IsAutomatic)
|
|
{
|
|
@:{{ item.@(@childs.Name) | toDate() }}
|
|
}else{
|
|
@:{{ item.@(@childs.Name) }}
|
|
}
|
|
@:</div>
|
|
</td>
|
|
}
|
|
}
|
|
@:</tr>
|
|
@:</template>
|
|
@:<div class="expand-more-btn" v-if="scope.row.@(@item.Name).length > 3">
|
|
@:<el-button v-if="scope.row.@(@item.Name)Expand" type="text" @@click="scope.row.@(@item.Name)Expand =!scope.row.@(@item.Name)Expand">隐藏部分</el-button>
|
|
@:<el-button v-if="!scope.row.@(@item.Name)Expand" type="text" @@click="scope.row.@(@item.Name)Expand=!scope.row.@(@item.Name)Expand">加载更多</el-button>
|
|
@:</div>
|
|
@:</div>
|
|
@:</template>
|
|
@:</el-table-column>
|
|
@foreach (var childs in item.ChildTableDesigns)
|
|
{
|
|
@:<el-table-column label="@(@childs.Label)" @(@item.Width)prop="@(@item.Name + "-" +@childs.Name)" @(@Model.UseColumnPermission ? "v-if=\"jnpf.hasP('" + @item.Name + "-" + childs.Name + "')\" " : "")align="@(@childs.Align)" @(@childs.IsSort)>
|
|
@:<template slot-scope="scope">{{ scope.row.@(@childs.Name) }}</template>
|
|
@:</el-table-column>
|
|
}
|
|
@:</el-table-column>
|
|
}else{
|
|
@:<el-table-column label="@(@item.Label)" @(@item.Width)prop="@(@item.Name)" @(@Model.UseColumnPermission ? "v-if=\"jnpf.hasP('" + item.Name + "')\" " : "")align="@(@item.Align)" @(@item.Fixed)@(@item.IsSort)>
|
|
@if(item.IsAutomatic)
|
|
{
|
|
@:<template slot-scope="scope">{{ scope.row.@(@item.Name) | toDate() }}</template>
|
|
}
|
|
@:</el-table-column>
|
|
}
|
|
break;
|
|
case 2:
|
|
@if(!item.IsChildTable)
|
|
{
|
|
@:<el-table-column label="@(@item.Label)" @(@item.Width)prop="@(@item.Name)" @(@Model.UseColumnPermission ? "v-if=\"jnpf.hasP('" + item.Name + "')\" " : "")align="@(@item.Align)" @(@item.Fixed)@(@item.IsSort)>
|
|
@if(item.IsAutomatic)
|
|
{
|
|
@:<template slot-scope="scope">{{ scope.row.@(@item.Name) | toDate() }}</template>
|
|
}
|
|
@:</el-table-column>
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
<el-table-column prop="flowState" label="状态" width="100">
|
|
@if(Model.IndexDataType == 3)
|
|
{
|
|
@:<template slot-scope="scope" v-if="!scope.row.top">
|
|
}else{
|
|
@:<template slot-scope="scope">
|
|
}
|
|
<el-tag v-if="scope.row.flowState==1">等待审核</el-tag>
|
|
<el-tag type="success" v-else-if="scope.row.flowState==2">审核通过</el-tag>
|
|
<el-tag type="danger" v-else-if="scope.row.flowState==3">审核驳回</el-tag>
|
|
<el-tag type="warning" v-else-if="scope.row.flowState==4">流程撤回</el-tag>
|
|
<el-tag type="info" v-else-if="scope.row.flowState==5">审核终止</el-tag>
|
|
<el-tag type="info" v-else>等待提交</el-tag>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="操作" fixed="right" width="@(@Model.ColumnButtonDesign.Count * 50)">
|
|
@if(Model.IndexDataType == 3)
|
|
{
|
|
@:<template slot-scope="scope" v-if="!scope.row.top">
|
|
}else{
|
|
@:<template slot-scope="scope">
|
|
}
|
|
@foreach (var item in @Model.ColumnButtonDesign)
|
|
{
|
|
@:<el-button type="text" @@click="@(@item.Method)" @(@item.Type)@(@item.Disabled)@(@Model.UseBtnPermission ? " v-has=\"'btn_" + @item.Value + "'\"":"")>@(@item.Label)</el-button>
|
|
}
|
|
</template>
|
|
</el-table-column>
|
|
</JNPF-table>
|
|
@if(Model.HasPage && Model.IndexDataType != 3)
|
|
{
|
|
@:<pagination :total="total" :page.sync="listQuery.currentPage" :limit.sync="listQuery.pageSize" @@pagination="initData" />
|
|
}
|
|
</div>
|
|
</div>
|
|
<FlowBox v-if="flowVisible" ref="FlowBox" @@close="colseFlow" />
|
|
<ExportBox v-if="exportBoxVisible" ref="ExportBox" @@download="download" />
|
|
@if(Model.IsUpload)
|
|
{
|
|
@:<ImportBox v-if="uploadBoxVisible" ref="UploadBox" @@refresh="initData" />
|
|
}
|
|
@if(Model.HasSuperQuery)
|
|
{
|
|
@:<SuperQuery v-if="superQueryVisible" ref="SuperQuery" :columnOptions="superQueryJson" @@superQuery="superQuery" />
|
|
}
|
|
</div>
|
|
</template>
|
|
<script>
|
|
import request from '@@/utils/request'
|
|
import columnList from './columnList'
|
|
import { getDictionaryDataSelector } from '@@/api/systemData/dictionary'
|
|
import FlowBox from '@@/views/workFlow/components/FlowBox'
|
|
import { getFormById } from '@@/api/workFlow/FormDesign'
|
|
@if(Model.IsDownload)
|
|
{
|
|
@:import ExportBox from '@@/components/ExportBox'
|
|
}
|
|
@if(Model.HasSuperQuery)
|
|
{
|
|
@:import SuperQuery from '@@/components/SuperQuery'
|
|
@:import superQueryJson from './superQueryJson'
|
|
}
|
|
import { getDataInterfaceRes } from '@@/api/systemData/dataInterface'
|
|
export default {
|
|
components: { FlowBox@(@Model.IsDownload ? ", ExportBox":"")@(@Model.HasSuperQuery ? ", SuperQuery" : "") },
|
|
data() {
|
|
return {
|
|
@if(Model.IsUpload)
|
|
{
|
|
@:uploadBoxVisible:false,
|
|
}
|
|
@if(Model.IsChildTableShow)
|
|
{
|
|
@:columnOptions: [],
|
|
@:expandObj: {},
|
|
@:mergeList: [],
|
|
}
|
|
columnList,
|
|
formFlowId: undefined,
|
|
@if(Model.HasSuperQuery)
|
|
{
|
|
@:superQueryVisible: false,
|
|
@:superQueryJson,
|
|
}
|
|
@if(Model.SearchColumnDesign.Count >= 3){
|
|
@:showAll: false,
|
|
}
|
|
query: {
|
|
@foreach (var item in @Model.SearchColumnDesign)
|
|
{
|
|
@:@(@item.Name):undefined,
|
|
}
|
|
@if(!Model.IsExistQuery && Model.Type == 2)
|
|
{
|
|
@:@(Model.TreeRelation):undefined,
|
|
}
|
|
},
|
|
@if(Model.Type == 2)
|
|
{
|
|
@:treeProps: {
|
|
@:children: '@(@Model.TreePropsChildren)',
|
|
@:label: '@(@Model.TreePropsLabel)',
|
|
@:value: '@(@Model.TreePropsValue)',
|
|
@:},
|
|
}
|
|
list: [],
|
|
listLoading: true,
|
|
multipleSelection: [],
|
|
total: 0,
|
|
listQuery: {
|
|
@if(Model.HasPage && Model.IndexDataType != 3)
|
|
{
|
|
@:currentPage: 1,
|
|
@:pageSize: 20,
|
|
}
|
|
sort: "desc",
|
|
sidx: "",
|
|
@if(Model.HasSuperQuery)
|
|
{
|
|
@:superQueryJson: ''
|
|
}
|
|
},
|
|
flowVisible: false,
|
|
exportBoxVisible: false,
|
|
@if(Model.Type == 2)
|
|
{
|
|
@:treeData:[],
|
|
}
|
|
@foreach(var item in @Model.OptionsList)
|
|
{
|
|
@if(item.IsIndex)
|
|
{
|
|
@:@item.Content
|
|
}
|
|
@if(item.IsProps)
|
|
{
|
|
@:@(@item.LowerName)Props:@(@item.QueryProps),
|
|
}
|
|
@switch(item.jnpfKey)
|
|
{
|
|
case "posSelect":
|
|
case "userSelect":
|
|
case "depSelect":
|
|
case "usersSelect":
|
|
@:@item.Content
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
},
|
|
computed: {
|
|
menuId() {
|
|
return this.$route.meta.modelId || ''
|
|
}
|
|
},
|
|
created() {
|
|
this.getFormById();
|
|
@if(Model.IsChildTableShow)
|
|
{
|
|
@:this.getColumnList();
|
|
}
|
|
@if(Model.Type == 2)
|
|
{
|
|
@:this.getTreeView();
|
|
}
|
|
else{
|
|
@:this.initData();
|
|
}
|
|
@foreach(var item in @Model.OptionsList)
|
|
{
|
|
@if(!item.IsStatic && item.IsIndex)
|
|
{
|
|
@:this.get@(@item.LowerName)Options();
|
|
}
|
|
}
|
|
},
|
|
methods: {
|
|
getFormById() {
|
|
getFormById("@(Model.FormId)").then(res => {
|
|
const flowId = res.data && res.data.id
|
|
this.formFlowId = flowId;
|
|
})
|
|
},
|
|
@if(Model.HasSuperQuery)
|
|
{
|
|
@:openSuperQuery() {
|
|
@:this.superQueryVisible = true
|
|
@:this.$nextTick(() => {
|
|
@:this.$refs.SuperQuery.init()
|
|
@:})
|
|
@:},
|
|
@:superQuery(queryJson) {
|
|
@:this.listQuery.superQueryJson = this.getSuperQueryJson(queryJson)
|
|
@:this.listQuery.currentPage = 1
|
|
@:this.initData()
|
|
@:},
|
|
@:getSuperQueryJson(queryJson){
|
|
@:if (!queryJson) return ''
|
|
@:let queryJsonObj=JSON.parse(queryJson)
|
|
@:let conditionJsonObj=JSON.parse(queryJsonObj.conditionJson)
|
|
@:let newConditionJsonObj=conditionJsonObj.map(o=>{
|
|
@:o.multiple=o.attr.multiple
|
|
@:delete o.attr
|
|
@:return o
|
|
@:})
|
|
@:queryJsonObj.conditionJson=newConditionJsonObj
|
|
@:return JSON.stringify(queryJsonObj)
|
|
@:},
|
|
}
|
|
@foreach(var item in @Model.OptionsList)
|
|
{
|
|
@if(!item.IsStatic && item.IsIndex)
|
|
{
|
|
@:get@(@item.LowerName)Options(){
|
|
switch(@item.DataType)
|
|
{
|
|
case "dictionary":
|
|
@:getDictionaryDataSelector('@(@item.DictionaryType)').then(res => {
|
|
@:this.@(@item.LowerName)Options = res.data.list
|
|
break;
|
|
case "dynamic":
|
|
@:getDataInterfaceRes('@(@item.DictionaryType)').then(res => {
|
|
@:let data = res.data
|
|
@:this.@(@item.LowerName)Options = data
|
|
break;
|
|
}
|
|
@:});
|
|
@:},
|
|
}
|
|
}
|
|
@if(Model.IsSort)
|
|
{
|
|
@:sortChange({ column, prop, order }) {
|
|
@:this.listQuery.sort = order == 'ascending' ? 'asc' : 'desc'
|
|
@:this.listQuery.sidx = !order ? '' : prop
|
|
@:this.initData()
|
|
@:},
|
|
}
|
|
@if(Model.IsUpload)
|
|
{
|
|
@:handelUpload(){
|
|
@:this.uploadBoxVisible = true
|
|
@:this.$nextTick(() => {
|
|
@:this.$refs.UploadBox.init("",'@(@Model.NameSpace)/@(@Model.ClassName)')
|
|
@:})
|
|
@:},
|
|
}
|
|
initData() {
|
|
this.listLoading = true;
|
|
let _query = {
|
|
...this.listQuery,
|
|
...this.query,
|
|
menuId : this.menuId,
|
|
};
|
|
let query = {}
|
|
for (let key in _query) {
|
|
if (Array.isArray(_query[key])) {
|
|
query[key] = _query[key].join()
|
|
} else {
|
|
query[key] = _query[key]
|
|
}
|
|
}
|
|
request({
|
|
url: `/api/@(@Model.NameSpace)/@(@Model.ClassName)/List`,
|
|
method: 'Post',
|
|
data: query
|
|
}).then(res => {
|
|
this.list = @(Model.HasPage ? "res.data.list" : "res.data").map(o => ({
|
|
...o,
|
|
...this.expandObj
|
|
}))
|
|
@if(Model.IndexDataType == 3)
|
|
{
|
|
@:this.list.map(o => {
|
|
@:if (o.children && o.children.length) {
|
|
@:o.children = o.children.map(e => ({
|
|
@:...e,
|
|
@:...this.expandObj
|
|
@:}))
|
|
@:}
|
|
@:})
|
|
}
|
|
this.listLoading = false
|
|
})
|
|
},
|
|
@if(Model.IsRemoveDel)
|
|
{
|
|
@:handleDel(id) {
|
|
@:this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
|
|
@:type: 'warning'
|
|
@:}).then(() => {
|
|
@:request({
|
|
@:url: `/api/@(@Model.NameSpace)/@(@Model.ClassName)/${id}`,
|
|
@:method: 'DELETE'
|
|
@:}).then(res => {
|
|
@:this.$message({
|
|
@:type: 'success',
|
|
@:message: res.msg,
|
|
@:onClose: () => {
|
|
@:this.initData()
|
|
@:}
|
|
@:});
|
|
@:})
|
|
@:}).catch(() => {
|
|
@:});
|
|
@:},
|
|
}
|
|
@if(Model.IsChildTableShow)
|
|
{
|
|
@:getColumnList() {
|
|
@if(!Model.UseColumnPermission)
|
|
{
|
|
@:this.columnOptions = this.transformColumnList(this.columnList)
|
|
}else{
|
|
@:let columnPermissionList = []
|
|
@:const permissionList = this.$store.getters.permissionList
|
|
@:const modelId = this.$route.meta.modelId
|
|
@:const list = permissionList.filter(o => o.modelId === modelId)
|
|
@:const columnList = list[0] && list[0].column ? list[0].column : []
|
|
@:for (let i = 0; i < this.columnList.length; i++) {
|
|
@:inner: for (let j = 0; j < columnList.length; j++) {
|
|
@:if (this.columnList[i].prop === columnList[j].enCode) {
|
|
@:columnPermissionList.push(this.columnList[i])
|
|
@:break inner
|
|
@:}
|
|
@:}
|
|
@:}
|
|
@:this.columnOptions = this.transformColumnList(columnPermissionList)
|
|
}
|
|
@:},
|
|
@:transformColumnList(columnList) {
|
|
@:let list = []
|
|
@:for (let i = 0; i < columnList.length; i++) {
|
|
@:const e = columnList[i];
|
|
@:if (!e.prop.includes('-')) {
|
|
@:list.push(e)
|
|
@:} else {
|
|
@:let prop = e.prop.split('-')[0]
|
|
@:let label = e.label.split('-')[0]
|
|
@:let vModel = e.prop.split('-')[1]
|
|
@:let newItem = {
|
|
@:align: "center",
|
|
@:jnpfKey: "table",
|
|
@:prop,
|
|
@:label,
|
|
@:children: []
|
|
@:}
|
|
@:e.vModel = vModel
|
|
@:if (!this.expandObj.hasOwnProperty(`${prop}Expand`)) this.$set(this.expandObj, `${prop}Expand`, false)
|
|
@:if (!list.some(o => o.prop === prop)) list.push(newItem)
|
|
@:for (let i = 0; i < list.length; i++) {
|
|
@:if (list[i].prop === prop) {
|
|
@:list[i].children.push(e)
|
|
@:break
|
|
@:}
|
|
@:}
|
|
@:}
|
|
@:}
|
|
@:this.getMergeList(list)
|
|
@:return list
|
|
@:},
|
|
@:getMergeList(list) {
|
|
@:let newList = JSON.parse(JSON.stringify(list))
|
|
@:newList.forEach(item => {
|
|
@:if (item.children && item.children.length) {
|
|
@:let child = {
|
|
@:prop: item.prop + '-child-first'
|
|
@:}
|
|
@:item.children.unshift(child)
|
|
@:}
|
|
@:})
|
|
@:newList.forEach(item => {
|
|
@:if (item.children && item.children.length > 0) {
|
|
@:item.children.forEach((child, index) => {
|
|
@:if (index == 0) {
|
|
@:this.mergeList.push({
|
|
@:prop: child.prop,
|
|
@:rowspan: 1,
|
|
@:colspan: item.children.length
|
|
@:})
|
|
@:} else {
|
|
@:this.mergeList.push({
|
|
@:prop: child.prop,
|
|
@:rowspan: 0,
|
|
@:colspan: 0
|
|
@:})
|
|
@:}
|
|
@:})
|
|
@:} else {
|
|
@:this.mergeList.push({
|
|
@:prop: item.prop,
|
|
@:rowspan: 1,
|
|
@:colspan: 1
|
|
@:})
|
|
@:}
|
|
@:})
|
|
@:},
|
|
@:arraySpanMethod({ column }) {
|
|
@:for (let i = 0; i < this.mergeList.length; i++) {
|
|
@:if (column.property == this.mergeList[i].prop) {
|
|
@:return [this.mergeList[i].rowspan, this.mergeList[i].colspan]
|
|
@:}
|
|
@:}
|
|
@:},
|
|
}
|
|
@if(Model.IsBatchRemoveDel)
|
|
{
|
|
@:handleSelectionChange(val) {
|
|
@:const res = val.map(item => item.@(@Model.PrimaryKey))
|
|
@:this.multipleSelection = res
|
|
@:},
|
|
@:handleBatchRemoveDel() {
|
|
@:if (!this.multipleSelection.length) {
|
|
@:this.$message({
|
|
@:type: 'error',
|
|
@:message: '请选择一条数据',
|
|
@:duration: 1500,
|
|
@:})
|
|
@:return
|
|
@:}
|
|
@:const ids = this.multipleSelection
|
|
@:this.$confirm('您确定要删除这些数据吗, 是否继续?', '提示', {
|
|
@:type: 'warning'
|
|
@:}).then(() => {
|
|
@:request({
|
|
@:url: `/api/@(@Model.NameSpace)/@(@Model.ClassName)/batchRemove`,
|
|
@:method: 'POST',
|
|
@:data: ids ,
|
|
@:}).then(res => {
|
|
@:this.$message({
|
|
@:type: 'success',
|
|
@:message: res.msg,
|
|
@:onClose: () => {
|
|
@:this.initData()
|
|
@:}
|
|
@:});
|
|
@:})
|
|
@:}).catch(() => { })
|
|
@:},
|
|
}
|
|
addOrUpdateHandle(id, flowState) {
|
|
let data = {
|
|
id: id || '',
|
|
enCode: '',
|
|
flowId: this.formFlowId,
|
|
formType: 1,
|
|
opType: flowState ? 0 : '-1',
|
|
status: flowState
|
|
}
|
|
this.flowVisible = true
|
|
this.$nextTick(() => {
|
|
this.$refs.FlowBox.init(data)
|
|
})
|
|
},
|
|
@if(Model.IsDownload)
|
|
{
|
|
@:exportData() {
|
|
@:this.exportBoxVisible = true
|
|
@:this.$nextTick(() => {
|
|
@:this.$refs.ExportBox.init(this.columnList)
|
|
@:})
|
|
@:},
|
|
@:download(data) {
|
|
@:let query = { dataType:data.dataType, selectKey:data.selectKey.join(','), ...this.listQuery, ...this.query, menuId:this.menuId }
|
|
@:request({
|
|
@:url: `/api/@(@Model.NameSpace)/@(@Model.ClassName)/Actions/Export`,
|
|
@:method: 'GET',
|
|
@:data: query
|
|
@:}).then(res => {
|
|
@:if (!res.data.url) return
|
|
@:window.location.href = this.define.comUrl + res.data.url
|
|
@:this.$refs.ExportBox.visible = false
|
|
@:this.exportBoxVisible = false
|
|
@:})
|
|
@:},
|
|
}
|
|
@if(Model.Type == 2)
|
|
{
|
|
switch(@Model.TreeDataSource)
|
|
{
|
|
case "organize":
|
|
|
|
@:getNodePath(node) {
|
|
@:let fullPath = []
|
|
@:const loop = (node) => {
|
|
@:if (node.level) fullPath.unshift(node.data)
|
|
@:if (node.parent) loop(node.parent)
|
|
@:}
|
|
@:loop(node)
|
|
@:return fullPath
|
|
@:},
|
|
break;
|
|
}
|
|
@:handleNodeClick(data, node){
|
|
@:this.treeActiveId = data.@(@Model.TreePropsValue)
|
|
@:for (let key in this.query) {
|
|
@:this.query[key] = undefined
|
|
@:}
|
|
switch(@Model.TreeDataSource)
|
|
{
|
|
case "organize":
|
|
|
|
@:const nodePath = this.getNodePath(node)
|
|
@:const currValue = nodePath.map(o => o.@(@Model.TreePropsValue))
|
|
@:this.query.@(Model.TreeRelation) = currValue
|
|
break;
|
|
default:
|
|
@:this.query.@(Model.TreeRelation) = data.@(@Model.TreePropsValue)
|
|
break;
|
|
}
|
|
@:this.listQuery = {
|
|
@:currentPage: 1,
|
|
@:pageSize: @(@Model.PageSize),
|
|
@:sort: "@(@Model.Sort)",
|
|
@:sidx: "@(@Model.DefaultSidx)",
|
|
@:}
|
|
@:this.initData()
|
|
@:},
|
|
@:getTreeView() {
|
|
switch(@Model.TreeDataSource)
|
|
{
|
|
case "dictionary":
|
|
@:getDictionaryDataSelector('@(@Model.TreeDictionary)').then(res => {
|
|
@:this.treeData = res.data.list
|
|
@:this.initData()
|
|
@:})
|
|
break;
|
|
case "department":
|
|
@:this.$store.dispatch('generator/getDepTree').then(res => {
|
|
@:this.treeData = res
|
|
@:this.initData()
|
|
@:})
|
|
break;
|
|
case "organize":
|
|
@:this.$store.dispatch('generator/getDepTree').then(res => {
|
|
@:this.treeData = res
|
|
@:this.initData()
|
|
@:})
|
|
break;
|
|
case "api":
|
|
@:getDataInterfaceRes('@(@Model.TreePropsUrl)').then(res => {
|
|
@:if (Array.isArray(res.data)) {
|
|
@:this.treeData = res.data
|
|
@:} else {
|
|
@:this.treeData = []
|
|
@:}
|
|
@:this.initData()
|
|
@:})
|
|
break;
|
|
}
|
|
@:},
|
|
}
|
|
search() {
|
|
this.listQuery = {
|
|
currentPage: 1,
|
|
pageSize: @(@Model.PageSize),
|
|
sort: "@(@Model.Sort)",
|
|
sidx: "@(@Model.DefaultSidx)",
|
|
}
|
|
this.initData()
|
|
},
|
|
colseFlow(isrRefresh) {
|
|
this.flowVisible = false
|
|
if (isrRefresh) this.reset()
|
|
},
|
|
reset() {
|
|
for (let key in this.query) {
|
|
this.query[key] = undefined
|
|
}
|
|
this.listQuery = {
|
|
currentPage: 1,
|
|
pageSize: @(@Model.PageSize),
|
|
sort: "@(@Model.Sort)",
|
|
sidx: "@(@Model.DefaultSidx)",
|
|
@if(Model.HasSuperQuery)
|
|
{
|
|
@:superQueryJson: this.listQuery.superQueryJson
|
|
}
|
|
}
|
|
this.initData()
|
|
}
|
|
}
|
|
}
|
|
</script> |