增加造数的页面

This commit is contained in:
qiaoxinjiu
2026-04-13 16:42:02 +08:00
commit 3c7f075544
48 changed files with 25781 additions and 0 deletions

View File

@@ -0,0 +1,398 @@
<template>
<el-tabs v-model="activeName">
<el-tab-pane label="菜单管理" name="first">
<keep-alive>
<div class="create-data">
<div class="search">
<el-form :inline="true" class="search" size="small" @submit.native.prevent>
<el-form-item label="业务线">
<el-select
v-model="team_name"
placeholder="请选择业务线"
style="width:160px"
clearable
@change="getTeamName(team_name)">
<el-option v-for="item in dict_data" :key="item.value" :value="item.value" :label="item.label"></el-option>
</el-select>
</el-form-item>
<el-form-item label="" labelWidth="110px">
<el-input v-model="keyword" placeholder="名称" clearable @change="search" @keyup.enter="search"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="search">搜索</el-button>
</el-form-item>
</el-form>
</div>
<div class="api-form">
<el-table ref="table" :data="tableData" :header-cell-style="{ textAlign: 'center' }" :stripe="true" :height="tableHeight" border>
<el-table-column label="业务线" prop="team_name"></el-table-column>
<el-table-column label="业务名称" prop="dict_key"></el-table-column>
<el-table-column label="对应名称" prop="dict_value"></el-table-column>
<el-table-column label="创建时间" prop="created_time">
<template slot-scope="props">
{{ formatTimeValue(props.row.created_time) }}
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="props">
<el-button type="primary" @click.native.prevent="addData(props.row)">修改</el-button>
</template>
</el-table-column>
</el-table>
<el-dialog
:title="dialog.title"
:visible="dialog.dialogVisible"
:close-on-click-modal="false"
width="40%"
@close="cancel">
<el-form :model="dialog.moduleForm" label-width="120px" class="demo-ruleForm">
<el-form-item label="业务名称:">
<span>{{ dialog.moduleForm.dict_key }}</span>
</el-form-item>
<el-form-item label="对应名称:">
<el-input v-model="dialog.moduleForm.dict_value"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click.native.prevent="cancel">取消</el-button>
<el-button type="primary" @click.native.prevent="submit">确定</el-button>
</span>
</el-dialog>
</div>
<div class="block">
<el-pagination
:current-page="pageNo"
:page-size="10"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange">
</el-pagination>
</div>
</div>
</keep-alive>
</el-tab-pane>
<el-tab-pane label="数据管理" name="second">
<div class="search">
<el-form :inline="true" class="search" size="small" @submit.native.prevent>
<el-form-item label="业务线">
<el-select
v-model="manage_team_name"
placeholder="请选择业务线"
style="width:160px"
clearable
@change="manageGetFileName(manage_team_name)">
<el-option v-for="item in dict_data" :key="item.value" :value="item.value" :label="item.label"></el-option>
</el-select>
</el-form-item>
<el-form-item label="业务系统">
<el-select v-model="file_name" placeholder="请选择" style="width:160px" clearable>
<el-option v-for="item in dict_file_data" :key="item.value" :value="item.value" :label="item.label"></el-option>
</el-select>
</el-form-item>
<el-form-item label="" labelWidth="110px">
<el-input v-model="detail_name" placeholder="场景名称" clearable @change="manageSearch" @keyup.enter="manageSearch"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="manageSearch">搜索</el-button>
<el-button type="primary" @click.native.prevent="managePullGit">更新关键字</el-button>
</el-form-item>
</el-form>
</div>
<el-table ref="table" :data="manage_tableData" :header-cell-style="{ textAlign: 'center' }" :stripe="true" :height="tableHeight" border>
<el-table-column label="场景名称" prop="method_function_detail"></el-table-column>
<el-table-column label="业务系统" prop="file_name"></el-table-column>
<el-table-column label="业务线" prop="team_name"></el-table-column>
<el-table-column label="负责人" prop="creator"></el-table-column>
<el-table-column label="操作" align="center">
<template slot-scope="props">
<el-button type="text" class="delete_button" @click.native.prevent="manageHandleDelete(props.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-dialog
:title="pullmaster.title"
:visible="pullmaster.dialogVisible"
:close-on-click-modal="false"
width="30%"
@close="manageGitCancel">
<el-form :model="pullmaster.moduleForm" label-width="60px" class="demo-ruleForm">
<el-form-item label="业务线:" label-suffix="*">
<el-select v-model="pullmaster.moduleForm.team" placeholder="请选择">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click.native.prevent="manageGitCancel">取消</el-button>
<el-button type="primary" @click.native.prevent="manageGitSubmit">确定</el-button>
</span>
</el-dialog>
<div class="block">
<el-pagination
:current-page="manage_pageNo"
:page-size="10"
:total="manage_total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="manageHandleSizeChange"
@current-change="manageHandleCurrentChange">
</el-pagination>
</div>
</el-tab-pane>
</el-tabs>
</template>
<script>
import { DataDelete, DictAdd, DictQuery, GetTeam, InfoQuery, ScrapyDetail, getGitPull } from '@/api/CreateDtapi'
import { formatTime } from '@/utils/util'
const defaultDialogForm = () => ({
team_name: '',
data_type: '',
dict_key: '',
dict_value: ''
})
const defaultPullForm = () => ({
team: '',
fileName: '',
username: '',
password: ''
})
export default {
name: 'CreateManage',
data() {
return {
activeName: 'first',
tableHeight: null,
keyword: '',
total: 0,
team_name: '',
tableData: [],
pageNo: 1,
pageSize: 10,
dialog: {
title: '编辑',
dialogVisible: false,
moduleForm: defaultDialogForm()
},
manage_tableData: [],
manage_total: 0,
manage_pageNo: 1,
manage_pageSize: 10,
loading: false,
get_team: '',
manage_team_name: '',
file_name: '',
detail_name: '',
module_name: '',
dict_data: {},
dict_file_data: {},
options: [
{ value: 'CC', label: '销售' },
{ value: 'PBE', label: '公共基础' },
{ value: 'TO', label: '教师' },
{ value: 'TMO', label: '教务' },
{ value: 'USER', label: '用户组' }
],
pullmaster: {
title: '编辑',
dialogVisible: false,
moduleForm: defaultPullForm()
}
}
},
methods: {
formatTimeValue(str) {
return str ? formatTime(str) : ''
},
handleSizeChange(val) {
this.pageSize = val
this.search()
},
handleCurrentChange(val) {
this.pageNo = val
this.search(true)
},
dataList(data) {
DictQuery(data).then(data => {
this.tableData = data.data
this.total = data.totalCount
})
},
getTeamName(team) {
this.pageNo = 1
GetTeam({ data_type: 2, team_name: team }).then(data => {
if (data.code === 200) {
this.dict_data = data.data
}
})
},
search(keepPage) {
if (!keepPage) {
this.pageNo = 1
}
this.dataList({
pageNo: this.pageNo,
pageSize: this.pageSize,
keyword: this.keyword,
team_name: this.team_name
})
},
addData(row) {
this.dialog.dialogVisible = true
this.dialog.title = '修改业务对应展示名称'
this.dialog.moduleForm = { ...row }
},
cancel() {
this.dialog = {
title: '编辑',
dialogVisible: false,
moduleForm: defaultDialogForm()
}
},
submit() {
if (!this.dialog.moduleForm.dict_value) {
this.$message({ type: 'info', message: '请输入名称' })
return
}
DictAdd(this.dialog.moduleForm).then(data => {
if (data.code === 200) {
this.$message({ type: 'success', message: '修改成功!' })
this.cancel()
this.search()
}
})
},
manageHandleSizeChange(val) {
this.manage_pageSize = val
this.manageSearch()
},
manageHandleCurrentChange(val) {
this.manage_pageNo = val
this.manageSearch(true)
},
manageDataList(data) {
InfoQuery(data).then(data => {
this.manage_tableData = data.data
this.manage_total = data.totalCount
})
},
manageSearch(keepPage) {
if (!keepPage) {
this.manage_pageNo = 1
}
this.manageDataList({
pageNo: this.manage_pageNo,
pageSize: this.manage_pageSize,
detail_name: this.detail_name,
team_name: this.manage_team_name,
file_name: this.file_name,
module_name: this.module_name
})
},
manageHandleDelete(row) {
this.$confirm('是否删除该数据?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
DataDelete({ create_data_detail_id: row.create_data_detail_id }).then(data => {
if (data.code === 200) {
this.$message({ type: 'success', message: '删除成功!' })
this.manageSearch()
}
})
})
},
managePullGit() {
this.pullmaster.dialogVisible = true
this.pullmaster.title = '更新关键字'
},
manageGitCancel() {
this.pullmaster = {
title: '编辑',
dialogVisible: false,
moduleForm: defaultPullForm()
}
},
manageSubmit(team) {
this.pullmaster.moduleForm.team = team
ScrapyDetail(this.pullmaster.moduleForm).then(data => {
this.loading = false
if (data.code === 200) {
this.$message({ type: 'success', message: '更新关键字成功!' })
this.pullmaster.moduleForm = defaultPullForm()
this.manageSearch()
} else {
this.$message({ type: 'error', message: data.message })
}
})
},
loadingShow() {
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
})
setTimeout(() => {
loading.close()
this.pullmaster.dialogVisible = false
this.search()
}, 10000)
},
manageGitSubmit() {
this.loadingShow()
this.get_team = this.pullmaster.moduleForm.team
if (!this.pullmaster.moduleForm.team) {
this.$message({ type: 'info', message: '请输入组名' })
return
}
getGitPull(this.pullmaster.moduleForm).then(data => {
if (data.code === 200) {
this.manageSubmit(this.get_team)
}
})
},
manageGetTeamName(manageTeam) {
this.manage_pageNo = 1
GetTeam({ data_type: 2, team_name: manageTeam }).then(data => {
if (data.code === 200) {
this.dict_data = data.data
}
})
},
manageGetFileName(manageTeam) {
this.manage_pageNo = 1
GetTeam({ data_type: 3, team_name: manageTeam }).then(data => {
if (data.code === 200) {
this.dict_file_data = data.data
}
})
}
},
created() {
this.dataList({ pageNo: 1, pageSize: 10, keyword: '', team_name: '' })
this.manageDataList({ pageNo: 1, pageSize: 10, detail_name: '', team_name: '', file_name: '', module_name: '' })
this.tableHeight = document.getElementById('app').clientHeight - 250
this.getTeamName('')
this.manageGetTeamName('')
}
}
</script>
<style scoped>
.data {
padding-left: 100px;
}
.delete_button {
color: #cf9236;
}
</style>

