parent
a6647dcefe
commit
ad14e6d7ee
@ -0,0 +1,35 @@
|
||||
{
|
||||
// 一、格式化相关
|
||||
"editor.formatOnType": false,
|
||||
"editor.formatOnSave": true,
|
||||
"editor.formatOnPaste": false,
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.fixAll.eslint": "explicit"
|
||||
},
|
||||
|
||||
// 二、编辑器显示与行为
|
||||
"editor.tabSize": 2,
|
||||
"editor.snippetSuggestions": "top",
|
||||
"editor.guides.bracketPairs": "active",
|
||||
"editor.suggestSelection": "first",
|
||||
"editor.acceptSuggestionOnCommitCharacter": false,
|
||||
"editor.quickSuggestions": {
|
||||
"other": true,
|
||||
"comments": true,
|
||||
"strings": true
|
||||
},
|
||||
|
||||
// 三、换行和列宽限制
|
||||
"editor.wordWrap": "on",
|
||||
"editor.wordWrapColumn": 180,
|
||||
"editor.rulers": [180],
|
||||
|
||||
// 四、文件与保存
|
||||
"files.autoSave": "off",
|
||||
|
||||
// 五、Git 设置
|
||||
"git.confirmSync": false,
|
||||
|
||||
// 六、工作台与启动项
|
||||
"workbench.startupEditor": "newUntitledFile"
|
||||
}
|
@ -1,16 +1,76 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import melonJson from "./melon.json";
|
||||
// import melonjson from "./melon.json";
|
||||
/**
|
||||
* 初始化和重置文书结构
|
||||
* @param widgetJson
|
||||
*/
|
||||
export const initJson = (widgetJson: any) => {
|
||||
widgetJson['widgetList'] = []
|
||||
widgetJson['subDomList'] = []
|
||||
widgetJson['activeId'] = ""
|
||||
widgetJson['activeDomName'] = ""
|
||||
// widgetJson['formConfig'] = {}
|
||||
}
|
||||
|
||||
export const addItem = (fatherId = "", widgetJson: any) => {
|
||||
/**
|
||||
* 添加新的子元素
|
||||
* @param addItemDataOrigin 新元素
|
||||
* @param fatherId 父容器id
|
||||
* @param widgetJson w文书结构JSON
|
||||
*/
|
||||
export const addItem = (addItemDataOrigin: any, fatherId = "", widgetJson: any) => {
|
||||
const { addItemData, activeId, activeDomName } = formatAddItem(addItemDataOrigin)
|
||||
if (fatherId) { } else {
|
||||
widgetJson['widgetList'] = [melonJson]
|
||||
widgetJson['subDomList'] = [addItemData]
|
||||
}
|
||||
}
|
||||
widgetJson['activeId'] = activeId
|
||||
widgetJson['activeDomName'] = activeDomName
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据表单元素 格式化对应的属性
|
||||
* @param addItemDataOrigin
|
||||
*/
|
||||
const formatAddItem = (addItemDataOrigin: any) => {
|
||||
const addItemData = JSON.parse(JSON.stringify(addItemDataOrigin));
|
||||
let activeId = '';
|
||||
let activeDomName = '';
|
||||
addItemData['key'] = Date.now().toString().slice(-6);
|
||||
addItemData['id'] = `${addItemData['type']}-${addItemData['key']}`;
|
||||
activeId = addItemData['id']
|
||||
activeDomName = addItemData['displayName']
|
||||
addItemData['options'] = {
|
||||
name: `table-${addItemData['key']}`,
|
||||
hidden: false,
|
||||
customClass: ''
|
||||
};
|
||||
// 针对表格 需要初始化子单元格
|
||||
if (addItemData['type'] == 'table') {
|
||||
const key = addItemData['key'].slice(-1) + addItemData['key'].slice(0, -1);
|
||||
// 子单元格
|
||||
const colItem = {
|
||||
key: key,
|
||||
id: `table-cell-${key}`,
|
||||
category: "container",
|
||||
type: "table-cell",
|
||||
displayName: "子单元格",
|
||||
icon: "Monitor",
|
||||
merged: false,
|
||||
subDomList: [],
|
||||
options: {
|
||||
name: `table-cell-${key}`,
|
||||
hidden: false,
|
||||
colspan: 1,
|
||||
rowspan: 1,
|
||||
customClass: ''
|
||||
}
|
||||
};
|
||||
addItemData['subDomList'] = [[colItem]]
|
||||
// activeId = colItem['id']
|
||||
// activeDomName = colItem['displayName']
|
||||
}
|
||||
return {
|
||||
addItemData,
|
||||
activeId,
|
||||
activeDomName
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in new issue