bug
This commit is contained in:
parent
0d3c79b08e
commit
d0ac46db5c
|
@ -16,7 +16,6 @@ declare module '@vue/runtime-core' {
|
|||
EditTabel: typeof import('./src/components/EditTabel/EditTabel.vue')['default']
|
||||
FuncEditer: typeof import('./src/components/IndexCal/IndexFuncEditer/components/FuncEditer.vue')['default']
|
||||
IndexCalModelEdit: typeof import('./src/components/IndexCal/IndexCalModelEdit/indexCalModelEdit.vue')['default']
|
||||
IndexCalModelEdit2: typeof import('./src/components/IndexCal/IndexCalModelEdit/indexCalModelEdit2.vue')['default']
|
||||
IndexCalModelEditPlus: typeof import('./src/components/IndexCal/IndexCalModelEdit/indexCalModelEditPlus.vue')['default']
|
||||
IndexCalParamInput: typeof import('./src/components/IndexCal/IndexCalParam/IndexCalParamInput.vue')['default']
|
||||
InParamConfig: typeof import('./src/components/ApiFlow/components/ApiEditer/components/InParamConfig.vue')['default']
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
<template>
|
||||
<div>
|
||||
<div class="m-2">
|
||||
<!-- <el-button size="small" type="primary" class="ml-2" @click="saveToCache">保存到缓存</el-button>
|
||||
<el-button size="small" type="primary" class="ml-2" @click="saveToFile">保存到文件</el-button> -->
|
||||
<el-button size="small" type="success" @click="runModel">运行</el-button>
|
||||
<el-switch class="ml-2" v-model="fillingMode" active-text="填报模式" />
|
||||
<el-switch class="ml-2" v-model="simpleMode" @change="onSimpleModeChange" active-text="精简模式" />
|
||||
<el-switch class="ml-2" v-model="treeColorShow" active-text="树颜色" />
|
||||
</div>
|
||||
<el-table :cell-style="tableCellStyle" ref="table" :data="[tableIdTree]" style="width: 100%; margin-bottom: 20px"
|
||||
:max-height="props.maxHeight" row-key="id" align="center" border default-expand-all>
|
||||
<el-table height="100%" :cell-style="tableCellStyle" ref="table" :data="[tableIdTree]"
|
||||
style="width: 100%; margin-bottom: 20px" :max-height="props.maxHeight" row-key="id" align="center" border
|
||||
default-expand-all>
|
||||
<el-table-column prop="name" label="指标名称" />
|
||||
<!-- <el-table-column prop="key" label="键值" align="center" /> -->
|
||||
<el-table-column prop="calValue" label="计算结果" align="center" />
|
||||
|
@ -406,28 +405,14 @@ function rowDelete(row: Index) {
|
|||
}
|
||||
}
|
||||
|
||||
function createAndDownloadFile(fileName, content) {
|
||||
const aTag = document.createElement("a");
|
||||
const blob = new Blob([content]);
|
||||
aTag.download = fileName;
|
||||
aTag.href = URL.createObjectURL(blob);
|
||||
aTag.click();
|
||||
URL.revokeObjectURL(blob.toString());
|
||||
}
|
||||
|
||||
function saveToFile() {
|
||||
createAndDownloadFile("data.json", JSON.stringify(props.calModel));
|
||||
}
|
||||
|
||||
function saveToCache() {
|
||||
localStorage.setItem("indexCalModelCache", JSON.stringify(props.calModel));
|
||||
}
|
||||
|
||||
|
||||
// function loadFromCache() {
|
||||
// let item = localStorage.getItem('indexCalModelCache')
|
||||
// item && (props.calModel = JSON.parse(item))
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function onSimpleModeChange(val) {
|
||||
if (val === true) {
|
||||
|
|
|
@ -40,13 +40,10 @@
|
|||
<el-button size="small" type="success" class="ml-auto" @click="funcTest">测试</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</n-config-provider>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
|
@ -56,7 +53,7 @@ import javascript from "highlight.js/lib/languages/javascript";
|
|||
import type { Index, Lang } from "../../types";
|
||||
import IndexCalParamInput from "../../IndexCalParam/IndexCalParamInput.vue";
|
||||
hljs.registerLanguage("javascript", javascript);
|
||||
const props = defineProps<{ index: Index,lang: Lang }>();
|
||||
const props = defineProps<{ index: Index, lang: Lang }>();
|
||||
const codeEditerId = ref("codeEditerId");
|
||||
const codeEditerCardWidth = ref(220);
|
||||
const codeEditerCardHeight = ref(220);
|
||||
|
@ -71,7 +68,7 @@ onMounted(() => {
|
|||
});
|
||||
window.addEventListener("resize", setSize);
|
||||
});
|
||||
const code = computed({ set(val: string) { props.index.codeConfig[props.lang] = val }, get() { return props.index&&props.index.codeConfig[props.lang] } })
|
||||
const code = computed({ set(val: string) { props.index.codeConfig[props.lang] = val }, get() { return props.index && props.index.codeConfig[props.lang] } })
|
||||
const setSize = () => {
|
||||
const el = document.getElementById(codeEditerId.value);
|
||||
codeEditerCardHeight.value = el.offsetHeight;
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
import type { Api } from "@/components/ApiFlow/apiFlowTypes"
|
||||
|
||||
const averageFuncConfig: Api = {
|
||||
name: "平均数",
|
||||
id: "averageFunc",
|
||||
func: "let value2=sum(...value1)/value1.length",
|
||||
inParams: [
|
||||
{
|
||||
name: "数组值",
|
||||
key: "value1",
|
||||
valueConfig: { valueType: "numberArray" },
|
||||
},
|
||||
],
|
||||
outParams: [
|
||||
{ name: "平均数", key: "value2", valueConfig: { valueType: "number" } },
|
||||
]
|
||||
}
|
||||
|
|
@ -1,15 +1,47 @@
|
|||
<template>
|
||||
<IndexCalModelEditPlus :cal-model="model" :default-lang="'js'"></IndexCalModelEditPlus>
|
||||
<div>
|
||||
<IndexCalModelEditPlus :cal-model="model" :default-lang="'js'"></IndexCalModelEditPlus>
|
||||
<div>
|
||||
<el-button size="small" type="primary" class="ml-2" @click="saveToCache">保存到缓存</el-button>
|
||||
<el-button size="small" type="primary" class="ml-2" @click="saveToFile">保存到文件</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { Index } from '@/components/IndexCal/types';
|
||||
import 黄土坡GEP from "@/mock/黄土坡GEP.json"
|
||||
import { ref } from 'vue';
|
||||
import htpGEP from "@/mock/htpGEP.json"
|
||||
import { onMounted, ref } from 'vue';
|
||||
import IndexCalModelEditPlus from "@/components/IndexCal/IndexCalModelEdit/indexCalModelEditPlus.vue";
|
||||
//@ts-ignore
|
||||
defineOptions({
|
||||
name: "indexCalModelEditPlusView"
|
||||
});
|
||||
//@ts-ignore
|
||||
const model = ref<Index>(黄土坡GEP[0])
|
||||
const model = ref<Index>(htpGEP[0])
|
||||
function createAndDownloadFile(fileName, content) {
|
||||
const aTag = document.createElement("a");
|
||||
const blob = new Blob([content]);
|
||||
aTag.download = fileName;
|
||||
aTag.href = URL.createObjectURL(blob);
|
||||
aTag.click();
|
||||
URL.revokeObjectURL(blob.toString());
|
||||
}
|
||||
|
||||
function saveToFile() {
|
||||
createAndDownloadFile("data.json", JSON.stringify(model.value));
|
||||
}
|
||||
|
||||
function saveToCache() {
|
||||
localStorage.setItem("indexCalModelCachePlus", JSON.stringify(model.value));
|
||||
}
|
||||
|
||||
|
||||
function loadFromCache() {
|
||||
let item = localStorage.getItem('indexCalModelCachePlus')
|
||||
item && (model.value = JSON.parse(item))
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
loadFromCache()
|
||||
})
|
||||
</script>
|
||||
|
|
|
@ -4,12 +4,12 @@
|
|||
<script lang="ts" setup>
|
||||
import IndexCalModelEdit from '@/components/IndexCal/IndexCalModelEdit/indexCalModelEdit.vue';
|
||||
import { Index } from '@/components/IndexCal/types';
|
||||
import 黄土坡GEP from "@/mock/黄土坡GEP.json"
|
||||
import htpGEP from "@/mock/htpGEP.json"
|
||||
import { ref } from 'vue';
|
||||
//@ts-ignore
|
||||
defineOptions({
|
||||
name: "indexCalModelEditView"
|
||||
});
|
||||
//@ts-ignore
|
||||
const model = ref<Index>(黄土坡GEP[0])
|
||||
const model = ref<Index>(htpGEP[0])
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue