208 lines
5.0 KiB
Vue
208 lines
5.0 KiB
Vue
<template>
|
|
<fvSearchForm :searchConfig="searchConfig" @search="search"></fvSearchForm>
|
|
<fvTable ref="tableIns" :tableConfig="tableConfig" @headBtnClick="headBtnClick">
|
|
<template #empty>
|
|
<el-empty description="暂无数据"/>
|
|
</template>
|
|
</fvTable>
|
|
</template>
|
|
|
|
<script setup lang="jsx">
|
|
import {useAuthStore} from '@/stores/userstore.js'
|
|
import Tag from '@/components/Tag.vue'
|
|
import fvSelect from '@/fvcomponents/fvSelect/index.vue'
|
|
import { ElNotification} from "element-plus";
|
|
import {deleteDemand} from "@/api/project-demand";
|
|
|
|
const authStore = useAuthStore()
|
|
const router = useRouter()
|
|
const searchConfig = reactive([
|
|
{
|
|
label: '征集名称',
|
|
prop: 'requirementName',
|
|
component: 'el-input',
|
|
props: {
|
|
placeholder: '请输入征集名称查询',
|
|
clearable: true,
|
|
filterable: true,
|
|
checkStrictly: true
|
|
}
|
|
},
|
|
{
|
|
label: '征集类型',
|
|
prop: 'collectType',
|
|
component: shallowRef(fvSelect),
|
|
props: {
|
|
placeholder: '请选择征集类型',
|
|
clearable: true,
|
|
filterable: true,
|
|
cacheKey: 'todo_type'
|
|
}
|
|
},
|
|
{
|
|
label: '状态',
|
|
prop: 'state',
|
|
component: shallowRef(fvSelect),
|
|
props: {
|
|
placeholder: '请选择状态',
|
|
clearable: true,
|
|
cacheKey: 'demand_collection'
|
|
}
|
|
},
|
|
])
|
|
const tableIns = ref()
|
|
const userInfo = ref(authStore.userinfo)
|
|
const tableConfig = reactive({
|
|
columns: [
|
|
{
|
|
type: 'selection',
|
|
prop: 'selection'
|
|
},
|
|
{
|
|
prop: 'requirementName',
|
|
label: '征集名称',
|
|
align: 'center'
|
|
},
|
|
{
|
|
prop: 'collectType',
|
|
label: '征集类型',
|
|
align: 'center'
|
|
},
|
|
{
|
|
prop: 'companyName',
|
|
label: '所属公司',
|
|
align: 'center',
|
|
currentRender: ({row, index}) => (
|
|
<div style={{width: '300px', textOverflow: 'ellipsis'}}>{row.companyName}</div>)
|
|
},
|
|
{
|
|
prop: 'approveName',
|
|
label: '审批人',
|
|
align: 'center'
|
|
},
|
|
{
|
|
prop: 'deadline',
|
|
label: '截止时间',
|
|
align: 'center'
|
|
},
|
|
{
|
|
prop: 'taskNode',
|
|
label: '当前节点',
|
|
align: 'center'
|
|
},
|
|
{
|
|
prop: 'state',
|
|
label: '状态',
|
|
align: 'center',
|
|
width: 200,
|
|
showOverflowTooltip: false,
|
|
currentRender: ({row, index}) => (<Tag dictType={'demand_collection'} value={row.state}/>)
|
|
},
|
|
{
|
|
prop: 'oper',
|
|
label: '操作',
|
|
align: 'center',
|
|
showOverflowTooltip: false,
|
|
currentRender: ({row, index}) => {
|
|
let btn = []
|
|
let buttons = new Set(Array.from(row.buttons))
|
|
if (buttons.has("details")) {
|
|
btn.push({label: '详情', prem: ['mosr:requirement:info'], func: () => handleDetail(row), type: 'primary'})
|
|
}
|
|
if (buttons.has("edit")) {
|
|
btn.push({label: '编辑', prem: ['mosr:requirement:resubmit'], func: () => handleEdit(row), type: 'primary'})
|
|
}
|
|
if (buttons.has("report")) {
|
|
btn.push({label: '需求上报', prem: ['mosr:requirement:info'], func: () => handleReport(row), type: 'primary'})
|
|
}
|
|
return (
|
|
<div style={{width: '100%'}}>
|
|
{
|
|
btn.map(item => (
|
|
<el-button
|
|
type={item.type}
|
|
v-perm={item.prem}
|
|
onClick={() => item.func()}
|
|
link
|
|
>
|
|
{item.label}
|
|
</el-button>
|
|
))
|
|
}
|
|
{
|
|
buttons.has("delete") ?
|
|
<popover-delete name={row.requirementName} type={'需求征集'} btnType={'danger'}
|
|
perm={['mosr:requirement:del']}
|
|
onDelete={() => handleDelete(row)}/> : ''
|
|
}
|
|
</div>
|
|
)
|
|
}
|
|
}
|
|
],
|
|
api: '/workflow/mosr/requirement',
|
|
btns: [
|
|
{name: '新增', key: 'add', color: '#DED0B2'},
|
|
{name: '导出', key: 'export', type: ''},
|
|
],
|
|
params: {}
|
|
})
|
|
|
|
const search = (val) => {
|
|
tableConfig.params = {...val}
|
|
tableIns.value.refresh()
|
|
}
|
|
const handleAdd = (row) => {
|
|
router.push({
|
|
name: 'Requirement/add',
|
|
query: {
|
|
// id: row.requirementId
|
|
}
|
|
})
|
|
}
|
|
const handleEdit = (row) => {
|
|
router.push({
|
|
name: 'Requirement/edit',
|
|
query: {
|
|
id: row.requirementId
|
|
}
|
|
})
|
|
}
|
|
const handleDelete = (row) => {
|
|
deleteDemand(row.requirementId).then(res => {
|
|
ElNotification({
|
|
title: '提示',
|
|
message: res.msg,
|
|
type: res.code === 1000 ? 'success' : 'error'
|
|
})
|
|
tableIns.value.refresh()
|
|
})
|
|
}
|
|
const handleDetail = (row) => {
|
|
router.push({
|
|
name: 'Requirement/detail',
|
|
query: {
|
|
id: row.requirementId
|
|
}
|
|
})
|
|
}
|
|
const handleReport = (row) => {
|
|
router.push({
|
|
name: 'Summary/add',
|
|
query: {
|
|
id: row.requirementId
|
|
}
|
|
})
|
|
}
|
|
const headBtnClick = (key) => {
|
|
switch (key) {
|
|
case 'add':
|
|
handleAdd()
|
|
break;
|
|
case 'export':
|
|
handleExport()
|
|
break;
|
|
}
|
|
}
|
|
</script>
|