代码生成预览新增复制
This commit is contained in:
parent
7b1bbc2ea1
commit
57f5437920
@ -1,9 +1,11 @@
|
|||||||
import hasRole from './hasRole'
|
import hasRole from './hasRole'
|
||||||
import hasPermi from './hasPermi'
|
import hasPermi from './hasPermi'
|
||||||
|
import clipboard from '../module/clipboard'
|
||||||
|
|
||||||
const install = function(Vue) {
|
const install = function(Vue) {
|
||||||
Vue.directive('hasRole', hasRole)
|
Vue.directive('hasRole', hasRole)
|
||||||
Vue.directive('hasPermi', hasPermi)
|
Vue.directive('hasPermi', hasPermi)
|
||||||
|
Vue.directive('clipboard', clipboard)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window.Vue) {
|
if (window.Vue) {
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" @click="handleSearch()">查询</el-button>
|
<el-button type="primary" @click="handleSearch()">查询</el-button>
|
||||||
<el-button type="default" icon="el-icon-refresh" size="small" @click="loadTableData()">刷新</el-button>
|
<!-- <el-button type="default" icon="el-icon-refresh" size="small" @click="loadTableData()">刷新</el-button> -->
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
@ -28,6 +28,7 @@
|
|||||||
<span>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span>
|
<span>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column prop="tableId" label="表id" width="80"/>
|
||||||
<el-table-column prop="tableName" label="表名" sortable="custom" width="180" />
|
<el-table-column prop="tableName" label="表名" sortable="custom" width="180" />
|
||||||
<el-table-column prop="tableComment" label="表描述" :show-overflow-tooltip="true" />
|
<el-table-column prop="tableComment" label="表描述" :show-overflow-tooltip="true" />
|
||||||
<el-table-column prop="className" label="实体" />
|
<el-table-column prop="className" label="实体" />
|
||||||
@ -50,8 +51,8 @@
|
|||||||
<el-dialog :title="preview.title" :visible.sync="preview.open" width="80%" top="5vh" append-to-body>
|
<el-dialog :title="preview.title" :visible.sync="preview.open" width="80%" top="5vh" append-to-body>
|
||||||
<el-tabs v-model="preview.activeName">
|
<el-tabs v-model="preview.activeName">
|
||||||
<el-tab-pane v-for="(item, key) in preview.data" :label="item.title" :name="key.toString()" :key="key">
|
<el-tab-pane v-for="(item, key) in preview.data" :label="item.title" :name="key.toString()" :key="key">
|
||||||
<pre v-html="highlightedCode(item.content)">
|
<el-link :underline="false" icon="el-icon-document-copy" v-clipboard:copy="item.content" v-clipboard:success="clipboardSuccess" style="float:right">复制</el-link>
|
||||||
</pre>
|
<pre><code class="hljs" v-html="highlightedCode(item.content, item.title)"></code></pre>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
@ -91,7 +92,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import {
|
import {
|
||||||
codeGenerator,
|
codeGenerator,
|
||||||
getGenTable,
|
listTable,
|
||||||
delTable,
|
delTable,
|
||||||
previewTable,
|
previewTable,
|
||||||
} from "@/api/tool/gen";
|
} from "@/api/tool/gen";
|
||||||
@ -150,7 +151,7 @@ export default {
|
|||||||
handleSearch() {
|
handleSearch() {
|
||||||
this.tableloading = true;
|
this.tableloading = true;
|
||||||
|
|
||||||
getGenTable(this.queryParams).then((res) => {
|
listTable(this.queryParams).then((res) => {
|
||||||
this.tableData = res.data.result;
|
this.tableData = res.data.result;
|
||||||
this.total = res.data.totalNum;
|
this.total = res.data.totalNum;
|
||||||
this.tableloading = false;
|
this.tableloading = false;
|
||||||
@ -274,6 +275,11 @@ export default {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
/** 复制代码成功 */
|
||||||
|
clipboardSuccess(){
|
||||||
|
this.msgSuccess("复制成功");
|
||||||
|
},
|
||||||
|
// 多选框选中数据
|
||||||
handleSelectionChange(section) {
|
handleSelectionChange(section) {
|
||||||
this.tableIds = section.map((item) => item.tableId);
|
this.tableIds = section.map((item) => item.tableId);
|
||||||
this.multiple = !section.length;
|
this.multiple = !section.length;
|
||||||
@ -281,7 +287,7 @@ export default {
|
|||||||
},
|
},
|
||||||
/** 高亮显示 */
|
/** 高亮显示 */
|
||||||
highlightedCode(code, key) {
|
highlightedCode(code, key) {
|
||||||
// var language = vmName.substring(vmName.indexOf(".") + 1, vmName.length);
|
// var language = key.substring(key.lastIndexOf(".") , key.length)
|
||||||
const result = hljs.highlightAuto(code || "");
|
const result = hljs.highlightAuto(code || "");
|
||||||
return result.value || " ";
|
return result.value || " ";
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user