ZaiZai hai 9 meses
pai
achega
48be9de9b2
Modificáronse 2 ficheiros con 121 adicións e 3 borrados
  1. 65 0
      src/views/project/list/edit-formula.vue
  2. 56 3
      src/views/project/list/wbs-tree.vue

+ 65 - 0
src/views/project/list/edit-formula.vue

@@ -0,0 +1,65 @@
+<template>
+    <hc-drawer v-model="isShow" ui="hc-project-list-edit-formula-drawer" to-id="hc-layout-box" is-close @close="drawerClose">
+        <hc-card is-action-btn>
+            1111
+            <template #action>
+                <el-button @click="drawerClose">取消</el-button>
+                <el-button type="primary" :loading="submitLoading" @click="submitClick">保存</el-button>
+            </template>
+        </hc-card>
+    </hc-drawer>
+</template>
+
+<script setup>
+import { ref, watch } from 'vue'
+import { getObjValue } from 'js-fast-way'
+
+const props = defineProps({
+    data: {
+        type: Object,
+        default: () => ({}),
+    },
+})
+
+//事件
+const emit = defineEmits(['close', 'finish'])
+
+//双向绑定
+const isShow = defineModel('modelValue', {
+    default: false,
+})
+
+//监听数据
+const dataInfo = ref(props.data)
+watch(() => props.data, (data) => {
+    dataInfo.value = getObjValue(data)
+}, { immediate: true, deep: true })
+
+//监听显示
+watch(isShow, (val) => {
+    if (val) getDataApi()
+})
+
+//获取数据
+const getDataApi = async () => {
+    console.log(dataInfo.value)
+}
+
+//保存
+const submitLoading = ref(false)
+const submitClick = async () => {
+
+}
+
+//关闭抽屉
+const drawerClose = () => {
+    isShow.value = false
+    emit('close')
+}
+</script>
+
+<style lang="scss">
+.el-overlay .el-drawer.hc-project-list-edit-formula-drawer {
+    background-color: #F1F5F8;
+}
+</style>

+ 56 - 3
src/views/project/list/wbs-tree.vue

@@ -125,17 +125,19 @@
         <!-- 调整表单 -->
         <HcAdjustExcel v-model="isAdjustExcelShow" :info="adjustExcelInfo" />
         <!-- 编辑元素公式 -->
-        <hc-dialog v-model="elementFormulasShow" is-table widths="600px" title="编辑元素公式" :footer="false" @close="elementFormulasClose">
+        <hc-dialog v-model="elementFormulasShow" is-table widths="600px" :title="elementFormulasName" :footer="false" @close="elementFormulasClose">
             <template #search>
                 <hc-search-input v-model="formulaInput" @search="searchFormulaClick" />
             </template>
             <hc-table v-loading="formulaTableLoading" :is-index="false" :is-current-row="false" :column="formulaTableColumn" :datas="formulaTableData">
                 <template #action="{ row }">
-                    <el-link :type="row.globalFormula === 1 ? 'warning' : 'primary'">全局公式</el-link>
-                    <el-link v-show="row.hasPartFormula" :type="row.isSaveFormula === 1 ? 'warning' : 'primary'">节点公式</el-link>
+                    <el-link :type="row.globalFormula === 1 ? 'warning' : 'primary'" @click="toFormulaGlobal(row)">全局公式</el-link>
+                    <el-link v-show="row.hasPartFormula" :type="row.isSaveFormula === 1 ? 'warning' : 'primary'" @click="toFormulaNodes(row)">节点公式</el-link>
                 </template>
             </hc-table>
         </hc-dialog>
+        <!-- 编辑公式 -->
+        <HcEditFormula v-model="isEditFormulaShow" :data="editFormulaData" @finish="editFormulaFinish" />
     </hc-drawer>
 </template>
 
@@ -149,6 +151,7 @@ import TreeNodeEditDialog from './tree-node-edit.vue'
 import HcAdjustExcel from './adjust-excel.vue'
 import HcAssociationList from './association-list.vue'
 import HcEditElement from './edit-element.vue'
+import HcEditFormula from './edit-formula.vue'
 import excelApi from '~api/exctab/exceltab'
 import wbsTreeApi from '~api/wbs/tree'
 import mainApi from '~api/wbs/private'
@@ -685,8 +688,12 @@ const editElementToPage = async (name) => {
 }
 
 //编辑元素公式
+const elementFormulasName = ref('')
+const elementFormulasObj = ref({})
 const elementFormulasShow = ref(false)
 const elementFormulasClick = async (row) => {
+    elementFormulasObj.value = row
+    elementFormulasName.value = row.tableName + ' 元素公式'
     elementFormulasShow.value = true
     formulaTableLoading.value = true
     const { data } = await wbsTreeApi.selectFormElements({
@@ -721,10 +728,56 @@ const searchFormulaClick = () => {
 const elementFormulasClose = () => {
     elementFormulasShow.value = false
     formulaTableLoading.value = false
+    elementFormulasName.value = ''
     formulaTableData.value = []
     formulaTableList.value = []
 }
 
+//编辑公式
+const isEditFormulaShow = ref(false)
+const editFormulaData = ref({})
+
+//全局公式,10
+const toFormulaGlobal = async (row) => {
+    elementFormulasClose()
+    const formulasObj = elementFormulasObj.value
+    formulasObj.hasPartFormula = row.hasPartFormula
+    editFormulaData.value = {
+        node: formulasObj,
+        pid: projectInfo.value.id,
+        wbsId: wbsId.value,
+        nodeId: treeItem.value.id,
+        eleId: row.id,
+        eleType: false,
+        tableType: true,
+        globalType: 10,
+    }
+    await nextTick()
+    isEditFormulaShow.value = true
+}
+
+//节点公式,20
+const toFormulaNodes = async (row) => {
+    elementFormulasClose()
+    editFormulaData.value = {
+        node: treeItem.value,
+        pid: projectInfo.value.id,
+        wbsId: wbsId.value,
+        nodeId: treeItem.value.id,
+        eleId: row.id,
+        tableType: false,
+        globalType: 20,
+    }
+    await nextTick()
+    isEditFormulaShow.value = true
+}
+
+//公式操作完成
+const editFormulaFinish = () => {
+    isEditFormulaShow.value = false
+    editFormulaData.value = {}
+}
+
 //离开了当前页面
 onDeactivated(() => {
     isAdjustExcelShow.value = false