提交 1833cdf9 编写于 作者: W wq1234wq

事件搜索

上级 fc73350b
......@@ -16,7 +16,12 @@
<nz-form-item>
<nz-form-label nzFor="Name">规则</nz-form-label>
<nz-form-control>
<input nz-input [(ngModel)]="q.RuleName" name="RuleName" #UserName placeholder="请输入" />
<nz-select nzShowSearch nzAllowClear nzPlaceHolder="选择规则" [(ngModel)]="q.RuleId" name="RuleId">
<ng-container *ngFor="let o of rules">
<nz-option [nzValue]="o.ruleId" [nzLabel]="o.name"></nz-option>
</ng-container>
</nz-select>
</nz-form-control>
</nz-form-item>
</div>
......@@ -24,10 +29,11 @@
<nz-form-item>
<nz-form-label nzFor="Creator">创建对象</nz-form-label>
<nz-form-control>
<input nz-input [(ngModel)]="q.Creator" (input)="onChange($event)" name="Creator" #UserPhone placeholder="请输入" [nzAutocomplete]="auto"/>
<input nz-input [(ngModel)]="q.CreatorName" (input)="onInput($event)" (ngModelChange)="onChange($event)" name="CreatorName" placeholder="请输入" [nzAutocomplete]="auto"/>
<input type="hidden" [(ngModel)]="q.Creator" name="Creator" placeholder="请输入" />
<nz-autocomplete #auto>
<nz-auto-option *ngFor="let option of devices" [nzValue]="option.value">{{ option.text }}</nz-auto-option>
<nz-auto-option *ngFor="let option of devices" [nzValue]="option.name">{{ option.name }}</nz-auto-option>
</nz-autocomplete>
</nz-form-control>
......@@ -37,7 +43,7 @@
<nz-form-item>
<nz-form-label nzFor="CreatTime">创建时间</nz-form-label>
<nz-form-control>
<input nz-input [(ngModel)]="q.CreatTime" name="CreatTime" placeholder="请输入" />
<nz-range-picker [nzFormat]="dateFormat" [(ngModel)]="q.CreatTime" name="CreatTime" placeholder="请输入"></nz-range-picker>
</nz-form-control>
</nz-form-item>
</div>
......
......@@ -14,9 +14,9 @@ import { FloweventviewComponent } from '../floweventview/floweventview.component
styleUrls: ['./flowevents.component.less']
})
export class FloweventsComponent implements OnInit {
devices:creator[]=[{value:Guid.EMPTY,text:'测试'}];
TAG: STColumnTag = {
devices: creator[] = [{ id: Guid.EMPTY, name: '测试' }];
dateFormat = 'yyyy/MM/dd'
TAG: STColumnTag = {
'Normal': { text: '设备', color: 'green' },
'TestPurpose': { text: '测试', color: 'orange' },
......@@ -30,25 +30,27 @@ export class FloweventsComponent implements OnInit {
pi: number;
ps: number;
Name: string;
Creator: string;
RuleName:string;
Creator: string;
RuleId: string;
CreatorName: string;
CreatTime: Date[];
sorter: string;
status: number | null;
} = {
pi: 0,
ps: 10,
Name: '',
Creator: '',
RuleName:'',
CreatTime: [],
sorter: '',
status: null,
};
pi: 0,
ps: 10,
Name: '',
Creator: '',
RuleId: '',
CreatorName: '',
CreatTime: [],
sorter: '',
status: null,
};
total = 0;
loading = false;
rules = [];
url = 'api/rules/flowevents';
req: STReq = { method: 'POST', allInBody: true, reName: { pi: 'offset', ps: 'limit' }, params: this.q };
......@@ -65,7 +67,7 @@ export class FloweventsComponent implements OnInit {
columns: STColumn[] = [
{ title: '', index: 'eventId', type: 'checkbox' },
{ title: '事件名称', index: 'eventName', render: 'name' },
{ title: '类型', index: 'type',type:'tag',tag: this.TAG },
{ title: '类型', index: 'type', type: 'tag', tag: this.TAG },
{ title: '触发规则', index: 'name' },
{ title: '事件源', index: 'creatorName' },
{ title: '创建时间', type: 'date', index: 'createrDateTime' },
......@@ -79,7 +81,7 @@ export class FloweventsComponent implements OnInit {
this.openComponent(item);
},
},
],
},
];
......@@ -89,7 +91,7 @@ export class FloweventsComponent implements OnInit {
expandForm = false;
openComponent(event: baseevent): void {
var { nzMaskClosable, width } = this.settingService.getData('drawerconfig');
var title ='回放';
var title = '回放';
const drawerRef = this.drawerService.create<FloweventviewComponent, { event: baseevent }, string>({
nzTitle: title,
nzContent: FloweventviewComponent,
......@@ -99,8 +101,8 @@ export class FloweventsComponent implements OnInit {
event: event,
},
});
drawerRef.afterOpen.subscribe(() => {});
drawerRef.afterOpen.subscribe(() => { });
drawerRef.afterClose.subscribe((data) => {
this.st.load(this.st.pi);
......@@ -108,52 +110,62 @@ export class FloweventsComponent implements OnInit {
}
});
}
onChange($event: Event){
var element= $event.target as HTMLInputElement
this.http.get('api/Devices/Customers',{
limit:20,
offset:0,
customerId: this.settingService.user.comstomer,name:element?.value??''
}).pipe(debounceTime(500)).subscribe(next=>{},error=>{},()=>{})
onInput($event: Event) {
var element = $event.target as HTMLInputElement
this.http.get('api/Devices/Customers', {
limit: 20,
offset: 0,
customerId: this.settingService.user.comstomer, name: element?.value ?? ''
}).pipe(debounceTime(500)).subscribe(next => {
this.devices = [...next.data.rows.map(x => { return { id: x.id, name: x.name } }), { id: Guid.EMPTY, name: '测试' }]
}, error => { }, () => { })
}
onChange($event){
this.q.Creator=this.devices.find(c=>c.name==$event)?.id
}
getData() {
this.st.req = this.req;
this.st.load(this.st.pi);
}
reset() {
this.q ==
{
pi: 0,
ps: 10,
Name: '',
Creator: '',
RuleName:'',
CreatTime: [],
sorter: '',
status: null,
};
this.q =
{
pi: 0,
ps: 10,
Name: '',
Creator: '',
CreatorName: '',
RuleId: '',
CreatTime: [],
sorter: '',
status: null,
};
}
constructor(
private http: _HttpClient,
public msg: NzMessageService,
private drawerService: NzDrawerService,
private settingService: SettingsService,
) {
}
ngOnInit(): void {
this.http.post('api/rules/index', { offset: 0, limit: 100 }).subscribe(next => {
this.rules = next.data.rows;
}, error => { }, () => { })
}
}
export interface baseevent{
export interface baseevent {
eventId: string;
eventName: string;
eventName: string;
eventDesc: string;
eventStaus: string;
type: string;
......@@ -167,7 +179,7 @@ export interface baseevent{
}
export interface creator{
value:string;
text:string;
export interface creator {
id: string;
name: string;
}
\ No newline at end of file
......@@ -28,11 +28,11 @@ export class FlowlistComponent implements OnInit {
) {}
TAG: STColumnTag = {
1: { text: '遥测', color: 'green' },
1: { text: '遥测', color: 'geekblue' },
2: { text: '属性', color: 'orange' },
0: { text: 'RAW', color: 'blue' },
3: { text: 'RPC', color: 'cyan' },
4: { text: 'Online', color: 'lime' },
4: { text: 'Online', color: 'green' },
5: { text: 'Offline', color: 'red' },
};
page: STPage = {
......
......@@ -33,7 +33,7 @@ namespace IoTSharp.Controllers.Models
public class EventParam : IPageParam
{
public string Name { get; set; }
public string RuleName { get; set; }
public Guid? RuleId { get; set; }
public string CreatorName { get; set; }
public Guid? Creator { get; set; }
......
......@@ -1129,9 +1129,9 @@ namespace IoTSharp.Controllers
condition = condition.And(x => x.CreaterDateTime > m.CreatTime[0] && x.CreaterDateTime < m.CreatTime[1]);
}
if (!string.IsNullOrEmpty(m.RuleName))
if (m.RuleId!=null)
{
condition = condition.And(x => x.FlowRule.Name.Contains(m.RuleName));
condition = condition.And(x => x.FlowRule.RuleId== m.RuleId);
}
......@@ -1187,7 +1187,6 @@ namespace IoTSharp.Controllers
}
[HttpGet("[action]")]
public ApiResult<dynamic> GetFlowOperations(Guid eventId)
{
......@@ -1201,8 +1200,6 @@ namespace IoTSharp.Controllers
}
[HttpGet("[action]")]
public ApiResult<dynamic> GetExecutors()
{
......@@ -1224,11 +1221,6 @@ namespace IoTSharp.Controllers
}
[HttpGet("[action]")]
public async Task<ApiResult<RuleTaskExecutor>> GetExecutor(Guid Id)
{
......@@ -1279,7 +1271,7 @@ namespace IoTSharp.Controllers
executor.TypeName = m.ExecutorName;
executor.Path = m.Path;
executor.Tag = m.Tag;
executor.Path = m.Path;
_context.RuleTaskExecutors.Update(executor);
await _context.SaveChangesAsync();
return new ApiResult<bool>(ApiCode.Success, "Ok", true);
......@@ -1300,7 +1292,7 @@ namespace IoTSharp.Controllers
executor.TypeName = m.ExecutorName;
executor.Path = m.Path;
executor.Tag = m.Tag;
executor.Path = m.Path;
executor.AddDateTime = DateTime.Now;
executor.Creator = profile.Id;
executor.ExecutorStatus = 1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册