|
@@ -311,6 +311,10 @@
|
|
|
</hc-body>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <!-- 多标签处理 -->
|
|
|
+ <div class="border-dashed-card hc-formula-card-tag mb-14px">
|
|
|
+ 1111
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<template #action>
|
|
|
<el-button @click="drawerClose">取消</el-button>
|
|
@@ -335,10 +339,10 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { nextTick, ref, watch } from 'vue'
|
|
|
+import { computed, nextTick, ref, watch } from 'vue'
|
|
|
import { useClick } from 'hc-vue3-ui'
|
|
|
import {
|
|
|
- arrIndex, deepClone, getArrValue, getObjValue,
|
|
|
+ arrIndex, deepClone, getArrValue, getObjVal, getObjValue,
|
|
|
getRandom, isArray, isNullES, isString,
|
|
|
} from 'js-fast-way'
|
|
|
import { ElMessageBox } from 'element-plus'
|
|
@@ -541,21 +545,53 @@ const handleFormulaMenu = (index, path) => {
|
|
|
console.error(e)
|
|
|
}
|
|
|
} else {
|
|
|
- equationSelect(index, path)
|
|
|
+ equationSelect(path)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//在等式模式下点选计算式
|
|
|
-const equationSelectEle = ref({})
|
|
|
-const equationSelect = (index, path) => {
|
|
|
- console.log(index, path)
|
|
|
- const selectEle = equationSelectEle.value
|
|
|
- const isValidElement = element => element?.type === 'Element' || element?.type === 'ParamData'
|
|
|
- if (!selectEle || !isValidElement(selectEle)) {
|
|
|
+const equationSelectIndex = ref(-1)
|
|
|
+const equationSelect = (path) => {
|
|
|
+ const selectEle = getObjVal(equationSelectEle.value)
|
|
|
+ if (!selectEle || !['Element', 'ParamData'].includes(selectEle.type)) {
|
|
|
window?.$message.warning('请先选中元素')
|
|
|
return
|
|
|
}
|
|
|
console.log(selectEle)
|
|
|
+ let obj = {}
|
|
|
+ try {
|
|
|
+ const index = Number(path[1].split('-')[1]) - 1
|
|
|
+ const expression = formulaMenuList.value[path[0]][index]
|
|
|
+ obj = deepClone(expression)
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error)
|
|
|
+ }
|
|
|
+ if (obj.type === 1) return
|
|
|
+ obj.arguments = new Array(obj.template.args.length)
|
|
|
+ let ele = {}
|
|
|
+ if (selectEle.type === 'ParamData') {
|
|
|
+ ele = {
|
|
|
+ type: 'ParamData',
|
|
|
+ id: selectEle.id,
|
|
|
+ v: selectEle.v,
|
|
|
+ k: selectEle.k,
|
|
|
+ name: selectEle.name,
|
|
|
+ selected: false,
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ ele = {
|
|
|
+ type: 'Element',
|
|
|
+ id: selectEle.id,
|
|
|
+ name: selectEle.name,
|
|
|
+ selected: false,
|
|
|
+ tableElementKey: selectEle.tableElementKey,
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let tg = obj.template.args.findIndex(x => x.m !== '常量')
|
|
|
+ obj.arguments[tg] = ele
|
|
|
+ equationSelectEle.value.children.push(obj)
|
|
|
+ //跳转到最新的标签
|
|
|
+ equationSelectIndex.value = equationSelectEle.value.children.length - 1
|
|
|
}
|
|
|
|
|
|
//获取数据
|
|
@@ -611,6 +647,30 @@ const clearResetFunClick = () => {
|
|
|
processType.value = ''
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+//获取当前选中的元素
|
|
|
+const equationSelectEle = computed(() => {
|
|
|
+ const type = processType.value
|
|
|
+ if (isNullES(type)) return null
|
|
|
+ const index = processIndex.value
|
|
|
+ let arr = []
|
|
|
+ if (type === 'resultFormula') {
|
|
|
+ arr = resultFormula.value
|
|
|
+ } else if (type === 'processFormula') {
|
|
|
+ arr = processFormula.value
|
|
|
+ }
|
|
|
+ if (arr.length <= 0) return null
|
|
|
+ return arr[index]
|
|
|
+})
|
|
|
+
|
|
|
+//显示函数详情
|
|
|
+const showFunDetail = computed(() => {
|
|
|
+ if (isNullES(equationSelectEle.value)) return false
|
|
|
+ if (isNullES(equationSelectEle.value.children)) return false
|
|
|
+ return equationSelectEle.value.children.length > 0
|
|
|
+})
|
|
|
+
|
|
|
+
|
|
|
//是否重置函数
|
|
|
const isResetFun = ref(false)
|
|
|
const resetFunClick = () => {
|