383 lines
12 KiB
Vue
383 lines
12 KiB
Vue
<template>
|
|
<process-common-layout class="page-box" :process-key="processKey" :loading="loading">
|
|
<template v-slot:process>
|
|
<!-- 流程信息 -->
|
|
<div class="process-part">
|
|
<div class="process-part-title">{{ $t('processInformation') }}</div>
|
|
<van-form
|
|
ref="form"
|
|
input-align="right"
|
|
error-message-align="right">
|
|
<!-- 流程名称 -->
|
|
<van-field
|
|
:label="$t('processName')"
|
|
:placeholder="$t('pleaseEnter') + $t('processName')"
|
|
readonly
|
|
type="textarea"
|
|
rows="1"
|
|
autosize
|
|
:rules="rules.prcName"
|
|
v-model="processInfoForm.prcName"/>
|
|
<!-- 截止日期 -->
|
|
<calendar-field
|
|
:label="$t('expirationDate')"
|
|
v-model="processInfoForm.dueTime"
|
|
readonly
|
|
type="date"/>
|
|
<!-- 流程说明 -->
|
|
<van-field
|
|
v-model="processInfoForm.prcMes"
|
|
:label="$t('processExplain')"
|
|
type="textarea"
|
|
autosize
|
|
disabled
|
|
rows="2"
|
|
:placeholder="$t('pleaseEnter')+$t('processExplain')"
|
|
:border="false"
|
|
input-align="left"
|
|
class="vertical-form-item"/>
|
|
</van-form>
|
|
</div>
|
|
<!-- 业务信息 -->
|
|
<div class="process-part">
|
|
<div class="process-part-title">{{ $t('basicServiceInformation') }}</div>
|
|
<a-table
|
|
bordered
|
|
row-key="id"
|
|
:scroll="{x:'100%', y: '50vh'}"
|
|
:columns="columns"
|
|
:data-source="dataSource"
|
|
:loading="tableLoading"
|
|
:pagination="false"/>
|
|
</div>
|
|
<!-- 流程审批信息 -->
|
|
<div class="process-part">
|
|
<div class="process-part-title">{{ $t('processApprovalInformation') }}</div>
|
|
<van-form
|
|
ref="approvalInfoForm"
|
|
input-align="right"
|
|
error-message-align="right">
|
|
<!-- 备注 -->
|
|
<van-field
|
|
v-model="approvalInfoForm.commitText"
|
|
:label="$t('remark')"
|
|
:rules="rules.commitText"
|
|
name="commitText"
|
|
type="textarea"
|
|
autosize
|
|
rows="2"
|
|
:placeholder="$t('pleaseEnter')+$t('remark')"
|
|
:border="false"
|
|
input-align="left"
|
|
class="vertical-form-item"/>
|
|
<!--附件-->
|
|
<z-upload v-model="approvalInfoForm.commitFile" />
|
|
</van-form>
|
|
</div>
|
|
</template>
|
|
<template v-slot:operation>
|
|
<!-- 转办 -->
|
|
<van-button class="operation-common-btn" @click="handleTurnTo">
|
|
<template #icon>
|
|
<van-icon class="iconfont" class-prefix="icon" name="xunhuan" />
|
|
</template>
|
|
{{ $t('turnTo') }}
|
|
</van-button>
|
|
<!-- 同意 -->
|
|
<van-button class="operation-common-btn" type="primary" @click="handleAgree">
|
|
<template #icon>
|
|
<van-icon class="iconfont" class-prefix="icon" name="check" />
|
|
</template>
|
|
{{ $t('agree') }}
|
|
</van-button>
|
|
<!-- 驳回 -->
|
|
<van-button class="operation-common-btn light-color-button" @click="handleReject">
|
|
<template #icon>
|
|
<van-icon class="iconfont" class-prefix="icon" name="close" />
|
|
</template>
|
|
{{ $t('reject') }}
|
|
</van-button>
|
|
</template>
|
|
<select-user ref="selectUserRef" @selected-change="selectUserChange"></select-user>
|
|
</process-common-layout>
|
|
</template>
|
|
|
|
<script>
|
|
import ProcessCommonLayout from '@/components/ProcessCommonLayout'
|
|
import { ApprovalOpinions, EsInspectionPlan, ProcessKey } from '@/enums/commonEnums'
|
|
import SelectUser from '@/components/SelectUser'
|
|
import CalendarField from '@/components/CalendarField'
|
|
import ZUpload from '@/components/ZUpload'
|
|
import { approvalInspectPlan, getInspectPlanDetail, rejectInspectPlan, transferInspectPlan } from '@/api/api'
|
|
import { getAction } from '@/api/manage'
|
|
export default {
|
|
name: 'EnterpriseStandardInspectionPlanFlow',
|
|
components: { ZUpload, CalendarField, SelectUser, ProcessCommonLayout },
|
|
data () {
|
|
return {
|
|
// 流程加载
|
|
loading: false,
|
|
// 表格加载
|
|
tableLoading: false,
|
|
processKey: ProcessKey.ES_INSPECTION_PLAN.value,
|
|
rules: {
|
|
// 备注
|
|
commitText: [
|
|
{ required: false, message: this.$t('pleaseEnter') + this.$t('remark') }
|
|
]
|
|
},
|
|
// 获取到的流程信息
|
|
info: {},
|
|
// 流程信息
|
|
processInfoForm: {},
|
|
// 审批意见信息
|
|
approvalInfoForm: {},
|
|
// 业务表相关
|
|
url: {
|
|
list: '/process/processEsInspectPlan/list'
|
|
},
|
|
columns: [
|
|
{
|
|
title: this.$t('serialNumber'),
|
|
dataIndex: '',
|
|
key: 'rowIndex',
|
|
align: 'center',
|
|
width: 50,
|
|
customRender: function (t, r, index) {
|
|
return parseInt(index) + 1
|
|
}
|
|
},
|
|
{ // 稽查依据标准号
|
|
title: this.$t('esInspectionPlan.inspectionBasisStandardNumber'),
|
|
align: 'center',
|
|
width: 150,
|
|
dataIndex: 'inspectNo'
|
|
},
|
|
{ // 稽查依据标准名称
|
|
title: this.$t('esInspectionPlan.inspectionBasisStandardName'),
|
|
align: 'center',
|
|
width: 150,
|
|
dataIndex: 'inspectName'
|
|
},
|
|
{ // 计划稽查对象
|
|
title: this.$t('esInspectionPlan.planInspectionObjects'),
|
|
align: 'center',
|
|
width: 120,
|
|
dataIndex: 'inspectObject_dictText'
|
|
},
|
|
{ // 主责标准化工作组
|
|
title: this.$t('esInspectionPlan.mainDutyStandardizationGroup'),
|
|
align: 'center',
|
|
width: 150,
|
|
dataIndex: 'standardizationWorkGroup'
|
|
},
|
|
{ // 所属部门
|
|
title: this.$t('esInspectionPlan.department'),
|
|
align: 'center',
|
|
width: 120,
|
|
dataIndex: 'belongDept_dictText'
|
|
},
|
|
{ // 计划稽查日期
|
|
title: this.$t('esInspectionPlan.planInspectionDate'),
|
|
align: 'center',
|
|
width: 120,
|
|
dataIndex: 'planInspectDate'
|
|
},
|
|
{ // 稽查负责人
|
|
title: this.$t('esInspectionPlan.inspectionDirector'),
|
|
align: 'center',
|
|
width: 120,
|
|
dataIndex: 'inspectUserDictText'
|
|
},
|
|
{ // 标准化组对接人
|
|
title: this.$t('esInspectionPlan.standardizationGroupContactPerson'),
|
|
align: 'center',
|
|
width: 140,
|
|
dataIndex: 'standardizationDockingUserDictText'
|
|
},
|
|
{ // 发起人
|
|
title: this.$t('esInspectionPlan.initiator'),
|
|
align: 'center',
|
|
width: 120,
|
|
dataIndex: 'createByDictText'
|
|
}
|
|
],
|
|
dataSource: []
|
|
}
|
|
},
|
|
computed: {
|
|
// 当前项目id
|
|
projectId () {
|
|
return this.$route.query.projectId
|
|
}
|
|
},
|
|
// 组件内路由拦截
|
|
beforeRouteEnter (to, from, next) {
|
|
// 如果不是移动端支持的节点,就跳转NoMobile
|
|
if (!EsInspectionPlan.propertyOfValue('isMobile', to.query.nodeId)) {
|
|
next({ path: '/noMobile' })
|
|
}
|
|
next()
|
|
},
|
|
created () {
|
|
this.loadPage()
|
|
},
|
|
methods: {
|
|
// 加载页面数据
|
|
loadPage () {
|
|
this.loading = true
|
|
const { projectId, taskId } = this.$route.query
|
|
Promise.all([
|
|
// 获取业务数据
|
|
getAction(this.url.list, { projectId }).then(res => {
|
|
if (res.success) {
|
|
this.dataSource = res.result || []
|
|
}
|
|
}).finally(() => {}),
|
|
|
|
// 获取流程数据
|
|
getInspectPlanDetail({ projectId, taskId }).then(res => {
|
|
if (res.success) {
|
|
const data = res.result || {}
|
|
this.info = data
|
|
const processAll = data.processAll || {}
|
|
const processApprovalRecord = data.processApprovalRecord || {}
|
|
// 回显流程信息
|
|
this.processInfoForm = {
|
|
prcName: processAll.prcName,
|
|
dueTime: processAll.dueTime,
|
|
prcMes: processAll.prcMes
|
|
}
|
|
// 回显审批信息
|
|
this.approvalInfoForm = {
|
|
commitText: processApprovalRecord.commitText,
|
|
commitFile: processApprovalRecord.commitFile
|
|
}
|
|
}
|
|
}).finally(() => {})
|
|
]).finally(() => {
|
|
this.loading = false
|
|
})
|
|
},
|
|
// 转办
|
|
handleTurnTo () {
|
|
if (this.loading) return
|
|
// 点击显示选人组件
|
|
this.$refs.selectUserRef.open()
|
|
},
|
|
// 转办选完人的回调
|
|
selectUserChange (userIds) {
|
|
this.loading = true
|
|
const param = {}
|
|
param.userId = userIds
|
|
param.taskId = this.$route.query.taskId
|
|
transferInspectPlan(param).then(res => {
|
|
if (res.success) {
|
|
this.$message(res.message)
|
|
this.goBack()
|
|
} else {
|
|
this.$message(res.message)
|
|
}
|
|
}).finally(() => {
|
|
this.loading = false
|
|
})
|
|
},
|
|
// 获取页面参数
|
|
async getPageParams () {
|
|
const params = {}
|
|
let validateError = null
|
|
|
|
// 流程信息
|
|
params.processAll = Object.assign({}, this.info.processAll, {
|
|
projectId: this.projectId,
|
|
nodeId: this.$route.query.nodeId,
|
|
taskId: this.$route.query.taskId
|
|
})
|
|
|
|
// 审批意见
|
|
await this.$refs.approvalInfoForm.validate().then(() => {
|
|
params.processApprovalRecord = Object.assign({}, this.info.processApprovalRecord, this.approvalInfoForm, {
|
|
projectId: this.projectId
|
|
})
|
|
}).catch(err => {
|
|
console.log(err)
|
|
validateError = err
|
|
})
|
|
|
|
// 验证失败就返回一个错误
|
|
if (validateError) {
|
|
throw new Error(validateError)
|
|
}
|
|
|
|
// 其他参数
|
|
params.map = {}
|
|
return params
|
|
},
|
|
// 同意
|
|
handleAgree () {
|
|
if (this.loading) return
|
|
this.loading = true
|
|
this.rules.commitText[0].required = false
|
|
this.getPageParams().then(params => {
|
|
params.map.pass = true
|
|
// 如果没有填写注释,就默认同意
|
|
if (!params.processApprovalRecord.commitText) {
|
|
params.processApprovalRecord.commitText = '同意'
|
|
}
|
|
// 审批意见
|
|
params.processApprovalRecord.commitFlag = ApprovalOpinions.AGREE.value
|
|
console.log(params)
|
|
return approvalInspectPlan(params)
|
|
}).then(res => {
|
|
if (res.success) {
|
|
this.$message(res.message)
|
|
this.goBack()
|
|
} else {
|
|
this.$message(res.message)
|
|
}
|
|
}).catch((err) => {
|
|
console.log(err)
|
|
}).finally(() => {
|
|
this.loading = false
|
|
})
|
|
},
|
|
// 驳回
|
|
handleReject () {
|
|
if (this.loading) return
|
|
this.rules.commitText[0].required = true
|
|
// 驳回需要填写备注
|
|
if (!this.approvalInfoForm.commitText) {
|
|
this.$message(this.$t('pleaseEnterRemarks'))
|
|
}
|
|
this.getPageParams().then(params => {
|
|
params.map.pass = false
|
|
// 审批意见
|
|
params.processApprovalRecord.commitFlag = ApprovalOpinions.REJECT.value
|
|
console.log(params)
|
|
return rejectInspectPlan(params)
|
|
}).then(res => {
|
|
if (res.success) {
|
|
this.$message(res.message)
|
|
this.goBack()
|
|
} else {
|
|
this.$message(res.message)
|
|
}
|
|
}).catch((err) => {
|
|
console.log(err)
|
|
}).finally(() => {
|
|
this.loading = false
|
|
this.rules.commitText[0].required = false
|
|
})
|
|
},
|
|
goBack () {
|
|
// this.$router.go(-1)
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="less">
|
|
@import '~@/assets/less/common.less';
|
|
|
|
</style>
|