|
|
@@ -2,81 +2,145 @@
|
|
|
@using System.Threading.Tasks
|
|
|
@using System.Text.Json
|
|
|
|
|
|
-@if (IsVisible)
|
|
|
+@if (IsVisible && Model != null)
|
|
|
{
|
|
|
<div class="modal-overlay">
|
|
|
<div class="modal-content filter_box">
|
|
|
@if (Model?.Type == 1 || Model?.Type == 2)
|
|
|
{
|
|
|
- <div class="filter_row">
|
|
|
- <span>文件名</span><Input Placeholder="文件名" @bind-Value="Model.FileName" Style="width:30%" Disabled />
|
|
|
- <span>上传人</span><Input Placeholder="上传人" @bind-Value="Model.MediaUploader" Style="width:30%" Disabled />
|
|
|
- </div>
|
|
|
+ <EditForm Model="@Model" style="width:100%" Context="editContext" @key="Model">
|
|
|
+ <DataAnnotationsValidator />
|
|
|
+
|
|
|
+ <div class="filter_row">
|
|
|
+
|
|
|
+ <div class="filter_colume">
|
|
|
+ <div class="filter_row_around">
|
|
|
+ <span>文件名</span><Input Placeholder="文件名" @bind-Value="Model.FileName" Style="width:80%" Disabled />
|
|
|
+ </div>
|
|
|
+ <ValidationMessage For="@(() => Model.FileName)" style="color:red"/>
|
|
|
+ </div>
|
|
|
+
|
|
|
+
|
|
|
+ <div class="filter_colume">
|
|
|
+ <div class="filter_row_around">
|
|
|
+ <span>上传人</span><Input Placeholder="上传人" @bind-Value="Model.MediaUploader" Style="width:80%" Disabled />
|
|
|
+ </div>
|
|
|
+ <ValidationMessage For="@(() => Model.MediaUploader)" style="color:red" />
|
|
|
+ </div>
|
|
|
+
|
|
|
+ </div>
|
|
|
|
|
|
- <div class="filter_row">
|
|
|
- <span>广告状态</span>
|
|
|
- <SimpleSelect DefaultValue="@Model.MediaState.ToString()" OnSelectedItemChanged="@(data => OnSelectItemChange(1, data))" Style="width:30%">
|
|
|
- <SelectOptions>
|
|
|
- <SimpleSelectOption Value="0" Label="禁用" style="width:30%" />
|
|
|
- <SimpleSelectOption Value="1" Label="可用" style="width:30%" />
|
|
|
- </SelectOptions>
|
|
|
- </SimpleSelect>
|
|
|
-
|
|
|
- <span>油机状态</span>
|
|
|
- <SimpleSelect DefaultValues="@Model.getMachineStateList()" OnSelectedItemsChanged="OnSelectItemsChange" Mode="SelectMode.Multiple" style="width:30%">
|
|
|
- <SelectOptions>
|
|
|
- <SimpleSelectOption Value="idle" Label="空闲" />
|
|
|
- <SimpleSelectOption Value="lock" Label="锁枪" />
|
|
|
- <SimpleSelectOption Value="offline" Label="脱机" />
|
|
|
- <SimpleSelectOption Value="lift" Label="提枪" />
|
|
|
- <SimpleSelectOption Value="authorised" Label="授权" />
|
|
|
- <SimpleSelectOption Value="start" Label="开始" />
|
|
|
- <SimpleSelectOption Value="fueling" Label="加油中" />
|
|
|
- </SelectOptions>
|
|
|
- </SimpleSelect>
|
|
|
- </div>
|
|
|
+ <div class="filter_row">
|
|
|
+ <div class="filter_colume">
|
|
|
+ <div class="filter_row_around">
|
|
|
+ <span>广告状态</span>
|
|
|
+ <SimpleSelect DefaultValue="@Model.MediaState.ToString()" OnSelectedItemChanged="@(data => OnSelectItemChange(1, data, editContext))" Style="width:80%">
|
|
|
+ <SelectOptions>
|
|
|
+ <SimpleSelectOption Value="0" Label="禁用" style="width:80%" />
|
|
|
+ <SimpleSelectOption Value="1" Label="可用" style="width:80%" />
|
|
|
+ </SelectOptions>
|
|
|
+ </SimpleSelect>
|
|
|
+ </div>
|
|
|
+ <ValidationMessage For="@(() => Model.MediaState)" style="color:red" />
|
|
|
+ </div>
|
|
|
+
|
|
|
+
|
|
|
+ <div class="filter_colume">
|
|
|
+ <div class="filter_row_around">
|
|
|
+ <span>油机状态</span>
|
|
|
+ <SimpleSelect DefaultValues="@Model.getMachineStateList()" OnSelectedItemsChanged="@(data => OnSelectItemsChange(data, editContext))" Mode="SelectMode.Multiple" style="width:80%">
|
|
|
+ <SelectOptions>
|
|
|
+ <SimpleSelectOption Value="idle" Label="空闲" />
|
|
|
+ <SimpleSelectOption Value="lock" Label="锁枪" />
|
|
|
+ <SimpleSelectOption Value="offline" Label="脱机" />
|
|
|
+ <SimpleSelectOption Value="lift" Label="提枪" />
|
|
|
+ <SimpleSelectOption Value="authorised" Label="授权" />
|
|
|
+ <SimpleSelectOption Value="start" Label="开始" />
|
|
|
+ <SimpleSelectOption Value="fueling" Label="加油中" />
|
|
|
+ </SelectOptions>
|
|
|
+ </SimpleSelect>
|
|
|
+ </div>
|
|
|
+ <ValidationMessage For="@(() => Model.MachineStateList)" style="color:red" />
|
|
|
+ </div>
|
|
|
+
|
|
|
+ </div>
|
|
|
|
|
|
- <div class="filter_row">
|
|
|
- <span>有效时间段</span><RangePicker TValue="DateTime?[]" Value="EffecitiveTime" OnChange="@(date => onDateChage(date, 1))" />
|
|
|
- <span style="margin-right:5%">播放时段</span><RangePicker TValue="DateTime?[]" Value="playRange" Picker="DatePickerType.Time" Format="@("HH")" OnChange="@(date => onDateChage(date, 2))" />
|
|
|
- </div>
|
|
|
+ <div class="filter_row">
|
|
|
+ <div class="filter_colume">
|
|
|
+ <div class="filter_row_around">
|
|
|
+ <span>有效时间段</span><RangePicker TValue="DateTime?[]" Value="EffecitiveTime" OnChange="@(date => onDateChage(date, 1))" />
|
|
|
+ </div>
|
|
|
+ <ValidationMessage For="@(() => Model.EffecitiveTime)" style="color:red" />
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="filter_colume">
|
|
|
+ <div class="filter_row_around">
|
|
|
+ <span style="margin-right:5%">播放时段</span><RangePicker TValue="DateTime?[]" Value="playRange" Picker="DatePickerType.Time" Format="@("HH")" OnChange="@(date => onDateChage(date, 2))" />
|
|
|
+ </div>
|
|
|
+ <ValidationMessage For="@(() => Model.StartTime)" style="color:red" />
|
|
|
+ </div>
|
|
|
+
|
|
|
+ </div>
|
|
|
|
|
|
- <div class="filter_row">
|
|
|
- <span>下发油站</span>
|
|
|
- <SimpleSelect DefaultValue="@Model.BusinessUnitID.ToString()" OnSelectedItemChanged="@(data => OnSelectItemChange(2, data))" style="width:30%">
|
|
|
- <SelectOptions>
|
|
|
- @foreach (var department in Model.siteInfos)
|
|
|
- {
|
|
|
- <SimpleSelectOption Value="@department.Id.ToString()" Label="@department.Name" style="width:30%" />
|
|
|
- }
|
|
|
- </SelectOptions>
|
|
|
- </SimpleSelect>
|
|
|
- <span>备注</span><Input Placeholder="备注" @bind-Value="Model.Remark" style="width:30%" />
|
|
|
- </div>
|
|
|
- }
|
|
|
+ <div class="filter_row">
|
|
|
+ <div class="filter_colume">
|
|
|
+ <div class="filter_row_around">
|
|
|
+ <span>下发油站</span>
|
|
|
+ <SimpleSelect DefaultValue="@Model.BusinessUnitID.ToString()" OnSelectedItemChanged="@(data => OnSelectItemChange(2, data, editContext))" style="width:80%">
|
|
|
+ <SelectOptions>
|
|
|
+ @foreach (var department in Model.siteInfos)
|
|
|
+ {
|
|
|
+ <SimpleSelectOption Value="@department.Id.ToString()" Label="@department.Name" style="width:80%" />
|
|
|
+ }
|
|
|
+ </SelectOptions>
|
|
|
+ </SimpleSelect>
|
|
|
+ </div>
|
|
|
+ <ValidationMessage For="@(() => Model.BusinessUnitID)" style="color:red" />
|
|
|
+ </div>
|
|
|
+
|
|
|
+
|
|
|
+ <div class="filter_colume">
|
|
|
+ <div class="filter_row_around">
|
|
|
+ <span>备注</span><Input Placeholder="备注" @bind-Value="Model.Remark" style="width:80%" />
|
|
|
+ </div>
|
|
|
+ <ValidationMessage For="@(() => Model.Remark)" style="color:red" />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
|
|
|
- @if(Model?.Type == 1)
|
|
|
- {
|
|
|
- <Upload class="filter_row" Name="file" style="justify-content:center" Action="@Global.MediaUploadUrl"
|
|
|
- @bind-FileList="fileList" ListType="UploadListType.PictureCard"
|
|
|
- ShowUploadList="true" ShowDownloadIcon="true" ShowPreviewIcon="true" ShowRemoveIcon="true" ShowButton="fileList.Count < 1"
|
|
|
- OnCompleted="OnUploadCompleted" OnRemove="OnRemove">
|
|
|
- <div>
|
|
|
- <Icon Type="plus" />
|
|
|
- <div className="ant-upload-text">上传文件</div>
|
|
|
+ @if (Model?.Type == 1)
|
|
|
+ {
|
|
|
+ <Upload class="filter_row" Name="file" style="justify-content:center" Action="@Global.MediaUploadUrl"
|
|
|
+ Headers="uploadFileHeader"
|
|
|
+ @bind-FileList="fileList" ListType="UploadListType.PictureCard"
|
|
|
+ ShowUploadList="true" ShowDownloadIcon="true" ShowPreviewIcon="true" ShowRemoveIcon="true" ShowButton="fileList.Count < 1"
|
|
|
+ OnCompleted="OnUploadCompleted" OnRemove="OnRemove">
|
|
|
+ <div>
|
|
|
+ <Icon Type="plus" />
|
|
|
+ <div className="ant-upload-text">上传文件</div>
|
|
|
+ </div>
|
|
|
+ </Upload>
|
|
|
+ }
|
|
|
+
|
|
|
+ <div class="filter_row" style="justify-content:end;margin-top:5%;">
|
|
|
+ <button Icon="plus" type="button" @onclick="() => HandleSubmit(editContext)" style="margin-right:2%">确定</button>
|
|
|
+ <button Icon="reload" @onclick="Close" style="margin-right:2%">取消</button>
|
|
|
</div>
|
|
|
- </Upload>
|
|
|
+ </EditForm>
|
|
|
+
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
@if(Model?.Type == 3)
|
|
|
{
|
|
|
<h3>是否删除广告?@(Model.FileName)</h3>
|
|
|
+ <div class="filter_row" style="justify-content:end;margin-top:5%;">
|
|
|
+ <Button Icon="plus" OnClick="onSure" Style="margin-right:2%">确定</Button>
|
|
|
+ <Button Icon="reload" OnClick="Close" Style="margin-right:2%">取消</Button>
|
|
|
+ </div>
|
|
|
}
|
|
|
|
|
|
- <div class="filter_row" style="justify-content:end;margin-top:5%;">
|
|
|
- <Button Icon="plus" OnClick="onSure" Style="margin-right:2%">确定</Button>
|
|
|
- <Button Icon="reload" OnClick="Close" Style="margin-right:2%">取消</Button>
|
|
|
- </div>
|
|
|
+
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
@@ -130,10 +194,12 @@
|
|
|
/// </summary>
|
|
|
private DateTime?[] playRange = new DateTime?[2];
|
|
|
|
|
|
+ private Dictionary<string, string> uploadFileHeader = new Dictionary<string, string>();
|
|
|
|
|
|
protected override void OnParametersSet()
|
|
|
{
|
|
|
fileList.Clear();
|
|
|
+ uploadFileHeader["Authorization"] = Global.GetToken();
|
|
|
EffecitiveTime = new DateTime?[]
|
|
|
{
|
|
|
Model?.EffecitiveTime,
|
|
|
@@ -176,6 +242,7 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 上传文件完毕
|
|
|
/// </summary>
|
|
|
@@ -204,7 +271,7 @@
|
|
|
/// </summary>
|
|
|
/// <param name="type">1:油机状态;2:站点</param>
|
|
|
/// <param name="value">选择的值</param>
|
|
|
- private void OnSelectItemChange(int type, string value)
|
|
|
+ private void OnSelectItemChange(int type, string value, EditContext editContext)
|
|
|
{
|
|
|
Console.WriteLine(value);
|
|
|
switch (type)
|
|
|
@@ -213,6 +280,7 @@
|
|
|
int state = -1;
|
|
|
int.TryParse(value, out state);
|
|
|
Model.MediaState = state;
|
|
|
+ editContext.NotifyFieldChanged(FieldIdentifier.Create(() => Model.MediaState));
|
|
|
break;
|
|
|
case 2:
|
|
|
var siteinfo = Model.siteInfos.Find(it => it.Id.ToString().Equals(value));
|
|
|
@@ -220,22 +288,31 @@
|
|
|
{
|
|
|
Model.GroupID = siteinfo.ParentId;
|
|
|
Model.BusinessUnitID = siteinfo.Id;
|
|
|
+
|
|
|
+ editContext.NotifyFieldChanged(FieldIdentifier.Create(() => Model.BusinessUnitID));
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 多选选择器选择事件
|
|
|
/// </summary>
|
|
|
/// <param name="values">选择的值</param>
|
|
|
- private void OnSelectItemsChange(IEnumerable<string> values)
|
|
|
+ private void OnSelectItemsChange(IEnumerable<string> values ,EditContext editContext)
|
|
|
{
|
|
|
Console.WriteLine(values);
|
|
|
- Model.MachineStateList = values.ToList();
|
|
|
+ if (values.Count() <= 0)
|
|
|
+ {
|
|
|
+ Model.MachineStateList = Model.getAllMachineStateList();
|
|
|
+ } else
|
|
|
+ {
|
|
|
+ Model.MachineStateList = values.ToList();
|
|
|
+ }
|
|
|
|
|
|
+ editContext.NotifyFieldChanged(FieldIdentifier.Create(() => Model.MachineStateList));
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
@@ -270,6 +347,15 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private async Task HandleSubmit(EditContext editContext)
|
|
|
+ {
|
|
|
+
|
|
|
+ if(editContext.Validate())
|
|
|
+ {
|
|
|
+ await onSure();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 确定按钮事件
|
|
|
/// </summary>
|
|
|
@@ -333,4 +419,22 @@
|
|
|
width: 100%;
|
|
|
margin-top: 2%;
|
|
|
}
|
|
|
+
|
|
|
+ .filter_row_around {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: row;
|
|
|
+ justify-content: space-around;
|
|
|
+ align-items: center;
|
|
|
+ width: 100%;
|
|
|
+ margin-top: 2%;
|
|
|
+ }
|
|
|
+
|
|
|
+ .filter_colume {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: end;
|
|
|
+ width: 100%;
|
|
|
+ margin-top: 2%;
|
|
|
+ }
|
|
|
</style>
|