Files
laws_weilai/jero-web/src/views/phoneView/processManagement.vue
T
2023-06-07 18:06:33 +08:00

858 lines
25 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<div class="box">
<div class="header-search">
<van-icon @click="iconClick" class="icon" name="arrow-left"/>
<span class="header-search-text">
{{queryForm.serialNumber}} {{title}}
</span>
</div>
<van-collapse class="collapse" v-model="activeNames">
<van-collapse-item :title="$t('essentialInformation')" name="1">
<div class="content-box-type">
<span class="content-box-left">{{$t('entryName')}}</span>
<span class="content-box-text">{{queryForm.projectName+'-'+queryForm.projectVersion}}</span>
</div>
<div class="content-box-type">
<span class="content-box-left">{{$t('regulationNo')}}</span>
<span class="content-box-text">{{queryForm.serialNumber || '--'}}</span>
</div>
<div class="content-box-type">
<span class="content-box-left">{{$t('title')}}</span>
<span class="content-box-text">{{queryForm.title || '--'}}</span>
</div>
<div class="content-box-type">
<span class="content-box-left">{{$t('subtitle')}}</span>
<span class="content-box-text">{{queryForm.subtitle || '--'}}</span>
</div>
<div class="content-box-type">
<span class="content-box-left">{{$t('applicableSupplement')}}</span>
<span class="content-box-text">{{queryForm.applicableSupplement || '--'}}</span>
</div>
</van-collapse-item>
<van-collapse-item :title="$t('TaskRequirements')" name="2">
<div class="content-box-type">
<span class="content-box-left">{{$t('Sponsor')}}</span>
<span class="content-box-text">{{queryProject[queryData.Sponsor] || '--'}}</span>
</div>
<div class="content-box-type">
<span class="content-box-left">{{$t('personLiable')}}</span>
<span class="content-box-text">{{queryProject[queryData.personLiable] || '--'}}</span>
</div>
<div class="content-box-type">
<span class="content-box-left">{{$t('deliveryDate')}}</span>
<span class="content-box-text">{{queryProject[queryData.DueDate] || '--'}}</span>
</div>
<div class="content-box-type">
<span class="content-box-left">{{$t('typeOfDeliverables')}}</span>
<span class="content-box-text">{{queryProject[queryData.typeOfDeliverables] || '--'}}</span>
</div>
<div class="content-box-type-text">
{{$t('deliverableTemplate')}}
</div>
<div class="content-box-type-text-one" v-if="dataSourceFile && dataSourceFile.length == 0">
--
</div>
<div class="content-box-type-text-one"
v-else
v-for="item in dataSourceFile">
{{item.fileName}}
</div>
<div class="content-box-type-text">
{{$t('descriptionDeliverables')}}
</div>
<div class="content-box-type-text-Two">
{{queryProject[queryData.remarks] || '--'}}
</div>
</van-collapse-item>
<van-collapse-item :title="$t('Processhistory')" name="3">
<van-steps inactive-icon="passed"
active-icon="passed"
active-color="#00BEBE"
direction="vertical" :active="dataSource.length">
<van-step v-for="(item,index) in dataSource" :key="index">
<div class="vanStepBox">
<div class="van-text">
{{item.name}}
</div>
<div class="van-text-status">
<span class="van-text-color" :class="statusClass[item.operatorResult]" v-if="item.operatorResultName">
{{item.operatorResultName}}
</span>
</div>
<div class="van-time">
<span class="van-name">
{{item.assignee}}
</span>
|
<span class="van-name-time">
{{item.createTime}}
</span>
</div>
<div class="van-desgin">
{{item.approvalOpinion}}
</div>
<div class="van-file" v-if="item.approvalFileName && item.approvalFileName.length > 0"
v-for="(val,index1) in item.approvalFileName" :key="index1">
{{val}}
</div>
</div>
</van-step>
</van-steps>
</van-collapse-item>
<van-collapse-item :title="examineTitle" name="4" v-if="!queryData.isDisplay">
<van-form @submit="onSubmit" ref="form">
<van-field name="disposeResult"
class="uploader"
:rules="[{ required: true, message: $t('resultofhandling') + $t('cannotEmpty') }]"
:label="$t('resultofhandling')">
<template #input>
<van-radio-group v-model="form.disposeResult" direction="horizontal">
<van-radio name="Accepted" v-if="queryData.TaskKey == 'zrrqr' || queryData.TaskKey == 'dezrrqr'">
{{$t('accept')}}
</van-radio>
<van-radio name="Rejected" v-if="queryData.TaskKey == 'zrrqr'">
{{$t('refuse')}}
</van-radio>
<van-radio name="Adopt" :disabled="isAdopt"
v-if="queryData.TaskKey == 'fggcssh' || queryData.TaskKey == 'fggcsbcsh'">
{{$t('adopt')}}
</van-radio>
<van-radio name="Compliance"
v-if="queryData.TaskKey == 'dezrrtjjfw' || queryData.TaskKey == 'zrrtjjfw' || queryData.TaskKey == 'zrrbctjxg'">
{{$t('accord')}}
</van-radio>
<van-radio name="Non-Compliance"
v-if="queryData.TaskKey == 'dezrrtjjfw' || queryData.TaskKey == 'zrrtjjfw' || queryData.TaskKey == 'zrrbctjxg'">
{{$t('nonConformity')}}
</van-radio>
<van-radio name="To be tracked"
v-if="queryData.TaskKey == 'zrrtjjfw' || queryData.TaskKey == 'dezrrtjjfw' || queryData.TaskKey == 'zrrbctjxg'">
{{$t('Tracked')}}
</van-radio>
<van-radio name="NA"
v-if="queryData.TaskKey == 'zrrtjjfw' || queryData.TaskKey == 'dezrrtjjfw' || queryData.TaskKey == 'zrrbctjxg'">
{{$t('notInvolved')}}
</van-radio>
<van-radio name="Returned"
v-if="queryData.TaskKey == 'dezrrqr' || queryData.TaskKey == 'dezrrtjjfw' ||
queryData.TaskKey == 'zrrtjjfw' || queryData.TaskKey == 'fggcssh' || queryData.TaskKey == 'fggcsbcsh'">
{{$t('sendBack')}}
</van-radio>
</van-radio-group>
</template>
</van-field>
<van-field
v-model.trim="form.approvalOpinion"
rows="4"
class="textarea"
autosize
:show-error="false"
:rules="[{ required: true, message: $t('feedbackMessage') + $t('cannotEmpty') }]"
:label="$t('feedback')"
maxlength="200"
type="textarea"
:placeholder="$t('pleaseEnter')+$t('feedbackMessage')"
/>
<van-field name="uploader" class="uploader"
v-if="queryData.TaskKey == 'dezrrtjjfw' || queryData.TaskKey == 'zrrtjjfw' || queryData.TaskKey == 'fggcssh'
|| queryData.TaskKey == 'zrrbctjxg' || queryData.TaskKey == 'fggcsbcsh'"
:label="$t('attachmentUpload')">
<template #input>
<van-uploader :preview-image="false"
accept="*"
:after-read="upload"
class="uploader-button">
<van-button icon="back-top" type="primary">{{$t('upload1')}}</van-button>
</van-uploader>
</template>
</van-field>
<div class="file-list"
v-for="(item,index) in fileList"
:key="index">
<span class="file-text">{{item.fileName}}
<van-icon class="file-text-icon" name="passed"/>
</span>
<a-icon @click="fileClick(index)" class="icon-text" type="delete"/>
</div>
<van-button class="submitButton"
round
block
type="info"
native-type="submit">{{$t('submit')}}
</van-button>
</van-form>
</van-collapse-item>
</van-collapse>
<van-overlay :show="show">
<van-loading type="spinner">{{textLoading}}</van-loading>
</van-overlay>
</div>
</template>
<script>
import { getAction, postAction, deleteAction, downloadFile, uploadAction } from '@/api/manage'
import { mapGetters } from 'vuex'
import moment from 'moment'
import axios from 'axios'
import Vue from 'vue'
import { ACCESS_TOKEN } from '@/store/mutation-types'
export default {
name: 'phoneProcessManagement',
data() {
return {
activeNames: ['1', '2', '3', '4'],
show: false,
form: {},
statusClass: {
'Accepted': 'AcceptedClass',
'Rejected': 'RejectedClass',
'Transfer': 'TransferClass',
'Returned': 'ReturnedClass',
'Adopt': 'AdoptClass',
'Compliance': 'ComplianceClass',
'Non-Compliance': 'NonComplianceClass',
'To be tracked': 'trackedClass',
'NA': 'NAClass'
},
dataSource: [],
url: {
urlFrom: 'project/projectLibraryBase/queryById',
queryProjectLawsInventoryInfoById: 'project/projectLawsInventoryEO/queryProjectLawsInventoryInfoById',
queryTaskDetailByTaskIds: '/task/queryTaskDetailByTaskIds',
edit: '/project/projectTaskInventoryDetailEO/edit',
dreSubmit: '/project/projectTaskInventoryFeedbackEO/dreSubmit',
list: '/project/projectTaskInventoryFeedbackEO/list',
historyList: '/wkflow/processHistoryEO/queryComplianceProcessHistoryList'
},
queryForm: {},
queryProject: {},
queryBy: {},
queryData: {},
title: '',
dataSourceFile: [],
textLoading: '',
fileList: [],
uploadAction: window._CONFIG['domianURL'] + '/sys/common/upload',
examineTitle: '',
isAdopt: false
}
},
mounted() {
document.title = 'NIO GRP'
this.textLoading = this.$t('loading')
this.getData(this.$route.query)
},
methods: {
...mapGetters(['userInfo']),
iconClick() {
this.$router.go(-1)
},
onSubmit() {
this.$refs.form.validate().then(() => {
let handlingTime = moment(new Date()).format('YYYY-MM-DD HH:mm:ss')
let content = []
if (this.fileList && this.fileList.length > 0) {
this.fileList.forEach(res => {
content.push(res.id)
})
}
this.form.approvalFile = content.join(',')
this.completeTask({ operatorTime: handlingTime, ...this.form })
})
},
getData(row) {
this.show = true
this.queryData = row
this.queryData.isDisplay = JSON.parse(this.queryData.isDisplay)
let _this = this
if (row.flowType == '2') {
this.title = this.$t('designTheComplianceProcess')
} else if (row.flowType == '4') {
this.title = this.$t('verifyComplianceProcess')
}
if (row.TaskKey == 'zrrqr' || row.TaskKey == 'dezrrqr' || row.TaskKey == 'zrrtjjfw' || row.TaskKey == 'dezrrtjjfw') {
this.examineTitle = this.$t('personLiableConfirm')
} else {
this.examineTitle = this.$t('sponsorReview')
}
this.getHistoryList()
if (row.taskIds) {
this.queryTaskDetailByTask(function() {
_this.queryProjectLawsInventoryInfo()
})
} else {
this.queryBy.projectLibraryId = row.projectLibraryId
this.queryBy.id = row.projectTaskInventoryId
this.queryProjectLawsInventoryInfo()
}
},
queryTaskDetailByTask(callback) {
this.loading = true
getAction(this.url.queryTaskDetailByTaskIds, { taskIds: this.queryData.taskIds }).then((res) => {
if (res instanceof String) {
this.queryBy = JSON.parse(res) || {}
callback()
} else {
this.queryBy = res || {}
callback()
}
})
},
queryProjectLawsInventoryInfo() {
let query = {
id: this.queryBy.id,
operatorType: 'taskAffirmQuery'
}
this.queryBy.approvalOpinion = ''
this.queryBy.approvalFile = ''
getAction(this.url.queryProjectLawsInventoryInfoById, query).then((res) => {
if (res.success) {
this.queryProject = res.result[0] || {}
if (this.queryBy.disposeResult == 'To be tracked' || this.queryBy.disposeResult == 'Non-Compliance') {
this.isAdopt = true
}
if (this.queryProject[this.queryData.deliverableTemplate]) {
this.getFileInfos(this.queryProject[this.queryData.deliverableTemplate])
}
this.getQueryForm()
} else {
this.queryProject = {}
}
})
},
getHistoryList() {
let query = {
actiProcInstId: this.queryData.actiProcInstId || this.queryData.prcId,
flowType: this.queryData.flowType,
projectLawsInventoryId: this.queryData.projectTaskInventoryId
}
getAction('/wkflow/processHistoryEO/queryComplianceProcessHistoryList', query).then((res) => {
if (res.success) {
this.dataSource = res.result || []
this.dataSource.forEach(val => {
if (val.approvalFileName) {
val.approvalFileName = val.approvalFileName.split(',')
val.approvalFile = val.approvalFile.split(',')
}
})
} else {
this.dataSource = []
}
})
},
getFileInfos(item) {
getAction('sys/common/getFileInfos', { id: item }).then((res) => {
if (res.success) {
this.dataSourceFile = res.result
this.dataSourceFile.forEach((val) => {
let fileName = val.fileName
let index1 = fileName.lastIndexOf('.')
let index2 = fileName.length
let fileSuffix = fileName.substring(index1, index2)
val.fileSuffix = fileSuffix
})
console.log(this.dataSourceFile)
} else {
this.dataSourceFile = []
}
})
},
getQueryForm() {
getAction(this.url.urlFrom, { id: this.queryBy.projectLibraryId }).then((res) => {
if (res.success) {
this.queryForm = res.result[0] || {}
if (this.queryProject) {
this.queryForm = { ...this.queryForm, ...this.queryProject }
}
this.show = false
} else {
this.queryForm = {}
}
})
},
async upload(file) {
// 这时候我们创建一个formData对象实例
const formData = new FormData()
// 通过append方法添加需要的file
// 这里需要注意 append(key, value)来添加数据,如果指定的key不存在则会新增一条数据,如果key存在,则添加到数据的末尾
formData.append('file', file.file)
// 调用uploadFile上传的接口
const res = await this.uploadFile(formData)
this.fileList.push(res)
// 上传文件的guid和后台返回的guid一样,通过push方法把上传的文件存放到上传成功才能提交的数组里面
},
uploadFile(formData) {
this.textLoading = this.$t('loading')
this.show = true
return new Promise(resolve => {
const token = Vue.ls.get(ACCESS_TOKEN)
axios({
url: this.uploadAction,
method: 'post',
data: formData,
headers: {
'Content-Type': 'multipart/form-data', // 文件上传
'X-Access-Token': token
}
}).then((res) => {
resolve(res.data.result)
this.show = false
})
})
},
completeTask(value) {
this.textLoading = this.$t('Submitting')
this.show = true
let json = Object.assign(this.queryBy, value)
let data = JSON.stringify(json).replace(/\"/g, '\'')
Object.keys(value).forEach(res => {
if (value[res] && typeof value[res] == 'string') {
value[res] = value[res].replace(/\"/g, '“')
value[res] = value[res].replace(/\'/g, '')
}
})
let query = {
userid: this.userInfo().id,
taskId: this.queryData.taskId || this.queryData.taskIds,
json: data
}
postAction('/workFlow/completeTask', query).then((res) => {
if (res.success) {
this.$message.success(this.$t('OperationSuccessful'))
this.show = false
this.$router.go(-1)
} else {
this.show = false
this.$message.warning(res.message)
}
})
},
fileClick(index) {
this.fileList.splice(index, 1)
}
}
}
</script>
<style scoped>
.box {
padding: 0 0.4rem 0.4rem 0.4rem;
position: relative;
}
.header-search {
/*padding-left: 0.4rem;*/
/*padding-right: 0.4rem;*/
width: 100%;
display: flex;
position: sticky;
top: 0;
padding-top: 0.4rem;
background: #fff;
z-index: 1000;
}
.icon {
font-size: 0.66rem;
width: 0.7rem;
}
.header-search-text {
font-size: 0.44rem;
font-family: PingFang SC-Medium, PingFang SC;
font-weight: 600;
color: #040B29;
margin-left: 0.2rem;
word-break: break-all;
overflow: hidden;
display: -webkit-box;
text-overflow: ellipsis;
/*! autoprefixer: off */
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
/*! autoprefixer: on;*/
text-justify: inter-ideograph;
}
.collapse {
margin-top: 0.6rem;
}
::v-deep .van-cell {
padding: 0;
}
::v-deep .van-cell::after {
border-bottom: none;
}
::v-deep .van-collapse-item--border::after {
border-top: none;
}
::v-deep .van-hairline--top-bottom::after, .van-hairline-unset--top-bottom::after {
border-width: 0;
}
::v-deep .van-cell--clickable .van-cell__title span {
font-size: 0.44rem;
font-family: PingFang SC-Medium, PingFang SC;
font-weight: 600;
color: #040B29;
}
::v-deep .collapse .van-cell--clickable .van-icon {
font-size: 0.44rem;
color: #040B29;
}
::v-deep .van-collapse-item {
margin-bottom: 0.6rem;
}
.content-box-type {
display: flex;
margin-top: 0.08rem;
margin-bottom: 0.4rem;
}
.content-box-type:last-child {
margin-bottom: 0.1rem;
}
.content-box-left {
display: inline-block;
font-size: 0.38rem;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #6F7385;
flex: auto;
min-width: 2rem;
}
.content-box-type-text {
font-size: 0.38rem;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #6F7385;
margin-bottom: 0.4rem;
}
.content-box-type-text-one {
font-size: 0.38rem;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 500;
color: #01A0AC;
margin-bottom: 0.4rem;
word-break: break-all;
}
.content-box-type-text-Two {
display: inline-block;
font-size: 0.38rem;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 500;
color: #040B29;
word-break: break-all;
}
.content-box-text {
text-align: right;
margin-left: 0.3rem;
font-size: 0.38rem;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 500;
color: #040B29;
word-break: break-all;
}
::v-deep .van-collapse-item__content {
padding: 0.5rem 0;
}
::v-deep .van-step__circle-container .van-icon {
font-size: 0.55rem;
background: #fff;
}
::v-deep .van-step--finish {
color: #00BEBE;
}
::v-deep .van-step--vertical {
padding: 0.26rem 0 0.46rem 0;
}
::v-deep .van-step--vertical:not(:last-child)::after {
border-bottom-width: 0;
}
.vanStepBox {
margin-left: 0.2rem;
}
.van-text {
font-size: 0.38rem;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 500;
color: #040B29;
}
.van-text-color {
padding: 0.19rem 0.3rem;
color: #26BD4B;
font-size: 0.34rem;
background: rgba(38, 189, 75, 0.12);
border-radius: 0.1rem;
}
.van-time {
font-size: 0.34rem;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #868A9A;
margin-top: 0.3rem;
}
.van-name {
color: #868A9A;
margin-right: 0.1rem;
font-size: 0.34rem;
}
.van-name-time {
color: #868A9A;
margin-left: 0.1rem;
font-size: 0.34rem;
}
.van-desgin {
font-size: 0.38rem;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #41475E;
margin-top: 0.3rem;
word-break: break-all;
}
.van-file {
font-size: 0.38rem;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #01A0AC;
margin-top: 0.3rem;
word-break: break-all;
}
::v-deep .van-form .van-cell__title {
font-size: 0.38rem;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 500;
color: #595E72;
width: 100%;
}
::v-deep .van-form .van-cell__value{
margin-top: 0.1rem;
}
::v-deep .van-form .van-radio__icon .van-icon {
width: 0.45rem;
height: 0.45rem;
line-height: 0.38rem;
}
::v-deep .van-form .van-radio__icon--checked .van-icon {
background-color: #00BEBE;
border-color: #00BEBE;
}
::v-deep .van-form .van-radio__icon {
height: 0.45rem;
}
::v-deep .van-form .van-radio__label {
font-size: 0.38rem;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 500;
color: #040B29;
}
::v-deep .van-form .van-cell {
margin-bottom: 0.3rem;
}
.textarea {
display: block;
}
::v-deep .van-form .textarea .van-field__control {
background: #F5F6F7;
border-radius: 0.12rem;
padding: 0.2rem;
margin-top: 0.1rem;
}
.uploader {
display: block;
}
.uploader-button {
margin-top: 0.2rem;
}
.uploader-button .van-button--primary {
background-color: #fff;
border: 0.03rem solid #00BEBE;
color: #01A0AC;
font-size: 0.38rem;
font-family: PingFang SC-Medium, PingFang SC;
font-weight: 500;
}
.uploader-button .van-button {
height: 0.9rem;
border-radius: 0.12rem;
}
.uploader-button .van-button .van-icon {
font-size: 0.42rem;
font-weight: 500;
}
::v-deep .van-loading {
color: #fff;
font-size: 0.36rem;
}
::v-deep .van-loading__text {
color: #fff;
font-size: 0.46rem;
}
::v-deep .van-overlay {
z-index: 1001;
text-align: center;
line-height: 30;
display: flex;
align-items: center;
justify-content: center;
}
.submitButton {
border-radius: 0.2rem;
background: #00B3BE;
border: none;
margin-top: 1.2rem;
}
::v-deep .van-icon-success:before {
font-size: 0.34rem;
text-align: center;
}
::v-deep .van-radio {
margin-bottom: 0.1rem;
}
.file-list {
width: 100%;
background: #FFFFFF;
border-radius: 0.2rem;
border: 0.02rem solid #E6E7EC;
padding: 0.26rem 0.4rem;
font-size: 0.38rem;
font-weight: 400;
color: #040B29;
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 0.2rem;
}
.file-text {
display: inline-block;
margin-right: 0.3rem;
word-break: break-all;
}
.file-text-icon {
font-size: 0.41rem;
margin-left: 0.2rem;
color: #26BD4B;
font-weight: 600;
}
.icon-text {
font-size: 0.4rem;
color: #040B29;
}
::v-deep .van-field--error .van-field__control::placeholder {
color: #BBBDC7;
}
.van-text-status {
margin-bottom: 0.3rem;
margin-top: 0.3rem;
}
.van-collapse-item:last-child {
margin-bottom: 0;
}
.AcceptedClass {
background: #e9f8ed;
color: #26BD4B;
}
.RejectedClass {
background: #fdeaea;
color: #E83030;
}
.TransferClass {
background: #fff6e8;
color: #FDA71C;
}
.ReturnedClass {
background: #fff6e8;
color: #FDA71C;
}
.AdoptClass {
background: #e9f8ed;
color: #26BD4B;
}
.ComplianceClass {
background: #e9f8ed;
color: #26BD4B;
}
.NonComplianceClass {
background: #fdeaea;
color: #E83030;
}
.trackedClass {
background: #fff6e8;
color: #FDA71C;
}
.NAClass {
background: #f1f1f3;
color: #707486;
}
</style>