|
@@ -66,23 +66,26 @@ const userInfo = XEUtils.clone(userStore.userInfo, true)
|
|
|
|
|
|
const render = (item: PageHeader) => {
|
|
|
const modelValue = typeof pageData.value.params[item.key] === 'undefined' ? "" : pageData.value.params[item.key];
|
|
|
- const tempProps = {
|
|
|
+ const tempProps: {
|
|
|
+ [key: string]: any
|
|
|
+ } = {
|
|
|
modelValue: modelValue,
|
|
|
- "onUpdate:modelValue": (val) => {
|
|
|
+ "onUpdate:modelValue": (val: any) => {
|
|
|
pageData.value.params[item.key] = val
|
|
|
},
|
|
|
...item.bind
|
|
|
}
|
|
|
+
|
|
|
if (item.on) {
|
|
|
for (const onKey in item.on) {
|
|
|
const key = capitalizeFirstLetter(onKey, 'on')
|
|
|
- tempProps[key] = (...val) => newFunc(item, val, item.on[onKey])
|
|
|
+ tempProps[key] = (...val: any) => newFunc(item, val, item.on[onKey])
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (item.func) {
|
|
|
for (let funcKey in item.func) {
|
|
|
- tempProps[funcKey] = (...val) => newFunc(item, val, item.func[funcKey])
|
|
|
+ tempProps[funcKey] = (...val: any) => newFunc(item, val, item.func[funcKey])
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -100,11 +103,11 @@ const render = (item: PageHeader) => {
|
|
|
return h(ElAndXc[item.name], tempProps, () => child)
|
|
|
}
|
|
|
|
|
|
-const isActive = (index) => {
|
|
|
+const isActive = (index: number) => {
|
|
|
return index === currentClickIndex.value
|
|
|
}
|
|
|
|
|
|
-function formItemClick(item: PageHeader, index) {
|
|
|
+function formItemClick(item: PageHeader, index: number) {
|
|
|
emits('changeTabs', "属性配置")
|
|
|
if (props.componentAttribute == null) {
|
|
|
return
|
|
@@ -113,13 +116,13 @@ function formItemClick(item: PageHeader, index) {
|
|
|
store.changeCurrentBind(item)
|
|
|
}
|
|
|
|
|
|
-function upClick(index) {
|
|
|
+function upClick(index: number) {
|
|
|
if (index === 0) return
|
|
|
swapItems(pageData.value.header, index, index - 1)
|
|
|
currentClickIndex.value = index - 1
|
|
|
}
|
|
|
|
|
|
-function downClick(index) {
|
|
|
+function downClick(index: number) {
|
|
|
if (index === pageData.value.header.length - 1) {
|
|
|
return
|
|
|
}
|
|
@@ -127,12 +130,12 @@ function downClick(index) {
|
|
|
currentClickIndex.value = index + 1
|
|
|
}
|
|
|
|
|
|
-function swapItems(arr, currentClickIndex, newIndex) {
|
|
|
+function swapItems(arr: any[], currentClickIndex: number, newIndex: number) {
|
|
|
arr[currentClickIndex] = arr.splice(newIndex, 1, arr[currentClickIndex])[0]
|
|
|
return arr
|
|
|
}
|
|
|
|
|
|
-function delClick(index) {
|
|
|
+function delClick(index: number) {
|
|
|
currentClickIndex.value = -1
|
|
|
store.changeCurrentBind(null)
|
|
|
pageData.value.header.splice(index, 1)
|
|
@@ -159,9 +162,15 @@ async function queryClick() {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+type TableBindTs = {
|
|
|
+ data: any[],
|
|
|
+ columns: any[],
|
|
|
+ tableBind: {}
|
|
|
+}
|
|
|
+
|
|
|
const rules = ref({})
|
|
|
|
|
|
-const dialogTableData = ref({
|
|
|
+const dialogTableData = ref<TableBindTs>({
|
|
|
data: [],
|
|
|
columns: [],
|
|
|
tableBind: {}
|
|
@@ -247,9 +256,14 @@ function getBindDefaultValue(name: string) {
|
|
|
const AsyncFunction = Object.getPrototypeOf(async function () {
|
|
|
}).constructor;
|
|
|
|
|
|
-const queryKey = ref({})
|
|
|
|
|
|
-function newFunc(currentBind, value, funcStr) {
|
|
|
+type QueryKeyTs = {
|
|
|
+ [K in PageHeader[][number]['key']]: any
|
|
|
+}
|
|
|
+
|
|
|
+const queryKey = ref<QueryKeyTs>({})
|
|
|
+
|
|
|
+function newFunc(currentBind: PageHeader, value: any, funcStr: string) {
|
|
|
function updateView() {
|
|
|
queryKey.value[currentBind.key] += pageData.value.header.length + queryKey.value[currentBind.key]
|
|
|
}
|
|
@@ -262,7 +276,7 @@ function newFunc(currentBind, value, funcStr) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-async function addComponent(data) {
|
|
|
+async function addComponent(data: PageHeader) {
|
|
|
const temp = XEUtils.clone(data, true)
|
|
|
Object.assign(temp.bind, getBindDefaultValue(data.name))
|
|
|
queryKey.value[temp.key] = pageData.value.header.length
|
|
@@ -278,14 +292,14 @@ async function addComponent(data) {
|
|
|
|
|
|
async function testClick() {
|
|
|
await formRef.value!.validate()
|
|
|
- const data = {}
|
|
|
+ const data: QueryKeyTs = {}
|
|
|
pageData.value.header.forEach(item => {
|
|
|
data[item.key] = pageData.value.params[item.key]
|
|
|
})
|
|
|
props?.doTest(data)
|
|
|
}
|
|
|
|
|
|
-function openDialogAndSetData(data, title: string = '详情') {
|
|
|
+function openDialogAndSetData(data: TableBindTs, title: string = '详情') {
|
|
|
dialogTitle.value = title
|
|
|
showDialog.value = true
|
|
|
dialogTableData.value = data
|
|
@@ -313,7 +327,7 @@ function setTableData(res: any) {
|
|
|
width: 70,
|
|
|
align: 'center',
|
|
|
fixed: 'right',
|
|
|
- func: {
|
|
|
+ slots: {
|
|
|
default: `
|
|
|
const {h} = vue
|
|
|
const {ElButton} = el
|
|
@@ -385,8 +399,9 @@ defineExpose({
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
- <CyFlex>
|
|
|
- <template #header>
|
|
|
+
|
|
|
+ <div class="layout_container">
|
|
|
+ <header>
|
|
|
<div class="cy-page_help_v2-header" ref="headerRef">
|
|
|
<el-form v-bind="pageData.fromConfig"
|
|
|
:rules="rules"
|
|
@@ -433,8 +448,8 @@ defineExpose({
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
</div>
|
|
|
- </template>
|
|
|
- <template #default>
|
|
|
+ </header>
|
|
|
+ <div class="layout_main">
|
|
|
<div class="cy-page_help_v2-main"
|
|
|
style="width: 100%; height: 100%"
|
|
|
v-loading="loading">
|
|
@@ -446,21 +461,23 @@ defineExpose({
|
|
|
:columns="tableBind.columns"
|
|
|
/>
|
|
|
</div>
|
|
|
- </template>
|
|
|
- </CyFlex>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
|
|
|
<el-dialog v-model="showDialog"
|
|
|
:title="dialogTitle"
|
|
|
width="90%"
|
|
|
class="page_help-dialog">
|
|
|
- <PageHelpTable
|
|
|
- :store="store"
|
|
|
- :getSlotsData="getSlotsData"
|
|
|
- :table-bind="dialogTableData.tableBind"
|
|
|
- table-ref-name="dialogTableRef"
|
|
|
- :data="dialogTableData.data"
|
|
|
- :columns="dialogTableData.columns"
|
|
|
- />
|
|
|
+ <div style="height: calc(100vh - 400px)">
|
|
|
+ <PageHelpTable
|
|
|
+ :store="store"
|
|
|
+ :getSlotsData="getSlotsData"
|
|
|
+ :table-bind="dialogTableData.tableBind"
|
|
|
+ table-ref-name="dialogTableRef"
|
|
|
+ :data="dialogTableData.data"
|
|
|
+ :columns="dialogTableData.columns"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
<template #footer>
|
|
|
<el-button v-if="props.isEditor" @click="dialogTableColumns">生成表格列</el-button>
|
|
|
<el-button @click="exportExcel(dialogTableData ,store.dialogTableRef)" type="primary">导出Excel</el-button>
|