|
@@ -1,51 +1,182 @@
|
|
<template>
|
|
<template>
|
|
<div class="pa-3">
|
|
<div class="pa-3">
|
|
|
|
+ <div class="pa-3 text-right">
|
|
|
|
+ <v-btn color="primary" rounded class="buttons" @click="onShow">查看方案</v-btn>
|
|
|
|
+ </div>
|
|
|
|
+ <v-card
|
|
|
|
+ class="mb-3"
|
|
|
|
+ v-if="showCard"
|
|
|
|
+ >
|
|
|
|
+ <v-card-title>方案明细 [ {{ itemData.title }} ]</v-card-title>
|
|
|
|
+ <v-card-text>
|
|
|
|
+ <v-tabs v-model="active">
|
|
|
|
+ <v-tab
|
|
|
|
+ v-for="rules in rulesItems"
|
|
|
|
+ :key="rules.category"
|
|
|
|
+ >
|
|
|
|
+ {{ rules.category }}
|
|
|
|
+ </v-tab>
|
|
|
|
+ </v-tabs>
|
|
|
|
+ <v-tabs-items v-model="active" style="min-height: 500px;">
|
|
|
|
+ <v-tab-item
|
|
|
|
+ v-for="rules in rulesItems"
|
|
|
|
+ :key="rules.category"
|
|
|
|
+ >
|
|
|
|
+ <div class="pa-3">
|
|
|
|
+ <v-banner>参数列表</v-banner>
|
|
|
|
+ <v-list>
|
|
|
|
+ <v-list-item-group color="primary">
|
|
|
|
+ <v-list-item
|
|
|
|
+ v-for="configurations in rules.calculateConfigurations"
|
|
|
|
+ :key="configurations.calculateConfigurationId"
|
|
|
|
+ @click="onSend(`${configurations.name} ${configurations.value}`)"
|
|
|
|
+ >
|
|
|
|
+ <v-list-item-content>
|
|
|
|
+ <v-list-item-title>{{ configurations.name }} {{ configurations.value }}</v-list-item-title>
|
|
|
|
+ </v-list-item-content>
|
|
|
|
+ </v-list-item>
|
|
|
|
+ </v-list-item-group>
|
|
|
|
+ </v-list>
|
|
|
|
+ <v-banner>计算公式</v-banner>
|
|
|
|
+ <v-treeview
|
|
|
|
+ activatable
|
|
|
|
+ color="primary"
|
|
|
|
+ item-key="uuid"
|
|
|
|
+ item-text="content"
|
|
|
|
+ :items="rules.calculateFormulas"
|
|
|
|
+ return-object
|
|
|
|
+ @update:active="onSendTree"
|
|
|
|
+ ></v-treeview>
|
|
|
|
+ </div>
|
|
|
|
+ </v-tab-item>
|
|
|
|
+ </v-tabs-items>
|
|
|
|
+ </v-card-text>
|
|
|
|
+ </v-card>
|
|
<div class="box d-flex flex-column">
|
|
<div class="box d-flex flex-column">
|
|
<v-textarea
|
|
<v-textarea
|
|
v-model="code"
|
|
v-model="code"
|
|
label="请输入执行代码"
|
|
label="请输入执行代码"
|
|
outlined
|
|
outlined
|
|
- rows="10"
|
|
|
|
|
|
+ rows="6"
|
|
dense
|
|
dense
|
|
></v-textarea>
|
|
></v-textarea>
|
|
- <v-btn
|
|
|
|
- class="buttons align-self-center"
|
|
|
|
- rounded
|
|
|
|
- color="primary"
|
|
|
|
- :loading="loading"
|
|
|
|
- @click="handleSubmit"
|
|
|
|
- >
|
|
|
|
- <v-icon left>mdi-cloud-upload-outline</v-icon>
|
|
|
|
- 提交
|
|
|
|
- </v-btn>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
+ <v-navigation-drawer
|
|
|
|
+ v-model="show"
|
|
|
|
+ width="500"
|
|
|
|
+ absolute
|
|
|
|
+ temporary
|
|
|
|
+ right
|
|
|
|
+ >
|
|
|
|
+ <v-banner class="mt-3">方案列表</v-banner>
|
|
|
|
+ <v-list>
|
|
|
|
+ <v-list-item-group color="primary">
|
|
|
|
+ <v-list-item
|
|
|
|
+ v-for="(item, i) in items"
|
|
|
|
+ :key="i"
|
|
|
|
+ @click="handleClick(item)"
|
|
|
|
+ >
|
|
|
|
+ <v-list-item-content>
|
|
|
|
+ <v-list-item-title>{{ item.title }}</v-list-item-title>
|
|
|
|
+ </v-list-item-content>
|
|
|
|
+ </v-list-item>
|
|
|
|
+ </v-list-item-group>
|
|
|
|
+ </v-list>
|
|
|
|
+ </v-navigation-drawer>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
-import { api } from '@/api/dataGovernance'
|
|
|
|
|
|
+import axios from 'axios'
|
|
|
|
+// import { api } from '@/api/dataGovernance'
|
|
export default {
|
|
export default {
|
|
name: 'execute-script',
|
|
name: 'execute-script',
|
|
data () {
|
|
data () {
|
|
return {
|
|
return {
|
|
- code: null,
|
|
|
|
- loading: false
|
|
|
|
|
|
+ active: 0,
|
|
|
|
+ show: false,
|
|
|
|
+ code: '',
|
|
|
|
+ loading: false,
|
|
|
|
+ items: [],
|
|
|
|
+ showCard: false,
|
|
|
|
+ itemData: {},
|
|
|
|
+ rulesItems: []
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
- async handleSubmit () {
|
|
|
|
- this.loading = true
|
|
|
|
|
|
+ onShow () {
|
|
|
|
+ this.show = true
|
|
|
|
+ this.getList()
|
|
|
|
+ },
|
|
|
|
+ onSend (e) {
|
|
|
|
+ console.log(e)
|
|
|
|
+ this.code += e
|
|
|
|
+ },
|
|
|
|
+ onSendTree (e) {
|
|
|
|
+ if (!e.length) {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ this.onSend(e[0].content)
|
|
|
|
+ },
|
|
|
|
+ async handleClick (e) {
|
|
|
|
+ this.show = false
|
|
|
|
+ this.showCard = true
|
|
|
|
+ this.itemData = e
|
|
try {
|
|
try {
|
|
- await api.savePythonCode({
|
|
|
|
- code: this.code
|
|
|
|
|
|
+ const { data } = await this.fetchData('/op/base/performance/solution/detail', {
|
|
|
|
+ performanceSolutionId: e.performanceSolutionId
|
|
})
|
|
})
|
|
- this.$snackbar.success('保存成功')
|
|
|
|
|
|
+ this.rulesItems = data.performanceSolutionDetailRespCategoryVos
|
|
|
|
+ this.active = 0
|
|
} catch (error) {
|
|
} catch (error) {
|
|
this.$snackbar.error(error)
|
|
this.$snackbar.error(error)
|
|
- } finally {
|
|
|
|
- this.loading = false
|
|
|
|
}
|
|
}
|
|
|
|
+ },
|
|
|
|
+ async getList () {
|
|
|
|
+ try {
|
|
|
|
+ const { data } = await this.fetchData('/op/base/performance/solution/page', {
|
|
|
|
+ page: {
|
|
|
|
+ size: 999,
|
|
|
|
+ current: 1
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ this.items = data.records.map(e => e.entity)
|
|
|
|
+ } catch (err) {
|
|
|
|
+ this.items = []
|
|
|
|
+ this.$snackbar.error(err)
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ fetchData (url, params) {
|
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
|
+ axios.post(url, params, { // 配置对象
|
|
|
|
+ headers: {
|
|
|
|
+ 'Content-Type': 'application/json'
|
|
|
|
+ },
|
|
|
|
+ timeout: 5000, // 超时时间(毫秒)
|
|
|
|
+ responseType: 'json' // 响应数据类型
|
|
|
|
+ }).then(res => {
|
|
|
|
+ const { data } = res
|
|
|
|
+ if (data.code !== 20000) {
|
|
|
|
+ reject(data.message)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ resolve(data)
|
|
|
|
+ }).catch(reject)
|
|
|
|
+ })
|
|
}
|
|
}
|
|
|
|
+ // async handleSubmit () {
|
|
|
|
+ // this.loading = true
|
|
|
|
+ // try {
|
|
|
|
+ // await api.savePythonCode({
|
|
|
|
+ // code: this.code
|
|
|
|
+ // })
|
|
|
|
+ // this.$snackbar.success('保存成功')
|
|
|
|
+ // } catch (error) {
|
|
|
|
+ // this.$snackbar.error(error)
|
|
|
|
+ // } finally {
|
|
|
|
+ // this.loading = false
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|