浏览代码

编写结论接口调用

duy 1 年之前
父节点
当前提交
b5bbc0aa5d

+ 32 - 0
src/api/modules/transfer/write-conclusion.js

@@ -33,4 +33,36 @@ export default {
             data: form,
         }, msg)
     },
+    //在线验收-下一步编写报告,校验
+    async checkTable(form, msg = true) {
+        return httpApi({
+            url: '/api/blade-archive/archiveExpertConclusion/checkTable',
+            method: 'get',
+            params: form,
+        }, msg)
+    },
+   //在线验收-确认提交权限
+   async checkSubmit(form, msg = true) {
+    return httpApi({
+            url: '/api/blade-archive/archiveExpertConclusion/checkSubmit',
+            method: 'get',
+            params: form,
+            }, msg)
+    },
+     //在线验收-暂存草稿
+   async saveTable(form, msg = true) {
+    return httpApi({
+            url: '/api/blade-archive/archiveExpertConclusion/saveTable',
+            method: 'post',
+            data: form,
+            }, msg)
+    },
+     //在线验收-确认提交
+   async submitTable(form, msg = true) {
+    return httpApi({
+            url: '/api/blade-archive/archiveExpertConclusion/submitTable',
+            method: 'post',
+            data: form,
+            }, msg)
+    },
 }

+ 45 - 5
src/views/transfer/report-detail.vue

@@ -6,11 +6,12 @@
                 <HcCardItem title="前言">
                     <div style="height: 100%;">
                         <el-input
-                            v-model="textarea"
+                            v-model="consolusionData.foreword"
                             placeholder="请输入"
                             show-word-limit
                             type="textarea"
                             class="inputbox"
+                            :disabled="state === 2"
                         />
                     </div>
                 </HcCardItem>
@@ -21,22 +22,24 @@
                 <HcCardItem id="hc_table_data" title="项目概况">
                     <div style="height: 100%;">
                         <el-input
-                            v-model="textarea"
+                            v-model="consolusionData.generalSituation"
                             placeholder="请输入"
                             show-word-limit
                             type="textarea"
                             class="inputbox"
+                            :disabled="state === 2"
                         />
                     </div>
                 </HcCardItem>
                 <HcCardItem id="hc_table_score" title="项目档案管理情况">
                     <div style="height: 100%;">
                         <el-input
-                            v-model="textarea"
+                            v-model="consolusionData.adminCondition"
                             placeholder="请输入"
                             show-word-limit
                             type="textarea"
                             class="inputbox"
+                            :disabled="state === 2"
                         />
                     </div>
                 </HcCardItem>
@@ -45,11 +48,12 @@
                 <HcCardItem title="存在问题及建议">
                     <div style="height: 100%;">
                         <el-input
-                            v-model="textarea"
+                            v-model="consolusionData.questionSuggest"
                             placeholder="请输入"
                             show-word-limit
                             type="textarea"
                             class="inputbox"
+                            :disabled="state === 2"
                         />
                     </div>
                 </HcCardItem>
@@ -60,10 +64,46 @@
 
 <script setup>
 import { onMounted, ref, watch } from 'vue'
-const textarea = ref('')
+
+const props = defineProps({
+    consolusionData: {
+        type: Object,
+        default: () => ({
+            foreword:'',
+            generalSituation:'',
+            questionSuggest:'',
+            adminCondition	:'',
+        }),
+    },
+    state:{
+        type:Boolean,
+        default:false,
+    },
+  
+})
+//事件
+const emit = defineEmits(['change'])
+const consolusionData = ref(props.consolusionData)
+const state = ref(props.state)
+//监听
+watch(() => [
+    props.consolusionData,
+    props.state,
+], ([datas, state1]) => {
+    consolusionData.value = datas
+    state.value = state1
+})
+watch(() => [
+consolusionData.value,
+], ([datas]) => {
+    emit('change', datas)
+}, {
+    deep: true,
+})
 //渲染完成
 onMounted(() => {
     setSplitRef()
+    // getConclusion()
 })
 
 //初始化设置拖动分割线

+ 118 - 46
src/views/transfer/write-report.vue

@@ -13,10 +13,10 @@
                 </div>
             </template>
             <template #extra>
-                <el-button v-if="state === 2" color="#81B338" @click="onSubmitReportClick">查看验收意见</el-button>
+                <el-button v-if="state === 2" type="success" round @click="onSubmitReportClick">查看验收意见</el-button>
                 <el-button v-if="state === 2" type="danger" round>撤回提交</el-button>