View File

@@ -0,0 +1,146 @@
<template>
<div class="create-data-info">
<el-card shadow="never">
<div slot="header" class="clearfix">
<span>{{ pageTitle }}</span>
</div>
<el-form v-loading="loading" ref="form" :model="form" :rules="rules" label-width="120px" size="small">
<el-form-item label="项目名称" prop="project">
<el-select v-model="form.project" placeholder="请选择项目" clearable style="width: 320px;">
<el-option
v-for="item in projectOptions"
:key="item"
:label="item"
:value="item">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="运行环境" prop="runEnv">
<el-input v-model="form.runEnv" placeholder="请输入运行环境" style="width: 320px;"></el-input>
</el-form-item>
<el-form-item label="运行分组" prop="runGroup">
<el-input v-model="form.runGroup" placeholder="请输入运行分组" style="width: 320px;"></el-input>
</el-form-item>
<el-form-item label="sql语句" prop="sql">
<el-input
v-model="form.sql"
type="textarea"
:rows="8"
placeholder="请输入 sql 语句">
</el-input>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input
v-model="form.remark"
type="textarea"
:rows="4"
placeholder="请输入备注">
</el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" :loading="saving" @click="submitForm">保存</el-button>
<el-button @click="goBack">返回</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</template>
<script>
import {ItApiCreate, ItApiDetail} from '@/api/CreateDtapi'
export default {
name: 'CreateDataInfo',
data() {
return {
saving: false,
loading: false,
projectOptions: ['ZHYY', 'DLZ', 'JOYHUB', 'OA', 'APP'],
form: {
project: '',
runEnv: '',
sql: '',
remark: '',
sqlId: '',
runGroup: ''
},
rules: {
project: [{required: true, message: '请选择项目名称', trigger: 'change'}],
runEnv: [{required: true, message: '请输入运行环境', trigger: 'blur'}],
sql: [{required: true, message: '请输入sql语句', trigger: 'blur'}],
runGroup: [{required: true, message: '请输入运行分组', trigger: 'blur'}]
}
}
},
computed: {
pageTitle() {
return this.form.sqlId ? '修改造数任务' : '新增造数任务'
}
},
methods: {
initForm() {
const query = this.$route.query || {}
this.form = {
project: '',
runEnv: '',
sql: '',
remark: '',
sqlId: query.sqlId || query.id || query.create_data_detail_id || '',
runGroup: ''
}
if (this.form.sqlId) {
this.getDetail()
}
},
getDetail() {
this.loading = true
ItApiDetail({sqlId: this.form.sqlId}).then(res => {
const data = res && res.data ? res.data : {}
this.form = {
...this.form,
project: data.project || '',
runEnv: data.runEnv || data.run_env || '',
sql: data.sql || '',
remark: data.remark || '',
sqlId: data.sqlId || data.sql_id || data.id || data.create_data_detail_id || this.form.sqlId,
runGroup: data.runGroup || data.run_group || ''
}
}).catch(err => {
this.$message({type: 'error', message: (err && err.message) || '详情获取失败'})
}).finally(() => {
this.loading = false
})
},
submitForm() {
this.$refs.form.validate(valid => {
if (!valid) {
return false
}
this.saving = true
ItApiCreate(this.form).then(res => {
if (res && res.success === true) {
this.$message({type: 'success', message: this.form.sqlId ? '修改成功' : '新增成功'})
this.$router.push({path: '/create/data'})
} else {
this.$message({type: 'error', message: res.message || '保存失败'})
}
}).finally(() => {
this.saving = false
})
})
},
goBack() {
this.$router.push({path: '/create/data'})
}
},
created() {
this.initForm()
}
}
</script>
<style scoped>
.create-data-info {
padding: 20px;
}
</style>

