Files
laws-sinotruk-mobile/src/views/workCenter/annualRevisionPlanStandardizationInit/AnnualRevisionPlanStandardizationInit.vue
T
2024-01-15 14:28:58 +08:00

412 lines
13 KiB
Vue

<template>
<process-common-layout class="page-box" :processKey="ProcessKey.ES_ANNUAL_INIT.value" :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"
:readonly="readonly"
>
<!-- 流程名称 -->
<van-field
:label="$t('processName')"
:placeholder="$t('pleaseEnter') + $t('processName')"
readonly
type="textarea"
rows="1"
autosize
v-model="processInfoForm.prcName" />
<!-- 截止日期 -->
<calendar-field
:label="$t('expirationDate')"
v-model="processInfoForm.dueTime"
type="date"
readonly
/>
<!-- 流程说明 -->
<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>
<van-form
ref="baseInfoFormRef"
input-align="right"
error-message-align="right"
:readonly="readonly"
>
<!-- 业务基本信息 -->
<div class="process-part">
<div class="process-part-title">{{ $t('basicServiceInformation') }}</div>
<a-table
bordered
:scroll="{x: '100%'}"
ref="table"
rowKey="espId"
:columns="columns"
:dataSource="baseInfoForm"
:pagination="false">
<template v-slot:text="text">
{{ text || text === 0 ? text : global.emptyLine }}
</template>
</a-table>
</div>
</van-form>
<!-- 流程审批信息 -->
<div class="process-part">
<div class="process-part-title">{{ $t('processApprovalInfo') }}</div>
<van-form
ref="processForm"
input-align="right"
error-message-align="right"
:readonly="readonly">
<!-- 备注 -->
<van-field
v-model="processInfoForm.commitText"
:rules="processInfoRules.commitText"
:label="$t('remark')"
name="commitText"
type="textarea"
autosize
rows="2"
maxlength="500"
:placeholder="$t('pleaseEnter')+$t('remark')"
:border="false"
input-align="left"
class="vertical-form-item"/>
<!--附件-->
<van-field readonly :label="$t('attachment')" class="attach-form-item" input-align="left">
<template v-slot:input>
<z-upload v-model="processInfoForm.commitFile" />
</template>
</van-field>
</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 { EsRevisionPlanStandardizationInitNodes, ProcessKey } from '@/enums/commonEnums'
import CalendarField from '@/components/CalendarField'
import SelectUser from '@/components/SelectUser'
import ZUpload from '@/components/ZUpload'
import {
standardizationInitGetDataById,
standardizationInitTurnTo,
standardizationInitAgree,
standardizationInitReject
} from '@/api/api'
export default {
name: 'AnnualRevisionPlanStandardizationInit',
components: {
ProcessCommonLayout,
CalendarField,
SelectUser,
ZUpload
},
data () {
return {
ProcessKey,
readonly: false,
loading: false,
processInfoForm: {}, // 流程信息表单
// 流程信息校验
processInfoRules: {
commitText: [
{ required: false, message: this.$t('pleaseEnter') + this.$t('remark') }
]
},
columns: [
{
title: this.$t('serialNumber'),
dataIndex: '',
key: 'rowIndex',
align: 'center',
width: 80,
customRender: function (t, r, index) {
return parseInt(index) + 1
}
},
{ // 制修订类型
title: this.$t('revisionPlanActivelyReport.revisionType'),
align: 'center',
width: 180,
dataIndex: 'projectType_dictText',
scopedSlots: { customRender: 'text' }
},
{ // 原企标编号
title: this.$t('revisionPlanActivelyReport.oldEnterpriseStandardNum'),
align: 'center',
width: 180,
dataIndex: 'originEnStandardNo',
scopedSlots: { customRender: 'text' }
},
{ // 新企标编号
title: this.$t('revisionPlanActivelyReport.newEnterpriseStandardNum'),
align: 'center',
width: 180,
dataIndex: 'newEnStandardNo',
scopedSlots: { customRender: 'text' }
},
{ // 原企标名称
title: this.$t('revisionPlanActivelyReport.oldEnterpriseStandardName'),
align: 'center',
width: 180,
dataIndex: 'originEnStandardName',
scopedSlots: { customRender: 'text' }
},
{ // 新企标名称
title: this.$t('revisionPlanActivelyReport.newEnterpriseStandardName'),
align: 'center',
width: 180,
dataIndex: 'newEnStandardName',
scopedSlots: { customRender: 'text' }
},
{ // 授权部门
title: this.$t('revisionPlanActivelyReport.authDepartment'),
align: 'center',
width: 180,
dataIndex: 'authDept_dictText',
scopedSlots: { customRender: 'text' }
},
{ // 企业标准代号
title: this.$t('revisionPlanActivelyReport.enterpriseStandardCode'),
align: 'center',
width: 180,
dataIndex: 'enStandardCode_dictText',
scopedSlots: { customRender: 'text' }
},
{ // 配合单位
title: this.$t('revisionPlanActivelyReport.suitUnit'),
align: 'center',
width: 180,
dataIndex: 'cooperationUnit_dictText',
scopedSlots: { customRender: 'text' }
},
{ // 主起草人
title: this.$t('revisionPlanActivelyReport.principalDrafter'),
align: 'center',
width: 180,
dataIndex: 'mainDraftingUser_dictText',
scopedSlots: { customRender: 'text' }
},
{ // 主起草单位
title: this.$t('revisionPlanActivelyReport.mainDraftingUnit'),
align: 'center',
width: 180,
dataIndex: 'mainDraftingUnit_dictText',
scopedSlots: { customRender: 'text' }
},
{ // 主起草单位负责人
title: this.$t('revisionPlanActivelyReport.headOfMainDraftingUnit'),
align: 'center',
width: 180,
dataIndex: 'mainDraftingUnitResponsiblePerson_dictText',
scopedSlots: { customRender: 'text' }
},
{ // 标准推进人
title: this.$t('revisionPlanActivelyReport.standardPusher'),
align: 'center',
width: 180,
dataIndex: 'standardPromoter_dictText',
scopedSlots: { customRender: 'text' }
},
{ // 草稿计划完成日期
title: this.$t('revisionPlanActivelyReport.draftPlanFinishDate'),
align: 'center',
width: 180,
dataIndex: 'draftPlannedCompleteDate',
scopedSlots: { customRender: 'text' }
},
{ // 征求意见稿计划完成日期
title: this.$t('revisionPlanActivelyReport.exposureDraftPlanFinishDate'),
align: 'center',
width: 200,
dataIndex: 'solicitationDraftPlanCompleteDate',
scopedSlots: { customRender: 'text' }
},
{ // 计划报批日期
title: this.$t('revisionPlanActivelyReport.planSubmissionDate'),
align: 'center',
width: 180,
dataIndex: 'planApprovalDate',
scopedSlots: { customRender: 'text' }
},
{ // 变更状态
title: this.$t('revisionPlanActivelyReport.changeState'),
align: 'center',
width: 180,
dataIndex: 'changeStatus_dictText',
scopedSlots: { customRender: 'text' }
}
],
baseInfoForm: {}
}
},
// 组件内路由拦截
beforeRouteEnter (to, from, next) {
// 如果不是移动端支持的节点,就跳转NoMobile
if (!EsRevisionPlanStandardizationInitNodes.propertyOfValue('isMobile', to.query.nodeId)) {
next({ path: '/noMobile' })
}
next()
},
created () {
this.initData()
},
methods: {
// 初始化数据
initData () {
this.loading = true
standardizationInitGetDataById(this.$route.query.taskId).then(res => {
if (res.success) {
const result = res.result
// 有草稿json按草稿进来的回显
if (result.infoJsonStr) {
// 初始化流程信息
const prcObj = Object.assign({}, result)
prcObj.dueTime = result.processDueDate
prcObj.prcMes = result.processDescription
// 初始化流程审批信息
prcObj.commitText = result.handleText
prcObj.commitFile = result.handleFile
this.processInfoForm = Object.assign({}, prcObj)
result.dataList = JSON.parse(result.infoJsonStr)
console.log(result.data)
} else {
this.processInfoForm = result.common
}
this.baseInfoForm = result.dataList
} else {
this.$message(res.message)
}
}).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
standardizationInitTurnTo(param).then(res => {
if (res.success) {
this.$message(res.message)
this.goBack()
} else {
this.$message(res.message)
}
}).finally(() => {
this.loading = false
})
},
// 同意
handleAgree () {
if (this.loading) return
this.processInfoRules.commitText[0].required = false
if (!this.processInfoForm.commitText) {
this.processInfoForm.commitText = '同意'
}
this.$refs.processForm.validate().then(() => {
const param = {} // 需要传给后端的数据
param.common = Object.assign({}, this.processInfoForm)
param.common.taskId = this.$route.query.taskId
this.loading = true
standardizationInitAgree(param).then(res => {
if (res.success) {
this.$message(res.message)
this.goBack()
} else {
this.$message(res.message)
}
}).finally(() => {
this.loading = false
})
}).catch((errorInfo) => {
console.log(errorInfo)
})
},
// 驳回
handleReject () {
if (this.loading) return
this.processInfoRules.commitText[0].required = true
this.$refs.processForm.validate().then(() => {
this.loading = true
const param = {}
param.common = Object.assign({}, this.processInfoForm)
param.common.taskId = this.$route.query.taskId
standardizationInitReject(param).then(res => {
if (res.success) {
this.$message(res.message)
this.goBack()
} else {
this.$message(res.message)
}
}).finally(() => {
this.loading = false
this.processInfoRules.commitText[0].required = false
})
}).catch((errorInfo) => {
console.log(errorInfo)
if (errorInfo.find(item => item.name === 'commitText')) {
// 没通过校验的有备注,弹窗提示输入备注
this.$message(this.$t('pleaseEnterRemarks'))
}
})
},
goBack () {
this.$router.go(-1)
}
}
}
</script>
<style scoped lang="less">
@import '~@assets/less/common.less';
</style>