对接Pre-Homo流程

This commit is contained in:
范强强
2023-06-13 17:09:12 +08:00
parent f19089cdac
commit 9731d79b30
2 changed files with 243 additions and 10 deletions
@@ -15,7 +15,7 @@
:loading-text="$t('loading')"
@load="onLoad"
>
<div class="content-text" @click="handlingClick" v-for="(item,index) in list">
<div class="content-text" @click="handlingClick(item)" v-for="(item,index) in list">
<div class="content-text-left">
<div class="content-text-top">
<span class="content-text-top-left">
@@ -62,7 +62,12 @@
},
handlingClick(item) {
this.$router.push({
path: '/phonePreHomoMangement'
path: '/phonePreHomoMangement',
query: {
taskDefinitionKey: this.$route.query.taskDefinitionKey,
projectName:this.$route.query.projectName,
id: item.id
}
})
},
onLoad() {
@@ -3,7 +3,7 @@
<div class="header-search">
<van-icon @click="iconClick" class="icon" name="arrow-left"/>
<span class="header-search-text">
EDS1.2 EVO-G1.1-中国-03 Pre-Homo流程
{{$route.query.projectName + ' ' + $t('preHomoFlow')}}
</span>
</div>
@@ -87,22 +87,63 @@
<van-form @submit="onSubmit" ref="form">
<van-field name="disposeResult"
class="uploader"
v-if="$route.query.taskDefinitionKey == 'Task Review' ||
$route.query.taskDefinitionKey == 'Task responsibility confirmation'"
: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">
<van-radio-group @change="disposeResultChange" v-model="form.disposeResult" direction="horizontal">
<van-radio name="rzgcssc_tg" v-if="$route.query.taskDefinitionKey == 'Task Review'">
{{$t('reviewAndPass')}}
</van-radio>
<van-radio name="Rejected">
<van-radio name="rzgcssc_th" v-if="$route.query.taskDefinitionKey == 'Task Review'">
{{$t('reviewAndReturn')}}
</van-radio>
<van-radio name="zrrjsrw" v-if="$route.query.taskDefinitionKey == 'Task responsibility confirmation'">
{{$t('missionAccepted')}}
</van-radio>
<van-radio name="zrrjjrw" v-if="$route.query.taskDefinitionKey == 'Task responsibility confirmation'">
{{$t('missionRejection')}}
</van-radio>
</van-radio-group>
</template>
</van-field>
<van-field
v-model.trim="form.approvalOpinion"
v-if="form.disposeResult == 'rzgcssc_tg'"
v-model.trim="form.reportNumber"
rows="4"
class="textarea"
autosize
:show-error="false"
:label="$t('reportNo')"
maxlength="200"
:placeholder="$t('pleaseEnter')+$t('reportNo')"
/>
<van-field
v-if="form.disposeResult == 'rzgcssc_tg'"
v-model.trim="form.productModel"
rows="4"
class="textarea"
autosize
:show-error="false"
:label="$t('productModel')"
maxlength="200"
:placeholder="$t('pleaseEnter')+$t('productModel')"
/>
<van-field
v-if="form.disposeResult == 'rzgcssc_tg'"
v-model.trim="form.productionEnterpriseName"
rows="4"
class="textarea"
autosize
:show-error="false"
:label="$t('nameOfManufacturer')"
maxlength="200"
:placeholder="$t('pleaseEnter')+$t('nameOfManufacturer')"
/>
<van-field
v-if="form.disposeResult == 'rzgcssc_th' || form.disposeResult == 'zrrjjrw'"
v-model.trim="form.reasonForReturn"
rows="4"
class="textarea"
autosize
@@ -113,6 +154,59 @@
type="textarea"
:placeholder="$t('pleaseEnter')+$t('feedbackMessage')"
/>
<div v-if="$route.query.taskDefinitionKey == 'Task handling'">
<van-field name="uploader" class="uploader"
:rules="[{ required: true, message: $t('DeliverablesResult') + $t('cannotEmpty') }]"
v-if="queryForm.valueType == 'file'"
:label="$t('DeliverablesResult')">
<template #input>
<van-uploader :preview-image="false"
accept="*"
v-model="form.disposeResult"
:after-read="upload"
class="uploader-button">
<van-button icon="back-top" type="primary">{{$t('upload1')}}</van-button>
</van-uploader>
</template>
</van-field>
<van-field
v-else-if="queryForm.valueType == 'text'"
:rules="[{ required: true, message: $t('DeliverablesResult') + $t('cannotEmpty') }]"
v-model.trim="form.deliveryResult"
rows="4"
class="textarea"
autosize
:show-error="false"
:label="$t('DeliverablesResult')"
maxlength="200"
:placeholder="$t('pleaseEnter')+$t('DeliverablesResult')"
/>
<van-field name="disposeResult"
class="uploader"
v-else-if="queryForm.valueType == 'select'"
:rules="[{ required: true, message: $t('DeliverablesResult') + $t('cannotEmpty') }]"
:label="$t('DeliverablesResult')">
<template #input>
<van-radio-group v-model="form.deliveryResult" direction="horizontal">
<van-radio name="1">
{{$t('yes')}}
</van-radio>
<van-radio name="2">
{{$t('not')}}
</van-radio>
</van-radio-group>
</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>
</div>
<van-button class="submitButton"
round
block
@@ -129,30 +223,162 @@
</template>
<script>
import { getAction, postAction, deleteAction, downloadFile } from '@/api/manage'
import { Dialog, Toast } from 'vant'
import Vue from 'vue'
import { ACCESS_TOKEN } from '@/store/mutation-types'
import axios from 'axios'
export default {
name: 'phonePreHomoMangement',
data() {
return {
activeNames: ['1', '2', '3', '4'],
fileList: [],
show: false,
textLoading: this.$t('loading'),
queryForm: {},
queryData: {},
form: {},
uploadAction: window._CONFIG['domianURL'] + '/sys/common/upload',
queryProject: {},
dataSourceFile: [],
deliverablesResultFile: []
deliverablesResultFile: [],
url: {
queryProjectCertificationInventoryById: '/phone/toDoCenter/queryProjectCertificationInventoryById',
saveBatch: '/project/projectCertificationInventoryEO/saveBatch'
}
}
},
mounted() {
document.title = 'NIO GRP'
this.getData()
},
methods: {
iconClick() {
this.$router.go(-1)
},
disposeResultChange(value) {
if (value == 'rzgcssc_tg') {
this.form.reasonForReturn = ''
} else if (value == 'rzgcssc_th') {
this.form.productionEnterpriseName = ''
this.form.productModel = ''
this.form.reportNumber = ''
} else if (value == 'zrrjsrw') {
this.form.reasonForReturn = ''
} else if (value == 'zrrjjrw') {
this.form.reasonForReturn = ''
}
this.form = { ...this.form }
},
onSubmit() {
if (this.$route.query.taskDefinitionKey == 'Task Review') {
this.ApprovedClick()
} else if (this.$route.query.taskDefinitionKey == 'Task handling') {
this.submitClick()
} else if (this.$route.query.taskDefinitionKey == 'Task responsibility confirmation') {
this.ApprovedClick()
}
},
submitClick() {
let query = {
'nodeKey': 'zrrtjrw',
'projectLibraryId': this.queryForm.projectLibraryId,
'ids': this.queryForm.id
}
this.submitPreservation()
postAction('/project/projectCertificationInventoryEO/submitTask', query).then((res) => {
if (res.success) {
Toast(this.$t('OperationSuccessful'))
this.$router.go(-1)
} else {
Toast(this.$t('operationFailed'))
}
})
},
submitPreservation() {
let content = []
let fileListId = []
if (this.queryForm.valueType == 'file') {
this.fileList.forEach(res => {
fileListId.push(res.id)
})
this.form.disposeResult = fileListId.join(',')
}
content[0] = Object.assign(this.queryForm, this.form)
postAction(this.url.saveBatch, { 'dataList': content }).then((res) => {
})
},
ApprovedClick() {
let query = {
'nodeKey': this.form.disposeResult,
'projectLibraryId': this.queryForm.projectLibraryId,
'ids': this.queryForm.id,
reasonForReturn: this.form.reasonForReturn
}
if (this.form.disposeResult == 'rzgcssc_tg') {
this.preservationClick()
}
postAction('/project/projectCertificationInventoryEO/submitTask', query).then((res) => {
if (res.success) {
Toast(this.$t('OperationSuccessful'))
this.$router.go(-1)
} else {
Toast(this.$t('operationFailed'))
}
})
},
//保存
preservationClick() {
let content = []
content[0] = Object.assign(this.queryForm, this.form)
postAction(this.url.saveBatch, { 'dataList': content }).then((res) => {
})
},
getData() {
getAction(this.url.queryProjectCertificationInventoryById, { id: this.$route.query.id }).then((res) => {
if (res.success) {
this.queryForm = res.result || {}
} 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
})
})
},
fileClick(index) {
this.fileList.splice(index, 1)
this.form.disposeResult.splice(index, 1)
this.form = { ...this.form }
}
}
}
@@ -510,6 +736,8 @@
margin-left: 0.2rem;
color: #26BD4B;
font-weight: 600;
float: right;
margin-top: 0.11rem;
}
.icon-text {