View File

@@ -0,0 +1,525 @@
<template>
<el-tabs v-model="activeName">
<el-tab-pane label="菜单管理" name="first">
<keep-alive>
<div class="create-data">
<div class="search">
<el-form :inline="true" class="search" size="small" @submit.native.prevent>
<el-form-item label="业务线">
<el-select
v-model="team_name"
placeholder="请选择业务线" @change="get_file_name(team_name)"
style="width:160px"
clearable>
<el-option v-for="item in dict_data" :key="item.value" :value="item.value"
:label="item.label"></el-option>
</el-select>
</el-form-item>
<el-form-item label="" labelWidth="110px">
<el-input placeholder="名称" v-model="keyword" clearable @change="search" @keyup.enter="search">
</el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="search" @keyup.enter="search">搜索</el-button>
</el-form-item>
</el-form>
</div>
<div class="api-form">
<el-table ref="table" :data="tableData" :header-cell-style="{textAlign: 'center'}" :stripe="true" :height="tableHeight" border>
<el-table-column label="业务线" prop="team_name"></el-table-column>
<el-table-column label="业务名称" prop="dict_key"></el-table-column>
<el-table-column label="对应名称" prop="dict_value"></el-table-column>
<el-table-column label="创建时间" prop="created_time">
<template slot-scope="props">
{{ formatTime(props.row.created_time) }}
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="props">
<el-button type="primary" @click.native.prevent="addData(props.row)" style="right: 0">修改</el-button>
</template>
</el-table-column>
</el-table>
<el-dialog
:title="dialog.title"
:visible="dialog.dialogVisible"
:close-on-click-modal="false"
width="40%"
@close="cancel()">
<el-form :model="dialog.moduleForm" ref="dialog.moduleForm" :rules="rules" label-width="120px"
class="demo-ruleForm">
<el-form-item label="业务名称:" prop="module_name">
<span>{{ dialog.moduleForm.dict_key }}</span>
</el-form-item>
<el-form-item label="对应名称:" prop="class_name">
<el-input v-model="dialog.moduleForm.dict_value">{{ dialog.moduleForm.dict_value }}</el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click.native.prevent="cancel()">取消</el-button>
<el-button type="primary" @click.native.prevent="submit">确定</el-button>
</span>
</el-dialog>
</div>
<div class="block">
<span class="demonstration"></span>
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="pageNo"
:page-size="10"
layout="total, sizes, prev, pager, next, jumper"
:total="total">
</el-pagination>
</div>
</div>
</keep-alive>
</el-tab-pane>
<el-tab-pane label="数据管理" name="second">
<div class="search">
<el-form :inline="true" class="search" size="small" @submit.native.prevent>
<el-form-item label="业务线">
<el-select
v-model="manage_team_name"
placeholder="请选择业务线" @change="manage_get_file_name(manage_team_name)"
style="width:160px"
clearable>
<el-option v-for="item in dict_data" :key="item.value" :value="item.value"
:label="item.label"></el-option>
</el-select>
</el-form-item>
<el-form-item label="业务系统">
<el-select
v-model="file_name"
placeholder="请选择"
style="width:160px"
clearable>
<el-option v-for="item in dict_file_data" :key="item.value" :value="item.value"
:label="item.label"></el-option>
</el-select>
</el-form-item>
<el-form-item label="" labelWidth="110px">
<el-input placeholder="场景名称" v-model="detail_name" clearable @change="manage_search()"
@keyup.enter="manage_search()">
</el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="manage_search" @keyup.enter="manage_search">搜索</el-button>
<el-button type="primary" @click.native.prevent="manage_pullGit" style="right: 0">更新关键字</el-button>
</el-form-item>
</el-form>
</div>
<el-table ref="table" :data="manage_tableData" :header-cell-style="{textAlign: 'center'}" :stripe="true" :height="tableHeight" border>
<el-table-column label="场景名称" prop="method_function_detail"></el-table-column>
<el-table-column label="业务系统" prop="file_name"></el-table-column>
<el-table-column label="业务线" prop="team_name"></el-table-column>
<el-table-column label="负责人" prop="creator"></el-table-column>
<el-table-column label="操作" align="center">
<template slot-scope="props" >
<el-button type="text" class="delete_button" @click.native.prevent="manage_handleDelete(props.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
<el-dialog
:title="pullmaster.title"
:visible="pullmaster.dialogVisible"
:close-on-click-modal="false"
width="30%"
@close="manage_gitcancel()"
>
<el-form :model="pullmaster.moduleForm" ref="dialog.scrapy" :rules="rules" label-width="60px"
class="demo-ruleForm">
<el-form-item label="业务线:" prop="baseOrUbrd" label-suffix="*">
<el-select v-model="pullmaster.moduleForm.team" placeholder="请选择">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click.native.prevent="manage_gitcancel()">取消</el-button>
<el-button type="primary" @click.native.prevent="manage_gitsubmit()">确定</el-button>
</span>
</el-dialog>
<div class="block">
<span class="demonstration"></span>
<el-pagination
@size-change="manage_handleSizeChange"
@current-change="manage_handleCurrentChange"
:current-page="manage_pageNo"
:page-size="10"
layout="total, sizes, prev, pager, next, jumper"
:total="manage_total">
</el-pagination>
</div>
</el-tab-pane>
</el-tabs>
</template>
<script>
import {DictAdd, DictQuery, GetTeam} from '@/api/CreateDtapi'
import {
DataAdd,
DataDelete,
DataAdvance,
InfoQuery,
ScrapyDetail,
getEureka,
getGitPull
} from '@/api/CreateDtapi'
import {formatTime} from '@/utils/util'
// import CreateData from '@/components/User/EditPassword'
export default {
name: "CreateManage",
// components: {CreateData},
data() {
return {
roles: [
{
value: 1,
label: '初始路径'
}, {
value: 2,
label: '描述简称'
}
],
activeName: 'first',
tableHeight: null,
keyword: '',
currentPage1: 0,
total: 0,
team_name: '',
tableData: [],
pageNo: 1,
pageSize: 10,
create_dict_data_id: '',
drawer: false,
dialog: {
title: "编辑",
dialogVisible: false,
moduleForm: {
team_name: '',
data_type: '',
dict_key: '',
dict_value: '',
},
},
manage_tableData: [],
manage_total: 0,
manage_pageNo: 1,
manage_pageSize: 10,
loading: false,
get_team: '',
manage_team_name: '',
initial_team_name: '',
file_name: '',
detail_name: '',
module_name: '',
create_data_detail_id: "",
manage_drawer: false,
onfocus_create_data_info_id: '',
dict_data: {},
dict_file_data: {},
options: [{
value: 'CC',
label: '销售'
}, {
value: 'PBE',
label: '公共基础'
}, {
value: 'TO',
label: '教师'
}, {
value: 'TMO',
label: '教务'
}, {
value: 'USER',
label: '用户组'
}],
scrapy: {
title: "编辑",
dialogVisible: false,
moduleForm: {
fileName: '',
team: ''
}
},
pullmaster: {
title: "编辑",
dialogVisible: false,
moduleForm: {
team: '',
fileName: '',
username: '',
password: ''
}
},
}
},
methods: {
formatTime(str) {
if (str === undefined || str === null) {
return ''
} else {
return formatTime(str)
}
},
handleSizeChange(val) {
this.pageSize = val;
this.search()
},
handleCurrentChange(val) {
this.pageNo = val;
this.search(true)
},
dataList(data) {
DictQuery(data).then(data => {
this.tableData = data.data;
this.total = data.totalCount
})
},
get_team_name(team) {
let request_data = {"data_type": 2, "team_name": team}
this.pageNo = 1
GetTeam(request_data).then((data) => {
if (data.code === 200) {
this.dict_data = data.data
}
})
},
search(val) {
if (!val) {
this.pageNo = 1
}
let data = {
pageNo: this.pageNo,
pageSize: this.pageSize,
keyword: this.keyword,
team_name: this.team_name
};
this.dataList(data)
},
openDrawer(row) {
this.drawer = true
this.onfocus_create_data_info_id = row.create_data_info_id
},
closeDrwaer() {
this.drawer = false
},
addData(row) {
this.dialog.dialogVisible = true;
this.dialog.title = "修改业务对应展示名称"
this.dialog.moduleForm = row
},
cancel() {
this.dialog.dialogVisible = false;
this.dialog = {
title: "编辑",
dialogVisible: false,
moduleForm: {
data_type: '',
team_name: '',
dict_key: '',
dict_value: '',
},
}
},
submit() {
// if (this.dialog.moduleForm.dict_key !== '' && this.dialog.moduleForm.dict_value !== '' && this.dialog.moduleForm.data_type !== '') {
if (this.dialog.moduleForm.dict_value !== '') {
console.log(this.dialog.moduleForm, "$$$$")
DictAdd(this.dialog.moduleForm).then((data) => {
if (data.code === 200) {
this.$message({
type: 'success',
message: '修改成功!'
});
this.dialog.dialogVisible = false;
this.search()
}
this.dialog.moduleForm = {
data_type: '',
team_name: '',
dict_key: '',
dict_value: '',
}
})
} else {
this.$message({
type: 'info',
message: "请输入名称"
})
}
},
manage_handleDelete(row) {
let data = {create_data_detail_id: row.create_data_detail_id};
this.$confirm('是否删除该数据?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
DataDelete(data).then((data) => {
if (data.code === 200) {
this.$message({
type: 'success',
message: '删除成功!'
});
this.manage_search()
}
})
})
},
manage_pullGit() {
this.pullmaster.dialogVisible = true;
this.pullmaster.title = "更新关键字"
},
manage_gitcancel() {
this.pullmaster.dialogVisible = false;
this.pullmaster = {
title: "编辑",
dialogVisible: false,
moduleForm: {
team: '',
fileName: '',
username: '',
password: ''
},
}
},
manage_submit(team) {
this.pullmaster.moduleForm.team = team
ScrapyDetail(this.pullmaster.moduleForm).then((data) => {
this.loading = false;
if (data.code === 200) {
this.$message({
type: 'success',
message: '更新关键字成功!',
});
this.pullmaster.moduleForm = {
team: '',
fileName: '',
username: '',
password: ''
}
this.manage_search()
} else {
this.$message({
type: 'false',
message: data.message
});
}
this.pullmaster.moduleForm = {
team: '',
fileName: '',
username: '',
password: ''
}
})
},
loadingShow() {
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
setTimeout(() => {
loading.close();
// this.$message({
// type: 'success',
// message: '更新关键字成功!'
// });
this.pullmaster.dialogVisible = false;
this.search()
}, 10000);
},
manage_gitsubmit() {
this.loadingShow();
this.get_team = this.pullmaster.moduleForm.team
if (this.pullmaster.moduleForm.team !== '') {
getGitPull(this.pullmaster.moduleForm).then((data) => {
if (data.code === 200) {
this.manage_submit(this.get_team)
}
})
} else {
this.$message({
type: 'info',
message: "请输入组名"
})
}
},
manage_handleSizeChange(val) {
this.manage_pageSize = val;
this.manage_search()
},
manage_handleCurrentChange(val) {
this.manage_pageNo = val;
this.manage_search(true)
},
manage_dataList(data) {
InfoQuery(data).then(data => {
this.manage_tableData = data.data;
this.manage_total = data.totalCount
})
},
manage_search(val) {
if (!val) {
this.manage_pageNo = 1
}
let data = {
pageNo: this.manage_pageNo,
pageSize: this.manage_pageSize,
detail_name: this.detail_name,
team_name: this.manage_team_name,
file_name: this.file_name,
module_name: this.module_name
};
this.manage_dataList(data)
},
manage_get_team_name(manage_team) {
let request_data = {"data_type": 2, "team_name": manage_team}
this.manage_pageNo = 1
GetTeam(request_data).then((data) => {
if (data.code === 200) {
this.dict_data = data.data
}
})
},
manage_get_file_name(manage_team) {
let request_data = {"data_type": 3, "team_name": manage_team}
this.manage_pageNo = 1
GetTeam(request_data).then((data) => {
if (data.code === 200) {
this.dict_file_data = data.data
}
})
},
},
created() {
let data = {pageNo: 1, pageSize: 10, keyword: "", team_name: ""}
this.dataList(data)
let manage_data = {pageNo: 1, pageSize: 10, detail_name: "", team_name: "", file_name: "", module_name: ""}
this.manage_dataList(manage_data)
this.tableHeight = document.getElementById("app").clientHeight - 250
let team = ""
this.get_team_name(team)
this.manage_get_team_name(team)
}
}
</script>
<style scoped>
.data {
padding-left: 100px;
}
.delete_button{
color: #cf9236;
}
</style>

