Commit 90846532 authored by zL's avatar zL

提交部分代码

parent e5df757d
...@@ -16,7 +16,7 @@ export function formatApiJson(local: Unit[]): RootUnitType[] { ...@@ -16,7 +16,7 @@ export function formatApiJson(local: Unit[]): RootUnitType[] {
return { return {
data: unit.children.map((item) => formatL2Local2Api(item)), data: unit.children.map((item) => formatL2Local2Api(item)),
type: 3, type: 3,
key: '', key:unit.title,
label: unit.title label: unit.title
}; };
}); });
...@@ -28,8 +28,11 @@ export function formatApiJson(local: Unit[]): RootUnitType[] { ...@@ -28,8 +28,11 @@ export function formatApiJson(local: Unit[]): RootUnitType[] {
*/ */
function formatL2Local2Api(localL2: Property | Unit): TemplateProperty | TmplSelectProperty | UnitProperty { function formatL2Local2Api(localL2: Property | Unit): TemplateProperty | TmplSelectProperty | UnitProperty {
if (localL2 instanceof Property) { if (localL2 instanceof Property) {
return formatProperty2Api(localL2); return formatProperty2Api(localL2);
} else { } else {
console.log(1);
const children = localL2.children as Property[]; const children = localL2.children as Property[];
return { return {
key: '', key: '',
...@@ -45,7 +48,7 @@ function formatProperty2Api(property: Property): TemplateProperty | TmplSelectPr ...@@ -45,7 +48,7 @@ function formatProperty2Api(property: Property): TemplateProperty | TmplSelectPr
if (property.type === PropertyType.Select) { if (property.type === PropertyType.Select) {
return { return {
key: property.key, key: property.label,
type: PropertyType.Select, type: PropertyType.Select,
label: property.label, label: property.label,
options: property.options, options: property.options,
...@@ -69,7 +72,7 @@ function formatProperty2Api(property: Property): TemplateProperty | TmplSelectPr ...@@ -69,7 +72,7 @@ function formatProperty2Api(property: Property): TemplateProperty | TmplSelectPr
data = {} data = {}
} }
return { return {
key: property.key, key: property.label,
type: (property.type as PropertyType.Image), type: (property.type as PropertyType.Image),
data: data, data: data,
label: property.label label: property.label
...@@ -88,7 +91,7 @@ function formatProperty2Api(property: Property): TemplateProperty | TmplSelectPr ...@@ -88,7 +91,7 @@ function formatProperty2Api(property: Property): TemplateProperty | TmplSelectPr
data = {} data = {}
} }
return { return {
key: property.key, key: property.label,
type: (property.type as PropertyType.File), type: (property.type as PropertyType.File),
data: data, data: data,
label: property.label label: property.label
...@@ -102,7 +105,8 @@ function formatProperty2Api(property: Property): TemplateProperty | TmplSelectPr ...@@ -102,7 +105,8 @@ function formatProperty2Api(property: Property): TemplateProperty | TmplSelectPr
value: property.value value: property.value
}, },
type: PropertyType.Input, type: PropertyType.Input,
key: property.parent.title === 'ext' ? property.label : property.key, // key: property.parent.title === 'ext' ? property.label : property.key,
key:property.label,
label: property.label label: property.label
}; };
} else if (property.type === PropertyType.Date) { } else if (property.type === PropertyType.Date) {
...@@ -113,7 +117,7 @@ function formatProperty2Api(property: Property): TemplateProperty | TmplSelectPr ...@@ -113,7 +117,7 @@ function formatProperty2Api(property: Property): TemplateProperty | TmplSelectPr
value: property.value value: property.value
}, },
type: PropertyType.Date, type: PropertyType.Date,
key: property.key, key: property.label,
label: property.label label: property.label
}; };
...@@ -131,7 +135,7 @@ function formatProperty2Api(property: Property): TemplateProperty | TmplSelectPr ...@@ -131,7 +135,7 @@ function formatProperty2Api(property: Property): TemplateProperty | TmplSelectPr
data = {} data = {}
} }
return { return {
key: property.key, key: property.label,
type: (property.type as PropertyType.Video), type: (property.type as PropertyType.Video),
data: data, data: data,
label: property.label label: property.label
...@@ -151,7 +155,7 @@ function formatProperty2Api(property: Property): TemplateProperty | TmplSelectPr ...@@ -151,7 +155,7 @@ function formatProperty2Api(property: Property): TemplateProperty | TmplSelectPr
data = {} data = {}
} }
return { return {
key: property.key, key: property.label,
type: (property.type as PropertyType.Audio), type: (property.type as PropertyType.Audio),
data: data, data: data,
label: property.label label: property.label
...@@ -166,7 +170,7 @@ function formatProperty2Api(property: Property): TemplateProperty | TmplSelectPr ...@@ -166,7 +170,7 @@ function formatProperty2Api(property: Property): TemplateProperty | TmplSelectPr
value: property.value value: property.value
}, },
type: (property.type as PropertyType.Image), type: (property.type as PropertyType.Image),
key: property.key, key: property.label,
label: property.label label: property.label
}; };
} }
......
...@@ -602,7 +602,9 @@ export default class editTemplate extends Vue { ...@@ -602,7 +602,9 @@ export default class editTemplate extends Vue {
await this.fileHandler(); await this.fileHandler();
var newDetail = new Array(); var newDetail = new Array();
newDetail = formatApiJson(this.rootUnitList); newDetail = formatApiJson(this.rootUnitList);
// console.log(newDetail);
// return
// return // return
// 更新ext数据 // 更新ext数据
for (let index = 0; index < newDetail.length; index++) { for (let index = 0; index < newDetail.length; index++) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment