上传界面显示
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
using AntdUI;
|
||||
using AntdUIDemo.Views.Table;
|
||||
using DH.Commons.Enums;
|
||||
using DH.Devices.Vision;
|
||||
using DHSoftware.Models;
|
||||
using System;
|
||||
@ -148,12 +149,12 @@ namespace DHSoftware.Views
|
||||
},
|
||||
new ColumnSwitch("IsEnable", "是否启用", ColumnAlign.Center){
|
||||
//支持点击回调
|
||||
Call= (value,record, i_row, i_col) =>{
|
||||
//执行耗时操作
|
||||
Thread.Sleep(1000);
|
||||
// AntdUI.Message.info(window, value.ToString(),autoClose:1);
|
||||
return value;
|
||||
}
|
||||
//Call= (value,record, i_row, i_col) =>{
|
||||
// //执行耗时操作
|
||||
// Thread.Sleep(10);
|
||||
// // AntdUI.Message.info(window, value.ToString(),autoClose:1);
|
||||
// return value;
|
||||
//}
|
||||
},
|
||||
new Column("ScoreMinValue", "最小得分",ColumnAlign.Center),
|
||||
new Column("ScoreMaxValue", "最大得分",ColumnAlign.Center),
|
||||
@ -222,7 +223,12 @@ namespace DHSoftware.Views
|
||||
{
|
||||
DefectRow useradd = new DefectRow()
|
||||
{
|
||||
LabelDescription="xinquexian"
|
||||
LabelDescription="xinquexian",
|
||||
IsEnable=true,
|
||||
ScoreMinValue=0.3,
|
||||
ScoreMaxValue=1,
|
||||
AreaMinValue=1,
|
||||
AreaMaxValue=999999999,
|
||||
|
||||
};
|
||||
var form = new DefectRowEdit(_window, useradd) { Size = new Size(700, 500) };
|
||||
@ -361,87 +367,87 @@ namespace DHSoftware.Views
|
||||
//表格内部按钮事件
|
||||
private void Table_base_CellButtonClick(object sender, TableButtonEventArgs e)
|
||||
{
|
||||
//var buttontext = e.Btn.Text;
|
||||
var buttontext = e.Btn.Text;
|
||||
|
||||
//if (e.Record is User user)
|
||||
//{
|
||||
// curUser = user;
|
||||
// switch (buttontext)
|
||||
// {
|
||||
// //暂不支持进入整行编辑,只支持指定单元格编辑,推荐使用弹窗或抽屉编辑整行数据
|
||||
// case "编辑":
|
||||
// var form = new UserEdit(window, user) { Size = new Size(500, 300) };
|
||||
// AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
|
||||
// {
|
||||
// OnLoad = () =>
|
||||
// {
|
||||
// AntdUI.Message.info(window, "进入编辑", autoClose: 1);
|
||||
// },
|
||||
// OnClose = () =>
|
||||
// {
|
||||
// AntdUI.Message.info(window, "结束编辑", autoClose: 1);
|
||||
// }
|
||||
// });
|
||||
// break;
|
||||
// case "删除":
|
||||
// var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
|
||||
// if (result == DialogResult.OK)
|
||||
// antList.Remove(user);
|
||||
// break;
|
||||
// case "AntdUI":
|
||||
// //超链接内容
|
||||
// AntdUI.Message.info(window, user.CellLinks.FirstOrDefault().Id, autoClose: 1);
|
||||
// break;
|
||||
// case "查看图片":
|
||||
// //使用clone可以防止table中的image被修改
|
||||
// Preview.open(new Preview.Config(window, (Image)curUser.CellImages[0].Image.Clone()));
|
||||
// break;
|
||||
// }
|
||||
//}
|
||||
if (e.Record is DefectRow user)
|
||||
{
|
||||
curUser = user;
|
||||
switch (buttontext)
|
||||
{
|
||||
//暂不支持进入整行编辑,只支持指定单元格编辑,推荐使用弹窗或抽屉编辑整行数据
|
||||
case "编辑":
|
||||
var form = new DefectRowEdit(_window, user) { Size = new Size(500, 300) };
|
||||
AntdUI.Drawer.open(new AntdUI.Drawer.Config(_window, form)
|
||||
{
|
||||
OnLoad = () =>
|
||||
{
|
||||
AntdUI.Message.info(_window, "进入编辑", autoClose: 1);
|
||||
},
|
||||
OnClose = () =>
|
||||
{
|
||||
AntdUI.Message.info(_window, "结束编辑", autoClose: 1);
|
||||
}
|
||||
});
|
||||
break;
|
||||
case "删除":
|
||||
var result = Modal.open(_window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
|
||||
if (result == DialogResult.OK)
|
||||
antList.Remove(user);
|
||||
break;
|
||||
case "AntdUI":
|
||||
//超链接内容
|
||||
// AntdUI.Message.info(_window, user.CellLinks.FirstOrDefault().Id, autoClose: 1);
|
||||
break;
|
||||
case "查看图片":
|
||||
//使用clone可以防止table中的image被修改
|
||||
// Preview.open(new Preview.Config(window, (Image)curUser.CellImages[0].Image.Clone()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonDEL_Click(object sender, EventArgs e)
|
||||
{
|
||||
//if (antList.Count == 0 || !antList.Any(x => x.Selected))
|
||||
//{
|
||||
// bool isSubSelected = false;
|
||||
// // 判断子元素是否勾选
|
||||
// for (int i = 0; i < antList.Count; i++)
|
||||
// {
|
||||
// if (antList[i].Users != null && antList[i].Users.Any(x => x.Selected))
|
||||
// {
|
||||
// isSubSelected = true;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// if (!isSubSelected)
|
||||
// {
|
||||
// AntdUI.Message.warn(window, "请选择要删除的行!", autoClose: 3);
|
||||
// return;
|
||||
// }
|
||||
//}
|
||||
if (antList.Count == 0 || !antList.Any(x => x.Selected))
|
||||
{
|
||||
bool isSubSelected = false;
|
||||
//// 判断子元素是否勾选
|
||||
//for (int i = 0; i < antList.Count; i++)
|
||||
//{
|
||||
// if (antList[i].Users != null && antList[i].Users.Any(x => x.Selected))
|
||||
// {
|
||||
// isSubSelected = true;
|
||||
// break;
|
||||
// }
|
||||
//}
|
||||
if (!isSubSelected)
|
||||
{
|
||||
AntdUI.Message.warn(_window, "请选择要删除的行!", autoClose: 3);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
|
||||
//if (result == DialogResult.OK)
|
||||
//{
|
||||
// // 使用反转for循环删除主列表中选中的项
|
||||
// for (int i = antList.Count - 1; i >= 0; i--)
|
||||
// {
|
||||
// // 删除选中的主列表项
|
||||
// if (antList[i].Selected)
|
||||
// {
|
||||
// antList.RemoveAt(i);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // 删除子列表中选中的项
|
||||
// antList[i].Users = antList[i].Users?.Where(user => !user.Selected).ToArray();
|
||||
// }
|
||||
// }
|
||||
// // 提示删除完成
|
||||
// // AntdUI.Message.success(this.w, "删除成功!", autoClose: 3);
|
||||
// MessageBox.Show("删除成功!");
|
||||
//}
|
||||
var result = Modal.open(_window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
|
||||
if (result == DialogResult.OK)
|
||||
{
|
||||
// 使用反转for循环删除主列表中选中的项
|
||||
for (int i = antList.Count - 1; i >= 0; i--)
|
||||
{
|
||||
// 删除选中的主列表项
|
||||
if (antList[i].Selected)
|
||||
{
|
||||
antList.RemoveAt(i);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 删除子列表中选中的项
|
||||
// antList[i].Users = antList[i].Users?.Where(user => !user.Selected).ToArray();
|
||||
}
|
||||
}
|
||||
// 提示删除完成
|
||||
// AntdUI.Message.success(this.w, "删除成功!", autoClose: 3);
|
||||
MessageBox.Show("删除成功!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user