|
@ -4,7 +4,8 @@ |
|
|
<el-scrollbar class="left-scrollbar"> |
|
|
<el-scrollbar class="left-scrollbar"> |
|
|
<div class="components-list"> |
|
|
<div class="components-list"> |
|
|
<div v-for="(item, listIndex) in leftComponents" |
|
|
<div v-for="(item, listIndex) in leftComponents" |
|
|
:key="listIndex"> |
|
|
:key="listIndex" |
|
|
|
|
|
> |
|
|
<div class="components-title"> |
|
|
<div class="components-title"> |
|
|
<svg-icon name="component" /> |
|
|
<svg-icon name="component" /> |
|
|
{{ item.title }} |
|
|
{{ item.title }} |
|
@ -15,11 +16,13 @@ |
|
|
:sort="false" |
|
|
:sort="false" |
|
|
class="components-draggable" |
|
|
class="components-draggable" |
|
|
draggable=".components-item" |
|
|
draggable=".components-item" |
|
|
@end="onEnd"> |
|
|
@end="onEnd" |
|
|
|
|
|
> |
|
|
<div v-for="(element, index) in item.list" |
|
|
<div v-for="(element, index) in item.list" |
|
|
:key="index" |
|
|
:key="index" |
|
|
class="components-item" |
|
|
class="components-item" |
|
|
@click="addComponent(element)"> |
|
|
@click="addComponent(element)" |
|
|
|
|
|
> |
|
|
<div class="components-body"> |
|
|
<div class="components-body"> |
|
|
<svg-icon :name="element.__config__.tagIcon" /> |
|
|
<svg-icon :name="element.__config__.tagIcon" /> |
|
|
{{ element.__config__.label }} |
|
|
{{ element.__config__.label }} |
|
@ -34,33 +37,39 @@ |
|
|
<el-scrollbar class="center-scrollbar"> |
|
|
<el-scrollbar class="center-scrollbar"> |
|
|
<el-row v-if="formConf" |
|
|
<el-row v-if="formConf" |
|
|
:gutter="formConf.gutter" |
|
|
:gutter="formConf.gutter" |
|
|
class="center-board-row"> |
|
|
class="center-board-row" |
|
|
|
|
|
> |
|
|
<el-row align="middle" |
|
|
<el-row align="middle" |
|
|
justify="center" |
|
|
justify="center" |
|
|
type="flex"> |
|
|
type="flex" |
|
|
|
|
|
> |
|
|
<el-col class="form-head-title"> |
|
|
<el-col class="form-head-title"> |
|
|
<h4 class="form-name-text" |
|
|
<h4 class="form-name-text" |
|
|
contenteditable="true" |
|
|
contenteditable="true" |
|
|
@blur="(event)=>{ |
|
|
@blur="(event)=>{ |
|
|
this.formConf.title=event.target.innerText; |
|
|
this.formConf.title=event.target.innerText; |
|
|
this.saveProjectInfo()}"> |
|
|
this.saveProjectInfo()}" |
|
|
|
|
|
> |
|
|
{{ formConf.title }} |
|
|
{{ formConf.title }} |
|
|
</h4> |
|
|
</h4> |
|
|
</el-col> |
|
|
</el-col> |
|
|
</el-row> |
|
|
</el-row> |
|
|
<el-row align="middle" |
|
|
<el-row align="middle" |
|
|
justify="center" |
|
|
justify="center" |
|
|
type="flex"> |
|
|
type="flex" |
|
|
|
|
|
> |
|
|
<el-col class="form-head-desc"> |
|
|
<el-col class="form-head-desc"> |
|
|
<Tinymce v-if="editDescription" |
|
|
<Tinymce v-if="editDescription" |
|
|
v-model="formConf.description" |
|
|
v-model="formConf.description" |
|
|
placeholder="请输入表单描述" |
|
|
placeholder="请输入表单描述" |
|
|
@blur="editDescription=false" |
|
|
@blur="editDescription=false" |
|
|
@input="saveProjectInfo" /> |
|
|
@input="saveProjectInfo" |
|
|
|
|
|
/> |
|
|
<div v-else |
|
|
<div v-else |
|
|
class="form-name-text" |
|
|
class="form-name-text" |
|
|
@click="editDescription=true" |
|
|
@click="editDescription=true" |
|
|
v-html="formConf.description" /> |
|
|
v-html="formConf.description" |
|
|
|
|
|
/> |
|
|
<!-- <p class="form-name-text" contenteditable="true"--> |
|
|
<!-- <p class="form-name-text" contenteditable="true"--> |
|
|
<!-- @blur="(event)=>{--> |
|
|
<!-- @blur="(event)=>{--> |
|
|
<!-- formConf.description=event.target.innerText;--> |
|
|
<!-- formConf.description=event.target.innerText;--> |
|
@ -73,12 +82,14 @@ |
|
|
<el-form :disabled="formConf.disabled" |
|
|
<el-form :disabled="formConf.disabled" |
|
|
:label-position="formConf.labelPosition" |
|
|
:label-position="formConf.labelPosition" |
|
|
:label-width="formConf.labelWidth + 'px'" |
|
|
:label-width="formConf.labelWidth + 'px'" |
|
|
:size="formConf.size"> |
|
|
:size="formConf.size" |
|
|
|
|
|
> |
|
|
<draggable :animation="340" |
|
|
<draggable :animation="340" |
|
|
:list="drawingList" |
|
|
:list="drawingList" |
|
|
class="drawing-board" |
|
|
class="drawing-board" |
|
|
group="componentsGroup" |
|
|
group="componentsGroup" |
|
|
@end="onItemEnd"> |
|
|
@end="onItemEnd" |
|
|
|
|
|
> |
|
|
<draggable-item v-for="(item, index) in drawingList" |
|
|
<draggable-item v-for="(item, index) in drawingList" |
|
|
:key="item.renderKey" |
|
|
:key="item.renderKey" |
|
|
:active-id="activeId" |
|
|
:active-id="activeId" |
|
@ -89,12 +100,15 @@ |
|
|
@activeItem="activeFormItem" |
|
|
@activeItem="activeFormItem" |
|
|
@changeLabel="changeLabel" |
|
|
@changeLabel="changeLabel" |
|
|
@copyItem="drawingItemCopy" |
|
|
@copyItem="drawingItemCopy" |
|
|
@deleteItem="drawingItemDelete" /> |
|
|
@deleteItem="drawingItemDelete" |
|
|
|
|
|
/> |
|
|
</draggable> |
|
|
</draggable> |
|
|
<div v-show="!drawingList.length" |
|
|
<div v-show="!drawingList.length" |
|
|
class="empty-info"> |
|
|
class="empty-info" |
|
|
|
|
|
> |
|
|
<img style="width: 20%" |
|
|
<img style="width: 20%" |
|
|
src="@/assets/images/form-bg.png"> |
|
|
src="@/assets/images/form-bg.png" |
|
|
|
|
|
> |
|
|
<p>从左侧拖入或点选组件进行表单设计</p> |
|
|
<p>从左侧拖入或点选组件进行表单设计</p> |
|
|
</div> |
|
|
</div> |
|
|
</el-form> |
|
|
</el-form> |
|
@ -106,7 +120,8 @@ |
|
|
:form-conf="formConf" |
|
|
:form-conf="formConf" |
|
|
:show-field="!!drawingList.length" |
|
|
:show-field="!!drawingList.length" |
|
|
@tag-change="tagChange" |
|
|
@tag-change="tagChange" |
|
|
@data-change="updateProjectItemInfo" /> |
|
|
@data-change="updateProjectItemInfo" |
|
|
|
|
|
/> |
|
|
</div> |
|
|
</div> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
@ -262,7 +277,6 @@ export default { |
|
|
async saveProjectItemInfo(item) { |
|
|
async saveProjectItemInfo(item) { |
|
|
let isSuccess = false |
|
|
let isSuccess = false |
|
|
let params = formItemConvertData(item, this.projectKey) |
|
|
let params = formItemConvertData(item, this.projectKey) |
|
|
console.log(params) |
|
|
|
|
|
let pItem = item |
|
|
let pItem = item |
|
|
await this.$api.post(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/item/create`, params).then(res => { |
|
|
await this.$api.post(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/item/create`, params).then(res => { |
|
|
pItem.sort = res.data.sort |
|
|
pItem.sort = res.data.sort |
|
@ -338,7 +352,7 @@ export default { |
|
|
const config = clone.__config__ |
|
|
const config = clone.__config__ |
|
|
config.span = this.formConf.span // 生成代码时,会根据span做精简判断 |
|
|
config.span = this.formConf.span // 生成代码时,会根据span做精简判断 |
|
|
this.createIdAndKey(clone) |
|
|
this.createIdAndKey(clone) |
|
|
clone.placeholder !== undefined && (clone.placeholder += config.label) |
|
|
clone.placeholder !== undefined && (clone.placeholder) |
|
|
tempActiveData = clone |
|
|
tempActiveData = clone |
|
|
return tempActiveData |
|
|
return tempActiveData |
|
|
}, |
|
|
}, |
|
|