Skip to content

Commit

Permalink
update 更新安装文件
Browse files Browse the repository at this point in the history
  • Loading branch information
liuliang-wt committed Jul 28, 2019
1 parent 5b6769b commit 19d243d
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const frameworkRender = {
columnsRenderDownload: (props) => {
if (props.value) {
return <div style={{ textAlign: "center" }} >
<Button shape="circle" icon="download" onClick={e => {
<Button style={{ height: 25, width: 25, objectFit: "cover" }} shape="circle" icon="download" onClick={e => {
window.open(RequestFiles.onFileDownload(props.value))
}} />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const columnDefs: (ColDef | ColGroupDef)[] = [
headerName: "操作时间", field: "ActionTime",
},
{
headerName: "时长", field: "Duration",
headerName: "时长", field: "Duration", enableValue: true
},
{
headerName: "IP", field: "IP",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ protected override IEnumerable<IGridColumn<ActionLogDisplayModel>> InitGridHeade
header.Add(this.MakeGridHeader(x => x.ITCode, 120));
header.Add(this.MakeGridHeader(x => x.ActionUrl, 200));
header.Add(this.MakeGridHeader(x => x.ActionTime, 200).SetSort(true));
header.Add(this.MakeGridHeader(x => x.Duration, 100).SetSort(true).SetBackGroundFunc((entity)=> {
header.Add(this.MakeGridHeader(x => x.Duration, 100).SetSort(true).SetForeGroundFunc((entity)=> {
if(entity.Duration <= 1)
{
return "008000";
Expand Down
33 changes: 26 additions & 7 deletions src/WalkingTec.Mvvm.Mvc/CodeGenVM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ public void DoGen()
name: '{ModuleName.ToLower()}',
path: '/{ModelName.ToLower()}',
controller: '{ModelName}',
component: () => import('./{ModelName.ToLower()}').then(x => x.default)
component: React.lazy(() => import('./{ModelName.ToLower()}'))
}}
/**WTM**/
");
Expand Down Expand Up @@ -1035,19 +1035,32 @@ public string GenerateReactView(string name)
var pros = FieldInfos.Where(x => x.IsListField == true).ToList();
fieldstr.Append(Environment.NewLine);
List<PropertyInfo> existSubPro = new List<PropertyInfo>();
int rowheight = 30;
for (int i = 0; i < pros.Count; i++)
{
var item = pros[i];
string label = modelType.GetProperty(item.FieldName).GetPropertyDisplayName();
string render = "columnsRender";
string render = "";
string newname = item.FieldName;
if (modelType.GetProperty(item.FieldName).PropertyType.IsBoolOrNullableBool())
{
render = "columnsRenderBoolean";
}
if (string.IsNullOrEmpty(item.RelatedField) == false)
{
var subtype = Type.GetType(item.RelatedField);
string prefix = "";
if (subtype == typeof(FileAttachment))
{
render = "columnsRenderImg";
if (item.FieldName.ToLower().Contains("photo") || item.FieldName.ToLower().Contains("pic") || item.FieldName.ToLower().Contains("icon"))
{
render = "columnsRenderImg";
rowheight = 110;
}
else
{
render = "columnsRenderDownload";
}
var fk = DC.GetFKName2(modelType, item.FieldName);
newname = fk;
}
Expand All @@ -1065,17 +1078,23 @@ public string GenerateReactView(string name)
}
fieldstr.Append($@"
{{
dataIndex: ""{newname}"",
title: ""{label}"",
render: {render}
field: ""{newname}"",
headerName: ""{label}""");

if(render != "")
{
fieldstr.Append($@",
cellRenderer: {render} ");
}
fieldstr.Append($@"
}}");
if (i < pros.Count - 1)
{
fieldstr.Append(",");
}
fieldstr.Append(Environment.NewLine);
}
return rv.Replace("$columns$", fieldstr.ToString());
return rv.Replace("$columns$", fieldstr.ToString()).Replace("$rowheight$", rowheight.ToString());
}
if (name == "models")
{
Expand Down
42 changes: 11 additions & 31 deletions src/WalkingTec.Mvvm.Mvc/GeneratorFiles/Spa/React/views/table.txt
Original file line number Diff line number Diff line change
@@ -1,42 +1,22 @@
import { columnsRender, columnsRenderImg, DataViewTable } from 'components/dataView';
import { DesError } from 'components/decorators';
import { ColDef, ColGroupDef } from 'ag-grid-community';
import { AgGrid } from 'components/dataView';
import React from 'react';
import Store from '../store';
import Action from './action';
/**
* 列 信息配置
* 完整参数列表 https://ant.design/components/table-cn/#components-table-demo-dynamic-settings
* dataIndex:属性名称 区分大小写
* title:表格显示的中文标题
*/
const columns = [$columns$
// 列配置
const columnDefs: (ColDef | ColGroupDef)[] = [$columns$
]

/**
* 表格
*/
@DesError
export default class extends React.Component<any, any> {
/**
* 操作动作
*/
renderColumns() {
const tableColumns: any[] = [...columns];
// 根据需求 加入行动作
if (true) {
tableColumns.push(
{
title: '动作',
dataIndex: 'Action',
fixed: 'right',//固定 列
width: 160,
render: (text, record) => <Action.rowAction data={record} />
}
)
}
return tableColumns
}
render() {
return <DataViewTable Store={Store} columns={this.renderColumns()} />
return <AgGrid
rowGroupPanelShow="always"
Store={Store}
columnDefs={columnDefs}
rowAction={Action.rowAction}
rowHeight={$rowheight$}
/>
}
}
Binary file modified src/WalkingTec.Mvvm.Mvc/SetupFiles/Mvc/layui/layui.zip
Binary file not shown.
Binary file modified src/WalkingTec.Mvvm.Mvc/SetupFiles/Spa/React/ClientApp.zip
Binary file not shown.

0 comments on commit 19d243d

Please sign in to comment.