TestingReport.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  1. <template>
  2. <el-dialog :visible.sync="dialogDaliy" width="70vw" class="public_task report-dialog" :title="reportHome ? '提测报告' : `创建提测报告模版`" :close-on-click-modal="false" :destroy-on-close="true" :before-close="handleClose">
  3. <div v-if="reportHome" class="blueStripe" />
  4. <i v-if="!reportHome" class="el-icon-arrow-left report-return didi-hover" @click="reportReturn" />
  5. <el-steps v-if="reportHome" :active="active" align-center finish-status="success" class="report-steps">
  6. <el-step title="选择模版" />
  7. <el-step title="填写报告" />
  8. <el-step title="发送报告" />
  9. </el-steps>
  10. <div class="report-leftRight">
  11. <div v-if="showOne" style="min-height: 50vh;">
  12. <el-row type="flex" justify="center">
  13. <el-col :span="19" class="creator">模版名称</el-col>
  14. <el-col :span="5" class="creator">创建人</el-col>
  15. </el-row>
  16. <div ref="refName" style="max-height: 260px; overflow:scroll; overflow-x: hidden">
  17. <el-row v-for="(item, index) in selectTemplate" :key="index" type="flex" justify="center" @mouseover.native="item.operation = true" @mouseleave.native="item.operation = false">
  18. <el-col :span="19">
  19. <el-radio v-model="fromData.radio" class="creatorList" :label="item.id">{{ item.moduleName }}</el-radio>
  20. </el-col>
  21. <el-col :span="5" class="creatorList">
  22. {{ item.creatorObject.name }}
  23. <span v-if="item.creator !== 'SYSTEM' && item.creator !== '系统'" class="operation">
  24. <i class="el-icon-edit-outline didi-hover" @click="open_new_template(item)" />
  25. <el-popover :ref="item.id" placement="bottom" width="300" trigger="click">
  26. <div><div class="blur-column" /> 删除模版</div>
  27. <div class="blueStripe" />
  28. <div class="deletreport">是否要删除模版{{ item.moduleName }}?</div>
  29. <div style="text-align: right; margin: 0">
  30. <el-button size="mini" type="danger" @click="settingDeleteReportModule(item)">确定</el-button>
  31. <el-button size="mini" @click="closeDefaultPopover()">取消</el-button>
  32. </div>
  33. <i slot="reference" class="el-icon-delete reportModel didi-hover" />
  34. </el-popover>
  35. </span>
  36. </el-col>
  37. </el-row>
  38. </div>
  39. <el-row type="flex" justify="center">
  40. <el-col :span="24">
  41. <span class="didi-hover" @click="open_new_template()"><i class="el-icon-circle-plus-outline creatorList didi-hover" /> <span style="margin-left: 8px">新建模版</span></span>
  42. </el-col>
  43. </el-row>
  44. </div>
  45. <!-- new模版 -->
  46. <newTestingTemplate v-if="reportTamplate" ref="newReportTemplate" class="daily" :template-id="templateId" @getreportTemplate="getreportTemplate" @reportReturn="reportReturn" />
  47. <!-- new模版 -->
  48. <!-- 新建日报模版 -->
  49. <newTestingTemplate v-if="newDailyTemplate" ref="dailyTemplate" class="daily" :template-id="fromData.radio" :task-ids="daily_taskIds" @SaveNextStep="SaveNextStep" />
  50. <!-- 新建日报模版 -->
  51. <!-- 日报预览 -->
  52. <TestingPreview v-if="dailyPreview" ref="dailyPreview" class="daily" :daily-id="dailyId" @handleClose="handleClose" />
  53. <!-- 日报预览 -->
  54. </div>
  55. <div slot="footer" class="dialog-footer" align="center">
  56. <!-- 新建模版 -->
  57. <el-button v-if="reportTamplate" size="small" type="primary" @click="created_out()">保存</el-button>
  58. <!-- 第一步 -->
  59. <el-button v-if="showOne" size="small" type="primary" @click="NextStep()">下一步</el-button>
  60. <!-- 第二步 -->
  61. <el-button v-if="newDailyTemplate" size="small" type="primary" @click="reportReturn">上一步</el-button>
  62. <el-button v-if="newDailyTemplate" size="small" type="primary" @click="getCreateData">保存, 下一步</el-button>
  63. <!-- 第三步 -->
  64. <el-button v-if="dailyPreview" size="small" type="primary" @click="sendReportReturn">上一步</el-button>
  65. <el-button v-if="dailyPreview" size="small" type="primary" @click="sendReport">发送</el-button>
  66. </div>
  67. </el-dialog>
  68. </template>
  69. <script>
  70. import '@/styles/PublicStyle/index.scss'
  71. import { settingQueryReportModuleList, settingDeleteReportModule, reportdelivertestGetReportById } from '@/api/reportTemplate'
  72. import newTestingTemplate from '@/views/reportManagement/Testing/newTestingTemplate.vue'
  73. import TestingPreview from '@/views/reportManagement/Testing/TestingPreview.vue'
  74. export default {
  75. components: {
  76. newTestingTemplate,
  77. TestingPreview
  78. },
  79. data() {
  80. return {
  81. reportHome: true, // 报告主页
  82. templateId: '', // 模版id
  83. modelId: '', // 下一步选择的模版id
  84. selectTemplate: [], // 模版option
  85. fromData: {
  86. radio: 1
  87. },
  88. newDailyTemplate: false, // 新建日报模版
  89. reportTamplate: false, // new模版
  90. dailyPreview: false, // 日报预览
  91. dailyId: '', // 当前创建报告的id
  92. updateDaily: false, // 编辑
  93. dialogDaliy: false,
  94. showOne: true,
  95. active: 1,
  96. daily_taskIds: [] // 选择的任务ID
  97. }
  98. },
  99. created() {
  100. this.getreportTemplate()
  101. },
  102. methods: {
  103. async getreportTemplate() { // 获取模版list
  104. const res = await settingQueryReportModuleList({ bizId: localStorage.getItem('bizId'), type: 1 }) // 1 提测
  105. if (res.code === 200) {
  106. this.$nextTick(() => {
  107. const data = res.data
  108. this.selectTemplate = data.map(item => ({
  109. ...item,
  110. operation: false
  111. }))
  112. this.fromData.radio = this.selectTemplate[0].id
  113. })
  114. }
  115. },
  116. init(index, newData) {
  117. console.log(index, newData, '测试')
  118. this.dialogDaliy = true
  119. switch (index) {
  120. case 2: // 编辑
  121. reportdelivertestGetReportById(newData.id).then(res => {
  122. if (res.code === 200) {
  123. this.daily_taskIds = res.data.taskIds // 关联任务
  124. this.fromData.radio = res.data // 选择的模块
  125. }
  126. })
  127. this.reportHome = true // 步骤条
  128. this.active = 2 // 步骤条状态第三步
  129. this.showOne = false // 隐藏第一步
  130. this.newDailyTemplate = true // 隐藏第二步
  131. this.dailyPreview = false // 展示第三部
  132. this.updateDaily = true // 编辑
  133. break
  134. case 4: // 重新提测
  135. reportdelivertestGetReportById(newData.id).then(res => {
  136. if (res.code === 200) {
  137. this.daily_taskIds = res.data.taskIds // 关联任务
  138. this.fromData.radio = res.data // 选择的模块
  139. this.reportHome = true // 步骤条
  140. this.active = 2 // 步骤条状态第三步
  141. this.showOne = false // 隐藏第一步
  142. this.newDailyTemplate = true // 隐藏第二步
  143. this.dailyPreview = false // 展示第三部
  144. this.updateDaily = false // 编辑
  145. }
  146. })
  147. break
  148. case 3: // 发送报告
  149. this.dailyId = newData.id
  150. this.reportHome = true // 步骤条
  151. this.active = 3 // 步骤条状态第三步
  152. this.showOne = false // 隐藏第一步
  153. this.newDailyTemplate = false // 隐藏第二步
  154. this.dailyPreview = true // 展示第三部
  155. break
  156. case 7: // 新建
  157. this.daily_taskIds = newData
  158. this.reportHome = true // 步骤条
  159. this.active = 1 // 步骤条状态第三步
  160. this.showOne = true // 展示第一步
  161. this.newDailyTemplate = false // 隐藏第二步
  162. this.dailyPreview = false // 隐藏第三部
  163. break
  164. }
  165. },
  166. report_update() { // 编辑模版
  167. this.$refs.DailyReport.getQueryData(1)
  168. },
  169. created_out() { // 新建模版
  170. this.$refs.newReportTemplate.getCreateData(1)
  171. },
  172. reportReturn() { // 新建模版点击返回
  173. this.reportHome = true // 步骤条
  174. this.showOne = true // 模版选择
  175. this.reportTamplate = false // 编辑区域
  176. this.newDailyTemplate = false // 隐藏第二步
  177. this.dailyPreview = false // 隐藏第三步
  178. },
  179. open_new_template(val) { // 点击新建模版
  180. val ? this.templateId = val.id : this.templateId = '新建模版'
  181. this.reportTamplate = true // 编辑区域
  182. this.reportHome = false // 步骤条
  183. this.showOne = false // 模版选择
  184. },
  185. async settingDeleteReportModule(item) {
  186. const res = await settingDeleteReportModule({ id: item.id }, item.id)
  187. if (res.code === 200) {
  188. this.getreportTemplate()
  189. this.closeDefaultPopover()
  190. this.$message({ message: '已删除’', type: 'success', duration: 1000, offset: 150 })
  191. }
  192. },
  193. closeDefaultPopover() { // 模拟点击
  194. this.$refs.refName.click()
  195. },
  196. getCreateData() { // 保存,下一步
  197. this.$refs.dailyTemplate.reportreleaseCreate(this.updateDaily)
  198. },
  199. NextStep() { // 第一步到第二步
  200. this.reportHome = true // 步骤条
  201. this.active = 2 // 步骤条状态第二步
  202. this.showOne = false // 隐藏第一步
  203. this.newDailyTemplate = true // 展示第二步
  204. this.dailyPreview = false // 隐藏第三步
  205. },
  206. SaveNextStep(ele) { // 第二步到第三部
  207. console.log(ele, 'xsaxasxasxsaxsa')
  208. this.dailyId = ele.id // 新建报告id
  209. this.reportHome = true // 步骤条
  210. this.active = 3 // 步骤条状态第三步
  211. this.showOne = false // 隐藏第一步
  212. this.newDailyTemplate = false // 隐藏第二步
  213. this.dailyPreview = true // 展示第三部
  214. },
  215. async sendReportReturn() { // 第三步返回第二部
  216. const res = await reportdelivertestGetReportById(this.dailyId)
  217. if (res.code === 200) {
  218. this.daily_taskIds = res.data.taskIds // 关联任务
  219. this.fromData.radio = res.data // 选择的模块
  220. }
  221. this.reportHome = true // 步骤条
  222. this.active = 2 // 步骤条状态第三步
  223. this.showOne = false // 隐藏第一步
  224. this.newDailyTemplate = true // 隐藏第二步
  225. this.dailyPreview = false // 展示第三部
  226. this.updateDaily = true // 编辑
  227. },
  228. sendReport() { // 截图
  229. this.$refs.dailyPreview.sendReport()
  230. },
  231. handleClose() {
  232. this.dialogDaliy = false
  233. this.$emit('getList')
  234. }
  235. }
  236. }
  237. </script>
  238. <style lang="scss" scoped>
  239. .report-leftRight {
  240. margin: 0 8%;
  241. >>> .el-row .el-col {
  242. margin: 0;
  243. }
  244. }
  245. .titIcon {
  246. width: 4px;
  247. height: 17px;
  248. background: #409EFF;
  249. border-radius: 1px;
  250. }
  251. .el-dialog__header {
  252. padding: 0 !important;
  253. }
  254. .reportModel {
  255. margin-left: 10px;
  256. }
  257. .operation {
  258. margin-left: 30px;
  259. }
  260. .creator {
  261. display: inline-block;
  262. font-size:16px;
  263. font-family:Microsoft Sans Serif;
  264. font-weight:400;
  265. line-height:22px;
  266. color:rgba(51,51,51,1);
  267. opacity:1;
  268. }
  269. .creatorList {
  270. display: inline-block;
  271. font-size:14px;
  272. font-family:Microsoft Sans Serif;
  273. font-weight:400;
  274. line-height: 2.8;
  275. color:rgba(51,51,51,1);
  276. opacity:1;
  277. }
  278. .deletreport {
  279. font-size:14px;
  280. text-align: center;
  281. margin: 30px 0;
  282. font-family:MicrosoftYaHei;
  283. color:rgba(51,59,74,1);
  284. opacity:1;
  285. }
  286. .report-dialog {
  287. >>>.el-dialog__header {
  288. padding: 20px 20px 10px;
  289. border-bottom: 1px solid rgba(238,238,238,1);
  290. opacity:1;
  291. }
  292. >>>.el-dialog__footer {
  293. padding: 15px 20px;
  294. text-align: right;
  295. border-top: 1px solid rgba(238,238,238,1);
  296. opacity:1;
  297. }
  298. }
  299. .report-return {
  300. font-size: 18px;
  301. position: absolute;
  302. top: 23px;
  303. left: 11px;
  304. }
  305. .report-steps {
  306. margin-bottom: 20px;
  307. font-size:16px;
  308. font-family:PingFang SC;
  309. font-weight:500;
  310. line-height:22px;
  311. color:rgba(51,51,51,1);
  312. opacity:1;
  313. }
  314. .daily {
  315. max-height: 460px;
  316. overflow:scroll;
  317. overflow-x: hidden
  318. }
  319. .blur-column {
  320. width:4px;
  321. height:15px;
  322. display:inline-block;
  323. vertical-align: middle;
  324. background:#409EFF;
  325. border-radius:1px;
  326. }
  327. </style>