ibc-export.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. <template>
  2. <div>
  3. <!-- <el-dialog
  4. title="导出"
  5. width="60%"
  6. :close-on-click-modal="false"
  7. :visible.sync="visible"> -->
  8. <div class="my-title">导出</div>
  9. <div class="my-table" id="printDiv" style="padding:55px 30px 0 30px;background-color:#fff;">
  10. <h1 style="text-align: center">入 厂 检 验 报 告</h1>
  11. <h4 style="text-align: right;margin-right: 20px;margin-top: 40px">编号: {{dataForm.inspectionCode}}</h4>
  12. <!-- border="1" -->
  13. <table class="table-first" align="center" cellpadding="8" cellspacing="0" border="1"
  14. style="margin-top: 10px;font-family: SimSun,serif;font-size: medium;text-align: center;border-width: 1px 1px 0 0;">
  15. <tbody align="left">
  16. <tr>
  17. <td class="title" style="width: 15%">供方单位</td>
  18. <td colspan="2" style="width: 30%">{{dataForm.source}}</td>
  19. <td class="title" style="width: 15%">批次号</td>
  20. <td colspan="3" style="width: 40%">{{dataForm.batchNumber}}</td>
  21. </tr>
  22. <tr>
  23. <td class="title" style="width: 15%">产品名称</td>
  24. <td colspan="2" style="width: 30%">{{dataForm.materialName}}</td>
  25. <td class="title" style="width: 15%">产品图号</td>
  26. <td colspan="3" style="width: 40%">{{dataForm.specifications}}</td>
  27. </tr>
  28. <tr>
  29. <td class="title" style="width: 15%">来料类型</td>
  30. <td colspan="6" align="left">
  31. <el-checkbox-group v-model="idsMaterial">
  32. <!-- :style="item.id === 1?'margin-left: 30px':''" -->
  33. <el-checkbox disabled class="my-cb" v-for="item in optionsMaterial" :label="item.code" :key="item.code"><span style="color: #404040">{{item.value}}</span></el-checkbox>
  34. </el-checkbox-group>
  35. </td>
  36. </tr>
  37. <tr>
  38. <td class="title">
  39. 检验设备
  40. (勾选)
  41. </td>
  42. <td colspan="6" align="left">
  43. {{dataForm.detectionEquipment}}
  44. </td>
  45. </tr>
  46. <tr>
  47. <td class="title">序号</td>
  48. <td class="title">检验项目</td>
  49. <td class="title">技术指标</td>
  50. <td class="title">实测记录</td>
  51. <td class="title">交检数</td>
  52. <td class="title">合格数</td>
  53. <td class="title">备注</td>
  54. </tr>
  55. <tr v-for="(item,i) in checkList" :key="i + '+0001'">
  56. <td>{{i+1}}</td>
  57. <td>{{item.inspectionProject}}</td>
  58. <td>{{item.technicalIndicators}}</td>
  59. <td>{{item.measuredRecords}}</td>
  60. <td>{{dataForm.cnt}}</td>
  61. <td>{{dataForm.qualifiedCnt}}</td>
  62. <td>{{item.notes}}</td>
  63. </tr>
  64. <tr>
  65. <td class="title">检验结论:</td>
  66. <td colspan="7">{{dataForm.conclusion}}</td>
  67. </tr>
  68. <tr>
  69. <td class="title">检验员:</td>
  70. <td colspan="2"><span>{{dataForm.creatorName}}</span>&emsp;<span>{{dataForm.approveDate}}</span></td>
  71. <td class="title">审核:</td>
  72. <td colspan="3">梁瑞伟&emsp;<span>{{dataForm.approveDate}}</span></td>
  73. </tr>
  74. </tbody>
  75. </table>
  76. <!-- <table class="table-data-list" align="center" cellpadding="8" cellspacing="0" border="1"
  77. style="width:100%;font-family: SimSun,serif;font-size: medium;text-align: center;border-width: 0 1px 0 0">
  78. <thead>
  79. <tr>
  80. <th style="width: 50px">序号</th>
  81. <th style="width: 20%">检验项目</th>
  82. <th style="width: 20%">技术指标</th>
  83. <th style="width: 20%">实测记录</th>
  84. <th style="width: 80px">交检数</th>
  85. <th style="width: 80px">合格数</th>
  86. <th style="width: auto">备注</th>
  87. </tr>
  88. </thead>
  89. <tbody align="center">
  90. <tr v-for="(item,i) in checkList" :key="i + '+0001'">
  91. <td>{{i+1}}</td>
  92. <td>{{item.inspectionProject}}</td>
  93. <td>{{item.technicalIndicators}}</td>
  94. <td>{{item.measuredRecords}}</td>
  95. <td>{{dataForm.cnt}}</td>
  96. <td>{{dataForm.qualifiedCnt}}</td>
  97. <td>{{item.notes}}</td>
  98. </tr>
  99. </tbody>
  100. </table> -->
  101. <!-- <table class="table-conclusion" align="center" cellpadding="8" cellspacing="0" border="1"
  102. style="font-family: SimSun,serif;font-size: medium;text-align: center;border-width: 0 1px 1px 1px;width: 100%">
  103. <tbody align="left">
  104. <tr>
  105. <th style="text-align: left; width: 200px">检验结论:</th>
  106. </tr>
  107. <tr>
  108. <td>{{dataForm.conclusion}}</td>
  109. </tr>
  110. <tr>
  111. <th>检验员:</th>
  112. <td><span>{{dataForm.creatorName}}</span>&emsp;<span>{{dataForm.approveDate}}</span></td>
  113. <th>审核:</th>
  114. <td>梁瑞伟&emsp;<span>{{dataForm.approveDate}}</span></td>
  115. </tr>
  116. </tbody>
  117. </table> -->
  118. </div>
  119. <span slot="footer" class="dialog-footer">
  120. <el-button @click="onChose">取消</el-button>
  121. <!-- <el-button type="primary" v-on:click="getPdf()">导出</el-button>-->
  122. <el-button type="primary" v-print="printObj">导出</el-button>
  123. </span>
  124. <!-- </el-dialog> -->
  125. </div>
  126. </template>
  127. <script>
  128. import {getIncomingInspection} from '@/api/check'
  129. export default {
  130. name: 'ibc-export',
  131. data () {
  132. return {
  133. printObj: {
  134. id: 'printDiv',
  135. popTitle: '-',
  136. extraHead: '<meta http-equiv="Content-Language" content="zh-cn"/>'
  137. },
  138. htmlTitle: '入厂检验报告',
  139. visible: false,
  140. dataForm: {},
  141. checkList: [],
  142. idsMaterial: [],
  143. optionsMaterial: [
  144. {
  145. code: '1', value: '原、辅材料'
  146. },
  147. {
  148. code: '2', value: '外协件'
  149. },
  150. {
  151. code: '3', value: '其他'
  152. }
  153. ],
  154. idsDevice: [1, 2, 10],
  155. size: ''
  156. }
  157. },
  158. methods: {
  159. onChose () {
  160. this.$emit('onChose')
  161. },
  162. async init (id) {
  163. this.visible = true
  164. this.idsMaterial = []
  165. this.idsDevice = []
  166. this.checkList = []
  167. if (!id) return
  168. await getIncomingInspection(id).then(({data}) => {
  169. if (data && data.code === '200') {
  170. this.dataForm = data.data
  171. if (data.data.inspectionType) {
  172. this.idsMaterial.push(data.data.inspectionType)
  173. }
  174. if (data.data.qualityInspectionItemsList) {
  175. this.checkList = data.data.qualityInspectionItemsList
  176. }
  177. this.dataForm.approveDate = data.data.updateTime ? data.data.updateTime.substring(0, 10) : ''
  178. }
  179. })
  180. }
  181. }
  182. }
  183. </script>
  184. <style scoped>
  185. @page{
  186. size: auto; /* auto is the initial value */
  187. margin: 3mm; /* this affects the margin in the printer settings */
  188. }
  189. html{
  190. background-color: #FFFFFF;
  191. margin: 0; /* this affects the margin on the html before sending to printer */
  192. }
  193. body{
  194. border: solid 1px blue ;
  195. margin: 10mm 15mm 10mm 15mm; /* margin you want for the content */
  196. }
  197. .table-first td, .table-first th, .table-data-list th, .table-data-list td{
  198. border-color: grey;
  199. border-width: 0 0 1px 1px;
  200. }
  201. .table-conclusion td, .table-conclusion th{
  202. border-color: grey;
  203. border-width: 0;
  204. }
  205. .title{
  206. font-weight: bold;
  207. }
  208. </style>