浏览代码

公式说明

duy 4 天之前
父节点
当前提交
de90370612

+ 1 - 1
package.json

@@ -26,7 +26,7 @@
         "crypto-js": "^4.2.0",
         "dayjs": "^1.11.13",
         "echarts": "^5.5.1",
-        "element-plus": "^2.8.7",
+        "element-plus": "^2.11.7",
         "hc-vue3-ui": "^4.9.9",
         "js-base64": "^3.7.7",
         "js-fast-way": "^0.5.7",

+ 9 - 1
src/api/modules/data-fill/wbs.js

@@ -1,5 +1,5 @@
 import { HcApi } from '../../request/index'
-import { getHeader } from 'hc-vue3-ui'
+// import { getHeader } from 'hc-vue3-ui'
 
 export default {
     //新增或删除 合同段划分树首件关联
@@ -627,4 +627,12 @@ export default {
             data: form,
         })
     },
+    //获取公式说明
+    async getFormulaData(form) {
+        return HcApi({
+            url: '/api/blade-manager/exceltab/getFormulaData',
+            method: 'post',
+            data: form,
+        })
+    },
 }

+ 8 - 7
src/global/components/table-form/index.vue

@@ -36,7 +36,7 @@ const props = defineProps({
 })
 
 // Emits 定义
-const emit = defineEmits(['rightTap', 'render', 'excelBodyTap'])
+const emit = defineEmits(['rightTap', 'render', 'excelBodyTap', 'focusTap'])
 
 // 响应式数据
 const keyId = ref(props.pkey)
@@ -140,12 +140,10 @@ const getExcelHtml = async () => {
                 emit('render', form)
             },
             onRight: (event, KeyName) => {
-               
-                
                 onRightClick(pkeyId, event, KeyName, pid)
             },
-            onLeftClick: (key) => {
-                setShiftTableForm(key, pid)
+            onLeftClick: (event, key) => {
+                setShiftTableForm(key, pid, pkeyId, event)
             },
         })
         tableFormApp.value = app
@@ -219,7 +217,11 @@ const onRightClick = async (pkeyId, event, KeyName, pid) => {
     }
 }
 
