|
@@ -1,7 +1,9 @@
|
|
|
<template>
|
|
<template>
|
|
|
- <div class="d-flex fullscreen">
|
|
|
|
|
- <v-card style="width: 400px;" class="mr-3 fullHeight" v-loading="loading">
|
|
|
|
|
- <v-banner>方案列表</v-banner>
|
|
|
|
|
|
|
+ <div class="d-flex fullscreen" v-loading="loading">
|
|
|
|
|
+ <v-card style="width: 400px;" class="mr-3 fullHeight">
|
|
|
|
|
+ <v-banner single-line>
|
|
|
|
|
+ <div class="py-2 title">方案列表</div>
|
|
|
|
|
+ </v-banner>
|
|
|
<v-list>
|
|
<v-list>
|
|
|
<v-list-item
|
|
<v-list-item
|
|
|
v-for="item in items"
|
|
v-for="item in items"
|
|
@@ -25,27 +27,49 @@
|
|
|
<v-card class="width-auto">
|
|
<v-card class="width-auto">
|
|
|
<div class="pa-3 fullscreen">
|
|
<div class="pa-3 fullscreen">
|
|
|
<div class="fullscreen d-flex flex-column">
|
|
<div class="fullscreen d-flex flex-column">
|
|
|
- <v-card outlined class="height-auto">
|
|
|
|
|
|
|
+ <div class="mt-3 d-flex">
|
|
|
|
|
+
|
|
|
|
|
+ <v-text-field
|
|
|
|
|
+ outlined
|
|
|
|
|
+ dense
|
|
|
|
|
+ hide-details
|
|
|
|
|
+ label="请输入来源表 *"
|
|
|
|
|
+ v-model="changeObj.source_table"
|
|
|
|
|
+ placeholder="请输入来源表"
|
|
|
|
|
+ :rules="[v => !!v || '请输入来源表']"
|
|
|
|
|
+ ></v-text-field>
|
|
|
|
|
+ <v-text-field
|
|
|
|
|
+ class="ml-3"
|
|
|
|
|
+ outlined
|
|
|
|
|
+ dense
|
|
|
|
|
+ hide-details
|
|
|
|
|
+ label="请输入目标表 *"
|
|
|
|
|
+ v-model="changeObj.target_table"
|
|
|
|
|
+ placeholder="请输入目标表"
|
|
|
|
|
+ :rules="[v => !!v || '请输入目标表']">
|
|
|
|
|
+ </v-text-field>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <v-card outlined class="height-auto mt-3">
|
|
|
<Toolbar
|
|
<Toolbar
|
|
|
style="border-bottom: 1px solid #ccc"
|
|
style="border-bottom: 1px solid #ccc"
|
|
|
:editor="editor"
|
|
:editor="editor"
|
|
|
:defaultConfig="toolbarConfig"
|
|
:defaultConfig="toolbarConfig"
|
|
|
:mode="mode"
|
|
:mode="mode"
|
|
|
- >11</Toolbar>
|
|
|
|
|
|
|
+ ></Toolbar>
|
|
|
<Editor
|
|
<Editor
|
|
|
- style="overflow-y: hidden; height: calc(100% - 100px);"
|
|
|
|
|
- v-model="editorHtml"
|
|
|
|
|
|
|
+ style="overflow-y: hidden; height: calc(100% - 50px);"
|
|
|
|
|
+ v-model="changeObj.script_requirement"
|
|
|
:defaultConfig="editorConfig"
|
|
:defaultConfig="editorConfig"
|
|
|
:mode="mode"
|
|
:mode="mode"
|
|
|
@onCreated="onCreated"
|
|
@onCreated="onCreated"
|
|
|
/>
|
|
/>
|
|
|
- <div class="d-flex align-end justify-end pa-3">
|
|
|
|
|
- <v-btn color="primary">生成代码</v-btn>
|
|
|
|
|
- </div>
|
|
|
|
|
</v-card>
|
|
</v-card>
|
|
|
- <div class="mt-3">
|
|
|
|
|
|
|
+ <div class="d-flex align-end justify-end pa-3">
|
|
|
|
|
+ <v-btn color="primary" @click="onGenerating">生成代码</v-btn>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div>
|
|
|
<v-textarea
|
|
<v-textarea
|
|
|
- v-model="code"
|
|
|
|
|
|
|
+ v-model="changeObj.script_content"
|
|
|
outlined
|
|
outlined
|
|
|
hide-details
|
|
hide-details
|
|
|
label="请输入执行代码"
|
|
label="请输入执行代码"
|
|
@@ -56,9 +80,28 @@
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</v-card>
|
|
</v-card>
|
|
|
|
|
+ <v-card style="width: 400px;" class="ml-3 fullHeight d-flex flex-column">
|
|
|
|
|
+ <v-banner single-line>
|
|
|
|
|
+ <div class="py-2 title">基础信息</div>
|
|
|
|
|
+ <template #actions>
|
|
|
|
|
+ <v-btn
|
|
|
|
|
+ text
|
|
|
|
|
+ class="ml-3"
|
|
|
|
|
+ color="primary"
|
|
|
|
|
+ @click="handleSubmit"
|
|
|
|
|
+ >
|
|
|
|
|
+ <v-icon left>mdi-send-variant</v-icon>
|
|
|
|
|
+ 确认提交
|
|
|
|
|
+ </v-btn>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </v-banner>
|
|
|
|
|
+ <div class="pt-3 height-auto overflow-y-auto">
|
|
|
|
|
+ <EditBase ref="editBaseRefs"></EditBase>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </v-card>
|
|
|
<v-navigation-drawer
|
|
<v-navigation-drawer
|
|
|
v-model="drawer"
|
|
v-model="drawer"
|
|
|
- absolute
|
|
|
|
|
|
|
+ fixed
|
|
|
temporary
|
|
temporary
|
|
|
right
|
|
right
|
|
|
width="800"
|
|
width="800"
|
|
@@ -84,9 +127,11 @@
|
|
|
<div class="fullscreen overflow-y-auto">
|
|
<div class="fullscreen overflow-y-auto">
|
|
|
<v-tabs-items v-model="tab">
|
|
<v-tabs-items v-model="tab">
|
|
|
<v-tab-item>
|
|
<v-tab-item>
|
|
|
- <div v-html="ruleItem.calculateFormulas[0]?.content"></div>
|
|
|
|
|
|
|
+ <div class="text-right mb-3"><v-btn color="primary" @click="onUse">使用规则</v-btn></div>
|
|
|
|
|
+ <div v-html="ruleItem.calculateFormulas?.[0]?.content"></div>
|
|
|
</v-tab-item>
|
|
</v-tab-item>
|
|
|
<v-tab-item class="pa-3">
|
|
<v-tab-item class="pa-3">
|
|
|
|
|
+ <div class="text-right mb-3"><v-btn color="primary" @click="onUseParam">使用参数</v-btn></div>
|
|
|
<v-expansion-panels
|
|
<v-expansion-panels
|
|
|
v-model="panelActive"
|
|
v-model="panelActive"
|
|
|
multiple
|
|
multiple
|
|
@@ -150,15 +195,25 @@
|
|
|
import { Editor, Toolbar } from '@wangeditor/editor-for-vue'
|
|
import { Editor, Toolbar } from '@wangeditor/editor-for-vue'
|
|
|
import '@wangeditor/editor/dist/css/style.css'
|
|
import '@wangeditor/editor/dist/css/style.css'
|
|
|
// import NonePage from '@/components/Common/empty.vue'
|
|
// import NonePage from '@/components/Common/empty.vue'
|
|
|
|
|
+import EditBase from './editBase.vue'
|
|
|
import axios from 'axios'
|
|
import axios from 'axios'
|
|
|
|
|
+import {
|
|
|
|
|
+ api
|
|
|
|
|
+} from '@/api/dataGovernance'
|
|
|
export default {
|
|
export default {
|
|
|
name: 'editPage',
|
|
name: 'editPage',
|
|
|
- components: { Editor, Toolbar },
|
|
|
|
|
|
|
+ components: { Editor, Toolbar, EditBase },
|
|
|
|
|
+ props: {
|
|
|
|
|
+ itemData: {
|
|
|
|
|
+ type: Object,
|
|
|
|
|
+ default: () => ({})
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
data () {
|
|
data () {
|
|
|
return {
|
|
return {
|
|
|
drawer: false,
|
|
drawer: false,
|
|
|
editor: null,
|
|
editor: null,
|
|
|
- editorHtml: null,
|
|
|
|
|
|
|
+ // editorHtml: null,
|
|
|
toolbarConfig: {
|
|
toolbarConfig: {
|
|
|
toolbarKeys: [
|
|
toolbarKeys: [
|
|
|
'headerSelect',
|
|
'headerSelect',
|
|
@@ -170,8 +225,6 @@ export default {
|
|
|
},
|
|
},
|
|
|
editorConfig: { placeholder: '请输入内容...' },
|
|
editorConfig: { placeholder: '请输入内容...' },
|
|
|
mode: 'default', // or 'simple'
|
|
mode: 'default', // or 'simple'
|
|
|
-
|
|
|
|
|
- code: null,
|
|
|
|
|
loading: false,
|
|
loading: false,
|
|
|
items: [],
|
|
items: [],
|
|
|
rulesItems: [],
|
|
rulesItems: [],
|
|
@@ -179,7 +232,13 @@ export default {
|
|
|
tab: 0,
|
|
tab: 0,
|
|
|
panelActive: [],
|
|
panelActive: [],
|
|
|
clickItem: null,
|
|
clickItem: null,
|
|
|
- clickId: null
|
|
|
|
|
|
|
+ clickId: null,
|
|
|
|
|
+ changeObj: {
|
|
|
|
|
+ script_content: '',
|
|
|
|
|
+ script_requirement: '',
|
|
|
|
|
+ source_table: null,
|
|
|
|
|
+ target_table: null
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
computed: {
|
|
computed: {
|
|
@@ -193,8 +252,13 @@ export default {
|
|
|
return this.clickItem[this.active]
|
|
return this.clickItem[this.active]
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
- created () {
|
|
|
|
|
- this.init()
|
|
|
|
|
|
|
+ async created () {
|
|
|
|
|
+ this.loading = true
|
|
|
|
|
+ if (Object.keys(this.itemData).length) {
|
|
|
|
|
+ await this.getDetails()
|
|
|
|
|
+ }
|
|
|
|
|
+ await this.getList()
|
|
|
|
|
+ this.loading = false
|
|
|
},
|
|
},
|
|
|
beforeDestroy () {
|
|
beforeDestroy () {
|
|
|
const editor = this.editor
|
|
const editor = this.editor
|
|
@@ -205,9 +269,35 @@ export default {
|
|
|
onCreated (editor) {
|
|
onCreated (editor) {
|
|
|
this.editor = Object.seal(editor) // 一定要用 Object.seal() ,否则会报错
|
|
this.editor = Object.seal(editor) // 一定要用 Object.seal() ,否则会报错
|
|
|
},
|
|
},
|
|
|
- async init () {
|
|
|
|
|
|
|
+ onUse () {
|
|
|
|
|
+ this.changeObj.script_requirement += `\n${this.ruleItem.calculateFormulas?.[0]?.content}`
|
|
|
|
|
+ },
|
|
|
|
|
+ onUseParam () {
|
|
|
|
|
+ const str = this.ruleItem.calculateConfigurations.reduce((t, v) => {
|
|
|
|
|
+ return t + `<p>${v.name}=${v.value}</p>`
|
|
|
|
|
+ }, '\n')
|
|
|
|
|
+ this.changeObj.script_requirement += str
|
|
|
|
|
+ console.log(str)
|
|
|
|
|
+ },
|
|
|
|
|
+ // 详情
|
|
|
|
|
+ async getDetails () {
|
|
|
|
|
+ try {
|
|
|
|
|
+ const { data } = await api.getDataFlowDetails(this.itemData.id)
|
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
|
+ this.$refs.editBaseRefs.setValues(data)
|
|
|
|
|
+ })
|
|
|
|
|
+ this.changeObj = {
|
|
|
|
|
+ script_content: data.script_content,
|
|
|
|
|
+ script_requirement: data.script_requirement,
|
|
|
|
|
+ source_table: data.source_table,
|
|
|
|
|
+ target_table: data.target_table
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ this.$snackbar.error(error)
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ async getList () {
|
|
|
try {
|
|
try {
|
|
|
- this.loading = true
|
|
|
|
|
const { data } = await this.fetchData('/op/base/performance/solution/page', {
|
|
const { data } = await this.fetchData('/op/base/performance/solution/page', {
|
|
|
page: {
|
|
page: {
|
|
|
size: 999,
|
|
size: 999,
|
|
@@ -218,8 +308,6 @@ export default {
|
|
|
} catch (err) {
|
|
} catch (err) {
|
|
|
this.items = []
|
|
this.items = []
|
|
|
this.$snackbar.error(err)
|
|
this.$snackbar.error(err)
|
|
|
- } finally {
|
|
|
|
|
- this.loading = false
|
|
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
fetchData (url, params) {
|
|
fetchData (url, params) {
|
|
@@ -240,13 +328,84 @@ export default {
|
|
|
}).catch(reject)
|
|
}).catch(reject)
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
- async onClick (e) {
|
|
|
|
|
|
|
+ async onGenerating () {
|
|
|
|
|
+ // const text = this.editor.getText()
|
|
|
|
|
+ if (!this.changeObj.script_requirement) {
|
|
|
|
|
+ this.$snackbar.warning('请输入内容')
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!this.changeObj.source_table) {
|
|
|
|
|
+ this.$snackbar.warning('请先填写来源表')
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!this.changeObj.target_table) {
|
|
|
|
|
+ this.$snackbar.warning('请先填写目标表')
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ // if
|
|
|
this.loading = true
|
|
this.loading = true
|
|
|
try {
|
|
try {
|
|
|
|
|
+ const { data } = await api.getDataFlowScript({
|
|
|
|
|
+ request_data: this.changeObj.script_requirement,
|
|
|
|
|
+ input: this.changeObj.source_table,
|
|
|
|
|
+ output: this.changeObj.target_table
|
|
|
|
|
+ })
|
|
|
|
|
+ // this.changeObj.script_requirement = text
|
|
|
|
|
+ this.changeObj.script_content = data.script_content
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ this.$snackbar.error(error)
|
|
|
|
|
+ } finally {
|
|
|
|
|
+ this.loading = false
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ async handleSubmit () {
|
|
|
|
|
+ const params = this.$refs.editBaseRefs.getValue()
|
|
|
|
|
+ if (!params) {
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ const { script_content: scriptContent, source_table: sourceTable, target_table: targetTable } = this.changeObj
|
|
|
|
|
+ if (!scriptContent) {
|
|
|
|
|
+ this.$snackbar.warning('请先生成脚本')
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!sourceTable) {
|
|
|
|
|
+ this.$snackbar.warning('请先填写来源表')
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!targetTable) {
|
|
|
|
|
+ this.$snackbar.warning('请先填写目标表')
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ const query = {
|
|
|
|
|
+ ...params,
|
|
|
|
|
+ ...this.changeObj
|
|
|
|
|
+ }
|
|
|
|
|
+ const isEdit = Object.keys(this.itemData).length > 0
|
|
|
|
|
+ try {
|
|
|
|
|
+ if (isEdit) {
|
|
|
|
|
+ await api.updateDataFlow(this.itemData.id, query)
|
|
|
|
|
+ } else {
|
|
|
|
|
+ await api.addDataFlow(query)
|
|
|
|
|
+ }
|
|
|
|
|
+ this.$snackbar.success(isEdit ? '更新成功' : '新增成功')
|
|
|
|
|
+ this.$emit('success')
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ this.$snackbar.error(error)
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ async onClick (e) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ this.loading = true
|
|
|
const { data } = await this.fetchData('/op/base/performance/solution/detail', {
|
|
const { data } = await this.fetchData('/op/base/performance/solution/detail', {
|
|
|
performanceSolutionId: e.performanceSolutionId
|
|
performanceSolutionId: e.performanceSolutionId
|
|
|
})
|
|
})
|
|
|
this.clickId = data.entity.performanceSolutionId
|
|
this.clickId = data.entity.performanceSolutionId
|
|
|
|
|
+ if (!data.performanceSolutionDetailRespCategoryVos.length) {
|
|
|
|
|
+ this.loading = false
|
|
|
|
|
+ this.$snackbar.warning('该方案暂无数据')
|
|
|
|
|
+ this.drawer = false
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
this.clickItem = data.performanceSolutionDetailRespCategoryVos
|
|
this.clickItem = data.performanceSolutionDetailRespCategoryVos
|
|
|
this.drawer = true
|
|
this.drawer = true
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
@@ -260,6 +419,10 @@ export default {
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
|
|
|
+.title {
|
|
|
|
|
+ color: #1976D2;
|
|
|
|
|
+ font-weight: 600;
|
|
|
|
|
+}
|
|
|
.fullscreen {
|
|
.fullscreen {
|
|
|
height: 100%;
|
|
height: 100%;
|
|
|
width: 100%;
|
|
width: 100%;
|