refactor ConformanceTimeRrange created
This commit is contained in:
@@ -229,100 +229,91 @@ export default {
|
|||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.$emitter.on('actRadioData', (data) => {
|
this.$emitter.on('actRadioData', (data) => {
|
||||||
switch (data.category) {
|
const category = data.category;
|
||||||
|
const task = data.task;
|
||||||
|
|
||||||
|
const handleDoubleSelection = (startKey, endKey, timeKey, durationType) => {
|
||||||
|
this[startKey] = task;
|
||||||
|
this[timeKey] = { min: 0, max: 0 };
|
||||||
|
if (this[endKey]) {
|
||||||
|
this[timeKey] = this.getDurationTime(this[durationType], 'double', task, this[endKey]);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleSingleSelection = (key, timeKey, durationType) => {
|
||||||
|
this[timeKey] = this.getDurationTime(this[durationType], 'single', task);
|
||||||
|
};
|
||||||
|
|
||||||
|
switch (category) {
|
||||||
// Activity duration
|
// Activity duration
|
||||||
case 'cfmDur':
|
case 'cfmDur':
|
||||||
this.timeDuration = this.getDurationTime(this.conformanceAllTasks, 'act', data.task);
|
this.timeDuration = this.getDurationTime(this.conformanceAllTasks, 'act', task);
|
||||||
break;
|
break;
|
||||||
// Processing time
|
// Processing time
|
||||||
case 'cfmPtEteStart':
|
case 'cfmPtEteStart':
|
||||||
this.timeCfmPtEteStart = this.getDurationTime(this.cfmPtEteStart, 'single', data.task);
|
handleSingleSelection('cfmPtEteStart', 'timeCfmPtEteStart', 'cfmPtEteStart');
|
||||||
break;
|
break;
|
||||||
case 'cfmPtEteEnd':
|
case 'cfmPtEteEnd':
|
||||||
this.timeCfmPtEteEnd = this.getDurationTime(this.cfmPtEteEnd, 'single', data.task);
|
handleSingleSelection('cfmPtEteEnd', 'timeCfmPtEteEnd', 'cfmPtEteEnd');
|
||||||
break;
|
break;
|
||||||
case 'cfmPtEteSEStart':
|
case 'cfmPtEteSEStart':
|
||||||
this.selectCfmPtEteSEStart = data.task;
|
handleDoubleSelection('selectCfmPtEteSEStart', 'selectCfmPtEteSEEnd', 'timeCfmPtEteSE', 'cfmPtEteSE');
|
||||||
this.timeCfmPtEteSE = {min: 0, max: 0};
|
break;
|
||||||
if(this.selectCfmPtEteSEEnd) this.timeCfmPtEteSE = this.getDurationTime(this.cfmPtEteSE, 'double', data.task, this.selectCfmPtEteSEEnd);
|
|
||||||
break;
|
|
||||||
case 'cfmPtEteSEEnd':
|
case 'cfmPtEteSEEnd':
|
||||||
this.selectCfmPtEteSEEnd = data.task;
|
handleDoubleSelection('selectCfmPtEteSEEnd', 'selectCfmPtEteSEStart', 'timeCfmPtEteSE', 'cfmPtEteSE');
|
||||||
this.timeCfmPtEteSE = {min: 0, max: 0};
|
break;
|
||||||
if(this.selectCfmPtEteSEStart) this.timeCfmPtEteSE = this.getDurationTime(this.cfmPtEteSE, 'double', this.selectCfmPtEteSEStart, data.task);
|
|
||||||
break;
|
|
||||||
case 'cfmPtPStart':
|
case 'cfmPtPStart':
|
||||||
this.timeCfmPtPStart = this.getDurationTime(this.cfmPtPStart, 'single', data.task);
|
handleSingleSelection('cfmPtPStart', 'timeCfmPtPStart', 'cfmPtPStart');
|
||||||
break;
|
break;
|
||||||
case 'cfmPtPEnd':
|
case 'cfmPtPEnd':
|
||||||
this.timeCfmPtPEnd = this.getDurationTime(this.cfmPtPEnd, 'single', data.task);
|
handleSingleSelection('cfmPtPEnd', 'timeCfmPtPEnd', 'cfmPtPEnd');
|
||||||
break;
|
break;
|
||||||
case 'cfmPtPSEStart':
|
case 'cfmPtPSEStart':
|
||||||
this.selectCfmPtPSEStart = data.task;
|
handleDoubleSelection('selectCfmPtPSEStart', 'selectCfmPtPSEEnd', 'timeCfmPtPSE', 'cfmPtPSE');
|
||||||
this.timeCfmPtPSE = {min: 0, max: 0};
|
break;
|
||||||
if(this.selectCfmPtPSEEnd) {
|
|
||||||
this.timeCfmPtPSE = this.getDurationTime(this.cfmPtPSE, 'double', data.task, this.selectCfmPtPSEEnd);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'cfmPtPSEEnd':
|
case 'cfmPtPSEEnd':
|
||||||
this.selectCfmPtPSEEnd = data.task;
|
handleDoubleSelection('selectCfmPtPSEEnd', 'selectCfmPtPSEStart', 'timeCfmPtPSE', 'cfmPtPSE');
|
||||||
this.timeCfmPtPSE = {min: 0, max: 0};
|
break;
|
||||||
if(this.selectCfmPtPSEStart) {
|
|
||||||
this.timeCfmPtPSE = this.getDurationTime(this.cfmPtPSE, 'double', this.selectCfmPtPSEStart, data.task);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
// Waiting time
|
// Waiting time
|
||||||
case 'cfmWtEteStart':
|
case 'cfmWtEteStart':
|
||||||
this.timeCfmWtEteStart = this.getDurationTime(this.cfmWtEteStart, 'single', data.task);
|
handleSingleSelection('cfmWtEteStart', 'timeCfmWtEteStart', 'cfmWtEteStart');
|
||||||
break;
|
break;
|
||||||
case 'cfmWtEteEnd':
|
case 'cfmWtEteEnd':
|
||||||
this.timeCfmWtEteEnd = this.getDurationTime(this.cfmWtEteEnd, 'single', data.task);
|
handleSingleSelection('cfmWtEteEnd', 'timeCfmWtEteEnd', 'cfmWtEteEnd');
|
||||||
break;
|
break;
|
||||||
case 'cfmWtEteSEStart':
|
case 'cfmWtEteSEStart':
|
||||||
this.selectCfmWtEteSEStart = data.task;
|
handleDoubleSelection('selectCfmWtEteSEStart', 'selectCfmWtEteSEEnd', 'timeCfmWtEteSE', 'cfmWtEteSE');
|
||||||
this.timeCfmWtEteSE = {min: 0, max: 0};
|
break;
|
||||||
if(this.selectCfmWtEteSEEnd) this.timeCfmWtEteSE = this.getDurationTime(this.cfmWtEteSE, 'double', data.task, this.selectCfmWtEteSEEnd);
|
|
||||||
break;
|
|
||||||
case 'cfmWtEteSEEnd':
|
case 'cfmWtEteSEEnd':
|
||||||
this.selectCfmWtEteSEEnd = data.task;
|
handleDoubleSelection('selectCfmWtEteSEEnd', 'selectCfmWtEteSEStart', 'timeCfmWtEteSE', 'cfmWtEteSE');
|
||||||
this.timeCfmWtEteSE = {min: 0, max: 0};
|
break;
|
||||||
if(this.selectCfmWtEteSEStart) this.timeCfmWtEteSE = this.getDurationTime(this.cfmWtEteSE, 'double', this.selectCfmWtEteSEStart, data.task);
|
|
||||||
break;
|
|
||||||
case 'cfmWtPStart':
|
case 'cfmWtPStart':
|
||||||
this.timeCfmWtPStart = this.getDurationTime(this.cfmWtPStart, 'single', data.task);
|
handleSingleSelection('cfmWtPStart', 'timeCfmWtPStart', 'cfmWtPStart');
|
||||||
break;
|
break;
|
||||||
case 'cfmWtPEnd':
|
case 'cfmWtPEnd':
|
||||||
this.timeCfmWtPEnd = this.getDurationTime(this.cfmWtPEnd, 'single', data.task);
|
handleSingleSelection('cfmWtPEnd', 'timeCfmWtPEnd', 'cfmWtPEnd');
|
||||||
break;
|
break;
|
||||||
case 'cfmWtPSEStart':
|
case 'cfmWtPSEStart':
|
||||||
this.selectCfmWtPSEStart = data.task;
|
handleDoubleSelection('selectCfmWtPSEStart', 'selectCfmWtPSEEnd', 'timeCfmWtPSE', 'cfmWtPSE');
|
||||||
this.timeCfmWtPSE = {min: 0, max: 0};
|
break;
|
||||||
if(this.selectCfmWtPSEEnd) this.timeCfmWtPSE = this.getDurationTime(this.cfmWtPSE, 'double', data.task, this.selectCfmWtPSEEnd);
|
|
||||||
break;
|
|
||||||
case 'cfmWtPSEEnd':
|
case 'cfmWtPSEEnd':
|
||||||
this.selectCfmWtPSEEnd = data.task;
|
handleDoubleSelection('selectCfmWtPSEEnd', 'selectCfmWtPSEStart', 'timeCfmWtPSE', 'cfmWtPSE');
|
||||||
this.timeCfmWtPSE = {min: 0, max: 0};
|
break;
|
||||||
if(this.selectCfmWtPSEStart) this.timeCfmWtPSE = this.getDurationTime(this.cfmWtPSE, 'double', this.selectCfmWtPSEStart, data.task);
|
|
||||||
break;
|
|
||||||
// Cycle time
|
// Cycle time
|
||||||
case 'cfmCtEteStart':
|
case 'cfmCtEteStart':
|
||||||
this.timeCfmCtEteStart = this.getDurationTime(this.cfmPtEteStart, 'single', data.task);
|
handleSingleSelection('cfmCtEteStart', 'timeCfmCtEteStart', 'cfmCtEteStart');
|
||||||
break;
|
break;
|
||||||
case 'cfmCtEteEnd':
|
case 'cfmCtEteEnd':
|
||||||
this.timeCfmCtEteEnd = this.getDurationTime(this.cfmCtEteEnd, 'single', data.task);
|
handleSingleSelection('cfmCtEteEnd', 'timeCfmCtEteEnd', 'cfmCtEteEnd');
|
||||||
break;
|
break;
|
||||||
case 'cfmCtEteSEStart':
|
case 'cfmCtEteSEStart':
|
||||||
this.selectCfmCtEteSEStart = data.task;
|
handleDoubleSelection('selectCfmCtEteSEStart', 'selectCfmCtEteSEEnd', 'timeCfmCtEteSE', 'cfmCtEteSE');
|
||||||
this.timeCfmCtEteSEE = {min: 0, max: 0};
|
break;
|
||||||
if(this.selectCfmCtEteSEEnd) this.timeCfmCtEteSE = this.getDurationTime(this.cfmCtEteSE, 'double', data.task, this.selectCfmCtEteSEEnd);
|
|
||||||
break;
|
|
||||||
case 'cfmCtEteSEEnd':
|
case 'cfmCtEteSEEnd':
|
||||||
this.selectCfmCtEteSEEnd = data.task;
|
handleDoubleSelection('selectCfmCtEteSEEnd', 'selectCfmCtEteSEStart', 'timeCfmCtEteSE', 'cfmCtEteSE');
|
||||||
this.timeCfmCtEteSEE = {min: 0, max: 0};
|
break;
|
||||||
if(this.selectCfmCtEteSEStart) this.timeCfmCtEteSE = this.getDurationTime(this.cfmCtEteSE, 'double', this.selectCfmCtEteSEStart, data.task);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
this.$emitter.on('reset', (data) => {
|
this.$emitter.on('reset', (data) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user