-                <el-button v-if="state === 1" type="danger" round @click="submissionClick">确认提交</el-button>
-                <el-button color="#7729F5" round @click="officeDraft">暂存草稿</el-button>
+                <el-button v-if="isShowSubmit && state !== 2" type="danger" round @click="submissionClick">确认提交</el-button>
+                <el-button color="#7729F5" round :loading="saveDraftLaod" @click="officeDraft">暂存草稿</el-button>
                 <el-button round plain type="danger" @click="previousStep">上一步</el-button>
                 <el-button type="danger" round plain @click="toBackClick">返回主页</el-button>
             </template>
@@ -25,12 +25,14 @@
                 :url="saveUrl" :project-id="projectId" :token="token" :user-info="userInfo"
                 @download="officeDownload"
             /> -->
-            <reportDetail />
+            <reportDetail :consolusion-data="consolusionData" :state="state" @change="changConsoluData" />
         </hc-new-card>
 
         <!-- 短信认证 -->
         <HcSmsAuth :loading="SMSAuthLoading" :show="SMSAuthShow" @cancel="SMSAuthCancel" @confirm="SMSAuthConfirm" />
 
+        <!-- 历史报告 -->
+    
         <!-- 历史报告 -->
         <HcDrawer
             :show="isSubmitReportDrawer" to-id="submit-report-layout-target" uis="hc-submit-report-target"
@@ -38,20 +40,17 @@
         >
             <template #header>
                 <div class="hc-select-view w-52">
-                    <el-select v-model="pdfDate" placeholder="选择日期">
-                        <el-option label="2022年12月24日" value="2022年12月24日" />
-                        <el-option label="2022年12月25日" value="2022年12月25日" />
-                        <el-option label="2022年12月26日" value="2022年12月26日" />
-                        <el-option label="2022年12月27日" value="2022年12月27日" />
+                    <el-select v-model="pdfDate" placeholder="选择日期" @change="changePdfDate">
+                        <el-option v-for="item in timeData " :label="item" :value="item" />
                     </el-select>
                 </div>
-                <div class="hc-title-view">试验资料(含工地试验室资质证书、仪器标定证书等)</div>
-                <div class="hc-icon-view text-hover" @click="onSubmitReportDrawerClose">
-                    <HcIcon name="close" />
-                </div>
+                <div class="hc-title-view">{{ tableTitle }}</div>
+            </template>
+            <template #extra>
+                <el-button type="danger" round plain @click="onSubmitReportDrawerClose">返回主页</el-button>
             </template>
             <HcPdf
-                src="https://bladex-test-info.oss-cn-chengdu.aliyuncs.com//upload/20221212/ce9799c7d18efc03efefd6f242439f2e.pdf"
+                :src="curPdf"
             />
         </HcDrawer>
     </div>
@@ -62,8 +61,10 @@ import { onMounted, ref } from 'vue'
 import { useAppStore } from '~src/store'
 import { useRouter } from 'vue-router'
 import initialgApi from '~api/initial/initial'
+import writeApi from '~api/transfer/write-conclusion'
 import { getToken } from '~src/api/util/auth'
 import reportDetail from './report-detail.vue'
+import { arrToKey, getArrValue, getObjValue } from 'js-fast-way'
 
 //变量
 const router = useRouter()
@@ -76,57 +77,69 @@ const token = ref( getToken())
 
 //渲染完成
 onMounted(() => {
-    setTimeout(() => {
-        geDocxUrl()
-    }, 1000)
+    // setTimeout(() => {
+    //     geDocxUrl()
+    // }, 1000)
+    getIsSubmit()
+    getConclusion()
 })
 
 const state = ref(1)
 const docxUrl = ref('')
-const saveUrl = ref('http://192.168.0.128:8090/blade-archive/archivesauto/callbackSave' + '?Blade-Auth=bearer ' + token.value + '&' + 'projectId=' + projectId.value)
+
 const dataKey = ref('')
 const datafile = ref({})
 //const docxUrl = ref('https://bladex-test-info.oss-cn-chengdu.aliyuncs.com//upload/20230317/e2bdc6581e397b810b46ac7cd71b111b.docx')
 
 //暂存草稿
-const officeRef = ref(null)
-const officeDraft = () => {
-    //执行下载命令
-    const xxx = officeRef.value.getDocRef()
-    xxx.downloadAs()
-}
 
