Files
laws-sinotruk-client/src/views/workCenter/annualRevisionPlanStandardizationInit/modules/LeaderApproveSentBaseInfo.vue
T

296 lines
9.8 KiB
Vue

<template>
<div>
<!-- 操作区域 -->
<div class="table-operator">
<!-- 批量设置主起草人 -->
<a-button icon="setting" type="primary" ghost @click="batchSetDrafter">
{{ $t('workCenter.revisionPlanActivelyReport.batchSetDrafter') }}
</a-button>
</div>
<div>
<j-table
:can-drag="true"
:scroll="{x: '100%'}"
ref="table"
:rowKey="(record, index) => {return index}"
:columns="columns"
:dataSource="dataSource"
:pagination="false"
:loading="loading"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}">
<!-- 原企标编号/企标名称 -->
<template v-slot:toDetailOld="{text, record}">
<a-tooltip overlay-class-name="tooltip-style">
<template slot="title">{{ text || text === 0 ? text : global.emptyLine }}</template>
<a v-if="text" class="link-a" @click="handleGoDetailOld(record)">{{ text }}</a>
<div v-else class="table-text">{{ global.emptyLine }}</div>
</a-tooltip>
</template>
<!-- 新企标编号/企标名称 -->
<template v-slot:toDetailNew="{text, record}">
<a-tooltip overlay-class-name="tooltip-style">
<template slot="title">{{ text || text === 0 ? text : global.emptyLine }}</template>
<a v-if="text" class="link-a" @click="handleGoDetailNew(record)">{{ text }}</a>
<div v-else class="table-text">{{ global.emptyLine }}</div>
</a-tooltip>
</template>
</j-table>
</div>
<!-- 选人弹框 -->
<user-select-modal ref="userSelectModal" type="radio" @change="userSelectModalChange" @nameChange="userSelectNameChange"></user-select-modal>
</div>
</template>
<script>
import JTable from '@/components/jero/JTable'
// 选人弹框
import UserSelectModal from '@/components/selection/UserSelectModal'
import UserSelection from '@/components/selection/UserSelection'
export default {
name: 'LeaderApproveSentBaseInfo',
components: { JTable, UserSelectModal, UserSelection },
props: {
disabled: {
type: Boolean,
required: false,
default: false
}
},
data () {
return {
loading: false,
columns: [
{
title: this.$t('serialNumber'),
dataIndex: '',
key: 'rowIndex',
align: 'center',
width: 80,
customRender: function (t, r, index) {
return parseInt(index) + 1
}
},
{ // 制修订类型
title: this.$t('enterpriseStandardLibrary.plan.revisionType'),
align: 'center',
width: 180,
dataIndex: 'projectType_dictText',
scopedSlots: { customRender: 'text' }
},
{ // 原企标编号
title: this.$t('enterpriseStandardLibrary.plan.oldEnterpriseStandardNum'),
align: 'center',
width: 180,
dataIndex: 'originEnStandardNo',
scopedSlots: { customRender: 'toDetailOld' }
},
{ // 新企标编号
title: this.$t('enterpriseStandardLibrary.plan.newEnterpriseStandardNum'),
align: 'center',
width: 180,
dataIndex: 'newEnStandardNo',
scopedSlots: { customRender: 'toDetailNew' }
},
{ // 原企标名称
title: this.$t('enterpriseStandardLibrary.plan.oldEnterpriseStandardName'),
align: 'center',
width: 180,
dataIndex: 'originEnStandardName',
scopedSlots: { customRender: 'toDetailOld' }
},
{ // 新企标名称
title: this.$t('enterpriseStandardLibrary.plan.newEnterpriseStandardName'),
align: 'center',
width: 180,
dataIndex: 'newEnStandardName',
scopedSlots: { customRender: 'toDetailNew' }
},
{ // 授权部门
title: this.$t('enterpriseStandardLibrary.plan.authDepartment'),
align: 'center',
width: 180,
dataIndex: 'authDept_dictText',
scopedSlots: { customRender: 'text' }
},
{ // 企业标准代号
title: this.$t('enterpriseStandardLibrary.plan.enterpriseStandardCode'),
align: 'center',
width: 180,
dataIndex: 'enStandardCode_dictText',
scopedSlots: { customRender: 'text' }
},
{ // 配合单位
title: this.$t('enterpriseStandardLibrary.plan.suitUnit'),
align: 'center',
width: 180,
dataIndex: 'cooperationUnit_dictText',
scopedSlots: { customRender: 'text' }
},
{ // 主起草人
title: this.$t('enterpriseStandardLibrary.plan.principalDrafter'),
align: 'center',
width: 180,
dataIndex: 'mainDraftingUser_dictText',
scopedSlots: { customRender: 'text' }
},
{ // 主起草单位
title: this.$t('enterpriseStandardLibrary.plan.mainDraftingUnit'),
align: 'center',
width: 180,
dataIndex: 'mainDraftingUnit_dictText',
scopedSlots: { customRender: 'text' }
},
{ // 主起草单位负责人
title: this.$t('enterpriseStandardLibrary.plan.headOfMainDraftingUnit'),
align: 'center',
width: 180,
dataIndex: 'mainDraftingUnitResponsiblePerson_dictText',
scopedSlots: { customRender: 'text' }
},
{ // 标准推进人
title: this.$t('enterpriseStandardLibrary.plan.standardPusher'),
align: 'center',
width: 180,
dataIndex: 'standardPromoter_dictText',
scopedSlots: { customRender: 'text' }
},
{ // 草稿计划完成日期
title: this.$t('enterpriseStandardLibrary.plan.draftPlanFinishDate'),
align: 'center',
width: 180,
dataIndex: 'draftPlannedCompleteDate',
scopedSlots: { customRender: 'text' }
},
{ // 征求意见稿计划完成日期
title: this.$t('enterpriseStandardLibrary.plan.exposureDraftPlanFinishDate'),
align: 'center',
width: 200,
dataIndex: 'solicitationDraftPlanCompleteDate',
scopedSlots: { customRender: 'text' }
},
{ // 计划报批日期
title: this.$t('enterpriseStandardLibrary.plan.planSubmissionDate'),
align: 'center',
width: 180,
dataIndex: 'planApprovalDate',
scopedSlots: { customRender: 'text' }
},
{ // 变更状态
title: this.$t('enterpriseStandardLibrary.plan.changeState'),
align: 'center',
width: 180,
dataIndex: 'changeStatus_dictText',
scopedSlots: { customRender: 'text' }
},
{ // 主起草人
title: this.$t('workCenter.revisionPlanActivelyReport.drafter'),
align: 'center',
width: 300,
dataIndex: 'drafter',
customRender: (value, row, index) => {
return <user-selection v-model={this.dataSource[index].prcMainDraftUser}
nameStr={this.dataSource[index].prcMainDraftUser_dictText}
disabled={this.disabled} type={'radio'} placeholder={this.$t('pleaseSelect')} />
}
}
],
dataSource: [],
selectedRowKeys: [],
selectionRows: [],
url: {
list: ''
},
selectNames: '' // 选完人的名字,批量设置人需要用
}
},
methods: {
// 拿到外面传进来的数据初始化,因为套了几层就不在外层初始化数据了
initData (data) {
// 给表格赋值
this.dataSource = data
},
// 外层要获取数据
getData () {
// 把数据抛出
const data = {}
data.dataSource = this.dataSource
return data
},
// 外层获取数据要过校验,返回false表示没有通过校验
getDataValidate () {
// 每行的主起草人是否都有
let data = {}
let hasErr = false
for (const item of this.dataSource) {
if (!item.prcMainDraftUser) {
// 需要选主起草人,但是没有选择
hasErr = true
break
}
}
if (hasErr) {
this.$message.warning(this.$t('workCenter.revisionPlanActivelyReport.pleaseSelectDrafter'))
data = false
} else {
data.dataSource = this.dataSource
}
return data
},
// 企标编号,企标名称跳转详情,原企标
handleGoDetailOld (record) {
this.$openPageNewSheet({
path: '/enterpriseStandardLibrary/enterpriseStandardDetail',
query: {
standardNumber: record.originEnStandardNo
}
})
},
// 企标编号,企标名称跳转详情,新企标
handleGoDetailNew (record) {
this.$openPageNewSheet({
path: '/enterpriseStandardLibrary/enterpriseStandardDetail',
query: {
standardNumber: record.newEnStandardNo
}
})
},
// 表格选中
onSelectChange (selectedRowKeys, selectionRows) {
this.selectedRowKeys = selectedRowKeys
this.selectionRows = selectionRows
},
// 批量设置主起草人
batchSetDrafter () {
if (this.selectedRowKeys.length <= 0) {
// 请选择要分发的数据
this.$message.warning(this.$t('pleaseSelectDistributeData'))
return
}
this.$refs.userSelectModal.open()
},
// 批量设置主起草人选择人后的回调
userSelectModalChange (value) {
for (const item of this.selectedRowKeys) {
this.dataSource[item].prcMainDraftUser = value
this.dataSource[item].prcMainDraftUser_dictText = this.selectNames
}
this.dataSource = JSON.parse(JSON.stringify(this.dataSource))
},
// 选人的名字获取
userSelectNameChange (value) {
this.selectNames = value
}
}
}
</script>
<style scoped>
</style>