配置表单
This commit is contained in:
2
packages/2.0.5/AppForm/components/Add.vue
vendored
2
packages/2.0.5/AppForm/components/Add.vue
vendored
@@ -16,7 +16,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<basic-info ref="basicInfo" v-model="basicInfo" v-show="currIndex === 0" :dict="dict" :instance="instance"></basic-info>
|
||||
<form-layout class="form-config__wrapper" v-model="tableInfos" ref="form" v-show="currIndex === 1" :dict="dict" :instance="instance"></form-layout>
|
||||
<form-layout :appType="basicInfo.appType" class="form-config__wrapper" v-model="tableInfos" ref="form" v-if="currIndex === 1" :dict="dict" :instance="instance"></form-layout>
|
||||
<form-config
|
||||
ref="config"
|
||||
:showListFields="showListFields"
|
||||
|
||||
81
packages/2.0.5/AppForm/components/FormLayout.vue
vendored
81
packages/2.0.5/AppForm/components/FormLayout.vue
vendored
@@ -51,6 +51,7 @@
|
||||
scroll
|
||||
@end="onElEnd"
|
||||
element="div"
|
||||
filter=".components-filter"
|
||||
draggable=".components-item"
|
||||
group="componentsGroup"
|
||||
:sort="true">
|
||||
@@ -58,10 +59,13 @@
|
||||
class="components-item"
|
||||
v-for="(item, i) in group.column"
|
||||
:style="{width: item.grid * 100 + '%'}"
|
||||
:class="[groupIndex === j && activeIndex === i ? 'active' : '']"
|
||||
:class="{
|
||||
'components-filter': item.isInit === '1',
|
||||
'active': groupIndex === j && activeIndex === i
|
||||
}"
|
||||
@click.stop="groupIndex = j, activeIndex = i, isGroup = false"
|
||||
:key="i">
|
||||
<div class="left-item__item--remove" title="删除字段" v-show="groupIndex === j && activeIndex === i" @click.stop="removeItem(j, i)">
|
||||
<div class="left-item__item--remove" title="删除字段" v-show="item.isInit !== '1' && groupIndex === j && activeIndex === i" @click.stop="removeItem(j, i)">
|
||||
<i class="iconfont iconDelete"></i>
|
||||
<span>删除字段</span>
|
||||
</div>
|
||||
@@ -69,6 +73,16 @@
|
||||
<template v-if="(item.type === 'textarea')">
|
||||
<el-input :disabled="item.disable === '1'" :rows="item.lineNumber" size="small" type="textarea" :placeholder="item.fieldTips" v-model="item.defaultValue"></el-input>
|
||||
</template>
|
||||
<template v-if="(item.type === 'resident')">
|
||||
<el-input :disabled="item.disable === '1'" size="small" placeholder="请选择人员" v-model="item.defaultValue">
|
||||
<template slot="append">选择人员</template>
|
||||
</el-input>
|
||||
</template>
|
||||
<template v-if="(item.type === 'gird')">
|
||||
<el-input :disabled="item.disable === '1'" size="small" placeholder="请选择网格" v-model="item.defaultValue">
|
||||
<template slot="append">选择网格</template>
|
||||
</el-input>
|
||||
</template>
|
||||
<template v-if="item.type === 'radio'">
|
||||
<el-radio-group v-model="item.defaultValue" :disabled="item.disable === '1'">
|
||||
<el-radio :label="field.label" v-for="(field, index) in item.options" :key="index">{{ field.label }}</el-radio>
|
||||
@@ -110,11 +124,10 @@
|
||||
<template v-if="item.type === 'area'">
|
||||
<ai-area-get
|
||||
:instance="instance"
|
||||
always-show
|
||||
/>
|
||||
always-show />
|
||||
</template>
|
||||
<template v-if="item.type === 'select'">
|
||||
<el-select :disabled="item.disable === '1'" size="small" :placeholder="item.fieldTips" v-model="item.defaultValue">
|
||||
<el-select :disabled="item.disable === '1'" style="width: 100%;" size="small" :placeholder="item.fieldTips" v-model="item.defaultValue">
|
||||
<el-option
|
||||
v-for="(filed, index) in item.options"
|
||||
:key="index"
|
||||
@@ -153,7 +166,7 @@
|
||||
<el-input placeholder="请输入分组名称" :maxlength="32" show-word-limit v-model="currTarget.groupName"></el-input>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layout-right__del" @click="removeGroup" v-if="isGroup && targetList.length > 1">
|
||||
<div class="layout-right__del" @click="removeGroup" v-if="isGroup && targetList.length > 1 && currTarget.isInit !== '1'">
|
||||
<span>删除分组</span>
|
||||
</div>
|
||||
<div class="right-item" v-if="activeIndex > -1">
|
||||
@@ -360,7 +373,8 @@
|
||||
params: Object,
|
||||
type: String,
|
||||
areaId: String,
|
||||
value: Array
|
||||
value: Array,
|
||||
appType: String
|
||||
},
|
||||
|
||||
components: {
|
||||
@@ -483,6 +497,9 @@
|
||||
},
|
||||
|
||||
mounted () {
|
||||
if (this.appType && !this.value.length) {
|
||||
this.getInitFileds()
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
@@ -509,6 +526,56 @@
|
||||
})
|
||||
},
|
||||
|
||||
getInitFileds () {
|
||||
this.instance.post(`/app/appapplicationinfo/queryInitTable?appType=${this.appType}`).then(res => {
|
||||
if (res.code === 0) {
|
||||
let arr = res.data
|
||||
let groups = this.unique(arr.map(v => v.groupName))
|
||||
this.targetList = groups.map(groupName => {
|
||||
const column = arr.filter(v => v.groupName === groupName).map(item => {
|
||||
if (['select', 'checkbox', 'radio'].includes(item.type)) {
|
||||
item.options = item.selectValues.split('`').map(v => {
|
||||
return {
|
||||
label: v,
|
||||
value: ''
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (item.type === 'checkbox' && item.defaultValue) {
|
||||
item.defaultValue = item.defaultValue.split('`')
|
||||
}
|
||||
|
||||
if (item.grid) {
|
||||
item.grid = Number(item.grid)
|
||||
}
|
||||
|
||||
return item
|
||||
})
|
||||
|
||||
return {
|
||||
type: 'group',
|
||||
fieldName: '卡片',
|
||||
fixedLabel: '卡片',
|
||||
icon: 'iconpic',
|
||||
groupName,
|
||||
column: column,
|
||||
isInit: '1'
|
||||
}
|
||||
})
|
||||
|
||||
this.targetList.push({
|
||||
type: 'group',
|
||||
fieldName: '卡片',
|
||||
fixedLabel: '卡片',
|
||||
icon: 'iconpic',
|
||||
groupName: '基础信息',
|
||||
column: []
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
onConfirm () {
|
||||
let result = []
|
||||
this.targetList.forEach((group, i) => {
|
||||
|
||||
Reference in New Issue
Block a user