Commit 462c6a6a by yuwei

项目初始化

parent e2476051
...@@ -50,6 +50,8 @@ public class ModelColumnDto implements Serializable { ...@@ -50,6 +50,8 @@ public class ModelColumnDto implements Serializable {
private String isInsert; private String isInsert;
@ApiModelProperty(value = "是否编辑字段(0否,1是)") @ApiModelProperty(value = "是否编辑字段(0否,1是)")
private String isEdit; private String isEdit;
@ApiModelProperty(value = "是否详情字段(0否,1是)")
private String isDetail;
@ApiModelProperty(value = "是否列表字段(0否,1是)") @ApiModelProperty(value = "是否列表字段(0否,1是)")
private String isList; private String isList;
@ApiModelProperty(value = "是否查询字段(0否,1是)") @ApiModelProperty(value = "是否查询字段(0否,1是)")
......
...@@ -88,6 +88,11 @@ public class ModelColumnEntity extends BaseEntity { ...@@ -88,6 +88,11 @@ public class ModelColumnEntity extends BaseEntity {
private String isEdit; private String isEdit;
/** /**
* 是否详情字段(0否,1是)
*/
private String isDetail;
/**
* 是否列表字段(0否,1是) * 是否列表字段(0否,1是)
*/ */
private String isList; private String isList;
......
...@@ -25,11 +25,6 @@ public class Condition implements Serializable { ...@@ -25,11 +25,6 @@ public class Condition implements Serializable {
private String queryType; private String queryType;
/** /**
* 字段类型,如int、varchar、datetime
*/
private String type;
/**
* 查询类型between时left查询字段值 * 查询类型between时left查询字段值
*/ */
private String leftValue; private String leftValue;
......
...@@ -35,6 +35,7 @@ public class ModelColumnVo implements Serializable { ...@@ -35,6 +35,7 @@ public class ModelColumnVo implements Serializable {
private String isRequired; private String isRequired;
private String isInsert; private String isInsert;
private String isEdit; private String isEdit;
private String isDetail;
private String isList; private String isList;
private String isQuery; private String isQuery;
private String queryType; private String queryType;
......
...@@ -164,4 +164,10 @@ public class ModelController extends BaseController { ...@@ -164,4 +164,10 @@ public class ModelController extends BaseController {
Map<String, Object> map = modelService.getTableParamById(id); Map<String, Object> map = modelService.getTableParamById(id);
return R.ok().setData(map); return R.ok().setData(map);
} }
@GetMapping("/form/param/{id}")
public R getFormParamById(@PathVariable String id) {
Map<String, Object> map = modelService.getFormParamById(id);
return R.ok().setData(map);
}
} }
...@@ -32,4 +32,6 @@ public interface ModelService extends BaseService<ModelEntity> { ...@@ -32,4 +32,6 @@ public interface ModelService extends BaseService<ModelEntity> {
void dropTable(String id); void dropTable(String id);
Map<String, Object> getTableParamById(String id); Map<String, Object> getTableParamById(String id);
Map<String, Object> getFormParamById(String id);
} }
...@@ -133,25 +133,59 @@ public class ModelServiceImpl extends BaseServiceImpl<ModelDao, ModelEntity> imp ...@@ -133,25 +133,59 @@ public class ModelServiceImpl extends BaseServiceImpl<ModelDao, ModelEntity> imp
List<ModelColumnEntity> modelColumns = modelEntity.getModelColumns(); List<ModelColumnEntity> modelColumns = modelEntity.getModelColumns();
// 列表展示字段 // 列表展示字段
List<Map<String, Object>> columnList = modelColumns.stream().filter(s -> DataConstant.TrueOrFalse.TRUE.getKey().equals(s.getIsList())).map(s -> { List<Map<String, Object>> columnList = modelColumns.stream().filter(s -> DataConstant.TrueOrFalse.TRUE.getKey().equals(s.getIsList())).map(s -> {
Map<String, Object> map = new HashMap<>(2); Map<String, Object> map = new HashMap<>(4);
map.put("prop", s.getColumnName()); map.put("prop", s.getColumnName());
map.put("label", s.getColumnComment()); map.put("label", s.getColumnComment());
return map; return map;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
// 查询参数字段 // 查询参数字段
List<Map<String, Object>> queryList = modelColumns.stream().filter(s -> DataConstant.TrueOrFalse.TRUE.getKey().equals(s.getIsQuery())).map(s -> { List<Map<String, Object>> queryList = modelColumns.stream().filter(s -> DataConstant.TrueOrFalse.TRUE.getKey().equals(s.getIsQuery())).map(s -> {
Map<String, Object> map = new HashMap<>(2); Map<String, Object> map = new HashMap<>(4);
map.put("column", s.getColumnName()); map.put("column", s.getColumnName());
map.put("queryType", s.getQueryType());
map.put("type", s.getColumnType());
map.put("columnName", s.getColumnComment()); map.put("columnName", s.getColumnComment());
map.put("queryType", s.getQueryType());
map.put("htmlType", s.getHtmlType());
return map; return map;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>(4);
map.put("modelId", id); 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);
return map; return map;
} }
@Override
public Map<String, Object> getFormParamById(String id) {
ModelEntity modelEntity = super.getById(id);
String tableName = modelEntity.getModelPhysicalTable();
List<ModelColumnEntity> modelColumns = modelEntity.getModelColumns();
List<Map<String, Object>> columnList = modelColumns.stream().filter(s -> DataConstant.TrueOrFalse.FALSE.getKey().equals(s.getIsSystem())).map(s -> {
Map<String, Object> map = new HashMap<>(16);
map.put("id", s.getId());
map.put("columnName", s.getColumnName());
map.put("columnComment", s.getColumnComment());
map.put("columnType", s.getColumnType());
map.put("columnLength", s.getColumnLength());
map.put("columnScale", s.getColumnScale());
map.put("defaultValue", s.getDefaultValue());
map.put("isRequired", s.getIsRequired());
map.put("isInsert", s.getIsInsert());
map.put("isEdit", s.getIsEdit());
map.put("isDetail", s.getIsEdit());
map.put("isList", s.getIsList());
map.put("isQuery", s.getIsQuery());
map.put("queryType", s.getQueryType());
map.put("isBindDict", s.getIsBindDict());
map.put("bindDictColumn", s.getBindDictColumn());
map.put("dictList", null);
map.put("htmlType", s.getHtmlType());
return map;
}).collect(Collectors.toList());
Map<String, Object> map = new HashMap<>(4);
map.put("modelId", id);
map.put("tableName", tableName);
map.put("columnList", columnList);
return map;
}
} }
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
<result column="is_required" property="isRequired" /> <result column="is_required" property="isRequired" />
<result column="is_insert" property="isInsert" /> <result column="is_insert" property="isInsert" />
<result column="is_edit" property="isEdit" /> <result column="is_edit" property="isEdit" />
<result column="is_detail" property="isDetail" />
<result column="is_list" property="isList" /> <result column="is_list" property="isList" />
<result column="is_query" property="isQuery" /> <result column="is_query" property="isQuery" />
<result column="query_type" property="queryType" /> <result column="query_type" property="queryType" />
...@@ -42,7 +43,7 @@ ...@@ -42,7 +43,7 @@
update_by, update_by,
update_time, update_time,
remark, remark,
model_id, column_name, column_comment, column_type, column_length, column_scale, default_value, is_system, is_pk, is_required, is_insert, is_edit, is_list, is_query, query_type, is_bind_dict, bind_dict_type_id, bind_dict_column, html_type, sort model_id, column_name, column_comment, column_type, column_length, column_scale, default_value, is_system, is_pk, is_required, is_insert, is_edit, is_detail, is_list, is_query, query_type, is_bind_dict, bind_dict_type_id, bind_dict_column, html_type, sort
</sql> </sql>
</mapper> </mapper>
...@@ -73,3 +73,10 @@ export function getTableParam(id) { ...@@ -73,3 +73,10 @@ export function getTableParam(id) {
method: 'get' method: 'get'
}) })
} }
export function getFormParam(id) {
return request({
url: '/data/masterdata/models/form/param/' + id,
method: 'get'
})
}
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<div class="body-wrapper"> <div class="body-wrapper">
<el-form ref="form" :model="form" label-width="80px"> <el-form ref="form" :model="form" label-width="80px">
<el-form-item <el-form-item
v-for="(item, index) in columns" v-for="(item, index) in columnList"
:key="item.id" :key="item.id"
:label="item.columnComment" :label="item.columnComment"
:prop="item.columnName" :prop="item.columnName"
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
<el-input <el-input
v-model.trim="form[item.columnName]" v-model.trim="form[item.columnName]"
:placeholder="'请输入' + item.columnComment" :placeholder="'请输入' + item.columnComment"
:maxlength="parseInt(item.columnLength)"
/> />
</template> </template>
<template v-if="item.htmlType === 'textarea'"> <template v-if="item.htmlType === 'textarea'">
...@@ -27,22 +28,52 @@ ...@@ -27,22 +28,52 @@
type="textarea" type="textarea"
v-model.trim="form[item.columnName]" v-model.trim="form[item.columnName]"
:placeholder="'请输入' + item.columnComment" :placeholder="'请输入' + item.columnComment"
:maxlength="parseInt(item.columnLength)"
/> />
</template> </template>
<template v-if="item.htmlType === 'number'"> <template v-if="item.htmlType === 'number'">
<el-input-number <el-input-number
v-model.trim="form[item.columnName]" v-model.trim="form[item.columnName]"
:controls="false" :controls="false"
:precision="parseInt(item.columnScale)"
></el-input-number> ></el-input-number>
</template> </template>
<template v-if="item.htmlType === 'datetime'"> <template v-if="item.htmlType === 'datetime'">
<el-date-picker <template v-if="item.columnType === 'date'">
v-model.trim="form[item.columnName]" <el-date-picker
format="yyyy-MM-dd HH:mm:ss" v-model.trim="form[item.columnName]"
value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd"
type="datetime" value-format="yyyy-MM-dd"
placeholder="选择日期时间" type="date"
></el-date-picker> placeholder="选择日期"
></el-date-picker>
</template>
<template v-if="item.columnType === 'time'">
<el-time-picker
v-model="form[item.columnName]"
format="HH:mm:ss"
value-format="HH:mm:ss"
placeholder="选择时间点">
</el-time-picker>
</template>
<template v-if="item.columnType === 'year'">
<el-date-picker
v-model.trim="form[item.columnName]"
format="yyyy"
value-format="yyyy"
type="year"
placeholder="选择年份"
></el-date-picker>
</template>
<template v-if="item.columnType === '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>
</template> </template>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -51,8 +82,7 @@ ...@@ -51,8 +82,7 @@
</template> </template>
<script> <script>
import { addChangeRecord } from '@/api/metadata/changerecord' import { getFormParam } from '@/api/masterdata/datamodel'
import { getDataModel } from '@/api/masterdata/datamodel'
import { addData } from '@/api/masterdata/datamanage' import { addData } from '@/api/masterdata/datamanage'
export default { export default {
...@@ -84,17 +114,17 @@ export default { ...@@ -84,17 +114,17 @@ export default {
}, },
// 表单参数 // 表单参数
form: {}, form: {},
// 表单校验 tableName: '',
rules: {}, columnList: []
columns: []
} }
}, },
created() { created() {
console.log('data:' + this.data) console.log('data:' + this.data)
getDataModel(this.data.modelId).then(response => { getFormParam(this.data.modelId).then(response => {
if (response.success) { if (response.success) {
const { data } = response const { data } = response
this.columns = data.modelColumns this.tableName = data.tableName
this.columnList = data.columnList.filter(item => item.isInsert === '1')
} }
}) })
}, },
...@@ -104,33 +134,32 @@ export default { ...@@ -104,33 +134,32 @@ export default {
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm: function() { submitForm: function() {
console.log(this.form) this.$refs['form'].validate(valid => {
return false if (valid) {
// this.$refs['form'].validate(valid => { const data = { tableName: this.tableName, datas: this.form }
// if (valid) { this.loadingOptions.loading = true
// this.loadingOptions.loading = true this.loadingOptions.loadingText = '保存中...'
// this.loadingOptions.loadingText = '保存中...' this.loadingOptions.isDisabled = true
// this.loadingOptions.isDisabled = true addData(data).then(response => {
// addChangeRecord(this.form).then(response => { if (response.success) {
// if (response.success) { this.$message.success('保存成功')
// this.$message.success('保存成功') setTimeout(() => {
// setTimeout(() => { // 2秒后跳转列表页
// // 2秒后跳转列表页 this.$emit('showCard', this.showOptions)
// this.$emit('showCard', this.showOptions) }, 2000)
// }, 2000) } else {
// } else { this.$message.error('保存失败')
// this.$message.error('保存失败') this.loadingOptions.loading = false
// this.loadingOptions.loading = false this.loadingOptions.loadingText = '保存'
// this.loadingOptions.loadingText = '保存' this.loadingOptions.isDisabled = false
// this.loadingOptions.isDisabled = false }
// } }).catch(() => {
// }).catch(() => { this.loadingOptions.loading = false
// this.loadingOptions.loading = false this.loadingOptions.loadingText = '保存'
// this.loadingOptions.loadingText = '保存' this.loadingOptions.isDisabled = false
// this.loadingOptions.isDisabled = false })
// }) }
// } })
// })
} }
} }
} }
......
...@@ -8,26 +8,72 @@ ...@@ -8,26 +8,72 @@
</div> </div>
<div class="body-wrapper"> <div class="body-wrapper">
<el-form ref="form" :model="form" label-width="80px" disabled> <el-form ref="form" :model="form" label-width="80px" disabled>
<el-form-item label="版本号" prop="version"> <el-form-item
<el-input v-model="form.version" /> v-for="(item, index) in columnList"
</el-form-item> :key="item.id"
<el-form-item label="原来的值" prop="fieldOldValue"> :label="item.columnComment"
<el-input v-model="form.fieldOldValue" /> :prop="item.columnName"
</el-form-item> :rules="[{ required: item.isRequired, message: item.columnComment + '不能为空' }]"
<el-form-item label="最新的值" prop="fieldNewValue"> >
<el-input v-model="form.fieldNewValue" /> <template v-if="item.htmlType === 'input'">
</el-form-item> <el-input
<el-form-item label="状态" prop="status"> v-model.trim="form[item.columnName]"
<el-radio-group v-model="form.status"> :placeholder="'请输入' + item.columnComment"
<el-radio :maxlength="parseInt(item.columnLength)"
v-for="dict in statusOptions" />
:key="dict.id" </template>
:label="dict.itemText" <template v-if="item.htmlType === 'textarea'">
>{{ dict.itemValue }}</el-radio> <el-input
</el-radio-group> type="textarea"
</el-form-item> v-model.trim="form[item.columnName]"
<el-form-item label="备注" prop="remark"> :placeholder="'请输入' + item.columnComment"
<el-input v-model="form.remark" type="textarea" /> :maxlength="parseInt(item.columnLength)"
/>
</template>
<template v-if="item.htmlType === 'number'">
<el-input-number
v-model.trim="form[item.columnName]"
:controls="false"
:precision="parseInt(item.columnScale)"
></el-input-number>
</template>
<template v-if="item.htmlType === 'datetime'">
<template v-if="item.columnType === 'date'">
<el-date-picker
v-model.trim="form[item.columnName]"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
type="date"
placeholder="选择日期"
></el-date-picker>
</template>
<template v-if="item.columnType === 'time'">
<el-time-picker
v-model="form[item.columnName]"
format="HH:mm:ss"
value-format="HH:mm:ss"
placeholder="选择时间点">
</el-time-picker>
</template>
<template v-if="item.columnType === 'year'">
<el-date-picker
v-model.trim="form[item.columnName]"
format="yyyy"
value-format="yyyy"
type="year"
placeholder="选择年份"
></el-date-picker>
</template>
<template v-if="item.columnType === '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>
</template>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
...@@ -35,8 +81,7 @@ ...@@ -35,8 +81,7 @@
</template> </template>
<script> <script>
import { getChangeRecord } from '@/api/metadata/changerecord' import { getFormParam } from '@/api/masterdata/datamodel'
import { getDataModel } from '@/api/masterdata/datamodel'
import { getData } from '@/api/masterdata/datamanage' import { getData } from '@/api/masterdata/datamanage'
export default { export default {
...@@ -61,22 +106,31 @@ export default { ...@@ -61,22 +106,31 @@ export default {
showDetail: false showDetail: false
}, },
// 表单参数 // 表单参数
form: {} form: {},
tableName: '',
columnList: []
} }
}, },
created() { created() {
console.log('id:' + this.data.id) console.log('data:' + this.data)
getFormParam(this.data.modelId).then(response => {
if (response.success) {
const { data } = response
this.tableName = data.tableName
this.columnList = data.columnList.filter(item => item.isDetail === '1')
}
})
}, },
mounted() { mounted() {
this.getChangeRecord(this.data.id) this.getData(this.data.id)
}, },
methods: { methods: {
showCard() { showCard() {
this.$emit('showCard', this.showOptions) this.$emit('showCard', this.showOptions)
}, },
/** 获取详情 */ /** 获取详情 */
getChangeRecord: function(id) { getData: function(id) {
getChangeRecord(id).then(response => { getData({ id: id, tableName: this.tableName }).then(response => {
if (response.success) { if (response.success) {
this.form = response.data this.form = response.data
} }
......
...@@ -8,15 +8,73 @@ ...@@ -8,15 +8,73 @@
</el-button-group> </el-button-group>
</div> </div>
<div class="body-wrapper"> <div class="body-wrapper">
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" :model="form" label-width="80px">
<el-form-item label="版本号" prop="version"> <el-form-item
<el-input v-model="form.version" placeholder="请输入版本号" /> v-for="(item, index) in columnList"
</el-form-item> :key="item.id"
<el-form-item label="原来的值" prop="fieldOldValue"> :label="item.columnComment"
<el-input v-model="form.fieldOldValue" placeholder="请输入原来的值" disabled /> :prop="item.columnName"
</el-form-item> :rules="[{ required: item.isRequired, message: item.columnComment + '不能为空' }]"
<el-form-item label="最新的值" prop="fieldNewValue"> >
<el-input v-model="form.fieldNewValue" placeholder="请输入最新的值" /> <template v-if="item.htmlType === 'input'">
<el-input
v-model.trim="form[item.columnName]"
:placeholder="'请输入' + item.columnComment"
:maxlength="parseInt(item.columnLength)"
/>
</template>
<template v-if="item.htmlType === 'textarea'">
<el-input
type="textarea"
v-model.trim="form[item.columnName]"
:placeholder="'请输入' + item.columnComment"
:maxlength="parseInt(item.columnLength)"
/>
</template>
<template v-if="item.htmlType === 'number'">
<el-input-number
v-model.trim="form[item.columnName]"
:controls="false"
:precision="parseInt(item.columnScale)"
></el-input-number>
</template>
<template v-if="item.htmlType === 'datetime'">
<template v-if="item.columnType === 'date'">
<el-date-picker
v-model.trim="form[item.columnName]"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
type="date"
placeholder="选择日期"
></el-date-picker>
</template>
<template v-if="item.columnType === 'time'">
<el-time-picker
v-model="form[item.columnName]"
format="HH:mm:ss"
value-format="HH:mm:ss"
placeholder="选择时间点">
</el-time-picker>
</template>
<template v-if="item.columnType === 'year'">
<el-date-picker
v-model.trim="form[item.columnName]"
format="yyyy"
value-format="yyyy"
type="year"
placeholder="选择年份"
></el-date-picker>
</template>
<template v-if="item.columnType === '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>
</template>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
...@@ -24,8 +82,7 @@ ...@@ -24,8 +82,7 @@
</template> </template>
<script> <script>
import { getChangeRecord, updateChangeRecord } from '@/api/metadata/changerecord' import { getFormParam } from '@/api/masterdata/datamodel'
import { getDataModel } from '@/api/masterdata/datamodel'
import { getData, updateData } from '@/api/masterdata/datamanage' import { getData, updateData } from '@/api/masterdata/datamanage'
export default { export default {
...@@ -57,44 +114,30 @@ export default { ...@@ -57,44 +114,30 @@ export default {
}, },
// 表单参数 // 表单参数
form: {}, form: {},
// 表单校验 tableName: '',
rules: { columnList: []
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() { created() {
console.log('data:' + this.data) console.log('data:' + this.data)
getDataModel(this.data.modelId).then(response => { getFormParam(this.data.modelId).then(response => {
if (response.success) { if (response.success) {
console.log(response) const { data } = response
this.tableName = data.tableName
this.columnList = data.columnList.filter(item => item.isEdit === '1')
} }
}) })
}, },
mounted() { mounted() {
// this.getChangeRecord(this.data.id) this.getData(this.data.id)
}, },
methods: { methods: {
showCard() { showCard() {
this.$emit('showCard', this.showOptions) this.$emit('showCard', this.showOptions)
}, },
/** 获取详情 */ /** 获取详情 */
getChangeRecord: function(id) { getData: function(id) {
getChangeRecord(id).then(response => { getData({ id: id, tableName: this.tableName }).then(response => {
if (response.success) { if (response.success) {
this.form = response.data this.form = response.data
} }
...@@ -104,10 +147,11 @@ export default { ...@@ -104,10 +147,11 @@ export default {
submitForm: function() { submitForm: function() {
this.$refs['form'].validate(valid => { this.$refs['form'].validate(valid => {
if (valid) { if (valid) {
const data = { id: this.data.id, tableName: this.tableName, datas: this.form }
this.loadingOptions.loading = true this.loadingOptions.loading = true
this.loadingOptions.loadingText = '保存中...' this.loadingOptions.loadingText = '保存中...'
this.loadingOptions.isDisabled = true this.loadingOptions.isDisabled = true
updateChangeRecord(this.form).then(response => { updateData(data).then(response => {
if (response.success) { if (response.success) {
this.$message.success('保存成功') this.$message.success('保存成功')
setTimeout(() => { setTimeout(() => {
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="字段属性" name="second"> <el-tab-pane label="字段属性" name="second">
<el-button type="primary" @click="addRow">添加</el-button> <el-button type="primary" @click="addRow">添加</el-button>
<el-form ref="table" :model="form" :rules="rules" size="mini"> <el-form ref="secondTable" :model="form" :rules="rules" size="mini">
<el-table :data="form.modelColumns" border style="width: 100%; margin: 15px 0;"> <el-table :data="form.modelColumns" border style="width: 100%; margin: 15px 0;">
<el-table-column label="序号" type="index" align="center" width="55" /> <el-table-column label="序号" type="index" align="center" width="55" />
<el-table-column label="列名称"> <el-table-column label="列名称">
...@@ -99,6 +99,36 @@ ...@@ -99,6 +99,36 @@
</el-form-item> </el-form-item>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center">
<template slot-scope="scope">
<el-form-item>
<el-button :disabled="scope.row.isSystem === '1' || scope.$index < 8" icon="el-icon-arrow-up" circle @click="upRow(scope.$index)" />
<el-button :disabled="scope.row.isSystem === '1' || scope.$index === (form.modelColumns.length - 1)" icon="el-icon-arrow-down" circle @click="downRow(scope.$index)" />
<el-button :disabled="scope.row.isSystem === '1'" icon="el-icon-delete" circle @click="delRow(scope.$index)" />
</el-form-item>
</template>
</el-table-column>
</el-table>
</el-form>
</el-tab-pane>
<el-tab-pane label="页面属性" name="third">
<el-form ref="thirdTable" :model="form" :rules="rules" size="mini">
<el-table :data="form.modelColumns" border style="width: 100%; margin: 15px 0;">
<el-table-column label="序号" type="index" align="center" width="55" />
<el-table-column label="列名称">
<template slot-scope="scope">
<el-form-item>
<el-input :disabled="true" v-model="scope.row.columnName" />
</el-form-item>
</template>
</el-table-column>
<el-table-column label="列描述">
<template slot-scope="scope">
<el-form-item>
<el-input :disabled="true" v-model="scope.row.columnComment" />
</el-form-item>
</template>
</el-table-column>
<el-table-column label="插入" align="center" width="55"> <el-table-column label="插入" align="center" width="55">
<template slot-scope="scope"> <template slot-scope="scope">
<el-form-item :prop="'modelColumns.' + scope.$index + '.isInsert'"> <el-form-item :prop="'modelColumns.' + scope.$index + '.isInsert'">
...@@ -113,6 +143,13 @@ ...@@ -113,6 +143,13 @@
</el-form-item> </el-form-item>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="详情" align="center" width="55">
<template slot-scope="scope">
<el-form-item :prop="'modelColumns.' + scope.$index + '.isDetail'">
<el-checkbox :disabled="scope.row.isSystem === '1'" v-model="scope.row.isDetail" true-label="1" false-label="0" />
</el-form-item>
</template>
</el-table-column>
<el-table-column label="列表" align="center" width="55"> <el-table-column label="列表" align="center" width="55">
<template slot-scope="scope"> <template slot-scope="scope">
<el-form-item :prop="'modelColumns.' + scope.$index + '.isList'"> <el-form-item :prop="'modelColumns.' + scope.$index + '.isList'">
...@@ -155,22 +192,13 @@ ...@@ -155,22 +192,13 @@
</el-form-item> </el-form-item>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center">
<template slot-scope="scope">
<el-form-item>
<el-button :disabled="scope.row.isSystem === '1' || scope.$index < 8" icon="el-icon-arrow-up" circle @click="upRow(scope.$index)" />
<el-button :disabled="scope.row.isSystem === '1' || scope.$index === (form.modelColumns.length - 1)" icon="el-icon-arrow-down" circle @click="downRow(scope.$index)" />
<el-button :disabled="scope.row.isSystem === '1'" icon="el-icon-delete" circle @click="delRow(scope.$index)" />
</el-form-item>
</template>
</el-table-column>
</el-table> </el-table>
</el-form> </el-form>
</el-tab-pane> </el-tab-pane>
<!-- <el-tab-pane label="唯一约束" name="fourth">唯一约束</el-tab-pane>--> <!-- <el-tab-pane label="索引" name="fourth">索引</el-tab-pane>-->
<!-- <el-tab-pane label="条件约束" name="fifth">条件约束</el-tab-pane>--> <!-- <el-tab-pane label="唯一约束" name="fifth">唯一约束</el-tab-pane>-->
<!-- <el-tab-pane label="外键约束" name="sixth">外键约束</el-tab-pane>--> <!-- <el-tab-pane label="条件约束" name="sixth">条件约束</el-tab-pane>-->
<!-- <el-tab-pane label="索引" name="seventh">索引</el-tab-pane>--> <!-- <el-tab-pane label="外键约束" name="seventh">外键约束</el-tab-pane>-->
</el-tabs> </el-tabs>
</div> </div>
</el-card> </el-card>
...@@ -243,13 +271,13 @@ export default { ...@@ -243,13 +271,13 @@ export default {
htmlTypeOptions: [], htmlTypeOptions: [],
// 系统默认列 // 系统默认列
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', isDetail: '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: 'status', columnComment: '状态(0禁用,1启用)', columnType: 'tinyint', columnLength: '0', columnScale: '0', defaultValue: '1', isPk: '0', isRequired: '0', isInsert: '0', isEdit: '0', isDetail: '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', isDetail: '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_time', columnComment: '创建日期', columnType: 'datetime', columnLength: '0', columnScale: '0', defaultValue: '', isPk: '0', isRequired: '0', isInsert: '0', isEdit: '0', isDetail: '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', isDetail: '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', isDetail: '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' } { columnName: 'update_time', columnComment: '更新日期', columnType: 'datetime', columnLength: '0', columnScale: '0', defaultValue: '', isPk: '0', isRequired: '0', isInsert: '0', isEdit: '0', isDetail: '0', isList: '0', isQuery: '0', queryType: '', htmlType: 'datetime', isSystem: '1' }
] ]
} }
}, },
...@@ -295,6 +323,7 @@ export default { ...@@ -295,6 +323,7 @@ export default {
isRequired: '1', isRequired: '1',
isInsert: '1', isInsert: '1',
isEdit: '1', isEdit: '1',
isDetail: '1',
isList: '1', isList: '1',
isQuery: '0', isQuery: '0',
queryType: '', queryType: '',
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
</el-form> </el-form>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="字段信息" name="second"> <el-tab-pane label="字段信息" name="second">
<el-form ref="table" :model="form" size="mini" disabled> <el-form ref="secondTable" :model="form" size="mini" disabled>
<el-table :data="form.modelColumns" border style="width: 100%; margin: 15px 0;"> <el-table :data="form.modelColumns" border style="width: 100%; margin: 15px 0;">
<el-table-column label="序号" type="index" align="center" width="55" /> <el-table-column label="序号" type="index" align="center" width="55" />
<el-table-column label="列名称"> <el-table-column label="列名称">
...@@ -101,6 +101,27 @@ ...@@ -101,6 +101,27 @@
</el-form-item> </el-form-item>
</template> </template>
</el-table-column> </el-table-column>
</el-table>
</el-form>
</el-tab-pane>
<el-tab-pane label="页面属性" name="third">
<el-form ref="thirdTable" :model="form" size="mini">
<el-table :data="form.modelColumns" border style="width: 100%; margin: 15px 0;">
<el-table-column label="序号" type="index" align="center" width="55" />
<el-table-column label="列名称">
<template slot-scope="scope">
<el-form-item>
<el-input v-model="scope.row.columnName" clearable placeholder="请输入列名称" />
</el-form-item>
</template>
</el-table-column>
<el-table-column label="列描述">
<template slot-scope="scope">
<el-form-item>
<el-input v-model="scope.row.columnComment" clearable placeholder="请输入列描述" />
</el-form-item>
</template>
</el-table-column>
<el-table-column label="插入" align="center" width="55"> <el-table-column label="插入" align="center" width="55">
<template slot-scope="scope"> <template slot-scope="scope">
<el-form-item> <el-form-item>
...@@ -115,6 +136,13 @@ ...@@ -115,6 +136,13 @@
</el-form-item> </el-form-item>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="详情" align="center" width="55">
<template slot-scope="scope">
<el-form-item>
<el-checkbox v-model="scope.row.isDetail" true-label="1" false-label="0" />
</el-form-item>
</template>
</el-table-column>
<el-table-column label="列表" align="center" width="55"> <el-table-column label="列表" align="center" width="55">
<template slot-scope="scope"> <template slot-scope="scope">
<el-form-item> <el-form-item>
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="字段信息" name="second"> <el-tab-pane label="字段信息" name="second">
<el-button type="primary" @click="addRow">添加</el-button> <el-button type="primary" @click="addRow">添加</el-button>
<el-form ref="table" :model="form" :rules="rules" size="mini"> <el-form ref="secondTable" :model="form" :rules="rules" size="mini">
<el-table :data="form.modelColumns" border style="width: 100%; margin: 15px 0;"> <el-table :data="form.modelColumns" border style="width: 100%; margin: 15px 0;">
<el-table-column label="序号" type="index" align="center" width="55" /> <el-table-column label="序号" type="index" align="center" width="55" />
<el-table-column label="列名称"> <el-table-column label="列名称">
...@@ -99,6 +99,36 @@ ...@@ -99,6 +99,36 @@
</el-form-item> </el-form-item>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center">
<template slot-scope="scope">
<el-form-item>
<el-button :disabled="scope.row.isSystem === '1' || scope.$index < 8" icon="el-icon-arrow-up" circle @click="upRow(scope.$index)" />
<el-button :disabled="scope.row.isSystem === '1' || scope.$index === (form.modelColumns.length - 1)" icon="el-icon-arrow-down" circle @click="downRow(scope.$index)" />
<el-button :disabled="scope.row.isSystem === '1'" icon="el-icon-delete" circle @click="delRow(scope.$index)" />
</el-form-item>
</template>
</el-table-column>
</el-table>
</el-form>
</el-tab-pane>
<el-tab-pane label="页面属性" name="third">
<el-form ref="thirdTable" :model="form" :rules="rules" size="mini">
<el-table :data="form.modelColumns" border style="width: 100%; margin: 15px 0;">
<el-table-column label="序号" type="index" align="center" width="55" />
<el-table-column label="列名称">
<template slot-scope="scope">
<el-form-item>
<el-input :disabled="true" v-model="scope.row.columnName" />
</el-form-item>
</template>
</el-table-column>
<el-table-column label="列描述">
<template slot-scope="scope">
<el-form-item>
<el-input :disabled="true" v-model="scope.row.columnComment" />
</el-form-item>
</template>
</el-table-column>
<el-table-column label="插入" align="center" width="55"> <el-table-column label="插入" align="center" width="55">
<template slot-scope="scope"> <template slot-scope="scope">
<el-form-item :prop="'modelColumns.' + scope.$index + '.isInsert'"> <el-form-item :prop="'modelColumns.' + scope.$index + '.isInsert'">
...@@ -113,6 +143,13 @@ ...@@ -113,6 +143,13 @@
</el-form-item> </el-form-item>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="详情" align="center" width="55">
<template slot-scope="scope">
<el-form-item :prop="'modelColumns.' + scope.$index + '.isDetail'">
<el-checkbox :disabled="scope.row.isSystem === '1'" v-model="scope.row.isDetail" true-label="1" false-label="0" />
</el-form-item>
</template>
</el-table-column>
<el-table-column label="列表" align="center" width="55"> <el-table-column label="列表" align="center" width="55">
<template slot-scope="scope"> <template slot-scope="scope">
<el-form-item :prop="'modelColumns.' + scope.$index + '.isList'"> <el-form-item :prop="'modelColumns.' + scope.$index + '.isList'">
...@@ -155,15 +192,6 @@ ...@@ -155,15 +192,6 @@
</el-form-item> </el-form-item>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center">
<template slot-scope="scope">
<el-form-item>
<el-button :disabled="scope.row.isSystem === '1' || scope.$index < 8" icon="el-icon-arrow-up" circle @click="upRow(scope.$index)" />
<el-button :disabled="scope.row.isSystem === '1' || scope.$index === (form.modelColumns.length - 1)" icon="el-icon-arrow-down" circle @click="downRow(scope.$index)" />
<el-button :disabled="scope.row.isSystem === '1'" icon="el-icon-delete" circle @click="delRow(scope.$index)" />
</el-form-item>
</template>
</el-table-column>
</el-table> </el-table>
</el-form> </el-form>
</el-tab-pane> </el-tab-pane>
...@@ -284,6 +312,7 @@ export default { ...@@ -284,6 +312,7 @@ export default {
isRequired: '1', isRequired: '1',
isInsert: '1', isInsert: '1',
isEdit: '1', isEdit: '1',
isDetail: '1',
isList: '1', isList: '1',
isQuery: '0', isQuery: '0',
queryType: '', queryType: '',
......
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