Files
laws-sinotruk-mobile/src/views/workCenter/enterpriseStandardStartUse/EnterpriseStandardStartUse.vue
T

355 lines
12 KiB
Vue

<template>
<process-common-layout class="page-box" :processKey="ProcessKey.ES_ENABLE.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="global.emptyLine || $t('pleaseEnter') + $t('processName')"
readonly
type="textarea"
rows="1"
autosize
v-model="processInfoForm.prcName" />
<!-- 截止日期 -->
<calendar-field
:label="$t('expirationDate')"
:placeholder="global.emptyLine"
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>
<!-- 企标编号 -->
<van-field
:label="$t('esInitChange.enterpriseStandardNum')"
:placeholder="global.emptyLine || $t('pleaseEnter') + $t('esInitChange.enterpriseStandardNum')"
readonly
type="textarea"
autosize
rows="1"
v-model="baseInfoForm.standardNumber" />
<!-- 企标名称 -->
<van-field
:label="$t('esInitChange.enterpriseStandardName')"
:placeholder="global.emptyLine || $t('pleaseEnter') + $t('esInitChange.enterpriseStandardName')"
readonly
type="textarea"
rows="1"
autosize
v-model="baseInfoForm.standardName" />
<!-- 标准英文名称 -->
<van-field
:label="$t('esInitChange.standardEnglishName')"
:placeholder="global.emptyLine || $t('pleaseEnter') + $t('esInitChange.standardEnglishName')"
readonly
type="textarea"
rows="1"
autosize
v-model="baseInfoForm.englishName" />
<!-- 标准类型 -->
<picker-dict-field
:label="$t('esAnnul.standardType')"
:placeholder="global.emptyLine || $t('pleaseEnter') + $t('esAnnul.standardType')"
dict-code="esp_standard_type"
readonly
v-model="baseInfoForm.standardCategory" />
<!-- 代替企标编号 -->
<van-field
:label="$t('esAnnul.substituteStandardNumber')"
:placeholder="global.emptyLine || $t('pleaseEnter') + $t('esAnnul.substituteStandardNumber')"
readonly
type="textarea"
rows="1"
autosize
v-model="baseInfoForm.substituteStandardNumber" />
<!-- 被代替企标编号 -->
<van-field
:label="$t('esAnnul.replacedByEnStandardNumber')"
:placeholder="global.emptyLine || $t('pleaseEnter') + $t('esAnnul.replacedByEnStandardNumber')"
readonly
type="textarea"
rows="1"
autosize
v-model="baseInfoForm.replacedByStandardNumber" />、
<!-- 发布日期 -->
<calendar-field
:label="$t('esAnnul.releaseDate')"
:placeholder="global.emptyLine"
v-model="baseInfoForm.releaseDate"
type="date"
readonly
/>
<!-- 实施日期 -->
<calendar-field
:label="$t('esAnnul.materialDate')"
:placeholder="global.emptyLine"
v-model="baseInfoForm.implementationDate"
type="date"
readonly
/>
<!-- 启用理由 -->
<van-field
:label="$t('esStartUse.startUseReason')"
:placeholder="global.emptyLine || $t('pleaseEnter') + $t('esStartUse.startUseReason')"
readonly
type="textarea"
rows="1"
autosize
v-model="baseInfoForm.archiveReason" />
</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 { EsStartUseNodes, ProcessKey } from '@/enums/commonEnums'
import CalendarField from '@/components/CalendarField'
import PickerDictField from '@/components/PickerDictField'
import SelectUser from '@/components/SelectUser'
import ZUpload from '@/components/ZUpload'
import {
enStandardStartUseTurnTo,
enStandardStartUseAgree,
enStandardStartUseReject,
enStandardStartUseGetDataById
} from '@/api/api'
import { WorkCenterMixin } from '@/mixins/WorkCenterMixin'
export default {
name: 'EnterpriseStandardStartUse',
mixins: [WorkCenterMixin],
components: {
ProcessCommonLayout,
CalendarField,
PickerDictField,
SelectUser,
ZUpload
},
data () {
return {
ProcessKey,
readonly: false,
loading: false,
processInfoForm: {}, // 流程信息表单
// 流程信息校验
processInfoRules: {
commitText: [
{ required: false, message: this.$t('pleaseEnter') + this.$t('remark') }
]
},
baseInfoForm: {}
}
},
// 组件内路由拦截
beforeRouteEnter (to, from, next) {
// 如果不是移动端支持的节点,就跳转NoMobile
if (!EsStartUseNodes.propertyOfValue('isMobile', to.query.nodeId)) {
next({ path: '/noMobile' })
}
next()
},
created () {
this.initData()
},
methods: {
// 初始化数据
initData () {
this.loading = true
enStandardStartUseGetDataById(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.data = JSON.parse(result.infoJsonStr)
console.log(result.data)
} else {
this.processInfoForm = result.common
}
this.baseInfoForm = result.data
} 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
enStandardStartUseTurnTo(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
enStandardStartUseAgree(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
enStandardStartUseReject(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'))
}
})
}
}
}
</script>
<style scoped lang="less">
@import '~@assets/less/common.less';
</style>