文件上传内容优化,详情相关图片地址修改

xjl
刘妍 2 years ago
parent fa25527257
commit 4845f18684

@ -6,7 +6,7 @@ import { AxiosProgressEvent } from 'axios';
const { uploadUrl } = useGlobSetting();
const uploadFileUrl = uploadUrl + '/api/Platform/Upload'
const uploadFileUrl = uploadUrl + '/api/Platform/Upload';
/**
* @description: Upload interface
*/

@ -1,7 +1,5 @@
import { defineStore } from 'pinia';
export const flowStore = defineStore({
id: 'flow',
state: () => ({
@ -20,44 +18,44 @@ export const flowStore = defineStore({
setWfDataName(id, name) {
this.flowWfData.forEach((element: any) => {
if (element.id == id && name) {
element.name = name
element.name = name;
}
});
},
setElments(data) {
this.flowElements = data
this.flowElements = data;
},
// 获取单个节点的数据
getWfDataNode(id) {
var currentIndex = (this.flowWfData || []).findIndex((element) => element.id === id);
if (currentIndex == -1) {
return null
return null;
} else {
return this.flowWfData[currentIndex]
return this.flowWfData[currentIndex];
}
},
// 添加单个节点的数据
setWfDataNode(data) {
let flowWfData = this.flowWfData
let flowWfData = this.flowWfData;
var currentIndex = (flowWfData || []).findIndex((element) => element.id === data.id);
if (currentIndex == -1) {
this.flowWfData.push(data)
this.flowWfData.push(data);
}
},
// 全覆盖,供更新和详情使用
setWfDataAll(list) {
this.flowWfData = list
this.flowWfData = list;
},
// 修改单个节点的某项数据
updataWfDataNode(id, key, value) {
let flowWfData = this.flowWfData
let flowWfData = this.flowWfData;
var currentIndex = (flowWfData || []).findIndex((element) => element.id === id);
this.flowWfData[currentIndex][key] = value
this.flowWfData[currentIndex][key] = value;
},
deleteWfData(data) {
let flowWfData = this.flowWfData
let flowWfData = this.flowWfData;
var currentIndex = (flowWfData || []).findIndex((element) => element.id === data.id);
this.flowWfData.splice(currentIndex, 1)
}
this.flowWfData.splice(currentIndex, 1);
},
},
});

@ -128,8 +128,7 @@ export class VAxios {
*/
uploadFile<T = any>(config: AxiosRequestConfig, params: UploadFileParams) {
const formData = new window.FormData();
const customFilename = params.name || 'file';
const customFilename = 'files';
if (params.filename) {
formData.append(customFilename, params.file, params.filename);
} else {

@ -1,12 +1,7 @@
<template>
<div class="case-view">
<div class="case-view_step">
<a-steps
v-model:current="current"
type="navigation"
size="small"
:style="stepStyle"
>
<a-steps v-model:current="current" type="navigation" size="small" :style="stepStyle">
<a-step
v-for="(item, index) in flowLog"
:key="index"
@ -23,7 +18,7 @@
:canExpan="false"
v-if="current == 0 || current == 4"
>
<Issue :data="detailData"></Issue>
<Issue :data="detailData" :imageList="imageList"></Issue>
</CollapseContainer>
<CollapseContainer
@ -138,7 +133,12 @@
</a-descriptions>
</CollapseContainer>
</div>
<CollapseContainer v-if="props.mapShow" title="地图位置" :canExpan="false" class="map_box ml-1 w-1/2 xl:w-1/2">
<CollapseContainer
v-if="props.mapShow"
title="地图位置"
:canExpan="false"
class="map_box ml-1 w-1/2 xl:w-1/2"
>
<MapDetail :ruleForm="detailData" :isOnce="true"></MapDetail>
</CollapseContainer>
</div>
@ -161,7 +161,9 @@
Investigate,
Procedure,
} from '../index';
const BASE_IMAGE_URL = ref('http://192.168.104:9011');
//
import { useGlobSetting } from '@/hooks/setting';
const { uploadUrl } = useGlobSetting();
const current = ref<number>(0);
const stepStyle = ref({
marginBottom: '60px',
@ -175,15 +177,13 @@
mapShow: {
type: Boolean,
default: () => {
return true ;
return true;
},
},
});
console.log(props);
watch(
() => props.caseId,
(newVal, oldVal) => {
console.log(newVal);
getCaseFlowLogData();
loadDetailCaseInfo();
getCaseHandleInfo();
@ -192,6 +192,8 @@
const detailData = ref();
const caseHandleInfo = ref();
const playerOptions = ref();
//
const imageList = ref<fileListModel>([]);
//
const threadImageList = ref<fileListModel>([]);
//
@ -242,14 +244,16 @@
}
//
async function loadDetailCaseInfo() {
imageList.value = [];
const data = await getCaseInfo({ id: props.caseId });
console.log(data);
detailData.value = data;
for (let i = 0; i < data.pic_list.length; i++) {
imageList.value.push(uploadUrl + '/' + data.pic_list[i]);
}
}
//
async function getCaseHandleInfo() {
const data = await getDroneCaseDeal({ caseid: props.caseId });
console.log(data);
caseHandleInfo.value = data;
if (caseHandleInfo.value.is_illegal == 0) {
caseHandleInfo.value.is_illegal = '合法';
@ -274,7 +278,7 @@
sources: [
{
type: '',
src: BASE_IMAGE_URL + '/' + item, //url
src: uploadUrl + '/' + item, //url
},
],
poster: '', //
@ -292,23 +296,17 @@
}
//
if (data.pic_info_list.length > 0) {
threadImageList.value = []
data.pic_info_list.forEach((item) => {
threadImageList.value.push(item.filePath);
threadImageList.value.push(uploadUrl + '/' + item.filePath);
});
for (let i = 0; i < threadImageList.value.length; i++) {
let obj = {
filePath: BASE_IMAGE_URL + '/' + threadImageList.value[i],
s_filePath: BASE_IMAGE_URL + '/S_' + threadImageList.value[i],
};
threadImageList.value[i] = obj;
}
}
//
if (data.after_pic_list.length > 0) {
threadAfterImageList.value = [];
data.after_pic_list.forEach((item: fileList) => {
threadAfterImageList.value.push(BASE_IMAGE_URL + '/S_' + item.filePath);
data.after_pic_list.forEach((item) => {
threadAfterImageList.value.push(uploadUrl + '/' + item.filePath);
});
}
@ -329,7 +327,7 @@
sources: [
{
type: '',
src: BASE_IMAGE_URL + '/' + item, //url
src: uploadUrl + '/' + item, //url
},
],
poster: '', //
@ -349,22 +347,14 @@
if (data.evidence_file_list.length > 0) {
evidenceFileList.value = [];
data.evidence_file_list.forEach((item: fileList) => {
let obj = {
filePath: BASE_IMAGE_URL + '/' + item.filePath,
s_filePath: BASE_IMAGE_URL + '/' + item.filePath,
};
evidenceFileList.value.push(obj);
evidenceFileList.value.push(uploadUrl + '/' + item.filePath);
});
}
if (data.boundary_pic_list.length > 0) {
boundaryImageList.value = [];
data.boundary_pic_list.forEach((item) => {
let obj = {
filePath: BASE_IMAGE_URL + '/' + item,
s_filePath: BASE_IMAGE_URL + '/' + item,
};
boundaryImageList.value.push(obj);
boundaryImageList.value.push(uploadUrl + '/' + item);
});
}
@ -372,11 +362,7 @@
if (data.punish_pic_list.length > 0) {
punishImageList.value = [];
data.punish_pic_list.forEach((item) => {
let obj = {
filePath: BASE_IMAGE_URL + '/' + item,
s_filePath: BASE_IMAGE_URL + '/S_' + item,
};
punishImageList.value.push(obj);
punishImageList.value.push(uploadUrl + '/' + item);
});
}
@ -384,11 +370,7 @@
if (data.payment_pic_list.length > 0) {
paymentImageList.value = [];
data.payment_pic_list.forEach((item) => {
let obj = {
filePath: BASE_IMAGE_URL + '/' + item,
s_filePath: BASE_IMAGE_URL + '/S_' + item,
};
paymentImageList.value.push(obj);
paymentImageList.value.push(uploadUrl + '/' + item);
});
}
@ -396,11 +378,7 @@
if (data.agree_checkout_pic_list.length > 0) {
agreeImageList.value = [];
data.agree_checkout_pic_list.forEach((item) => {
let obj = {
filePath: BASE_IMAGE_URL + '/' + item,
s_filePath: BASE_IMAGE_URL + '/S_' + item,
};
agreeImageList.value.push(obj);
agreeImageList.value.push(uploadUrl + '/' + item);
});
}
@ -408,11 +386,7 @@
if (data.checkout_pic_list.length > 0) {
checkoutImageList.value = [];
data.checkout_pic_list.forEach((item) => {
let obj = {
filePath: BASE_IMAGE_URL + '/' + item,
s_filePath: BASE_IMAGE_URL + '/S_' + item,
};
checkoutImageList.value.push(obj);
checkoutImageList.value.push(uploadUrl + '/' + item);
});
}
}
@ -438,7 +412,7 @@
.file-box {
overflow-y: auto;
}
.file-all{
.file-all {
overflow-y: auto;
width: 100%;
}

@ -8,7 +8,7 @@
</a-descriptions-item>
<a-descriptions-item label="拟拆除后照片">
<div>
<ImagePreview :imageList="imgList" />
<ImagePreview :imageList="threadAfterImageList" />
</div>
</a-descriptions-item>
<a-descriptions-item label="视频">

@ -170,7 +170,7 @@
<a-descriptions-item label="现场照片">
<div>
<ImagePreview :imageList="imgList" />
<ImagePreview :imageList="threadImageList" />
</div>
</a-descriptions-item>
<a-descriptions-item label="现场视频">
@ -220,7 +220,6 @@
},
},
});
console.log(props)
caseHandleInfo.value = props.data;
playerOptions.value = props.playerOptions;
threadImageList.value = props.threadImageList;

@ -53,20 +53,24 @@
return {};
},
},
imageList: {
type: Object,
default: () => {
return [];
},
},
});
if(Object.keys(props.data).length != 0){
console.log(props)
const imgList = ref([]);
if (Object.keys(props.data).length != 0) {
caseDetail.value = props.data.info;
imgList.value = props.imageList;
}
const imgList = ref([
'https://picsum.photos/id/66/346/216',
'https://picsum.photos/id/67/346/216',
'https://picsum.photos/id/68/346/216',
]);
watch(
() => props.data,
(newVal, oldVal) => {
caseDetail.value = newVal.info;
imgList.value = props.imageList;
},
);
</script>

@ -92,7 +92,7 @@
</template>
<a-tabs v-model:activeKey="activeKey">
<a-tab-pane key="1" tab="案件判读">
<Interpret :interpretData="interpretData"></Interpret>
<Interpret :interpretData="interpretData" @close="changeType"></Interpret>
</a-tab-pane>
<a-tab-pane key="2" tab="案件处理">
<Dispose :id="interpretData.id"></Dispose>

@ -1,82 +1,108 @@
<template>
<div class="interpret-box">
<a-form
ref="formRef"
:rules="data.rules"
:model="ruleForm"
:label-col="labelCol"
:wrapper-col="wrapperCol"
>
<a-form-item label="案件编号">
<a-input v-model:value="ruleForm.case_no" disabled />
</a-form-item>
<a-form-item label="案件详情">
<a-input v-model:value="ruleForm.case_description" placeholder="请输入" />
</a-form-item>
<a-form-item label="违规类型" name="typeid">
<a-select
v-model:value="ruleForm.typeid"
placeholder="请选择"
:options="data.violationOptions"
:field-names="{ label: 'itemName', value: 'itemValue' }"
>
</a-select>
</a-form-item>
<a-form-item label="图斑面积">
<a-input v-model:value="ruleForm.area" placeholder="请输入" />
</a-form-item>
<a-form-item label="县/区">
<a-select
v-model:value="ruleForm.countyid"
placeholder="请选择"
:options="data.cityDatas"
:field-names="{ label: 'itemName', value: 'itemValue' }"
>
</a-select>
</a-form-item>
<a-form-item label="乡镇/街道">
<a-select
v-model:value="ruleForm.streetid"
placeholder="请选择"
:options="data.streetDatas"
:field-names="{ label: 'itemName', value: 'itemValue' }"
>
</a-select>
</a-form-item>
<a-form-item label="社区/村">
<a-select
v-model:value="ruleForm.communityname"
placeholder="请选择"
:options="data.communtDatas"
:field-names="{ label: 'itemName', value: 'itemValue' }"
>
</a-select>
</a-form-item>
<a-form-item label="详细地址">
<a-input v-model:value="ruleForm.address" placeholder="请输入" />
</a-form-item>
<a-form-item label="备注">
<a-textarea
v-model:value="ruleForm.description"
placeholder="备注"
:auto-size="{ minRows: 1, maxRows: 3 }"
/>
</a-form-item>
<a-form-item label="现场照片">
<ImageUpload :maxSize="20" v-model:file-list="fileList" :maxNumber="10" @change="handleChange" :api="uploadApi" />
</a-form-item>
</a-form>
<div class="interpret-form">
<a-form
ref="formRef"
:rules="data.rules"
:model="ruleForm"
:label-col="labelCol"
:wrapper-col="wrapperCol"
>
<a-form-item label="案件编号">
<a-input v-model:value="ruleForm.case_no" disabled />
</a-form-item>
<a-form-item label="案件详情">
<a-input v-model:value="ruleForm.case_description" placeholder="请输入" />
</a-form-item>
<a-form-item label="违规类型" name="typeid">
<a-select
v-model:value="ruleForm.typeid"
placeholder="请选择"
:options="data.violationOptions"
:field-names="{ label: 'itemName', value: 'itemValue' }"
>
</a-select>
</a-form-item>
<a-form-item label="图斑面积">
<a-input v-model:value="ruleForm.area" placeholder="请输入" />
</a-form-item>
<a-form-item label="县/区">
<a-select
v-model:value="ruleForm.countyid"
placeholder="请选择"
:options="data.cityDatas"
:field-names="{ label: 'itemName', value: 'itemValue' }"
>
</a-select>
</a-form-item>
<a-form-item label="乡镇/街道">
<a-select
v-model:value="ruleForm.streetid"
placeholder="请选择"
:options="data.streetDatas"
:field-names="{ label: 'itemName', value: 'itemValue' }"
>
</a-select>
</a-form-item>
<a-form-item label="社区/村">
<a-select
v-model:value="ruleForm.communityname"
placeholder="请选择"
:options="data.communtDatas"
:field-names="{ label: 'itemName', value: 'itemValue' }"
>
</a-select>
</a-form-item>
<a-form-item label="详细地址">
<a-input v-model:value="ruleForm.address" placeholder="请输入" />
</a-form-item>
<a-form-item label="备注">
<a-textarea
v-model:value="ruleForm.description"
placeholder="备注"
:auto-size="{ minRows: 1, maxRows: 3 }"
/>
</a-form-item>
<a-form-item label="现场照片">
<ImagePreview :imageList="abbreviationPicListData" />
<ImageUpload
file-list="fileList"
:maxSize="20"
:maxNumber="10"
:api="imgApi"
:multiple="true"
@delete="handleRemove"
/>
</a-form-item>
</a-form>
</div>
<div class="btn-box">
<a-button color="info" class="ml-2" @click="resetForm"></a-button>
<a-button color="info" class="ml-2" type="primary" @click="saveForm"></a-button>
<a-button color="success" class="ml-2" type="primary" @click="submitForm"></a-button>
<a-button color="info" class="ml-2" type="primary" danger @click="eventClose"></a-button>
</div>
</div>
</template>
<script lang="ts" setup>
import { ImageUpload } from '@/components/Upload';
import { ref, reactive , watch} from 'vue';
import {uploadApi} from '@/api/sys/upload'
import { ref, reactive, watch, onMounted } from 'vue';
import { ImagePreview } from '@/components/Preview';
import { getCaseInfo } from '@/api/monitor/index';
import { uploadApi } from '@/api/sys/upload';
//
import { useGlobSetting } from '@/hooks/setting';
const { uploadUrl } = useGlobSetting();
const emit = defineEmits(['close']);
const formRef = ref();
const labelCol = { span: 7 };
const wrapperCol = { span: 17 };
const ruleForm = ref({});
const fileList = ref([]);
const filSuccessList = ref([]);
const formData = ref({});
const picListData = ref([]);
const abbreviationPicListData = ref(['https://picsum.photos/id/66/346/216']);
const data = reactive({
violationOptions: [],
communtDatas: [],
@ -86,7 +112,11 @@
typeid: [{ required: true, message: '请选择违规类型' }],
},
});
watch(fileList, (newValue) => {
// fileList
// newValue formUser === formUser.value
console.log(newValue);
});
const props = defineProps({
interpretData: {
type: Object,
@ -95,32 +125,45 @@
},
},
});
console.log(props.interpretData);
ruleForm.value = props.interpretData;
watch(
() => props.interpretData,
(newVal, oldVal) => {
ruleForm.value = newVal;
getFormData();
},
);
const handleChange = (info: UploadChangeParam) => {
if (info.file.status === 'uploading') {
loading.value = true;
return;
}
if (info.file.status === 'done') {
// Get this url from response in real world.
getBase64(info.file.originFileObj, (base64Url: string) => {
imageUrl.value = base64Url;
loading.value = false;
onMounted(() => {
getFormData();
});
//
async function getFormData() {
picListData.value = [];
const data = await getCaseInfo({ id: ruleForm.value.id });
formData.value = data;
data.pics.forEach((item) => {
let src = item.path;
item.path = uploadUrl + '/' + item.path;
item.thumbnail = uploadUrl + '/S_' + src;
picListData.value.push(item);
//
abbreviationPicListData.value.push(item.thumbnail);
});
}
if (info.file.status === 'error') {
loading.value = false;
message.error('upload error');
async function imgApi(file, progress) {
const data = await uploadApi(file, progress);
if (data.result.length > 0) {
filList.value.push(file);
filSuccessList.value.push(data.data.result[0]);
}
}
function handleRemove(file) {
console.log(file);
var currentIndex = (fileList.value || []).findIndex((element) => element.uid === file.uid);
fileList.value.splice(currentIndex, 1);
filSuccessList.value.splice(currentIndex, 1);
}
};
//
async function getNoBuildStatus() {
getMethodCommon('/Categorys/LoadList', { typeid: 'DRONE_CASE_TYPE' }).then((res) => {
@ -144,6 +187,7 @@
});
});
}
//
async function validateForm() {
let res = await formRef.value
.validate()
@ -155,10 +199,44 @@
});
return res;
}
//
function resetForm() {
emit('close');
}
//
async function saveForm() {
this.formData.info = this.ruleForm;
let arr = this.picListData;
// console.log("arr",arr);
this.formData.pic_list = [];
for (let i = 0; i < arr.length; i++) {
// this.formData.pic_list[i]=this.picListData[i].split("6001/")[1];
this.formData.pic_list[i] = this.handleImagePath(this.picListData[i].path);
}
postMethodCommon('/DroneCaseinfo/AddDroneCaseInfo', this.formData).then((res) => {
if (res.code == 200) {
this.$notify({
title: '成功',
message: '保存成功',
type: 'success',
duration: 2000,
});
this.close();
}
});
}
</script>
<style lang="less" scoped>
.interpret-box {
width: 100%;
height: 74vh;
position: relative;
.interpret-form {
overflow-y: auto;
height: 100%;
padding-bottom: 20px;
}
.ant-form {
padding: 20px;
display: flex;
@ -173,5 +251,19 @@
}
}
}
::v-deep .ant-image-img{
width: 50%;
}
}
.btn-box {
width: 100%;
padding: 10px 10%;
display: flex;
align-items: center;
justify-content: space-around;
position: absolute;
bottom: 0px;
left: 0;
background-color: @component-background;
}
</style>

@ -33,7 +33,7 @@
ruleForm.value = newVal;
detailMap.value.flyTo({
center: [newVal.lng, newVal.lat], //
zoom: 18, //
zoom: 16, //
pitch: 0, //
});
loadDroneMarker(newVal.lng, newVal.lat);

Loading…
Cancel
Save