mirror of
https://gitee.com/dromara/go-view.git
synced 2026-04-23 00:00:12 +08:00
feat: 新增编辑阶段 mock 接口轮询请求功能
This commit is contained in:
+1
-2
@@ -21,7 +21,7 @@
|
||||
<span>
|
||||
开发环境使用 mock 数据,请输入【
|
||||
<n-text type="info">
|
||||
{{ featchMockData }}
|
||||
{{featchMockData}}
|
||||
</n-text>
|
||||
】
|
||||
</span>
|
||||
@@ -56,7 +56,6 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, toRefs } from 'vue'
|
||||
import { icon } from '@/plugins'
|
||||
import { CreateComponentType } from '@/packages/index.d'
|
||||
import { SettingItemBox } from '@/components/ChartItemSetting/index'
|
||||
import { RequestHttpEnum } from '@/enums/httpEnum'
|
||||
import { featchMockData } from '@/api/mock'
|
||||
|
||||
-1
@@ -75,7 +75,6 @@ const { targetData } = useTargetData()
|
||||
const props = defineProps({
|
||||
ajax: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
|
||||
+1
-8
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="go-chart-configurations-data-static">
|
||||
<chart-data-matching-and-show></chart-data-matching-and-show>
|
||||
<chart-data-matching-and-show :ajax="false"></chart-data-matching-and-show>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -8,13 +8,6 @@
|
||||
import { PropType } from 'vue'
|
||||
import { CreateComponentType } from '@/packages/index.d'
|
||||
import { ChartDataMatchingAndShow } from '../ChartDataMatchingAndShow'
|
||||
|
||||
const props = defineProps({
|
||||
targetData: {
|
||||
type: Object as PropType<CreateComponentType>,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -5,7 +5,6 @@ import { readFile, downloadFile } from '@/utils'
|
||||
|
||||
export const useFile = (targetData: any) => {
|
||||
const uploadFileListRef = ref()
|
||||
const option = toRef(targetData, 'option')
|
||||
|
||||
//@ts-ignore
|
||||
const beforeUpload = ({ file }) => {
|
||||
@@ -24,8 +23,7 @@ export const useFile = (targetData: any) => {
|
||||
nextTick(() => {
|
||||
if (file.file) {
|
||||
readFile(file.file).then((fileData: any) => {
|
||||
option.value.dataset = JSON.parse(fileData)
|
||||
console.log(option.value.dataset)
|
||||
targetData.value.option.dataset = JSON.parse(fileData)
|
||||
})
|
||||
} else {
|
||||
window['$message'].error('导入数据失败,请稍后重试或联系管理员!')
|
||||
@@ -37,9 +35,9 @@ export const useFile = (targetData: any) => {
|
||||
const download = () => {
|
||||
try {
|
||||
window['$message'].success('下载中,请耐心等待...')
|
||||
downloadFile(JSON.stringify(option.value.dataset), undefined, 'json')
|
||||
downloadFile(JSON.stringify(targetData.value.option.dataset), undefined, 'json')
|
||||
} catch (error) {
|
||||
window['$message'].success('下载失败,数据错误!')
|
||||
window['$message'].error('下载失败,数据错误!')
|
||||
}
|
||||
}
|
||||
return {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { RequestDataTypeEnum } from '@/store/modules/chartEditStore/chartEditStore.d'
|
||||
import { RequestHttpEnum } from '@/enums/httpEnum'
|
||||
import { RequestHttpEnum, RequestDataTypeEnum } from '@/enums/httpEnum'
|
||||
|
||||
// 匹配结果
|
||||
export enum DataResultEnum {
|
||||
|
||||
@@ -6,23 +6,26 @@
|
||||
:options="selectOptions"
|
||||
/>
|
||||
</setting-item-box>
|
||||
|
||||
<n-divider style="margin: 10px 0;"></n-divider>
|
||||
|
||||
<!-- 静态 -->
|
||||
<chart-data-static
|
||||
v-if="targetData.data.requestDataType === RequestDataTypeEnum.STATIC"
|
||||
></chart-data-static>
|
||||
|
||||
<!-- 动态 -->
|
||||
<chart-data-ajax></chart-data-ajax>
|
||||
<chart-data-ajax v-else></chart-data-ajax>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { SettingItemBox } from '@/components/ChartItemSetting/index'
|
||||
import { RequestDataTypeEnum } from '@/store/modules/chartEditStore/chartEditStore.d'
|
||||
import { useTargetData } from '../hooks/useTargetData.hook'
|
||||
import { ChartDataStatic } from './components/ChartDataStatic/index'
|
||||
import { ChartDataAjax } from './components/ChartDataAjax/index'
|
||||
import { SelectCreateDataType, SelectCreateDataEnum } from './index.d'
|
||||
import { RequestDataTypeEnum } from '@/enums/httpEnum'
|
||||
|
||||
const { targetData } = useTargetData()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user