提交 5088a271 编写于 作者: W wq1234wq

条件测试

上级 52770b25
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace IoTSharp.Migrations
{
public partial class addteststatus : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "TestStatus",
table: "RuleTaskExecutors",
type: "integer",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<Guid>(
name: "Tester",
table: "RuleTaskExecutors",
type: "uuid",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
migrationBuilder.AddColumn<DateTime>(
name: "TesterDateTime",
table: "RuleTaskExecutors",
type: "timestamp without time zone",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<int>(
name: "TestStatus",
table: "Flows",
type: "integer",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<Guid>(
name: "Tester",
table: "Flows",
type: "uuid",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
migrationBuilder.AddColumn<DateTime>(
name: "TesterDateTime",
table: "Flows",
type: "timestamp without time zone",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "TestStatus",
table: "RuleTaskExecutors");
migrationBuilder.DropColumn(
name: "Tester",
table: "RuleTaskExecutors");
migrationBuilder.DropColumn(
name: "TesterDateTime",
table: "RuleTaskExecutors");
migrationBuilder.DropColumn(
name: "TestStatus",
table: "Flows");
migrationBuilder.DropColumn(
name: "Tester",
table: "Flows");
migrationBuilder.DropColumn(
name: "TesterDateTime",
table: "Flows");
}
}
}
......@@ -774,6 +774,15 @@ namespace IoTSharp.Migrations
b.Property<string>("TargetId")
.HasColumnType("text");
b.Property<int>("TestStatus")
.HasColumnType("integer");
b.Property<Guid>("Tester")
.HasColumnType("uuid");
b.Property<DateTime>("TesterDateTime")
.HasColumnType("timestamp without time zone");
b.Property<string>("bpmnid")
.HasColumnType("text");
......@@ -943,6 +952,15 @@ namespace IoTSharp.Migrations
b.Property<string>("Tag")
.HasColumnType("text");
b.Property<int>("TestStatus")
.HasColumnType("integer");
b.Property<Guid>("Tester")
.HasColumnType("uuid");
b.Property<DateTime>("TesterDateTime")
.HasColumnType("timestamp without time zone");
b.Property<string>("TypeName")
.HasColumnType("text");
......
......@@ -23,5 +23,10 @@ namespace IoTSharp.Data
public int ExecutorStatus { get; set; }
public DateTime AddDateTime { get; set; }
public Guid Creator { get; set; }
public int TestStatus { get; set; }
public Guid Tester { get; set; }
public DateTime TesterDateTime { get; set; }
}
}
......@@ -3,7 +3,17 @@
<div nz-col nzSm="6" style="padding: 0.1rem">
<nz-card nzTitle="对象属性">
<form nz-form se-container="1" labelWidth="100" gutter="32">
<se label="对象Id" error="对象Id" required>
<se label="Id" error="Id" >
<input
nz-input
placeholder=""
[(ngModel)]="form.id"
readonly="readonly"
[ngModelOptions]="{ standalone: true }"
(ngModelChange)="ngModelChange($event)"
/>
</se>
<se label="对象Id" error="对象Id" >
<input
nz-input
placeholder=""
......
......@@ -71,6 +71,7 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy
@Input() ruleId: number;
form: FormBpmnObject = {
id:'',
flowid: '',
flowname: '',
flowdesc: '',
......@@ -193,6 +194,7 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy
if (task) {
if (task.bizObject == null) {
task.bizObject = {
id:'',
flowid: '',
flowname: '',
flowdesc: '',
......@@ -227,6 +229,7 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy
if (endevent) {
if (endevent.bizObject === null) {
endevent.bizObject = {
id:'',
flowid: '',
flowname: '',
flowdesc: '',
......@@ -253,6 +256,7 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy
if (startevent) {
if (startevent.bizObject === null) {
startevent.bizObject = {
id:'',
flowid: '',
flowname: '',
flowdesc: '',
......@@ -279,6 +283,7 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy
if (intermediatethrowevent) {
if (intermediatethrowevent.bizObject == null) {
intermediatethrowevent.bizObject = {
id:'',
flowid: '',
flowname: '',
flowdesc: '',
......@@ -305,6 +310,7 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy
if (complexgateway) {
if (complexgateway.bizObject == null) {
complexgateway.bizObject = {
id:'',
flowid: '',
flowname: '',
flowdesc: '',
......@@ -331,6 +337,7 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy
if (parallelgteway) {
if (parallelgteway.bizObject == null) {
parallelgteway.bizObject = {
id:'',
flowid: '',
flowname: '',
flowdesc: '',
......@@ -357,6 +364,7 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy
if (exclusivegateway) {
if (exclusivegateway.bizObject == null) {
exclusivegateway.bizObject = {
id:'',
flowid: '',
flowname: '',
flowdesc: '',
......@@ -383,6 +391,7 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy
if (inclusivegateway) {
if (inclusivegateway.bizObject == null) {
inclusivegateway.bizObject = {
id:'',
flowid: '',
flowname: '',
flowdesc: '',
......@@ -409,6 +418,7 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy
if (businessruletask) {
if (businessruletask.bizObject == null) {
businessruletask.bizObject = {
id:'',
flowid: '',
flowname: '',
flowdesc: '',
......@@ -437,6 +447,7 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy
if (eventbasedgateway) {
if (eventbasedgateway.bizObject == null) {
eventbasedgateway.bizObject = {
id:'',
flowid: '',
flowname: '',
flowdesc: '',
......@@ -463,6 +474,7 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy
if (receivetask) {
if (receivetask.bizObject == null) {
receivetask.bizObject = {
id:'',
flowid: '',
flowname: '',
flowdesc: '',
......@@ -491,6 +503,7 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy
if (usertask) {
if (usertask.bizObject == null) {
usertask.bizObject = {
id:'',
flowid: '',
flowname: '',
flowdesc: '',
......@@ -520,6 +533,7 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy
if (intermediatecatchevent) {
if (intermediatecatchevent.bizObject == null) {
intermediatecatchevent.bizObject = {
id:'',
flowid: '',
flowname: '',
flowdesc: '',
......@@ -546,6 +560,7 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy
if (servicetask) {
if (servicetask.bizObject == null) {
servicetask.bizObject = {
id:'',
flowid: '',
flowname: '',
flowdesc: '',
......@@ -574,6 +589,7 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy
if (manualtask) {
if (manualtask.bizObject == null) {
manualtask.bizObject = {
id:'',
flowid: '',
flowname: '',
flowdesc: '',
......@@ -602,6 +618,7 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy
if (sendtask) {
if (sendtask.bizObject == null) {
sendtask.bizObject = {
id:'',
flowid: '',
flowname: '',
flowdesc: '',
......@@ -630,6 +647,7 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy
if (callactivity) {
if (callactivity.bizObject == null) {
callactivity.bizObject = {
id:'',
flowid: '',
flowname: '',
flowdesc: '',
......@@ -657,6 +675,7 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy
if (sequenceflow) {
if (!sequenceflow.bizObject) {
sequenceflow.bizObject = {
id:'',
flowid: '',
flowname: '',
flowdesc: '',
......@@ -684,6 +703,7 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy
if (participant) {
if (participant.bizObject == null) {
participant.bizObject = {
id:'',
flowid: '',
flowname: '',
flowdesc: '',
......@@ -709,6 +729,7 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy
if (subprocess) {
if (subprocess.bizObject == null) {
subprocess.bizObject = {
id:'',
flowid: '',
flowname: '',
flowdesc: '',
......@@ -735,6 +756,7 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy
if (collaboration) {
if (collaboration.bizObject == null) {
collaboration.bizObject = {
id:'',
flowid: '',
flowname: '',
flowdesc: '',
......@@ -917,7 +939,7 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy
baseBpmnObject.id = e.element.businessObject.id;
baseBpmnObject.text = e.element.businessObject.text;
baseBpmnObject.bpmntype = e.element.type;
baseBpmnObject.bizObject = {
baseBpmnObject.bizObject = { id:'',
flowid: '',
flowname: '',
flowdesc: '',
......@@ -963,7 +985,7 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy
baseBpmnObject = new SequenceFlow();
baseBpmnObject.id = e.element.businessObject.id;
baseBpmnObject.bpmntype = e.element.type;
baseBpmnObject.bizObject = {
baseBpmnObject.bizObject = { id:'',
flowid: '',
flowname: '',
flowdesc: '',
......@@ -1015,7 +1037,7 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy
dataStoreReference = new SequenceFlow();
dataStoreReference.id = e.element.businessObject.id;
dataStoreReference.bpmntype = e.element.type;
dataStoreReference.bizObject = {
dataStoreReference.bizObject = { id:'',
flowid: '',
flowname: '',
flowdesc: '',
......@@ -1065,7 +1087,7 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy
container = new SequenceFlow();
container.id = e.element.businessObject.id;
container.bpmntype = e.element.type;
container.bizObject = {
container.bizObject = { id:'',
flowid: '',
flowname: '',
flowdesc: '',
......@@ -1117,7 +1139,7 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy
subProcess = new SequenceFlow();
subProcess.id = e.element.businessObject.id;
subProcess.bpmntype = e.element.type;
subProcess.bizObject = {
subProcess.bizObject = { id:'',
flowid: '',
flowname: '',
flowdesc: '',
......@@ -1171,7 +1193,7 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy
sequenceflow = new SequenceFlow();
sequenceflow.id = e.element.businessObject.id;
sequenceflow.bpmntype = e.element.type;
sequenceflow.bizObject = {
sequenceflow.bizObject = { id:'',
flowid: '',
flowname: '',
flowdesc: '',
......@@ -1226,7 +1248,7 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy
task = new Task();
task.id = e.element.id;
task.bpmntype = e.element.type;
task.bizObject = {
task.bizObject = { id:'',
flowid: '',
flowname: '',
flowdesc: '',
......@@ -1278,7 +1300,7 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy
gateway = new GateWay();
gateway.id = e.element.id;
gateway.bpmntype = e.element.type;
gateway.bizObject = {
gateway.bizObject = { id:'',
flowid: '',
flowname: '',
flowdesc: '',
......@@ -1328,7 +1350,7 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy
startevent = new BpmnBaseObject();
startevent.bpmntype = e.element.type;
startevent.id = e.element.id;
startevent.bizObject = {
startevent.bizObject = { id:'',
flowid: '',
flowname: '',
flowdesc: '',
......@@ -1377,7 +1399,7 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy
endevent = new BpmnBaseObject();
endevent.id = e.element.id;
endevent.bpmntype = e.element.type;
endevent.bizObject = {
endevent.bizObject = { id:'',
flowid: '',
flowname: '',
flowdesc: '',
......@@ -1500,7 +1522,7 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy
if (data.gateWays) {
for (var element of data.gateWays) {
var gateWay = new GateWay();
gateWay.bizObject = {
gateWay.bizObject = { id:element.bizObject.flowid,
flowid: element.id,
flowname: element.bizObject.flowname,
flowdesc: '',
......@@ -1526,7 +1548,7 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy
if (data.sequenceFlows) {
for (var element of data.sequenceFlows) {
var sequenceflows = new SequenceFlow();
sequenceflows.bizObject = {
sequenceflows.bizObject = { id:element.bizObject.flowid,
flowid: element.id,
flowname: element.flowname,
......@@ -1555,7 +1577,7 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy
if (data.tasks) {
for (var element of data.tasks) {
var task = new Task();
task.bizObject = {
task.bizObject = { id:element.bizObject.flowid,
flowid: element.id,
flowname: element.bizObject.flowname,
flowdesc: '',
......@@ -1582,7 +1604,7 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy
if (data.laneSet) {
for (var element of data.laneSet) {
var laneset = new BpmnBaseObject();
laneset.bizObject = {
laneset.bizObject = { id:element.bizObject.flowid,
flowid: element.id,
flowname: element.bizObject.flowname,
flowdesc: '',
......@@ -1607,7 +1629,7 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy
if (data.endEvents) {
for (var element of data.endEvents) {
var endevent = new BpmnBaseObject();
endevent.bizObject = {
endevent.bizObject = { id:element.bizObject.flowid,
flowid: element.id,
flowname: element.bizObject.flowname,
flowdesc: '',
......@@ -1633,7 +1655,7 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy
if (data.startEvents) {
for (var element of data.startEvents) {
var startevent = new BpmnBaseObject();
startevent.bizObject = {
startevent.bizObject = { id:element.bizObject.flowid,
flowid: element.id,
flowname: element.bizObject.flowname,
flowdesc: '',
......@@ -1659,7 +1681,7 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy
if (data.containers) {
for (var element of data.containers) {
var container = new BpmnBaseObject();
container.bizObject = {
container.bizObject = { id:element.bizObject.flowid,
flowid: element.id,
flowname: element.bizObject.flowname,
flowdesc: '',
......@@ -1685,7 +1707,7 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy
if (data.baseBpmnObjects) {
for (var element of data.baseBpmnObjects) {
var baseBpmnObject = new BpmnBaseObject();
baseBpmnObject.bizObject = {
baseBpmnObject.bizObject = { id:element.bizObject.flowid,
flowid: element.id,
flowname: element.bizObject.flowname,
flowdesc: '',
......@@ -1711,7 +1733,7 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy
if (data.dataStoreReferences) {
for (var element of data.dataStoreReferences) {
var datastorereference = new BpmnBaseObject();
datastorereference.bizObject = {
datastorereference.bizObject = { id:element.bizObject.flowid,
flowid: element.id,
flowname: element.bizObject.flowname,
flowdesc: '',
......@@ -1736,7 +1758,7 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy
if (data.subProcesses) {
for (var element of data.subProcesses) {
var subprocess = new BpmnBaseObject();
subprocess.bizObject = {
subprocess.bizObject = { id:element.bizObject.flowid,
flowid: element.id,
flowname: element.bizObject.flowname,
flowdesc: '',
......@@ -1762,7 +1784,7 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy
if (data.dataOutputAssociations) {
for (var element of data.dataOutputAssociations) {
var dataOutputAssociation = new DataOutputAssociation();
dataOutputAssociation.bizObject = {
dataOutputAssociation.bizObject = { id:element.bizObject.flowid,
flowid: element.id,
flowname: element.bizObject.flowname,
flowdesc: '',
......@@ -1788,7 +1810,7 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy
if (data.dataInputAssociations) {
for (var element of data.dataInputAssociations) {
var dataInputAssociations = new DataOutputAssociation();
dataInputAssociations.bizObject = {
dataInputAssociations.bizObject = { id:element.bizObject.flowid,
flowid: element.id,
flowname: element.bizObject.flowname,
flowdesc: '',
......@@ -1814,7 +1836,7 @@ export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy
if (data.lane) {
for (var element of data.lane) {
var lane = new BpmnBaseObject();
lane.bizObject = {
lane.bizObject = { id:element.bizObject.flowid,
flowid: element.id,
flowname: element.bizObject.flowname,
flowdesc: '',
......@@ -1854,6 +1876,7 @@ export class BpmnBaseObject {
public incoming!: BpmnBaseObject[];
public outgoing!: BpmnBaseObject[];
public bizObject: FormBpmnObject = {
id:'',
flowid: '',
flowname: '',
flowdesc: '',
......@@ -1957,6 +1980,7 @@ export const importDiagram = (bpmnJS: any) => (source: Observable<any>) =>
});
export interface FormBpmnObject {
id:string;
flowid: string;
flowname: string;
flowdesc: string;
......
......@@ -86,6 +86,7 @@
<td>执行器</td>
<td>默认参数</td>
<td>脚本类型</td>
<td>测试状态</td>
<td>操作</td>
</tr>
<tr *ngFor="let _item of item.flows; let i = index; let odd = odd">
......@@ -94,14 +95,15 @@
<td>{{ _item.nodeProcessClass }}</td>
<td>{{ _item.nodeProcessParams }}</td>
<td>{{ _item.nodeProcessScriptType }}</td>
<td><button>测试</button></td>
<td>{{ _item.teststatus===1?'测试通过':'未测试' }}</td>
<td><a (click)="testunit(_item)">{{
_item.flowType==='bpmn:Task'?'脚本测试':_item.flowType==='bpmn:SequenceFlow'?'条件测试':''
}}</a></td>
</tr>
</table>
</nz-card>
</ng-template>
<ng-template st-row="rulestatus" let-i>
<nz-badge [nzStatus]="i.statusType" [nzText]="i.statusText"></nz-badge>
</ng-template>
......
......@@ -10,6 +10,7 @@ import { appmessage, pageddata } from '../../common/AppMessage';
import { FlowsimulatorComponent } from '../../util/flow/flowsimulator/flowsimulator.component';
import { FlowformComponent } from '../flowform/flowform.component';
import { ForkdialogComponent } from '../forkdialog/forkdialog.component';
@Component({
selector: 'app-flowlist',
......@@ -25,10 +26,8 @@ export class FlowlistComponent implements OnInit {
private _router: Router,
private drawerService: NzDrawerService,
private settingService: SettingsService,
) {
}
private message: NzMessageService,
) {}
page: STPage = {
front: false,
......@@ -104,22 +103,21 @@ export class FlowlistComponent implements OnInit {
icon: 'warning',
},
click: (item: ruleflow) => {
//do something
},
},
{
text: (record) => 'fork',
click: (item: ruleflow) => {
text: (record) => '复制',
//do something
type: 'modal',
modal: {
component: ForkdialogComponent,
},
click: (record, modal) => {
this.message.success(`复制:${modal.data ? '成功' : '失败'}`);
this.getData();
},
},
{
......@@ -182,7 +180,7 @@ export class FlowlistComponent implements OnInit {
id: id,
},
});
drawerRef.afterOpen.subscribe(() => {});
drawerRef.afterClose.subscribe((data) => {
......@@ -192,28 +190,25 @@ export class FlowlistComponent implements OnInit {
});
}
onchange($event){
onchange($event) {
switch ($event.type) {
case 'expand':
if ($event.expand.expand) {
this.http.get<appmessage<flow>>('api/rules/GetFlows?ruleId='+$event.expand?.ruleId).subscribe(next=>{
console.log(next)
$event.expand.flows=next.data;
},error=>{},()=>{});
this.http.get<appmessage<flow>>('api/rules/GetFlows?ruleId=' + $event.expand?.ruleId).subscribe(
(next) => {
console.log(next);
$event.expand.flows = next.data;
},
(error) => {},
() => {},
);
}
break;
}
}
testthisflow(ruleflow: ruleflow): void {
var { nzMaskClosable, width } = this.settingService.getData('drawerconfig');
var title = '测试' + ruleflow.name;
const drawerRef = this.drawerService.create<FlowsimulatorComponent, { id: string }, string>({
nzTitle: title,
......@@ -224,9 +219,7 @@ $event.expand.flows=next.data;
id: ruleflow.ruleId,
},
});
drawerRef.afterOpen.subscribe(() => {});
drawerRef.afterClose.subscribe((data) => {
this.st.load(this.st.pi);
if (typeof data === 'string') {
......@@ -234,6 +227,16 @@ $event.expand.flows=next.data;
});
}
testunit(flow: flow) {
console.log(flow);
switch (flow.flowType) {
case 'bpmn:SequenceFlow':
break;
case 'bpmn:Task':
break;
}
}
getData() {
this.st.req = this.req;
this.st.load(this.st.pi);
......@@ -260,18 +263,19 @@ export interface ruleflow {
CreatTime: Date;
rulestatus: number;
definitionsXml: string;
flows:flow[]
flows: flow[];
}
export interface flow{
flowId:string;
flowname:string;
bpmnid:string;
nodeProcessClass:string;
conditionexpression:string;
nodeProcessMethod:string;
nodeProcessParams:string;
nodeProcessScriptType:string;
nodeProcessScript:string;
export interface flow {
flowId: string;
flowname: string;
flowType: string;
bpmnid: string;
nodeProcessClass: string;
conditionexpression: string;
nodeProcessMethod: string;
nodeProcessParams: string;
nodeProcessScriptType: string;
nodeProcessScript: string;
teststatus: number;
}
<div class="modal-header">
<div class="modal-title">复制</div>
</div>
<form nz-form [formGroup]="form" (ngSubmit)="submit()" se-container="1" labelWidth="200">
<se label="规则名称" error="请输入规则名称" required hidden>
<input nz-input formControlName="ruleId" placeholder="Id" readonly />
</se>
<se label="规则名称" error="规则名称" required="required">
<!-- <editor formControlName="RuleDesc"></editor> -->
<input nz-input formControlName="name" placeholder="规则备注" />
</se>
<se label="规则备注" error="规则名称">
<!-- <editor formControlName="RuleDesc"></editor> -->
<input nz-input formControlName="ruledesc" placeholder="规则备注" />
</se>
</form>
<div class="modal-footer">
<button nz-button [nzType]="'default'" [nzSize]="'large'" (click)="cancel()"> Cancel </button>
<button nz-button [nzType]="'primary'" [nzSize]="'large'" (click)="ok()"> OK </button>
</div>
\ No newline at end of file
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ForkdialogComponent } from './forkdialog.component';
describe('ForkdialogComponent', () => {
let component: ForkdialogComponent;
let fixture: ComponentFixture<ForkdialogComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ ForkdialogComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(ForkdialogComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, Input, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { _HttpClient } from '@delon/theme';
import { NzSafeAny } from 'ng-zorro-antd/core/types';
import { NzModalRef } from 'ng-zorro-antd/modal';
@Component({
selector: 'app-forkdialog',
templateUrl: './forkdialog.component.html',
styleUrls: ['./forkdialog.component.less'],
})
export class ForkdialogComponent implements OnInit {
loading = false;
@Input() record: NzSafeAny;
form!: FormGroup;
ok(): void {
this.http.post('api/rules/fork', this.form.value).subscribe(
(next) => {
this.modal.destroy(next);
},
(error) => {},
() => {},
);
}
cancel(): void {
this.modal.destroy();
}
constructor(private fb: FormBuilder, private modal: NzModalRef, private http: _HttpClient) {}
ngOnInit(): void {
console.log(this.record);
this.form = this.fb.group({
ruleId: [this.record.ruleId, []],
name: ['copy of ' + this.record.name, [Validators.required]],
ruledesc: [this.record.ruledesc, []],
});
}
submit() {
}
}
......@@ -64,6 +64,7 @@ import { TaskexecutorlistComponent } from './flow/taskexecutorlist/taskexecutorl
import { TaskexecutorformComponent } from './flow/taskexecutorform/taskexecutorform.component';
import { SequenceflowtesterComponent } from './flow/sequenceflowtester/sequenceflowtester.component';
import { TasktesterComponent } from './flow/tasktester/tasktester.component';
import { ForkdialogComponent } from './flow/forkdialog/forkdialog.component';
const COMPONENTS: Type<null>[] = [];
const Directive: Type<void>[] = [fielddirective, controldirective];
......@@ -126,6 +127,7 @@ const Directive: Type<void>[] = [fielddirective, controldirective];
TaskexecutorformComponent,
SequenceflowtesterComponent,
TasktesterComponent,
ForkdialogComponent,
],
})
export class RoutesModule {
......
......@@ -135,7 +135,11 @@ namespace IoTSharp.Controllers
return new ApiResult<FlowRule>(ApiCode.CantFindObject, "can't find this object", null);
}
/// <summary>
/// 复制一个规则副本
/// </summary>
/// <param name="flowRule"></param>
/// <returns></returns>
[HttpPost("[action]")]
......@@ -154,7 +158,7 @@ namespace IoTSharp.Controllers
newrule.ExecutableCode = rule.ExecutableCode;
newrule.RuleDesc = flowRule.RuleDesc;
newrule.RuleStatus = 1;
newrule.ParentRuleId = rule.ParentRuleId;
newrule.ParentRuleId = rule.RuleId;
newrule.SubVersion = rule.SubVersion + 0.01;
newrule.Runner = rule.Runner;
_context.FlowRules.Add(newrule);
......@@ -191,6 +195,7 @@ namespace IoTSharp.Controllers
await _context.SaveChangesAsync();
}
return new ApiResult<bool>(ApiCode.Success, "Ok", true);
}
else
......@@ -519,7 +524,7 @@ namespace IoTSharp.Controllers
}
[HttpGet("[action]")]
public ApiResult<IoTSharp.Models.Rule.Activity> GetDiagram(Guid id)
public ApiResult<Activity> GetDiagram(Guid id)
{
var ruleflow = _context.FlowRules.FirstOrDefault(c => c.RuleId == id);
IoTSharp.Models.Rule.Activity activity = new IoTSharp.Models.Rule.Activity();
......@@ -1270,7 +1275,7 @@ namespace IoTSharp.Controllers
{
var profile = await this.GetUserProfile();
// this._flowRuleProcessor.ProcessCondition()
this._flowRuleProcessor.ProcessCondition()
await _context.SaveChangesAsync();
......@@ -1278,5 +1283,8 @@ namespace IoTSharp.Controllers
}
}
}
\ No newline at end of file
......@@ -383,6 +383,13 @@
this is test purpose
</summary>
</member>
<member name="M:IoTSharp.Controllers.RulesController.Fork(IoTSharp.Data.FlowRule)">
<summary>
复制一个规则副本
</summary>
<param name="flowRule"></param>
<returns></returns>
</member>
<member name="M:IoTSharp.Controllers.RulesController.FlowEvents(IoTSharp.Controllers.Models.EventParam)">
<summary>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册