Browse Source

日志填报,复制任意时间

iZaiZaiA 2 years ago
parent
commit
746ee85824

+ 24 - 8
src/api/modules/ledger/query.js

@@ -89,14 +89,6 @@ export default {
             params: form
             params: form
         }, msg);
         }, msg);
     },
     },
-    //复制任意时间
-    async copyTheLogBusinessData(form, msg = true) {
-        return httpApi({
-            url: '/api/blade-manager/exceltab/copy-the-log-business-data',
-            method: 'get',
-            params: form
-        }, msg);
-    },
     //获取当前资料的任务状态
     //获取当前资料的任务状态
     async checkTheLogTaskStatus(form, msg = true) {
     async checkTheLogTaskStatus(form, msg = true) {
         return httpApi({
         return httpApi({
@@ -129,4 +121,28 @@ export default {
             data: form
             data: form
         }, msg);
         }, msg);
     },
     },
+    //获取当前合同段下本日志节点的填报资料日期树
+    async queryReportLogTimeTree(form, msg = true) {
+        return httpApi({
+            url: '/api/blade-business/contractLog/queryReportLogTimeTree',
+            method: 'get',
+            params: form
+        }, msg);
+    },
+    //获取填报记录
+    async queryLogTimeTreeList(form, msg = true) {
+        return httpApi({
+            url: '/api/blade-business/contractLog/queryLogList',
+            method: 'get',
+            params: form
+        }, msg);
+    },
+    //复制任意时间
+    async copyTheLogBusinessData(form, msg = true) {
+        return httpApi({
+            url: '/api/blade-manager/exceltab/copy-the-log-business-data',
+            method: 'get',
+            params: form
+        }, msg);
+    },
 }
 }

+ 10 - 3
src/global/components/hc-dialog/index.vue

@@ -1,6 +1,6 @@
 <template>
 <template>
-    <el-dialog v-model="isShow" class="hc-modal-border" :class="[isTable?'hc-modal-table':'', isSlotExtra?'hc-modal-header-extra':'', ui]" :show-close="isClose"
-               :style="isBgColor?'--el-dialog-bg-color:' + isBgColor:''" :title="title" :width="isWidth" draggable destroy-on-close @closed="dialogClosed">
+    <el-dialog v-model="isShow" class="hc-modal-border" :class="[isTable?'hc-modal-table':'', isSlotExtra?'hc-modal-header-extra':'', padding ? '':'hc-modal-no-padding', ui]"
+               :style="isBgColor?'--el-dialog-bg-color:' + isBgColor:''" :title="title" :show-close="isClose" :width="isWidth" draggable destroy-on-close @closed="dialogClosed">
         <template #header v-if="isSlotHeader || isSlotExtra">
         <template #header v-if="isSlotHeader || isSlotExtra">
             <slot name='header' v-if="isSlotHeader"/>
             <slot name='header' v-if="isSlotHeader"/>
             <div role="heading" class="el-dialog__title" v-if="!isSlotHeader && isSlotExtra">{{title}}</div>
             <div role="heading" class="el-dialog__title" v-if="!isSlotHeader && isSlotExtra">{{title}}</div>
@@ -64,7 +64,7 @@ const props = defineProps({
     },
     },
     bgColor: {
     bgColor: {
         type: [String,Number],
         type: [String,Number],
-        default: ''
+        default: '#f1f5f8'
     },
     },
     isTable: {
     isTable: {
         type: Boolean,
         type: Boolean,
@@ -78,6 +78,10 @@ const props = defineProps({
         type: Boolean,
         type: Boolean,
         default: true
         default: true
     },
     },
+    padding: {
+        type: Boolean,
+        default: true
+    },
 })
 })
 
 
 //变量
 //变量
@@ -142,5 +146,8 @@ const buttonSaveClick = () => {
             }
             }
         }
         }
     }
     }
+    .el-dialog.hc-modal-no-padding .el-dialog__body {
+        padding: 0;
+    }
 }
 }
 </style>
 </style>

