# Conflicts:
#	src/api/remoteSensingSourceData/remoteSensingSourceData.js
#	src/views/dataService/remoteSensingData/components/retrievalCondition.vue
This commit is contained in:
yyhouc 2023-05-24 18:48:48 +08:00
commit ce598472b3
4 changed files with 145 additions and 4 deletions

View File

@ -52,4 +52,13 @@ export const removeList = (ids) => {
method: 'delte', method: 'delte',
data: ids, data: ids,
}); });
} }
export const importTemplateImgList = (data) => {
return request({
url: '/api/' + moduleName + '/ui/remoteSensing/importTemplateImgList',
headers:{'Content-Type': 'multipart/form-data'},
method: 'post',
data: data
});
};

View File

@ -18,7 +18,6 @@ export function authDirective(app) {
app.directive('auth-role', { app.directive('auth-role', {
mounted(el, binding) { mounted(el, binding) {
const stores = useUserInfo(); const stores = useUserInfo();
console.log('指令验证',stores.userInfos);
if (!stores.userInfos.roles.some((v) => v === binding.value)) el.parentNode.removeChild(el); if (!stores.userInfos.roles.some((v) => v === binding.value)) el.parentNode.removeChild(el);
}, },
}); });

View File

@ -48,11 +48,19 @@
<el-upload ref="upFileRef" class="upload-demo" :accept="'.xls,.xlsx'" :auto-upload="false" <el-upload ref="upFileRef" class="upload-demo" :accept="'.xls,.xlsx'" :auto-upload="false"
:on-change="addRemoteSensingData" :show-file-list="false" style="margin-top:15px"> :on-change="addRemoteSensingData" :show-file-list="false" style="margin-top:15px">
<template #trigger> <template #trigger>
<el-button type="success">Upload</el-button> <el-button type="success">
<el-icon>
<ele-Upload />
</el-icon>Upload</el-button>
</template> </template>
</el-upload> </el-upload>
</el-col> </el-col>
<el-col :span="3" v-auth-role="'admin'"> <el-col :span="3">
<el-button class="ml10" type="success" style="margin-top:15px" @click="OpenuploadDataRef()">
Upload Img</el-button>
</el-col>
<el-col :span="3" v-auth-role="'admin'" style="margin-left:25px">
<el-button size="default" type="danger" v-auth-role="'admin'" class="upload-demo" style="margin-top: 15px; height: 40px;" @click="removeThis"> <el-button size="default" type="danger" v-auth-role="'admin'" class="upload-demo" style="margin-top: 15px; height: 40px;" @click="removeThis">
<el-icon> <el-icon>
<ele-Delete /> <ele-Delete />
@ -67,6 +75,18 @@
<el-table :data="state.requestData" style="width: 1000Px;" @selection-change="handleSelectionChange"> <el-table :data="state.requestData" style="width: 1000Px;" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" v-auth-role="'admin'" /> <el-table-column type="selection" width="55" v-auth-role="'admin'" />
<el-table-column type="index" label="Index" align="center" width="80"></el-table-column> <el-table-column type="index" label="Index" align="center" width="80"></el-table-column>
<el-table-column prop="thumbnailLink" label="thumbnail" width="180" show-overflow-tooltip>
<template #default="scope">
<el-popover trigger="hover" placement="right" popper-class="max-h-300px overflow-auto" :width="330">
<!-- table中原本显示的图片 -->
<template #reference>
<img :src="scope.row.thumbnailLink" :alt="scope.row.thumbnailLink" style="max-height: 130px;max-width: 130px">
</template>
<!-- 鼠标移入时弹出的图片 -->
<img :src="scope.row.thumbnailLink" alt="" style="height: 150px;width: 300px">
</el-popover>
</template>
</el-table-column>
<el-table-column prop="satelliteCode" label="Satellite code" width="170" align="center" show-overflow-tooltip <el-table-column prop="satelliteCode" label="Satellite code" width="170" align="center" show-overflow-tooltip
sortable></el-table-column> sortable></el-table-column>
<el-table-column prop="productTime" label="Product time" width="170" align="center" show-overflow-tooltip <el-table-column prop="productTime" label="Product time" width="170" align="center" show-overflow-tooltip
@ -100,6 +120,7 @@
</el-row> </el-row>
<approvalData ref="approvalDataRef" @callback="getData()" /> <approvalData ref="approvalDataRef" @callback="getData()" />
<addAddress ref="addAddressRef" @callback="getData()" /> <addAddress ref="addAddressRef" @callback="getData()" />
<uploadData ref="uploadDataRef" @callback="getData()" />
</div> </div>
</template> </template>
@ -111,6 +132,7 @@ import disasterTable from "/@/components/table/DisasterTable.vue";
import approvalData from "./approvalData.vue"; import approvalData from "./approvalData.vue";
import addAddress from "./addAddress.vue"; import addAddress from "./addAddress.vue";
import { ElMessageBox, ElMessage } from 'element-plus'; import { ElMessageBox, ElMessage } from 'element-plus';
import uploadData from "./uploadData.vue";
// //
const handleSelectionChange = (val) => { const handleSelectionChange = (val) => {
state.multipleSelection = val; state.multipleSelection = val;
@ -140,6 +162,7 @@ const removeThis = ()=>{
const approvalDataRef = ref(); const approvalDataRef = ref();
const addAddressRef = ref(); const addAddressRef = ref();
const upFileRef = ref(); const upFileRef = ref();
const uploadDataRef = ref();
const state = reactive({ const state = reactive({
disasterData: { disasterData: {
data: [], data: [],
@ -224,6 +247,9 @@ const state = reactive({
}, { }, {
label: 'Night light satellite', label: 'Night light satellite',
value: 'Night light satellite' value: 'Night light satellite'
}, {
label: 'Video satellite',
value: 'Video satellite'
}], }],
value_satelliteType: '', value_satelliteType: '',
value_resolution: [], value_resolution: [],
@ -261,6 +287,15 @@ const addAddressOpen = (row) => {
addAddressRef.value.openDialog(row); addAddressRef.value.openDialog(row);
}; };
//
const OpenuploadDataRef = () => {
if (state.disasterId == null) {
ElMessage.warning('Please select the disaster first');
return false;
}
uploadDataRef.value.openDialog(state.disasterId);
};
// //
const getData = () => { const getData = () => {
let data = { let data = {

View File

@ -0,0 +1,98 @@
<template>
<el-dialog title="upload" v-model="state.isShowDialog" width="550px">
<el-form :model="state.ruleForm" size="default" label-width="110px" ref="adminAddFormRef">
<el-form-item label="file:" style="margin-top: 30px;">
<el-upload ref="upFileRef" class="upload-demo" :file-list="state.fileList" style="width: 460px;"
:auto-upload="false" :on-change="handleChange" multiple = "true">
<template #trigger>
<el-button type="primary">select file</el-button>
</template>
</el-upload>
</el-form-item>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="onCancel" size="default">cancel</el-button>
<el-button type="primary" @click="uploadHandler()" size="default"
:loading="state.isLoading">upload</el-button>
</span>
</template>
</el-dialog>
</template>
<script setup>
import { reactive, ref } from "vue";
import { ElMessage } from "element-plus";
import { importTemplateImgList } from "/@/api/remoteSensingSourceData/remoteSensingSourceData.js";
const upFileRef = ref();
const emit = defineEmits(['callback']);
const adminAddFormRef = ref();
const state = reactive({
fileList: [],
dataList: [],
isShowDialog: false,
isLoading: false,
ruleForm: {
},
})
//onchanne
const handleChange = (file, fileList) => {
state.fileList = fileList;
};
//
const uploadHandler = () => {
const form = new FormData();
state.fileList.forEach(item=>{
state.dataList.push(item.raw);
form.append("fileList", item.raw);
})
form.append("disasterId", state.ruleForm.disasterId);
state.isLoading = true;
importTemplateImgList(form).then(da => {
ElMessage.success("success");
emit('callback');
}).finally(() => {
state.isLoading = false;
})
closeDialog();
};
const handleRemove = (uploadFile, uploadFiles) => {
console.log(uploadFile, uploadFiles)
}
const handlePreview = (file) => {
console.log(file)
}
//
const resetField = () => {
adminAddFormRef.value.resetFields();
state.fileArray = [];
upFileRef.value.clearFiles();
}
//
const openDialog = (row) => {
state.isShowDialog = true;
state.ruleForm.disasterId = row;
};
//
const closeDialog = () => {
state.isShowDialog = false;
resetField();
};
//
const onCancel = () => {
closeDialog();
};
//
defineExpose({
openDialog,
});
</script>
<style scoped></style>