Files
laws_weilai/jero-web/src/views/projectManagement/projectNonConformance/index.vue
T
2022-07-12 16:45:38 +08:00

473 lines
15 KiB
Java

<template>
<a-card :bordered="false">
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
<a-col :md="6" :sm="8">
<div class="box-title-text">
<div class="title-text" :title="$t('standard')">
<span>{{$t('standard')}}</span>
</div>
<j-input class="box-input" :placeholder="$t('PleaseEnter')+$t('standard')"
v-model="queryParam.serialNumber"></j-input>
</div>
</a-col>
<a-col :md="6" :sm="8">
<div class="box-title-text">
<div class="title-text" :title="$t('title')">
<span>{{$t('title')}}</span>
</div>
<j-input class="box-input" :placeholder="$t('PleaseEnter')+$t('title')"
v-model="queryParam.title"></j-input>
</div>
</a-col>
<a-col :md="6" :sm="8">
<div class="box-title-text">
<div class="title-text" :title="$t('areaOfResponsibility')">
<span>{{$t('areaOfResponsibility')}}</span>
</div>
<j-dict-select-tag class="box-input" v-model="queryParam.dutyTerritory"
:placeholder="$t('PleaseSelect')+$t('areaOfResponsibility')"
:type="'select'"
:triggerChange="false" :dictCode="'duty_territory'"/>
</div>
</a-col>
<template v-if="toggleSearchStatus">
<a-col :md="6" :sm="8">
<div class="box-title-text">
<div class="title-text" :title="$t('ProcessType')">
<span>{{$t('ProcessType')}}</span>
</div>
<a-select allowClear
class="box-input"
v-model="queryParam.flowType"
:placeholder="$t('PleaseSelect')+$t('ProcessType')">
<a-select-option :value="this.$t('designComplianceReview')">
<span class="itemOption">
{{ $t('designComplianceReview') }}
</span>
</a-select-option>
<a-select-option :value="this.$t('preHomeConfirmation')">
<span class="itemOption">
{{ $t('preHomeConfirmation') }}
</span>
</a-select-option>
<a-select-option :value="this.$t('verificationComplianceReview')">
<span class="itemOption">
{{ $t('verificationComplianceReview') }}
</span>
</a-select-option>
</a-select>
</div>
</a-col>
<a-col :md="6" :sm="8">
<div class="box-title-text">
<div class="title-text" :title="$t('RelatedItems')">
<span>{{$t('RelatedItems')}}</span>
</div>
<a-select allowClear
class="box-input"
v-model="queryParam.projectName"
:placeholder="$t('PleaseSelect')+$t('RelatedItems')">
<a-select-option v-for="(item, key) in projectNameList"
:key="key"
:value="item.projectName">
<span style="display: inline-block;width: 100%" :title=" item.projectName ">
{{ item.projectName}}
</span>
</a-select-option>
</a-select>
</div>
</a-col>
<a-col :md="6" :sm="8">
<div class="box-title-text">
<div class="title-text" :title="$t('problemType')">
<span>{{$t('problemType')}}</span>
</div>
<a-select allowClear
class="box-input"
v-model="queryParam.problemType"
:placeholder="$t('PleaseSelect')+$t('problemType')">
<a-select-option :value="$t('inconformity')">
<span class="itemOption">
{{ $t('nonConformity') }}
</span>
</a-select-option>
<a-select-option :value="$t('toTrack')">
<span class="itemOption">
{{ $t('Tracked') }}
</span>
</a-select-option>
</a-select>
</div>
</a-col>
<a-col :md="6" :sm="8">
<div class="box-title-text">
<div class="title-text" :title="$t('Sponsor')">
<span>{{$t('Sponsor')}}</span>
</div>
<PersonnelSelection :query="{db_field_name:'initiator',db_field_txt:$t('Sponsor')}"
:isInput="true"
class="box-input"
:personneQuery="queryParam"
@change="PersonnelSelectionChange"
v-model="queryParam.initiatorName"/>
</div>
</a-col>
<a-col :md="6" :sm="8">
<div class="box-title-text">
<div class="title-text" :title="$t('personLiable')">
<span>{{$t('personLiable')}}</span>
</div>
<PersonnelSelection :query="{db_field_name:'duty',db_field_txt:$t('personLiable')}"
:isInput="true"
class="box-input"
:personneQuery="queryParam"
@change="PersonnelSelectionChange"
v-model="queryParam.dutyName"/>
</div>
</a-col>
</template>
<span style="float: right;overflow: hidden;margin-right: 11px" class="table-page-search-submitButtons">
<a-col :md="6" :sm="24">
<a-button class="box-button" type="primary" @click="searchQuery">{{$t('query')}}</a-button>
<a-button class="box-button" style="margin-left: 8px" @click="searchReset">{{$t('reset')}}</a-button>
<a @click="handleToggleSearch" style="margin-left: 8px">
{{ !toggleSearchStatus ? $t('open') : $t('away') }}
<a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
</a>
</a-col>
</span>
</a-row>
</a-form>
</div>
<div class="table-operator">
<div @click="handleExport" v-has="'ncrTrack:exportData'" class="operator-text">
<a-icon type="export" :rotate="-90"/>
{{ $t('export') }}
</div>
</div>
<div>
<a-table
ref="table"
size="middle"
rowKey="uuid"
:loading="loading"
:pagination="false"
:scroll="{x: '100%'}"
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
:data-source="dataSource"
:columns="columns"
>
<span slot="standard" slot-scope="text,result">
<a @click="standardClick(result)" class="textName" :title="text">
{{text}}
</a>
</span>
</a-table>
</div>
<div class="page" v-if="dataSource.length > 0">
<a-pagination
:show-total="total => $t('total')+` ${total} `+$t('strip')"
show-quick-jumper
show-size-changer
:page-size.sync="pageSize"
:total="total"
:current="pageNo"
@change="pageOnChange"
@showSizeChange="SizeChange"
/>
</div>
</a-card>
</template>
<script>
import { getAction, postAction, downloadFile, deleteAction ,downloadFilePost} from '@/api/manage'
import PersonnelSelection from '@/components/PersonnelSelection/index'
import store from '@/store/'
export default {
name: 'projectNonConformance',
components: {
PersonnelSelection
},
data() {
return {
queryParam: {},
loading: false,
dataSource: [],
selectedRowKeys: [],
projectNameList: [],
toggleSearchStatus: false,
columns: [
{
title: this.$t('standard'),
align: 'center',
dataIndex: 'serialNumber',
width: 170,
scopedSlots: { customRender: 'standard' }
},
{
title: this.$t('title'),
align: 'center',
dataIndex: 'title',
width: 170,
scopedSlots: { customRender: 'standard' }
},
{
title: this.$t('ProcessType'),
align: 'center',
dataIndex: 'flowType',
width: 180,
ellipsis: true
},
{
title: this.$t('areaOfResponsibility'),
align: 'center',
dataIndex: 'dutyTerritory',
width: 180,
ellipsis: true
},
{
title: this.$t('RelatedItems'),
align: 'center',
dataIndex: 'projectName',
width: 180,
ellipsis: true
},
{
title: this.$t('problemType'),
align: 'center',
dataIndex: 'problemType',
width: 140,
ellipsis: true
},
{
title: this.$t('Sponsor'),
align: 'center',
dataIndex: 'initiator',
width: 140
},
{
title: this.$t('personLiable'),
align: 'center',
dataIndex: 'duty',
width: 140
}
],
total: 0,
pageSize: 10,
pageNo: 1,
url: {
page: '/project/ncrTrackController/queryPage',
exportData: '/project/ncrTrackController/exportData'
},
content: []
}
},
created() {
if (store.getters.userInfo) {
this.$socketPublic.dispatch('webSocketInit')//初始化ws
}
},
mounted() {
this.getList()
this.getNameList()
},
watch: {
'$socketPublic.state.msg': {
//处理接收到的消息
handler: function(res) {
let that = this
let data = JSON.parse(res.data)
if (data.msgId) {
this.getList()
}
}
}
},
methods: {
getNameList() {
getAction('project/projectNameInfoEO/list', {}).then((res) => {
if (res.success) {
this.projectNameList = res.result || []
} else {
this.projectNameList = []
}
})
},
handleToggleSearch() {
this.toggleSearchStatus = !this.toggleSearchStatus
},
searchQuery() {
this.pageNo = 1
this.getList()
},
onSelectChange(value) {
this.content = []
this.selectedRowKeys = value
if (this.selectedRowKeys && this.selectedRowKeys.length > 0) {
this.dataSource.forEach(res => {
this.selectedRowKeys.forEach(val => {
if (res.uuid == val) {
this.content.push({
id: res.id,
flowType: res.flowType
})
}
})
})
}
},
searchReset() {
this.pageNo = 1
this.queryParam = {}
this.getList()
},
pageOnChange(page, pageSize) {
this.pageNo = page
this.getList()
},
SizeChange(page, pageSize) {
this.pageNo = 1
this.pageSize = pageSize
this.getList()
},
getList() {
let query = {
pageNo: this.pageNo,
pageSize: this.pageSize,
...this.queryParam
}
this.loading = true
getAction(this.url.page, query).then((res) => {
if (res.success) {
this.dataSource = res.result.records || []
this.total = res.result.total
this.loading = false
} else {
this.dataSource = []
this.loading = false
}
})
},
handleExport() {
let query = {
...this.queryParam,
ncrTrackVOList: this.content
}
downloadFilePost(this.url.exportData, this.$t('NonConformance') + '.xls', query, this.Deselect)
},
Deselect() {
this.selectedRowKeys = []
},
PersonnelSelectionChange(value, id) {
this.queryParam[value] = id
this.queryParam = { ...this.queryParam }
},
standardClick(val) {
let num = val.prcType
let query = {
taskIds: val.taskId,
projectTaskInventoryId: val.projectLawsInventoryId,
projectLibraryId: val.projectLibraryId,
projectName: val.projectName,
id: val.projectLibraryId,
serialNumber: val.serialNumber,
actiProcInstId: val.prcId,
primaryKeyId: val.projectTaskInventoryDetailId,
TaskKey: val.taskDefinitionKey,
isDisplay: val.status == 'NotDone' ? true : false
}
switch (num) {
case '2':
query.flowType = 2
query.Sponsor = 'designInitiatorName'
query.personLiable = 'designDutyName'
query.typeOfDeliverables = 'designDeliverableTypeName'
query.deliverableTemplate = 'designDeliverableTemplate'
query.DueDate = 'designDueDate'
query.remarks = 'designRemark'
break
case '3':
query.flowType = 3
query.Sponsor = 'prehomoInitiatorName'
query.personLiable = 'prehomoDutyName'
query.typeOfDeliverables = 'prehomoDeliverableTypeName'
query.deliverableTemplate = 'prehomoDeliverableTemplate'
query.DueDate = 'prehomoDueDate'
query.remarks = 'prehomoRemark'
break
case '4':
query.flowType = 4
query.Sponsor = 'verifyInitiatorName'
query.personLiable = 'verifyDutyName'
query.typeOfDeliverables = 'verifyDeliverableTypeName'
query.deliverableTemplate = 'verifyDeliverableTemplate'
query.DueDate = 'verifyDueDate'
query.remarks = 'verifyRemark'
break
}
let newUrl = this.$router.resolve({
path: '/taskListProcess',
query: query
})
window.open(newUrl.href, '_blank')
}
}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
.box-title-text {
line-height: 1.4;
display: flex;
align-items: center;
margin-bottom: 10px;
}
.title-text {
width: 110px;
color: #000F16;
display: inline-block;
font-weight: 500;
font-size: 14px;
margin-right: 16px;
margin-top: 3px;
text-align: right;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.box-input {
display: inline-block;
width: 70%;
height: 38px;
margin-top: 2px;
}
.box-button {
height: 38px;
/*margin-top: 2px;*/
}
.page {
text-align: right;
margin-top: 20px;
}
.textName {
width: 100%;
overflow: hidden;
display: -webkit-box;
text-overflow: ellipsis;
/*! autoprefixer: off */
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
/*! autoprefixer: on;*/
text-justify: inter-ideograph;
word-break: break-all
}
</style>