+ 1 - 1
src/styles/app/element.scss

@@ -558,7 +558,7 @@
         flex: 1;
         flex: 1;
         user-select: none;
         user-select: none;
     }
     }
-    .el-tree-node.is-expanded.is-current.is-focusable {
+    &.tree-line .el-tree-node.is-expanded.is-current.is-focusable {
         background: #cacaca;
         background: #cacaca;
         border-radius: 4px;
         border-radius: 4px;
     }
     }

+ 117 - 17
src/views/ledger/components/table-form.vue

@@ -97,8 +97,17 @@
         </HcDialog>
         </HcDialog>
 
 
         <!--复制任意时间-->
         <!--复制任意时间-->
-        <HcDialog :show="copyTimeModal" title="复制任意时间" widths="360px" bg-color="#f1f5f8" saveText="复制" @close="copyTimeModal = false" :loading="copyTimeLoading" @save="copyTimeSaveClick">
-            <el-alert title="等接口中..." type="warning" show-icon/>
+        <HcDialog :show="copyTimeModal" isTable title="复制任意时间" widths="62rem" saveText="复制" :padding="false" @close="copyTimeModal = false" :loading="copyTimeLoading" @save="copyTimeSaveClick">
+            <div class="hc-user-time-box">
+                <div class="tree-box">
+                    <el-scrollbar>
+                        <el-tree class="hc-tree-node" :props="copyTimeTreeProps" :data="copyTimeTreeData" node-key="hierarchy" :default-expanded-keys="copyTimeTreeKeys" highlight-current accordion @node-click="copyTimeTreeNodeClick"/>
+                    </el-scrollbar>
+                </div>
+                <div class="user-box">
+                    <HcTable ref="copyTimeTableRef" :column="copyTimeTableColumn" :datas="copyTimeTableData" :loading="copyTimeTableLoading" isCheck @selection-change="copyTimeTableSelection"/>
+                </div>
+            </div>
         </HcDialog>
         </HcDialog>
 
 
         <!--批量上报审批-->
         <!--批量上报审批-->
@@ -113,7 +122,7 @@ import queryApi from '~api/ledger/query';
 import wbsQueryApi from '~api/data-fill/query';
 import wbsQueryApi from '~api/data-fill/query';
 import HTableForm from "~src/plugins/HTableForm"
 import HTableForm from "~src/plugins/HTableForm"
 import DateCalendar from "./dateCalendar/index.vue"
 import DateCalendar from "./dateCalendar/index.vue"
