Browse Source

页面编辑v2问题修复

xiaochan 1 year ago
parent
commit
77395b99d3

+ 0 - 46
src/tsconfig.json

@@ -1,46 +0,0 @@
-{
-  "compilerOptions": {
-    "types": [
-      "vue/ref-macros"
-    ],
-    "noEmit": true,
-    "allowJs": true,
-    "target": "esnext",
-    "useDefineForClassFields": true,
-    "module": "esnext",
-    "moduleResolution": "node",
-    "strict": true,
-    "jsx": "preserve",
-    "sourceMap": true,
-    "resolveJsonModule": true,
-    "isolatedModules": true,
-    "esModuleInterop": true,
-    "experimentalDecorators": true,
-    "lib": [
-      "esnext",
-      "dom"
-    ],
-    "baseUrl": "./",
-    "paths": {
-      "@": [
-        "src"
-      ],
-      "@/*": [
-        "src/*"
-      ]
-    },
-    "skipLibCheck": true
-  },
-  "include": [
-    "src/**/*.ts",
-    "src/**/*.d.ts",
-    "src/**/*.tsx",
-    "src/**/*.vue"
-  ],
-  "references": [
-    {
-      "path": "./tsconfig.node.json"
-    }
-  ]
-}
-

+ 0 - 8
src/tsconfig.node.json

@@ -1,8 +0,0 @@
-{
-  "compilerOptions": {
-    "composite": true,
-    "module": "esnext",
-    "moduleResolution": "node"
-  },
-  "include": ["vite.config.ts"]
-}

+ 0 - 0
src/utils/emr/useEmrModel.ts


+ 1 - 17
src/views/data-base/page-editor-help-v2/components/page-editor-v2/PageHelpOtherConfigurations.vue

@@ -1,7 +1,6 @@
 <script setup lang="ts">
 import {copyStrFunc} from "@/utils/public";
 import {PageStore} from "@/views/data-base/page-editor-help-v2/page-help-v2";
-import XEUtils from "xe-utils";
 import {CyJsonEditorDialog} from "@/components/cy/cy-monaco-editor/CyMonacoEditor";
 import {ElButton} from "element-plus";
 
@@ -28,21 +27,6 @@ function saveData() {
   props.store.handleSavaData()
 }
 
-function defaultValue() {
-  let temp = {};
-  if (XEUtils.isEmpty(props.store.pageData.value.paramsDefaultValue)) {
-    props.store.pageData.value.header.forEach(item => {
-      temp[item.key] = ""
-    })
-  } else {
-    temp = props.store.pageData.value.paramsDefaultValue
-  }
-  CyJsonEditorDialog(temp, {bodyWidth: '60%'}).then(res => {
-    props.store.pageData.value.paramsDefaultValue = res.json
-  })
-}
-
-
 function editorPageJson() {
   CyJsonEditorDialog(props.store.pageData.value, {fullScreen: true}).then(res => {
     props.store.mutation.setPageData(res.json)
@@ -57,7 +41,7 @@ function editorPageJson() {
   <el-button @click="generateQuery">生成查询</el-button>
   <el-button @click="generateTableColumns">生成表格列</el-button>
   <el-button @click="saveData">保存</el-button>
-  <el-button @click="defaultValue">默认值</el-button>
+  <el-button @click="store.defaultValue">默认值</el-button>
   <el-button @click="editorPageJson">编辑页面JSON对象</el-button>
 </template>
 

+ 23 - 0
src/views/data-base/page-editor-help-v2/page-help-v2.ts

@@ -15,6 +15,7 @@ import SystemDeptSelect from "@/components/system/dept-select/SystemDeptSelect.v
 // @ts-ignore
 import SystemStaffSelect from '@/components/system/staff-select/SystemStaffSelect.vue'
 import {xcMessage} from "@/utils/xiaochan-element-plus";
+import {CyJsonEditorDialog} from "@/components/cy/cy-monaco-editor/CyMonacoEditor";
 
 interface TableData {
     data: any[],
@@ -113,11 +114,13 @@ export function usePageStore(props: any) {
     function handleSavaData() {
         const clone: PageJsonObject = XEUtils.clone(pageData.value, true)
         if (XEUtils.isEmpty(clone.paramsDefaultValue)) {
+            defaultValue()
             xcMessage.error('没有设置默认值。')
             return
         }
 
         if (Object.keys(clone.paramsDefaultValue).length !== Object.keys(clone.params).length) {
+            defaultValue()
             xcMessage.error('有新增的组件没有创建默认值。')
             return
         }
@@ -183,6 +186,25 @@ export function usePageStore(props: any) {
         }
     }
 
+
+    function defaultValue() {
+        let temp: {};
+        const headerParams = {}
+        pageData.value.header.forEach(item => {
+            // @ts-ignore
+            headerParams[item.key] = ""
+        })
+        if (XEUtils.isEmpty(pageData.value.paramsDefaultValue)) {
+            temp = headerParams
+        } else {
+            temp = {...headerParams, ...pageData.value.paramsDefaultValue};
+        }
+        // @ts-ignore
+        CyJsonEditorDialog(temp, {bodyWidth: '60%'}).then(res => {
+            pageData.value.paramsDefaultValue = res.json
+        })
+    }
+
     return {
         currentClickIndex,
         pageData,
@@ -198,6 +220,7 @@ export function usePageStore(props: any) {
         dialogTableRef,
         compData,
         addComponentRefresh,
+        defaultValue,
         mutation
     }
 }

+ 1 - 0
tsconfig.json

@@ -11,6 +11,7 @@
     "moduleResolution": "node",
     "strict": true,
     "jsx": "preserve",
+    "jsxImportSource": "vue",
     "sourceMap": true,
     "resolveJsonModule": true,
     "isolatedModules": true,