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

295 lines
9.4 KiB
Vue
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>
<div>
<j-table
:can-drag="true"
:scroll="{x: '100%'}"
ref="table"
rowKey="enterpriseStandardPlanId"
:columns="columns"
:dataSource="dataSource"
:pagination="false"
:loading="loading">
<!-- 原企标编号/企标名称 -->
<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>
<!-- 操作栏 -->
<div slot="action" slot-scope="{record, index}" class="action-span-cell">
<a @click="handleEdit(record, index)" class="table-ope-btn">{{ $t('edit') }}</a>
<a-divider v-if="currentNode === 7" type="vertical" />
<a v-if="currentNode === 7" @click="handleDelete(record.id, index)" class="table-ope-btn">{{ $t('delete') }}</a>
</div>
</j-table>
</div>
<!-- 新增编辑的弹框 -->
<base-info-table-modal ref="baseInfoTableModal" source="tableBaseInfo" :edit-role="editRole" @ok="modelFormOk"></base-info-table-modal>
</div>
</template>
<script>
import JTable from '@/components/jero/JTable'
import BaseInfoTableModal from './BaseInfoTableModal'
export default {
name: 'TableBaseInfo',
components: { JTable, BaseInfoTableModal },
props: {
disabled: {
type: Boolean,
required: false,
default: false
},
// 当前节点
currentNode: {
type: Number,
required: false,
default: 1
}
},
computed: {
// 当前节点编辑的角色,用做弹框中的编辑特殊判断
editRole () {
if (this.currentNode === 4) {
return 'drafter'
} else if (this.currentNode === 5) {
return 'contact'
} else {
return ''
}
}
},
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('operation'),
scopedSlots: { customRender: 'action' },
align: 'center',
fixed: 'right',
width: 200
}
],
dataSource: [
{
id: 1,
draftPlanFinishDate: '2022-01-09',
exposureDraftPlanFinishDate: '2022-01-09',
// planSubmissionDate: '2022-01-09'
}
],
editIndex: undefined // 编辑的下标
}
},
mounted () {
if (this.currentNode === 6) {
// 是主起草单位主管级领导批准节点,没有操作列
this.columns.pop()
}
},
methods: {
// 拿到外面传进来的数据初始化,因为套了几层就不在外层初始化数据了
initData (data) {
this.data = data
// 给表格赋值
// this.dataSource =
},
// 外层要获取数据
getData () {
// 把数据抛出
const data = {}
data.dataSource = this.dataSource
return data
},
// 外层获取数据要过校验,返回false表示没有通过校验
getDataValidate (callback) {
// 校验表格是否每行都有数据,每行的联络人是否都有
if (this.dataSource && this.dataSource.length > 0) {
const data = {}
data.dataSource = this.dataSource
callback(data)
} else {
this.$message.warning(this.$t('addAtLeastOneRowOfData'))
const data = false
callback(data)
}
},
// 企标编号,企标名称跳转详情,原企标
handleGoDetailOld (record) {
this.$openPageNewSheet({
path: '/enterpriseStandardLibrary/enterpriseStandardDetail',
query: {
standardNumber: record.originEnStandardNo
}
})
},
// 企标编号,企标名称跳转详情,新企标
handleGoDetailNew (record) {
this.$openPageNewSheet({
path: '/enterpriseStandardLibrary/enterpriseStandardDetail',
query: {
standardNumber: record.newEnStandardNo
}
})
},
// 新增或编辑完成
modelFormOk (value) {
this.dataSource.splice(this.editIndex, 1, value)
},
// 编辑
handleEdit (record, index) {
this.editIndex = index
this.$refs.baseInfoTableModal.edit(record)
},
// 删除
handleDelete (id, index) {
this.dataSource.splice(index, 1)
}
}
}
</script>
<style scoped>
</style>