Просмотр исходного кода

质保书打印,检验报告打印

qymljy 7 месяцев назад
Родитель
Сommit
cacf765f30

+ 1 - 1
src/HDrpManagement/dispatch/details/index.vue

@@ -19,7 +19,7 @@
       <div slot="tags">
       </div>
       <div slot="customOperationBef">
-        <printMaterials></printMaterials>
+        <printMaterials v-if="tool.checkAuth($route.name,'printMaterials')"></printMaterials>
       </div>
       <div slot="customOperation">
         <Edit class="inline-16" style="margin-left: -10px" v-if="tool.checkAuth($route.name,'update') && mainData.status == '新建'" :data="mainData" @onSuccess="onSuccess" />

+ 90 - 10
src/HDrpManagement/dispatch/modules/printMaterials.vue

@@ -17,10 +17,11 @@
         size="50%"
         append-to-body>
       <div class="detail__panel container">
-        <p class="normal-title" style="margin-bottom:16px">{{$t(`选择模板`)}}</p>
+        <p class="normal-title" style="margin-bottom:16px">{{$t(drawerTitle)}}</p>
         <el-table
+            v-loading="loading"
             :data="list"
-            height="250"
+            :height="heightTable"
             border
             style="width: 100%">
           <el-table-column
@@ -36,6 +37,18 @@
             </template>
           </el-table-column>
         </el-table>
+        <div style="margin-top:10px;text-align:right" v-if="nowSelect == '检验报告'">
+          <el-pagination
+              background
+              @size-change="handleSizeChange"
+              @current-change="handleCurrentChange"
+              :current-page="param.content.pageNumber"
+              :page-sizes="[20, 50, 100, 200]"
+              :page-size="20"
+              layout="total,sizes, prev, pager, next, jumper"
+              :total="total">
+          </el-pagination>
+        </div>
       </div>
     </el-drawer>
   </div>
@@ -50,7 +63,23 @@ export default {
       list:[],
       nowSelect:"",
       sys_reportid:'',
-      idName:''
+      idName:'',
+      drawerTitle:'',
+      param:{
+        "id": 20221115104703,
+        "content": {
+          "sa_orderid": 0,
+          "pageNumber": 1,
+          "pageSize": 20,
+          "where": {
+            "condition": ""
+          }
+        },
+      },
+      total:0,
+      currentPage:0,
+      heightTable:260 + 'px',
+      loading:false
     }
   },
   methods:{
@@ -58,19 +87,70 @@ export default {
       if (type == '质保书'){
         this.list = [
           {
-            name:'质保书打印'
+            name:'质保书'
           }
         ]
         this.nowSelect = type
-        this.sys_reportid = 163
-        this.idName = 'sa_dispatch'
+        this.idName = 'sa_dispatchid'
         this.dataid = this.$route.query.id
+        this.drawerTitle = '打印质保书'
+        this.drawer = true
+      }else if (type == '检验报告'){
+        this.nowSelect = type
+        this.idName = 'sa_dispatch_itemsid'
+        this.drawerTitle = '打印检验报告'
+        this.param.content.pageNUmber = 1
         this.drawer = true
+        this.loading = true
+        this.heightTable = 'calc(100vh - 160px)'
+        this.listData()
       }
+      this.queryReportId(type)
+    },
+    async queryReportId(type){
+      const res = await this.$api.requested({
+        "id": "2025101715070202",
+        "content": {
+        },
+      })
+      if (res.code == 0){
+        this.tool.showMessage(res,()=>{})
+      }else {
+        res.data.forEach(item=>{
+          if (item.name == type){
+            this.sys_reportid = item.sys_reportid
+          }
+        })
+      }
+    },
+    async listData(){
+      this.param.content.sa_dispatchid = this.$route.query.id
+      const res = await this.$api.requested(this.param)
+      let tableData = res.data.map(item=>{
+        return {
+          name:item.itemname + '检验报告',
+          sa_dispatch_itemsid:item.sa_dispatch_itemsid
+        }
+      })
+      this.list = tableData
+      this.total = res.total
+      this.currentPage = res.pageNumber
+      this.loading = false
+    },
+    handleSizeChange(val) {
+      // console.log(`每页 ${val} 条`);
+      this.param.content.pageSize = val
+      this.listData()
+    },
+    handleCurrentChange(val) {
+      // console.log(`当前页: ${val}`);
+      this.param.content.pageNumber = val
+      this.listData()
     },
     async printBtn (data) {
-      console.log(data,'2222')
-      /* 报表类型 type = datainfo */
+      if (this.nowSelect == '检验报告'){
+        this.dataid = data.sa_dispatch_itemsid
+      }
       let res = await this.$api.requested({
         "id":20221213094501,
         "content": {
@@ -79,8 +159,8 @@ export default {
         }
       })
       this.tool.showMessage(res,() => {
-        window.open(this.tool.getBaseUrl() + res.data + `&${this.idName}=${this.dataid}`)
-        // window.open('http://61.164.207.46:8000' + res.data + `&${this.idName}=${this.dataid}`)
+        // window.open(this.tool.getBaseUrl() + res.data + `&${this.idName}=${this.dataid}`)
+        window.open('http://61.164.207.46:8000' + res.data + `&${this.idName}=${this.dataid}`)
       })
     },
   }