Commit e777e38a142e1f30db1ebe5107d3949a4ee84e8a

Authored by 谭毅彬
1 parent beb33c45

操作记录页面显示优化

Signed-off-by: TanYibin <5491541@qq.com>
ant-design-vue-jeecg/src/views/system/monitor/OperationLog.vue
... ... @@ -75,24 +75,17 @@
75 75 class="j-table-force-nowrap"
76 76 @change="handleTableChange">
77 77  
78   - <template slot="htmlSlot" slot-scope="text">
79   - <div v-html="text"></div>
80   - </template>
81   - <template slot="imgSlot" slot-scope="text">
82   - <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
83   - <img v-else :src="getImgView(text)" height="25px" alt=""
84   - style="max-width:80px;font-size: 12px;font-style: italic;"/>
85   - </template>
86   - <template slot="fileSlot" slot-scope="text">
87   - <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
88   - <a-button
89   - v-else
90   - :ghost="true"
91   - type="primary"
92   - icon="download"
93   - size="small"
94   - @click="downloadFile(text)">下载
95   - </a-button>
  78 + <template :slot="expandedRowRender" slot-scope="record">
  79 + <div style="margin: 0">
  80 + <div v-if="record.contentReturn">
  81 + <a-button @click="copyToClipboard(record.contentReturn)" type="link" icon="copy" style="vertical-align: revert;"></a-button>
  82 + <span style="vertical-align: initial; word-break:break-all; white-space:pre-wrap; overflow:hidden; color:#0066CC;">方法响应内容:{{ record.contentReturn }}</span>
  83 + </div>
  84 + <div v-if="record.contentException">
  85 + <a-button @click="copyToClipboard(record.contentException)" type="link" icon="copy" style="vertical-align: revert;"></a-button>
  86 + <span style="vertical-align: initial; word-break:break-all; white-space:pre-wrap; overflow:hidden; color:red">方法异常内容:{{ record.contentException }}</span>
  87 + </div>
  88 + </div>
96 89 </template>
97 90  
98 91 <span slot="action" slot-scope="text, record">
... ... @@ -113,6 +106,7 @@ import {mixinDevice} from &#39;@/utils/mixin&#39;
113 106 import {JeecgListMixin} from '@/mixins/JeecgListMixin'
114 107 import OperationLogModal from './modules/OperationLogModal'
115 108 import JEllipsis from "@comp/jeecg/JEllipsis"
  109 +import ClipboardJS from 'clipboard'
116 110  
117 111 export default {
118 112 name: 'OperationLogList',
... ... @@ -150,32 +144,19 @@ export default {
150 144 customRender: (t) => ellipsis1(t)
151 145 },
152 146 {
153   - title: '操作时间',
154   - align: "center",
155   - dataIndex: 'operationTime'
156   - },
157   - {
158   - title: '操作耗时',
159   - align: "center",
160   - dataIndex: 'operationCostTime'
161   - },
162   - {
163   - title: '操作人姓名',
  147 + title: '操作人',
164 148 align: "center",
165 149 dataIndex: 'operatorName'
166 150 },
167 151 {
168   - title: '操作结果状态',
  152 + title: '操作时间',
169 153 align: "center",
170   - dataIndex: 'operationStatus_dictText'
  154 + dataIndex: 'operationTime'
171 155 },
172 156 {
173   - title: '操作',
174   - dataIndex: 'action',
  157 + title: '操作耗时',
175 158 align: "center",
176   - fixed: "right",
177   - width: 80,
178   - scopedSlots: {customRender: 'action'}
  159 + dataIndex: 'operationCostTime'
179 160 }
180 161 ],
181 162 url: {
... ... @@ -188,17 +169,38 @@ export default {
188 169 },
189 170 dictOptions: {},
190 171 superFieldList: [],
  172 + expandedRowRender: undefined
191 173 }
192 174 },
193 175 created() {
194 176 this.getSuperFieldList();
195 177 },
  178 + mounted() {
  179 + this.expandedRowRender = "expandedRowRender";
  180 + },
196 181 computed: {
197 182 importExcelUrl: function () {
198 183 return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
199 184 },
200 185 },
201 186 methods: {
  187 + copyToClipboard(content) {
  188 + const clipboard = new ClipboardJS('.copy-button', {
  189 + text: () => content
  190 + });
  191 +
  192 + clipboard.on('success', () => {
  193 + clipboard.destroy();
  194 + this.$message.success('已复制到剪贴板');
  195 + });
  196 +
  197 + clipboard.on('error', () => {
  198 + clipboard.destroy();
  199 + this.$message.error('复制失败');
  200 + });
  201 +
  202 + clipboard.onClick(event); // 添加这一行来触发点击事件
  203 + },
202 204 getQueryParams() {
203 205 // 重写查询条件
204 206 let sqp = {}
... ...