Files
laws_weilai/jero-web/src/views/otamanagement/upgradeactivity/components/initiatingProcess.vue
T
2023-03-16 09:16:12 +08:00

830 lines
28 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 id="examineBox">
<headerProcess
:title="title"
/>
<div class="detail-box">
<div class="detail-content" style="padding: 20px">
<div class="table-page-search-wrapper" v-if="whetherDisplay">
<search ref="searchRef"
:flag="'1'"
:url="url"/>
</div>
<div v-if="whetherDisplay">
<a-table
ref="table"
size="middle"
:components="drag(columns,'columns')"
:loading="loading"
:pagination="false"
:scroll="{x: '100%'}"
rowKey="id"
:data-source="dataSource"
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange ,columnTitle:' '}"
:columns="columns"
>
<span slot="whetherTheDisassemblySheetIncluded" slot-scope="text,record">
{{record.sarFileSplitInfoList && record.sarFileSplitInfoList.length > 0 ? '是':'否'}}
</span>
<span slot="whetherTheDisassemblySheetIncludedTitle" :title="$t('whetherTheDisassemblySheetIncluded')">
{{$t('whetherTheDisassemblySheetIncluded')}}
</span>
</a-table>
<div class="page" v-if="dataSource && dataSource.length > 0">
<a-pagination
:show-total="total => $t('total')+` ${total} `+$t('strip')"
show-quick-jumper
:page-size.sync="pageSize"
:total="total"
:current="pageNo"
@change="pageOnChange"
@showSizeChange="SizeChange"
/>
</div>
</div>
<a-form-model :model="formInline" class="formAdd" :rules="rules" ref="ruleForm">
<a-row :gutter="24" v-if="whetherDisplay">
<a-col :span="12">
<div class="box-title-text">
<div class="title-text">
<span class="Required">*</span>
<span class="title-text-text" :title="$t('standardDecompositionDocument')">{{$t('standardDecompositionDocument')}}</span>
</div>
<a-form-model-item class="itemModel" prop="whetherTobring">
<a-radio-group class="box-input"
v-model="formInline.whetherTobring" @change="onChange">
<a-radio :value="'1'">
{{$t('yes')}}
</a-radio>
<a-radio :value="'2'">
{{$t('notOnlyRz')}}
</a-radio>
</a-radio-group>
</a-form-model-item>
</div>
</a-col>
</a-row>
<a-row :gutter="24">
<a-col :span="8">
<div class="box-title-text" style="height: 60px">
<div class="title-text" :title="$t('brand')">
<span class="Required">*</span>
<span class="title-text-text" :title="$t('brand')">{{$t('brand')}}</span>
</div>
<a-form-model-item class="itemModel propbox" prop="brands">
<j-multi-select-tag class="box-input" v-model="formInline.brands"
:placeholder="$t('PleaseSelect')+$t('brand')"
:type="'select'"
style="width: 100%"
:triggerChange="false" :dictCode="'brand'"/>
</a-form-model-item>
</div>
</a-col>
</a-row>
<a-row :gutter="24" style="margin-bottom: 10px">
<a-col :span="16">
<div class="box-title-text">
<div class="title-text">
<span class="title-text-text" :title="$t('selectedStandard')">{{$t('selectedStandard')}}</span>
</div>
<div class="title-text-content"
:title="selectedRowKeysRecord[0] ? selectedRowKeysRecord[0].serialNumber+' - '+selectedRowKeysRecord[0].title:''"
:class="{'title-text-content-one':!isTrue}">
{{selectedRowKeysRecord[0] ?
selectedRowKeysRecord[0].serialNumber+'-'+selectedRowKeysRecord[0].title:''}}
</div>
<div class="title-text-right title-text-right-index" v-if="isTrue">
<span :title="$t('standardDecompositionDocument')" @click="standardDecompositionDocumentClick">
{{$t('standardDecompositionDocument')}}
</span>
</div>
<div class="title-text-right" v-if="isTrue">
<span :title="$t('importLocalDisassemblyOrder')" @click="importLocalDisassemblyOrderClick">
{{$t('importLocalDisassemblyOrder')}}
</span>
</div>
</div>
</a-col>
</a-row>
<a-row :gutter="24">
<a-col :span="8">
<div class="box-title-text">
<div class="title-text">
<span class="Required">*</span>
<span class="title-text-text" :title="$t('closingDate')">{{$t('closingDate')}}</span>
</div>
<a-form-model-item class="itemModel" prop="endTime">
<a-date-picker class="box-input"
:disabledDate="disabledDate"
:placeholder="$t('PleaseSelect')+$t('closingDate')"
@change="dateChange('endTime')"
:getCalendarContainer="(trigger) => trigger.parentNode"
format="YYYY-MM-DD"
v-model="formInline['endTime']"
style="width: 100%"/>
</a-form-model-item>
</div>
</a-col>
<a-col :span="8">
<div class="box-title-text">
<div class="title-text">
<span class="title-text-text"
:title="$t('RelevantMaterials')">{{$t('RelevantMaterials')}}</span>
</div>
<a-form-model-item class="itemModel" prop="accessory_id">
<a-button type="primary" class="button-text"
@click="clickButtonToUpload('relatedDataFileId')">
{{ (formInline.relatedDataFileId === 'null' || formInline.relatedDataFileId === '' ||
formInline.relatedDataFileId == null) ? $t('clickUpload') : $t('viewUploadedFiles')
}}
</a-button>
</a-form-model-item>
</div>
</a-col>
</a-row>
<a-row :gutter="24">
<a-col :span="24">
<div class="box-title-text">
<div class="title-text">
<span class="title-text-text" :title="$t('processBackground')">{{$t('processBackground')}}</span>
</div>
<a-form-model-item class="itemModel" prop="processBackground">
<a-textarea :placeholder="$t('pleaseEnter')+$t('processBackground')"
v-model="formInline.processBackground"
:rows="4"/>
</a-form-model-item>
</div>
</a-col>
</a-row>
<a-row :gutter="24">
<a-col :span="24">
<div class="box-title-text">
<div class="title-text">
<span class="title-text-text" :title="$t('remarks')">{{$t('remarks')}}</span>
</div>
<a-form-model-item class="itemModel" prop="remark">
<a-textarea :placeholder="$t('pleaseEnter')+$t('remarks')"
v-model="formInline.remark"
:rows="4"/>
</a-form-model-item>
</div>
</a-col>
</a-row>
<a-row :gutter="24" v-if="!isTrue">
<a-col :span="12">
<div class="box-title-text">
<div class="title-text">
<!-- <span class="Required">*</span>-->
<span class="title-text-text" :title="$t('evaluationMethod')">{{$t('evaluationMethod')}}</span>
</div>
<a-form-model-item class="itemModel" prop="gatherResult">
<a-tree-select
tree-node-filter-prop="title"
v-model="formInline.evaluationMethods"
:maxTagCount="1"
@change="evaluationMethodsChange"
:getPopupContainer="triggerNode=> triggerNode.parentNode"
class="box-input"
style="width: 100%"
:tree-data="gatherResultList"
tree-checkable
:placeholder="$t('PleaseSelect')+$t('evaluationMethod')"
/>
</a-form-model-item>
</div>
</a-col>
<a-col :span="12">
<div class="box-title-text">
<div class="title-text">
<span class="Required">*</span>
<span class="title-text-text" :title="$t('Assessor')">{{$t('Assessor')}}</span>
</div>
<a-form-model-item class="itemModel" prop="evaluatorsName">
<PersonnelSelection class="box-input"
:personneQuery="formInline"
:query="{db_field_name:'evaluators',db_field_txt:$t('Assessor')}"
:isInput="true"
@change="PersonnelSelectionChange"
v-model="formInline.evaluatorsName"/>
</a-form-model-item>
</div>
</a-col>
</a-row>
</a-form-model>
<TermInformation
ref="TermInformationRef"
@TermInformationRefForm="TermInformationRefForm"
:gatherResultList="gatherResultList"
v-if="isTrue"/>
<footerProcess
@submit="submit"
:isSubmit="true"
/>
</div>
</div>
<JLoading :loading="JLoading">{{this.$t('pleaseWaitWhileRunning')}}</JLoading>
<uploadFile ref="uploadFile" @uploadSuccess="uploadSuccess"/>
<standardDecompositionSheet ref="standardDecompositionSheetRef"
:gatherResultList="gatherResultList"
@standardDecompositionSheetForm="standardDecompositionSheetForm"/>
</div>
</template>
<script>
import headerProcess from '../../../processCenter/components/headerProcess'
import search from '@/components/search/index'
import uploadFile from '@/components/uploadFile/file'
import PersonnelSelection from '@/components/PersonnelSelection/index'
import footerProcess from '../../../processCenter/components/footerProcess'
import standardDecompositionSheet from './standardDecompositionSheet'
import TermInformation from './TermInformation'
import { getAction, postAction } from '@/api/manage'
import moment from 'moment'
import eventBUs from '../../../../common/event'
import { mapGetters } from 'vuex'
import { ResizeHeader, ResizeColumnProvide } from '@/mixins/header'
export default {
name: 'evaluationInitiationProcess',
components: {
headerProcess,
search,
uploadFile,
footerProcess,
PersonnelSelection,
standardDecompositionSheet,
TermInformation
},
mixins:[ResizeHeader, ResizeColumnProvide],
data() {
return {
title: this.$t('regulatoryEngineer') + this.$t('initiatingProcess'),
//url传参严格按照当前命名
url: {
seachList: 'document/bussDocumentLibraryEO/queryCondition', //搜索字段
addModelList: '/dummy/dummyInventoryInfoEO/queryPageDummy',
addModelListOne: '/lawsTechnologyEvaluation/lawsTechnologyEvaluationEO/queryPageDummy'
},
loading: false,
JLoading: false,
isTrue: false,
dataSource: [],
selectedRowKeys: [],
total: 0,
pageSize: 10,
pageNo: 1,
formInline: {},
standardDecomposition: [],
gatherResultList: [],
rules: {
endTime: [
{
required: true,
message: this.$t('closingDate') + this.$t('cannotEmpty'),
trigger: 'change'
}
],
whetherTobring: [
{
required: true,
message: this.$t('standardDecompositionDocument') + this.$t('cannotEmpty'),
trigger: 'change'
}
],
evaluatorsName: [
{
required: true,
message: this.$t('Assessor') + this.$t('cannotEmpty'),
trigger: 'change'
}
],
brands: [
{
required: true,
message: this.$t('brand') + this.$t('cannotEmpty'),
trigger: 'change'
}
],
processBackground: [
{
max: 300,
message: this.$t('processBackground') + this.$t('cannotExceed') + 300 + this.$t('Characters'),
trigger: 'blur'
}
],
remark: [
{
max: 300,
message: this.$t('remarks') + this.$t('cannotExceed') + 300 + this.$t('Characters'),
trigger: 'blur'
}
]
},
searchParmes: {},
selectedRowKeysRecord: [],
standardList: [],
whetherDisplay: false,
columns: [
{
title: this.$t('standard'),
align: 'left',
dataIndex: 'serial_number',
width: 170,
ellipsis: true,
scopedSlots: { customRender: 'serial_number' }
},
{
title: this.$t('title'),
align: 'left',
dataIndex: 'title',
ellipsis: true,
width: 170,
scopedSlots: { customRender: 'titleName' }
},
{
title: this.$t('status'),
align: 'left',
width: 140,
ellipsis: true,
dataIndex: 'state'
},
{
title: this.$t('zoneOfApplication'),
align: 'left',
width: 170,
ellipsis: true,
dataIndex: 'region'
},
{
title: this.$t('technicalField'),
align: 'left',
ellipsis: true,
width: 170,
dataIndex: 'technology_territory'
},
{
title: this.$t('correspondingStandard'),
align: 'left',
ellipsis: true,
width: 170,
dataIndex: 'corresponding_standard'
},
{
align: 'left',
ellipsis: true,
width: 170,
scopedSlots: {
customRender: 'whetherTheDisassemblySheetIncluded',
title: 'whetherTheDisassemblySheetIncludedTitle'
}
}
]
}
},
mounted() {
document.title = this.$t('regulatoryEngineer') + this.$t('initiatingProcess')
this.getEvaluationMethodTree()
if (this.$route.query.whetherTobring == '1') {
this.formInline.whetherTobring = '1'
this.formInline = { ...this.formInline }
this.isTrue = true
} else {
this.isTrue = false
this.formInline.whetherTobring = '2'
this.formInline = { ...this.formInline }
}
if (this.$route.query.firstInitiation == '1') {
this.whetherDisplay = true
this.getList()
} else {
this.whetherDisplay = false
this.formInline.processBackground = this.$route.query.processBackground
this.formInline.lawsTechnologyEvaluationId = this.$route.query.lawsTechnologyEvaluationId
this.formInline.remark = this.$route.query.remark
this.formInline.standId = this.$route.query.standId
this.formInline = { ...this.formInline }
this.getListOne()
}
eventBUs.$on('searchQuery', search => {
Object.keys(search).forEach(res => {
if (search[res] instanceof Array) {
search[res] = search[res].join(',')
}
})
this.pageNo = 1
this.searchParmes = search
this.getList()
})
},
methods: {
...mapGetters(['userInfo']),
getEvaluationMethodTree() {
getAction('/sys/category/getEvaluationMethodTree').then((res) => {
if (res.success) {
this.gatherResultList = res.result
} else {
this.gatherResultList = []
}
})
},
disabledDate(current) {
return current && current < moment().subtract(1, 'day')
},
pageOnChange(page) {
this.pageNo = page
this.getList()
},
SizeChange(page, pageSize) {
this.pageNo = 1
this.pageSize = pageSize
this.getList()
},
getListOne() {
let query = {
pageNo: this.pageNo,
pageSize: this.pageSize,
id: this.formInline.standId
}
this.loading = true
// let url = ''
// if (this.isTrue) {
// url = this.url.addModelListOne
// } else {
// url = this.url.addModelList
// }
postAction('/lawsTechnologyEvaluation/lawsTechnologyEvaluationEO/queryPageDummyById', query).then((res) => {
if (res.success) {
let content = res.result || []
this.selectedRowKeysRecord.push({
standId: content[0].id,
serialNumber: content[0].serial_number,
title: content[0].title,
title_en: content[0].title_en,
technologyTerritory: content[0].technology_territory_id
})
this.standardDecomposition = content
this.loading = false
} else {
this.dataSource = []
this.loading = false
}
})
},
getList() {
let query = {
pageNo: this.pageNo,
pageSize: this.pageSize,
...this.searchParmes
}
this.loading = true
let url = ''
if (this.isTrue) {
url = this.url.addModelListOne
} else {
url = this.url.addModelList
}
postAction(url, query).then((res) => {
if (res.success) {
this.dataSource = res.result.records || []
this.total = res.result.total
this.loading = false
} else {
this.dataSource = []
this.total = 0
this.loading = false
}
})
},
onSelectChange(value, record) {
this.selectedRowKeys = value
this.selectedRowKeysRecord = []
if (this.selectedRowKeys.length > 1) {
this.selectedRowKeys.shift()
}
let content = record.filter(res => {
return res.id == this.selectedRowKeys[0]
})
if (content && content.length > 0) {
this.selectedRowKeysRecord.push({
standId: content[0].id,
title_en:content[0].title_en,
serialNumber: content[0].serial_number,
title: content[0].title,
technologyTerritory: content[0].technology_territory_id
})
}
this.standardDecomposition = content
},
standardDecompositionDocumentClick() {
if (this.standardDecomposition && this.standardDecomposition.length > 0) {
if (this.standardDecomposition[0].sarFileSplitInfoList && this.standardDecomposition[0].sarFileSplitInfoList.length > 0) {
this.$refs.standardDecompositionSheetRef.getData(JSON.parse(JSON.stringify(this.standardDecomposition[0])), this.standardList)
} else {
this.$message.warning(this.$t('thereForTheCurrentlySelectedData'))
}
} else {
this.$message.warning(this.$t('pleaseSelectStandardFirst'))
}
},
standardDecompositionSheetForm(value) {
this.standardList = JSON.parse(JSON.stringify(value))
this.$refs.TermInformationRef.getData(JSON.parse(JSON.stringify(value)))
},
TermInformationRefForm(value) {
if (value && value.itemId) {
this.standardList = this.standardList.filter(res => {
return value.itemId != res.id
})
}
this.$refs.standardDecompositionSheetRef.getRowList(JSON.parse(JSON.stringify(value)))
},
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 }
},
PersonnelSelectionChange(value, id) {
this.formInline[value] = id
this.formInline = { ...this.formInline }
},
evaluationMethodsChange(key, name) {
this.formInline.evaluationMethods = key
this.formInline.evaluationMethodsName = []
this.formInline.evaluationMethodsName = name
},
dateChange(item) {
this.formInline[item] = this.formInline[item] ? moment(this.formInline[item]).format('YYYY-MM-DD') : ''
},
getUUID() {
var str = []
var Chars = '0123456789abcdefghijklmnopqrstuvwxyz'
for (var i = 0; i < 36; i++) {
str[i] = Chars.substr(Math.floor(Math.random() * 16), 1)
}
str[0] = str[8] = str[13] = str[18] = str[23] = '-'
return str.join('')
},
submit(startTime) {
this.$refs.ruleForm.validate(valid => {
if (valid) {
if (this.selectedRowKeysRecord && this.selectedRowKeysRecord.length == 0) {
this.$message.warning(this.$t('pleaseSelectStandard'))
} else {
if (this.isTrue) {
this.$refs.TermInformationRef.submitData((dataList) => {
this.submitData(startTime, dataList)
})
} else {
this.submitData(startTime)
}
}
}
})
},
submitData(startTime, dataList) {
this.JLoading = true
let value = Object.assign(this.formInline, this.selectedRowKeysRecord[0])
if (this.isTrue) {
value.evaluationType = 'Item evaluation'
} else {
value.evaluationType = 'Feedback evaluation'
}
value.startTime = startTime
value.flowStatus = 'Underway'
value.taskAffirmDueDate = value.endTime
if (!value.lawsTechnologyEvaluationId) {
value.lawsTechnologyEvaluationId = this.getUUID()
}
value.regulationOwnerId = this.userInfo().id
value.regulationOwnerName = this.userInfo().username
Object.keys(value).forEach(res => {
if (value[res] && value[res] instanceof Array) {
value[res] = value[res].join(',')
}
if (value[res] && typeof value[res] == 'string') {
value[res] = value[res].replace(/\"/g, '“')
value[res] = value[res].replace(/\'/g, '‘')
}
})
let operatorTime = moment(new Date()).format('YYYY-MM-DD HH:mm:ss')
value.handlingTime = operatorTime
this.startProcess(value, dataList)
},
startProcess(value, dataList) {
let query = {}
if (this.isTrue) {
query = {
type: 6,
...value,
firstInitiation: this.$route.query.firstInitiation,
msg: JSON.stringify({ itemList: dataList }).replace(/\"/g, '\'')
}
} else {
query = {
type: 6,
...value,
firstInitiation: this.$route.query.firstInitiation,
msg: JSON.stringify({ evaluators: value.evaluators }).replace(/\"/g, '\'')
}
}
postAction('/workFlow/startProcess', query).then((res) => {
if (res.success) {
this.$message.success(this.$t('OperationSuccessful'))
this.JLoading = false
this.$router.push({
path: '/technologyAssessment'
})
// this.completeTask(value, res.result)
} else {
this.JLoading = false
this.$message.warning(this.$t('operationFailed'))
}
})
},
completeTask(value, taskId) {
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: taskId,
json: JSON.stringify(value).replace(/\"/g, '\'')
}
postAction('/workFlow/completeTask', query).then((res) => {
if (res.success) {
this.$message.success(this.$t('OperationSuccessful'))
this.JLoading = false
this.$router.push({
path: '/technologyAssessment'
})
} else {
this.JLoading = false
this.$message.warning(this.$t('operationFailed'))
}
})
},
onChange(event) {
this.isTrue = event.target.value == '1' ? true : false
},
importLocalDisassemblyOrderClick() {
this.$refs.TermInformationRef.openData()
}
}
}
</script>
<style>
.ant-input-disabled {
color: rgba(0, 0, 0, 0.65) !important;
}
</style>
<style scoped>
/deep/.propbox .ant-form-explain{
margin-top: -17px !important;
}
.detail-box {
padding: 67px 0 0 0;
background: #ffffff;
height: 100%;
overflow: auto;
}
#examineBox {
display: flex;
flex-direction: column;
background: #fff;
position: relative;
height: 100%;
overflow-y: auto;
}
.box-title-text {
line-height: 1.4;
display: flex;
/*align-items: center;*/
}
.title-text {
width: 118px;
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: 48px;
color: #000F16;
}
.box-input {
display: inline-block;
height: 38px;
width: 100%;
}
.itemModel {
width: calc(100% - 130px);
display: inline-block;
margin-top: 2px;
margin-bottom: 12px;
}
.Required {
color: red;
margin-right: 4px;
}
.title-text-text {
margin-top: 9px;
}
.formAdd {
margin-top: 20px;
}
.button-text {
height: 38px;
width: calc(100%);
line-height: 38px;
background: #fff;
border: 1px #00B3BE solid;
color: #00B3BE;
}
.page {
text-align: right;
margin-top: 20px;
}
.title-text-content {
display: inline-block;
width: calc(100% - 530px);
text-align: center;
border: 1px solid #d9d9d9;
line-height: 38px;
border-bottom-left-radius: 5px;
border-top-left-radius: 5px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
word-break: break-word;
padding: 0 14px;
box-sizing: border-box;
}
.title-text-right {
width: 200px;
text-align: center;
border: 1px solid #d9d9d9;
line-height: 38px;
border-bottom-right-radius: 5px;
border-top-right-radius: 5px;
border-left: none;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
word-break: break-word;
padding: 0 14px;
box-sizing: border-box;
color: #21c9cc;
cursor: pointer;
}
.title-text-right-index {
border-bottom-right-radius: 0;
border-top-right-radius: 0;
}
.title-text-content-one {
border-bottom-right-radius: 5px;
border-top-right-radius: 5px;
width: calc(100% - 132px);
}
</style>