guoshilong
2023-09-12 03a6ea84ba129caac4a82c405e739b682db08241
航线上传
3 files modified
69 ■■■■■ changed files
src/api/wayline.ts 9 ●●●●● patch | view | raw | blame | history
src/components/task/CreatePlan.vue 43 ●●●● patch | view | raw | blame | history
src/pages/page-web/projects/wayline.vue 17 ●●●● patch | view | raw | blame | history
src/api/wayline.ts
@@ -6,9 +6,9 @@
const HTTP_PREFIX = '/api/drone'
// Get Wayline Files
export const getWaylineFiles = async function (wid: string, body: {}): Promise<IWorkspaceResponse<any>> {
  const url = `${HTTP_PREFIX}/workspaces/${wid}/waylines?order_by=${body.order_by}&page=${body.page}&page_size=${body.page_size}`
  const result = await request.get(url)
export const getWaylineFiles = async function (params:any): Promise<IWorkspaceResponse<any>> {
  const url = `${HTTP_PREFIX}/waylineFile/getList`
  const result = await request.get(url,{ params })
  return result.data
}
@@ -136,6 +136,9 @@
export const importKmzFile = async function (workspaceId: string, file: {}): Promise<IWorkspaceResponse<any>> {
  const url = `${HTTP_PREFIX}/waylineFile/upload`
  const result = await request.post(url, file, {
    params:{
      projectId: workspaceId
    },
    headers: {
      'Content-Type': 'multipart/form-data',
    }
src/components/task/CreatePlan.vue
@@ -11,7 +11,7 @@
        </a-form-item>
        <!-- 航线 -->
        <a-form-item label="执行航线" :wrapperCol="{offset: 10}" name="fileId">
        <a-form-item label="执行航线" :wrapperCol="{offset: 12}" name="fileId">
          <router-link
              :to="{name: 'select-plan'}"
              @click="selectRoute"
@@ -55,7 +55,7 @@
        </a-form-item>
        <!-- 设备 -->
        <a-form-item label="执行设备" :wrapperCol="{offset: 10}" v-model:value="planForm.dockSn" name="dockSn">
        <a-form-item label="执行设备" :wrapperCol="{offset: 12}" v-model:value="planForm.dockSn" name="dockSn">
          <router-link
              :to="{name: 'select-plan'}"
              @click="selectDevice"
@@ -87,7 +87,9 @@
                }}
              </a-radio-button>
            </a-radio-group>
          </div>
        </a-form-item>
        <!-- 单次定时- -->
@@ -198,20 +200,23 @@
        <!-- 相对机场返航高度 -->
        <a-form-item label="相对机场返航高度(ALT)" :labelCol="{span: 23}" name="rthAltitude">
          <a-button type="primary" :disabled="calculateDisabled('-',100)" @click="calculate('-',100)">-100</a-button>
          <a-button type="primary" :disabled="calculateDisabled('-',10)" @click="calculate('-',10)">-10</a-button>
          <a-button type="primary" :disabled="calculateDisabled('-',1)" @click="calculate('-',1)">-1</a-button>
          <div class="form-alt">
            <a-button class="alt-btn" type="primary" size="small" :disabled="calculateDisabled('-',100)" @click="calculate('-',100)">-100</a-button>
            <a-button class="alt-btn" type="primary" size="small" :disabled="calculateDisabled('-',10)" @click="calculate('-',10)">-10</a-button>
            <a-button class="alt-btn" type="primary" size="small" :disabled="calculateDisabled('-',1)" @click="calculate('-',1)">-1</a-button>
          <a-input-number v-model:value="planForm.rthAltitude" :min="20" :max="1500" class="width-100" required/>
            <a-input class="alt-input" v-model:value="planForm.rthAltitude" :min="20" :max="1500"  required/>
          <a-button type="primary" :disabled="calculateDisabled('+',1)" @click="calculate('+',1)">+1</a-button>
          <a-button type="primary" :disabled="calculateDisabled('+',10)" @click="calculate('+',10)">+10</a-button>
          <a-button type="primary" :disabled="calculateDisabled('+',100)" @click="calculate('+',100)"> +100</a-button>
            <a-button class="alt-btn" type="primary" size="small" :disabled="calculateDisabled('+',1)" @click="calculate('+',1)">+1</a-button>
            <a-button class="alt-btn" type="primary" size="small" :disabled="calculateDisabled('+',10)" @click="calculate('+',10)">+10</a-button>
            <a-button class="alt-btn" type="primary" size="small" :disabled="calculateDisabled('+',100)" @click="calculate('+',100)"> +100</a-button>
          </div>
        </a-form-item>
        <!-- Lost Action -->
        <a-form-item label="航线飞行中失联" :labelCol="{span: 23}" name="outOfControl">
          <div style="white-space: nowrap;">
          <div class="form-outOfControl" style="white-space: nowrap;">
            <a-radio-group v-model:value="planForm.outOfControl" button-style="solid">
              <a-radio-button v-for="action in OutOfControlActionOptions" :value="action.value" :key="action.value">
                {{ action.label }}
@@ -534,7 +539,7 @@
  height: 100vh;
  display: flex;
  flex-direction: column;
  width: 285px;
  width: 320px;
  .header {
    height: 52px;
@@ -573,7 +578,7 @@
      .ant-radio-button-wrapper {
        background-color: #232323;
        color: #fff;
        width: 20%;
        width: 23%;
        text-align: center;
        &.ant-radio-button-wrapper-checked {
@@ -639,6 +644,20 @@
  }
}
.form-alt{
  display: flex;
  align-items: center;
  .alt-btn{
    margin: 0 2px 0 2px ;
    width: 45px;
  }
  .alt-input{
    width: 50px;
  }
}
.btn-selected{
  background: #2d8cf0 !important;
  color:white !important;
src/pages/page-web/projects/wayline.vue
@@ -138,17 +138,18 @@
    return
  }
  canRefresh.value = false
  getWaylineFiles(workspaceId, {
    page: pagination.page,
    page_size: pagination.page_size,
    order_by: 'update_time desc'
  getWaylineFiles({
    workspaceId: projectId,
  }).then(res => {
    if (res.code !== 0) {
    console.log(res, '+++++++++++++++++++++++++++++++++++++')
    if (res.code !== 5000) {
      return
    }
    waylinesData.data = [...waylinesData.data, ...res.data.list]
    pagination.total = res.data.pagination.total
    pagination.page = res.data.pagination.page
    const data = res.data
    waylinesData.data = [...waylinesData.data, ...data]
  }).finally(() => {
    canRefresh.value = true
  })