-import {getObjValue, getObjNullValue, isString, getArrValue, isValueNull, deepClone} from "vue-utils-plus"
+import {getObjValue, getObjNullValue, isString, getArrValue, isValueNull} from "vue-utils-plus"
 
 
 //参数
 //参数
 const props = defineProps({
 const props = defineProps({
@@ -530,37 +539,112 @@ const copyTableFormClick = () => {
 }
 }
 
 
 //复制任意时间
 //复制任意时间
+const copyTimeModal = ref(false)
 const copyTimeLogModal = () => {
 const copyTimeLogModal = () => {
     copyTimeModal.value = true
     copyTimeModal.value = true
     copyTimeLoading.value = false
     copyTimeLoading.value = false
+    queryReportLogTimeTree()
 }
 }
-const copyTimeModal = ref(false)
-//选择日期
-const copyTimeChoices = ref('')
-const copyTimeChoice = ({choices}) => {
-    copyTimeChoices.value = choices
+
+//日期数
+const copyTimeTreeProps = {
+    children: 'treeList', label: 'name'
+}
+const copyTimeTreeData = ref([])
+const copyTimeTreeKeys = ref([])
+
+//获取当前合同段下本日志节点的填报资料日期树
+const queryReportLogTimeTree = async () => {
+    const { primaryKeyId } = menuItem.value
+    const { data } = await queryApi.queryReportLogTimeTree({
+        contractId: contractId.value || '',
+        nodePrimaryKeyId: primaryKeyId
+    })
+    const res = getArrValue(data)
+    copyTimeTreeData.value = res
+    if (res.length > 0) {
+        copyTimeTreeKeys.value = [res[0]?.hierarchy]
+    }
+}
+
+//日期树被点击
+const copyTimeTreeNodeClick = (data, node) => {
+    if (node.level === 3) {
+        queryLogTimeTreeList(data?.hierarchy)
+    }
+}
+
+//复制任意时间的记录人
+const copyTimeTableRef = ref(null)
+const copyTimeTableColumn = ref([
+    {key:'createUserName', name: '记录人'},
+])
+const copyTimeTableData = ref([])
+
+//获取填报记录
+const copyTimeTableLoading = ref(false)
+const queryLogTimeTreeList = async (time) => {
+    copyTimeTableLoading.value = true
+    const { primaryKeyId } = menuItem.value
+    const { data } = await queryApi.queryLogTimeTreeList({
+        contractId: contractId.value || '',
+        nodePrimaryKeyId: primaryKeyId,
+        time: time
+    })
+    copyTimeTableLoading.value = false
+    copyTimeTableData.value = getArrValue(data)
+}
+
+//多选
+const copyTimeTableKeys = ref([]);
+const copyTimeTableSelection = (rows) => {
+    copyTimeTableKeys.value = rows.filter((item) => {
+        return (item??'') !== '';
+    })
 }
 }
+
 //确认复制
 //确认复制
 const copyTimeLoading = ref(false)
 const copyTimeLoading = ref(false)
-const copyTimeSaveClick = async () => {
-    copyTimeModal.value = false
-    /*copyTimeLoading.value = true
+const copyTimeSaveClick = () => {
+    const rows = copyTimeTableKeys.value
+    if (rows.length > 0) {
+        const ids = rowsToId(rows)
+        copyTheLogBusinessData(ids)
+    } else {
+        window.$message?.warning('请先勾选记录人')
+    }
+}
+
+//复制任意时间
+const copyTheLogBusinessData = async (ids) => {
+    copyTimeLoading.value = true
     const {primaryKeyId} = menuItem.value
     const {primaryKeyId} = menuItem.value
     const { error, code } = await queryApi.copyTheLogBusinessData({
     const { error, code } = await queryApi.copyTheLogBusinessData({
         contractId: contractId.value || '',
         contractId: contractId.value || '',
         nodePrimaryKeyId: primaryKeyId,
         nodePrimaryKeyId: primaryKeyId,
         currentTime: recordTime.value,
         currentTime: recordTime.value,
-        targetTime: copyTimeChoices.value
-    }, false)
+        theLogId: ids
+    })
     //处理数据
     //处理数据
     copyTimeLoading.value = false
     copyTimeLoading.value = false
     if (!error && code === 200) {
     if (!error && code === 200) {
-        window?.location?.reload()  //刷新页面
-    } else {
-        window?.$message?.warning('复制失败')
-    }*/
+        copyTimeModal.value = false
+        window?.$message?.success('复制成功');
+        setTimeout(() => {
+            window?.location?.reload()  //刷新页面
+        }, 3000)
+    }
 }
 }
 
 
+
+//拼接ID
+const rowsToId = (rows) => {
+    return rows.map((obj) => {
+        return obj.id;
+    }).join(",")
+}
+
+
 //设置表单默认数据
 //设置表单默认数据
 const setFormDefaultData = (formInfo = {}) => {
 const setFormDefaultData = (formInfo = {}) => {
     return {
     return {
@@ -757,6 +841,22 @@ const theLogOneAbolish = async () => {
         overflow: hidden;
         overflow: hidden;
     }
     }
 }
 }
+
+.hc-user-time-box {
+    position: relative;
+    height: 100%;
+    display: flex;
+    .tree-box {
+        border-right: 1px solid #EEEEEE;
+        position: relative;
+        padding: 20px;
+        width: 200px;
+    }
+    .user-box {
+        position: relative;
+        flex: 1;
+    }
+}
 </style>
 </style>
 
 
 <style lang="scss">
 <style lang="scss">