Commit 56932e6c authored by zhuangzhuang's avatar zhuangzhuang

修改牛舍配置页: 风机,水槽,照明模式添加或替换

parent f683a72f
...@@ -34,25 +34,24 @@ const opts = { ...@@ -34,25 +34,24 @@ const opts = {
], ],
stretch: [ stretch: [
style({ height: '0' }), style({ height: '0' }),
animate(styles.easeIn, style({ height: '*' })) animate(styles.faseOutSlowIn, style({ height: '*' }))
], ],
flyIn: [ flyIn: [
style({ transform: 'translateY(-50%)', zIndex: '-5' }), // translateX(-100%) style({ transform: 'translateX(-100%)' }), // translateX(-100%)
animate(styles.easeIn, style({ transform: 'translateY(0)' })) animate(styles.inOutBack, style({ transform: '*' }))
], ],
flyOut: [ flyOut: [
style({ zIndex: '-5' }), style({ transform: '*' }),
animate(styles.easeIn, style({ transform: 'translateY(-50%)'})) animate(styles.inOutBack, style({ transform: 'translateX(-100%)' }))
],
up: [
style({ transform: 'translateY(-50%)' }), // translateX(-100%)
animate(styles.inOutBack, style({ transform: '*' }))
],
down: [
style({ transform: '*' }),
animate(styles.inOutBack, style({ transform: 'translateY(-50%)' }))
], ],
// flyIn: [
// style({ transform: 'translateX(-100%)' }), // translateX(-100%)
// animate(styles.inOutBack, style({ transform: '*' }))
// ],
// flyOut: [
// style({ transform: '*' }),
// animate(styles.inOutBack, style({ transform: 'translateX(-100%)' }))
// ],
zoomIn: [ zoomIn: [
style({ transform: 'scale(.5)' }), style({ transform: 'scale(.5)' }),
animate(styles.inOutBack, style({ transform: '*' })) animate(styles.inOutBack, style({ transform: '*' }))
...@@ -75,6 +74,8 @@ export const flyIn = [trigger('flyIn', [transition('void => *', opts.flyIn)])] ...@@ -75,6 +74,8 @@ export const flyIn = [trigger('flyIn', [transition('void => *', opts.flyIn)])]
export const flyOut = [trigger('flyOut', [transition('* => void', opts.flyOut)])] export const flyOut = [trigger('flyOut', [transition('* => void', opts.flyOut)])]
export const zoomIn = [trigger('zoomIn', [transition('void => *', opts.zoomIn)])] export const zoomIn = [trigger('zoomIn', [transition('void => *', opts.zoomIn)])]
export const zoomOut = [trigger('zoomOut', [transition('* => void', opts.zoomOut)])] export const zoomOut = [trigger('zoomOut', [transition('* => void', opts.zoomOut)])]
export const up = [trigger('zoomIn', [transition('void => *', opts.up)])]
export const down = [trigger('zoomOut', [transition('* => void', opts.down)])]
export const animations = [ export const animations = [
trigger('animations', [ trigger('animations', [
...@@ -85,6 +86,8 @@ export const animations = [ ...@@ -85,6 +86,8 @@ export const animations = [
transition('* => flyIn', opts.flyIn), transition('* => flyIn', opts.flyIn),
transition('* => flyOut', opts.flyOut), transition('* => flyOut', opts.flyOut),
transition('* => zoomIn', opts.zoomIn), transition('* => zoomIn', opts.zoomIn),
transition('* => zoomOut', opts.zoomOut) transition('* => zoomOut', opts.zoomOut),
transition('* => up', opts.up),
transition('* => down', opts.down)
]) ])
] ]
This diff is collapsed.
...@@ -59,7 +59,8 @@ ...@@ -59,7 +59,8 @@
border-left: 5px solid #62C7CC; border-left: 5px solid #62C7CC;
font-weight: bold; font-weight: bold;
margin-left: 5px; margin-left: 5px;
margin-bottom: 3px; // margin-bottom: 3px;
border-bottom: 1px solid rgba(173, 173, 173, 0.5);
} }
.selectFont { .selectFont {
...@@ -69,3 +70,8 @@ ...@@ -69,3 +70,8 @@
.popContent { .popContent {
text-align: center; text-align: center;
} }
.tdBorder {
border-left: 1px solid;
border-top: 1px solid;
}
...@@ -2,19 +2,19 @@ import {Component, OnInit} from '@angular/core'; ...@@ -2,19 +2,19 @@ import {Component, OnInit} from '@angular/core';
import {PickerController, AlertController} from '@ionic/angular'; import {PickerController, AlertController} from '@ionic/angular';
import {Api} from '../../service/api'; import {Api} from '../../service/api';
import {Load} from '../../service/load'; import {Load} from '../../service/load';
import {shrink, stretch, zoomIn, zoomOut, fadeIn, fadeOut, flyIn, flyOut} from '../../animations/animations'; import {shrink, stretch, zoomIn, zoomOut, fadeIn, fadeOut, up, down} from '../../animations/animations';
@Component({ @Component({
selector: 'v-env-cfg', selector: 'v-env-cfg',
templateUrl: './env-cfg.page.html', templateUrl: './env-cfg.page.html',
styleUrls: ['./env-cfg.page.scss'], styleUrls: ['./env-cfg.page.scss'],
animations: [ animations: [
shrink, stretch, zoomIn, zoomOut, fadeIn, fadeOut, flyIn, flyOut shrink, stretch, zoomIn, zoomOut, fadeIn, fadeOut, up, down
] ]
}) })
export class EnvCfgPage implements OnInit { export class EnvCfgPage implements OnInit {
defaultColumnOptions = []; defaultColumnOptions = [[]];
fanMode = { fanMode = {
'selecting': false, 'selecting': false,
...@@ -235,7 +235,7 @@ export class EnvCfgPage implements OnInit { ...@@ -235,7 +235,7 @@ export class EnvCfgPage implements OnInit {
tempHaveTouch(event) { tempHaveTouch(event) {
for (let i = 10; i <= 50; i++) { for (let i = 10; i <= 50; i++) {
this.defaultColumnOptions[0][i - 9] = i.toString(); this.defaultColumnOptions[0][i - 10] = i.toString();
} }
if (this.fanMode.selecting === false) { if (this.fanMode.selecting === false) {
this.fanMode.selecting = true; this.fanMode.selecting = true;
...@@ -246,7 +246,7 @@ export class EnvCfgPage implements OnInit { ...@@ -246,7 +246,7 @@ export class EnvCfgPage implements OnInit {
humHaveTouch(event) { humHaveTouch(event) {
for (let i = 0; i <= 100; i++) { for (let i = 0; i <= 100; i++) {
this.defaultColumnOptions[0][i + 1] = i.toString(); this.defaultColumnOptions[0][i] = i.toString();
} }
if (this.fanMode.selecting === false) { if (this.fanMode.selecting === false) {
this.fanMode.selecting = true; this.fanMode.selecting = true;
...@@ -282,13 +282,13 @@ export class EnvCfgPage implements OnInit { ...@@ -282,13 +282,13 @@ export class EnvCfgPage implements OnInit {
}, },
{fieldDeviceType: '喷淋', {fieldDeviceType: '喷淋',
controlModel: '1', controlModel: '1',
controlConfig: [{id: '111', name: '模式一', T: 21, A: 35, B: 45, interval: 55}, controlConfig: [{id: 1, name: '模式一', T: 21, A: 35, B: 45, interval: 55},
{id: '222', name: '模式二', T: 21, A: 35, B: 45, interval: 55}] {id: 2, name: '模式二', T: 21, A: 35, B: 45, interval: 55}]
}, },
{fieldDeviceType: '照明', {fieldDeviceType: '照明',
controlModel: '1', controlModel: '1',
controlConfig: [{id: '111', name: '模式A', startDate: '10-01', stopDate: '11-02', on: '19:00', off: '05:00'}, controlConfig: [{id: 1, name: '模式A', startDate: '10-01', stopDate: '11-02', on: '19:00', off: '05:00'},
{id: '111', name: '模式B', startDate: '10-01', stopDate: '11-02', on: '19:00', off: '05:00'}] {id: 2, name: '模式B', startDate: '10-01', stopDate: '11-02', on: '19:00', off: '05:00'}]
}, },
{fieldDeviceType: '水槽', {fieldDeviceType: '水槽',
controlModel: '0', controlModel: '0',
...@@ -551,18 +551,24 @@ export class EnvCfgPage implements OnInit { ...@@ -551,18 +551,24 @@ export class EnvCfgPage implements OnInit {
} }
} }
// 喷淋:替换模式 // 喷淋:添加模式
addModel(models, selectedName) { addModel(models, selectedName) {
if (selectedName) { if (selectedName) {
const modelCount = this.light.controlConfig.length;
const selectedModel = models.filter(data => data.patternModelName === selectedName); const selectedModel = models.filter(data => data.patternModelName === selectedName);
selectedModel[0].configJson.id = modelCount + 1;
debugger;
this.shower.controlConfig.push(selectedModel[0].configJson); this.shower.controlConfig.push(selectedModel[0].configJson);
} }
} }
// 照明:添加模式 // 照明:替换模式
changeModel(models, selectedName) { changeModel(models, selectedName) {
if (selectedName) { if (selectedName) {
const selectedModel = models.filter(data => data.patternModelName === selectedName); const selectedModel = models.filter(data => data.patternModelName === selectedName);
selectedModel[0].configJson.forEach((item, index) => {
item.id = index + 1;
});
this.light.controlConfig = selectedModel[0].configJson; this.light.controlConfig = selectedModel[0].configJson;
} }
} }
...@@ -575,6 +581,13 @@ export class EnvCfgPage implements OnInit { ...@@ -575,6 +581,13 @@ export class EnvCfgPage implements OnInit {
list.push({type: 'radio', label: item.patternModelName, value: item.patternModelName, checked: false}); list.push({type: 'radio', label: item.patternModelName, value: item.patternModelName, checked: false});
}); });
} }
if (2 === device || 3 === device) {
list.push({
type: 'radio',
label: '自定义',
value: 'other',
checked: false});
}
const alert = await this.alerCtrl.create({ const alert = await this.alerCtrl.create({
header: deviceName + '常用模式选择', header: deviceName + '常用模式选择',
inputs: list, inputs: list,
...@@ -598,13 +611,6 @@ export class EnvCfgPage implements OnInit { ...@@ -598,13 +611,6 @@ export class EnvCfgPage implements OnInit {
} }
}}] }}]
}); });
if (2 === device || 3 === device) {
alert.inputs.push({
type: 'radio',
label: '自定义',
value: 'other',
checked: false});
}
await alert.present(); await alert.present();
} }
...@@ -627,4 +633,17 @@ export class EnvCfgPage implements OnInit { ...@@ -627,4 +633,17 @@ export class EnvCfgPage implements OnInit {
this.isOpenHeatStress = !this.isOpenHeatStress; this.isOpenHeatStress = !this.isOpenHeatStress;
} }
} }
deleteShowerModel(one) {
const updateModel = this.shower.controlConfig.filter(data => data.id !== one.id);
this.shower.controlConfig = updateModel;
this.shower.controlConfig.forEach((item, index) => item.id = index + 1);
}
deleteLightModel(one) {
const updateModel = this.light.controlConfig.filter(data => data.id !== one.id);
this.light.controlConfig = updateModel;
this.light.controlConfig.forEach((item, index) => item.id = index + 1);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment