ZaiZai 1 year ago
parent
commit
7e0cf69123

+ 2 - 42
src/api/modules/funding/budget.js

@@ -26,7 +26,7 @@ export default {
         }, false)
     },
     //删除
-    async remove(form) {
+    async del(form) {
         return HcApi({
             url: '/api/blade-meter/changeTokenForm/delete',
             method: 'post',
@@ -34,51 +34,11 @@ export default {
         }, false)
     },
     //获取详情
-    async getDetail(form) {
+    async detail(form) {
         return HcApi({
             url: '/api/blade-meter/changeTokenForm/detail',
             method: 'get',
             params: form,
         })
     },
-    //新增确认选择清单
-    async getSelectForm(form) {
-        return HcApi({
-            url: '/api/blade-meter/changeTokenForm/selectForm',
-            method: 'post',
-            data: form,
-        }, false)
-    },
-    //新增添加清单
-    async addForm(form) {
-        return HcApi({
-            url: '/api/blade-meter/changeTokenForm/addForm',
-            method: 'get',
-            params: form,
-        })
-    },
-    //新增-获取变更申请部位
-    async getChangeNode(form) {
-        return HcApi({
-            url: '/api/blade-meter/changeTokenForm/getChangeNode',
-            method: 'get',
-            params: form,
-        })
-    },
-    //下达变更
-    async executeChange(form) {
-        return HcApi({
-            url: '/api/blade-meter/changeTokenForm/executeChange',
-            method: 'get',
-            params: form,
-        }, false)
-    },
-    //撤销变更
-    async annulChange(form) {
-        return HcApi({
-            url: '/api/blade-meter/changeTokenForm/annulChange',
-            method: 'get',
-            params: form,
-        }, false)
-    },
 }

+ 21 - 3
src/views/funding/budget.vue

@@ -12,6 +12,8 @@
         <template #action>
             <hc-pages :pages="searchForm" @change="pageChange" />
         </template>
+        <!-- 新增/修改 -->
+        <HcBudgetData v-model="isBudgetDataShow" :info="budgetRowData" @finish="getTableData" />
     </hc-card>
 </template>
 
@@ -20,16 +22,21 @@ import { onActivated, ref } from 'vue'
 import { useAppStore } from '~src/store'
 import { HcDelMsg } from 'hc-vue3-ui'
 import { getArrValue } from 'js-fast-way'
+import HcBudgetData from './modules/budget-data.vue'
 import mainApi from '~api/funding/budget'
 
 const store = useAppStore()
 const projectId = ref(store.getProjectId)
+const contractId = ref(store.getContractId)
 
 defineOptions({
     name: 'FundingBudget',
 })
 
+//选项卡被激活
 onActivated(() => {
+    projectId.value = store.getProjectId
+    contractId.value = store.getContractId
     getTableData()
 })
 
@@ -66,19 +73,30 @@ const getTableData = async () => {
     searchForm.value.total = data['total'] || 0*/
 }
 
+//新增/修改弹窗
+const isBudgetDataShow = ref(false)
+const budgetRowData = ref({})
+
 //新增数据
 const addRowClick = () => {
-
+    budgetRowData.value = {}
+    isBudgetDataShow.value = true
 }
 
 //修改数据
 const editRowClick = (row) => {
-
+    budgetRowData.value = row
+    isBudgetDataShow.value = true
 }
 
 //删除数据
 const delRowClick = (row) => {
-
+    HcDelMsg(async (resolve) => {
+        console.log('删除中...')
+        setTimeout(() => {
+            resolve() //关闭弹窗的回调
+        }, 3000)
+    })
 }
 </script>
 

+ 74 - 0
src/views/funding/modules/budget-data.vue

@@ -0,0 +1,74 @@
+<template>
+    <hc-dialog v-model="isShow" ui="hc-funding-budget-dialog" is-table widths="80%" :title="isNullES(rowInfo.id) ? '新增' : '修改'" @close="cancelClick">
+        <div>111111</div>
+        <template #footer>
+            <el-button @click="cancelClick">取消</el-button>
+            <el-button type="primary" :loading="confirmLoading" @click="confirmClick">确定</el-button>
+        </template>
+    </hc-dialog>
+</template>
+
+<script setup>
+import { ref, watch } from 'vue'
+import { useAppStore } from '~src/store'
+import { getArrValue, isNullES } from 'js-fast-way'
+import mainApi from '~api/funding/budget'
+
+const props = defineProps({
+    info: {
+        type: Object,
+        default: () => ({}),
+    },
+})
+
+//事件
+const emit = defineEmits(['finish', 'close'])
+
+//双向绑定
+const isShow = defineModel('modelValue', {
+    default: false,
+})
+
+//获取全局变量
+const store = useAppStore()
+const projectId = ref(store.getProjectId)
+const contractId = ref(store.getContractId)
+
+//监听数据
+const rowInfo = ref(props.info)
+watch(() => props.info, (data) => {
+    rowInfo.value = data
+}, { immediate: true, deep: true })
+
+//监听显示
+watch(isShow, (val) => {
+    if (val) setInitData()
+})
+
+//弹窗打开后,初始化数据
+const setInitData = () => {
+    projectId.value = store.getProjectId
+    contractId.value = store.getContractId
+    console.log(rowInfo.value)
+}
+
+//确认提交保存
+const confirmLoading = ref(false)
+const confirmClick = () => {
+    cancelClick()
+    emit('finish')
+}
+
+//取消并关闭弹窗
+const cancelClick = () => {
+    isShow.value = false
+    rowInfo.value = {}
+    emit('close')
+}
+</script>
+
+<style lang="scss">
+.el-dialog.hc-funding-budget-dialog .el-dialog__body .hc-new-dialog-body{
+    padding: 10px 0;
+}
+</style>