-//office文件下载事件
-const officeDownload = (data) => {
-    console.log('文件地址:', data)
-}
-
-//获取文档地址
-const geDocxUrl = async ()=>{
-    const { error, code, data } = await initialgApi.getArchiveConclusion({
-        projectId: projectId.value,
+const saveDraftLaod = ref(false)
+const officeDraft = async () => {
+    saveDraftLaod.value = true
+    const { error, code, msg } = await writeApi.saveTable({
+      ...consolusionData.value,
     })
+    saveDraftLaod.value = false
     if (!error && code === 200) {
-        docxUrl.value = data['worldUrl']
-        dataKey.value = data['id'] + '_' + Math.random() + ''
-        console.log(dataKey.value, 'dataKey')
-        datafile.value = data
+      window.$message.success(msg)
+      getConclusion()
 
-    } else {
-        docxUrl.value = ''
-    }
+    } 
 }
+
+
 //确认提交
 const submissionClick = () => {
     SMSAuthShow.value = true
 }
-
+const isShowSubmit = ref(false)
+const getIsSubmit = async ()=>{
+    const { error, code, data } = await writeApi.checkSubmit({
+        projectId: projectId.value,
+    })
+    if (!error && code === 200) {
+        isShowSubmit.value = data
+     
+    } else {
+        isShowSubmit.value = false
+    }
+}
 //短信验证
 const SMSAuthLoading = ref(false)
 const SMSAuthShow = ref(false)
-const SMSAuthConfirm = () => {
+const SMSAuthConfirm = async () => {
     SMSAuthShow.value = false
-    state.value = 2
+
+    //确认提交调接口
+    const { error, code, msg } = await writeApi.submitTable({
+      ...consolusionData.value,
+    })
+    if (!error && code === 200) {
+      window.$message.success(msg)
+    //   state.value = 2
+    getConclusion()
+
+    } 
 }
 const SMSAuthCancel = () => {
     SMSAuthShow.value = false
@@ -146,14 +159,73 @@ const toBackClick = () => {
 
 //历史报告
 const isSubmitReportDrawer = ref(false)
-const onSubmitReportClick = () => {
-    isSubmitReportDrawer.value = true
+const reportData = ref([])
+const timeData = ref([])
+const onSubmitReportClick = async () => {
+    const { error, code, data } = await initialgApi.getHistoryTable({
+        projectId: projectId.value,
+    })
+    if (!error && code === 200) {
+        reportData.value = getArrValue(data)
+        const dataString = arrToKey( reportData.value, 'approveDate', ',')
+        timeData.value = dataString.split(',')
+      if (timeData.value.length > 0) {
+        pdfDate.value = timeData.value[0]
+        curPdf.value = reportData.value[0].tableUrl
+        tableTitle.value = reportData.value[0].tableTitle
+        isSubmitReportDrawer.value = true
+      }
+       
+    } else {
+        reportData.value = []
+     
+    }
+   
 }
 const pdfDate = ref(null)
-
+const curPdf = ref('')
+const tableTitle = ref('')
 //历史报告
 const onSubmitReportDrawerClose = () => {
     isSubmitReportDrawer.value = false
+    curPdf.value = ''
+}
+const changePdfDate = (val)=>{
+    reportData.value.forEach((ele)=>{
+        if (ele.approveDate === val) {
+            curPdf.value = ele.tableUrl
+            tableTitle.value = ele.tableTitle
+        }
+    })
+}
+
+const consolusionData = ref({
+    foreword:'',
+    generalSituation:'',
+    questionSuggest:'',
+    adminCondition	:'',
+})
+const changConsoluData = (val)=>{
+    consolusionData.value = val
+}
+//获取结论
+const getConclusion = async ()=>{
+    const { error, code, data } = await initialgApi.getTable({
+        projectId: projectId.value,
+    })
+    if (!error && code === 200) {
+        console.log(data, 'data')
+        consolusionData.value = getObjValue(data)
+        state.value = data['status']
+    } else {
+        consolusionData.value = {
+            foreword:'',
+            generalSituation:'',
+            questionSuggest:'',
+            adminCondition	:'',
+        }
+     
+    }
 }
 </script>
 

+ 12 - 3
src/views/transfer/writing-conclusion.vue

@@ -181,10 +181,19 @@ const opinionTextEditHihe = async () => {
 }
 
 //编写报告
-const writeReportClick = () => {
-    router.push({
-        name: 'transfer-write-report',
+const writeReportClick = async () => {
+    const { error, code, data, msg } = await writeApi.checkTable({
+        projectId: projectId.value,
     })
+ 
+    if (!error && code === 200) {
+            if (data) {
+                 router.push({
+                    name: 'transfer-write-report',
+                })
+            } 
+     
+    }
 }
 
 //返回