|
@@ -7,7 +7,7 @@
|
|
|
>
|
|
|
<k-form-build
|
|
|
:dynamicData="item.template.dfFormSql || {}"
|
|
|
- :defaultValue="{}"
|
|
|
+ :defaultValue="item.template.defaultValue || {}"
|
|
|
class="formBuild"
|
|
|
:ref="item.tableName"
|
|
|
:value="item.template.dfVueTemplate"
|
|
@@ -22,6 +22,7 @@
|
|
|
import { camelCase, toUnderline } from "@/utils/index";
|
|
|
import { disableFormItem } from "@/utils/kFormDesign";
|
|
|
import { uuid as uuidv4 } from "uuid";
|
|
|
+
|
|
|
export default {
|
|
|
name: "Approve",
|
|
|
props: {
|
|
@@ -102,11 +103,11 @@ export default {
|
|
|
},
|
|
|
watch: {
|
|
|
myFormList: {
|
|
|
- handler(val) {
|
|
|
+ async handler(val) {
|
|
|
// this.$emit("update:formList", val);
|
|
|
console.log(JSON.parse(JSON.stringify(val)));
|
|
|
let temp = JSON.parse(JSON.stringify(val));
|
|
|
- this.formArray = this.disableHandler(temp);
|
|
|
+ this.formArray = await this.disableHandler(temp);
|
|
|
this.$nextTick(() => {
|
|
|
console.log("表单组渲染");
|
|
|
// setTimeout(() => {
|
|
@@ -138,7 +139,8 @@ export default {
|
|
|
this.defaultValue[item.tableName] = item.template?.defaultValue || {};
|
|
|
});
|
|
|
for (const key in this.defaultValue) {
|
|
|
- console.log(this.defaultValue);
|
|
|
+ console.log(JSON.parse(JSON.stringify(this.defaultValue)));
|
|
|
+ console.log(this.$refs[key]);
|
|
|
this.$refs[key][0]?.setData(this.defaultValue[key]);
|
|
|
}
|
|
|
},
|
|
@@ -153,41 +155,44 @@ export default {
|
|
|
*/
|
|
|
disableHandler(formList) {
|
|
|
this.resetForm();
|
|
|
- if (formList.length == 0) return [];
|
|
|
- formList.forEach((item) => {
|
|
|
- item.template.dfFormSql =
|
|
|
- typeof item.template.dfFormSql == "object"
|
|
|
- ? item.template.dfFormSql
|
|
|
- : JSON.parse(item.template.dfFormSql);
|
|
|
- // item.template.dfVueTemplate = disableFormItem(
|
|
|
- // typeof item.template.dfVueTemplate == "object"
|
|
|
- // ? item.template.dfVueTemplate
|
|
|
- // : JSON.parse(item.template.dfVueTemplate)
|
|
|
- // );
|
|
|
- item.template.dfVueTemplate =
|
|
|
- typeof item.template.dfVueTemplate == "object"
|
|
|
- ? item.template.dfVueTemplate
|
|
|
- : JSON.parse(item.template.dfVueTemplate);
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ if (formList.length == 0) resolve([]);
|
|
|
|
|
|
- if (item.template.resultMap) {
|
|
|
- item.template.defaultValue = item.template.resultMap[0]
|
|
|
- ? item.template.resultMap[0]
|
|
|
- : {};
|
|
|
- }
|
|
|
+ formList.forEach((item) => {
|
|
|
+ item.template.dfFormSql =
|
|
|
+ typeof item.template.dfFormSql == "object"
|
|
|
+ ? item.template.dfFormSql
|
|
|
+ : JSON.parse(item.template.dfFormSql);
|
|
|
+ // item.template.dfVueTemplate = disableFormItem(
|
|
|
+ // typeof item.template.dfVueTemplate == "object"
|
|
|
+ // ? item.template.dfVueTemplate
|
|
|
+ // : JSON.parse(item.template.dfVueTemplate)
|
|
|
+ // );
|
|
|
+ item.template.dfVueTemplate =
|
|
|
+ typeof item.template.dfVueTemplate == "object"
|
|
|
+ ? item.template.dfVueTemplate
|
|
|
+ : JSON.parse(item.template.dfVueTemplate);
|
|
|
|
|
|
- // 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 || {};
|
|
|
+ if (item.template.resultMap) {
|
|
|
+ item.template.defaultValue = item.template.resultMap[0]
|
|
|
+ ? item.template.resultMap[0]
|
|
|
+ : {};
|
|
|
+ }
|
|
|
|
|
|
- // this.$nextTick(() => {
|
|
|
- // Object.assign(this.defaultValue, item.template.defaultValue);
|
|
|
- // });
|
|
|
- // item.formInfo.jsonData = disableFormItem(item.formInfo.jsonData);
|
|
|
- });
|
|
|
+ // 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 || {};
|
|
|
|
|
|
- return formList;
|
|
|
+ // this.$nextTick(() => {
|
|
|
+ // Object.assign(this.defaultValue, item.template.defaultValue);
|
|
|
+ // });
|
|
|
+ // item.formInfo.jsonData = disableFormItem(item.formInfo.jsonData);
|
|
|
+ });
|
|
|
+
|
|
|
+ resolve(formList);
|
|
|
+ });
|
|
|
},
|
|
|
// 获取表单信息
|
|
|
getformInfo() {
|