View File

@@ -0,0 +1,377 @@
<template>
<div class="create-data">
<div class="search">
<el-form :inline="true" :model="queryForm" class="search" size="small" @submit.native.prevent>
<el-form-item label="项目">
<el-select
v-model="queryForm.project"
placeholder="请选择项目"
clearable
filterable>
<el-option
v-for="item in projectOptions"
:key="item"
:label="item"
:value="item">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="环境">
<el-input
v-model="queryForm.runEnv"
placeholder="请输入环境"
clearable
@keyup.enter.native="search()">
</el-input>
</el-form-item>
<el-form-item label="创建人">
<el-input
v-model="queryForm.creator"
placeholder="请输入创建人"
clearable
@keyup.enter.native="search()">
</el-input>
</el-form-item>
<el-form-item label="分组">
<el-input
v-model="queryForm.runGroup"
placeholder="请输入分组"
clearable
@keyup.enter.native="search()">
</el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="search">搜索</el-button>
<el-button @click="resetSearch">重置</el-button>
<el-button type="success" @click="addTask">新增</el-button>
</el-form-item>
</el-form>
</div>
<div class="api-form">
<el-table
ref="table"
v-loading="loading"
:data="tableData"
:header-cell-style="{textAlign: 'center'}"
:stripe="true"
:height="tableHeight"
border>
<el-table-column label="项目名称" prop="project" min-width="150"></el-table-column>
<el-table-column label="运行环境" prop="run_env" width="120"></el-table-column>
<el-table-column label="运行分组" prop="run_group" min-width="150"></el-table-column>
<el-table-column label="SQL语句" prop="sql" min-width="220">
<template slot-scope="props">
<el-tooltip v-if="props.row.sql && props.row.sql.length > 40" :content="props.row.sql" placement="top">
<span>{{ formatSql(props.row.sql) }}</span>
</el-tooltip>
<span v-else>{{ props.row.sql || '-' }}</span>
</template>
</el-table-column>
<el-table-column label="备注" prop="remark" min-width="180" :show-overflow-tooltip="true"></el-table-column>
<el-table-column label="创建人" prop="creator" width="120"></el-table-column>
<el-table-column label="创建时间" prop="created_time" min-width="170"></el-table-column>
<el-table-column label="操作" align="center" width="280" fixed="right">
<template slot-scope="props">
<el-button type="text" @click="editTask(props.row)">编辑</el-button>
<el-button type="text" @click="viewDetail(props.row)">查看详情</el-button>
<el-button type="text" style="color: #F56C6C;" @click="deleteTask(props.row)">删除</el-button>
<el-button type="text" :loading="runningId === getRowId(props.row)" @click="runTask(props.row)">执行</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="block">
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="pageNo"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="total">
</el-pagination>
</div>
<el-dialog title="任务详情" :visible.sync="detailVisible" width="60%">
<el-table v-if="detailRow" :data="detailItems" border>
<el-table-column label="字段" prop="key" width="180"></el-table-column>
<el-table-column label="值" prop="value" :show-overflow-tooltip="true"></el-table-column>
</el-table>
</el-dialog>
<el-dialog title="执行结果" :visible.sync="executeVisible" width="60%">
<pre class="execute-result" v-html="executeResult"></pre>
</el-dialog>
</div>
</template>
<script>
import {ItApiDelete, ItApiDetail, ItApiList, ItApiRun} from '@/api/CreateDtapi'
export default {
name: "CreateManage",
data() {
return {
tableHeight: null,
total: 0,
tableData: [],
pageNo: 1,
pageSize: 10,
loading: false,
runningId: '',
detailVisible: false,
detailRow: null,
executeVisible: false,
executeResult: '',
queryForm: {
project: '',
runEnv: '',
creator: '',
runGroup: ''
},
projectOptions: ['ZHYY', 'DLZ', 'JOYHUB', 'OA', 'APP']
}
},
computed: {
detailItems() {
if (!this.detailRow) {
return []
}
const fieldMap = [
{label: '项目名称', keys: ['project']},
{label: '运行环境', keys: ['runEnv', 'run_env']},
{label: '运行分组', keys: ['runGroup', 'run_group']},
{label: 'SQL语句', keys: ['sql']},
{label: '备注', keys: ['remark']},
{label: '创建时间', keys: ['createdTime', 'created_time']},
{label: '更新时间', keys: ['updatedTime', 'updated_time']}
]
return fieldMap.reduce((list, item) => {
const value = this.getDetailValue(item.keys)
if (value === '') {
return list
}
list.push({
key: item.label,
value
})
return list
}, [])
}
},
methods: {
handleSizeChange(val) {
this.pageSize = val
this.search()
},
handleCurrentChange(val) {
this.pageNo = val
this.search(true)
},
getList() {
this.loading = true
ItApiList(this.buildParams()).then(res => {
const data = res.data || {}
this.tableData = data.list || []
this.total = data.total || data.totalCount || res.total || res.totalCount || this.tableData.length
}).finally(() => {
this.loading = false
})
},
buildParams() {
const params = {
pageNo: this.pageNo,
pageSize: this.pageSize
}
Object.keys(this.queryForm).forEach(key => {
const value = this.queryForm[key]
if (value !== '') {
params[key] = value
}
})
return params
},
search(keepPage) {
if (!keepPage) {
this.pageNo = 1
}
this.getList()
},
resetSearch() {
this.queryForm = {
project: '',
runEnv: '',
creator: '',
runGroup: ''
}
this.search()
},
addTask() {
this.$router.push({path: '/create/info'})
},
editTask(row) {
const sqlId = this.getRowId(row)
if (!sqlId) {
this.$message({type: 'error', message: '缺少sqlId无法编辑'})
return
}
this.$router.push({path: '/create/info', query: {sqlId}})
},
viewDetail(row) {
const sqlId = this.getRowId(row)
if (!sqlId) {
this.$message({type: 'error', message: '缺少sqlId无法查看详情'})
return
}
this.loading = true
ItApiDetail({sqlId}).then(res => {
const data = res && res.data ? res.data : {}
this.detailRow = data
this.detailVisible = true
}).finally(() => {
this.loading = false
})
},
deleteTask(row) {
const sqlId = this.getRowId(row)
if (!sqlId) {
this.$message({type: 'error', message: '缺少sqlId无法删除'})
return
}
this.$confirm('确认删除该条记录吗?', '提示', {
type: 'warning'
}).then(() => {
ItApiDelete({sqlId: Number(sqlId) || sqlId}).then(res => {
if (res && res.success === true) {
this.$message({type: 'success', message: '删除成功'})
if (this.tableData.length === 1 && this.pageNo > 1) {
this.pageNo = this.pageNo - 1
}
this.getList()
} else {
this.$message({type: 'error', message: res.message || '删除失败'})
}
})
}).catch(() => {})
},
runTask(row) {
const sqlId = this.getRowId(row)
if (!sqlId) {
this.$message({type: 'error', message: '缺少sqlId无法执行'})
return
}
this.runningId = sqlId
ItApiRun({sqlId}).then(res => {
this.executeResult = this.formatJsonHtml(res && res.data)
this.executeVisible = true
}).catch(err => {
this.$message({type: 'error', message: (err && err.message) || '执行失败'})
}).finally(() => {
this.runningId = ''
})
},
escapeHtml(value) {
return String(value)
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
},
syntaxHighlight(json) {
return this.escapeHtml(json).replace(/("(?:\\u[a-fA-F0-9]{4}|\\[^u]|[^\\"])*"\s*:?)|(\btrue\b|\bfalse\b)|(\bnull\b)|(-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g, (match) => {
let className = 'json-number'
if (/^"/.test(match)) {
className = /:$/.test(match) ? 'json-key' : 'json-string'
} else if (/true|false/.test(match)) {
className = 'json-boolean'
} else if (/null/.test(match)) {
className = 'json-null'
}
return '<span class="' + className + '">' + match + '</span>'
})
},
formatJsonHtml(value) {
if (typeof value === 'string') {
try {
return this.syntaxHighlight(JSON.stringify(JSON.parse(value), null, 2))
} catch (e) {
return this.syntaxHighlight(value)
}
}
return this.syntaxHighlight(JSON.stringify(value || {}, null, 2))
},
getRowId(row) {
return String(row.sqlId || row.sql_id || row.id || row.create_data_detail_id || row.createDataDetailId || row.apiId || '')
},
formatSql(sql) {
if (!sql) {
return '-'
}
return sql.length > 40 ? sql.substring(0, 40) + '...' : sql
},
getDetailValue(keys) {
for (let i = 0; i < keys.length; i++) {
const value = this.detailRow[keys[i]]
if (value !== null && typeof value !== 'undefined' && value !== '') {
return this.formatValue(value)
}
}
return ''
},
formatValue(value) {
if (value === null || typeof value === 'undefined') {
return ''
}
if (typeof value === 'object') {
return JSON.stringify(value)
}
return String(value)
}
},
created() {
this.tableHeight = document.getElementById("app").clientHeight - 183
this.getList()
}
}
</script>
<style scoped>
.api-form {
text-align: center;
}
.execute-result {
max-height: 500px;
overflow: auto;
margin: 0;
padding: 16px;
background: #0f172a;
border-radius: 6px;
white-space: pre-wrap;
word-break: break-all;
text-align: left;
color: #e2e8f0;
line-height: 1.6;
}
.execute-result ::v-deep .json-key {
color: #93c5fd;
}
.execute-result ::v-deep .json-string {
color: #86efac;
}
.execute-result ::v-deep .json-number {
color: #f9a8d4;
}
.execute-result ::v-deep .json-boolean {
color: #fcd34d;
}
.execute-result ::v-deep .json-null {
color: #c4b5fd;
}
</style>

