|
@@ -4,23 +4,30 @@
|
|
|
<template v-for="(sub, subIndex) in filteredAttrs">
|
|
|
<template v-if="com.type == 'TextArea'">
|
|
|
<template v-if="isTextAreaType(sub.type)">
|
|
|
- <el-form-item :label="sub.id+':'"><!-- + ' (引用名:[' + sub.id + '])' -->
|
|
|
+ <el-form-item :label="sub.id + ':'"
|
|
|
+ ><!-- + ' (引用名:[' + sub.id + '])' -->
|
|
|
<!-- <el-input
|
|
|
type="textarea"
|
|
|
@input="updateAllReferences(sub, $event)"
|
|
|
v-model="sub.content"
|
|
|
></el-input> -->
|
|
|
- <span @click="toggleBackground(sub.id)" style="cursor: pointer;">{{ sub.content }}</span>
|
|
|
+ <span @click="toggleBackground(sub.id)" style="cursor: pointer">{{
|
|
|
+ sub.content
|
|
|
+ }}</span>
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
<template v-if="sub.type == 'formual'">
|
|
|
- <el-form-item :label="sub.id +':'"><!-- + ' (引用名:[' + sub.id + '])' -->
|
|
|
+ <el-form-item :label="sub.id + ':'"
|
|
|
+ ><!-- + ' (引用名:[' + sub.id + '])' -->
|
|
|
<!-- <el-input type="textarea" v-model="sub.formula"></el-input> -->
|
|
|
- <span @click="toggleBackground(sub.id)" style="cursor: pointer;">{{ sub.formula }}</span>
|
|
|
+ <span @click="toggleBackground(sub.id)" style="cursor: pointer">{{
|
|
|
+ sub.formula
|
|
|
+ }}</span>
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
<template v-if="sub.type == 'sourceData'">
|
|
|
- <el-form-item :label="sub.id+':'" ><!-- + ' (引用名:[' + sub.id + '])' -->
|
|
|
+ <el-form-item :label="sub.id + ':'"
|
|
|
+ ><!-- + ' (引用名:[' + sub.id + '])' -->
|
|
|
{{ formatSourceData(sub.id, sub.formula) }}
|
|
|
</el-form-item>
|
|
|
</template>
|
|
@@ -91,7 +98,7 @@ export default {
|
|
|
},
|
|
|
computed: {
|
|
|
filteredAttrs() {
|
|
|
- console.log("processedAttrs",this.processedAttrs);
|
|
|
+ console.log("processedAttrs", this.processedAttrs);
|
|
|
return this.processedAttrs;
|
|
|
},
|
|
|
},
|
|
@@ -105,10 +112,10 @@ export default {
|
|
|
toggleBackground(id) {
|
|
|
const element = document.getElementById(id);
|
|
|
if (element) {
|
|
|
- if (element.style.backgroundColor === 'yellow') {
|
|
|
- element.style.backgroundColor = '';
|
|
|
+ if (element.style.backgroundColor === "yellow") {
|
|
|
+ element.style.backgroundColor = "";
|
|
|
} else {
|
|
|
- element.style.backgroundColor = 'yellow';
|
|
|
+ element.style.backgroundColor = "yellow";
|
|
|
}
|
|
|
}
|
|
|
},
|
|
@@ -150,29 +157,26 @@ export default {
|
|
|
"Directory",
|
|
|
].includes(type);
|
|
|
},
|
|
|
- extractChineseTemplates(content) {
|
|
|
+
|
|
|
+ extractTemplates(content) {
|
|
|
const templateRegex = /\{\{(.*?)\}\}/g;
|
|
|
- const chineseRegex = /[\u4e00-\u9fa5]/;
|
|
|
let match;
|
|
|
- const chineseTemplates = [];
|
|
|
+ const templates = [];
|
|
|
|
|
|
while ((match = templateRegex.exec(content)) !== null) {
|
|
|
- if (chineseRegex.test(match[1])) {
|
|
|
- chineseTemplates.push(match[1].trim());
|
|
|
- }
|
|
|
+ templates.push(match[1].trim());
|
|
|
}
|
|
|
|
|
|
- return chineseTemplates;
|
|
|
+ return templates;
|
|
|
},
|
|
|
+
|
|
|
processContent() {
|
|
|
if (this.com && this.com.content) {
|
|
|
- const chineseTemplates = this.extractChineseTemplates(this.com.content);
|
|
|
- //console.log("Chinese templates:", chineseTemplates);
|
|
|
+ const templates = this.extractTemplates(this.com.content);
|
|
|
|
|
|
if (this.com.attrs && Array.isArray(this.com.attrs)) {
|
|
|
- this.processedAttrs = this.com.attrs.filter((el) =>
|
|
|
- //chineseTemplates.includes(el.id)
|
|
|
- chineseTemplates.includes(el.id) || el.type === "formual"
|
|
|
+ this.processedAttrs = this.com.attrs.filter(
|
|
|
+ (el) => templates.includes(el.id) || el.type === "formual"
|
|
|
);
|
|
|
}
|
|
|
} else {
|