Commit e2476051 by yuwei

项目初始化

parent f92085c0
...@@ -148,6 +148,7 @@ public class ModelServiceImpl extends BaseServiceImpl<ModelDao, ModelEntity> imp ...@@ -148,6 +148,7 @@ public class ModelServiceImpl extends BaseServiceImpl<ModelDao, ModelEntity> imp
return map; return map;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("modelId", id);
map.put("tableName", tableName); map.put("tableName", tableName);
map.put("columnList", columnList); map.put("columnList", columnList);
map.put("queryList", queryList); map.put("queryList", queryList);
......
<template>
<el-card class="box-card" shadow="always">
<div slot="header" class="clearfix">
<span>{{ title }}</span>
<el-button-group style="float: right;">
<el-button size="mini" icon="el-icon-plus" round :loading="loadingOptions.loading" :disabled="loadingOptions.isDisabled" @click="submitForm">{{ loadingOptions.loadingText }}</el-button>
<el-button size="mini" icon="el-icon-back" round @click="showCard">返回</el-button>
</el-button-group>
</div>
<div class="body-wrapper">
<el-form ref="form" :model="form" label-width="80px">
<el-form-item
v-for="(item, index) in columns"
:key="item.id"
:label="item.columnComment"
:prop="item.columnName"
:rules="[{ required: item.isRequired, message: item.columnComment + '不能为空' }]"
>
<template v-if="item.htmlType === 'input'">
<el-input
v-model.trim="form[item.columnName]"
:placeholder="'请输入' + item.columnComment"
/>
</template>
<template v-if="item.htmlType === 'textarea'">
<el-input
type="textarea"
v-model.trim="form[item.columnName]"
:placeholder="'请输入' + item.columnComment"
/>
</template>
<template v-if="item.htmlType === 'number'">
<el-input-number
v-model.trim="form[item.columnName]"
:controls="false"
></el-input-number>
</template>
<template v-if="item.htmlType === 'datetime'">
<el-date-picker
v-model.trim="form[item.columnName]"
format="yyyy-MM-dd HH:mm:ss"
value-format="yyyy-MM-dd HH:mm:ss"
type="datetime"
placeholder="选择日期时间"
></el-date-picker>
</template>
</el-form-item>
</el-form>
</div>
</el-card>
</template>
<script>
import { addChangeRecord } from '@/api/metadata/changerecord'
import { getDataModel } from '@/api/masterdata/datamodel'
import { addData } from '@/api/masterdata/datamanage'
export default {
name: 'DataAdd',
props: {
data: {
type: Object,
default: function() {
return {}
}
}
},
data() {
return {
title: '主数据新增',
// 展示切换
showOptions: {
data: {},
showList: true,
showAdd: false,
showEdit: false,
showDetail: false
},
// 保存按钮
loadingOptions: {
loading: false,
loadingText: '保存',
isDisabled: false
},
// 表单参数
form: {},
// 表单校验
rules: {},
columns: []
}
},
created() {
console.log('data:' + this.data)
getDataModel(this.data.modelId).then(response => {
if (response.success) {
const { data } = response
this.columns = data.modelColumns
}
})
},
methods: {
showCard() {
this.$emit('showCard', this.showOptions)
},
/** 提交按钮 */
submitForm: function() {
console.log(this.form)
return false
// this.$refs['form'].validate(valid => {
// if (valid) {
// this.loadingOptions.loading = true
// this.loadingOptions.loadingText = '保存中...'
// this.loadingOptions.isDisabled = true
// addChangeRecord(this.form).then(response => {
// if (response.success) {
// this.$message.success('保存成功')
// setTimeout(() => {
// // 2秒后跳转列表页
// this.$emit('showCard', this.showOptions)
// }, 2000)
// } else {
// this.$message.error('保存失败')
// this.loadingOptions.loading = false
// this.loadingOptions.loadingText = '保存'
// this.loadingOptions.isDisabled = false
// }
// }).catch(() => {
// this.loadingOptions.loading = false
// this.loadingOptions.loadingText = '保存'
// this.loadingOptions.isDisabled = false
// })
// }
// })
}
}
}
</script>
<style lang="scss" scoped>
.el-card ::v-deep .el-card__body {
height: calc(100vh - 230px);
overflow-y: auto;
}
</style>
<template>
<el-card class="box-card" shadow="always">
<div slot="header" class="clearfix">
<span>{{ title }}</span>
<el-button-group style="float: right;">
<el-button size="mini" icon="el-icon-back" round @click="showCard">返回</el-button>
</el-button-group>
</div>
<div class="body-wrapper">
<el-form ref="form" :model="form" label-width="80px" disabled>
<el-form-item label="版本号" prop="version">
<el-input v-model="form.version" />
</el-form-item>
<el-form-item label="原来的值" prop="fieldOldValue">
<el-input v-model="form.fieldOldValue" />
</el-form-item>
<el-form-item label="最新的值" prop="fieldNewValue">
<el-input v-model="form.fieldNewValue" />
</el-form-item>
<el-form-item label="状态" prop="status">
<el-radio-group v-model="form.status">
<el-radio
v-for="dict in statusOptions"
:key="dict.id"
:label="dict.itemText"
>{{ dict.itemValue }}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" />
</el-form-item>
</el-form>
</div>
</el-card>
</template>
<script>
import { getChangeRecord } from '@/api/metadata/changerecord'
import { getDataModel } from '@/api/masterdata/datamodel'
import { getData } from '@/api/masterdata/datamanage'
export default {
name: 'DataDetail',
props: {
data: {
type: Object,
default: function() {
return {}
}
}
},
data() {
return {
title: '主数据详情',
// 展示切换
showOptions: {
data: {},
showList: true,
showAdd: false,
showEdit: false,
showDetail: false
},
// 表单参数
form: {}
}
},
created() {
console.log('id:' + this.data.id)
},
mounted() {
this.getChangeRecord(this.data.id)
},
methods: {
showCard() {
this.$emit('showCard', this.showOptions)
},
/** 获取详情 */
getChangeRecord: function(id) {
getChangeRecord(id).then(response => {
if (response.success) {
this.form = response.data
}
})
}
}
}
</script>
<style lang="scss" scoped>
.el-card ::v-deep .el-card__body {
height: calc(100vh - 230px);
overflow-y: auto;
}
</style>
<template>
<el-card class="box-card" shadow="always">
<div slot="header" class="clearfix">
<span>{{ title }}</span>
<el-button-group style="float: right;">
<el-button size="mini" icon="el-icon-plus" round :loading="loadingOptions.loading" :disabled="loadingOptions.isDisabled" @click="submitForm">{{ loadingOptions.loadingText }}</el-button>
<el-button size="mini" icon="el-icon-back" round @click="showCard">返回</el-button>
</el-button-group>
</div>
<div class="body-wrapper">
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="版本号" prop="version">
<el-input v-model="form.version" placeholder="请输入版本号" />
</el-form-item>
<el-form-item label="原来的值" prop="fieldOldValue">
<el-input v-model="form.fieldOldValue" placeholder="请输入原来的值" disabled />
</el-form-item>
<el-form-item label="最新的值" prop="fieldNewValue">
<el-input v-model="form.fieldNewValue" placeholder="请输入最新的值" />
</el-form-item>
</el-form>
</div>
</el-card>
</template>
<script>
import { getChangeRecord, updateChangeRecord } from '@/api/metadata/changerecord'
import { getDataModel } from '@/api/masterdata/datamodel'
import { getData, updateData } from '@/api/masterdata/datamanage'
export default {
name: 'DataEdit',
props: {
data: {
type: Object,
default: function() {
return {}
}
}
},
data() {
return {
title: '主数据编辑',
// 展示切换
showOptions: {
data: {},
showList: true,
showAdd: false,
showEdit: false,
showDetail: false
},
// 保存按钮
loadingOptions: {
loading: false,
loadingText: '保存',
isDisabled: false
},
// 表单参数
form: {},
// 表单校验
rules: {
objectId: [
{ required: true, message: '源数据表主键不能为空', trigger: 'blur' }
],
fieldName: [
{ required: true, message: '数据表的字段名不能为空', trigger: 'blur' }
],
fieldOldValue: [
{ required: true, message: '原来的值不能为空', trigger: 'blur' }
],
fieldNewValue: [
{ required: true, message: '最新的值不能为空', trigger: 'blur' }
],
version: [
{ required: true, message: '版本号不能为空', trigger: 'blur' }
]
}
}
},
created() {
console.log('data:' + this.data)
getDataModel(this.data.modelId).then(response => {
if (response.success) {
console.log(response)
}
})
},
mounted() {
// this.getChangeRecord(this.data.id)
},
methods: {
showCard() {
this.$emit('showCard', this.showOptions)
},
/** 获取详情 */
getChangeRecord: function(id) {
getChangeRecord(id).then(response => {
if (response.success) {
this.form = response.data
}
})
},
/** 提交按钮 */
submitForm: function() {
this.$refs['form'].validate(valid => {
if (valid) {
this.loadingOptions.loading = true
this.loadingOptions.loadingText = '保存中...'
this.loadingOptions.isDisabled = true
updateChangeRecord(this.form).then(response => {
if (response.success) {
this.$message.success('保存成功')
setTimeout(() => {
// 2秒后跳转列表页
this.$emit('showCard', this.showOptions)
}, 2000)
} else {
this.$message.error('保存失败')
this.loadingOptions.loading = false
this.loadingOptions.loadingText = '保存'
this.loadingOptions.isDisabled = false
}
}).catch(() => {
this.loadingOptions.loading = false
this.loadingOptions.loadingText = '保存'
this.loadingOptions.isDisabled = false
})
}
})
}
}
}
</script>
<style lang="scss" scoped>
.el-card ::v-deep .el-card__body {
height: calc(100vh - 230px);
overflow-y: auto;
}
</style>
...@@ -24,33 +24,11 @@ ...@@ -24,33 +24,11 @@
<div v-if="tableName"> <div v-if="tableName">
<el-form ref="queryForm" :model="queryParams" :inline="true"> <el-form ref="queryForm" :model="queryParams" :inline="true">
<el-form-item v-for="(item, index) in queryParams.conditions" :label="item.columnName" :prop="item.column" :key="index"> <el-form-item v-for="(item, index) in queryParams.conditions" :label="item.columnName" :prop="item.column" :key="index">
<template v-if="item.type === 'char'"> <el-input
<el-input v-model.trim="item.value"
v-model.trim="queryParams.conditions[index].value" clearable
clearable size="small"
size="small" ></el-input>
></el-input>
</template>
<template v-if="item.type === 'int'">
<el-input-number
v-model.trim="queryParams.conditions[index].value"
:controls="false"
:precision="0"
clearable
size="small"
></el-input-number>
</template>
<template v-if="item.type === 'datetime'">
<el-date-picker
v-model.trim="queryParams.conditions[index].value"
format="yyyy-MM-dd HH:mm:ss"
value-format="yyyy-MM-dd HH:mm:ss"
type="datetime"
placeholder="选择日期时间"
clearable
size="small"
></el-date-picker>
</template>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
...@@ -201,6 +179,8 @@ export default { ...@@ -201,6 +179,8 @@ export default {
children: 'children', children: 'children',
label: 'modelName' label: 'modelName'
}, },
// 数据模型ID
modelId: '',
tableName: '', tableName: '',
// 表格头 // 表格头
tableColumns: [], tableColumns: [],
...@@ -252,6 +232,7 @@ export default { ...@@ -252,6 +232,7 @@ export default {
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.showOptions.data = {} this.showOptions.data = {}
this.showOptions.data.modelId = this.modelId
this.showOptions.showList = false this.showOptions.showList = false
this.showOptions.showAdd = true this.showOptions.showAdd = true
this.showOptions.showEdit = false this.showOptions.showEdit = false
...@@ -260,6 +241,7 @@ export default { ...@@ -260,6 +241,7 @@ export default {
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleEdit(row) { handleEdit(row) {
this.showOptions.data.modelId = this.modelId
this.showOptions.data.id = row.id || this.ids[0] this.showOptions.data.id = row.id || this.ids[0]
this.showOptions.showList = false this.showOptions.showList = false
this.showOptions.showAdd = false this.showOptions.showAdd = false
...@@ -269,6 +251,7 @@ export default { ...@@ -269,6 +251,7 @@ export default {
}, },
/** 详情按钮操作 */ /** 详情按钮操作 */
handleDetail(row) { handleDetail(row) {
this.showOptions.data.modelId = this.modelId
this.showOptions.data.id = row.id || this.ids[0] this.showOptions.data.id = row.id || this.ids[0]
this.showOptions.showList = false this.showOptions.showList = false
this.showOptions.showAdd = false this.showOptions.showAdd = false
...@@ -315,10 +298,11 @@ export default { ...@@ -315,10 +298,11 @@ export default {
}, },
/** 节点单击事件 */ /** 节点单击事件 */
handleNodeClick(data) { handleNodeClick(data) {
if (data.id && data.modelPhysicalTable !== this.tableName) { if (data.id && data.id !== this.modelId) {
getTableParam(data.id).then(response => { getTableParam(data.id).then(response => {
if (response.success) { if (response.success) {
const { data } = response const { data } = response
this.modelId = data.modelId
this.tableName = data.tableName this.tableName = data.tableName
this.tableColumns = data.columnList this.tableColumns = data.columnList
this.tableParamList = data.queryList this.tableParamList = data.queryList
......
...@@ -3,15 +3,27 @@ ...@@ -3,15 +3,27 @@
<transition name="el-zoom-in-center"> <transition name="el-zoom-in-center">
<data-list v-if="options.showList" @showCard="showCard" /> <data-list v-if="options.showList" @showCard="showCard" />
</transition> </transition>
<transition name="el-zoom-in-top">
<data-add v-if="options.showAdd" :data="options.data" @showCard="showCard" />
</transition>
<transition name="el-zoom-in-top">
<data-edit v-if="options.showEdit" :data="options.data" @showCard="showCard" />
</transition>
<transition name="el-zoom-in-bottom">
<data-detail v-if="options.showDetail" :data="options.data" @showCard="showCard" />
</transition>
</div> </div>
</template> </template>
<script> <script>
import DataList from './DataList' import DataList from './DataList'
import DataAdd from './DataAdd'
import DataEdit from './DataEdit'
import DataDetail from './DataDetail'
export default { export default {
name: 'DataManage', name: 'DataManage',
components: { DataList }, components: { DataList, DataAdd, DataEdit, DataDetail },
data() { data() {
return { return {
options: { options: {
......
...@@ -244,12 +244,12 @@ export default { ...@@ -244,12 +244,12 @@ export default {
// 系统默认列 // 系统默认列
systemColumns: [ systemColumns: [
{ columnName: 'id', columnComment: '主键ID', columnType: 'varchar', columnLength: '20', columnScale: '0', defaultValue: '', isPk: '1', isRequired: '1', isInsert: '0', isEdit: '0', isList: '0', isQuery: '0', queryType: '', htmlType: 'input', isSystem: '1' }, { columnName: 'id', columnComment: '主键ID', columnType: 'varchar', columnLength: '20', columnScale: '0', defaultValue: '', isPk: '1', isRequired: '1', isInsert: '0', isEdit: '0', isList: '0', isQuery: '0', queryType: '', htmlType: 'input', isSystem: '1' },
{ columnName: 'status', columnComment: '状态(0禁用,1启用)', columnType: 'tinyint', columnLength: '0', columnScale: '0', defaultValue: '1', isPk: '0', isRequired: '0', isInsert: '0', isEdit: '0', isList: '0', isQuery: '0', queryType: '', htmlType: 'input', isSystem: '1' }, { columnName: 'status', columnComment: '状态(0禁用,1启用)', columnType: 'tinyint', columnLength: '0', columnScale: '0', defaultValue: '1', isPk: '0', isRequired: '0', isInsert: '0', isEdit: '0', isList: '0', isQuery: '0', queryType: '', htmlType: 'number', isSystem: '1' },
{ columnName: 'create_by', columnComment: '创建人', columnType: 'varchar', columnLength: '20', columnScale: '0', defaultValue: '', isPk: '0', isRequired: '0', isInsert: '0', isEdit: '0', isList: '0', isQuery: '0', queryType: '', htmlType: 'input', isSystem: '1' }, { columnName: 'create_by', columnComment: '创建人', columnType: 'varchar', columnLength: '20', columnScale: '0', defaultValue: '', isPk: '0', isRequired: '0', isInsert: '0', isEdit: '0', isList: '0', isQuery: '0', queryType: '', htmlType: 'input', isSystem: '1' },
{ columnName: 'create_time', columnComment: '创建日期', columnType: 'datetime', columnLength: '0', columnScale: '0', defaultValue: '', isPk: '0', isRequired: '0', isInsert: '0', isEdit: '0', isList: '0', isQuery: '0', queryType: '', htmlType: 'input', isSystem: '1' }, { columnName: 'create_time', columnComment: '创建日期', columnType: 'datetime', columnLength: '0', columnScale: '0', defaultValue: '', isPk: '0', isRequired: '0', isInsert: '0', isEdit: '0', isList: '0', isQuery: '0', queryType: '', htmlType: 'datetime', isSystem: '1' },
{ columnName: 'create_dept', columnComment: '创建人所属部门', columnType: 'varchar', columnLength: '20', columnScale: '0', defaultValue: '', isPk: '0', isRequired: '0', isInsert: '0', isEdit: '0', isList: '0', isQuery: '0', queryType: '', htmlType: 'input', isSystem: '1' }, { columnName: 'create_dept', columnComment: '创建人所属部门', columnType: 'varchar', columnLength: '20', columnScale: '0', defaultValue: '', isPk: '0', isRequired: '0', isInsert: '0', isEdit: '0', isList: '0', isQuery: '0', queryType: '', htmlType: 'input', isSystem: '1' },
{ columnName: 'update_by', columnComment: '更新人', columnType: 'varchar', columnLength: '20', columnScale: '0', defaultValue: '', isPk: '0', isRequired: '0', isInsert: '0', isEdit: '0', isList: '0', isQuery: '0', queryType: '', htmlType: 'input', isSystem: '1' }, { columnName: 'update_by', columnComment: '更新人', columnType: 'varchar', columnLength: '20', columnScale: '0', defaultValue: '', isPk: '0', isRequired: '0', isInsert: '0', isEdit: '0', isList: '0', isQuery: '0', queryType: '', htmlType: 'input', isSystem: '1' },
{ columnName: 'update_time', columnComment: '更新日期', columnType: 'datetime', columnLength: '0', columnScale: '0', defaultValue: '', isPk: '0', isRequired: '0', isInsert: '0', isEdit: '0', isList: '0', isQuery: '0', queryType: '', htmlType: 'input', isSystem: '1' } { columnName: 'update_time', columnComment: '更新日期', columnType: 'datetime', columnLength: '0', columnScale: '0', defaultValue: '', isPk: '0', isRequired: '0', isInsert: '0', isEdit: '0', isList: '0', isQuery: '0', queryType: '', htmlType: 'datetime', isSystem: '1' }
] ]
} }
}, },
...@@ -292,9 +292,9 @@ export default { ...@@ -292,9 +292,9 @@ export default {
defaultValue: '', defaultValue: '',
isSystem: '0', isSystem: '0',
isPk: '0', isPk: '0',
isRequired: '0', isRequired: '1',
isInsert: '0', isInsert: '1',
isEdit: '0', isEdit: '1',
isList: '1', isList: '1',
isQuery: '0', isQuery: '0',
queryType: '', queryType: '',
......
...@@ -281,9 +281,9 @@ export default { ...@@ -281,9 +281,9 @@ export default {
defaultValue: '', defaultValue: '',
isSystem: '0', isSystem: '0',
isPk: '0', isPk: '0',
isRequired: '0', isRequired: '1',
isInsert: '0', isInsert: '1',
isEdit: '0', isEdit: '1',
isList: '1', isList: '1',
isQuery: '0', isQuery: '0',
queryType: '', queryType: '',
......
...@@ -335,9 +335,12 @@ export default { ...@@ -335,9 +335,12 @@ export default {
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
pauseJob(row.id || this.ids[0]) pauseJob(row.id || this.ids[0]).then(response => {
this.$message.success('任务暂停成功') if (response.success) {
this.getList() this.$message.success('任务暂停成功')
this.getList()
}
})
}).catch(() => { }).catch(() => {
}) })
}, },
...@@ -348,9 +351,12 @@ export default { ...@@ -348,9 +351,12 @@ export default {
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
resumeJob(row.id || this.ids[0]) resumeJob(row.id || this.ids[0]).then(response => {
this.$message.success('任务恢复成功') if (response.success) {
this.getList() this.$message.success('任务恢复成功')
this.getList()
}
})
}).catch(() => { }).catch(() => {
}) })
}, },
...@@ -361,9 +367,12 @@ export default { ...@@ -361,9 +367,12 @@ export default {
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
runJob(row.id || this.ids[0]) runJob(row.id || this.ids[0]).then(response => {
this.$message.success('任务执行成功') if (response.success) {
this.getList() this.$message.success('任务执行成功')
this.getList()
}
})
}).catch(() => { }).catch(() => {
}) })
}, },
...@@ -407,9 +416,9 @@ export default { ...@@ -407,9 +416,9 @@ export default {
statusFormatter(row, column, cellValue, index) { statusFormatter(row, column, cellValue, index) {
const dictLabel = this.selectDictLabel(this.statusOptions, cellValue) const dictLabel = this.selectDictLabel(this.statusOptions, cellValue)
if (cellValue === '1') { if (cellValue === '1') {
return <el-tag type="success">{dictLabel}</el-tag> return <el-tag type='success'>{dictLabel}</el-tag>
} else { } else {
return <el-tag type="warning">{dictLabel}</el-tag> return <el-tag type='warning'>{dictLabel}</el-tag>
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment