fix editor

This commit is contained in:
Paolo Possanzini
2018-09-21 09:29:06 +02:00
parent f4e794034e
commit 9a18f43c4e
4 changed files with 42 additions and 24 deletions
@@ -9,6 +9,7 @@ import "./job-editor-lang-definition"
import { Container, Draggable } from "vue-smooth-dnd";
import { objectsJob } from "src/modules/base-components/cards";
import * as pf from "sprintf-js";
import { jobService } from "../services/jobService";
@Component({ components: { ace, Container, Draggable, objectsJob } })
export default class JobEditorDetail extends Vue {
@@ -22,6 +23,8 @@ export default class JobEditorDetail extends Vue {
commands = new Array<commandInstance>();
interactive: boolean = false;
macros: Array<string> = [];
get sortedCommands() {
return Array.from(this.activeCommandSet).sort((a, b) => {
if (a.order > b.order) return 1;
@@ -55,9 +58,9 @@ export default class JobEditorDetail extends Vue {
commandsChanged(n, o) {
if (n && this.interactive) {
var result = "";
debugger
this.commands.forEach(c => {
result += pf.vsprintf(c.definition.command, c.value || "", c.value2 || "") + "\n";
result += pf.vsprintf(c.definition.command, [c.value || "", c.value2 || ""]) + "\n";
});
this.isoProgram = result;
@@ -108,6 +111,10 @@ export default class JobEditorDetail extends Vue {
vScrollBarAlwaysVisible: true
})
}
async mounted() {
this.macros = await jobService.GetMacroList();
}
}
interface commandDefinition {
@@ -31,7 +31,7 @@
</div>
<div class="details" slot v-if="p.title=='job_item_macro_cms'">
<select v-model="p.value">
<option v-for="(m, index) in macros" :key="index" :value="m">{{m}}</option>
</select>
</div>
</objects-job>
+21 -21
View File
@@ -30,34 +30,34 @@ export default class JobEditor extends Vue {
const siemensJobItems = [
{ title: 'job_item_part_program', layout: "big", command: 'CALL "%s"', rx: /CALL "(.+)";?|CALL "(.+)";([.]*)"/, order: 0 },
{ title: 'job_item_macro_cms', layout: "big", command: 'PCALL /_N_CMA_DIR/%s', rx: /PCALL \/_N_CMA_DIR\/(.+);?|PCALL \/_N_CMA_DIR\/(.+);?([.]*)/, order: 0 },
{ title: 'job_item_text', layout: "big", command: "%s", rx: /(.+);?|(.+);([.]*)/, order: 100 },
{ title: 'job_item_pause', layout: "small", command: "M0;%s", rx: /^M0;?|^M0;([.]*)/, order: 0 },
{ title: 'job_item_delay', layout: "small", command: "G04 F%s;", rx: /G04 F(\d*);?|G04 F(\d*);([.]*)/, order: 0 },
{ title: 'job_item_origin', layout: "small", command: "G%s", rx: /G(.+);?|G(.+);([.]*)/, order: 0 },
{ title: 'job_item_end_program', layout: "small", command: "M30", rx: /M30;?|M30;([.]*)/, order: 0 },
{ title: 'job_item_part_program', layout: "big", command: 'CALL "%s";%s', rx: /CALL "(.+)";(.*)|CALL "(.+)";?/, order: 0 },
{ title: 'job_item_macro_cms', layout: "big", command: 'PCALL /_N_CMA_DIR/%s;%s', rx: /PCALL \/_N_CMA_DIR\/(.+);(.*)|PCALL \/_N_CMA_DIR\/(.+);?/, order: 0 },
{ title: 'job_item_text', layout: "big", command: "%s;%s", rx: /(.+);(.*)|(.+);?/, order: 100 },
{ title: 'job_item_pause', layout: "small", command: "M0;%s", rx: /^M0;(.*)|^M0;?/, order: 0 },
{ title: 'job_item_delay', layout: "small", command: "G04 F%s;%s", rx: /G04 F(\d*);(.*)|G04 F(\d*);?/, order: 0 },
{ title: 'job_item_origin', layout: "small", command: "G%s;%s", rx: /G(.+);(.*)|G(.+);?/, order: 0 },
{ title: 'job_item_end_program', layout: "small", command: "M30;%s", rx: /M30;(.*)|M30;?/, order: 0 },
];
// Da controllare comandi e regex
const osaiJobItems = [
{ title: 'job_item_part_program', layout: "big", command: 'M198 %s', rx: /M198 (.+);?[.]*/, order: 0 },
{ title: 'job_item_macro_cms', layout: "big", command: 'M98 P%s', rx: /M98 P(.+);?[.]*/, order: 0 },
{ title: 'job_item_text', layout: "big", command: "%s", rx: /(.+);?[.]*/, order: 100 },
{ title: 'job_item_pause', layout: "small", command: "M0", rx: /^M0;?[.]*/, order: 0 },
{ title: 'job_item_delay', layout: "small", command: "G04 X%s;", rx: /G04 X(.+);?[.]*/, order: 0 },
{ title: 'job_item_origin', layout: "small", command: "G54 P%s", rx: /G54 P(.+);?[.]*/, order: 0 },
{ title: 'job_item_end_program', layout: "small", command: "M30;", rx: /M30;?[.]*/, order: 0 },
{ title: 'job_item_part_program', layout: "big", command: 'M198 %s', rx: /M198 (.+);(.*)|M198 (.+);?/, order: 0 },
{ title: 'job_item_macro_cms', layout: "big", command: 'M98 P%s', rx: /M98 P(.+);(.*)|M98 P(.+);?/, order: 0 },
{ title: 'job_item_text', layout: "big", command: "%s", rx: /(.+);(.*)|(.+);?/, order: 100 },
{ title: 'job_item_pause', layout: "small", command: "M0", rx: /^M0;(.*)|^M0;?/, order: 0 },
{ title: 'job_item_delay', layout: "small", command: "G04 X%s;", rx: /G04 X(.+);(.*)|G04 X(.+);?/, order: 0 },
{ title: 'job_item_origin', layout: "small", command: "G54 P%s", rx: /G54 P(.+);(.*)|G54 P(.+);?/, order: 0 },
{ title: 'job_item_end_program', layout: "small", command: "M30;", rx: /M30;(.*)|M30;?/, order: 0 },
];
// Da controllare comandi e regex
const fanucJobItems = [
{ title: 'job_item_part_program', layout: "big", command: 'CALL "%s"', rx: /M198 (.+);?[.]*/, order: 0 },
{ title: 'job_item_macro_cms', layout: "big", command: 'PCALL /_N_CMA_DIR/%s', rx: /M98 P(.+);?[.]*/, order: 0 },
{ title: 'job_item_text', layout: "big", command: "%s", rx: /(.+);?[.]*/, order: 100 },
{ title: 'job_item_pause', layout: "small", command: "M0", rx: /^M0;?[.]*/, order: 0 },
{ title: 'job_item_delay', layout: "small", command: "G04 F%s;", rx: /G04 X(.+);?[.]*/, order: 0 },
{ title: 'job_item_origin', layout: "small", command: "G%s", rx: /G54 P(.+);?[.]*/, order: 0 },
{ title: 'job_item_end_program', layout: "small", command: "M30", rx: /M30;?[.]*/, order: 0 },
{ title: 'job_item_part_program', layout: "big", command: 'CALL "%s"', rx: /M198 (.+);?.*/, order: 0 },
{ title: 'job_item_macro_cms', layout: "big", command: 'PCALL /_N_CMA_DIR/%s', rx: /M98 P(.+);?.*/, order: 0 },
{ title: 'job_item_text', layout: "big", command: "%s", rx: /(.+);?.*/, order: 100 },
{ title: 'job_item_pause', layout: "small", command: "M0", rx: /^M0;?.*/, order: 0 },
{ title: 'job_item_delay', layout: "small", command: "G04 F%s;", rx: /G04 X(.+);?.*/, order: 0 },
{ title: 'job_item_origin', layout: "small", command: "G%s", rx: /G54 P(.+);?.*/, order: 0 },
{ title: 'job_item_end_program', layout: "small", command: "M30", rx: /M30;?.*/, order: 0 },
];
+11
View File
@@ -0,0 +1,11 @@
import { baseRestService } from "src/_base/baseRestService";
export class JobService extends baseRestService {
async GetMacroList(): Promise<Array<string>> {
return await this.Get<string[]>("api/file_manager/macros");
}
}
export const jobService = new JobService();