8
0
ZaiZai 9 сар өмнө
parent
commit
32026b6f0a

+ 11 - 0
src/api/modules/project/element.js

@@ -0,0 +1,11 @@
+import { HcApi } from '../../request/index'
+
+export default {
+    async detail(id) {
+        return HcApi({
+            url: '/api/blade-manager/wbsFormElement/detail',
+            method: 'get',
+            params: { id },
+        })
+    },
+}

+ 39 - 2
src/views/project/list/edit-formula.vue

@@ -35,7 +35,10 @@
                     </div>
                 </div>
                 <div class="body relative">
-                    2222
+                    <template v-for="(item, index) in resultFormula" :key="index">
+                        <span class="element-class text-26px" :class="item.selected ? 'is-cur' : ''" @click="resultFormulaItem(item, index)">{{ item.name }}</span>
+                    </template>
+                    <span class="ml-10px mr-10px text-26px">=</span>
                 </div>
             </div>
             1111
@@ -49,8 +52,9 @@
 
 <script setup>
 import { ref, watch } from 'vue'
-import { deepClone, getObjValue } from 'js-fast-way'
+import { deepClone, getObjValue, isNullES } from 'js-fast-way'
 import mainApi from '~api/project/formula'
+import eleApi from '~api/project/element'
 
 const props = defineProps({
     data: {
@@ -86,6 +90,7 @@ const startFCRegExp = /^FC\.([a-zA-Z\d]+)\(/ //匹配开始的FC.xxx(
 const getDataApi = async () => {
     console.log(dataInfo.value)
     getTypeMapApi()
+    getWbsFormElementData()
 }
 
 //保留位数
@@ -127,6 +132,30 @@ const handleFormulaMenu = (index, path) => {
     console.log(index, path)
 }
 
+//获取数据
+const resultFormula = ref([])
+const getWbsFormElementData = async () => {
+    const { eleId } = getObjValue(dataInfo.value)
+    resultFormula.value = []
+    if (isNullES(eleId)) return
+    const { data } = await eleApi.detail(eleId)
+    const obj = getObjValue(data)
+    resultFormula.value = [{
+        type: 'Element',
+        name: obj.eName,
+        id: obj.id,
+        selected: false,
+        tableElementKey: obj.tableElementKey,
+        children: [],
+    }]
+}
+
+//被点击
+const resultFormulaItem = (item, index) => {
+    item.selected = !item.selected
+    console.log(item, index)
+}
+
 
 //保存
 const submitLoading = ref(false)
@@ -184,6 +213,14 @@ const drawerClose = () => {
         position: relative;
         .body {
             padding: 24px 0;
+            .element-class {
+                cursor: pointer;
+                padding: 0 3px;
+                user-select: none;
+                &.is-cur {
+                    color: #f0720a;
+                }
+            }
         }
     }
 }