View File

@@ -0,0 +1,90 @@
<template>
<div class="create-data">
<el-container>
<el-header>
<p class="create-result-info">造数结果:</p>
</el-header>
<el-main>
<span class="api-module-message-value">组名: {{ dialog.moduleForm.team_name }} </span>
<span class="api-module-message-value">类名: {{ dialog.moduleForm.class_name }} </span>
<span class="api-module-message-value">方法名: {{ dialog.moduleForm.method_name }} </span>
<br><br>
<span class="api-module-message-value">请求参数:<br> {{ dialog.moduleForm.request_parameter }} </span>
<br><br>
<span class="api-module-message-value">描述: {{ dialog.moduleForm.method_function_detail }} </span>
<!-- <span class="api-module-message-value">结果: {{ dialog.moduleForm.result_info }} </span>-->
</el-main>
<el-footer>
<span class="create-result-data">结果: <br>{{ dialog.moduleForm.result_info }} </span>
</el-footer>
</el-container>
</div>
</template>
<script>
import { ResultAdvance } from '@/api/CreateDtapi'
export default {
name: 'CreateResult',
data() {
return {
create_data_result_id: '',
dialog: {
moduleForm: {
team_name: '',
class_name: '',
method_name: '',
request_parameter: '',
method_function_detail: '',
result_info: ''
}
}
}
},
methods: {
getDetail() {
ResultAdvance({ create_data_result_id: this.create_data_result_id }).then(data => {
this.dialog.moduleForm = data.data
})
}
},
mounted() {
this.create_data_result_id = this.$route.query.create_data_result_id
this.getDetail()
}
}
</script>
<style scoped>
.data {
padding-left: 100px;
}
.create-result-info{
text-align: center;
font-family: 华文仿宋;
font-size: 30px;
}
.api-module-message-value {
color: #195fd9;
font-family: 华文楷体;
white-space: pre-wrap;
}
.create-result-data{
color: #ec1270;
font-size: 20px;
font-family: 华文楷体;
white-space: pre-wrap;
}
.api-data {
white-space: pre-wrap;
}
.form-button {
margin-top: 20px;
text-align: center;
bottom: 0;
}
</style>

