ZaiZai 8 달 전
부모
커밋
2b320b7373
2개의 변경된 파일78개의 추가작업 그리고 11개의 파일을 삭제
  1. 50 0
      src/views/desk/wbs/drawer-wbs.vue
  2. 28 11
      src/views/desk/wbs/edit-formula-dialog.vue

+ 50 - 0
src/views/desk/wbs/drawer-wbs.vue

@@ -283,6 +283,7 @@
             v-model="editFormulaShow"
             :table-id="tableId"
             @close="editFormulaClose"
+            @formula="toFormulaClick"
         />
     </hc-drawer>
     <!-- 节点参数设置 -->
@@ -293,12 +294,19 @@
         :node-info="nodeInfo"
         @close="nodeParamClose"
     />
+    <!-- 编辑公式 -->
+    <HcEditFormula
+        v-model="isEditFormulaShow"
+        :data="editFormulaData"
+        @finish="editFormulaFinish"
+    />
 </template>
 
 <script setup>
 import { nextTick, onMounted, ref, watch } from 'vue'
 import { HcDelMsg } from 'hc-vue3-ui'
 import { getDictionaryData, getDictionaryName } from '~src/utils/tools'
+import HcEditFormula from '~src/views/project/list/edit-formula.vue'
 import { getStoreValue, setStoreValue } from '~uti/storage'
 import tableSort from './table-sort.vue'
 import editFormulaDialog from './edit-formula-dialog.vue'
@@ -780,9 +788,13 @@ const showInfoClick = () => {
 const editFormulaShow = ref(false)
 const editFormulaClose = () => {
     editFormulaShow.value = false
+    elementFormulasObj.value = {}
 }
+
+const elementFormulasObj = ref({})
 const editFormulaClick = (row) => {
     const { id } = nodeInfo.value
+    elementFormulasObj.value = row
     if (id) {
         tableId.value = row.id
         editFormulaShow.value = true
@@ -790,6 +802,44 @@ const editFormulaClick = (row) => {
         window.$message.warning('请先选择左侧节点')
     }
 }
+
+//公式
+const editFormulaData = ref({})
+const isEditFormulaShow = ref(false)
+const toFormulaClick = async ({ type, data }) => {
+    const { id } = getObjValue(dataInfo.value)
+    if (type === 'global') {
+        //全局公式
+        editFormulaData.value = {
+            node: data,
+            wbsId: id,
+            nodeId: nodeDetail.value.id,
+            eleId: data.id,
+            eleType: false,
+            tableType: true,
+            globalType: 1,
+        }
+        await nextTick()
+        isEditFormulaShow.value = true
+    } else if (type === 'node') {
+        //节点公式
+        editFormulaData.value = {
+            node: nodeDetail.value,
+            wbsId: id,
+            nodeId: nodeDetail.value.id,
+            eleId: data.id,
+            globalType: 2,
+        }
+        await nextTick()
+        isEditFormulaShow.value = true
+    }
+}
+
+//公式操作完成
+const editFormulaFinish = () => {
+
+}
+
 //节点参数设置
 const nodeParamShow = ref(false)
 const nodeParamClose = () => {

+ 28 - 11
src/views/desk/wbs/edit-formula-dialog.vue

@@ -2,9 +2,9 @@
     <hc-dialog v-model="isShow" is-footer-center title=" 元素公式(WBS级)" widths="56rem" :loading="submitLoading" :footer="false" @close="dialogClose" @save="saveElementHandle">
         <hc-search-input v-model="queryValue" class="mb-4 w-100" @search="getEditEleList" />
         <hc-table :column="tableColumn" :datas="editEleList" :loading="tableLoading">
-            <template #action="{ row, index }">
-                <el-link type="warning">全局公式</el-link>
-                <el-link type="primary">节点公式</el-link>
+            <template #action="{ row }">
+                <el-link :type="row.globalFormula == 1 ? 'warning' : 'warning'" @click="toFormulaGlobal(row)">全局公式</el-link>
+                <el-link v-if="row.hasPartFormula" :type="row.isSaveFormula == 1 ? 'warning' : 'warning'" @click="toFormulaNodes(row)">节点公式</el-link>
             </template>
         </hc-table>
     </hc-dialog>
@@ -21,12 +21,14 @@ const props = defineProps({
     },
 })
 //事件
-const emit = defineEmits(['close'])
+const emit = defineEmits(['close', 'formula'])
+
 //双向绑定
 // eslint-disable-next-line no-undef
 const isShow = defineModel('modelValue', {
     default: false,
 })
+
 //监听显示
 watch(isShow, (val) => {
     if (val) {
@@ -38,13 +40,10 @@ watch(isShow, (val) => {
 const tableId = ref(props.tableId)
 
 //监听数据
-watch(
-    () => [props.tableId],
-    ([tid]) => {
-        tableId.value = tid
-    },
-    { deep: true },
-)
+watch(() => [props.tableId], ([tid]) => {
+    tableId.value = tid
+}, { deep: true })
+
 //关闭弹窗
 const dialogClose = () => {
     isShow.value = false
@@ -70,4 +69,22 @@ const getEditEleList = async () => {
     tableLoading.value = false
     editEleList.value = getArrValue(data)
 }
+
+//全局公式,10
+const toFormulaGlobal = async (row) => {
+    emit('formula', {
+        type: 'global',
+        data: row,
+    })
+    dialogClose()
+}
+
+//节点公式,20
+const toFormulaNodes = async (row) => {
+    emit('formula', {
+        type: 'node',
+        data: row,
+    })
+    dialogClose()
+}
 </script>