|
@@ -1,15 +1,16 @@
|
|
|
<template>
|
|
|
<div class="list-wrap">
|
|
|
- <div class="list-item" v-for="(item, index) in myFormList" :key="index">
|
|
|
+ <div class="list-item" v-for="(item, index) in formArray" :key="index">
|
|
|
<k-form-build
|
|
|
:dynamicData="item.template.dfFormSql || {}"
|
|
|
- :defaultValue="item.template.defaultValue"
|
|
|
+ :defaultValue="item.template.defaultValue || {}"
|
|
|
class="formBuild"
|
|
|
ref="addFromRef"
|
|
|
:value="item.template.dfVueTemplate"
|
|
|
/>
|
|
|
+ <el-divider></el-divider>
|
|
|
</div>
|
|
|
- <el-divider></el-divider>
|
|
|
+
|
|
|
<!-- <div class="log-list"></div> -->
|
|
|
<el-descriptions
|
|
|
v-for="(item, index) in nodeLogList"
|
|
@@ -76,6 +77,7 @@
|
|
|
// import formList from "@/assets/js/formArray";
|
|
|
import { camelCase, toUnderline } from "@/utils/index";
|
|
|
import { disableFormItem } from "@/utils/kFormDesign";
|
|
|
+import { uuid as uuidv4 } from "uuid";
|
|
|
export default {
|
|
|
name: "Approve",
|
|
|
props: {
|
|
@@ -100,6 +102,7 @@ export default {
|
|
|
// formJson: formList,
|
|
|
// },
|
|
|
// ],
|
|
|
+ formArray: [],
|
|
|
form: {
|
|
|
approvalStatus: "", //审批结果
|
|
|
approvalRemark: "", //审批备注
|
|
@@ -144,7 +147,8 @@ export default {
|
|
|
},
|
|
|
computed: {
|
|
|
myFormList() {
|
|
|
- return this.disableHandler(this.formList);
|
|
|
+ return this.formList;
|
|
|
+ // return this.disableHandler(this.formList);
|
|
|
// this.formList.forEach((item) => {
|
|
|
// item.template.dfFormSql = JSON.parse(item.template.dfFormSql);
|
|
|
// item.template.dfVueTemplate = JSON.parse(item.template.dfVueTemplate);
|
|
@@ -152,7 +156,21 @@ export default {
|
|
|
// return this.formList;
|
|
|
},
|
|
|
},
|
|
|
+ watch: {
|
|
|
+ myFormList: {
|
|
|
+ handler(val) {
|
|
|
+ // this.$emit("update:formList", val);
|
|
|
+ this.formArray = this.disableHandler(val);
|
|
|
+ console.log(this.formArray);
|
|
|
+ },
|
|
|
+ deep: true,
|
|
|
+ immediate: true,
|
|
|
+ },
|
|
|
+ },
|
|
|
methods: {
|
|
|
+ getUUID() {
|
|
|
+ return uuidv4();
|
|
|
+ },
|
|
|
/**
|
|
|
*
|
|
|
* @param {array} formList 表单列表
|
|
@@ -163,14 +181,22 @@ export default {
|
|
|
this.resetForm();
|
|
|
if (formList.length == 0) return [];
|
|
|
formList.forEach((item) => {
|
|
|
- item.template.dfFormSql = JSON.parse(item.template.dfFormSql);
|
|
|
+ item.template.dfFormSql =
|
|
|
+ typeof item.template.dfFormSql == "object"
|
|
|
+ ? item.template.dfFormSql
|
|
|
+ : JSON.parse(item.template.dfFormSql);
|
|
|
item.template.dfVueTemplate = disableFormItem(
|
|
|
- JSON.parse(item.template.dfVueTemplate)
|
|
|
+ typeof item.template.dfVueTemplate == "object"
|
|
|
+ ? item.template.dfVueTemplate
|
|
|
+ : JSON.parse(item.template.dfVueTemplate)
|
|
|
);
|
|
|
- item.template.defaultValue = item.template.resultMap[0]?.resultMap
|
|
|
- ? item.template.resultMap[0].resultMap
|
|
|
- : {};
|
|
|
- for (const key of Object.keys(item.template.defaultValue)) {
|
|
|
+ if (item.template.resultMap) {
|
|
|
+ item.template.defaultValue = item.template.resultMap[0]?.resultMap
|
|
|
+ ? item.template.resultMap[0].resultMap
|
|
|
+ : {};
|
|
|
+ }
|
|
|
+
|
|
|
+ for (const key of Object.keys(item.template?.defaultValue || {})) {
|
|
|
item.template.defaultValue[toUnderline(key)] =
|
|
|
item.template.defaultValue[key];
|
|
|
}
|