View File

@@ -0,0 +1,226 @@
<template>
<div class="create-data">
<div class="search">
<el-form :inline="true" class="search" size="small" @submit.native.prevent>
<el-form-item label="业务线">
<el-select
v-model="team_name"
placeholder="请选择业务线"
style="width:160px"
clearable
@change="pageNo = 1">
<el-option v-for="item in dict_data" :key="item.value" :value="item.value" :label="item.label"></el-option>
</el-select>
</el-form-item>
<el-form-item label="" labelWidth="110px">
<el-input v-model="detail_name" placeholder="场景名称" clearable @change="search" @keyup.enter="search"></el-input>
</el-form-item>
<el-form-item label="" labelWidth="110px">
<el-input v-model="get_tag" placeholder="备注" clearable @change="search" @keyup.enter="search"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="search" @keyup.enter="search">搜索</el-button>
</el-form-item>
</el-form>
</div>
<div class="api-form">
<el-table
ref="table"
:data="tableData"
:header-cell-style="{ textAlign: 'center' }"
:stripe="true"
:height="tableHeight"
border>
<el-table-column label="场景名称" prop="method_function_detail"></el-table-column>
<el-table-column label="请求参数" prop="request_parameter" :show-overflow-tooltip="true"></el-table-column>
<el-table-column label="结果数据" prop="result_info" :show-overflow-tooltip="true"></el-table-column>
<el-table-column label="业务线" prop="team_name"></el-table-column>
<el-table-column label="创建时间" prop="created_time">
<template slot-scope="props">
{{ formatTimeValue(props.row.created_time) }}
</template>
</el-table-column>
<el-table-column label="备注" prop="tag"></el-table-column>
<el-table-column label="操作" align="center">
<template slot-scope="props">
<el-button type="text" @click.native.prevent="openResult(props.row)">查看详情</el-button>
<el-button type="text" @click.native.prevent="tryRunCreateData(props.row)">再来一次</el-button>
</template>
</el-table-column>
</el-table>
<el-dialog title="造数结果" :visible.sync="result_dialog.dialogVisible" width="50%">
<div v-if="is_json">
<JsonView :json="JsonData"></JsonView>
</div>
<div v-else>
<span>{{ result_dialog.result_info }}</span>
</div>
</el-dialog>
</div>
<div class="block">
<el-pagination
:current-page="pageNo"
:page-size="10"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange">
</el-pagination>
</div>
</div>
</template>
<script>
import { GetTeam, ResultAdvance, ResultQuery } from '@/api/CreateDtapi'
import JsonView from '@/components/formateJson/JsonView'
import { formatTime } from '@/utils/util'
export default {
name: 'CreateResultList',
components: { JsonView },
data() {
return {
tableHeight: null,
team_name: '',
detail_name: '',
get_tag: '',
total: 0,
is_json: '',
tableData: [],
dict_data: {},
pageNo: 1,
pageSize: 10,
JsonData: '',
result_dialog: {
dialogVisible: false,
result_info: ''
}
}
},
methods: {
formatTimeValue(str) {
return str ? formatTime(str) : ''
},
handleSizeChange(val) {
this.pageSize = val
this.search()
},
handleCurrentChange(val) {
this.pageNo = val
this.search(true)
},
dataList(data) {
ResultQuery(data).then(data => {
this.tableData = data.data
this.total = data.totalCount
})
},
search(keepPage) {
if (!keepPage) {
this.pageNo = 1
}
this.dataList({
pageNo: this.pageNo,
pageSize: this.pageSize,
team_name: this.team_name || '',
detail_name: this.detail_name || '',
get_tag: this.get_tag || ''
})
},
resetResultDialog() {
this.result_dialog = {
dialogVisible: false,
result_info: ''
}
this.JsonData = ''
this.is_json = ''
},
getJsonData(val) {
try {
this.JsonData = JSON.parse(val)
} catch (e) {
this.JsonData = e.toString()
}
},
openResult(row) {
this.result_dialog.dialogVisible = true
ResultAdvance({ create_data_result_id: row.create_data_result_id }).then(data => {
if (data.code === 200) {
this.result_dialog.result_info = data.data.result_info
this.is_json = data.data.is_json
this.getJsonData(data.data.result_info)
} else {
this.result_dialog.result_info = data.message
}
}).catch(() => {
this.resetResultDialog()
})
},
tryRunCreateData(row) {
this.$router.push({
path: '/create/info',
query: {
create_data_detail_id: row.create_data_detail_id,
create_data_result_id: row.create_data_result_id
}
})
},
getTeamName(team) {
GetTeam({ data_type: 2, team_name: team }).then(data => {
if (data.code === 200) {
this.dict_data = data.data
}
})
}
},
created() {
this.team_name = this.$route.query.team_name || ''
this.detail_name = this.$route.query.method_function_detail || ''
this.get_tag = this.$route.query.get_tag || ''
this.dataList({
pageNo: 1,
pageSize: 10,
team_name: this.team_name,
detail_name: this.detail_name,
get_tag: this.get_tag
})
this.tableHeight = document.getElementById('app').clientHeight - 183
this.getTeamName('')
}
}
</script>
<style scoped>
.data {
padding-left: 100px;
}
pre {
outline: 1px solid #ccc;
padding: 5px;
margin: 5px;
}
.string {
color: green;
}
.number {
color: darkorange;
}
.boolean {
color: blue;
}
.null {
color: magenta;
}
.key {
color: red;
}
</style>