Browse Source

文件下载

ops-management-platform-frontend-dev
wbc 3 weeks ago
parent
commit
164e7441db
  1. 9
      src/api/common/index.ts
  2. 1
      src/views/IO/delayPatrol/waitAudit/faultModal.vue
  3. 47
      src/views/IO/patrolReport/index.vue
  4. 20
      src/views/IO/workOrder/delayAudit/auditModal.vue
  5. 1
      src/views/IO/workOrder/delayAudit/detailDrawer.vue
  6. 2
      src/views/IO/workOrder/orderAudit/detailDrawer.vue
  7. 2
      src/views/IO/workOrder/orderHandle/detailDrawer.vue
  8. 2
      src/views/IO/workOrder/orderSearch/detailDrawer.vue
  9. 2
      src/views/IO/workOrder/orderSend/detailDrawer.vue
  10. 40
      src/views/document/index.vue
  11. 18
      src/views/project/contractManage/index.vue
  12. 18
      src/views/project/projectManage/index.vue

9
src/api/common/index.ts

@ -5,7 +5,8 @@ enum Api {
getProjectInfo = '/platform/projectInfo/getNames',
getOrganizationType = '/platform/organizationType/list',
getContractNamesByProjectName = '/platform/contractInfo/getContractNamesByProjectName',
queryPointNames = '/platform/pointInfo/queryPointNames ',
queryPointNames = '/platform/pointInfo/queryPointNames',
commonDownload = '/resource/oss/urlToStream'
}
@ -30,4 +31,10 @@ export function getContractNamesByProjectName(data:any) {
export function queryPointNames() {
return defHttp.get({ url: Api.queryPointNames });
}
export function commonDownload(url) {
return defHttp.get<Blob>(
{ url: Api.commonDownload + '?url=' + url, responseType: 'blob', timeout: 30 * 1000 },
{ isTransformResponse: false },
);
}

1
src/views/IO/delayPatrol/waitAudit/faultModal.vue

@ -138,7 +138,6 @@
:headers="headers"
accept='.jpg,.jpeg,.png,.gif,.webp'
@change="handleChange"
list-type="picture"
>
<a-button type="primary"> 上传图片 </a-button>
</a-upload>

47
src/views/IO/patrolReport/index.vue

@ -20,6 +20,10 @@
<a-button type="link">删除</a-button>
</a-popconfirm>
<a-button type="link" @click="handleDetail(record.id)">详情</a-button>
<a-button type="link" @click="downloadPhoto(record)" v-if="record.inspectionPhoto"
>图片</a-button
>
<a-button type="link" @click="download(record)" v-if="record.attachment">下载</a-button>
</template>
</template>
</BasicTable>
@ -31,21 +35,19 @@
<script setup lang="ts">
import { PageWrapper } from '@/components/Page';
import { BasicTable, useTable } from '@/components/Table';
import { list, removeByIds,getProjectInfo } from './api';
import { list, removeByIds, getProjectInfo } from './api';
import { formSchemas, columns } from './patrolReportdata';
import reportModal from './reportModal.vue';
import { ref,computed,onMounted} from 'vue';
import { ref, computed, onMounted } from 'vue';
import detailDrawer from './detailDrawer.vue';
import { commonDownload } from '@/api/common/index';
import { downloadByData } from '@/utils/file/download';
defineOptions({ name: 'PatrolReport' });
const newFormSchemas: any = computed(() => {
formSchemas[0].componentProps.options = projectOptions.value;
return formSchemas;
});
const [registerTable, { reload }] = useTable({
rowSelection: {
type: 'checkbox',
},
title: '工作日报',
api: list,
showIndexColumn: true,
@ -63,7 +65,7 @@
},
columns: columns,
actionColumn: {
width: 200,
width: 320,
title: '操作',
key: 'action',
fixed: 'right',
@ -99,10 +101,33 @@
const getOptions = () => {
getProjectOptions();
};
onMounted(()=>{
getOptions()
})
//
const download = async (record: any) => {
const attachments = JSON.parse(record.attachment);
if (attachments && attachments.length > 0) {
attachments.forEach((i: any) => {
commonDownload(i.url).then((res) => {
const data = res;
downloadByData(data, i.name);
});
});
}
};
//
const downloadPhoto = async (record: any) => {
const attachments = JSON.parse(record.inspectionPhoto);
if (attachments && attachments.length > 0) {
attachments.forEach((i: any) => {
commonDownload(i.url).then((res) => {
const data = res;
downloadByData(data, i.name);
});
});
}
};
onMounted(() => {
getOptions();
});
</script>
<style scoped></style>

20
src/views/IO/workOrder/delayAudit/auditModal.vue

@ -51,9 +51,7 @@
<a-row :gutter="[16, 16]">
<a-col :span="24">
<a-form-item label="延期图片" name="attachments">
<div v-for="(item, index) in form.attachments" :key="index">
<img alt="" :src="item.url" />
</div>
<a-upload v-model:file-list="fileLists" disabled> </a-upload>
</a-form-item>
</a-col>
</a-row>
@ -84,7 +82,7 @@
import { message } from 'ant-design-vue';
import { getInfo, delaySubmit } from './api';
export default {
setup(props,{emit}) {
setup(props, { emit }) {
const title = ref('审核');
const visible = ref(false);
const form = reactive({
@ -98,6 +96,7 @@
handleResult: null,
id: null,
});
const fileLists = ref([])
//
const handleResultOptions = [
{
@ -109,11 +108,21 @@
];
const showModal = async (id) => {
visible.value = true;
fileLists.value= []
const data = await getInfo(id);
for (let i in form) {
form[i] = data[i];
}
form.handleResult = null
if (form.attachments && form.attachments.length > 0) {
form.attachments.forEach((i) => {
fileLists.value.push({
url: i.url,
name: i.name,
status: 'done',
});
});
}
form.handleResult = null;
};
const handleOk = () => {
@ -150,6 +159,7 @@
closeModal,
formRef,
rules,
fileLists
};
},
};

1
src/views/IO/workOrder/delayAudit/detailDrawer.vue

@ -82,7 +82,6 @@
><span class="titleLabel">故障图片</span>
<a-upload
v-model:file-list="fileLists"
list-type="picture"
disabled
>
</a-upload>

2
src/views/IO/workOrder/orderAudit/detailDrawer.vue

@ -82,7 +82,6 @@
><span class="titleLabel">故障图片</span>
<a-upload
v-model:file-list="fileLists"
list-type="picture"
disabled
>
</a-upload>
@ -125,7 +124,6 @@
><span class="titleLabel">处理图片</span>
<a-upload
v-model:file-list="fileLists1"
list-type="picture"
disabled
>
</a-upload>

2
src/views/IO/workOrder/orderHandle/detailDrawer.vue

@ -82,7 +82,6 @@
><span class="titleLabel">故障图片</span>
<a-upload
v-model:file-list="fileLists"
list-type="picture"
disabled
>
</a-upload>
@ -125,7 +124,6 @@
><span class="titleLabel">处理图片</span>
<a-upload
v-model:file-list="fileLists1"
list-type="picture"
disabled
>
</a-upload>

2
src/views/IO/workOrder/orderSearch/detailDrawer.vue

@ -82,7 +82,6 @@
><span class="titleLabel">故障图片</span>
<a-upload
v-model:file-list="fileLists"
list-type="picture"
disabled
>
</a-upload>
@ -125,7 +124,6 @@
><span class="titleLabel">处理图片</span>
<a-upload
v-model:file-list="fileLists1"
list-type="picture"
disabled
>
</a-upload>

2
src/views/IO/workOrder/orderSend/detailDrawer.vue

@ -82,7 +82,6 @@
><span class="titleLabel">故障图片</span>
<a-upload
v-model:file-list="fileLists"
list-type="picture"
disabled
>
</a-upload>
@ -125,7 +124,6 @@
><span class="titleLabel">处理图片</span>
<a-upload
v-model:file-list="fileLists1"
list-type="picture"
disabled
>
</a-upload>

40
src/views/document/index.vue

@ -16,23 +16,25 @@
<a-button type="link">删除</a-button>
</a-popconfirm>
<a-button type="link" @click="handleDetail(record.id)">详情</a-button>
<a-button type="link" @click="download(record)" v-if="record.attachment">下载</a-button>
</template>
</template>
</BasicTable>
<detailDrawer ref="detailDrawerRef" />
<addModal ref="addModalRef" @success="reload()"/>
<addModal ref="addModalRef" @success="reload()" />
</PageWrapper>
</template>
<script setup lang="ts">
import { PageWrapper } from '@/components/Page';
import { BasicTable, useTable } from '@/components/Table';
import { list, removeByIds,getDocumentType} from './api';
import { list, removeByIds, getDocumentType } from './api';
import { formSchemas, columns } from './data';
import detailDrawer from './detailDrawer.vue';
import { ref,onMounted } from 'vue';
import { ref, onMounted } from 'vue';
import addModal from './addModal.vue';
import { commonDownload } from '@/api/common/index';
import { downloadByData } from '@/utils/file/download';
defineOptions({ name: 'Document' });
const [registerTable, { reload }] = useTable({
@ -56,7 +58,7 @@
},
columns: columns,
actionColumn: {
width: 200,
width: 270,
title: '操作',
key: 'action',
fixed: 'right',
@ -82,16 +84,26 @@
};
const getDocumentTypeOptions = async () => {
const res = await getDocumentType();
formSchemas[0].componentProps.options = res.rows;
formSchemas[0].componentProps.options .forEach((i:any)=>{
i.value = i.typeName,
i.label = i.typeName
})
formSchemas[0].componentProps.options = res.rows;
formSchemas[0].componentProps.options.forEach((i: any) => {
(i.value = i.typeName), (i.label = i.typeName);
});
};
//
const download = async (record:any) => {
const attachments = JSON.parse(record.attachment)
if (attachments && attachments.length > 0) {
attachments.forEach((i: any) => {
commonDownload(i.url).then((res) => {
const data = res;
downloadByData(data, i.name);
});
});
}
};
onMounted(()=>{
getDocumentTypeOptions()
})
onMounted(() => {
getDocumentTypeOptions();
});
</script>
<style scoped></style>

18
src/views/project/contractManage/index.vue

@ -18,6 +18,7 @@
<a-button type="link">删除</a-button>
</a-popconfirm>
<a-button type="link" @click="handleDetail(record.id)">详情</a-button>
<a-button type="link" @click="download(record)" v-if="record.attachment">下载</a-button>
</template>
</template>
</BasicTable>
@ -94,7 +95,8 @@
import { ref, reactive } from 'vue';
import addModal from './addModal.vue';
import { message } from 'ant-design-vue';
import { commonDownload } from '@/api/common/index';
import { downloadByData } from '@/utils/file/download';
defineOptions({ name: 'ContractManage' });
const [registerTable, { reload }] = useTable({
@ -118,7 +120,7 @@
},
columns: columns,
actionColumn: {
width: 200,
width: 270,
title: '操作',
key: 'action',
fixed: 'right',
@ -274,6 +276,18 @@
}
}
)
//
const download = async (record:any) => {
const attachments = JSON.parse(record.attachment)
if (attachments && attachments.length > 0) {
attachments.forEach((i: any) => {
commonDownload(i.url).then((res) => {
const data = res;
downloadByData(data, i.name);
});
});
}
};
</script>
<style scoped></style>

18
src/views/project/projectManage/index.vue

@ -16,6 +16,7 @@
<a-button type="link">删除</a-button>
</a-popconfirm>
<a-button type="link" @click="handleDetail(record.id)">详情</a-button>
<a-button type="link" @click="download(record)" v-if="record.attachment">下载</a-button>
</template>
</template>
</BasicTable>
@ -32,7 +33,8 @@
import detailDrawer from './detailDrawer.vue';
import { ref } from 'vue';
import addModal from './addModal.vue';
import { commonDownload } from '@/api/common/index';
import { downloadByData } from '@/utils/file/download';
defineOptions({ name: 'ProjectManage' });
const [registerTable, { reload }] = useTable({
@ -56,7 +58,7 @@
},
columns: columns,
actionColumn: {
width: 200,
width: 270,
title: '操作',
key: 'action',
fixed: 'right',
@ -80,6 +82,18 @@
const handleEdit = (id: any) => {
addModalRef.value.showModal(2, id);
};
//
const download = async (record:any) => {
const attachments = JSON.parse(record.attachment)
if (attachments && attachments.length > 0) {
attachments.forEach((i: any) => {
commonDownload(i.url).then((res) => {
const data = res;
downloadByData(data, i.name);
});
});
}
};
</script>
<style scoped></style>

Loading…
Cancel
Save