|
@@ -24,6 +24,8 @@
|
|
|
<!-- 左侧面板区域 end-->
|
|
|
<!-- 中间拖拽区域 start-->
|
|
|
<div class="drag-wrap">
|
|
|
+ <!-- 顶部工具 -->
|
|
|
+ <TopToolBar @showJSON="showJSON" @saveJSON="saveJSON"></TopToolBar>
|
|
|
<CenterArea
|
|
|
:data="layoutData"
|
|
|
:selectItem="selectItem"
|
|
@@ -47,10 +49,12 @@ import LetfPanel from "./LetfPanel.vue";
|
|
|
import CenterArea from "./CenterArea.vue";
|
|
|
import collapseItem from "./collapseItem.vue"; //左侧tab
|
|
|
import RightPanel from "./RightPanel.vue"; //右侧tab
|
|
|
+import TopToolBar from "./TopToolBar.vue"; //右侧tab
|
|
|
+import { updateFormGroup } from "@/api/system/formGroup";
|
|
|
export default {
|
|
|
name: "DragPosition",
|
|
|
- props: [],
|
|
|
- components: { LetfPanel, CenterArea, collapseItem, RightPanel },
|
|
|
+ props: ["formGroupData"],
|
|
|
+ components: { LetfPanel, CenterArea, collapseItem, RightPanel, TopToolBar },
|
|
|
data() {
|
|
|
return {
|
|
|
startType: "",
|
|
@@ -145,7 +149,7 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
- this.schemaGroup[0].list = formList;
|
|
|
+ // this.schemaGroup[0].list = formList;
|
|
|
},
|
|
|
computed: {
|
|
|
formList() {
|
|
@@ -153,6 +157,48 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 保存布局数据
|
|
|
+ async saveJSON() {
|
|
|
+ let payLoad = {
|
|
|
+ ...this.formGroupData,
|
|
|
+ layoutJson: JSON.stringify(this.layoutData),
|
|
|
+ };
|
|
|
+ let res = await updateFormGroup(payLoad);
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$message.success("保存成功!");
|
|
|
+ } else {
|
|
|
+ this.$message.error("网络异常,保存失败!");
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 初始化表单数据
|
|
|
+ initFormData() {
|
|
|
+ let res = [];
|
|
|
+ this.layoutData.list = [];
|
|
|
+ console.log(this.formGroupData);
|
|
|
+ let { dragFormList, layoutJson } = this.formGroupData;
|
|
|
+ res = dragFormList.map((item) => {
|
|
|
+ let { dfName, dfNickname, dfTableName, formKey } = item;
|
|
|
+ return {
|
|
|
+ type: "form",
|
|
|
+ label: dfName,
|
|
|
+ dfNickname,
|
|
|
+ dfTableName,
|
|
|
+ formKey,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ console.log(res);
|
|
|
+ this.$set(this.schemaGroup[0], "list", res);
|
|
|
+ if (layoutJson) {
|
|
|
+ this.layoutData = JSON.parse(layoutJson);
|
|
|
+ } else {
|
|
|
+ this.layoutData.list.push(...res);
|
|
|
+ }
|
|
|
+ // this.schemaGroup[0].list = res;
|
|
|
+ },
|
|
|
+ // 预览json
|
|
|
+ showJSON() {
|
|
|
+ console.log("json数据", JSON.stringify(this.layoutData));
|
|
|
+ },
|
|
|
handleStart(type) {
|
|
|
this.startType = type;
|
|
|
},
|
|
@@ -243,13 +289,13 @@ ul {
|
|
|
height: 100%;
|
|
|
}
|
|
|
.drag-position {
|
|
|
- height: 100%;
|
|
|
+ height: calc(100% - 30px);
|
|
|
display: flex;
|
|
|
.drag-wrap {
|
|
|
// box-sizing: border-box;
|
|
|
position: relative;
|
|
|
// height: 100%;
|
|
|
- padding: 10px;
|
|
|
+ padding: 0 10px;
|
|
|
flex: 1;
|
|
|
}
|
|
|
}
|