iZaiZaiA il y a 2 ans
Parent
commit
58fcdc5bba

+ 32 - 0
src/api/modules/ledger/query.js

@@ -41,4 +41,36 @@ export default {
             params: form
         }, msg)
     },
+    //清表生成html
+    async getExcelHtml(form, msg = true) {
+        return httpApi({
+            url: '/api/blade-manager/exceltab/get-excel-html',
+            method: 'get',
+            params: form
+        }, msg);
+    },
+    //获取表单数据
+    async getBussDataInfo(form, msg = true) {
+        return httpApi({
+            url: '/api/blade-manager/exceltab/get-buss-dataInfo',
+            method: 'get',
+            params: form
+        }, msg);
+    },
+    //填报页面数据保存
+    async saveExcelBussData(form, msg = true) {
+        return httpApi({
+            url: '/api/blade-manager/exceltab/save_buss_data',
+            method: 'post',
+            data: form
+        }, msg);
+    },
+    //单表pdf预览
+    async getBussPdfInfo(form, msg = true) {
+        return httpApi({
+            url: '/api/blade-manager/exceltab/get-buss-pdfInfo',
+            method: 'get',
+            params: form
+        }, msg);
+    },
 }

+ 17 - 3
src/global/components/hc-status/index.vue

@@ -2,7 +2,8 @@
     <div class="hc-page-status-box" :class="ui">
         <div class="page-status">
             <img class="page-status-img" :src="nowebp" alt="" v-if="isType === 'NoForm'"/>
-            <div class="page-status-desc">{{isText}}</div>
+            <div class="page-status-text" v-if="isText">{{isText}}</div>
+            <div class="page-status-desc" v-if="isDesc">{{isDesc}}</div>
         </div>
     </div>
 </template>
