表单
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
</template>
|
||||
<template #content v-if="refresh">
|
||||
<baseInfo ref="baseInfo" :instance="instance" :dict="dict" v-show="activeStep==0"/>
|
||||
<applyForm ref="applyForm" :instance="instance" :dict="dict" v-show="activeStep==1"/>
|
||||
<applyForm ref="applyForm" :value="filedList" :instance="instance" :dict="dict" v-show="activeStep==1"/>
|
||||
<attachmentMaterial ref="attachmentMaterial" :instance="instance" v-show="activeStep==2"/>
|
||||
<processApproval ref="processApproval" :approvalSteps="applyForm.approvalSteps" :instance="instance"
|
||||
:dict="dict" v-show="activeStep==3"/>
|
||||
@@ -52,8 +52,11 @@ export default {
|
||||
approvalSteps: "",
|
||||
},
|
||||
processAnnexDefs: [],
|
||||
detailObj: {},
|
||||
detailObj: {
|
||||
tableInfo: {}
|
||||
},
|
||||
refresh: true,
|
||||
filedList: [],
|
||||
tableFieldInfos: []
|
||||
}
|
||||
},
|
||||
@@ -120,6 +123,7 @@ export default {
|
||||
...this.baseInfo,
|
||||
processDefStatus: Number(this.baseInfo.processDefStatus),
|
||||
tableInfo: {
|
||||
...this.detailObj.tableInfo,
|
||||
tableFieldInfos: this.tableFieldInfos
|
||||
},
|
||||
tableType: 0,
|
||||
@@ -140,6 +144,7 @@ export default {
|
||||
this.instance.post(`/app/approval-process-def/info-id`, null, {params: {id}}).then(res => {
|
||||
if (res?.data) {
|
||||
this.detailObj = res.data
|
||||
this.filedList = res.data.tableInfo.tableFieldInfos
|
||||
this.refreshDetail()
|
||||
}
|
||||
})
|
||||
|
||||
@@ -66,54 +66,32 @@
|
||||
<span>删除字段</span>
|
||||
</div>
|
||||
<el-form-item style="width: 100%;" :label="item.fieldName" :rules="[{ required: item.mustFill === '1' ? true : false }]">
|
||||
<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 v-if="item.fieldDataType === '1'">
|
||||
<el-input :disabled="item.disable === '1'" size="small" placeholder="请输入" v-model="item.defaultValue"></el-input>
|
||||
</template>
|
||||
<template v-if="item.type === 'radio'">
|
||||
<template v-if="item.fieldDataType === '4'">
|
||||
<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>
|
||||
</el-radio-group>
|
||||
</template>
|
||||
<template v-if="item.type === 'number'">
|
||||
<template v-if="item.fieldDataType === '0'">
|
||||
<el-input-number style="width: 100%;" v-model="item.defaultValue" :placeholder="item.fieldTips"></el-input-number>
|
||||
</template>
|
||||
<template v-if="item.type === 'rtf'">
|
||||
<ai-editor v-model="item.defaultValue" :placeholder="item.fieldTips" :instance="instance"/>
|
||||
</template>
|
||||
<template v-if="item.type === 'time'">
|
||||
<template v-if="item.fieldDataType === '3'">
|
||||
<el-date-picker
|
||||
v-model="item.defaultValue"
|
||||
size="small"
|
||||
:placeholder="item.fieldTips">
|
||||
</el-date-picker>
|
||||
</template>
|
||||
<template v-if="item.type === 'date'">
|
||||
<template v-if="item.fieldDataType === '8'">
|
||||
<el-date-picker
|
||||
v-model="item.defaultValue"
|
||||
size="small"
|
||||
:placeholder="item.fieldTips">
|
||||
</el-date-picker>
|
||||
</template>
|
||||
<template v-if="item.type === 'datetime'">
|
||||
<el-date-picker
|
||||
v-model="item.defaultValue"
|
||||
size="small"
|
||||
:placeholder="item.fieldTips">
|
||||
</el-date-picker>
|
||||
</template>
|
||||
<template v-if="item.type === 'onOff'">
|
||||
<el-switch active-value="1" inactive-value="0" v-model="item.defaultValue"></el-switch>
|
||||
</template>
|
||||
<template v-if="['input', 'phone', 'name', 'idNumber'].includes(item.type)">
|
||||
<el-input :disabled="item.disable === '1'" :maxlength="Number(item.maxLength)" size="small" :placeholder="item.fieldTips" v-model="item.defaultValue"></el-input>
|
||||
</template>
|
||||
<template v-if="item.type === 'area'">
|
||||
<ai-area-get
|
||||
:instance="instance"
|
||||
always-show
|
||||
/>
|
||||
</template>
|
||||
<template v-if="item.type === 'select'">
|
||||
<template v-if="item.fieldDataType === '9'">
|
||||
<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"
|
||||
@@ -123,17 +101,11 @@
|
||||
</el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
<template v-if="item.type === 'checkbox'" >
|
||||
<template v-if="item.fieldDataType === '5'" >
|
||||
<el-checkbox-group v-model="item.defaultValue" :disabled="item.disable === '1'">
|
||||
<el-checkbox :label="field.label" v-for="(field, index) in item.options" :key="index">{{ field.label }}</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</template>
|
||||
<template v-if="item.type === 'upload'">
|
||||
<div class="left-item__item--upload">
|
||||
<i class="iconfont iconAdd"></i>
|
||||
<span>添加附件</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</draggable>
|
||||
@@ -190,7 +162,7 @@
|
||||
<h2>最多输入字符</h2>
|
||||
</div>
|
||||
<div class="right-item__content">
|
||||
<el-input placeholder="字符个数" v-model="currTarget.maxLength">
|
||||
<el-input placeholder="字符个数" v-model="currTarget.fieldLength">
|
||||
<span slot="append">个</span>
|
||||
</el-input>
|
||||
</div>
|
||||
@@ -215,17 +187,11 @@
|
||||
export default {
|
||||
name: 'applyForm',
|
||||
|
||||
model: {
|
||||
prop: 'value',
|
||||
event: 'change',
|
||||
},
|
||||
|
||||
props: {
|
||||
instance: Function,
|
||||
dict: Object,
|
||||
params: Object,
|
||||
type: String,
|
||||
areaId: String,
|
||||
value: Array
|
||||
},
|
||||
|
||||
@@ -252,43 +218,17 @@
|
||||
},
|
||||
|
||||
watch: {
|
||||
value (v) {
|
||||
if (v) {
|
||||
let arr = JSON.parse(JSON.stringify(v))
|
||||
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 (['9', '4', '5'].includes(item.fieldDataType)) {
|
||||
item.options = item.selectValues.split('`').map(v => {
|
||||
return {
|
||||
label: v,
|
||||
value: ''
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (item.grid) {
|
||||
item.grid = Number(item.grid)
|
||||
}
|
||||
|
||||
return item
|
||||
})
|
||||
|
||||
return {
|
||||
type: 'group',
|
||||
fieldName: '卡片',
|
||||
fixedLabel: '卡片',
|
||||
icon: 'iconpic',
|
||||
groupName,
|
||||
column: column
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
activeIndex () {
|
||||
if (this.activeIndex > -1 && this.groupIndex > -1 && !this.isGroup) {
|
||||
const filed = this.targetList[this.groupIndex].column[this.activeIndex]
|
||||
this.currTarget = filed
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
if (this.groupIndex > -1 && this.isGroup) {
|
||||
this.currTarget = this.targetList[this.groupIndex]
|
||||
this.currTarget = this.targetList[this.groupIndex].column[this.activeIndex]
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
@@ -312,13 +252,8 @@
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
currComponentTitle () {
|
||||
return '表单设置'
|
||||
}
|
||||
},
|
||||
|
||||
mounted () {
|
||||
this.init()
|
||||
},
|
||||
|
||||
methods: {
|
||||
@@ -328,6 +263,39 @@
|
||||
this.targetList[j].column.splice(i, 1)
|
||||
},
|
||||
|
||||
init () {
|
||||
if (this.value.length) {
|
||||
let arr = this.value
|
||||
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 (['9', '4', '5'].includes(item.fieldDataType)) {
|
||||
item.options = item.selectValues.split('`').map(v => {
|
||||
return {
|
||||
label: v,
|
||||
value: ''
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return {
|
||||
...item,
|
||||
grid: 1
|
||||
}
|
||||
})
|
||||
|
||||
return {
|
||||
type: 'group',
|
||||
fieldName: '卡片',
|
||||
fixedLabel: '卡片',
|
||||
icon: 'iconpic',
|
||||
groupName,
|
||||
column: column
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
removeGroup () {
|
||||
if (this.targetList.length === 1) {
|
||||
return this.$message.error('分组不能小于1')
|
||||
@@ -348,13 +316,11 @@
|
||||
onConfirm () {
|
||||
let result = []
|
||||
this.targetList.forEach((group, i) => {
|
||||
group.column.forEach((item, index) => {
|
||||
group.column.forEach(item => {
|
||||
result.push({
|
||||
...item,
|
||||
groupIndex: i,
|
||||
fieldLength: item.maxLength,
|
||||
groupName: group.groupName,
|
||||
fieldDbName: this.isUnique(item.type) ? item.type : `${item.type}${i}${index}`,
|
||||
selectValues: item.options ? item.options.map(v => v.label).join('`') : ''
|
||||
})
|
||||
})
|
||||
@@ -365,12 +331,6 @@
|
||||
})
|
||||
},
|
||||
|
||||
isUnique (type) {
|
||||
const list = this.components[0].children.map(v => v.type)
|
||||
|
||||
return list.indexOf(type) > -1
|
||||
},
|
||||
|
||||
addOptions () {
|
||||
const len = this.targetList[this.groupIndex].column[this.activeIndex].options.length
|
||||
let label = `选项${len + 1}`
|
||||
|
||||
@@ -15,7 +15,7 @@ export const components = [
|
||||
defaultValue: '',
|
||||
icon: 'icontext_box',
|
||||
mustFill: '1',
|
||||
maxLength: 20
|
||||
fieldLength: 20
|
||||
},
|
||||
{
|
||||
type: 'idNumber',
|
||||
@@ -25,7 +25,7 @@ export const components = [
|
||||
defaultValue: '',
|
||||
icon: 'icontext_area',
|
||||
mustFill: '1',
|
||||
maxLength: 20,
|
||||
fieldLength: 20,
|
||||
disable: '0',
|
||||
grid: 1,
|
||||
fieldDataType: '1',
|
||||
@@ -39,7 +39,7 @@ export const components = [
|
||||
defaultValue: '',
|
||||
icon: 'icontext_area',
|
||||
mustFill: '1',
|
||||
maxLength: 11,
|
||||
fieldLength: 11,
|
||||
disable: '0',
|
||||
grid: 1,
|
||||
fieldDataType: '1',
|
||||
@@ -165,7 +165,7 @@ export const components = [
|
||||
defaultValue: '',
|
||||
icon: 'icontext_box',
|
||||
mustFill: '1',
|
||||
maxLength: 50
|
||||
fieldLength: 50
|
||||
},
|
||||
{
|
||||
type: 'number',
|
||||
@@ -179,7 +179,7 @@ export const components = [
|
||||
decimalPlaces: 0,
|
||||
fieldDataType: '0',
|
||||
minValue: 0,
|
||||
maxLength: 500,
|
||||
fieldLength: 50,
|
||||
disable: '0',
|
||||
grid: 1,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user