Files
mosr-web/src/views/project-management/implementation/index.vue

332 lines
7.6 KiB
Vue

<template>
<fvSearchForm :searchConfig="searchConfig" @search="search"></fvSearchForm>
<fvTable ref="tableIns" :tableConfig="tableConfig">
<template #empty>
<el-empty description="暂无数据"/>
</template>
</fvTable>
</template>
<script setup lang="jsx">
import fvSelect from '@/fvcomponents/fvSelect/index.vue'
import {reactive, shallowRef} from "vue";
const router = useRouter()
const shortcuts = [
{
text: '上周',
value: () => {
const end = new Date()
const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
return [start, end]
},
},
{
text: '上月',
value: () => {
const end = new Date()
const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
return [start, end]
},
},
{
text: '三月前',
value: () => {
const end = new Date()
const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
return [start, end]
},
},
]
const searchConfig = reactive([
{
label: '项目名称',
prop: 'projectName',
component: 'el-input',
props: {
placeholder: '请输入项目名称查询',
clearable: true,
filterable: true,
checkStrictly: true
}
},
{
label: '项目类型',
prop: 'projectType',
component: shallowRef(fvSelect),
props: {
placeholder: '请选择项目类型',
cacheKey: 'project_type',
clearable: true,
filterable: true,
}
},
{
label: '项目影响',
prop: 'projectImpact',
component: shallowRef(fvSelect),
props: {
placeholder: '请选择项目影响',
cacheKey: 'project_impact',
clearable: true,
filterable: true,
},
colProps: {}
},
{
label: '研发主体',
prop: 'rdSubject',
component: shallowRef(fvSelect),
props: {
placeholder: '请选择研发主体',
cacheKey: 'rd_subject',
clearable: true,
filterable: true,
}
},
{
label: '起止时间',
prop: 'dateValue',
component: 'el-date-picker',
props: {
clearable: true,
type: 'datetimerange',
startPlaceholder: '开始日期',
endPlaceholder: '结束日期',
valueFormat: 'YYYY-MM-DD HH:mm:ss',
shortcuts: shortcuts
}
},
{
label: '状态',
prop: 'state',
component: shallowRef(fvSelect),
props: {
placeholder: '请选择状态',
clearable: true,
cacheKey: 'project_initiation'
}
},
// {
// label: '最小金额',
// prop: 'requirementName',
// component: 'el-input',
// props: {
// placeholder: '请输入金额查询',
// clearable: true,
// filterable: true,
// checkStrictly: true
// }
// },
// {
// label: '最大金额',
// prop: 'requirementName',
// component: 'el-input',
// props: {
// placeholder: '请输入金额查询',
// clearable: true,
// filterable: true,
// checkStrictly: true
// }
// },
])
const tableIns = ref()
const tableConfig = reactive({
columns: [
{
type: 'selection',
prop: 'selection'
},
{
prop: 'projectName',
label: '名称',
align: 'center'
},
{
prop: 'affiliatedCompany',
label: '所属公司',
align: 'center'
},
{
prop: 'approveName',
label: '审批人',
align: 'center'
},
{
prop: 'projectType',
label: '项目类型',
align: 'center'
},
{
prop: 'rdSubject',
label: '研发主体',
align: 'center'
},
{
prop: 'projectImpact',
label: '项目影响',
align: 'center'
},
{
prop: 'economicEstimate',
label: '经济概算',
align: 'center'
},
{
prop: 'startTime',
label: '起止时间',
align: 'center',
currentRender: ({row}) => {
return row.startTime + ' 至 ' + row.endTime
}
},
{
prop: 'taskNode',
label: '当前节点',
align: 'center'
},
{
prop: 'state',
label: '状态',
align: 'center',
showOverflowTooltip: false,
currentRender: ({row, index}) => {
if (row.state !== null) {
return (<Tag dictType={'project_initiation'} value={row.state}/>)
} else {
return '--'
}
}
},
{
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("check")) {
btn.push({label: '验收', prem: ['mosr:requirement:resubmit'], func: () => handleCheck(row), type: 'primary'})
}
if (buttons.has("edit")) {
btn.push({label: '编辑', prem: ['mosr:requirement:info'], func: () => handleEdit(row), type: 'primary'})
}
if (buttons.has("standing")) {
btn.push({label: '台账', prem: ['mosr:requirement:info'], func: () => handleStandingBook(row), type: 'primary'})
}
// if (buttons.has("attachments")) {
btn.push({label: '附件', prem: ['mosr:requirement:info'], func: () => handleAttachment(row), type: 'primary'})
// }
if (buttons.has("viewAllocation")) {
btn.push({label: '查看分摊', prem: ['mosr:requirement:info'], func: () => handleShare(row), type: 'primary'})
}
if (buttons.has("phaseChange")) {
btn.push({label: '阶段变更', prem: ['mosr:requirement:info'], func: () => handlePhaseChange(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>
))
}
</div>
)
}
}
],
api: '/workflow/mosr/project/implementation',
params: {},
btns: [
{name: '生成分摊报表', key: '_export', color: '#DED0B2', auth: ''}
]
})
const search = (val) => {
let obj = {...val}
if(obj.dateValue) {
obj.startTime = obj.dateValue[0]
obj.endTime = obj.dateValue[1]
delete obj.dateValue
}
tableConfig.params = obj
tableIns.value.refresh()
}
const handleDetail = (row) => {
router.push({
name: 'Implementation/detail',
query: {
id: row.requirementId,
projectId: row.projectId,
state: row.state,
step: '40'
}
})
}
const handleCheck = (row) => {
router.push({
name: 'Implementation/check',
query: {
id: row.requirementId,
projectId: row.projectId
}
})
}
const handleEdit = (row) => {
router.push({
name: 'Implementation/edit',
query: {
id: row.requirementId,
projectId: row.projectId
}
})
}
const handleStandingBook = (row) => {
router.push({
name: 'Implementation/account',
query: {
id: row.projectId
}
})
}
const handleAttachment = (row) => {
router.push({
name: 'Implementation/attachment',
query: {
id: row.projectId
}
})
}
const handleShare = (row) => {
router.push({
name: 'Implementation/share',
query: {
id: row.requirementId
}
})
}
const handlePhaseChange = (row) => {
router.push({
name: 'Phase/change',
query: {
id: row.requirementId
}
})
}
</script>