lb #1

Merged
gtz217 merged 128 commits from lb into develop 2022-09-20 14:53:17 +08:00
2 changed files with 14 additions and 20 deletions
Showing only changes of commit c1e152405d - Show all commits

View File

@ -58,7 +58,14 @@
/>
<div v-else style="background: #eee; border-radius: 8px; height: 200px;">
<el-row>
<el-form ref="AttrForm" :model="AttrForm" :rules="AttrFormRules"></el-form>
<el-form ref="AttrForm" :model="AttrForm" :rules="AttrFormRules">
<el-form-item v-for="field in attrFormFields" :key="field.prop" :prop="field.prop" :label="field.name">
<!-- 子窗口只给input吧太麻烦了有特殊需求就不用这个组件了 -->
<el-input v-model="AttrForm[field.prop]" clearable />
<!-- TODO: mounted里初始化AttrFormconfigs里设置AttrFormRulesmounted里设置attrFormFields -->
<!-- TODO: 单独用一个组件来展示动态属性这一部分 -->
</el-form-item>
</el-form>
</el-row>
<el-row>
<el-button size="small" @click="showAddAttr = false">取消</el-button>
@ -122,6 +129,7 @@ export default {
props: {
configs: {
/**
* TODO: 定义及使用方式应改用README.md文件记录
* type: 'dialog' | 'drawer' | 'page'
* fields: Array<string|object>
* - fields.object: { name, type: 'number'|'textarea'|'select'|'date'|.., required: boolean, validator: boolean(是否需要验证), [options]: any[], api: string(自动获取数据的接口一般为getcode接口)}
@ -161,7 +169,8 @@ export default {
// add more...
},
defaultPlaceholders: {}, // defaultNames
/** 表单相关属性 */
/** 表单相关属性 */
visible: false,
isEdit: false,
isDetail: false,
@ -254,27 +263,12 @@ export default {
/** 单独设置 id */
this.$set(this.dataForm, 'id', null)
// TODOdelete next lines
console.log('dataform: ', this.dataForm)
console.log('rules: ', this.dataFormRules)
})
},
updated() {
this.isUpdated = true // emit(refreshDataList)
},
// beforeDestroy() {
//
// localStoragedataForm
// emit
//
// localStorage
// if (cached && compareCache(this.dataForm, localStorage...) || !isEdit) {
// // emit
// clearCache()
// this.$emit('refreshDataList')
// }
// },
methods: {
getLabel(n, c) {
const opt = this.configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)]

View File

@ -161,8 +161,8 @@ const addOrUpdateConfigs = {
tableConfigs: [
{ type: 'index', name: '序号' },
{ prop: 'createTime', name: '添加时间', filter: val => (val ? moment(val).format('YYYY-MM-DD hh:mm:ss') : '-') },
{ prop: 'name', name: '属性名' },
{ prop: 'code', name: '属性值' },
{ prop: 'name', name: '属性名', formField: true },
{ prop: 'code', name: '属性值', formField: true },
{ prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
]
}