-const setShiftTableForm = (key, pid) => {
+const setShiftTableForm = async (key, pid, pkeyId, event) => {
+    const dom = event.target
+    const clearFormula = dom.getAttribute('clearFormula') || null
+    emit('focusTap', { clearFormula, key, pkeyId })
+
     if (isCtrlKey.value) {
         const form = excelForm.value
         const keys = checkKeyList.value
@@ -350,7 +352,6 @@ const getCetCopyKeyList = ()=>{
     return checkKeyList.value
 }
 //清除所有选中的单元格
-
 const clearCheckKeyList = async ()=>{
  
     

+ 5 - 5
src/plugins/HTableForm.js

@@ -156,11 +156,11 @@ export default class HTableForm {
                 },
                 // 输入框左键点击处理
                 inputLeftClick(event, key) {
-                    setTimeout(() => {
-                        if (onLeftClick) {
-                            onLeftClick(key)
-                        }
-                    }, 100)
+                    // setTimeout(() => {
+                    if (onLeftClick) {
+                        onLeftClick(event, key)
+                    }
+                    // }, 100)
                 },
                 // 设置图表引用
                 setChartRefs(el, pKeyId, key) {

+ 158 - 3
src/views/data-fill/collapse-form/index.vue

@@ -160,7 +160,7 @@
                             :classify="classifys" :datas="changeFormDatas(item?.pkeyId, 'collapse')" :kid="item?.pkeyId"
                             :node-name="item.nodeName" :pid="`table-form-${item?.pkeyId}`" :tid="treeId"
                             @excel-body-tap="excelTableFormClick($event)" @render="tableFormRender($event, item, index)"
-                            @right-tap="tableFormRightTap($event, index)"
+                            @right-tap="tableFormRightTap($event, index)" @focus-tap="tableFromLeftTap($event)"
                         />
                         <el-tooltip
                             :content="item.isWindow
@@ -195,6 +195,18 @@
                             </HcTooltip>
                         </div>
                         <div class="btn-action">
+                            <el-button
+                                v-if="!isOpenFormulaDescription" size="small" hc-btn color="#2550A2"
+                                style="color:#fff;border-radius: 3px;" @click="enableFormulaDescription"
+                            >
+                                开启公式说明
+                            </el-button>
+                            <el-button
+                                v-else size="small" hc-btn color="#FF7D43"
+                                style="color:#F3F3F3;border-radius: 3px;" @click="enableFormulaDescription"
+                            >
+                                关闭公式说明
+                            </el-button>
                             <el-button v-if="isEnableBulk" type="warning" size="small" @click="enableBulkReplication">
                                 关闭批量复制
                             </el-button>
@@ -524,7 +536,6 @@
         </div>
     </hc-new-dialog>
     <!-- 导入表格数据 -->
-
     <hc-dialog v-model="uploadFileDialog" title="导入表格数据" @save="uploadFileClickSave">
         <div class="dialog-content">
             <!-- 提示文本 -->
@@ -551,6 +562,43 @@
             </el-form>
         </div>
     </hc-dialog>
+
+    <!-- 公式说明弹窗 -->
+    <el-dialog
+        v-model="formulaDescriptionVisible" modal-class="formula-dialog" width="350px" title="公式说明"
+        :modal="false" modal-penetrable :close-on-press-escape="false" transition="scale"
+        :close-icon="CircleCloseFilled" append-to-body
+    >
+        <div class="data-item">
+            <span class="label">源节点</span>
+            <span class="value">{{ formulaDescriptionData.nodeName }}</span>
+        </div>
+        <div class="data-item">
+            <span class="label">源表</span>
+            <span class="value">{{ formulaDescriptionData.tableName }}</span>
+        </div>
+        <div class="data-item">
+            <span class="label">源位置</span>
+            <span class="value">{{ formulaDescriptionData.elementName }}</span>
+        </div>
+        <div class="data-item">
+            <span class="label">获取方式</span>
+            <span class="value">{{ formulaDescriptionData.type }}</span>
+        </div>
+        <div class="data-item">
+            <span class="label">源数据</span>
+            <span class="value">{{ formulaDescriptionData.data }}</span>
+        </div>
+        <div class="divider" />
+        <div class="data-item">
+            <span class="label">获取结果</span>
+            <span class="value">{{ formulaDescriptionData.result }}</span>
+        </div>
+        <div class="view-btn">
+            查看详情
+            <HcIcon name="arrow-right" class="pl-1" />
+        </div>
+    </el-dialog>
 </template>
 
 <script setup>
@@ -596,6 +644,7 @@ import nodeBaseApi from '~api/data-fill/nodebaseinfo'
 import thirdApi from '~api/tentative/detect/third'
 import { formValidate } from 'js-fast-way'
 import { getDictionaryData } from '~uti/tools'
+import { CircleCloseFilled } from '@element-plus/icons-vue'
 
 //参数
 const props = defineProps({
@@ -675,7 +724,10 @@ const tree_AutoExpandKeys = ref(props.treeAutoExpandKeys)
 const treenodeDataInfo = ref(props.treenodeDataInfo)
 const newlistdata = ref(props.newlistdata)
 const isEnableBulk = ref(true)
-// const isEnableBulk = ref(false)
+const isOpenFormulaDescription = ref(false) //是否可以打开公式说明弹窗
+const formulaDescriptionVisible = ref(false) //公式说明弹窗是否显示
+const formulaDescriptionData = ref({}) //公式说明数据
+
 const contractInfo = ref(props.contractInfo)
 const isTemplateType = ref(useAppState.contractInfo?.templateType === 2)
 //表单变量
@@ -791,12 +843,26 @@ onMounted(() => {
     setTableFormMenu(useAppState.projectInfo)
     const { offsetHeight } = document.body
     DragModalHeight.value = offsetHeight - 200
+
+    const enableFormulaDescription = getStoreValue('enableFormulaDescription')
+    isOpenFormulaDescription.value = enableFormulaDescription ?? false
+
+    document.getElementById('app').addEventListener('click', e => {
+        if (!(e.target.tagName === 'INPUT' || e.target.tagName === 'TEXTAREA') || !e.target.id.includes('key')) {
+            formulaDescriptionVisible.value = false
+        }
+    })
+
     const isBulk = getStoreValue('isEnableBulk')
     isEnableBulk.value = isBulk ?? true
     HTableForm.setEnableBulk(isBulk)
     if (isBulk) setMountOnEventKey()
 })
 
+onUnmounted(() => {
+    document.getElementById('app').removeEventListener('click')
+})
+
 //处理变动的数据
 const changeFormData = ref({
     window: [],
@@ -1863,6 +1929,33 @@ const excelTableFormClick = (key) => {
     presentId.value = key
 }
 
+
+const tableFromLeftTap = async ({ key, clearFormula, pkeyId }) => {
+    if (isOpenFormulaDescription.value && clearFormula === '0') {
+        const refs = await getFormRef(pkeyId)
+        const isRegExp = await refs?.isFormRegExp()
+        if (isRegExp) {
+            const formData = refs?.getFormData()
+            const { error, code, data } = await wbsApi.getFormulaData({ ...formData, keyname: key })
+            if (!error && code === 200) {
+                formulaDescriptionData.value = data
+                formulaDescriptionVisible.value = true
+            } else {
+                formulaDescriptionVisible.value = false
+            }
+        }
+    } else {
+        formulaDescriptionVisible.value = false
+    }
+}
+
+// isOpenFormulaDescription: 是否开启公式说明
+//开启/关闭 公式说明
+const enableFormulaDescription = async () => {
+    isOpenFormulaDescription.value = !isOpenFormulaDescription.value
+    setStoreValue('enableFormulaDescription', isOpenFormulaDescription.value)
+}
+
 //缓存被激活时
 onActivated(() => {
     if (isEnableBulk.value) {
@@ -2434,4 +2527,66 @@ defineExpose({
 
 <style lang="scss">
 @import "./style.scss";
+
+.el-modal-dialog.formula-dialog {
+    pointer-events: none !important;
+
+    .el-dialog {
+        pointer-events: all !important;
+        margin: 0 !important;
+        top: 60px;
+        left: calc(100vw - 360px);
+
+        .el-dialog__title {
+            font-size: 18px;
+            color: #000000;
+        }
+
+        .el-dialog__close {
+            font-size: 18px;
+            color: #DB3737 !important;
+        }
+
+        .divider {
+            height: 3px;
+            width: 100%;
+            background-color: #E7E7E7;
+            margin: 15px 0 5px 0;
+        }
+
+        .data-item {
+            display: flex;
+            justify-content: space-between;
+            align-items: flex-start;
+            padding-top: 10px;
+
+            .label {
+                width: 80px;
+                text-align: left;
+                color: #949494;
+                font-size: 14px;
+            }
+
+            .value {
+                flex: 1;
+                overflow: hidden;
+                color: #000000;
+                font-size: 16px;
+            }
+
+            .result {
+                color: #3F9EFF;
+            }
+        }
+
+        .view-btn {
+            display: flex;
+            justify-content: flex-end;
+            align-items: center;
+            margin-top: 10px;
+            color: #2550A2;
+
+        }
+    }
+}
 </style>

+ 10 - 8
src/views/data-fill/collapse-form/table-form-item.vue

@@ -13,6 +13,7 @@
         @excel-body-tap="excelTableFormClick"
         @render="tableFormRender"
         @right-tap="tableFormRightTap"
+        @focus-tap="tableFormFocusTap"
     />
 </template>
 
@@ -63,7 +64,7 @@ const props = defineProps({
 })
 
 //事件
-const emit = defineEmits(['rightTap', 'render', 'excelBodyTap'])
+const emit = defineEmits(['rightTap', 'render', 'excelBodyTap', 'focusTap'])
 //初始变量
 const useAppState = useAppStore()
 const projectId = ref(useAppState.getProjectId)
@@ -126,8 +127,8 @@ onMounted(async () => {
 })
 
 //表单被点击
-const excelTableFormClick = (item) => {
-    emit('excelBodyTap', item)
+const excelTableFormClick = (data) => {
+    emit('excelBodyTap', data)
 }
 
 //获取表单初始数据
@@ -226,6 +227,11 @@ const tableFormRightTap = (item) => {
     emit('rightTap', item)
 }
 
+const tableFormFocusTap = (item) => {
+    console.log('111111111111111tableFormFocusTap', item)
+    emit('focusTap', item)
+}
+
 //设置数据
 const setFormChangeData = (data) => {
     const form = deepClone(tableFormInfo.value)
@@ -275,15 +281,11 @@ const setPasteKeyList = async (event) => {
 const getCetCopyKeyList = async (event)=>{
    let res = await tableFormRef.value?.getCetCopyKeyList(event)
    return res
-
-
 }
 const clearCheckKeyList = ()=>{
     tableFormRef.value?.clearCheckKeyList()
-
-
-
 }
+
 // 暴露出去
 defineExpose({
     getFormData,

文件差异内容过多而无法显示
+ 436 - 426
yarn.lock


部分文件因为文件数量过多而无法显示