Browse Source

[新增]添加二维预案单选界面

master
邵佳豪 4 years ago
parent
commit
52b59dcee9
  1. 88
      src/app/examiner/create-test-score/addPlanTwo.html
  2. 10
      src/app/examiner/create-test-score/create-test-score.component.html
  3. 508
      src/app/examiner/create-test-score/create-test-score.component.ts
  4. 10
      src/app/examiner/create-test-score/finishDialog.html
  5. 3
      src/app/examiner/examiner.module.ts
  6. 18
      src/app/pipes/size.pipe.ts

88
src/app/examiner/create-test-score/addPlanTwo.html

@ -5,51 +5,49 @@
</div>
<div class="tablebox">
<table mat-table [dataSource]="dataSource" class="mat-elevation-z8">
<!-- Checkbox Column -->
<ng-container matColumnDef="select">
<th mat-header-cell *matHeaderCellDef>
<!-- <mat-checkbox (change)="$event ? masterToggle() : null"
[checked]="selection.hasValue() && isAllSelected()"
[indeterminate]="selection.hasValue() && !isAllSelected()">
</mat-checkbox> -->
选择
</th>
<td mat-cell *matCellDef="let row">
<mat-checkbox color="primary" (click)="$event.stopPropagation()"
(change)="$event ? selection.toggle(row) : null"
[checked]="selection.isSelected(row)">
</mat-checkbox>
</td>
</ng-container>
<!-- name Column -->
<ng-container matColumnDef="name">
<th mat-header-cell *matHeaderCellDef> 预案名称 </th>
<td mat-cell *matCellDef="let element"> {{element.name}} </td>
</ng-container>
<!-- people Column -->
<ng-container matColumnDef="people">
<th mat-header-cell *matHeaderCellDef> 添加人 </th>
<td mat-cell *matCellDef="let element"> {{element.people}} </td>
</ng-container>
<!-- time Column -->
<ng-container matColumnDef="time">
<th mat-header-cell *matHeaderCellDef> 添加时间 </th>
<td mat-cell *matCellDef="let element"> {{element.time}} </td>
</ng-container>
<!-- level Column -->
<ng-container matColumnDef="level">
<th mat-header-cell *matHeaderCellDef> 编制级别 </th>
<td mat-cell *matCellDef="let element"> {{element.level}} </td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"
(click)="selection.toggle(row)">
</tr>
<!-- <mat-radio-group class="example-radio-group" [(ngModel)]="selectedradio"> -->
<!-- Checkbox Column -->
<ng-container matColumnDef="select">
<th mat-header-cell *matHeaderCellDef>
选择
</th>
<td mat-cell *matCellDef="let row;">
<mat-radio-button color="primary" (change)="radioChange(row)"></mat-radio-button>
</td>
</ng-container>
<!-- name Column -->
<ng-container matColumnDef="name">
<th mat-header-cell *matHeaderCellDef> 预案名称 </th>
<td mat-cell *matCellDef="let element"> {{element.name}} </td>
</ng-container>
<!-- people Column -->
<ng-container matColumnDef="people">
<th mat-header-cell *matHeaderCellDef> 添加人 </th>
<td mat-cell *matCellDef="let element"> {{element.creatorName}} </td>
</ng-container>
<!-- time Column -->
<ng-container matColumnDef="time">
<th mat-header-cell *matHeaderCellDef> 添加时间 </th>
<td mat-cell *matCellDef="let element"> {{element.creationTime | date:'yyyy-MM-dd'}} </td>
</ng-container>
<!-- level Column -->
<ng-container matColumnDef="level">
<th mat-header-cell *matHeaderCellDef> 编制级别 </th>
<td mat-cell *matCellDef="let element"> {{element.planLevel | planlevel}} </td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"
>
</tr>
<!-- </mat-radio-group> -->
</table>
</div>
</div>

10
src/app/examiner/create-test-score/create-test-score.component.html

