|
@@ -51,6 +51,7 @@ import { VueDraggable } from 'vue-draggable-plus'
|
|
|
import Detail from './modules/Detail.vue'
|
|
|
import MComponent from './modules/Component.vue'
|
|
|
import SelectInfo from './modules/SelectInfo'
|
|
|
+import { getCustomRelation } from '@/api/custom/relation'
|
|
|
|
|
|
import { componentBaseList, componenHidetList } from './modules/components'
|
|
|
export default {
|
|
@@ -91,19 +92,39 @@ export default {
|
|
|
},
|
|
|
created() {},
|
|
|
mounted() {
|
|
|
- this.handleSelect({}, this.config)
|
|
|
+ // this.handleSelect({}, this.config)
|
|
|
},
|
|
|
methods: {
|
|
|
- base(record) {
|
|
|
+ base(record, params = {}) {
|
|
|
this.components = record.components
|
|
|
this.config = record.config
|
|
|
+ this.num = record.num
|
|
|
+ if (this.components.length == 0) {
|
|
|
+ getCustomRelation(params).then((res) => {
|
|
|
+ const datas = JSON.parse(res.data.json)
|
|
|
+ const components = datas.forEach((item) => {
|
|
|
+ const newVal = [...componentBaseList, ...componenHidetList].find(
|
|
|
+ (component) => item.type === component.type
|
|
|
+ )
|
|
|
+ const component = {
|
|
|
+ ...newVal,
|
|
|
+ value: item.englishName,
|
|
|
+ id: String(+new Date()),
|
|
|
+ label: item.chineseName,
|
|
|
+ isDelete: false,
|
|
|
+ }
|
|
|
+ console.log(component)
|
|
|
+ this.components.push(component)
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
onClone(element) {
|
|
|
// 生成随机id
|
|
|
const val = {
|
|
|
...JSON.parse(JSON.stringify(element)),
|
|
|
value: `${element.value}${this.num}`,
|
|
|
- id: Math.floor(Math.random() * 10000000000000),
|
|
|
+ id: String(+new Date()),
|
|
|
}
|
|
|
this.handleSelect(val)
|
|
|
return val
|