|
|
@ -1,7 +1,7 @@ |
|
|
|
<template> |
|
|
|
<div class="preview-content right-preview"> |
|
|
|
<el-row :gutter="4"> |
|
|
|
<el-form ref="addOrUpdateForm" :model="addOrUpdateForm" :rules="rules" label-width="120px"> |
|
|
|
<el-form ref="addOrUpdateForm" :model="addOrUpdateForm" :rules="rules" :validate-on-rule-change="false" label-width="120px"> |
|
|
|
<draggable v-bind="{draggable:'.drag-item',animation:500}" :disabled="!isDisabled" @update="datadragEnd"> |
|
|
|
<el-col v-for="(item,index) in formPreviewData" :key="index" class="drag-item" :span="item.isLine ? 24 : 12"> |
|
|
|
<el-form-item :label="item.fieldCnName" :prop="item.fieldName"> |
|
|
@ -140,8 +140,8 @@ export default { |
|
|
|
// 获取对应字典子集数据 |
|
|
|
getAllSubset() { |
|
|
|
this.formPreviewData.map(item => { |
|
|
|
this.$set(item, 'options', []) |
|
|
|
if (item.dictionaryConfigId) { |
|
|
|
this.$set(item, 'options', []) |
|
|
|
FetchFindAllSubsetById({ id: item.dictionaryConfigId.id }).then(res => { |
|
|
|
if (item.isInputClass === 'select') { |
|
|
|
this.$set(item, 'options', res) |
|
|
@ -182,7 +182,6 @@ export default { |
|
|
|
// tree - select |
|
|
|
selectTree(val) { |
|
|
|
this.addOrUpdateForm[this.treeCurrentFiled.fieldName] = val.dicName |
|
|
|
this.getAllSubset() |
|
|
|
// 自动重复字段 - 是否重复 - treeSelect方式 |
|
|
|
if (this.treeCurrentFiled.isRepeat) { |
|
|
|
const params = { |
|
|
@ -212,13 +211,12 @@ export default { |
|
|
|
this.popoverVisible = true |
|
|
|
this.currentFieldName = item.fieldName |
|
|
|
this.tableData = [] |
|
|
|
this.getAllSubset() |
|
|
|
}, |
|
|
|
// 动态生成表单 |
|
|
|
editFormRow() { |
|
|
|
this.rules = {} |
|
|
|
this.formPreviewData.map(item => { |
|
|
|
this.$set(this.addOrUpdateForm, item.fieldName, '') |
|
|
|
// this.$set(this.addOrUpdateForm, item.fieldName, '') |
|
|
|
if (item.isInputClass === 'select') { |
|
|
|
this.$set(this.addOrUpdateForm, item.fieldName, null) // 防止unkonwn |
|
|
|
} |
|
|
@ -251,6 +249,13 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
const parent_id = this.selectedCategory.pid |
|
|
|
if (parseInt(parent_id) === 0) { |
|
|
|
this.addOrUpdateForm.parent_id = null |
|
|
|
} else { |
|
|
|
this.addOrUpdateForm.parent_id = parent_id |
|
|
|
} |
|
|
|
delete this.addOrUpdateForm.id |
|
|
|
console.log(this.addOrUpdateForm) |
|
|
|
this.$refs[formName].validate((valid) => { |
|
|
|
if (valid) { |
|
|
@ -260,13 +265,16 @@ export default { |
|
|
|
'jsonString': JSON.stringify(this.addOrUpdateForm) |
|
|
|
} |
|
|
|
edit(params).then(res => { |
|
|
|
this.$notify({ |
|
|
|
title: res, |
|
|
|
type: 'success', |
|
|
|
duration: 2500 |
|
|
|
}) |
|
|
|
this.crud.status.add = CRUD.STATUS.NORMAL |
|
|
|
this.crud.refresh() |
|
|
|
if (res) { |
|
|
|
this.$notify({ |
|
|
|
title: res, |
|
|
|
type: 'success', |
|
|
|
duration: 2500 |
|
|
|
}) |
|
|
|
this.crud.status.add = CRUD.STATUS.NORMAL |
|
|
|
this.crud.status.edit = CRUD.STATUS.NORMAL |
|
|
|
this.crud.refresh() |
|
|
|
} |
|
|
|
}) |
|
|
|
} else { |
|
|
|
console.log('error submit!!') |
|
|
|