printTable.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471
  1. <template>
  2. <div>
  3. <el-button type="text" size="mini" @click="compile">单 据 下 载</el-button>
  4. <el-dialog :visible.sync="visible" append-to-body width="1000px">
  5. <!--安装培训确认单-->
  6. <div ref="container" style="background:#ffffff" v-if="detail.workorder.type == '安装培训'">
  7. <div slot="title" style="text-align: center;width: 100%;">
  8. <h2 style="margin:0">浙江班尼戈智慧管网股份有限公司</h2>
  9. <h3 style="padding:10px;text-align:center">BZ/Q(EO)P38-02系统《E服务确认单》 </h3>
  10. <div class="flex">
  11. <p>日期:{{detail.createdate}}</p>
  12. <p> 编号:{{detail.confirmationno}}</p>
  13. </div>
  14. </div>
  15. <table id="header__table" border="1" style="border-collapse: collapse;border:1px solid #EBEBED;">
  16. <tr>
  17. <td class="td__title">服务分类</td>
  18. <td>{{ detail.workorder.servicetype || '--' }}</td>
  19. <td class="td__title">应用系统</td>
  20. <td>{{ detail.workorder.class1 || '--' }}</td>
  21. <td class="td__title">工单负责人</td>
  22. <td>{{ detail.workorder.projectleader || '--' }}</td>
  23. </tr>
  24. <tr>
  25. <td class="td__title">项目名称</td>
  26. <td>{{ detail.workorder.projectname || '--' }}</td>
  27. <td class="td__title">业务员负责人</td>
  28. <td>{{ detail.workorder.saler_name || '--' }}</td>
  29. <td class="td__title">服务经销商</td>
  30. <td>{{ detail.workorder.enterprisename || '--' }}</td>
  31. </tr>
  32. <tr>
  33. <td class="td__title">联系人</td>
  34. <td>{{ detail.workorder.scenecontact || '--' }}</td>
  35. <td class="td__title">联系方式</td>
  36. <td>{{ detail.workorder.scenecontactphonenumber || '--' }}</td>
  37. <td class="td__title">地址</td>
  38. <td>{{ detail.workorder.province + detail.workorder.city + detail.workorder.county + detail.workorder.address }}</td>
  39. </tr>
  40. <tr>
  41. <td colspan="6" style="padding:0">
  42. <el-table :data="detail.trainers" :header-cell-style="{background:'#F2F3F5',color:'#000000'}" size="mini">
  43. <el-table-column width="260" prop="name" label="培训人员姓名">
  44. <template slot-scope="scope">
  45. {{ scope.row.name ? scope.row.name : '--' }}
  46. </template>
  47. </el-table-column>
  48. <el-table-column prop="position" label="职务">
  49. <template slot-scope="scope">
  50. {{ scope.row.position ? scope.row.position : '--' }}
  51. </template>
  52. </el-table-column>
  53. <el-table-column width="200" prop="phonenumber" label="电话">
  54. <template slot-scope="scope">
  55. {{ scope.row.phonenumber ? scope.row.phonenumber : '--' }}
  56. </template>
  57. </el-table-column>
  58. <el-table-column width="200" prop="enterprisename" label="所属经销商">
  59. <template slot-scope="scope">
  60. {{ scope.row.enterprisename ? scope.row.enterprisename : '--' }}
  61. </template>
  62. </el-table-column>
  63. </el-table>
  64. </td>
  65. </tr>
  66. <tr>
  67. <td colspan="6" style="padding:0">
  68. <el-table :data="detail.trainertitems" :header-cell-style="{background:'#F2F3F5',color:'#000000'}" size="mini">
  69. <el-table-column width="260" prop="itemname" label="培训产品名">
  70. <template slot-scope="scope">
  71. {{ scope.row.itemname ? scope.row.itemname : '--' }}
  72. </template>
  73. </el-table-column>
  74. <el-table-column prop="itemno" label="编号">
  75. <template slot-scope="scope">
  76. {{ scope.row.itemno ? scope.row.itemno : '--' }}
  77. </template>
  78. </el-table-column>
  79. <el-table-column width="200" prop="qty" label="数量">
  80. <template slot-scope="scope">
  81. {{ scope.row.qty ? scope.row.qty : '--' }}
  82. </template>
  83. </el-table-column>
  84. <el-table-column width="200" prop="model" label="型号">
  85. <template slot-scope="scope">
  86. {{ scope.row.model ? scope.row.model : '--' }}
  87. </template>
  88. </el-table-column>
  89. <el-table-column width="200" prop="spec" label="规格">
  90. <template slot-scope="scope">
  91. {{ scope.row.spec ? scope.row.spec : '--' }}
  92. </template>
  93. </el-table-column>
  94. </el-table>
  95. </td>
  96. </tr>
  97. <tr>
  98. <td style="background:#FAFAFA">现场培训内容</td>
  99. <td colspan="5">{{ text.descriptions1 }}</td>
  100. </tr>
  101. <tr>
  102. <td style="background:#FAFAFA">现场互动及测试培训效果</td>
  103. <td colspan="5">{{ text.descriptions2 }}</td>
  104. </tr>
  105. <tr>
  106. <td style="background:#FAFAFA">客户意见及签字确认:</td>
  107. <td colspan="5"><img ref="nameImage" style="width:200px" v-if="signatureName.length" :src="signatureName[0].url" alt=""></td>
  108. </tr>
  109. <tr>
  110. <td style="background:#FAFAFA">反应速度</td>
  111. <td colspan="2">{{ detail.responsescore }}</td>
  112. <td style="background:#FAFAFA">配合态度</td>
  113. <td colspan="2">{{ detail.attitudescore }}</td>
  114. </tr>
  115. <tr>
  116. <td style="background:#FAFAFA"></td>
  117. <td colspan="5">尊敬的用户,感谢您一直以来对我们公司的信任和支持,为更好的为您提供优质服务和产品,请允许我们的客户人员带回您最宝贵的意见</td>
  118. </tr>
  119. </table>
  120. </div>
  121. <!--服务确认单-->
  122. <div ref="container" style="background:#ffffff" v-else-if="detail.workorder.type == '服务'">
  123. <div slot="title" style="text-align: center;width: 100%;">
  124. <h2 style="margin:0">浙江班尼戈智慧管网股份有限公司</h2>
  125. <h3 style="padding:10px;text-align:center">售后服务确认单 </h3>
  126. <div class="flex">
  127. <p>日期:{{detail.createdate}}</p>
  128. <p> 编号:{{detail.confirmationno}}</p>
  129. </div>
  130. </div>
  131. <table id="header__table" border="1" style="border-collapse: collapse;border:1px solid #EBEBED;">
  132. <tr>
  133. <td class="td__title">项目名称</td>
  134. <td>{{ detail.workorder.projectname || '--' }}</td>
  135. <td class="td__title">保质期</td>
  136. <td>{{ detail.workorder.isouritem === 1?'内':'外' }}</td>
  137. <td class="td__title">是否有偿服务</td>
  138. <td>{{ text.descriptions4 > 0?'是':'否' }}</td>
  139. </tr>
  140. <tr>
  141. <td class="td__title">服务金额</td>
  142. <td>{{ text.descriptions4 }}</td>
  143. <td class="td__title">联系人</td>
  144. <td>{{ detail.workorder.scenecontact || '--' }}</td>
  145. <td class="td__title">联系方式</td>
  146. <td>{{ detail.workorder.scenecontactphonenumber || '--' }}</td>
  147. </tr>
  148. <tr>
  149. <td class="td__title">应用系统</td>
  150. <td>{{ detail.workorder.class1 || '--' }}</td>
  151. <td class="td__title">客诉大类</td>
  152. <td>{{ detail.workorder.class2 || '--' }}</td>
  153. <td class="td__title">地址</td>
  154. <td>{{ detail.workorder.province + detail.workorder.city + detail.workorder.county + detail.workorder.address }}</td>
  155. </tr>
  156. <!-- <tr>
  157. <td colspan="6" style="padding:0">
  158. <el-table :data="detail.trainers" :header-cell-style="{background:'#F2F3F5',color:'#000000'}" size="mini">
  159. <el-table-column width="260" prop="name" label="培训人员姓名">
  160. <template slot-scope="scope">
  161. {{ scope.row.name ? scope.row.name : '--' }}
  162. </template>
  163. </el-table-column>
  164. <el-table-column prop="position" label="职务">
  165. <template slot-scope="scope">
  166. {{ scope.row.position ? scope.row.position : '--' }}
  167. </template>
  168. </el-table-column>
  169. <el-table-column width="200" prop="phonenumber" label="电话">
  170. <template slot-scope="scope">
  171. {{ scope.row.phonenumber ? scope.row.phonenumber : '--' }}
  172. </template>
  173. </el-table-column>
  174. <el-table-column width="200" prop="enterprisename" label="所属经销商">
  175. <template slot-scope="scope">
  176. {{ scope.row.enterprisename ? scope.row.enterprisename : '--' }}
  177. </template>
  178. </el-table-column>
  179. </el-table>
  180. </td>
  181. </tr> -->
  182. <tr>
  183. <td colspan="6" style="padding:0">
  184. <el-table :data="detail.trainertitems" :header-cell-style="{background:'#F2F3F5',color:'#000000'}" size="mini">
  185. <el-table-column width="260" prop="itemname" label="培训产品名">
  186. <template slot-scope="scope">
  187. {{ scope.row.itemname ? scope.row.itemname : '--' }}
  188. </template>
  189. </el-table-column>
  190. <el-table-column prop="itemno" label="编号">
  191. <template slot-scope="scope">
  192. {{ scope.row.itemno ? scope.row.itemno : '--' }}
  193. </template>
  194. </el-table-column>
  195. <el-table-column width="200" prop="qty" label="数量">
  196. <template slot-scope="scope">
  197. {{ scope.row.qty ? scope.row.qty : '--' }}
  198. </template>
  199. </el-table-column>
  200. <el-table-column width="200" prop="model" label="型号">
  201. <template slot-scope="scope">
  202. {{ scope.row.model ? scope.row.model : '--' }}
  203. </template>
  204. </el-table-column>
  205. <el-table-column width="200" prop="spec" label="规格">
  206. <template slot-scope="scope">
  207. {{ scope.row.spec ? scope.row.spec : '--' }}
  208. </template>
  209. </el-table-column>
  210. </el-table>
  211. </td>
  212. </tr>
  213. <tr>
  214. <td style="background:#FAFAFA">问题简述</td>
  215. <td colspan="5">{{ detail.workorder.reason || '--' }}</td>
  216. </tr>
  217. <tr>
  218. <td style="background:#FAFAFA">原因及处理措施</td>
  219. <td colspan="5">{{ detail.confirmationcontent[8]?detail.confirmationcontent[8].treatment.confirm_value :''}}</td>
  220. </tr>
  221. <tr>
  222. <td style="background:#FAFAFA">下次处理日期</td>
  223. <td colspan="5">{{ detail.confirmationcontent[7]?detail.confirmationcontent[7].nextTreatmentTime.confirm_value:''}}</td>
  224. </tr>
  225. <tr>
  226. <td style="background:#FAFAFA">事项说明</td>
  227. <td colspan="5">{{ detail.confirmationcontent[9]?detail.confirmationcontent[9].explain.confirm_value:"" }}</td>
  228. </tr>
  229. <tr>
  230. <td style="background:#FAFAFA">客户意见及签字确认:</td>
  231. <td colspan="5"><img ref="nameImage" style="width:200px" v-if="signatureName.length" :src="signatureName[0].url" alt=""></td>
  232. </tr>
  233. <tr>
  234. <td style="background:#FAFAFA">反应速度</td>
  235. <td colspan="2">{{ detail.responsescore }}</td>
  236. <td style="background:#FAFAFA">配合态度</td>
  237. <td colspan="2">{{ detail.attitudescore }}</td>
  238. </tr>
  239. <tr>
  240. <td style="background:#FAFAFA"></td>
  241. <td colspan="5">尊敬的用户,感谢您一直以来对我们公司的信任和支持,为更好的为您提供优质服务和产品,请允许我们的客户人员带回您最宝贵的意见</td>
  242. </tr>
  243. </table>
  244. </div>
  245. <!--安装调试确认单-->
  246. <div ref="container" style="background:#ffffff" v-else-if="detail.workorder.type == '安装调试'">
  247. <div slot="title" style="text-align: center;width: 100%;">
  248. <h2 style="margin:0">浙江班尼戈智慧管网股份有限公司</h2>
  249. <h3 style="padding:10px;text-align:center">售后服务确认单 </h3>
  250. <div class="flex">
  251. <p>日期:{{detail.createdate}}</p>
  252. <p> 编号:{{detail.confirmationno}}</p>
  253. </div>
  254. </div>
  255. <table id="header__table" border="1" style="border-collapse: collapse;border:1px solid #EBEBED;">
  256. <tr>
  257. <td class="td__title">项目名称</td>
  258. <td>{{ detail.workorder.projectname || '--' }}</td>
  259. <td class="td__title">保质期</td>
  260. <td>{{ detail.workorder.isouritem === 1?'内':'外' }}</td>
  261. <td class="td__title">是否有偿服务</td>
  262. <td>{{ text.descriptions4 > 0?'是':'否' }}</td>
  263. </tr>
  264. <tr>
  265. <td class="td__title">服务金额</td>
  266. <td>{{ text.descriptions4 }}</td>
  267. <td class="td__title">联系人</td>
  268. <td>{{ detail.workorder.scenecontact || '--' }}</td>
  269. <td class="td__title">联系方式</td>
  270. <td>{{ detail.workorder.scenecontactphonenumber || '--' }}</td>
  271. </tr>
  272. <tr>
  273. <td class="td__title">应用系统</td>
  274. <td>{{ detail.workorder.class1 || '--' }}</td>
  275. <td class="td__title">客诉大类</td>
  276. <td>{{ detail.workorder.class2 || '--' }}</td>
  277. <td class="td__title">地址</td>
  278. <td>{{ detail.workorder.province + detail.workorder.city + detail.workorder.county + detail.workorder.address }}</td>
  279. </tr>
  280. <!-- <tr>
  281. <td colspan="6" style="padding:0">
  282. <el-table :data="detail.trainers" :header-cell-style="{background:'#F2F3F5',color:'#000000'}" size="mini">
  283. <el-table-column width="260" prop="name" label="培训人员姓名">
  284. <template slot-scope="scope">
  285. {{ scope.row.name ? scope.row.name : '--' }}
  286. </template>
  287. </el-table-column>
  288. <el-table-column prop="position" label="职务">
  289. <template slot-scope="scope">
  290. {{ scope.row.position ? scope.row.position : '--' }}
  291. </template>
  292. </el-table-column>
  293. <el-table-column width="200" prop="phonenumber" label="电话">
  294. <template slot-scope="scope">
  295. {{ scope.row.phonenumber ? scope.row.phonenumber : '--' }}
  296. </template>
  297. </el-table-column>
  298. <el-table-column width="200" prop="enterprisename" label="所属经销商">
  299. <template slot-scope="scope">
  300. {{ scope.row.enterprisename ? scope.row.enterprisename : '--' }}
  301. </template>
  302. </el-table-column>
  303. </el-table>
  304. </td>
  305. </tr> -->
  306. <tr>
  307. <td colspan="6" style="padding:0">
  308. <el-table :data="detail.trainertitems" :header-cell-style="{background:'#F2F3F5',color:'#000000'}" size="mini">
  309. <el-table-column width="260" prop="itemname" label="培训产品名">
  310. <template slot-scope="scope">
  311. {{ scope.row.itemname ? scope.row.itemname : '--' }}
  312. </template>
  313. </el-table-column>
  314. <el-table-column prop="itemno" label="编号">
  315. <template slot-scope="scope">
  316. {{ scope.row.itemno ? scope.row.itemno : '--' }}
  317. </template>
  318. </el-table-column>
  319. <el-table-column width="200" prop="qty" label="数量">
  320. <template slot-scope="scope">
  321. {{ scope.row.qty ? scope.row.qty : '--' }}
  322. </template>
  323. </el-table-column>
  324. <el-table-column width="200" prop="model" label="型号">
  325. <template slot-scope="scope">
  326. {{ scope.row.model ? scope.row.model : '--' }}
  327. </template>
  328. </el-table-column>
  329. <el-table-column width="200" prop="spec" label="规格">
  330. <template slot-scope="scope">
  331. {{ scope.row.spec ? scope.row.spec : '--' }}
  332. </template>
  333. </el-table-column>
  334. </el-table>
  335. </td>
  336. </tr>
  337. <tr>
  338. <td style="background:#FAFAFA">问题简述</td>
  339. <td colspan="5">{{ detail.workorder.reason || '--' }}</td>
  340. </tr>
  341. <tr>
  342. <td style="background:#FAFAFA">原因及处理措施</td>
  343. <td colspan="5">{{ detail.confirmationcontent[8]?detail.confirmationcontent[8].treatment.confirm_value :''}}</td>
  344. </tr>
  345. <tr>
  346. <td style="background:#FAFAFA">下次处理日期</td>
  347. <td colspan="5">{{ detail.confirmationcontent[7]?detail.confirmationcontent[7].nextTreatmentTime.confirm_value:''}}</td>
  348. </tr>
  349. <tr>
  350. <td style="background:#FAFAFA">事项说明</td>
  351. <td colspan="5">{{ detail.confirmationcontent[9]?detail.confirmationcontent[9].explain.confirm_value:"" }}</td>
  352. </tr>
  353. <tr>
  354. <td style="background:#FAFAFA">客户意见及签字确认:</td>
  355. <td colspan="5"><img ref="nameImage" style="width:200px" v-if="signatureName.length" :src="signatureName[0].url" alt=""></td>
  356. </tr>
  357. <tr>
  358. <td style="background:#FAFAFA">反应速度</td>
  359. <td colspan="2">{{ detail.responsescore }}</td>
  360. <td style="background:#FAFAFA">配合态度</td>
  361. <td colspan="2">{{ detail.attitudescore }}</td>
  362. </tr>
  363. <tr>
  364. <td style="background:#FAFAFA"></td>
  365. <td colspan="5">尊敬的用户,感谢您一直以来对我们公司的信任和支持,为更好的为您提供优质服务和产品,请允许我们的客户人员带回您最宝贵的意见</td>
  366. </tr>
  367. </table>
  368. </div>
  369. <div class="dialog-footer">
  370. <el-button type="primary" @click="submit" size="small" class="normal-btn-width">生成图片</el-button>
  371. </div>
  372. </el-dialog>
  373. </div>
  374. </template>
  375. <script>
  376. import domtoimage from 'dom-to-image'
  377. export default {
  378. props: ['data'],
  379. data () {
  380. return {
  381. visible: false,
  382. detail: {
  383. servicetype:{},
  384. workorder:{},
  385. servicetitems:[],
  386. confirmationcontent:[]
  387. },
  388. signatureName:[],
  389. needSignName:true,
  390. show:true,
  391. text:{
  392. descriptions1:'',
  393. descriptions2:'',
  394. descriptions3:'',
  395. descriptions4:0,
  396. descriptions5:'',
  397. descriptions6:'',
  398. descriptions7:''
  399. }
  400. }
  401. },
  402. methods: {
  403. async compile () {
  404. this.visible = true
  405. let res = await this.$api.requested({
  406. "id": "20230211105803",
  407. "version": 1,
  408. "content": {
  409. "sa_workorder_confirmationid": this.data.sa_workorder_confirmationid
  410. }
  411. })
  412. res.data.confirmationcontent.forEach(e => {
  413. Object.keys(e).map((key,index)=>{
  414. this.text.descriptions4 += e[key].amount
  415. if (key.includes('现场培训内容')) {
  416. this.text.descriptions1 = e[key].confirm_value
  417. }
  418. if (key.includes('测试培训效果')) {
  419. this.text.descriptions2 = e[key].confirm_value
  420. }
  421. })
  422. })
  423. this.detail = res.data
  424. this.signatureName = this.detail.attinfos.filter(e=>{
  425. if (e.usetype === 'signature') {
  426. return e
  427. }
  428. })
  429. console.log(this.detail)
  430. },
  431. submit () {
  432. let that = this
  433. domtoimage.toBlob(this.$refs.container)
  434. .then(function (blob) {
  435. console.log('触发');
  436. let blobUrl = window.URL.createObjectURL(blob)
  437. let link = document.createElement('a')
  438. link.download = that.detail.workorder.type
  439. link.style.display = 'none'
  440. link.href = blobUrl
  441. // 触发点击
  442. document.body.appendChild(link)
  443. link.click()
  444. // 移除
  445. document.body.removeChild(link)
  446. })
  447. },
  448. },
  449. created () {
  450. }
  451. }
  452. </script>
  453. <style scoped>
  454. #header__table tr td {
  455. width: 120px;
  456. padding:10px;
  457. }
  458. .td__title {
  459. background: #FAFAFA;
  460. color: #000000;
  461. font-weight: bold;
  462. }
  463. .flex{
  464. display: flex;
  465. justify-content: space-between;
  466. }
  467. </style>