feat : 新增需求征集删除功能和文件下载功能
This commit is contained in:
@@ -60,9 +60,25 @@ export const deleteFile = (fileId) => {
|
|||||||
method: "delete"
|
method: "delete"
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
export const downloadFile = (fileId) => {
|
||||||
|
return request({
|
||||||
|
url: '/workflow/process/file/download',
|
||||||
|
method: "get",
|
||||||
|
responseType:'blob',
|
||||||
|
params:{
|
||||||
|
fileId:fileId
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
export const getCompanyOption = () => {
|
export const getCompanyOption = () => {
|
||||||
return request({
|
return request({
|
||||||
url: '/admin/mosr/sub/company/companyOption',
|
url: '/admin/mosr/sub/company/companyOption',
|
||||||
method: "get"
|
method: "get"
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
export const deleteDemand = (id) => {
|
||||||
|
return request({
|
||||||
|
url: `/workflow/mosr/requirement/${id}`,
|
||||||
|
method: "delete"
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
@cancel="handleCancel"
|
@cancel="handleCancel"
|
||||||
>
|
>
|
||||||
<template #reference>
|
<template #reference>
|
||||||
<el-button :type="btnType" size="mini" :disabled="isDisabled" :icon="btnIcon" :plain="isPlain">
|
<el-button :type="btnType" size="mini" :disabled="isDisabled" :icon="btnIcon" :plain="isPlain" :link="link">
|
||||||
{{ btnText }}
|
{{ btnText }}
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
@@ -30,6 +30,10 @@ const props = defineProps({
|
|||||||
type: String,
|
type: String,
|
||||||
default: ''
|
default: ''
|
||||||
},
|
},
|
||||||
|
link: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
btnIcon: {
|
btnIcon: {
|
||||||
type: String,
|
type: String,
|
||||||
default: ''
|
default: ''
|
||||||
@@ -61,6 +65,7 @@ const handleCancel = () => {
|
|||||||
visible.value = false
|
visible.value = false
|
||||||
}
|
}
|
||||||
const handleDelete = () => {
|
const handleDelete = () => {
|
||||||
|
console.log('确认')
|
||||||
emit("delete")
|
emit("delete")
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -77,7 +77,7 @@
|
|||||||
import OperationRender from '@/views/workflow/common/OperationRender.vue'
|
import OperationRender from '@/views/workflow/common/OperationRender.vue'
|
||||||
import ProcessDiagramViewer from '@/views/workflow/common/ProcessDiagramViewer.vue'
|
import ProcessDiagramViewer from '@/views/workflow/common/ProcessDiagramViewer.vue'
|
||||||
import {useProcessStore} from '@/stores/processStore.js';
|
import {useProcessStore} from '@/stores/processStore.js';
|
||||||
import {getInfo, agreeTask, rejectTask} from "@/api/project-demand/index.js";
|
import {getInfo, agreeTask, rejectTask,downloadFile} from "@/api/project-demand/index.js";
|
||||||
import {getSubCompOpt} from '@/api/user/user.js'
|
import {getSubCompOpt} from '@/api/user/user.js'
|
||||||
import {ElMessage} from "element-plus";
|
import {ElMessage} from "element-plus";
|
||||||
import {useRouter} from "vue-router";
|
import {useRouter} from "vue-router";
|
||||||
@@ -129,7 +129,9 @@ const tableConfig = reactive({
|
|||||||
label: '操作',
|
label: '操作',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
currentRender: ({row, index}) => {
|
currentRender: ({row, index}) => {
|
||||||
return (<a style="cursor: pointer;font-size: 14px;color: #2a99ff;" href={row.url}>下载</a>)
|
return (
|
||||||
|
<el-button type="primary" link onClick={() => handleDownload(row)}>下载</el-button>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -200,6 +202,16 @@ const getDataSourceOptionItem = (val) => {
|
|||||||
}
|
}
|
||||||
return companyNameArray.value.join(',');
|
return companyNameArray.value.join(',');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleDownload = (row) => {
|
||||||
|
downloadFile(row.fileId).then(res => {
|
||||||
|
const blob = new Blob([res])
|
||||||
|
let a = document.createElement('a')
|
||||||
|
a.href=URL.createObjectURL(blob)
|
||||||
|
a.download = row.originalFileName
|
||||||
|
a.click()
|
||||||
|
})
|
||||||
|
}
|
||||||
const init = async () => {
|
const init = async () => {
|
||||||
if (!route.query.id) return;
|
if (!route.query.id) return;
|
||||||
await getCompanyOption()
|
await getCompanyOption()
|
||||||
|
|||||||
@@ -10,6 +10,8 @@
|
|||||||
<script setup lang="jsx">
|
<script setup lang="jsx">
|
||||||
import Tag from '@/components/Tag.vue'
|
import Tag from '@/components/Tag.vue'
|
||||||
import fvSelect from '@/fvcomponents/fvSelect/index.vue'
|
import fvSelect from '@/fvcomponents/fvSelect/index.vue'
|
||||||
|
import {ElMessage} from "element-plus";
|
||||||
|
import {deleteDemand} from "@/api/project-demand";
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const searchConfig = reactive([
|
const searchConfig = reactive([
|
||||||
@@ -85,7 +87,6 @@ const tableConfig = reactive({
|
|||||||
let btn = [{label: '详情', func: () => handleDetail(row), type: 'primary'}]
|
let btn = [{label: '详情', func: () => handleDetail(row), type: 'primary'}]
|
||||||
if (row.state === '3' || row.state === '2') {
|
if (row.state === '3' || row.state === '2') {
|
||||||
btn.push({label: '编辑', func: () => handleEdit(row), type: 'primary'})
|
btn.push({label: '编辑', func: () => handleEdit(row), type: 'primary'})
|
||||||
btn.push({label: '删除', func: () => handleDelete(row), type: 'danger'})
|
|
||||||
} else if (row.state === '4') {
|
} else if (row.state === '4') {
|
||||||
btn.push({label: '上报', func: () => handleReport(row), type: 'primary'})
|
btn.push({label: '上报', func: () => handleReport(row), type: 'primary'})
|
||||||
}
|
}
|
||||||
@@ -103,6 +104,10 @@ const tableConfig = reactive({
|
|||||||
</el-button>
|
</el-button>
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
row.state === '3' || row.state === '2' ?
|
||||||
|
<popover-delete name={row.requirementName} type={'需求征集'} btnType={'danger'} onDelete={() => handleDelete(row)}/> : ''
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -136,6 +141,16 @@ const handleEdit = (row) => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
const handleDelete = (row) => {
|
||||||
|
deleteDemand(row.requirementId).then(res => {
|
||||||
|
if (res.code === 1000) {
|
||||||
|
ElMessage.success(res.msg)
|
||||||
|
tableIns.value.refresh()
|
||||||
|
} else {
|
||||||
|
ElMessage.error(res.msg)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
const handleDetail = (row) => {
|
const handleDetail = (row) => {
|
||||||
router.push({
|
router.push({
|
||||||
name: 'Collection/detail',
|
name: 'Collection/detail',
|
||||||
|
|||||||
Reference in New Issue
Block a user