|
@@ -18,7 +18,7 @@ import PageHelpOtherConfigurations
|
|
|
import {getWindowSize} from "@/utils/window-size";
|
|
|
import {ExcelName, Export} from '@/utils/ExportExcel'
|
|
|
import {userInfoStore} from "@/utils/store-public";
|
|
|
-import {capitalizeFirstLetter, createStore} from "@/views/data-base/page-editor-help-v2/page-help-v2";
|
|
|
+import {capitalizeFirstLetter, usePageStore} from "@/views/data-base/page-editor-help-v2/page-help-v2";
|
|
|
import {generateRandomString} from "@/utils/getUuid";
|
|
|
|
|
|
interface Props {
|
|
@@ -44,11 +44,16 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
doTest: null
|
|
|
})
|
|
|
|
|
|
-const instance = getCurrentInstance();
|
|
|
+const pageHelp = getCurrentInstance();
|
|
|
+const store = usePageStore()
|
|
|
+//@ts-ignore
|
|
|
+pageHelp.store = store
|
|
|
+
|
|
|
+const {currentClickIndex, pageData, clearOnAndFunc} = store
|
|
|
+
|
|
|
|
|
|
const formRef = useCompRef(ElForm)
|
|
|
const bindRef = ref(null)
|
|
|
-const currentIndex = ref(-1)
|
|
|
const headerRef = ref(null)
|
|
|
const {height: headerHeight} = useElementSize(headerRef)
|
|
|
const emits = defineEmits(['changeTabs'])
|
|
@@ -99,7 +104,7 @@ const render = (item: PageHeader) => {
|
|
|
}
|
|
|
|
|
|
const isActive = (index) => {
|
|
|
- return index === currentIndex.value
|
|
|
+ return index === currentClickIndex.value
|
|
|
}
|
|
|
|
|
|
function formItemClick(item: PageHeader, index) {
|
|
@@ -107,14 +112,14 @@ function formItemClick(item: PageHeader, index) {
|
|
|
if (props.componentAttribute == null) {
|
|
|
return
|
|
|
}
|
|
|
- currentIndex.value = index
|
|
|
+ currentClickIndex.value = index
|
|
|
bindRef.value?.changeCurrentBind(item)
|
|
|
}
|
|
|
|
|
|
function upClick(index) {
|
|
|
if (index === 0) return
|
|
|
swapItems(pageData.value.header, index, index - 1)
|
|
|
- currentIndex.value = index - 1
|
|
|
+ currentClickIndex.value = index - 1
|
|
|
}
|
|
|
|
|
|
function downClick(index) {
|
|
@@ -122,16 +127,16 @@ function downClick(index) {
|
|
|
return
|
|
|
}
|
|
|
swapItems(pageData.value.header, index, index + 1)
|
|
|
- currentIndex.value = index + 1
|
|
|
+ currentClickIndex.value = index + 1
|
|
|
}
|
|
|
|
|
|
-function swapItems(arr, currentIndex, newIndex) {
|
|
|
- arr[currentIndex] = arr.splice(newIndex, 1, arr[currentIndex])[0]
|
|
|
+function swapItems(arr, currentClickIndex, newIndex) {
|
|
|
+ arr[currentClickIndex] = arr.splice(newIndex, 1, arr[currentClickIndex])[0]
|
|
|
return arr
|
|
|
}
|
|
|
|
|
|
function delClick(index) {
|
|
|
- currentIndex.value = -1
|
|
|
+ currentClickIndex.value = -1
|
|
|
bindRef.value.changeCurrentBind(null)
|
|
|
pageData.value.header.splice(index, 1)
|
|
|
}
|
|
@@ -179,15 +184,6 @@ const dialogTitle = ref('详情')
|
|
|
const tableData = ref([])
|
|
|
const columns = ref([])
|
|
|
const loading = ref(false)
|
|
|
-const pageData = ref<PageJsonObject>({
|
|
|
- header: [],
|
|
|
- params: {},
|
|
|
- submitUrl: '',
|
|
|
- fromConfig: {
|
|
|
- inline: true,
|
|
|
- labelWidth: '120px'
|
|
|
- }
|
|
|
-})
|
|
|
|
|
|
function requiredInit(setDefaultValue = false) {
|
|
|
formRef.value.resetFields()
|
|
@@ -224,21 +220,10 @@ function handleOnAndFuncEvent(data: PageJsonObject) {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
-function clearOnAndFunc(data: PageJsonObject) {
|
|
|
- XEUtils.arrayEach(data.header, (item: PageHeader) => {
|
|
|
- if (item.on) {
|
|
|
-
|
|
|
- }
|
|
|
- if (item.func) {
|
|
|
-
|
|
|
- }
|
|
|
- })
|
|
|
-}
|
|
|
|
|
|
async function refresh() {
|
|
|
- console.log(pageData.value)
|
|
|
-
|
|
|
-
|
|
|
+ clearOnAndFunc();
|
|
|
+ bindRef.value?.changeCurrentBind(pageData.value.header[currentClickIndex.value])
|
|
|
setPageData(pageData.value)
|
|
|
}
|
|
|
|
|
@@ -274,8 +259,8 @@ const bindData = ref()
|
|
|
async function bindRefresh() {
|
|
|
bindData.value = await reportQueryCenterApi('/reportCenter/components/componentBind')
|
|
|
await nextTick()
|
|
|
- if (currentIndex.value > -1) {
|
|
|
- bindRef.value?.changeCurrentBind(pageData.value.header[currentIndex.value])
|
|
|
+ if (currentClickIndex.value > -1) {
|
|
|
+ bindRef.value?.changeCurrentBind(pageData.value.header[currentClickIndex.value])
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -392,7 +377,7 @@ defineExpose({
|
|
|
v-if="pageData.header.length > 0"
|
|
|
class="page-item_div"
|
|
|
:class="isActive(index) ? 'page-item_active': ''">
|
|
|
- <div v-if="currentIndex === index" class="tool">
|
|
|
+ <div v-if="currentClickIndex === index" class="tool">
|
|
|
<div class="tool_item" @click.stop="upClick(index)">
|
|
|
<el-icon>
|
|
|
<ArrowLeft/>
|
|
@@ -445,6 +430,7 @@ defineExpose({
|
|
|
</el-dialog>
|
|
|
|
|
|
<PageFormBind ref="bindRef"
|
|
|
+ :store="store"
|
|
|
@refresh="bindRefresh"
|
|
|
:data="pageData"
|
|
|
@requiredChange="requiredInit"
|