@ -42,7 +42,7 @@
<!-- 选择的单位名称 -->
<p class="colorspan" style="margin: 0 0 12px 6px;">{{unit.name}}</p>
<!-- 基本信息 -->
<mat-accordion>
<mat-accordion *ngIf="unit.basicInfoNodes && unit.basicInfoNodes.length != 0">
<mat-expansion-panel style="box-shadow: 0 0 black;" expanded>
<mat-expansion-panel-header collapsedHeight ='40px' expandedHeight='40px' style="position: relative;padding-left:20px;background: #F5FDFE;">
<mat-panel-title>
@ -86,7 +86,7 @@
</mat-expansion-panel>
</mat-accordion>
<!-- 四周毗邻 -->
<mat-accordion *ngIf="unit.aroundNodes.length != 0">
<mat-accordion *ngIf="unit.aroundNodes && unit.aroundNodes.length != 0">
<mat-expansion-panel style="box-shadow: 0 0 black;" expanded>
<mat-expansion-panel-header collapsedHeight ='40px' expandedHeight='40px' style="position: relative;padding-left:20px;background: #F5FDFE;">
<mat-panel-title>
@ -128,7 +128,7 @@
</mat-expansion-panel>
</mat-accordion>
<!-- 重点部位 -->
<mat-accordion *ngIf="unit.keySiteNodes.length != 0">
<mat-accordion *ngIf="unit.keySiteNodes && unit.keySiteNodes.length != 0">
<mat-expansion-panel style="box-shadow: 0 0 black;" expanded>
<mat-expansion-panel-header collapsedHeight ='40px' expandedHeight='40px' style="position: relative;padding-left:20px;background: #F5FDFE;">
<mat-panel-title>
@ -170,7 +170,7 @@
</mat-expansion-panel>
</mat-accordion>
<!-- 功能分区 -->
<mat-accordion *ngIf="unit.funDivNodes.length != 0">
<mat-accordion *ngIf="unit.funDivNodes && unit.funDivNodes.length != 0">
<mat-expansion-panel style="box-shadow: 0 0 black;" expanded>
<mat-expansion-panel-header collapsedHeight ='40px' expandedHeight='40px' style="position: relative;padding-left:20px;background: #F5FDFE;">
<mat-panel-title>
@ -212,7 +212,7 @@
</mat-expansion-panel>
</mat-accordion>
<!-- 数据核验(消防设施) -->
<mat-accordion *ngIf="unit.fireFacNodes .length != 0">
<mat-accordion *ngIf="unit.fireFacNodes && unit.fireFacNodes .length != 0">
<mat-expansion-panel style="box-shadow: 0 0 black;" expanded>
<mat-expansion-panel-header collapsedHeight ='40px' expandedHeight='40px' style="position: relative;padding-left:20px;background: #F5FDFE;">
<mat-panel-title>

508
src/app/examiner/create-test-score/create-test-score.component.ts

