TestReport.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  1. <template>
  2. <el-dialog :visible.sync="dialogVisible1" width="70vw" class="public_task" title="提测报告" :close-on-click-modal="false" :before-close="handleClose1">
  3. <div class="blueStripe" />
  4. <div style="margin: 2% 0%; font-size: 16pt; color: #333B4A;">
  5. <el-steps :active="active" align-center finish-status="success">
  6. <el-step style="font-size: 16pt; color: #333B4A;" title="选择模版" />
  7. <el-step title="填写报告" />
  8. <el-step style="font-size: 16pt; color: #333B4A;" title="发送报告" />
  9. </el-steps>
  10. </div>
  11. <div v-if="showOne" style="margin: 0 4% 2%;">
  12. <div style="margin: 0% 14%; height: 435px;" class="Layout">
  13. <div style="margin-right:2%;">
  14. <el-radio v-model="radio" class="_radio" label="1">客户端模版</el-radio><br>
  15. <el-image style="display: inline-block; width: 80%;" :src="src1" />
  16. </div>
  17. <div style="margin-left:2%;">
  18. <el-radio v-model="radio" class="_radio" label="2">服务端模版</el-radio><br>
  19. <el-image style="display: inline-block; width: 77%;" :src="src" />
  20. </div>
  21. </div>
  22. <div align="center">
  23. <el-button size="small" type="primary" @click="NextStep()">下一步</el-button>
  24. </div>
  25. </div>
  26. <div v-if="showTow" style="margin: 0 5%;">
  27. <div class="descr" style=" margin-bottom: 2%; height: 440px; overflow:scroll; overflow-x: hidden">
  28. <Present v-if="Present1" ref="Present" :clien-data="clienData" @fatherMethod="fatherMethod" />
  29. <presentation v-if="presentation1" ref="presentationRef" :clien-data="clienData" @fatherMethod="fatherMethod" />
  30. </div>
  31. <div align="center">
  32. <el-button size="small" type="primary" @click="PreviousStep()">上一步</el-button>
  33. <el-button size="small" type="primary" @click="created_out()">保存,下一步</el-button>
  34. </div>
  35. </div>
  36. <div v-if="showThree">
  37. <div style="margin: 2% 5%; font-size: 16pt; color: #333B4A;">
  38. <div style="margin: 1% 2%;font-size:18px; font-family:PingFangSC-Medium,PingFang SC; font-weight:500; color:rgba(51,59,74,1); line-height:29px;">
  39. 邮件列表
  40. </div>
  41. <div style="margin: 1% 2% 3%;">
  42. <div class="Layout" style="margin-bottom: 10px;"><div class="div1">收件人</div><search-people :value.sync="form.name" :clearable="true" :multiple="true" style="width:100%" /></div>
  43. <div class="Layout"><div class="div1">抄送</div><searchTeam :value.sync="form.names" :clearable="true" :multiple="true" style="width:100%" /></div>
  44. </div>
  45. <div style="margin: 0 2%; font-size:18px; font-family:PingFangSC-Medium,PingFang SC; font-weight:500; color:rgba(51,59,74,1); line-height:29px;">
  46. 报告预览
  47. </div>
  48. <div class="descr" style=" margin-bottom: 2%; height:310px; overflow:scroll; overflow-x: hidden">
  49. <acceptthe id="resumeId" ref="acceptthe" :message="preview" />
  50. </div>
  51. </div>
  52. <div align="center">
  53. <el-button size="small" type="primary" @click="gou_out()">上一步</el-button>
  54. <el-button size="small" :disabled="send" :loading="send" type="primary" @click="sendReport(form)">发送</el-button>
  55. </div>
  56. </div>
  57. </el-dialog>
  58. </template>
  59. <script>
  60. import '@/views/projectManage/publicCss/index.css'
  61. import '@/styles/PublicStyle/index.scss'
  62. import Present from '@/views/Platform/presentation/PresentReport'
  63. import acceptthe from '@/views/Platform/presentation/acceptTheReport'
  64. import presentation from '@/views/Platform/presentation/presentationReport.vue'
  65. import { launchTestSendmail } from '@/api/ResultPage'
  66. import html2canvas from 'html2canvas'
  67. import testF from '@/assets/testF.png'
  68. import testK from '@/assets/testK.png'
  69. import searchTeam from '@/components/select/searchTeam'
  70. import searchPeople from '@/components/select/searchPeople'
  71. export default {
  72. components: {
  73. Present,
  74. acceptthe,
  75. presentation,
  76. searchTeam,
  77. searchPeople
  78. },
  79. data() {
  80. return {
  81. form: {},
  82. Present1: false,
  83. presentation1: false,
  84. showOne: true,
  85. showTow: false,
  86. showThree: false,
  87. showClient: false,
  88. showClientYL: false,
  89. active: 1,
  90. radio: '1',
  91. clienData: {},
  92. newNum: '',
  93. present_task: [],
  94. send: false,
  95. preview: '',
  96. src: testF,
  97. src1: testK,
  98. dialogVisible1: false,
  99. clien: ''
  100. }
  101. },
  102. methods: {
  103. init(index, newData) {
  104. console.log(newData, '提测tan窗')
  105. this.dialogVisible1 = true
  106. const url = location.href // 获取url中"?"符后的字串
  107. const arr = url.split('=')
  108. switch (index) {
  109. case 1:
  110. this.present_task = [Number(arr[1])]
  111. this.showOne = true
  112. this.showTow = false
  113. this.showThree = false
  114. this.active = 1
  115. break
  116. case 2:
  117. this.clienData = newData
  118. this.showOne = false
  119. this.showThree = false
  120. this.showTow = true
  121. this.active = 2
  122. this.newNum = 2
  123. if (newData.type === 1) {
  124. this.radio = '1'
  125. this.Present1 = true
  126. this.presentation1 = false
  127. }
  128. if (newData.type === 2) {
  129. this.radio = '2'
  130. this.Present1 = false
  131. this.presentation1 = true
  132. }
  133. break
  134. case 3:
  135. this.clienData = newData
  136. this.showOne = false
  137. this.showTow = false
  138. this.showThree = true
  139. this.form = {}
  140. this.preview = newData
  141. this.active = 3
  142. break
  143. case 4:
  144. this.clienData = newData
  145. this.present_task = newData.taskIds
  146. this.showOne = false
  147. this.showThree = false
  148. this.showTow = true
  149. this.active = 2
  150. this.newNum = 1
  151. if (newData.type === 1) {
  152. this.radio = '1'
  153. this.Present1 = true
  154. this.presentation1 = false
  155. }
  156. if (newData.type === 2) {
  157. this.radio = '2'
  158. this.Present1 = false
  159. this.presentation1 = true
  160. }
  161. break
  162. case 7:
  163. this.present_task = newData
  164. this.clienData.taskIds = newData
  165. this.showOne = true
  166. this.showTow = false
  167. this.showThree = false
  168. this.active = 1
  169. break
  170. }
  171. },
  172. PreviousStep() {
  173. this.showTow = false
  174. this.showOne = true
  175. this.active = 1
  176. },
  177. gou_out() {
  178. this.$emit('getRouterData')
  179. this.clienData = this.preview
  180. this.showOne = false
  181. this.showThree = false
  182. this.showTow = true
  183. this.active = 2
  184. this.newNum = 2
  185. if (this.clienData.type === 1) {
  186. this.radio = '1'
  187. this.Present1 = true
  188. this.presentation1 = false
  189. }
  190. if (this.clienData.type === 2) {
  191. this.radio = '2'
  192. this.Present1 = false
  193. this.presentation1 = true
  194. }
  195. },
  196. created_out() {
  197. if (this.radio === '2') { // 服务端
  198. this.$refs.presentationRef.parentHandleclick(this.newNum, this.present_task, this.clien)
  199. }
  200. if (this.radio === '1') { // 客户端
  201. this.$refs.Present.parentHandleclick(this.newNum, this.present_task, this.clien)
  202. }
  203. },
  204. NextStep() {
  205. switch (Number(this.radio)) {
  206. case 1:
  207. this.clienData = {}
  208. this.showOne = false
  209. this.showTow = true
  210. this.Present1 = true
  211. this.presentation1 = false
  212. this.active = 2
  213. this.newNum = 1
  214. break
  215. case 2:
  216. this.clienData = {}
  217. this.showOne = false
  218. this.showTow = true
  219. this.Present1 = false
  220. this.presentation1 = true
  221. this.active = 2
  222. this.newNum = 1
  223. break
  224. case 3:
  225. this.$message({ message: '请选择要创建的‘模版’', type: 'error', duration: 1000, offset: 150 })
  226. break
  227. }
  228. },
  229. handleClose1() {
  230. this.dialogVisible1 = false
  231. this.radio = '1'
  232. this.showOne = false
  233. this.showThree = false
  234. this.showTow = false
  235. },
  236. fatherMethod(e) {
  237. console.log(e, '新建返回')
  238. this.clien = e.id
  239. this.preview = e
  240. this.showThree = true
  241. this.form = {}
  242. this.showTow = false
  243. this.active = 3
  244. },
  245. sendReport(e) {
  246. if (e.name !== undefined) {
  247. this.send = true
  248. const ele = this.preview
  249. const targetDom = document.getElementById('resumeId')
  250. const copyDom = targetDom.cloneNode(true)
  251. document.querySelector('body').appendChild(copyDom)
  252. setTimeout(() => {
  253. html2canvas(document.getElementsByClassName('reportContent')[1], { useCORS: true }).then(canvas => {
  254. const imgData = canvas.toDataURL('image/png')
  255. const sendImgData = imgData.substring(imgData.indexOf(',') + 1)
  256. const postData = { 'reportId': ele.id, 'imgStr': sendImgData, 'url': window.location.href, 'emailUser': e.name.join(','), 'copyTo': e.names.join(',') }
  257. launchTestSendmail(postData).then(res => {
  258. res.code === 200 ? this.$message.success('报告发送中,请稍后进行邮件查收!') : this.$message.error('发送测试日报失败,请联系管理员!')
  259. this.handleClose1()
  260. this.send = false
  261. document.querySelector('body').removeChild(copyDom)
  262. })
  263. })
  264. }, 500)
  265. } else {
  266. this.$message({ message: '请填写邮箱', type: 'error', offset: 150 })
  267. }
  268. }
  269. }
  270. }
  271. </script>
  272. <style>
  273. /* 全局dialog上下左右剧中 */
  274. .el-dialog{
  275. display: flex;
  276. flex-direction: column;
  277. margin:0 !important;
  278. position:absolute;
  279. top:50%;
  280. left:50%;
  281. transform:translate(-50%,-50%);
  282. }
  283. .el-dialog .el-dialog__body{
  284. flex:1;
  285. overflow: auto;
  286. }
  287. .descr{
  288. display: flex;
  289. justify-content: center;
  290. }
  291. </style>
  292. <style lang="scss" scoped>
  293. ._radio {
  294. margin: 3% 0;
  295. color: #333B4A;
  296. font-size: 16pt
  297. }
  298. .flex_start {
  299. display: flex;
  300. align-items: center;
  301. justify-content: flex-start;
  302. }
  303. .Layout {
  304. display: flex;
  305. align-items: center;
  306. justify-content: space-between;
  307. }
  308. .div1 {
  309. width: 60px;
  310. font-size: 14px;
  311. font-family: MicrosoftYaHei;
  312. color: rgba(51,51,51,1);
  313. line-height: 19px;
  314. }
  315. .descr{
  316. display: flex;
  317. justify-content: center;
  318. }
  319. .descr::-webkit-scrollbar{
  320. width:0;
  321. }
  322. </style>