@@ -20,6 +21,10 @@ const props = defineProps({
         type: String,
         default: "暂无相关数据"
     },
+    desc: {
+        type: String,
+        default: ""
+    },
     type: {
         type: String,
         default: "NoForm"
@@ -29,14 +34,17 @@ const props = defineProps({
 //变量
 const isType = ref(props.type)
 const isText = ref(props.text)
+const isDesc = ref(props.desc)
 
 //监听
 watch(() => [
     props.type,
     props.text,
-], ([type, text]) => {
+    props.desc,
+], ([type, text, desc]) => {
     isType.value = type
     isText.value = text
+    isDesc.value = desc
 })
 </script>
 
@@ -52,11 +60,17 @@ watch(() => [
         .page-status-img {
             width: 350px;
         }
-        .page-status-desc {
+        .page-status-text {
             text-align: center;
             font-size: 20px;
             color: #aaa;
         }
+        .page-status-desc {
+            text-align: center;
+            font-size: 14px;
+            color: #c5c5c5;
+            margin-top: 8px;
+        }
     }
 }
 </style>

+ 0 - 26
src/layout/index.vue

@@ -272,30 +272,4 @@ const logoClick = () => {
         }
     }
 }
-
-.fade-enter-active,
-.fade-leave-active {
-    transition: opacity 0.5s ease;
-}
-
-.fade-enter-from,
-.fade-leave-to {
-    opacity: 0;
-}
-
-/* fade-transform */
-.fade-transform-leave-active,
-.fade-transform-enter-active {
-    transition: all 0.5s;
-}
-
-.fade-transform-enter-from {
-    opacity: 0;
-    transform: translateX(-30px);
-}
-
-.fade-transform-leave-to {
-    opacity: 0;
-    transform: translateX(30px);
-}
 </style>

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

@@ -443,7 +443,7 @@
 
 
 //设置表单样式
-.hc-table-form-box {
+.hc-excel-table-form-view {
     td {
         padding: 6px;
         font-family: "EUDC", 宋体, v-sans, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol" !important;

+ 26 - 0
src/styles/app/main.scss

@@ -113,3 +113,29 @@ html, body, #app {
         }
     }
 }
+
+.fade-enter-active,
+.fade-leave-active {
+    transition: opacity 0.5s ease;
+}
+
+.fade-enter-from,
+.fade-leave-to {
+    opacity: 0;
+}
+
+/* fade-transform */
+.fade-transform-leave-active,
+.fade-transform-enter-active {
+    transition: all 0.5s;
+}
+
+.fade-transform-enter-from {
+    opacity: 0;
+    transform: translateX(-30px);
+}
+
+.fade-transform-leave-to {
+    opacity: 0;
+    transform: translateX(30px);
+}

+ 2 - 21
src/views/data-fill/components/ListItem.vue

@@ -5,7 +5,7 @@
                 <el-collapse-item :name="`item-${index}-${item?.pkeyId}`" :disabled="item['isBussShow'] === 2" :id="`item-${index}-${item?.pkeyId}`">
                     <template #title>
                         <div class="hc-collapse-item-header">
-                            <div class="text-lg truncate item-title">{{item.deptName}}</div>
+                            <div class="text-lg truncate item-title">{{item.nodeName}}</div>
                             <div class="hc-extra-text-box">
                                 <HcTooltip keys="wbs_del_table" v-if="item['isCopeTab'] === 2">
                                     <el-button type="danger" plain :disabled="item['isBussShow'] === 2" @click.stop="delClick(item,index)">删除本表</el-button>
@@ -33,7 +33,7 @@
                     </template>
                     <div class="data-fill-list-item-content">
                         <div class="data-fill-table-form-box">
-                            <div :id="`table-form-${item?.pkeyId}`"/>
+                            <div class="hc-excel-table-form-view" :id="`table-form-${item?.pkeyId}`"/>
                             <div class="hc-no-table-form" v-if="item?.isTableForm === false">
                                 <div class="table-form-no">
                                     <img :src="notableform" alt=""/>
@@ -738,25 +738,6 @@ defineExpose({
             }
         }
     }
-    //设置表单样式
-    .data-fill-table-form-box {
-        td {
-            padding: 6px;
-            .el-input {
-                background-color: #ffffff !important;
-                border-radius: 3px;
-                .el-input__wrapper {
-                    background-color: inherit;
-                }
-                .el-input__wrapper.is-focus, .el-input__wrapper:hover {
-                    box-shadow: 0 0 0 1.5px var(--el-input-focus-border-color) inset;
-                    background-color: #eddac4;
-                }
-                //公式 #dcdcdc
-                //焦点 #eddac4
-            }
-        }
-    }
 }
 
 //插入特殊字符弹窗的输入框

+ 2 - 2
src/views/data-fill/wbs.vue

@@ -680,7 +680,7 @@ const editNodeClick = async () => {
         editNodeLoading.value = true
         const { primaryKeyId, title, partitionCode } = formEditNodeModel.value
         const { error, code } = await wbsApi.wbsTreeUpdateNode({
-            deptName: title || '',
+            nodeName: title || '',
             pKeyId: primaryKeyId || '',
             partitionCode: partitionCode || ''
         })
@@ -1022,7 +1022,7 @@ const reportModalClick = () => {
     const rows = ListItemDatas.value;
     reportIds.value = info['contractIdRelation'] ? info['id'] : info['primaryKeyId']
     if (rows.length > 0) {
-        reportTaskName.value = rows.length > 1?`${rows[0].deptName}等${rows.length}个文件`:rows[0].deptName
+        reportTaskName.value = rows.length > 1?`${rows[0].name}等${rows.length}个文件`:rows[0].name
         reportAddition.value = {
             classify: authBtnTabKey.value,
             contractIdRelation: info['contractIdRelation'],

+ 176 - 29
src/views/ledger/components/table-form.vue

@@ -2,13 +2,16 @@
     <div class="hc-layout-content">
         <div class="hc-content-box">
             <div class="hc-table-forem-box">
-                <HcStatus/>
+                <el-scrollbar>
+                    <div class="hc-excel-table-form-view" :id="`table-form-${excelIdVal}`" v-if="excelIdVal && isTableForm"></div>
+                    <HcStatus :desc="statusDesc" v-else/>
+                </el-scrollbar>
             </div>
             <div class="hc-right-pian-box hc-flex-column">
                 <DateCalendar :dateData="dateData" @choice-date="dateCalendarChoice"/>
                 <el-alert title="蓝色代表当天已填写过日志" type="warning" show-icon/>
                 <div class="my-4">
-                    <el-button type="primary" hc-btn>
+                    <el-button type="primary" hc-btn @click="showProcessModal">
                         <HcIcon name="add-circle"/>
                         <span>关联工序</span>
                     </el-button>
@@ -23,26 +26,6 @@
                             <div class="process-item">这是名称这是名称这是名称这是名称这是名称这是名称这是名称</div>
                             <HcIcon name="close-circle" fill class="process-icon"/>
                         </div>
-                        <div class="process-item-box">
-                            <div class="process-item">这是名称这是名称这是名称这是名称这是名称这是名称这是名称</div>
-                            <HcIcon name="close-circle" fill class="process-icon"/>
-                        </div>
-                        <div class="process-item-box">
-                            <div class="process-item">这是名称这是名称这是名称这是名称这是名称这是名称这是名称</div>
-                            <HcIcon name="close-circle" fill class="process-icon"/>
-                        </div>
-                        <div class="process-item-box">
-                            <div class="process-item">这是名称这是名称这是名称这是名称这是名称这是名称这是名称</div>
-                            <HcIcon name="close-circle" fill class="process-icon"/>
-                        </div>
-                        <div class="process-item-box">
-                            <div class="process-item">这是名称这是名称这是名称这是名称这是名称这是名称这是名称</div>
-                            <HcIcon name="close-circle" fill class="process-icon"/>
-                        </div>
-                        <div class="process-item-box">
-                            <div class="process-item">这是名称这是名称这是名称这是名称这是名称这是名称这是名称</div>
-                            <HcIcon name="close-circle" fill class="process-icon"/>
-                        </div>
                     </el-scrollbar>
                 </div>
             </div>
@@ -79,14 +62,25 @@
                 </el-button>
             </HcTooltip>
         </div>
+
+        <!--关联工序-->
+        <HcDialog :show="processNodeModal" title="选择关联工序" widths="62rem"  @close="processNodeModal = false" @save="processNodeClick">
+            <div class="node-many-tree">
+                <el-tree :load="ElTreeLoadNode" lazy class="my-tree" :props="processTreeProps" show-checkbox node-key="primaryKeyId"
+                         :default-checked-keys="defaultChecked" :default-expanded-keys="defaultExpanded" check-strictly ref="processElTree"/>
+            </div>
+        </HcDialog>
+
     </div>
 </template>
 
 <script setup>
-import {ref, watch, onMounted} from "vue";
+import {ref, watch, nextTick} from "vue";
 import queryApi from '~api/ledger/query';
-import {getArrValue} from "vue-utils-plus"
+import wbsQueryApi from '~api/data-fill/query';
+import {HTableForm} from "~src/plugins/HTableForm"
 import DateCalendar from "./dateCalendar/index.vue"
+import {getObjValue, getObjNullValue, isString, getArrValue} from "vue-utils-plus"
 
 //参数
 const props = defineProps({
@@ -97,27 +91,180 @@ const props = defineProps({
     contractId: {
         type: [String,Number],
         default: ''
+    },
+    items: {
+        type: Object,
+        default: () => ({})
     }
 })
 
 //变量
 const projectId = ref(props.projectId);
 const contractId = ref(props.contractId);
+const menuItem = ref(props.items);
+const excelIdVal = ref('');
+const statusDesc = ref('');
 
 //监听
 watch(() => [
     props.projectId,
     props.contractId,
-], ([pid, cid]) => {
-    projectId.value = pid;
-    contractId.value = cid;
+    props.items,
+], ([pid, cid, item]) => {
+    projectId.value = pid
+    contractId.value = cid
+    menuItem.value = item
+    getQueryData()
 })
 
-//日历日期处理
-const dateData = ref(['2022-09-10','2022-09-12'])
+//渲染完成
+nextTick(() => {
+    getQueryData()
+})
+
+//获取相关数据
+const getQueryData = () => {
+    const item = menuItem.value
+    const eid = item?.excelId > 0 ? item?.excelId + '' : ''
+    excelIdVal.value = eid
+    getExcelHtmlData(eid)
+    getSubmitLogDateList(item?.primaryKeyId)
+}
+
+//获取日期记录
+const dateData = ref([])
+const getSubmitLogDateList = async (pid) => {
+    if (pid > 0) {
+        const { data } = await queryApi.getSubmitLogDateList({
+            projectId: projectId.value,
+            contractId: contractId.value,
+            primaryKeyId: pid
+        }, false)
+        //处理数据
+        dateData.value = getArrValue(data)
+    } else {
+        dateData.value = []
+    }
+}
+//日期日历回调
 const dateCalendarChoice = ({date, choice, choices}) => {
     console.log(date, choice, choices)
 }
+
+//表格表单渲染
+const isTableForm = ref(false)
+const getExcelHtmlData = async (excelId) => {
+    if (excelId) {
+        getBussDataInfo(excelId)
+        getExcelHtml(excelId)
+    } else {
+        statusDesc.value = `excelId: ${excelId || '-1 或 空'}`
+        isTableForm.value = false
+    }
+}
+
+//获取表单初始数据
+const tableFormData = ref({})
+const getBussDataInfo = async (excelId) => {
+    const { data } = await queryApi.getBussDataInfo({
+        pkeyId: excelId
+    }, false)
+    const info = getObjValue(data)
+    if (getObjNullValue(info)) {
+        const pickerKey = info['pickerKey'] || ''
+        const pickerKeys = pickerKey.split(',')
+        for (let i = 0; i < pickerKeys.length; i++) {
+            const val = info[pickerKeys[i]] || ''
+            if (val) {
+                const data = val.replace(/'/g,'"');
+                info[pickerKeys[i]] = JSON.parse(data)
+            } else {
+                info[pickerKeys[i]] = []
+            }
+        }
+        //有数据,关联数据
+        tableFormData.value = info
+    } else {
+        tableFormData.value = {}
+    }
+}
+
+//获取模板标签数据
+const getExcelHtml = async (excelId) => {
+    //获取数据
+    const { error, code, data } = await queryApi.getExcelHtml({
+        pkeyId: excelId
+    }, false)
+    //处理数据
+    const resData = isString(data) ? data || '' : ''
+    if (!error && code === 200 && resData) {
+        isTableForm.value = true
+        //渲染表单
+        await nextTick(() => {
+            HTableForm({
+                template: resData,
+                tableForm: tableFormData.value,
+                appId: `#table-form-${excelId}`
+            })
+        })
+    } else {
+        isTableForm.value = false
+        statusDesc.value = '暂无表单'
+        window?.$message?.warning('暂无表单')
+    }
+}
+
+//关联工序
+const processNodeModal = ref(false)
+const showProcessModal = () => {
+    processNodeModal.value = true
+}
+
+
+//树的配置
+const processElTree = ref(null)
+const processTreeProps = {label: 'title', children: 'children', isLeaf: 'notExsitChild'}
+const defaultExpanded = ref([]) //默认展开
+const defaultChecked = ref([]) //默认选中
+
+//树形结构异步加载数据
+const ElTreeLoadNode = async (node, resolve) => {
+    if (node.level === 0) {
+        const {error, code, data} = await wbsQueryApi.queryWbsTreeData({
+            contractId: contractId.value ||'',
+            contractIdRelation: '',
+            primaryKeyId: '',
+            parentId: ''
+        })
+        //处理数据
+        if (!error && code === 200) {
+            const resData = getArrValue(data)
+            resolve(resData)
+            defaultExpanded.value = [resData[0]?.primaryKeyId]
+        } else {
+            resolve([])
+        }
+    } else {
+        const {id, contractIdRelation, primaryKeyId} = node.data
+        const {error, code, data} = await wbsQueryApi.queryWbsTreeData({
+            contractId: contractId.value || '',
+            contractIdRelation: contractIdRelation,
+            primaryKeyId: id,
+            parentId: contractIdRelation ? primaryKeyId : id
+        })
+        //处理数据
+        if (!error && code === 200) {
+            resolve(getArrValue(data))
+        } else {
+            resolve([])
+        }
+    }
+}
+
+//确认关联工序
+const processNodeClick = () => {
+
+}
 </script>
 
 <style lang="scss" scoped>

+ 41 - 18
src/views/ledger/query.vue

@@ -1,22 +1,27 @@
 <template>
     <div class="hc-layout-box" v-loading="boxLoading">
-        <HcCard ui="flex-1" v-if="false">
+        <HcCard ui="flex-1" v-if="menuDatas.length <= 0">
             <HcStatus/>
         </HcCard>
-        <div class="hc-layout-left">
-            <el-scrollbar>
-                <el-menu :default-active="menuKey" class="hc-ledger-query-menu" unique-opened>
-                    <el-sub-menu v-for="item in menuDatas" :key="item?.primaryKeyId" :index="item?.primaryKeyId">
-                        <template #title>{{item?.title}}</template>
-                        <el-menu-item :index="`${item?.primaryKeyId}-form`">日志填报</el-menu-item>
-                        <el-menu-item :index="`${item?.primaryKeyId}-table`">日志列表查看</el-menu-item>
-                    </el-sub-menu>
-                </el-menu>
-            </el-scrollbar>
-        </div>
-
-        <HcTableForm :projectId="projectId" :contractId="contractId"/>
-
+        <template v-if="menuDatas.length > 0">
+            <div class="hc-layout-left">
+                <el-scrollbar>
+                    <el-menu :default-active="menuKey" class="hc-ledger-query-menu" unique-opened>
+                        <el-sub-menu v-for="item in menuDatas" :key="item?.primaryKeyId" :index="item?.primaryKeyId">
+                            <template #title>{{item?.title}}</template>
+                            <el-menu-item :index="`${item?.primaryKeyId}-form`" @click="handleMenuValue('form',item)">日志填报</el-menu-item>
+                            <el-menu-item :index="`${item?.primaryKeyId}-table`" @click="handleMenuValue('table',item)">日志列表查看</el-menu-item>
+                        </el-sub-menu>
+                    </el-menu>
+                </el-scrollbar>
+            </div>
+            <transition name="fade-transform">
+                <HcTableForm :projectId="projectId" :contractId="contractId" :items="menuItem" v-if="menuType === 'form'"/>
+                <div v-else>
+                    123456
+                </div>
+            </transition>
+        </template>
     </div>
 </template>
 
@@ -39,9 +44,14 @@ onMounted(()=> {
     queryLogList()
 })
 
-//获取当前合同段下的日志类型
+//日志类型变量
 const boxLoading = ref(false)
 const menuDatas = ref([]);
+const menuKey = ref('');
+const menuItem = ref({});
+const menuType = ref('form')
+
+//获取当前合同段下的日志类型
 const queryLogList = async () => {
     boxLoading.value = true
     const {error, code, data} = await queryApi.queryLogList({
@@ -49,13 +59,26 @@ const queryLogList = async () => {
     })
     //判断状态
     boxLoading.value = false
-    if (!error && code === 200) {
-        menuDatas.value = getArrValue(data)
+    const dataArr = getArrValue(data)
+    if (!error && code === 200 && dataArr.length > 0) {
+        menuDatas.value = dataArr
+        menuItem.value = dataArr[0]
+        menuKey.value = `${dataArr[0]?.primaryKeyId}-form`
+        menuType.value = 'form'
     } else {
         menuDatas.value = []
+        menuItem.value = {}
+        menuKey.value = ''
+        menuType.value = ''
     }
 }
 
+//菜单被点击
+const handleMenuValue = (type,item) => {
+    menuType.value = type
+    menuItem.value = item
+    menuKey.value = `${item?.primaryKeyId}-${item?.type}`
+}
 </script>
 
 <style lang="scss" scoped>