|
@@ -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
|
|
|
}
|
|
|
}
|