mirror of https://gitee.com/xiaonuobase/snowy
webVue [代码生成]预览 views\gen\codeGenerate\indexCodePreview.vue
parent
c7e0309a4e
commit
0851eedc67
|
@ -55,15 +55,17 @@
|
||||||
</span>
|
</span>
|
||||||
<span slot="action" slot-scope="text, record">
|
<span slot="action" slot-scope="text, record">
|
||||||
<span v-if="record.generateType === '1'">
|
<span v-if="record.generateType === '1'">
|
||||||
<a v-if="hasPerm('codeGenerate:runDown')" @click="runDownCodeGenerate(record)">开始生成</a>
|
<a v-if="hasPerm('codeGenerate:runDown')" @click="runDownCodeGenerate(record)">生成</a>
|
||||||
</span>
|
</span>
|
||||||
<span v-else>
|
<span v-else>
|
||||||
<a-popconfirm v-if="hasPerm('codeGenerate:runLocal')" placement="topRight" title="确定生成代码到本项目?" @confirm="() => runLocalCodeGenerate(record)">
|
<a-popconfirm v-if="hasPerm('codeGenerate:runLocal')" placement="topRight" title="确定生成代码到本项目?" @confirm="() => runLocalCodeGenerate(record)">
|
||||||
<a>开始生成</a>
|
<a>生成</a>
|
||||||
</a-popconfirm>
|
</a-popconfirm>
|
||||||
</span>
|
</span>
|
||||||
<a-divider type="vertical" v-if="hasPerm('codeGenerate:config') & hasPerm('codeGenerate:runLocal') || hasPerm('codeGenerate:runDown') "/>
|
<a-divider type="vertical" v-if="hasPerm('codeGenerate:config') & hasPerm('codeGenerate:runLocal') || hasPerm('codeGenerate:runDown') "/>
|
||||||
<a v-if="hasPerm('codeGenerate:config')" @click="indexConfigOpen(record)">配置</a>
|
<a v-if="hasPerm('codeGenerate:config')" @click="indexConfigOpen(record)">配置</a>
|
||||||
|
<a-divider type="vertical" v-if="hasPerm('codeGenerate:config') & hasPerm('codeGenerate:runLocal') || hasPerm('codeGenerate:runDown') "/>
|
||||||
|
<a v-if="hasPerm('codeGenerate:config')" @click="indexCodePreviewOpen(record)">预览</a>
|
||||||
<a-divider type="vertical" v-if="hasPerm('codeGenerate:config') & hasPerm('codeGenerate:edit')"/>
|
<a-divider type="vertical" v-if="hasPerm('codeGenerate:config') & hasPerm('codeGenerate:edit')"/>
|
||||||
<a v-if="hasPerm('codeGenerate:edit')" @click="$refs.editForm.edit(record)">编辑</a>
|
<a v-if="hasPerm('codeGenerate:edit')" @click="$refs.editForm.edit(record)">编辑</a>
|
||||||
<a-divider type="vertical" v-if="hasPerm('codeGenerate:edit') & hasPerm('codeGenerate:delete')"/>
|
<a-divider type="vertical" v-if="hasPerm('codeGenerate:edit') & hasPerm('codeGenerate:delete')"/>
|
||||||
|
@ -77,6 +79,7 @@
|
||||||
</a-spin>
|
</a-spin>
|
||||||
</a-card>
|
</a-card>
|
||||||
<index-config ref="indexConfig" @ok="handleResetOpen" v-if="hasPerm('codeGenerate:config')"/>
|
<index-config ref="indexConfig" @ok="handleResetOpen" v-if="hasPerm('codeGenerate:config')"/>
|
||||||
|
<index-code-preview ref="indexCodePreview" @ok="handleResetOpen" v-if="hasPerm('codeGenerate:config')"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
@ -85,10 +88,12 @@
|
||||||
import addForm from './addForm'
|
import addForm from './addForm'
|
||||||
import editForm from './editForm'
|
import editForm from './editForm'
|
||||||
import indexConfig from './indexConfig'
|
import indexConfig from './indexConfig'
|
||||||
|
import indexCodePreview from './indexCodePreview'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
indexConfig,
|
indexConfig,
|
||||||
|
indexCodePreview,
|
||||||
STable,
|
STable,
|
||||||
Ellipsis,
|
Ellipsis,
|
||||||
addForm,
|
addForm,
|
||||||
|
@ -233,6 +238,13 @@
|
||||||
this.indexOpenShow = false
|
this.indexOpenShow = false
|
||||||
this.$refs.indexConfig.open(record)
|
this.$refs.indexConfig.open(record)
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* 打开预览界面
|
||||||
|
*/
|
||||||
|
indexCodePreviewOpen (record) {
|
||||||
|
this.indexOpenShow = false
|
||||||
|
this.$refs.indexCodePreview.open(record)
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* 详细配置界面返回
|
* 详细配置界面返回
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -0,0 +1,64 @@
|
||||||
|
<template>
|
||||||
|
<a-card :bordered="false" v-show="indexCodeViewShow">
|
||||||
|
<div class="table-operator">
|
||||||
|
<a-button class="but_item" type="dashed" @click="handleCancel" icon="rollback">返回</a-button>
|
||||||
|
</div>
|
||||||
|
<a-tabs v-model="activeKey" tab-position="left" hide-add type="card" >
|
||||||
|
<a-tab-pane v-for="pane in panes" :key="pane.key" :tab="pane.title" closable="closable" >
|
||||||
|
<div>
|
||||||
|
<a-button type="primary" class="but_item" @click="copyContentCode(pane.content)" icon="copy">复制代码</a-button>
|
||||||
|
</div>
|
||||||
|
<a-textarea v-model="pane.content" autosize="true" ref="inputText" />
|
||||||
|
</a-tab-pane>
|
||||||
|
</a-tabs>
|
||||||
|
</a-card>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import { codeGenerateRunFileContent } from '@/api/modular/gen/codeGenerateManage'
|
||||||
|
export default {
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
activeKey: 'null',
|
||||||
|
panes: [],
|
||||||
|
indexCodeViewShow: false,
|
||||||
|
tableLoading: false,
|
||||||
|
visible: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/**
|
||||||
|
* 打开界面
|
||||||
|
*/
|
||||||
|
open (data) {
|
||||||
|
this.indexCodeViewShow = true
|
||||||
|
this.tableLoading = true
|
||||||
|
codeGenerateRunFileContent(data).then((res) => {
|
||||||
|
if (res.success) {
|
||||||
|
let tabi = 1
|
||||||
|
this.loadData = res.data
|
||||||
|
this.loadData.forEach(item => {
|
||||||
|
this.panes.push({ title: item.fileName, content: item.fileContent, key: 'tab' + tabi++ })
|
||||||
|
this.code = item.fileContent
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.activeKey = this.panes[0].key
|
||||||
|
this.tableLoading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
copyContentCode (code) {
|
||||||
|
var input = document.createElement('textarea')
|
||||||
|
input.value = code
|
||||||
|
document.body.appendChild(input)
|
||||||
|
input.select()
|
||||||
|
document.execCommand('Copy')
|
||||||
|
document.body.removeChild(input)
|
||||||
|
},
|
||||||
|
handleCancel () {
|
||||||
|
this.$emit('ok')
|
||||||
|
this.loadData = []
|
||||||
|
this.panes = []
|
||||||
|
this.indexCodeViewShow = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
Loading…
Reference in New Issue