guoshilong
2023-09-08 cee338f18d22bbbb989d79c0add082fdb4e2b8ef
store添加projectId
4 files modified
1 files added
29 ■■■■ changed files
src/api/wayline.ts 4 ●●●● patch | view | raw | blame | history
src/pages/page-web/projects/project_list/list_page/components/ProjectList.vue 3 ●●●●● patch | view | raw | blame | history
src/pages/page-web/projects/wayline.vue 3 ●●●● patch | view | raw | blame | history
src/store/common.ts 15 ●●●●● patch | view | raw | blame | history
src/store/index.ts 4 ●●● patch | view | raw | blame | history
src/api/wayline.ts
@@ -3,7 +3,7 @@
import { TaskType, TaskStatus, OutOfControlAction } from '/@/types/task'
import { WaylineType } from '/@/types/wayline'
const HTTP_PREFIX = '/wayline/api/v1'
const HTTP_PREFIX = 'drone/waylineFile'
// Get Wayline Files
export const getWaylineFiles = async function (wid: string, body: {}): Promise<IWorkspaceResponse<any>> {
@@ -120,7 +120,7 @@
// Upload Wayline file
export const importKmzFile = async function (workspaceId: string, file: {}): Promise<IWorkspaceResponse<any>> {
  const url = `${HTTP_PREFIX}/workspaces/${workspaceId}/waylines/file/upload`
  const url = `api/${HTTP_PREFIX}/upload`
  const result = await request.post(url, file, {
    headers: {
      'Content-Type': 'multipart/form-data',
src/pages/page-web/projects/project_list/list_page/components/ProjectList.vue
@@ -64,6 +64,8 @@
import { status, projectCard } from './data'
import { del, edit } from '/@/api/project-page'
import { Modal, message } from 'ant-design-vue'
import { useMyStore} from "/@/store";
const store = useMyStore()
const router = useRouter()
const emit = defineEmits(['refreshList', 'update:modelValue'])
const props = defineProps({
@@ -131,6 +133,7 @@
const goDetail = (item: any) => {
  console.log(11)
  store.commit('SET_PROJECT_ID', item.id)
  router.push({
    name: ERouterName.WORKSPACE,
    query: { id: item.id }
src/pages/page-web/projects/wayline.vue
@@ -98,6 +98,7 @@
const loading = ref(false)
const store = useMyStore()
const projectId = store.state.common.projectId
const pagination :IPage = {
  page: 1,
  total: -1,
@@ -220,7 +221,7 @@
  fileList.value.forEach(async (file: FileItem) => {
    const fileData = new FormData()
    fileData.append('file', file, file.name)
    await importKmzFile(workspaceId, fileData).then((res) => {
    await importKmzFile(projectId, fileData).then((res) => {
      if (res.code === 0) {
        message.success(`${file.name} file uploaded successfully`)
        canRefresh.value = true
src/store/common.ts
New file
@@ -0,0 +1,15 @@
import { MutationTree } from 'vuex'
const state = () => ({
  projectId: null as string | null
})
export type RootStateType = ReturnType<typeof state>
const mutations: MutationTree<RootStateType> = {
  SET_PROJECT_ID (state, projectId: string) {
    state.projectId = projectId
  },
}
export default {
  state,
  mutations
}
src/store/index.ts
@@ -8,6 +8,7 @@
import getter from './getters'
import { DevicesCmdExecuteInfo } from '/@/types/device-cmd'
import map from './map'
import common from "/@/store/common";
const initStateFunc = () => ({
  Layers: [
@@ -245,7 +246,8 @@
  actions,
  modules: {
    getter,
    map
    map,
    common
  },
}