无人机管理后台前端(已迁走)
张含笑
2025-09-02 38d20755f3c5e248aa1efda2dee0860c3e9a6bfd
src/views/resource/patchManagement.vue
@@ -55,7 +55,7 @@
        <el-form-item label="图斑类型" prop="region">
          <el-select v-model="ruleForm.region" placeholder="请选择图斑类型">
            <el-option
              v-for="item in spotTypeOption"
              v-for="item in allspotTypeOption"
              :key="item.value"
              :label="item.label"
              :value="item.value"
@@ -83,9 +83,8 @@
      :title="spotDetailsTitle"
      :detailid="detailid"
      :detailList="detailList"
      :spotTypeOption="spotTypeOption"
      :spotTypeOption="allspotTypeOption"
    ></SpotDetails>
  </basic-container>
</template>
<script setup>
@@ -96,6 +95,7 @@
  tableMapListApi,
  exportExcel,
  patchDeleteApi,
  listOfSpotTypesApi,
} from '@/api/patchManagement/index';
import { getRegionTreeAll } from '@/api/job/task';
import { ref, computed, watch } from 'vue';
@@ -107,7 +107,7 @@
import patchDetails from '@/views/resource/components/patchDetails.vue';
import SpotDetails from '@/views/resource/components/spotDetails.vue';
const spotDetailsTitle = ref('');
const detailList = ref('')
const detailList = ref('');
const store = useStore();
const router = useRouter();
const ruleFormRef = ref(null);
@@ -136,7 +136,6 @@
const query = ref({});
const loading = ref(true);
const box = ref(false);
const page = ref({
  pageSize: 20,
  currentPage: 1,
@@ -144,11 +143,10 @@
  lotTypeId: '',
  createUser: '',
  areaCode:'',
  fileName:''
  fileName: '',
});
const selectionList = ref([]);
const option = ref({
 align: 'center', 
  headerAlign: 'center',
@@ -275,7 +273,7 @@
const ids = computed(() => selectionList.value.map(ele => ele.id).join(','));
// 获取行政区划
const regionalData = ref([])
const regionalData = ref([]);
const requestDockInfo = () => {
  getRegionTreeAll({ parentCode: userAreaCode.value }).then(res => { 
    const rawData = res.data.data ? [res.data.data] : []; 
@@ -326,8 +324,20 @@
    }));
    regionalScope.value = res.data.data.area_codes;
    requestDockInfo();
  });
};
const allspotTypeOption = ref([]);
// 获取上传图斑类型
const getlistOfSpotTypesApi = () => {
  const searchparams = {
    current: 1,
    size: 9999,
  };
  listOfSpotTypesApi(searchparams).then(res => {
    allspotTypeOption.value = res.data.data.records.map(item => ({
      label: item.patches_type,
      value: item.id,
    }));
  });
};
// ===== watch =====
@@ -372,7 +382,6 @@
};
const rowDel = row => {
 ElMessageBox.confirm('确定将选择数据删除?', '提示', {
    confirmButtonText: '确定',
    cancelButtonText: '取消',
@@ -380,18 +389,18 @@
  })
  .then(() => patchDeleteApi(row.id))  // 直接传递ID
  .then(() => {
    onLoad(page.value)
    ElMessage.success('操作成功!')
  })
      onLoad(page.value);
      ElMessage.success('操作成功!');
    });
};
const searchReset = () => {
page.value.areaCode=''
page.value.createUser=''
page.value.fileName=''
  page.value.lotTypeId =''
page.value.currentPage=1
page.value.pageSize=20
  page.value.areaCode = '';
  page.value.createUser = '';
  page.value.fileName = '';
  page.value.lotTypeId = '';
  page.value.currentPage = 1;
  page.value.pageSize = 20;
  onLoad(page.value);
};
@@ -399,9 +408,9 @@
  page.value.currentPage = 1;
  page.value.lotTypeId = params.patches_type_desc;
  page.value.createUser = params.user_name;
  page.value.fileName=params.file_name
  page.value.areaCode=params.areaName
  page.value.createUser= params.user_name
  page.value.fileName = params.file_name;
  page.value.areaCode = params.areaName;
  page.value.createUser = params.user_name;
  onLoad(page.value);
  done();
};
@@ -445,27 +454,26 @@
    lotTypeId: pageInfo.lotTypeId,
    fileName:pageInfo.fileName,
    areaCode:pageInfo.areaCode,
    createUser:pageInfo.createUser
    createUser: pageInfo.createUser,
  };
  loading.value = true;
  spotManagementTableApi(searchparams).then(res => {
    const d = res.data.data;
    page.value.total = d.total;
    data.value = d.records
    .map(i=>({
    data.value = d.records.map(i => ({
      ...i,
      dataFrom:i.date_from === 0? '本地上传':'国土调查云',
      areaName: findAreaName(i.area_code)
      areaName: findAreaName(i.area_code),
    }));
    loading.value = false;
    selectionClear();
  });
};
const findAreaName = (areaCode) => {
const findAreaName = areaCode => {
  const nodes = regionalData.value;
  if (!nodes || nodes.length === 0) return areaCode;
  const normalizeCode = (code) => {
  const normalizeCode = code => {
    if (!code) return '';
    const strCode = String(code).replace(/0+$/, '');
    return strCode.length >= 6 ? strCode : '';
@@ -494,7 +502,7 @@
  detailid.value = row.id;
  uploadPatchDialog.value = true;
  spotDetailsTitle.value = type === 'detail' ? '图斑详情' : '图斑编辑';
  detailList.value = row
  detailList.value = row;
};
// 跳转至图斑类型管理页面
@@ -507,7 +515,8 @@
  if (!selectionList.value.length) {
    return ElMessage.warning('请选择需要导出的数据');
  }
  exportExcel(selectionList.value?.map(i => i.id).join(',')).then(res => {
  const a = selectionList.value.map(i => Number(i.id));
  exportExcel(a).then(res => {
    const elink = document.createElement('a');
    elink.download = new Date().getTime() + '.xls';
    elink.style.display = 'none';
@@ -562,7 +571,7 @@
provide('searchReset', searchReset);
onMounted(() => {
  getsearchManagementApi();
  getlistOfSpotTypesApi();
});
</script>