ZaiZai 2 tháng trước cách đây
mục cha
commit
160b14633f

+ 14 - 0
src/styles/view/project/edit-formula.scss

@@ -151,6 +151,12 @@
         .hc-formula-reset-fun {
             flex: 1;
         }
+        .hc-formula-card-project {
+            flex-shrink: 0;
+        }
+        .hc-formula-card-tag {
+            flex: 1;
+        }
     }
     //函数公式运算执行溯源
     .hc-formula-card-project {
@@ -292,6 +298,14 @@
     //多标签处理
     .hc-formula-card-tag {
         position: relative;
+        .el-tabs {
+            position: relative;
+            height: 100%;
+        }
+        .el-tabs .el-tabs__content {
+            padding: 12px;
+            font-size: 14px;
+        }
     }
 }
 

+ 69 - 20
src/views/project/list/edit-formula.vue

@@ -129,7 +129,7 @@
                     </hc-body>
                 </div>
                 <!-- 函数公式运算执行溯源 -->
-                <div v-if="!isResetFun && !deviationRangeShow" class="border-dashed-card hc-formula-card-project mb-14px">
+                <div v-if="!isResetFun && !deviationRangeShow && !isSelectEle" class="border-dashed-card hc-formula-card-project mb-14px">
                     <div class="header mb-14px text-14px">函数公式运算执行溯源</div>
                     <div class="body relative">
                         <el-select v-model="projectId" filterable clearable class="mr-14px w-380px" placeholder="选择项目" @change="projectChange">
@@ -312,14 +312,36 @@
                     </div>
                 </div>
                 <!-- 多标签处理 -->
-                <div v-if="showFunDetail" class="hc-formula-card-tag mb-14px">
-                    <el-tabs v-model="equationSelectIndex" type="border-card" closable :before-leave="leaveEquationSelect" @tab-remove="delEquationSelect">
-                        <template v-for="(item, index) in equationSelectEle.children" :key="index">
-                            <el-tab-pane :label="item.name" :name="index">
-                                {{ item.name }} + {{ index }}
-                            </el-tab-pane>
-                        </template>
-                    </el-tabs>
+                <div v-if="isSelectEle" class="hc-formula-card-tag mb-14px">
+                    <hc-body padding="0">
+                        <el-tabs v-model="equationSelectIndex" type="border-card" closable :before-leave="leaveEquationSelect" @tab-remove="delEquationSelect">
+                            <template v-for="(item, index) in equationSelectEle.children" :key="index">
+                                <el-tab-pane :label="item.name" :name="index">
+                                    <template v-if="!['日期偏移', '日期格式化', '下标取数', '判断'].includes(item.name)">
+                                        <div class="ft mb-6px">{{ getTemplateFt(item) }}</div>
+                                        <div class="example mb-14px">{{ item?.example }}</div>
+                                        <div class="arguments relative">
+                                            <template v-for="(items, indexs) in item.arguments" :key="indexs">
+                                                <div class="item hc-flex mb-10px">
+                                                    <span>参数{{ indexs + 1 }}({{ item.template.args[indexs].m }}):</span>
+                                                    <template v-if="JSON.stringify(items) !== 'null'">
+                                                        <el-tag v-if="(typeof items) == 'object' && (['Element', 'ParamData'].includes(items.type))">{{ items.name }}</el-tag>
+                                                        <el-input v-else v-model="item.arguments[indexs]" placeholder="请输入内容" class="w-200px" size="small" />
+                                                    </template>
+                                                    <el-link type="primary" class="ml-12px" @click="enterTextClick(item, indexs)">输入文本</el-link>
+                                                    <el-link type="primary" class="ml-12px" @click="selectingElements(item, indexs)">选择元素</el-link>
+                                                    <el-link type="primary" class="ml-12px" @click="setCurElement(item, index, indexs)">当前元素</el-link>
+                                                </div>
+                                            </template>
+                                        </div>
+                                    </template>
+                                    <template v-else>
+                                        {{ item.name }} + {{ index }}
+                                    </template>
+                                </el-tab-pane>
+                            </template>
+                        </el-tabs>
+                    </hc-body>
                 </div>
             </div>
             <template #action>
@@ -596,6 +618,7 @@ const equationSelect = (path) => {
     let tg = obj.template.args.findIndex(x => x.m !== '常量')
     obj.arguments[tg] = ele
     equationSelectEle.value.children.push(obj)
+    console.log(equationSelectEle.value.children)
     //跳转到最新的标签
     equationSelectIndex.value = equationSelectEle.value.children.length - 1
 }
@@ -663,7 +686,6 @@ const clearResetFunClick = () => {
     processType.value = ''
 }
 
-
 //获取当前选中的元素
 const equationSelectEle = computed(() => {
     const type = processType.value
@@ -679,21 +701,17 @@ const equationSelectEle = computed(() => {
     return arr[index]
 })
 
-//显示函数详情
-const showFunDetail = computed(() => {
-    if (isResetFun.value) {
-        // eslint-disable-next-line vue/no-side-effects-in-computed-properties
-        isResetFun.value = false
-    }
-    if (deviationRangeShow.value) {
-        // eslint-disable-next-line vue/no-side-effects-in-computed-properties
-        deviationRangeShow.value = false
-    }
+const isSelectEle = computed(() => {
     if (isNullES(equationSelectEle.value)) return false
     if (isNullES(equationSelectEle.value.children)) return false
     return equationSelectEle.value.children.length > 0
 })
 
+//是否有滚动条
+watch(isSelectEle, (newVal) => {
+    isScrollBar.value = !newVal
+})
+
 
 //是否重置函数
 const isResetFun = ref(false)
@@ -1311,6 +1329,37 @@ const findNumber = (array) => {
     return ''
 }
 
+//获取元素
+const getTemplateFt = (item) => {
+    let template = item?.template?.ft
+    item.template.args.forEach(obj => {
+        template = template.replace(obj.key, obj.m)
+    })
+    //item.arguments[0].tableElementKey = item.arguments[0].tableElementKey.replace('_key', ':key')
+    return template
+}
+
+//输入文本
+const enterTextClick = (item, indexs) => {
+    item.arguments[indexs] = ''
+}
+
+//选择元素
+const elementsArgumenItem = ref({})
+const selectingElements = (item, indexs) => {
+    elementsArgumenItem.value = {
+        arguments: item.arguments,
+        index: indexs,
+    }
+}
+
+//当前元素
+const setCurElement = (item, index, indexs) => {
+    let tmp = deepClone(equationSelectEle.value)
+    tmp['tableElementKey'] = tmp['tableElementKey'].replace('_key', ':key')
+    item.arguments[indexs] = tmp.children[index].arguments[indexs]
+}
+
 //保存
 const submitLoading = ref(false)
 const submitClick = async () => {