appointDialog.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. <template>
  2. <el-dialog
  3. title="委外单"
  4. :visible.sync="appointVisible"
  5. :before-close="handleClose"
  6. :close-on-click-modal="false"
  7. :close-on-press-escape="false"
  8. width="60%"
  9. >
  10. <div class="main_container" id='printBill'>
  11. <div class="basic-details-title border-none">
  12. <span class="border-span">委外信息</span>
  13. </div>
  14. <el-descriptions title="" :column="2" size="medium" border>
  15. <el-descriptions-item>
  16. <template slot="label"> 工单编号 </template>
  17. {{ workOrderInfo ? workOrderInfo.code : '' }}
  18. </el-descriptions-item>
  19. <el-descriptions-item>
  20. <template slot="label"> 发布时间 </template>
  21. {{ workOrderInfo ? workOrderInfo.createTime : '' }}
  22. </el-descriptions-item>
  23. <el-descriptions-item>
  24. <template slot="label"> 委外单位</template>
  25. {{ workOrderInfo ? workOrderInfo.outsourcUnit : ''}}
  26. </el-descriptions-item>
  27. <el-descriptions-item>
  28. <template slot="label"> 发布人 </template>
  29. {{ workOrderInfo ? workOrderInfo.createBy : '' }}
  30. </el-descriptions-item>
  31. <el-descriptions-item :span="2">
  32. <template slot="label"> 计划完成时间 </template>
  33. {{ workOrderInfo ? workOrderInfo.planCompletionTime : '' }}
  34. </el-descriptions-item>
  35. </el-descriptions>
  36. <div class="basic-details-title border-none">
  37. <span class="border-span">设备信息</span>
  38. </div>
  39. <el-descriptions title="" :column="2" size="medium" border>
  40. <el-descriptions-item>
  41. <template slot="label"> 设备编码 </template>
  42. {{ equipmentInfo ? equipmentInfo.code : '' }}
  43. </el-descriptions-item>
  44. <el-descriptions-item>
  45. <template slot="label"> 权属部门 </template>
  46. {{ equipmentInfo ? equipmentInfo.ownershipGroupName : ''}}
  47. </el-descriptions-item>
  48. <el-descriptions-item>
  49. <template slot="label"> 设备名称 </template>
  50. {{ equipmentInfo ? equipmentInfo.name : '' }}
  51. </el-descriptions-item>
  52. <el-descriptions-item>
  53. <template slot="label"> 权属人 </template>
  54. {{ equipmentInfo ? equipmentInfo.ownershipUserName : '' }}
  55. </el-descriptions-item>
  56. <el-descriptions-item>
  57. <template slot="label"> 权属人电话 </template>
  58. {{ equipmentInfo ? equipmentInfo.ownershipUserMobile : '' }}
  59. </el-descriptions-item>
  60. <el-descriptions-item>
  61. <template slot="label"> 固定资产编码 </template>
  62. {{ equipmentInfo ? equipmentInfo.fixCode : '' }}
  63. </el-descriptions-item>
  64. <el-descriptions-item>
  65. <template slot="label" :span="2"> 设备位置 </template>
  66. {{ equipmentInfo.position}}
  67. </el-descriptions-item>
  68. </el-descriptions>
  69. <div class="basic-details-title border-none">
  70. <span class="border-span">报修信息</span>
  71. </div>
  72. <el-descriptions title="" :column="2" size="medium" border>
  73. <el-descriptions-item>
  74. <template slot="label"> 报修记录编号 </template>
  75. {{ infoData ? infoData.code : '' }}
  76. </el-descriptions-item>
  77. <el-descriptions-item>
  78. <template slot="label"> 报修时间 </template>
  79. {{ infoData ? infoData.createTime : '' }}
  80. </el-descriptions-item>
  81. <el-descriptions-item>
  82. <template slot="label"> 报修人 </template>
  83. {{ infoData ? infoData.requestUserName : '' }}
  84. </el-descriptions-item>
  85. <el-descriptions-item>
  86. <template slot="label"> 报修人电话 </template>
  87. {{ infoData ? infoData.repairsDeptPhone : '' }}
  88. </el-descriptions-item>
  89. <el-descriptions-item :span="2">
  90. <template slot="label" > 故障描述 </template>
  91. {{ infoData ? infoData.remark : '' }}
  92. </el-descriptions-item>
  93. <!-- <el-descriptions-item :span="2">
  94. <template slot="label" > 图片 </template>
  95. <el-image
  96. v-for="(item, index) in infoData.repairsImg"
  97. :key="index"
  98. style="width: 100px; height: 100px; margin-right: 5px"
  99. :src="item.url"
  100. :preview-src-list="[item.url]"
  101. />
  102. </el-descriptions-item> -->
  103. </el-descriptions>
  104. <div class="container-write">
  105. <div class="write-box">
  106. <span class="box-tips">验收说明:</span>
  107. </div>
  108. <div class="write-choose">
  109. <div class="choose-item"><span class="item-span"></span>通过</div>
  110. <div class="choose-item"><span class="item-span"></span>不通过</div>
  111. </div>
  112. <div class="write-name"><span class="name-tips">验收人:</span></div>
  113. <div class="write-name"><span class="name-tips">验收日期:</span></div>
  114. </div>
  115. </div>
  116. <div class="btns">
  117. <el-button type="primary" size="small" @click="billPrintClick">打印</el-button>
  118. <el-button size="small" @click="handleClose">关闭</el-button>
  119. </div>
  120. </el-dialog>
  121. </template>
  122. <script>
  123. import { getOutsourceInfo , getRepairById } from '@/api/maintenance/repair_report';
  124. import { getAssetInfo } from '@/api/ledgerAssets';
  125. import print from 'print-js'
  126. export default {
  127. props: {
  128. },
  129. watch: {
  130. },
  131. data () {
  132. return {
  133. appointVisible:false,
  134. workOrderInfo: {},
  135. equipmentInfo: {},
  136. infoData: {},
  137. }
  138. },
  139. created () {
  140. },
  141. methods: {
  142. async init(row){
  143. this.appointVisible = true
  144. console.log('row',row)
  145. const res = await getOutsourceInfo(row.id)
  146. this.workOrderInfo = res
  147. this.getSbinfo(row.equiId)
  148. this.getBxinfo(row.repairRequestId)
  149. },
  150. getSbinfo (params) {
  151. getAssetInfo(params).then(res => {
  152. this.equipmentInfo = res
  153. this.$set(this.equipmentInfo,'position',res.positionList[0].pathName?res.positionList[0].pathName:'')
  154. })
  155. },
  156. getBxinfo(params){
  157. getRepairById(params).then(res=>{
  158. this.infoData = res
  159. // 处理图片
  160. if (this.infoData && this.infoData.repairsImg) {
  161. const repairsImg = this.infoData.repairsImg
  162. this.infoData.repairsImg = []
  163. repairsImg.split(',').map(item => {
  164. imageView(item).then(res => {
  165. this.infoData.repairsImg.push({
  166. name: item.substring('/download/'.length),
  167. url: res
  168. })
  169. })
  170. return
  171. })
  172. }
  173. })
  174. },
  175. handleClose () {
  176. this.appointVisible = false
  177. },
  178. billPrintClick(){
  179. const style = '@page {margin:0 10mm};'//打印时去掉眉页眉尾
  180. //打印为什么要去掉眉页眉尾?因为眉页title时打印当前页面的title,相当于是获取html中title标签里面的内容,但是比如我打印的内容只是一个弹框里面的内容,是没有title的,这时候就会出现undefined,为了避免出现这种情况,就可以隐藏眉页眉尾
  181. printJS({
  182. printable: 'printBill',// 标签元素id
  183. type: 'html',
  184. header: '',
  185. targetStyles: ['*'],
  186. style
  187. });
  188. //各个配置项
  189. //printable:要打印的id。
  190. //type:可以是 html 、pdf、 json 等。
  191. //properties:是打印json时所需要的数据属性。
  192. //gridHeaderStyle和gridStyle都是打印json时可选的样式。
  193. //repeatTableHeader:在打印JSON数据时使用。设置为时false,数据表标题将仅在第一页显示。
  194. //scanStyles:设置为false时,库将不处理应用于正在打印的html的样式。使用css参数时很有用,此时自己设置的原来想要打印的样式就会失效,在打印预览时可以看到效果
  195. //targetStyles: [’*’],这样设置继承了页面要打印元素原有的css属性。
  196. //style:传入自定义样式的字符串,使用在要打印的html页面 也就是纸上的样子。
  197. //ignoreElements:传入要打印的div中的子元素id,使其不打印。非常好用
  198. },
  199. }
  200. }
  201. </script>
  202. <style lang="scss" scoped>
  203. .dialog_top {
  204. display: flex;
  205. justify-content: space-between;
  206. align-items: center;
  207. margin-bottom: 10px;
  208. }
  209. .btns {
  210. text-align: right;
  211. margin: 10px 0;
  212. }
  213. .border-span{
  214. width: 100%;
  215. margin: 15px 0;
  216. display: inline-block;
  217. }
  218. :deep(.main_container){
  219. page-break-after:always;
  220. width: 100%;
  221. .el-descriptions--medium.is-bordered .el-descriptions-item__cell{
  222. min-width:120px!important;
  223. }
  224. .container-write{
  225. width: 97%;
  226. margin:20px 0;
  227. }
  228. .write-box{
  229. width:100%;
  230. height:100px;
  231. border:1px solid #999;
  232. border-radius:4px;
  233. padding: 10px;
  234. }
  235. .write-choose{
  236. width:100%;
  237. margin:15px auto;
  238. display:flex;
  239. align-items:center;
  240. .choose-item{
  241. margin-right:10px;
  242. display:flex;
  243. align-items:center;
  244. width:80px;
  245. .item-span{
  246. display:inline-block;
  247. width:15px;
  248. height:15px;
  249. border:1px solid #999;
  250. margin-right:4px;
  251. }
  252. }
  253. }
  254. .write-name{
  255. margin-bottom:10px;
  256. display:flex;
  257. align-items:center;
  258. justify-content: flex-end;
  259. .name-tips{
  260. margin-right:150px;
  261. width:80px;
  262. }
  263. }
  264. }
  265. </style>