|
@@ -179,6 +179,9 @@
|
|
></i>
|
|
></i>
|
|
|
|
|
|
<i
|
|
<i
|
|
|
|
+ v-clipboard:copy="scope.row.extractCode"
|
|
|
|
+ v-clipboard:success="copySuc"
|
|
|
|
+ v-clipboard:error="copyFail"
|
|
title="复制文本"
|
|
title="复制文本"
|
|
style="color: #00bf78"
|
|
style="color: #00bf78"
|
|
v-show="
|
|
v-show="
|
|
@@ -186,7 +189,7 @@
|
|
scope.row.extractCode != null &&
|
|
scope.row.extractCode != null &&
|
|
scope.row.extractCode != ''
|
|
scope.row.extractCode != ''
|
|
"
|
|
"
|
|
- @click="onCopy(scope.row)"
|
|
|
|
|
|
+
|
|
class="el-icon-copy-document"
|
|
class="el-icon-copy-document"
|
|
></i>
|
|
></i>
|
|
<i
|
|
<i
|
|
@@ -200,13 +203,16 @@
|
|
></i>
|
|
></i>
|
|
|
|
|
|
<i
|
|
<i
|
|
|
|
+ v-clipboard:copy="scope.row.extractCode"
|
|
|
|
+ v-clipboard:success="copySuc"
|
|
|
|
+ v-clipboard:error="copyFail"
|
|
title="复制文本"
|
|
title="复制文本"
|
|
v-show="
|
|
v-show="
|
|
!scope.row.isShow &&
|
|
!scope.row.isShow &&
|
|
scope.row.extractCode != null &&
|
|
scope.row.extractCode != null &&
|
|
scope.row.extractCode != ''
|
|
scope.row.extractCode != ''
|
|
"
|
|
"
|
|
- @click="onCopy(scope.row)"
|
|
|
|
|
|
+
|
|
class="el-icon-copy-document"
|
|
class="el-icon-copy-document"
|
|
></i>
|
|
></i>
|
|
</div>
|
|
</div>
|
|
@@ -476,10 +482,32 @@ export default {
|
|
this.searchTarget();
|
|
this.searchTarget();
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ copySuc(){
|
|
|
|
+ this.$message.success("复制成功")
|
|
|
|
+},
|
|
|
|
+
|
|
|
|
+copyFail(){
|
|
|
|
+ this.$message.success("复制失败")
|
|
|
|
+},
|
|
onCopy(row) {
|
|
onCopy(row) {
|
|
- navigator.clipboard.writeText(row.extractCode).then(() => {
|
|
|
|
- this.$message.success("复制成功");
|
|
|
|
- });
|
|
|
|
|
|
+ if (navigator.clipboard && window.isSecureContext) {
|
|
|
|
+ navigator.clipboard.writeText(row.extractCode).then(() => {
|
|
|
|
+ this.$message.success("复制成功");
|
|
|
|
+ });
|
|
|
|
+ }else {
|
|
|
|
+ const textArea = document.createElement('textarea')
|
|
|
|
+ textArea.value = val
|
|
|
|
+ // 使text area不在viewport,同时设置不可见
|
|
|
|
+ document.body.appendChild(textArea)
|
|
|
|
+ textArea.focus()
|
|
|
|
+ textArea.select()
|
|
|
|
+ this.$message.success('复制成功')
|
|
|
|
+ return new Promise((res, rej) => {
|
|
|
|
+ // 执行复制命令并移除文本框
|
|
|
|
+ document.execCommand('copy') ? res() : rej()
|
|
|
|
+ textArea.remove()
|
|
|
|
+ })
|
|
|
|
+ }
|
|
},
|
|
},
|
|
titleFormatter(val) {
|
|
titleFormatter(val) {
|
|
if (val.planStatus == "1") {
|
|
if (val.planStatus == "1") {
|