DailyReport.vue 13 KB

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