@@ -59,9 +59,12 @@
< div class = "process-part-title" > { { $t ( 'basicServiceInformation' ) } } < / div >
< div class = "table-operator" >
<!-- 新增 -- >
< a-button icon = "plus" type = "primary" @click ="handleAdd" > {{ $ t ( ' newlyAdded ' ) }} < / a -button >
< a-button icon = "plus" type = "primary" @click ="handleAdd" v-if = "canTableOperate" > {{ $ t ( ' newlyAdded ' ) }} < / a -button >
<!-- 批量删除 -- >
< a-button type = "primary" icon = "delete" ghost @click ="batchDel" > {{ $ t ( ' batchDelete ' ) }} < / a -button >
< a-button type = "primary" icon = "delete" ghost @click ="batchDel" v-if = "canTableOperate" > {{ $ t ( ' batchDelete ' ) }} < / a -button >
< a-button icon = "upload" type = "primary" ghost @click ="handleExportXls" v-if = "!canTableOperate" >
{{ $ t ( ' export ' ) }}
< / a -button >
< div >
< j-table
:can-drag = "true"
@@ -117,8 +120,8 @@
{{ $ t ( ' turnTo ' ) }}
< / a -button >
<!-- 抄送 -- >
< a-button type = "primary" :loading = "loading" ghost icon = "arrow-up" v-if = "btnList.includes('return ')" @click="handleCarbonCopy" >
{{ $ t ( ' turnTo ' ) }}
< a-button type = "primary" :loading = "loading" ghost v-if = "btnList.includes('carbonCopy ')" @click="handleCarbonCopy" >
{{ $ t ( ' workCenter.standardProcurementProcess.carbonCopy ' ) }}
< / a -button >
<!-- 保存 发起节点 、 审批节点都存在 -- >
< a-button type = "primary" :loading = "loading" ghost v-if = "btnList.includes('save')" @click="handleSave" >
@@ -164,6 +167,7 @@ import {
} from '../../../api/workCenter'
import UserSelection from '../../../components/selection/UserSelection'
import UserSelectModal from '../../../components/selection/UserSelectModal'
import { downFile } from '../../../api/manage'
export default {
name : 'StandardProcurementProcess' ,
@@ -214,22 +218,23 @@ export default {
dataIndex : 'standardName'
} ,
{ // 采购理由
title : this . $t ( 'standardNam e' ) ,
title : this . $t ( 'workCenter.standardProcurementProcess.reasonForPurchas e' ) ,
width : 380 ,
dataIndex : 'purchaseReason'
} ,
// 操作
{
title : this . $t ( 'operation' ) ,
fixed : 'right' ,
width : 150 ,
scopedSlots : { customRender : 'action' }
}
] ,
// 操作
operateColumn : {
title : this . $t ( 'operation' ) ,
fixed : 'right' ,
width : 150 ,
scopedSlots : { customRender : 'action' }
} ,
dataSource : [ ] ,
selectedRowKeys : [ ] ,
currentNode : '' ,
isTransfer : true // 是否转办
isTransfer : true , // 是否转办
businessId : null
}
} ,
computed : {
@@ -239,6 +244,10 @@ export default {
// 流程信息部分禁用
processInfoDisabled ( ) {
return ! ( this . currentNode === ProcurementProcessNodes . initiate . value && ! this . $route . query . processInstanceId )
} ,
// 表格是否可以增删改
canTableOperate ( ) {
return this . currentNode === ProcurementProcessNodes . initiate . value
}
} ,
created ( ) {
@@ -248,6 +257,9 @@ export default {
} else {
this . currentNode = ProcurementProcessNodes . initiate . value
}
if ( this . currentNode === ProcurementProcessNodes . initiate . value ) {
this . columns . push ( this . operateColumn )
}
this . btnList = ProcurementProcessNodes . propertyOfValue ( 'btn' , this . currentNode )
this . getPersonInfoStructure ( ProcessKey . LEGAL _PROCUREMENT . value , ( ) => {
this . initPersonInfoData ( this . currentNode === ProcurementProcessNodes . initiate . value )
@@ -297,9 +309,10 @@ export default {
draftId : this . $route . query . draftId ,
taskId : this . $route . query . taskId
}
initProcurementProcess ( params ) . then ( res => {
queryProcurementProcessInfo ( params ) . then ( res => {
if ( res . success ) {
const { result } = res
this . businessId = result . businessId
this . processInfo = Object . assign ( { } , result . basicProcessInfoDTO || { } )
this . dataSource = result . businessInfoDTO || [ ]
this . approvalInfo = Object . assign ( { } , result . basicTaskInfoDTO || { } )
@@ -308,6 +321,8 @@ export default {
this . approvalInfoForm . setFieldsValue ( this . approvalInfo )
} )
}
} ) . finally ( ( ) => {
this . loading = false
} )
} ,
dealFormData ( isSave ) {
@@ -316,6 +331,7 @@ export default {
processInfo = Object . assign ( this . processInfo , this . processInfoForm . getFieldsValue ( ) )
businessInfo = this . dataSource
approvalInfo = Object . assign ( this . approvalInfo , this . approvalInfoForm . getFieldsValue ( ) )
approvalInfo . taskId = approvalInfo . taskId || this . $route . query . taskId
userInfoMap = this . $refs . personnelInfo . getDataObj ( )
const params = { ... processInfo , ... businessInfo , ... approvalInfo , ... userInfoMap }
if ( ! Object . values ( params ) . some ( tt => ! ! tt || ( tt && tt . length > 0 ) ) ) {
@@ -342,6 +358,7 @@ export default {
this . approvalInfoForm . validateFields ( ( errors , values ) => {
if ( ! errors ) {
approvalInfo = Object . assign ( this . approvalInfo , values )
approvalInfo . taskId = approvalInfo . taskId || this . $route . query . taskId
} else {
flag = false
}
@@ -382,7 +399,9 @@ export default {
func ( params ) . then ( res => {
if ( res . success ) {
this . $message . success ( res . message )
this . goBack ( )
if ( this . isTransfer ) {
this . goBack ( )
}
} else {
this . $message . warning ( res . message )
}
@@ -475,7 +494,52 @@ export default {
} ) . finally ( ( ) => {
this . loading = false
} )
}
} ,
handleExportXls ( ) {
const fileName = this . $t ( 'workCenter.standardProcurementProcess.legalProcurement' ) + '.xls'
const param = {
businessId : this . businessId
}
if ( this . selectedRowKeys && this . selectedRowKeys . length > 0 ) {
const selectedRowsIds = this . dataSource . map ( ( tt , index ) => {
return this . selectedRowKeys . includes ( index ) ? tt . id : null
} ) . filter ( tt => ! ! tt )
param . selections = selectedRowsIds . join ( ',' )
}
console . log ( '导出参数' , param )
// 加一个大的提示
const modalLoading = this . $info ( {
title : '提示' ,
content : < span > 正在导出 , 请稍候 < a-spin size = "small" / > < / span > ,
keyboard : false
} )
// 把知道了这个按钮去掉
this . $nextTick ( ( ) => {
document . getElementsByClassName ( 'ant-modal-confirm-btns' ) [ 0 ] . style = 'display:none'
} )
downFile ( '/process/fb/processFbStandardPurchase/exportXls' , param ) . then ( ( data ) => {
if ( ! data ) {
this . $message . warning ( '文件下载失败' )
return
}
if ( typeof window . navigator . msSaveBlob !== 'undefined' ) {
window . navigator . msSaveBlob ( new Blob ( [ data ] , { type : 'application/vnd.ms-excel' } ) , fileName )
} else {
const url = window . URL . createObjectURL ( new Blob ( [ data ] , { type : 'application/vnd.ms-excel' } ) )
const link = document . createElement ( 'a' )
link . style . display = 'none'
link . href = url
link . setAttribute ( 'download' , fileName )
document . body . appendChild ( link )
link . click ( )
document . body . removeChild ( link ) // 下载完成移除元素
window . URL . revokeObjectURL ( url ) // 释放掉blob对象
}
} ) . finally ( ( ) => {
// 销毁这个提示
modalLoading . destroy ( )
} )
} ,
}
}
< / script >