ZaiZai 1 yıl önce
ebeveyn
işleme
1dcfda8444

+ 29 - 26
components/select-file/index.vue

@@ -11,11 +11,14 @@
 </template>
 
 <script setup>
-import {ref, onMounted, getCurrentInstance} from "vue";
-import {onUnload} from '@dcloudio/uni-app'
+import {ref, getCurrentInstance} from "vue";
+import {onLoad, onReady,onUnload} from '@dcloudio/uni-app'
 
 //初始变量
-let wv;
+const instance = getCurrentInstance().proxy
+const webViewRef = ref(null)
+let wv; //计划创建的webview
+
 const webViewStyle = ref({
     height: '1px',
     width: '1px',
@@ -29,40 +32,40 @@ const props = defineProps({
     }
 });
 
-const webViewRef = ref(null)
-
 //事件
 const emit = defineEmits(['change'])
 
-//渲染完成
-onMounted(() => {
+onLoad(() => {
     // #ifdef H5
     window.addEventListener('message', handleMessage);
     // #endif
+})
+
+//渲染完成
+onReady(() => {
+    // #ifdef APP-PLUS
     initWebview()
+    // #endif
 })
 
 //初始化webview
 const initWebview = () => {
-    // #ifdef APP-PLUS
-    const instance = getCurrentInstance().proxy.$parent
-    let currentWebview = instance.$getAppWebview()
-    //如果是页面初始化调用时,需要延时一下
-    setTimeout(() => {
-        wv = currentWebview.children()[0]
-        // #ifdef APP-PLUS
-        //ios 禁用缓存,测试生效!!
-        let cache1 = plus.ios.newObject('NSURLCache');
-        let cache = plus.ios.invoke(cache1, 'sharedURLCache');
-        plus.ios.invoke(cache, 'removeAllCachedResponses');
-        plus.ios.invoke(cache, 'setDiskCapacity:', 0);
-        plus.ios.invoke(cache, 'setMemoryCapacity:', 0);
-
-        //安卓端缓存清理。
-        plus.cache.clear();
-        // #endif
-    }, 1000);
-    // #endif
+    return new Promise((resolve) => {
+        let currentWebview = instance.$scope.$getAppWebview()
+        //如果是页面初始化调用时,需要延时一下
+        setTimeout(() => {
+            wv = currentWebview.children()[0]
+            //ios 禁用缓存,测试生效!!
+            let cache1 = plus.ios.newObject('NSURLCache');
+            let cache = plus.ios.invoke(cache1, 'sharedURLCache');
+            plus.ios.invoke(cache, 'removeAllCachedResponses');
+            plus.ios.invoke(cache, 'setDiskCapacity:', 0);
+            plus.ios.invoke(cache, 'setMemoryCapacity:', 0);
+            //安卓端缓存清理。
+            plus.cache.clear();
+            resolve(true)
+        }, 1000);
+    })
 }
 
 const handleMessage = (event) => {

+ 0 - 2
config/index.js

@@ -18,8 +18,6 @@ export default {
     },
     //正式环境
     baseApi: {
-        //api: 'http://192.168.0.109:8090/',  //请求地址
-        //form: 'http://192.168.0.109:5173/', //表单地址
         api: 'http://47.110.251.215:8090/', //请求地址
         form: 'https://user.hcxxy.com/',    //表单地址
         wss: 'wss://business.hcxxy.com/wss/websocket/', //长连接地址

+ 2 - 2
manifest.json

@@ -2,8 +2,8 @@
     "name" : "工程云家",
     "appid" : "__UNI__A0B807E",
     "description" : "智慧数字工程",
-    "versionName" : "2.0.7",
-    "versionCode" : 207,
+    "versionName" : "2.0.8",
+    "versionCode" : 208,
     "transformPx" : false,
     "networkTimeout" : {
         "request" : 300000,

+ 13 - 12
pages/data-fill/fileUp.vue

@@ -9,19 +9,17 @@
                 </view>
             </view>
         </template>
-
         <view class="action-bar-block"/>
         <view class="action-bar">
             <button type="primary" class="action-bar-btn" @click="selectImageTap">选择图片</button>
             <button type="primary" class="action-bar-btn" @click="selectFileTap">选择文件</button>
         </view>
-
-        <hc-select-file ref="selectFileRef" @change="selectFileChange"/>
+        <hc-select-file ref="selectFileRef" @change="selectFileChange" v-if="isFileBody"/>
     </hc-sys>
 </template>
 
 <script setup>
-import {ref, onMounted} from "vue";
+import {ref} from "vue";
 import {onLoad} from '@dcloudio/uni-app'
 import {useAppStore} from "@/store";
 import wbsApi from '~api/data-fill/wbs';
@@ -36,11 +34,12 @@ const store = useAppStore()
 const projectId = ref(store.projectId);
 const contractId = ref(store.contractId);
 const pageNode = ref({});
+const isFileBody = ref(false);
 
 //页面启动
-onLoad((option) => {
-    if (option.node) {
-        const res = JSON.parse(decodeURIComponent(option.node));
+onLoad(({node}) => {
+    if (node) {
+        const res = JSON.parse(decodeURIComponent(node));
         pageNode.value = {
             projectId: projectId.value,
             contractId: contractId.value,
@@ -48,14 +47,16 @@ onLoad((option) => {
             pkeyId: res.pkeyId,
             nodeId: res.treeId,
         }
+        getBussFileList()
+        isFileBody.value = true
+    } else {
+        errorToast('参数错误');
+        setTimeout(() => {
+            uni.navigateBack()
+        },1500)
     }
 })
 
-//渲染完成
-onMounted(() => {
-    getBussFileList()
-})
-
 //获取已上传的文件列表
 const fileListData = ref([])
 const getBussFileList = async () => {

+ 3 - 1
pages/data-fill/treeData.vue

@@ -77,8 +77,8 @@ const setTreeNodeData = async () => {
         }
     }
     nodeData.value = node
-    await getLoadItemNode(nodeData.value[index], index)
     uni.hideLoading();
+    await getLoadItemNode(nodeData.value[index], index)
 }
 
 //获取数据
@@ -145,12 +145,14 @@ const getLoadItemNode = async (item, index, pindex = -1) => {
 
 //获取节点数据
 const queryWbsTreeData = async (obj, level) => {
+    uni.showLoading({title: '获取数据中...', mask: true});
     const { data } = await wbsApi.queryWbsTreeData({
         ...obj,
         contractId: contractId.value || '',
         classifyType: contractInfo.value?.contractType ?? '',
         tableOwner: contractInfo.value?.contractType ?? ''
     })
+    uni.hideLoading();
     return getArrValue(data)
 }
 

+ 40 - 48
pages/task/detail.vue

@@ -1,37 +1,33 @@
 <template>
-    <hc-sys id="app-sys" class="h-full hc-app-task-detail" :isNavBar="false">
-        <view id="task-detail-content" class="task-detail-content">
-            <view class="task-name-box">
-                <view class="name-bar">{{taskInfo.taskName}}</view>
-                <view class="arrow-bar">
-                    <uni-icons type="bottom" size="22" @click="taskPopupClick"/>
+    <hc-sys class="h-full hc-app-task-detail" :isNavBar="false">
+        <uni-section class="mt-0.5" title="当前任务名称" type="line">
+            <template v-slot:right>
+                <view class="hc-flex text-gray-5" @click="taskPopupClick">
+                    <text class="mr-1">切换任务</text>
+                    <uni-icons type="bottom" size="18" color="#6b7280"/>
                 </view>
-            </view>
+            </template>
+            <view class="task-name">{{taskInfo.taskName}}</view>
             <view class="task-report-info">
                 <view>上报人:{{taskInfo.reportUserName}}</view>
                 <view>{{taskInfo.startTime}}</view>
             </view>
-            <view class="task-pdf-list-bar">
-                <view class="task-pdf-info" @click="tablePopupClick">
-                    <view class="file-name">{{taskFileInfo.fileName}}</view>
-                    <view class="file-num">共{{taskFileInfo.fileNum}}张表格</view>
+        </uni-section>
+        <uni-section class="mt-2" :title="`当前表格 (共${taskFileInfo?.fileNum ?? 0}张)`" sub-title="点击表格名称查看PDF" type="line">
+            <template v-slot:right>
+                <view class="hc-flex text-gray-5" @click="tablePopupClick">
+                    <text class="mr-1">切换表格</text>
+                    <uni-icons type="bottom" size="18" color="#6b7280"/>
                 </view>
-            </view>
-        </view>
-        <!--pdf区域-->
-        <hc-pdf :title="false" :ui="webViewStyle" :src="taskFileInfo?.fileUrl" v-if="taskFileInfo?.fileUrl"/>
-        <uv-empty icon="/static/image/list.png" marginTop="24" v-else/>
+            </template>
+            <view class="task-file-name" @click="viewPdfClick">{{taskFileInfo.fileName}}</view>
+        </uni-section>
         <!--底部操作栏-->
-        <template v-if="isTaskAuth">
-            <HcTabbarBlock :height="77"/>
-            <hc-tabbars id="action-bar">
-                <button type="primary" class="action-bar-btn" @click="approveClick">
-                    <text>审</text>
-                    <text class="ml-10">批</text>
-                </button>
-            </hc-tabbars>
-        </template>
-        <view id="action-bar" v-else></view>
+        <hc-tabbars v-if="isTaskAuth">
+            <button type="primary" class="action-bar-btn" @click="approveClick">
+                <text>审</text> <text class="ml-6">批</text>
+            </button>
+        </hc-tabbars>
         <!-- 普通弹窗 -->
         <uni-popup ref="popupRef" class="hc-popup" type="bottom">
             <view class="task-popup-content">
@@ -84,7 +80,6 @@
                 </template>
             </view>
         </uni-popup>
-
         <!-- 任务列表 -->
         <uni-popup ref="popupTaskRef" type="bottom">
             <view class="relative bg-white h-50vh hc-p br-t">
@@ -94,7 +89,6 @@
                 </template>
             </view>
         </uni-popup>
-
         <!-- 表格列表 -->
         <uni-popup ref="popupTableRef" type="bottom">
             <view class="relative bg-white h-50vh hc-p br-t">
@@ -111,7 +105,7 @@
 import {ref, nextTick, getCurrentInstance} from "vue";
 import {onLoad, onReady} from '@dcloudio/uni-app'
 import {arrToKey, getArrValue, getObjValue, isString} from "js-fast-way";
-import {errorToast, querySelect, successToast} from "@/utils/tools";
+import {errorToast, successToast, toPdfPreview} from "@/utils/tools";
 import {checkFlowUserIsExistPfxFile, saveSmsTimeout, sendNotice} from "~api/other/index";
 import mainApi from '~api/tasks/data';
 import {useAppStore} from "@/store";
@@ -145,7 +139,6 @@ onLoad(({node}) => {
 
 //渲染完成
 onReady(() => {
-    setWebViewStyle()
     uni.setNavigationBarTitle({title: '审批任务'})
 })
 
@@ -158,24 +151,6 @@ const getDataApi = async () => {
     uni.hideLoading();
 }
 
-//设置webview样式
-const webViewStyle = ref({})
-const setWebViewStyle = async () => {
-    const {height: appHeight} = await querySelect(instance,'app-sys')
-    const {height: navHeight} = await querySelect(instance,'task-detail-content')
-    const {height: bottomHeight} = await querySelect(instance,'action-bar')
-    // #ifdef H5
-    webViewStyle.value.top = navHeight + 'px'
-    webViewStyle.value.height = (appHeight - navHeight - bottomHeight) + 'px'
-    // #endif
-    // #ifdef APP-PLUS
-    const {screenHeight, safeArea} = uni.getWindowInfo()
-    webViewStyle.value.top = navHeight + 'px'
-    const content = navHeight + (screenHeight - safeArea.bottom) + bottomHeight
-    webViewStyle.value.height = (screenHeight - content) + 'px'
-    // #endif
-}
-
 //切换任务
 const taskClick = (item) => {
     taskInfo.value = item
@@ -441,6 +416,23 @@ const cancelClick = () => {
     smsCode.value = ''
     argument.value = ''
 }
+
+//查看PDF
+const viewPdfClick = () => {
+    const {fileUrl} = taskFileInfo.value
+    if (fileUrl) {
+        // #ifdef H5
+        window.open(url, '_blank')
+        // #endif
+        // #ifdef APP-PLUS
+        uni.navigateTo({
+            url: '/pages/index/preview?url=' + encodeURIComponent(fileUrl)
+        });
+        // #endif
+    } else {
+        errorToast('PDF文件不存在')
+    }
+}
 </script>
 
 <style lang="scss">

+ 2 - 0
pages/task/index.vue

@@ -113,6 +113,8 @@ onReady(() => {
 })
 
 onShow(() => {
+    projectId.value = store.projectId
+    contractId.value = store.contractId
     if (isNodes.value) {
         searchClick()
     }

+ 20 - 52
style/task/detail.scss

@@ -2,60 +2,28 @@ page {
     height: 100%;
 }
 .hc-app-task-detail {
-    .task-detail-content {
+    .task-name {
         position: relative;
-        background: white;
         border-top: 2rpx solid #eee;
-        .task-name-box {
-            position: relative;
-            display: flex;
-            align-items: center;
-            padding: 20rpx;
-            .name-bar {
-                flex: 1;
-            }
-            .arrow-bar {
-                margin-left: 22rpx;
-            }
-        }
-        .task-report-info {
-            position: relative;
-            display: flex;
-            justify-content: space-between;
-            box-sizing: border-box;
-            flex-direction: row;
-            padding: 20rpx;
-            padding-top: 0;
-            font-size: 24rpx;
-        }
-        .task-pdf-list-bar {
-            position: relative;
-            font-size: 24rpx;
-            border-top: 2rpx solid #eee;
-            .task-pdf-info {
-                position: relative;
-                display: flex;
-                box-sizing: border-box;
-                color: #EE5B20;
-                align-items: center;
-                width: 100vw;
-                padding: 20rpx;
-                box-sizing: border-box;
-                .file-name {
-                    position: relative;
-                    flex: 1;
-                }
-                .file-num {
-                    margin-left: 26rpx;
-                }
-            }
-            .task-item {
-                font-size: 26rpx;
-            }
-            .task-item + .task-item {
-                margin-top: 18rpx;
-            }
-        }
+        font-size: 26rpx;
+        padding: 20rpx;
+    }
+    .task-report-info {
+        position: relative;
+        display: flex;
+        justify-content: space-between;
+        box-sizing: border-box;
+        flex-direction: row;
+        padding: 20rpx;
+        font-size: 24rpx;
+        border-top: 2rpx solid #eee;
+    }
+    .task-file-name {
+        position: relative;
+        border-top: 2rpx solid #eee;
+        font-size: 26rpx;
+        padding: 20rpx;
+        color: #EE5B20;
     }
     .action-bar-btn {
         background: #EE5B20;