This commit is contained in:
g7hoo 2022-08-10 17:01:51 +08:00
부모 c435901f3b
커밋 c1e152405d
2개의 변경된 파일14개의 추가작업 그리고 20개의 파일을 삭제

파일 보기

@ -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)]

파일 보기

@ -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'] }
]
}