| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- <!--
- 作者:yangzhijie1488@163.com
- 时间:2017-12-12
- 描述:追踪日志
- -->
- <template>
- <div>
- <div v-for="items in traceComments" :key="items" class="media">
- <h4 class="media-heading">
- {{ items.createdName
- }}<a class="fa-pull-right" @click="edit(items)">编辑</a>
- </h4>
- <div class="media-body">
- <div>
- <div v-dompurify-html="items.content" />
- <br />
- {{ items.created }}
- </div>
- <div v-if="items.attachments != '' && items.attachments != undefined">
- <div
- v-for="item in split(items.attachments)"
- :key="item"
- @click="download(item)"
- >
- <a>{{ item }}</a>
- </div>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- var Common = require('../common/Common.js');
- var DownloadService = require('pc-component-v3').default.DownloadService;
- export default {
- components: {
- Common,
- DownloadService,
- },
- // props: ['traceId', 'trace'],
- props: {
- traceId: {
- type: String,
- default: null,
- },
- trace: {
- type: String,
- default: null,
- },
- },
- data: function () {
- return {
- traceComments: [],
- className: 'com.leanwo.prodog.trace.model.TraceComment',
- uuid: '',
- };
- },
- watch: {
- traceId: function (curVal, oldVal) {
- if (curVal != undefined) {
- this.getTraceComment();
- }
- },
- },
- mounted: function () {
- this.uuid = this.$route.params.uuid;
- if (this.traceId != undefined) {
- this.getTraceComment();
- }
- },
- methods: {
- /**
- * 根据追踪表Id获取评论
- * @author GuoZhiBo 20171201
- */
- getTraceComment: function () {
- var _self = this;
- $.ajax({
- url: Common.getApiURL('TraceCommentResource/queryTraceComment'),
- type: 'get',
- dataType: 'json',
- async: false,
- data: {
- traceId: _self.traceId,
- },
- beforeSend: function (request) {
- Common.addTokenToRequest(request);
- },
- success: function (data) {
- _self.traceComments = data;
- },
- error: function (XMLHttpRequest, textStatus, errorThrown) {
- Common.processException(XMLHttpRequest, textStatus, errorThrown);
- },
- });
- },
- /**
- * 将字符串以”,“进行分割成字符串
- * @author GuoZhiBo 20171201
- */
- split: function (items) {
- if (items != null && items != '') {
- return items.split(',');
- } else {
- return null;
- }
- },
- /**
- * 下载文件
- * @param {String} fileName 文件名
- * @return {void}
- */
- download: function (fileName) {
- var _self = this;
- DownloadService.fileDownload(_self.className, fileName);
- },
- /**
- * 获取图片地址
- * @param {String} item 图片名称
- * @return {String} 图片URL地址
- */
- getImageSrc: function (item) {
- var _self = this;
- if (item != undefined && item != null) {
- return Common.getImageSrc(
- 'com.leanwo.prodog.trace.model.TraceComment',
- item,
- );
- } else {
- return '';
- }
- },
- /**
- * 获取图片地址
- */
- getImageSrcName: function (imageName) {
- return Common.getImageSrc('com.leanwo.prodog.model.base.User', imageName);
- },
- /**
- * 打开评论界面进行评论
- * @author GuoZhiBo 20171201
- */
- edit: function (item) {
- this.$router.push('/trace/traceCommentEdit/' + item.id);
- },
- },
- };
- </script>
- <style>
- </style>
|