zouyu
2023-09-07 275d9a3c158173842449782201b9be2c243dd58b
src/views/inspectionManagement/commissionInspection/addCommision.vue
@@ -2,6 +2,79 @@
   <div class="add_commision">
      <div class="content-main">
         <div class="firstBox">
            <div class="printCommision" >
            <table height="30px" id="printCommision">
               <tr>
                  <td colspan="8">
                     <img :src="imgSrc" style="position: absolute;left: 50px;top:26px">
                     <h1 style="display: inline;">委托检验申请单</h1>
                  </td>
               </tr>
               <tr>
                  <td colspan="2">委托编号</td>
                  <td colspan="2">{{infoForm.commisioncode}}</td>
                  <td colspan="2">委托单位</td>
                  <td colspan="2">{{infoForm.department}}</td>
               </tr>
               <tr>
                  <td colspan="2">联系人</td>
                  <td colspan="2">{{infoForm.contacter}}</td>
                  <td colspan="2">联系电话</td>
                  <td colspan="2">{{infoForm.tel}}</td>
               </tr>
               <tr>
                  <td colspan="2">联系地址</td>
                  <td colspan="2">{{infoForm.address}}</td>
                  <td colspan="2">完成期限</td>
                  <td colspan="2">{{infoForm.deadline}}</td>
               </tr>
               <tr>
                  <td colspan="2">送样时间</td>
                  <td colspan="2">{{infoForm.time}}</td>
                  <td colspan="2">送样人</td>
                  <td colspan="2">{{infoForm.sender}}</td>
               </tr>
               <tr>
                  <td colspan="2">送样人电话</td>
                  <td colspan="2">{{infoForm.sendertel}}</td>
                  <td colspan="2">报告数量</td>
                  <td colspan="2">{{infoForm.num}}</td>
               </tr>
               <tr>
                  <td colspan="2">送样方式</td>
                  <td colspan="6">
                     <ul>
                        <li>
                           <i :class="`${infoForm.way == 1 ? 'el-icon-success' : 'el-icon-circle-check'}`"></i> 送样
                        </li>
                        <li>
                           <i :class="`${infoForm.way == 2 ? 'el-icon-success' : 'el-icon-circle-check'}`"></i> 上门
                        </li>
                     </ul>
                  </td>
               </tr>
               <tbody colspan="8"  v-for="(item,index) in sampleNameList" :key="index">
                  <tr>
                     <td colspan="2">样品</td>
                     <td colspan="2">{{item}}</td>
                     <td colspan="2">评定标准</td>
                     <td colspan="2">{{standardList[index]}}</td>
                  </tr>
                  <tr>
                     <td colspan="2">试验项目</td>
                     <td colspan="6">
                        <p style="text-align:left;margin-left:20px" v-for="(data,index) in testProjectList[index]" :key="index">
                        {{index+1 + "、" + data}}
                        </p>
                     </td>
                  </tr>
               </tbody>
               <tr>
                  <td colspan="2">备注</td>
                  <td colspan="6">{{infoForm.other}}</td>
               </tr>
            </table>
         </div>
            <div class="title">委托信息</div>
            <div class="tableBox">
               <div class="tableBox-header">
@@ -87,14 +160,14 @@
                        </el-col>
                        <el-col :span="5">
                           <el-form-item label="完成期限:">
                              <el-date-picker v-model="infoForm.deadline" type="date" placeholder="选择日期" style="width: 200px;"
                              <el-date-picker value-format="yyyy-MM-dd" v-model="infoForm.deadline" type="date" placeholder="选择日期" style="width: 200px;"
                                 size="small">
                              </el-date-picker>
                           </el-form-item>
                        </el-col>
                        <el-col :span="5">
                           <el-form-item label="送样时间:">
                              <el-date-picker v-model="infoForm.time" type="date" placeholder="选择日期" style="width: 200px;">
                              <el-date-picker value-format="yyyy-MM-dd" v-model="infoForm.time" type="date" placeholder="选择日期" style="width: 200px;">
                              </el-date-picker>
                           </el-form-item>
                        </el-col>
@@ -138,7 +211,7 @@
                     <el-button type="primary" size="small" @click="submitInspection"
                        style="background-color: rgb(1, 102, 226);">提交</el-button>
                     <!-- 点击返回,当前页面值为false -->
                     <el-button type="primary" size="mini" style="background-color: rgb(1, 102, 226); ">打印委托单</el-button>
                     <el-button type="primary" size="mini" style="background-color: rgb(1, 102, 226); " @click="printCommision">打印委托单</el-button>
                  </div>
               </el-form>
            </div>
@@ -222,6 +295,7 @@
</template>
<script>
   import PrintJS from 'print-js'
   import {
      getSampleName,
      getModelSpecification,
@@ -235,6 +309,10 @@
   export default {
      data() {
         return {
            sampleNameList:[],
            standardList:[],
            testProjectList:[],
            imgSrc: require("@/assets/404_images/logo.png"),
            currentPage: 0,
            searchData: '',
            infoForm: {
@@ -311,6 +389,20 @@
         this.getSampleName()
      },
      methods: {
         printCommision(){
            console.log(this.infoForm);
            PrintJS({
               printable: "printCommision",
               type: "html",
               css: [
                  "https://unpkg.com/element-ui/lib/theme-chalk/fonts/element-icons.ttf",
                  "https://unpkg.com/element-ui/lib/theme-chalk/fonts/element-icons.woff",
                  "https://unpkg.com/element-ui/lib/theme-chalk/icon.css"
               ],
               targetStyles: ["*"],
               ignoreElements: ["no-ignore"],
            });
         },
         getlink(viewId) {
            if (viewId == null) {
               this.$message.error('当前链接不在有效期内,系统自动关闭')
@@ -356,6 +448,12 @@
            })
         },
         addInspection() {
            let sName = this.addPointerForm.sampleName;
            this.sampleoptions.forEach(a=>{
               if(a.key == sName) this.sampleNameList.push(a.value);
            })
            this.standardList.push(this.addPointerForm.addway);
            this.testProjectList.push(this.addPointerForm.experiment);
            let exper = this.addPointerForm.experiment[0]
            for (let i = 1; i < this.addPointerForm.experiment.length; i++) {
               exper += ',' + this.addPointerForm.experiment[i]
@@ -380,6 +478,7 @@
               addway: '',
               speName: ''
            }
            console.log(this.sampleNameList);
         },
         async submitInspection() {
            let sampledeliveryway
@@ -473,6 +572,40 @@
</script>
<style lang="scss" scoped>
   .printCommision{
      display: none;
      width: 90%;
      height:100px;
      table {
         width: 100%;
         border-collapse: collapse;
         font-size: 18px;
      }
      table,
      tr,
      th,
      td {
         border: 2px solid black;
         text-align: center;
         font-family: '微软雅黑';
         ul{
            list-style: none;
            width: 500px;
         }
         ul li{
            display: inline;
            width:100px;
            margin: 0 25px;
         }
      }
      tr,
      td,
      th {
         padding: 20px 10px;
      }
   }
   .content-main {
      padding: 20px 40px;
      background-color: #f0f2f5;