|
@@ -143,19 +143,45 @@ export default {
|
|
|
// while (new Date().getTime() < unixtime_ms + ms) {}
|
|
|
// return "";
|
|
|
// },
|
|
|
+
|
|
|
+ // 主动渲染数据
|
|
|
+ async activeRender(val) {
|
|
|
+ console.log("activeRender");
|
|
|
+ let temp = JSON.parse(JSON.stringify(val));
|
|
|
+ this.formArray = await this.disableHandler(temp);
|
|
|
+ // this.$nextTick(() => {
|
|
|
+ // console.log("表单组渲染");
|
|
|
+ // // setTimeout(() => {
|
|
|
+ // // console.log("倒计时结束");
|
|
|
+ // this.setDefaultValue();
|
|
|
+ // // }, 5000);
|
|
|
+ // });
|
|
|
+ },
|
|
|
// 设置默认值
|
|
|
setDefaultValue() {
|
|
|
- console.log("开始渲染默认数据");
|
|
|
+ console.log(
|
|
|
+ "开始渲染默认数据",
|
|
|
+ JSON.parse(JSON.stringify(this.formArray)),
|
|
|
+ this.$refs
|
|
|
+ );
|
|
|
this.formArray.forEach((item) => {
|
|
|
- // for (const key of Object.keys(item.template?.defaultValue || {})) {
|
|
|
- // item.template.defaultValue[toUnderline(key)] =
|
|
|
- // item.template.defaultValue[key];
|
|
|
- // }
|
|
|
- this.defaultValue[item.tableName] = item.template?.defaultValue || {};
|
|
|
+ this.defaultValue[item.tableName] = item.template.defaultValue || {};
|
|
|
});
|
|
|
+ console.log(
|
|
|
+ "this.defaultValue",
|
|
|
+ JSON.parse(JSON.stringify(this.defaultValue))
|
|
|
+ );
|
|
|
for (const key in this.defaultValue) {
|
|
|
- this.$refs[key][0]?.setData(this.defaultValue[key]);
|
|
|
+ console.log(JSON.parse(JSON.stringify(this.defaultValue[key])));
|
|
|
+ this.$refs[key][0].setData(this.defaultValue[key]);
|
|
|
}
|
|
|
+ // setTimeout(() => {
|
|
|
+ // console.log("倒计时结束,开始赋值");
|
|
|
+ // this.$refs.sale_products[0].setData(this.defaultValue["sale_products"]);
|
|
|
+ // }, 1000);
|
|
|
+ // this.$nextTick(() => {
|
|
|
+ // this.$forceUpdate();
|
|
|
+ // });
|
|
|
},
|
|
|
getUUID() {
|
|
|
return uuidv4();
|
|
@@ -203,6 +229,10 @@ export default {
|
|
|
// });
|
|
|
// item.formInfo.jsonData = disableFormItem(item.formInfo.jsonData);
|
|
|
});
|
|
|
+ this.$nextTick(() => {
|
|
|
+ console.log("表单组渲染");
|
|
|
+ this.setDefaultValue();
|
|
|
+ });
|
|
|
resolve(formList);
|
|
|
});
|
|
|
},
|