[add] 企标稽查计划

This commit is contained in:
danshihao
2023-10-30 15:32:11 +08:00
parent c08f52b145
commit e24aaf8415
11 changed files with 1181 additions and 3 deletions
@@ -0,0 +1,286 @@
<template>
<div>
<div class="table-operator">
<!-- 新增 -->
<a-button icon="plus" type="primary" @click="handleAdd" v-has="'enterpriseStandard:add'">{{ $t('newlyAdded') }}</a-button>
<!-- 导入 -->
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
<a-button icon="upload" type="primary" ghost v-has="'enterpriseStandard:upload'">{{ $t('import') }}</a-button>
</a-upload>
<!-- 批量删除 -->
<a-button icon="delete" type="primary" ghost @click="batchDel" v-has="'enterpriseStandard:batchDel'">{{ $t('batchDelete') }}</a-button>
</div>
<div>
<j-table
v-if="columns && columns.length > 0"
:columns="columns"
:dataSource="dataSource"
:can-drag="true"
rowKey="id"
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
:pagination="ipagination"
:scroll="{x: '100%'}"
@change="tableOnChange">
<!-- 企标号、企标名称 -->
<template v-slot:standard="{text, record}">
<a-tooltip overlay-class-name="tooltip-style">
<template slot="title">{{ text || text === 0 ? text : global.emptyLine }}</template>
<a class="table-text can-click-table-text" @click="detailClick(record)" v-if="(text || text === 0) && record.detailFlag">{{ text }}</a>
<div class="table-text" v-else-if="(text || text === 0) && !record.detailFlag">{{ text }}</div>
<div class="table-text" v-else>{{ global.emptyLine }}</div>
</a-tooltip>
</template>
<!-- 所属部门意见 -->
<template v-slot:departOpinion="{text, record}">
<a-tooltip overlay-class-name="tooltip-style">
<template slot="title">{{ text || text === 0 ? text : global.emptyLine }}</template>
<a class="table-text can-click-table-text" @click="showDepartOpinion(record)" v-if="(text || text === 0)">{{ $t('view') }}</a>
<div class="table-text" v-else-if="(text || text === 0)">{{ text }}</div>
<div class="table-text" v-else>{{ global.emptyLine }}</div>
</a-tooltip>
</template>
<!-- 操作 -->
<template slot="action" slot-scope="{text, record, index}">
<!-- 编辑 and 删除:节点1 或 节点3 或 节点2且当前登录人是创建人 -->
<template v-if="['1', '3'].includes(currentNode) || (currentNode === '2' && $store.getters.userInfo.id === record.userId)">
<a @click="handleEdit(record, index)" >{{ $t('edit') }}</a>
<a-divider type="vertical" />
<a @click="handleDelete(record, index)" >{{ $t('delete') }}</a>
</template>
<!-- 意见 or 填写意见:节点2非自己创建的就是意见和填写意见 -->
<template v-else-if="currentNode === '2'">
<a v-if="!!record.opinion" @click="handleShowOpinion(record, index)" >{{ $t('workCenter.esInspectionPlan.opinion') }}</a>
<a v-else @click="handleWriteOpinion(record, index)" >{{ $t('workCenter.esInspectionPlan.writeOpinion') }}</a>
</template>
</template>
</j-table>
</div>
<!-- 新增/编辑稽查计划 -->
<inspection-plan-drawer ref="modalForm" @ok="modalFormOk"/>
<!-- 填写意见、意见回显 -->
<write-opinion-modal ref="writeOpinionModal" @ok="modalFormOk"/>
<!-- 节点3:所属部门意见-查看 -->
<show-opinion-modal ref="showOpinionModal" @ok="modalFormOk"/>
</div>
</template>
<script>
import { JeroListMixin } from '@/mixins/JeroListMixin'
import JTable from '@comp/jero/JTable'
import InspectionPlanDrawer from '@views/workCenter/enterpriseStandardInspectionPlan/modules/InspectionPlanDrawer'
import WriteOpinionModal from '@views/workCenter/enterpriseStandardInspectionPlan/modules/WriteOpinionModal'
import ShowOpinionModal from '@views/workCenter/enterpriseStandardInspectionPlan/modules/ShowOpinionModal'
export default {
name: 'InspectionPlanTable',
components: { ShowOpinionModal, WriteOpinionModal, InspectionPlanDrawer, JTable },
mixins: [JeroListMixin],
props: {
// 当前节点
currentNode: {
type: String,
required: true
}
},
data () {
return {
url: {
list: ''
},
model: {},
dataSource: [
{
id: 1,
inspectionBasisStandardName: '123',
inspectionBasisStandardNumber: '123',
detailFlag: true,
departOpinion: '123',
mainDutyStandardizationGroup: '1699358097292472322'
},
{
id: 3,
inspectionBasisStandardName: 'qaaa',
inspectionBasisStandardNumber: '12asdasdas3',
detailFlag: true,
departOpinion: '123',
opinion: [],
mainDutyStandardizationGroup: '1699358097292472322'
},
{
id: 2,
inspectionBasisStandardName: '123',
inspectionBasisStandardNumber: '123',
detailFlag: true,
departOpinion: '123',
userId: 'e9ca23d68d884d4ebb19d07889727dae'
// mainDutyStandardizationGroup: '1699358097292472322'
}
],
allColumns: [
{
title: this.$t('serialNumber'),
dataIndex: '',
key: 'rowIndex',
align: 'center',
width: 80,
customRender: function (t, r, index) {
return parseInt(index) + 1
}
},
{ // 稽查依据标准号
title: this.$t('workCenter.esInspectionPlan.inspectionBasisStandardNumber'),
align: 'center',
width: 180,
dataIndex: 'inspectionBasisStandardNumber',
scopedSlots: { customRender: 'standard' }
},
{ // 稽查依据标准名称
title: this.$t('workCenter.esInspectionPlan.inspectionBasisStandardName'),
align: 'center',
width: 180,
dataIndex: 'inspectionBasisStandardName',
scopedSlots: { customRender: 'standard' }
},
{ // 计划稽查对象
title: this.$t('workCenter.esInspectionPlan.planInspectionObjects'),
align: 'center',
width: 120,
dataIndex: 'planInspectionObjects',
scopedSlots: { customRender: 'text' }
},
{ // 主责标准化工作组
title: this.$t('workCenter.esInspectionPlan.mainDutyStandardizationGroup'),
align: 'center',
width: 150,
dataIndex: 'mainDutyStandardizationGroup',
scopedSlots: { customRender: 'text' }
},
{ // 所属部门
title: this.$t('workCenter.esInspectionPlan.department'),
align: 'center',
width: 120,
dataIndex: 'department',
scopedSlots: { customRender: 'text' }
},
{ // 计划稽查日期
title: this.$t('workCenter.esInspectionPlan.planInspectionDate'),
align: 'center',
width: 120,
dataIndex: 'planInspectionDate',
scopedSlots: { customRender: 'text' }
},
{ // 稽查负责人
title: this.$t('workCenter.esInspectionPlan.inspectionDirector'),
align: 'center',
width: 120,
dataIndex: 'inspectionDirector',
scopedSlots: { customRender: 'text' }
},
{ // 标准化组对接人
title: this.$t('workCenter.esInspectionPlan.standardizationGroupContactPerson'),
align: 'center',
width: 140,
dataIndex: 'standardizationGroupContactPerson',
scopedSlots: { customRender: 'text' }
},
{ // 所属部门人员
title: this.$t('workCenter.esInspectionPlan.departmentPersonnel'),
align: 'center',
width: 120,
dataIndex: 'departmentPersonnel',
showCodeList: ['1'],
scopedSlots: { customRender: 'text' }
},
{ // 创建人
title: this.$t('workCenter.esInspectionPlan.creator'),
align: 'center',
width: 120,
dataIndex: 'creator',
showCodeList: ['2'],
scopedSlots: { customRender: 'text' }
},
{ // 发起人
title: this.$t('workCenter.esInspectionPlan.initiator'),
align: 'center',
width: 120,
dataIndex: 'initiator',
showCodeList: ['3', '4', '5'],
scopedSlots: { customRender: 'text' }
},
{ // 所属部门意见
title: this.$t('workCenter.esInspectionPlan.departOpinion'),
align: 'center',
width: 120,
dataIndex: 'departOpinion',
showCodeList: ['3'],
scopedSlots: { customRender: 'departOpinion' }
},
{
fixed: 'right',
// 操作
showCodeList: ['1', '2', '3'],
title: this.$t('operation'),
// dataIndex: 'action',
align: 'center',
width: 180,
scopedSlots: { customRender: 'action' }
}
]
}
},
computed: {
// 按节点进行过滤
columns () {
return this.allColumns.filter(item => {
// 没有这个属性,就默认显示
if (!item.showCodeList) {
return true
}
// 如果有,就根据当前节点显示
return item.showCodeList.includes(this.currentNode)
})
}
},
mounted () {
},
methods: {
// 跳转详情
detailClick (record) {
this.$openPageNewSheet({
path: '/enterpriseStandardLibrary/enterpriseStandardDetail',
query: {
id: record.id
}
})
},
tableOnChange (pagination, filters, sorter) {
this.orderBy = sorter.order === 'ascend' ? '1' : '2'
this.orderByField = sorter.columnKey
this.ipagination = pagination
this.getTableList()
},
// 显示意见
handleShowOpinion (record) {
this.$refs.writeOpinionModal.show(record, true)
},
// 填写意见
handleWriteOpinion (record) {
this.$refs.writeOpinionModal.show(record)
},
// 查看所属部门意见
showDepartOpinion (record) {
this.$refs.showOpinionModal.show(record)
}
}
}
</script>
<style scoped>
</style>