Files
laws_weilai/jero-web/src/views/processCenter/components/engineeringConfirmation.vue
T
2022-05-20 14:27:36 +08:00

922 lines
29 KiB
Java

<template>
<div class="box">
<div class="box-text">
<div class="header-text">
{{$t('engineeringConfirmation')}}
</div>
</div>
<div class="header-content">
<div class="operator-text"
v-if="$route.query.TaskKey == 'zrrclrw' && this.$route.query.isDisplay"
@click="distributionEngineerClick($t('distributionEngineer'),1)">
<a-icon type="audit"/>
{{ $t('distributionEngineer') }}
</div>
<div class="operator-text"
v-if="$route.query.TaskKey == 'zrrclrw' && this.$route.query.isDisplay"
@click="reminderHandling()">
<a-icon type="sound"/>
{{ $t('reminderHandling') }}
</div>
<div class="operator-text"
v-if="$route.query.TaskKey == 'zrrclrw' && this.$route.query.isDisplay"
@click="distributionEngineerClick($t('addFeedback'),2)">
<a-icon type="plus-circle"/>
{{ $t('addFeedback') }}
</div>
</div>
<a-table
ref="table"
:loading="loading"
:pagination="false"
:scroll="{x: 1600}"
:data-source="dataSource"
:columns="columns"
:width="500"
>
<span slot="Deliverables" slot-scope="text,result">
<a @click="viewFileClick(result.fileId)" v-if="result.fileId">
{{$t('viewFile')}}
</a>
</span>
<span slot="engineerFeedbackContent" slot-scope="text,result">
<a class="text"
@click="detailsClick(result)">
{{text}}
</a>
</span>
<span slot="operation" slot-scope="result">
<a class="text"
v-if="$route.query.TaskKey == 'zrrclrw' || $route.query.TaskKey == 'dreDispose'"
:disabled="!result.createUser"
@click="edit(result,$t('edit'))">
{{$t('edit')}}
</a>
<a class="text"
v-if="$route.query.TaskKey == 'zrrclrw' && result.status"
:disabled="!result.status"
@click="confirm(result)">
<span v-if="result.status == 'NotDone'">
{{$t('confirm')}}
</span>
<span v-if="result.status == 'haveDone'">
{{$t('cancelConfirm')}}
</span>
</a>
<a class="text"
v-if="$route.query.TaskKey == 'zrrclrw'"
@click="answerClick(result,$t('replyFromProjectContactPerson'))">
{{$t('answer')}}
</a>
<a class="text"
v-if="$route.query.TaskKey == 'zrrclrw' || $route.query.TaskKey == 'dreDispose'"
:disabled="!result.createUser"
@click="deleted(result)">
{{$t('deleteLib')}}
</a>
</span>
</a-table>
<a-modal
:title="title"
:width="600"
:visible="visible"
:confirm-loading="confirmLoading"
:maskClosable="false"
@ok="handleOk"
@cancel="handleCancel"
>
<div style="max-height: 420px;overflow-y:auto;width: 100%">
<a-form-model :model="formInline" class="formAdd" :rules="rules" ref="ruleForm">
<a-row :gutter="24">
<a-col :span="24" v-if="title == $t('distributionEngineer')">
<div class="box-title-text">
<div class="title-text">
<span class="Required">*</span>
<span class="title-text-text"
:title="$t('engineer')">{{$t('engineer')}}</span>
</div>
<a-form-model-item class="itemModel" prop="userName">
<PersonnelSelection
:query="{db_field_name:'userId',db_field_txt:$t('engineer')}"
:personneQuery="formInline"
@change="PersonnelSelectionChange"
v-model="formInline.userName"/>
</a-form-model-item>
</div>
</a-col>
<a-col :span="24" v-if="title == $t('distributionEngineer')">
<div>
<div class="box-title-text" v-for="(item,index) in distributionEngineerList">
<div class="title-text">
<span class="title-text-text"
:title="item.name">{{item.name}}</span>
</div>
<a-form-model-item class="itemModel" style="width: calc(100% - 190px)">
<a-textarea
:placeholder="$t('PleaseEnter')+$t('projectDeliveryDescription')"
:disabled="false"
v-model="item.deliveryInstructions" :rows="4"/>
</a-form-model-item>
<span class="text-del" @click="deleteText(index)">{{$t('delete')}}</span>
</div>
</div>
</a-col>
<a-col :span="24" v-if="title == $t('addFeedback') || title == $t('edit')">
<div class="box-title-text">
<div class="title-text">
<span class="Required">*</span>
<span class="title-text-text"
:title="$t('feedbackFromTheEngineer')">{{$t('feedbackFromTheEngineer')}}</span>
</div>
<a-form-model-item class="itemModel" prop="engineerFeedbackContent">
<a-textarea
:placeholder="$t('PleaseEnter')+$t('feedbackFromTheEngineer')"
:disabled="false"
v-model="formInline.engineerFeedbackContent" :rows="4"/>
</a-form-model-item>
</div>
</a-col>
<a-col :span="24" v-if="title == $t('addFeedback') || title == $t('edit')">
<div class="box-title-text">
<div class="title-text">
<span class="Required">*</span>
<span class="title-text-text"
:title="$t('Deliverables')">{{$t('Deliverables')}}</span>
</div>
<a-form-model-item class="itemModel" prop="fileId">
<a-button type="primary" class="button-text"
@click="clickButtonToUpload('fileId')">
{{ (formInline.fileId === 'null' || formInline.fileId === '' ||
formInline.fileId == null) ? $t('clickUpload') : $t('viewUploadedFiles')
}}
</a-button>
</a-form-model-item>
</div>
</a-col>
<a-col :span="24" v-if="title == $t('replyFromProjectContactPerson')">
<div class="box-title-text">
<div class="title-text">
<span class="Required">*</span>
<span class="title-text-text"
:title="$t('replyFromProjectContactPerson')">{{$t('replyFromProjectContactPerson')}}</span>
</div>
<a-form-model-item class="itemModel" prop="engineeringInterfacePersonReply">
<a-textarea
:placeholder="$t('replyFromProjectContactPerson')"
:disabled="false"
v-model="formInline.engineeringInterfacePersonReply" :rows="4"/>
</a-form-model-item>
</div>
</a-col>
</a-row>
</a-form-model>
</div>
</a-modal>
<a-modal
:title="$t('engineeringConfirmationDetails')"
:width="900"
:visible="visibleDetails"
:maskClosable="false"
@cancel="visibleDetails = false"
>
<template slot="footer">
<a-button key="back" @click="visibleDetails = false">
{{$t('cancel')}}
</a-button>
</template>
<div class="engineeringBox" v-if="detailsList.length > 0">
<div style="width: calc(100% - 12px);margin-bottom: 40px" v-for="(item,index) in detailsList">
<div class="title-header-text" v-if="index == 0 && detailsList[0].dataStatus == 'current'">
{{$t('currentInformation')}}
</div>
<div class="title-header-text" style="margin-top: 40px"
v-if="index == 1 && detailsList[1].dataStatus == 'history'"
>
{{$t('deliveryHistory')}}
</div>
<div class="title-header-text"
v-if="detailsList[0].dataStatus == 'history'"
>
{{$t('deliveryHistory')}}
</div>
<a-row :gutter="24" style="margin-bottom: 18px">
<a-col :span="5">
<div class="text-field-left">{{$t('projectDeliveryRequirements')}}:</div>
</a-col>
<a-col :span="19">
<div class="text-field-right">
{{item.deliveryRequirements}}
</div>
</a-col>
</a-row>
<a-row :gutter="24" style="margin-bottom: 18px">
<a-col :span="5">
<div class="text-field-left">{{$t('feedbackFromTheEngineer')}}:</div>
</a-col>
<a-col :span="19">
<div class="text-field-right">
{{item.engineerFeedbackContent}}
</div>
</a-col>
</a-row>
<a-row :gutter="24" style="margin-bottom: 18px">
<a-col :span="5">
<div class="text-field-left">{{$t('Deliverables')}}:</div>
</a-col>
<a-col :span="19">
<div v-if="item.fileId" class="text-field-right text-field-cou"
@click="viewFileClick(item.fileId)">
{{$t('viewUploadedFiles')}}
</div>
</a-col>
</a-row>
<a-row :gutter="24" style="margin-bottom: 18px">
<a-col :span="5">
<div class="text-field-left">{{$t('completedBy')}}:</div>
</a-col>
<a-col :span="7">
<div class="text-field-right">
{{item.createBy}}
</div>
</a-col>
<a-col :span="5">
<div class="text-field-left">{{$t('completedTime')}}:</div>
</a-col>
<a-col :span="7">
<div class="text-field-right">
{{item.createTime}}
</div>
</a-col>
</a-row>
<a-row :gutter="24" style="margin-bottom: 18px">
<a-col :span="5">
<div class="text-field-left">{{$t('replyFromProjectContactPerson')}}:</div>
</a-col>
<a-col :span="19">
<div class="text-field-right">
{{item.engineeringInterfacePersonReply}}
</div>
</a-col>
</a-row>
</div>
</div>
<div class="noData" v-else>
{{$t('noData')}}
</div>
<div class="page" v-if="detailsList.length > 0">
<a-pagination
:show-total="total => $t('total')+` ${total} `+$t('strip')"
show-quick-jumper
:page-size.sync="pageSize"
:total="total"
@change="pageOnChange"
/>
</div>
<JLoading :loading="pageLoading">{{$t('dataLoading')}}</JLoading>
</a-modal>
<a-modal
:title="$t('reminderHandling')"
:width="800"
:visible="visibleTable"
:maskClosable="false"
@cancel="visibleTable = false"
>
<template slot="footer">
<a-button key="back" @click="visibleTable = false">
{{$t('cancel')}}
</a-button>
</template>
<a-table
ref="table"
:loading="loadingTable"
:pagination="false"
:scroll="{x: true,y:400}"
:data-source="dataSourceTable"
:columns="columnsTable"
>
<span slot="operationTable" slot-scope="result">
<a @click="reminderClick(result)">{{$t('reminder')}}</a>
</span>
</a-table>
</a-modal>
<uploadFile ref="uploadFile" @uploadSuccess="uploadSuccess"/>
<viewFileModel ref="viewFileModelRef"/>
</div>
</template>
<script>
import PersonnelSelection from '@/components/PersonnelSelection/index'
import { getAction, postAction, putAction, deleteAction } from '@/api/manage'
import uploadFile from '@/components/uploadFile/file'
import viewFileModel from '@/components/viewFileModel/index'
import { Base64 } from 'js-base64'
export default {
name: 'engineeringConfirmation',
components: {
PersonnelSelection,
uploadFile,
viewFileModel
},
data() {
return {
loading: false,
visibleFile: false,
pageLoading: false,
dataSource: [],
dataSourceTable: [],
pageSize: 3,
pageNo: 1,
total: 0,
distributionEngineerList: [],
columnsTable: [
{
title: this.$t('engineer'),
dataIndex: 'userName',
align: 'center'
},
{
title: this.$t('operation'),
align: 'center',
width: 200,
scopedSlots: { customRender: 'operationTable' }
}
],
loadingTable: false,
visible: false,
confirmLoading: false,
visibleTable: false,
title: '',
formInline: {},
formInlineDetails: {},
rules: {
engineerFeedbackContent: [
{
required: true,
message: this.$t('feedbackFromTheEngineer') + this.$t('cannotEmpty'),
trigger: 'blur'
},
{
max: 300,
message: this.$t('feedbackFromTheEngineer') + this.$t('cannotExceed') + 300 + this.$t('Characters'),
trigger: 'blur'
}
],
engineeringInterfacePersonReply: [
{
required: true,
message: this.$t('replyFromProjectContactPerson') + this.$t('cannotEmpty'),
trigger: 'blur'
},
{
max: 300,
message: this.$t('replyFromProjectContactPerson') + this.$t('cannotExceed') + 300 + this.$t('Characters'),
trigger: 'blur'
}
],
fileId: [
{
required: true,
message: this.$t('Deliverables') + this.$t('cannotEmpty'),
trigger: 'change'
}
],
userName: [
{
required: true,
message: this.$t('engineer') + this.$t('cannotEmpty'),
trigger: 'change'
}
]
},
visibleDetails: false,
columnsAll: [
{
title: 'ID',
dataIndex: 'index',
key: 'index',
align: 'left',
width: 140,
customRender: (text, record, index) => `${index + 1}`
},
{
title: this.$t('completedBy'),
dataIndex: 'createBy',
ellipsis: true,
align: 'left'
},
{
title: this.$t('completedTime'),
dataIndex: 'createTime',
ellipsis: true,
align: 'left'
},
{
title: this.$t('feedbackFromTheEngineer'),
dataIndex: 'engineerFeedbackContent',
align: 'left',
ellipsis: true,
scopedSlots: { customRender: 'engineerFeedbackContent' }
},
{
title: this.$t('Deliverables'),
dataIndex: 'fileId',
align: 'left',
ellipsis: true,
scopedSlots: { customRender: 'Deliverables' }
},
{
title: this.$t('replyFromProjectContactPerson'),
dataIndex: 'engineeringInterfacePersonReply',
ellipsis: true,
align: 'left'
},
{
title: this.$t('operation'),
align: 'left',
width: 300,
scopedSlots: { customRender: 'operation' }
}
],
detailsList: [],
url: {
list: '/project/projectTaskInventoryFeedbackEO/list',
add: '/project/projectTaskInventoryFeedbackEO/add',
edit: '/project/projectTaskInventoryFeedbackEO/edit',
deleted: '/project/projectTaskInventoryFeedbackEO/delete',
DetailEOAdd: '/project/projectTaskInventoryDetailEO/add',
queryByActiProcInstId: '/project/projectTaskInventoryDetailEO/queryByActiProcInstId',
remindDispose: '/project/projectTaskInventoryEO/remindDispose',
page: '/project/feedbackHistory/page',
confirmEdit: '/project/projectTaskInventoryDetailEO/edit'
},
feedbackId: ''
}
},
mounted() {
this.$route.query.isDisplay = JSON.parse(this.$route.query.isDisplay)
this.getList()
},
computed: {
columns() {
let columnResult = JSON.parse(JSON.stringify(this.columnsAll))
if (this.$route.query.TaskKey != 'zrrclrw' || !this.$route.query.isDisplay) {
for (var i = 0; i < columnResult.length; i++) {
if (columnResult[i].title === this.$t('operation')) {
columnResult.splice(i, 1)
i--
}
}
}
return columnResult
}
},
methods: {
pageOnChange(page, pageSize) {
this.pageNo = page
this.getDetails()
},
handleOk() {
this.$refs.ruleForm.validate(valid => {
if (valid) {
if (this.title == this.$t('addFeedback')) {
this.feedbackData(this.url.add, postAction)
} else if (this.title == this.$t('edit')) {
this.feedbackData(this.url.edit, putAction)
} else if (this.title == this.$t('replyFromProjectContactPerson')) {
this.feedbackData(this.url.edit, putAction)
} else if (this.title == this.$t('distributionEngineer')) {
this.distributionEngineer(this.url.edit, putAction)
}
}
})
},
distributionEngineer() {
let msgType = ''
if (this.$route.query.flowType == 2) {
msgType = 'designRemindMsg'
} else if (this.$route.query.flowType == 3) {
msgType = 'prehomoRemindMsg'
} else if (this.$route.query.flowType == 4) {
msgType = 'verifyRemindMsg'
}
let query = {
status: 'NotDone',
actiProcInstId: this.$route.query.actiProcInstId,
projectTaskInventoryId: this.$route.query.projectTaskInventoryId,
flowType: this.$route.query.flowType,
taskDefinitionKey: 'dreDispose',
msgType: msgType,
distributionEngineerList: this.distributionEngineerList
}
postAction(this.url.DetailEOAdd, query).then((res) => {
if (res.success) {
if (res.success) {
this.confirmLoading = false
this.getList()
this.visible = false
this.$message.success(this.$t('OperationSuccessful'))
} else {
this.confirmLoading = false
this.$message.warning(this.$t('operationFailed'))
}
}
})
},
feedbackData(url, Action) {
this.confirmLoading = true
let query = {
projectTaskInventoryId: this.$route.query.projectTaskInventoryId,
actiProcInstId: this.$route.query.actiProcInstId,
flowType: this.$route.query.flowType,
...this.formInline
}
Action(url, query).then((res) => {
if (res.success) {
this.confirmLoading = false
this.getList()
this.visible = false
this.$message.success(this.$t('OperationSuccessful'))
} else {
this.confirmLoading = false
this.$message.warning(this.$t('operationFailed'))
}
})
},
handleCancel() {
this.visible = false
},
distributionEngineerClick(title, num) {
this.title = title
this.visible = true
this.formInline = {}
if (num == 1) {
this.getReminderHandlingList(1)
}
this.$nextTick(() => {
this.$refs.ruleForm.validateField()
})
},
confirm(val) {
let _this = this
this.$confirm({
content: _this.$t('confirmOperation') + '?',
onOk() {
let query = {}
if (val.status == 'NotDone') {
query = {
id: val.projectTaskInventoryId,
status: 'haveDone'
}
} else {
query = {
id: val.projectTaskInventoryId,
status: 'NotDone'
}
}
putAction(_this.url.confirmEdit, query).then((res) => {
if (res.success) {
_this.$message.success(_this.$t('OperationSuccessful'))
_this.getList()
} else {
_this.$message.warning(_this.$t('operationFailed'))
}
})
}
})
},
reminderHandling() {
this.visibleTable = true
this.getReminderHandlingList(2)
},
getReminderHandlingList(num) {
this.loadingTable = true
let query = {
taskDefinitionKey: 'dreDispose',
actiProcInstId: this.$route.query.actiProcInstId
}
getAction(this.url.queryByActiProcInstId, query).then((res) => {
if (res.success) {
this.dataSourceTable = res.result || []
if (num == 1) {
this.distributionEngineerList = []
let userName = []
let userId = []
if (this.dataSourceTable && this.dataSourceTable.length > 0) {
this.dataSourceTable.forEach(val => {
this.distributionEngineerList.push({
name: val.userName,
id:val.id,
userId: val.userId,
deliveryInstructions: val.deliveryInstructions
})
userName.push(val.userName)
userId.push(val.userId)
})
}
this.formInline.userId = userId.join(',')
this.formInline.userName = userName.join(',')
}
this.loadingTable = false
} else {
this.dataSourceTable = []
this.loadingTable = false
}
})
},
reminderClick(val) {
let msgType = ''
if (this.$route.query.flowType == 2) {
msgType = 'designRemindMsg'
} else if (this.$route.query.flowType == 3) {
msgType = 'prehomoRemindMsg'
} else if (this.$route.query.flowType == 4) {
msgType = 'verifyRemindMsg'
}
let query = {
msgType: msgType,
projectLibraryId: this.$route.query.projectLibraryId,
dreUserIds: val.userId,
serialNumber: this.$route.query.serialNumber
}
postAction(this.url.remindDispose, query).then((res) => {
if (res.success) {
this.$message.success(this.$t('OperationSuccessful'))
} else {
this.$message.warning(this.$t('operationFailed'))
}
})
},
detailsClick(val) {
this.visibleDetails = true
this.feedbackId = val.id
this.getDetails()
},
getDetails() {
let query = {
pageNo: this.pageNo,
pageSize: this.pageSize,
feedbackId: this.feedbackId
}
this.pageLoading = true
getAction(this.url.page, query).then((res) => {
if (res.success) {
this.detailsList = res.result.records || []
this.total = res.result.total
this.pageLoading = false
} else {
this.pageLoading = false
}
})
},
PersonnelSelectionChange(value, id) {
this.formInline[value] = id
if (id) {
this.formInline.userName.split(',').forEach((res, index) => {
this.distributionEngineerList.push({
deliveryInstructions: '',
name: res,
userId: this.formInline[value].split(',')[index]
})
})
}
this.formInline = { ...this.formInline }
},
deleteText(num) {
this.distributionEngineerList.splice(num, 1)
this.distributionEngineerList = [...this.distributionEngineerList]
this.formInline.userName = this.formInline.userName.split(',')
this.formInline.userName.splice(num, 1)
this.formInline.userName = this.formInline.userName.join(',')
this.formInline.userId = this.formInline.userId.split(',')
this.formInline.userId.splice(num, 1)
this.formInline.userId = this.formInline.userId.join(',')
this.formInline = { ...this.formInline }
},
edit(val, title) {
this.title = title
this.visible = true
this.formInline = JSON.parse(JSON.stringify(val))
this.$nextTick(() => {
this.$refs.ruleForm.validateField()
})
},
answerClick(val, title) {
this.title = title
this.visible = true
this.formInline = JSON.parse(JSON.stringify(val))
this.$nextTick(() => {
this.$refs.ruleForm.validateField()
})
},
clickButtonToUpload(item) {
this.$refs.uploadFile.perentHandleFunc()
this.$refs.uploadFile.visible = true
this.uploadName = item
getAction('sys/common/getFileInfos', { id: this.formInline[item] }).then((res) => {
if (res.success) {
this.$refs.uploadFile.perentHandleFunc(res.result)
} else {
this.$refs.uploadFile.perentHandleFunc()
}
})
},
/** 上传文件的回调 */
uploadSuccess(data) {
let attIdList = []
if (data && data.length > 0) {
data.map(item => {
attIdList.push(item.id || data.name)
})
}
/** 赋值给当前对应的表单文件 */
this.formInline[this.uploadName] = attIdList.join(',')
this.formInline = { ...this.formInline }
this.$nextTick(() => {
this.$refs.ruleForm.validateField([this.uploadName])
})
},
getList() {
let query = {
actiProcInstId: this.$route.query.actiProcInstId
}
this.loading = true
getAction(this.url.list, query).then((res) => {
if (res.success) {
this.loading = false
this.dataSource = res.result || []
} else {
this.loading = false
this.dataSource = []
}
})
},
deleted(val) {
let _this = this
this.$confirm({
content: _this.$t('ConfirmDelete'),
onOk() {
deleteAction(_this.url.deleted, { id: val.id }).then((res) => {
if (res.success) {
_this.$message.success(_this.$t('OperationSuccessful'))
_this.getList()
} else {
_this.$message.warning(_this.$t('operationFailed'))
}
})
}
})
},
viewFileClick(item) {
this.$refs.viewFileModelRef.clickButtonToUpload(item)
}
}
}
</script>
<style scoped lang="less">
.box {
padding: 0 24px 24px 24px;
box-sizing: border-box;
}
.box-text {
display: flex;
justify-content: space-between;
height: 80px;
line-height: 80px;
.header-text {
font-size: 16px;
font-weight: 400;
color: #000F16;
}
}
.header-content {
width: 100%;
text-align: right;
margin-bottom: 20px;
}
.text {
margin-right: 8px;
}
.operator-text {
cursor: pointer;
margin-right: 53px;
font-size: 14px;
font-weight: 400;
color: #040B29;
display: inline-block;
}
.operator-text:last-child {
margin-right: 16px;
}
.box-title-text {
line-height: 1.4;
display: flex;
}
.Required {
color: red;
margin-right: 4px;
}
.title-text {
width: 124px;
text-align: right;
display: inline-block;
font-weight: 500;
font-size: 14px;
margin-right: 16px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
height: 42px;
line-height: 42px;
}
.box-input {
display: inline-block;
height: 38px;
width: 100%;
}
.itemModel {
width: calc(100% - 130px);
display: inline-block;
margin-top: 2px;
}
.title-text-text {
margin-top: 9px;
}
.formAdd {
margin-bottom: 40px;
width: calc(100% - 12px);
}
.button-text {
height: 38px;
width: calc(100% - 100px);
line-height: 38px;
background: #fff;
border: 1px #00B3BE solid;
color: #00B3BE;
}
.text-field-left {
font-size: 16px;
font-weight: 400;
color: #6F7385;
}
.text-field-right {
font-size: 16px;
color: #040B29;
font-weight: 400;
}
.text-field-cou {
color: #00B3BE !important;
cursor: pointer;
}
.text-del {
display: inline-block;
text-align: right;
width: 50px;
color: #00B3BE;
cursor: pointer;
}
.engineeringBox {
width: 100%;
max-height: 600px;
overflow: auto;
}
.title-header-text {
font-size: 16px;
font-weight: 400;
color: #000F16;
margin-bottom: 30px;
}
.page {
text-align: right;
margin-top: 20px;
}
.noData {
height: 200px;
line-height: 200px;
text-align: center;
}
</style>