@ -23,6 +23,11 @@ export class CreateTestScoreComponent implements OnInit {
this.selectedTab = index
}
ngOnInit(): void {
// this.getUnitData()
// .then(()=>{
// this.getAround()
// })
this.getUnitData()
this.getAround()
this.getKeySite()
@ -34,56 +39,6 @@ export class CreateTestScoreComponent implements OnInit {
clickUnitName(key){
this.selectedUnitIndex = key
}
//模拟单位数据
unitDatas:any = [
{name:'富丽华大酒店1',score:0,basicInfoScore:0,basicInfoItemScore:0,basicInfoNodes : [
{
name: '单位信息',
key: '0-0',
type:'基本信息',
expanded: true,
children: [
{name: '统一社会信用代码',key: '1',isLeaf:true},
{name: '单位类型',key: '2',isLeaf:true},
{name: '联系人',key: '3',isLeaf:true},
{name: '联系电话',key: '4',isLeaf:true},
{name: '辖区中队',key: '5',isLeaf:true},
{name: '单位地址',key: '6',isLeaf:true}
]
},
{
name: '建筑信息',
key: '0-1',
type:'基本信息',
expanded: true,
children: [
{ name: '面积', key: '0-1-0-0',isLeaf:true},
{ name: '高度', key: '0-1-0-1',isLeaf:true},
{ name: '层数', key: '0-1-0-2',isLeaf:true}
]
},
],aroundScore:0,aroundItemScore:0,aroundNodes :[
{
name: '单位四周毗邻',
key: '11',
expanded: true,
type:'四周毗邻',
children: [
{name: '东方向',key: '55',isLeaf:true},
]
},
{
name: '建筑四周毗邻',
key: '22',
expanded: true,
type:'四周毗邻',
children: [
{name: '东方向',key: '55',isLeaf:true},
]
},
]},
// {name:'富丽华大酒店2',score:0,basicInfoScore:0}
]
//上个页面传过来的单位数据
// unitId:any = [{name:'最最最最最',id:'5fb76c42919f2b44e464016f'},
@ -91,216 +46,219 @@ export class CreateTestScoreComponent implements OnInit {
// {name:'贵港油库',id:'5fa35d68f8eb762cb03c662e'}
// ]
unitId:any = JSON.parse(localStorage.getItem('checkedWork'))
//获取单位基本信息
getUnitData(){
this.unitId.forEach((element,index) => {
element.score = 0
element.basicInfoScore = 0
element.basicInfoItemScore = 0
this.http.get(`/api/Companies/${element.id}`).subscribe((data:any)=>{
// console.log('单位信息',index,data)
let unitData = {
name: '单位信息',
type:'基本信息',
expanded: false,
key:(Math.random()*10000000).toString(16).substr(0,4)+(new Date()).getTime()+Math.random().toString().substr(2,5),
children:[]
}
data.usci ? unitData.children.push({
name: '统一社会信用代码',key: element.id+'统一社会信用代码',isLeaf:true,value:data.usci
}) : null
data.buildingTypes[0].name ? unitData.children.push({
name: '单位类型',key: element.id+'单位类型',isLeaf:true,value:data.buildingTypes[0].name
}) : null
data.contacts ? unitData.children.push({
name: '联系人',key: element.id+'联系人',isLeaf:true,value:data.contacts
}) : null
data.phone ? unitData.children.push({
name: '联系电话',key: element.id+'联系电话',isLeaf:true,value:data.phone
}) : null
data.organizationName ? unitData.children.push({
name: '辖区中队',key: element.id+'辖区中队',isLeaf:true,value:data.organizationName
}) : null
data.address ? unitData.children.push({
name: '单位地址',key: element.id+'单位地址',isLeaf:true,value:data.address
}) : null
//获取单位基本信息
getUnitData(){
element.basicInfoNodes = []
element.basicInfoNodes.push(unitData)
var buildingsData:any
this.http.get("/api/Buildings",{
params:{
companyId:element.id
this.unitId.forEach((element,index) => {
element.score = 0
element.basicInfoScore = 0
element.basicInfoItemScore = 0
this.http.get(`/api/Companies/${element.id}`).subscribe((data:any)=>{
let unitData = {
name: '单位信息',
type:'基本信息',
expanded: false,
key:(Math.random()*10000000).toString(16).substr(0,4)+(new Date()).getTime()+Math.random().toString().substr(2,5),
children:[]
}
}).subscribe(async (data:any)=>{
buildingsData = data
for (let i = 0, length = data.length; i < length; i++){
const result = await new Promise((resolve) =>{
this.http.get("/api/BuildingBasicInfos",{ // 循环请求当前单位建筑每一个建筑的信息保存到数组中
params:{
companyId :element.id,
buildingId:data[i].id,
buildingType:data[i].buildingTypes[0].id
}
}).subscribe((buildingsData:any)=>{
// console.log(1234,buildingsData)
buildingsData.name = data[i].name
buildingsData.buildingType = data[i].buildingTypes[0].name
buildingsData[0].buildingBasicGroups.forEach((y,m) => {
let propertyInfosArr = []
let tabledata
if(y.type == 1){//如果是表格类
var map = {},
dest:any = [];
for(var i = 0; i < y.propertyInfos.length; i++){
var ai = y.propertyInfos[i];
if(!map[ai.propertyName]){
dest.push({
propertyName: ai.propertyName,
data: [ai]
});
map[ai.propertyName] = ai;
}else{
for(var j = 0; j < dest.length; j++){
var dj = dest[j];
if(dj.propertyName == ai.propertyName){
dj.data.push(ai);
break;
}
}
data.usci ? unitData.children.push({
name: '统一社会信用代码',key: element.id+'统一社会信用代码',isLeaf:true,value:data.usci
}) : null
data.buildingTypes[0].name ? unitData.children.push({
name: '单位类型',key: element.id+'单位类型',isLeaf:true,value:data.buildingTypes[0].name
}) : null
data.contacts ? unitData.children.push({
name: '联系人',key: element.id+'联系人',isLeaf:true,value:data.contacts
}) : null
data.phone ? unitData.children.push({
name: '联系电话',key: element.id+'联系电话',isLeaf:true,value:data.phone
}) : null
data.organizationName ? unitData.children.push({
name: '辖区中队',key: element.id+'辖区中队',isLeaf:true,value:data.organizationName
}) : null
data.address ? unitData.children.push({
name: '单位地址',key: element.id+'单位地址',isLeaf:true,value:data.address
}) : null
element.basicInfoNodes = []
element.basicInfoNodes.push(unitData)
var buildingsData:any
this.http.get("/api/Buildings",{
params:{
companyId:element.id
}
}).subscribe(async (data:any)=>{
buildingsData = data
for (let i = 0, length = data.length; i < length; i++){
const result = await new Promise((resolve) =>{
this.http.get("/api/BuildingBasicInfos",{ // 循环请求当前单位建筑每一个建筑的信息保存到数组中
params:{
companyId :element.id,
buildingId:data[i].id,
buildingType:data[i].buildingTypes[0].id
}
}).subscribe((buildingsData:any)=>{
buildingsData.name = data[i].name
buildingsData.buildingType = data[i].buildingTypes[0].name
buildingsData[0].buildingBasicGroups.forEach((y,m) => {
let propertyInfosArr = []
let tabledata
if(y.type == 1){//如果是表格类
var map = {},
dest:any = [];
for(var i = 0; i < y.propertyInfos.length; i++){
var ai = y.propertyInfos[i];
if(!map[ai.propertyName]){
dest.push({
propertyName: ai.propertyName,
data: [ai]
});
map[ai.propertyName] = ai;
}else{
for(var j = 0; j < dest.length; j++){
var dj = dest[j];
if(dj.propertyName == ai.propertyName){
dj.data.push(ai);
break;
}
}
}
}
//根据行数确定在循环数组中的index
dest.forEach(item => {
item.data.sort(function(a,b){
return Number(a.tag) - Number(b.tag)
})
})
y.tabledata = dest
tabledata = dest
y.tabledata[0].data.forEach((x,key) => {
if(x.propertyValue){
x.key = (Math.random()*10000000).toString(16).substr(0,4)+(new Date()).getTime()+Math.random().toString().substr(2,5)
x.isLeaf = true
x.name = x.propertyValue
propertyInfosArr.push(x)
}
})
}else{
y.propertyInfos.forEach((x,key) => {
if(x.propertyValue){
x.key = (Math.random()*10000000).toString(16).substr(0,4)+(new Date()).getTime()+Math.random().toString().substr(2,5)
x.isLeaf = true
x.name = x.propertyName
propertyInfosArr.push(x)
}
})
}
//根据行数确定在循环数组中的index
dest.forEach(item => {
item.data.sort(function(a,b){
return Number(a.tag) - Number(b.tag)
if(propertyInfosArr.length != 0){
element.basicInfoNodes.push({
name:y.name != '基本信息' ? buildingsData.name + '-' + y.name : buildingsData.name ,
type:'基本信息',
expanded: false,
key:(Math.random()*10000000).toString(16).substr(0,4)+(new Date()).getTime()+Math.random().toString().substr(2,5),
children:propertyInfosArr,
tabledata:tabledata ? tabledata : null
})
})
y.tabledata = dest
tabledata = dest
y.tabledata[0].data.forEach((x,key) => {
if(x.propertyValue){
x.key = (Math.random()*10000000).toString(16).substr(0,4)+(new Date()).getTime()+Math.random().toString().substr(2,5)
x.isLeaf = true
x.name = x.propertyValue
propertyInfosArr.push(x)
}
})
}else{
y.propertyInfos.forEach((x,key) => {
if(x.propertyValue){
x.key = (Math.random()*10000000).toString(16).substr(0,4)+(new Date()).getTime()+Math.random().toString().substr(2,5)
x.isLeaf = true
x.name = x.propertyName
propertyInfosArr.push(x)
}
})
}
if(propertyInfosArr.length != 0){
element.basicInfoNodes.push({
name:y.name != '基本信息' ? buildingsData.name + '-' + y.name : buildingsData.name ,
type:'基本信息',
expanded: false,
key:(Math.random()*10000000).toString(16).substr(0,4)+(new Date()).getTime()+Math.random().toString().substr(2,5),
children:propertyInfosArr,
tabledata:tabledata ? tabledata : null
})
element.basicInfoNodes = [...element.basicInfoNodes]
}
element.basicInfoNodes = [...element.basicInfoNodes]
}
})
resolve(i)
})
resolve(i)
})
})
}
// console.log(987,this.unitId)
})
}
})
})
})
})
})
}
//获取四周毗邻数据
getAround(){
this.unitId.forEach((element,index) => {
element.aroundScore = 0
element.aroundItemScore = 0
element.aroundNodes = []
//获得当前单位的单位毗邻
let id = {companyId:element.id}
this.http.get('/api/CompanyAdjoins',{params:id}).subscribe((data:any)=>{
// console.log(index+'四周毗邻',data)
data.forEach(item => {
item.direction == 0 ? item.title = '东方向' : null
item.direction == 1 ? item.title = '西方向' : null
item.direction == 2 ? item.title = '南方向' : null
item.direction == 3 ? item.title = '北方向' : null
item.direction == 4 ? item.title = '东南方向' : null
item.direction == 5 ? item.title = '西南方向' : null
item.direction == 6 ? item.title = '东北方向' : null
item.direction == 7 ? item.title = '西北方向' : null
item.isLeaf = true,
item.key = item.id
})
//如果存在单位毗邻
if(data.length != 0){
this.unitId[index].aroundNodes.push({
name: '单位毗邻',
key: (Math.random()*10000000).toString(16).substr(0,4)+(new Date()).getTime()+Math.random().toString().substr(2,5),
expanded: false,
type:'四周毗邻',
children: data
this.unitId.forEach((element,index) => {
element.aroundScore = 0
element.aroundItemScore = 0
element.aroundNodes = []
//获得当前单位的单位毗邻
let id = {companyId:element.id}
this.http.get('/api/CompanyAdjoins',{params:id}).subscribe((data:any)=>{
// console.log(index+'四周毗邻',data)
data.forEach(item => {
item.direction == 0 ? item.title = '东方向' : null
item.direction == 1 ? item.title = '西方向' : null
item.direction == 2 ? item.title = '南方向' : null
item.direction == 3 ? item.title = '北方向' : null
item.direction == 4 ? item.title = '东南方向' : null
item.direction == 5 ? item.title = '西南方向' : null
item.direction == 6 ? item.title = '东北方向' : null
item.direction == 7 ? item.title = '西北方向' : null
item.isLeaf = true,
item.key = item.id
})
element.aroundNodes = [...element.aroundNodes]
}
})
//如果存在单位毗邻
if(data.length != 0){
this.unitId[index].aroundNodes.push({
name: '单位毗邻',
key: (Math.random()*10000000).toString(16).substr(0,4)+(new Date()).getTime()+Math.random().toString().substr(2,5),
expanded: false,
type:'四周毗邻',
children: data
})
element.aroundNodes = [...element.aroundNodes]
}
})
//获得当前单位的建筑毗邻
this.http.get('/api/Buildings',{params:id}).subscribe((data:any)=>{
if (data.length) {
getAllArchitecture(data)
}
})
let that = this
async function getAllArchitecture(buildingsdata){
for (let i = 0, length = buildingsdata.length; i < length; i++){
let id = {buildingId:buildingsdata[i].id}
let result = await new Promise((resolve, reject) => {
that.http.get('/api/BuildingAdjoins',{params:id}).subscribe((data:any)=>{
data.forEach(item => {
item.direction == 0 ? item.title = '东方向' : null
item.direction == 1 ? item.title = '西方向' : null
item.direction == 2 ? item.title = '南方向' : null
item.direction == 3 ? item.title = '北方向' : null
item.direction == 4 ? item.title = '东南方向' : null
item.direction == 5 ? item.title = '西南方向' : null
item.direction == 6 ? item.title = '东北方向' : null
item.direction == 7 ? item.title = '西北方向' : null
item.isLeaf = true
item.key = item.id
})
if(data.length != 0){
that.unitId[index].aroundNodes.push({
name: buildingsdata[i].name,
key: (Math.random()*10000000).toString(16).substr(0,4)+(new Date()).getTime()+Math.random().toString().substr(2,5),
expanded: false,
type:'四周毗邻',
children: data
})
element.aroundNodes = [...element.aroundNodes]
}
resolve('1')
})
})
}
//获得当前单位的建筑毗邻
this.http.get('/api/Buildings',{params:id}).subscribe((data:any)=>{
if (data.length) {
getAllArchitecture(data)
}
})
let that = this
async function getAllArchitecture(buildingsdata){
for (let i = 0, length = buildingsdata.length; i < length; i++){
let id = {buildingId:buildingsdata[i].id}
let result = await new Promise((resolve, reject) => {
that.http.get('/api/BuildingAdjoins',{params:id}).subscribe((data:any)=>{
data.forEach(item => {
item.direction == 0 ? item.title = '东方向' : null
item.direction == 1 ? item.title = '西方向' : null
item.direction == 2 ? item.title = '南方向' : null
item.direction == 3 ? item.title = '北方向' : null
item.direction == 4 ? item.title = '东南方向' : null
item.direction == 5 ? item.title = '西南方向' : null
item.direction == 6 ? item.title = '东北方向' : null
item.direction == 7 ? item.title = '西北方向' : null
item.isLeaf = true
item.key = item.id
})
if(data.length != 0){
that.unitId[index].aroundNodes.push({
name: buildingsdata[i].name,
key: (Math.random()*10000000).toString(16).substr(0,4)+(new Date()).getTime()+Math.random().toString().substr(2,5),
expanded: false,
type:'四周毗邻',
children: data
})
element.aroundNodes = [...element.aroundNodes]
}
resolve('1')
})
})
}
}
})
}
//获取重点部位
getKeySite(){
@ -719,10 +677,13 @@ export class CreateTestScoreComponent implements OnInit {
//添加预案
addPlan(){
let companyId = {
companyId : this.unitId[this.selectedUnitIndex].id
}
const dialogRef = this.dialog.open(AddPlanDialog, {
width: '380px',
height: '136px',
data: {}
data: companyId
});
dialogRef.afterClosed().subscribe(result => {
@ -1028,14 +989,13 @@ export class CreateTestScoreComponent implements OnInit {
console.log(paperDataInfo)
const dialogRef = this.dialog.open(FinishDialog, {
width: '700px',
height: '300px',
width: '650px',
data: paperDataInfo
});
dialogRef.afterClosed().subscribe(result => {
console.log('The dialog was closed');
this.router.navigate(['/home/createexam-index']) //跳转试卷列表页面
});
}
//上一步
@ -1064,9 +1024,13 @@ export class AddPlanDialog {
//选择想要添加的预案类型 (已存在或者自定义)
selectType(type){
let obj = {
type:type,
companyId:this.data.companyId
}
const dialogRef = this.dialog.open(AddPlanTwoDialog, {
id:'addPlanTwo',
data: {type}
data: obj
});
dialogRef.afterClosed().subscribe(result => {
@ -1075,12 +1039,6 @@ export class AddPlanDialog {
}
}
const ELEMENT_DATA: any = [
{id: 1, name: '五楼电梯故障', people:'上海总队',time:'2020-06-15',level:'总队'},
{id: 2, name: '故障搜救', people:'超级管理员',time:'2020-06-15',level:'总队'},
{id: 3, name: '故障搜救', people:'超级管理员',time:'2020-06-15',level:'总队'},
{id: 4, name: '五楼电梯故障', people:'上海总队',time:'2020-06-15',level:'总队'},
];
//添加预案2
@Component({
@ -1090,25 +1048,32 @@ const ELEMENT_DATA: any = [
})
export class AddPlanTwoDialog {
constructor(public dialog: MatDialog,public dialogRef: MatDialogRef<AddPlanTwoDialog>,@Inject(MAT_DIALOG_DATA) public data: any) {}
constructor(private http: HttpClient,public dialog: MatDialog,public dialogRef: MatDialogRef<AddPlanTwoDialog>,@Inject(MAT_DIALOG_DATA) public data: any) {}
planType:any = this.data.type == 1 ? true : false//显示的预案类型
displayedColumns: string[] = ['select', 'name', 'people', 'time', 'level'];
dataSource = new MatTableDataSource<any>(ELEMENT_DATA);
selection = new SelectionModel<any>(true, []);
isAllSelected() {
const numSelected = this.selection.selected.length;
const numRows = this.dataSource.data.length;
return numSelected === numRows;
}
masterToggle() {
this.isAllSelected() ?
this.selection.clear() :
this.dataSource.data.forEach(row => this.selection.select(row));
dataSource : any //列表数据
selectedradio
radioChange(e){
console.log(e)
}
ngOnInit(): void {
// console.log(this.data.companyId)
this.get2DPlan()
}
//获取当前公司的二维预案
get2DPlan(){
let planArr = []
this.http.get('/api/PlanComponents',{params:{
companyId:this.data.companyId
}}).subscribe((data:any) => {
console.log(123,data)
data.items.forEach(item => {
item.planType == 1 ? planArr.push(item) : null
})
this.dataSource = planArr
})
}
onNoClick(): void {
@ -1117,7 +1082,7 @@ export class AddPlanTwoDialog {
//确定
confirm(){
if(this.planType == 1){
console.log(this.selection)
}else{
}
@ -1137,9 +1102,8 @@ export class AddPlanTwoDialog {
})
export class FinishDialog{
constructor(private http: HttpClient,public dialog: MatDialog,public snackBar: MatSnackBar,public dialogRef: MatDialogRef<AddPlanTwoDialog>,@Inject(MAT_DIALOG_DATA) public data: any) {}
constructor(private router:Router,private http: HttpClient,public dialog: MatDialog,public snackBar: MatSnackBar,public dialogRef: MatDialogRef<AddPlanTwoDialog>,@Inject(MAT_DIALOG_DATA) public data: any) {}
ngOnInit(): void {
// console.log( new Date())
this.getProfiles()
}
//获取登录账号的个人资料
@ -1198,6 +1162,7 @@ export class FinishDialog{
this.http.post('/api/Papers',params).subscribe(data => {
this.snackBar.open('创建成功','确定',config);
this.dialogRef.close();
this.router.navigate(['/home/createexam-index']) //跳转试卷列表页面
},err => {
this.snackBar.open(err,'确定',config);
})
@ -1235,6 +1200,9 @@ export class FinishDialog{
getWeek(result: Date[]): void {
console.log('week: ', result.map(getISOWeek));
}
close(){
this.dialogRef.close();
}
}
//查看答案

10
src/app/examiner/create-test-score/finishDialog.html

@ -8,18 +8,18 @@
-->
<div class="box">
<div class="diaone">
<div><label>请填写试卷类型</label></div>
<div style="margin-bottom: 5px;"><label>请填写试卷类型:</label></div>
<div><input placeholder="请填写" [(ngModel)]="examName"></div>
</div>
<div class="diatwo">
<div class="starttime">
<div><label>请选择开始时间</label></div>
<div style="margin-bottom: 5px;"><label>请选择开始时间:</label></div>
<!-- <div><nz-range-picker class="datepicker" nzFormat="yyyy-MM-dd HH:mm" [nzShowTime]="{ nzHideDisabledOptions: true, nzDefaultOpenValue: timeDefaultValue }" [nzDisabledTime]="disabledDateTime" [(ngModel)]="date" (ngModelChange)="onChange($event)"></nz-range-picker>
</div> -->
<div><input type="datetime-local" name="start_time" value="" [(ngModel)]="startTime" /></div>
</div>
<div class="endtime">
<div><label>请选择结束时间</label></div>
<div style="margin-bottom: 5px;"><label>请选择结束时间:</label></div>
<div><input type="datetime-local" name="end_time" value="" [(ngModel)]="endTime"/></div>
</div>
@ -27,6 +27,6 @@
<div mat-dialog-actions style="margin-top: 20px;">
<button mat-button (click)="onNoClick()" style="background-color: #07CDCF;margin-left: 200px;color: #fff;">确定</button>
<button mat-button [mat-dialog-close]="data.animal" style=" background-color: #FF8678;margin-left: 25px;color: #fff;">取消</button>
</div>
<button mat-button type="button" (click)="close()" style=" background-color: #FF8678;margin-left: 25px;color: #fff;">取消</button>
</div>
</div>

3
src/app/examiner/examiner.module.ts

@ -52,9 +52,10 @@ import { NzTreeModule } from 'ng-zorro-antd/tree';
import { ExaminerIndexComponent } from './examiner-index/examiner-index.component';
import { ExaminerNewOneComponent } from './examiner-new-one/examiner-new-one.component';
import { NzDatePickerModule } from 'ng-zorro-antd/date-picker';
import { PlanLevel } from '../pipes/size.pipe';
@NgModule({
declarations: [CreateTestScoreComponent,AddPlanDialog,AddPlanTwoDialog,LookTreeNodeDialog,ExaminerIndexComponent, ExaminerNewOneComponent,FinishDialog],
declarations: [CreateTestScoreComponent,AddPlanDialog,AddPlanTwoDialog,LookTreeNodeDialog,ExaminerIndexComponent, ExaminerNewOneComponent,FinishDialog,PlanLevel],
imports: [
CommonModule,
examinerRoutingModule,

18
src/app/pipes/size.pipe.ts

@ -55,4 +55,22 @@ export class testState implements PipeTransform {
return "已结束"
}
}
}
export enum PlanLevelEnum {
"编制级别0",
"总队",
"支队",
"编制级别3",
"大队",
"编制级别5",
"编制级别6",
"编制级别7",
"中队"
}
@Pipe({name: 'planlevel'})
export class PlanLevel implements PipeTransform {
transform(value: number): string {
return PlanLevelEnum[value]
}
}
Loading…
Cancel
Save