153 lines
4.5 KiB
Vue
153 lines
4.5 KiB
Vue
<template>
|
|
<div>
|
|
<div class="table-operator">
|
|
<!-- 新增 -->
|
|
<a-button icon="plus" type="primary" @click="handleAdd" v-has="'enterpriseStandard:add'">{{ $t('newlyAdded') }}</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 slot="action" slot-scope="{text, record, index}">
|
|
<a @click="handleDelete(record, index)" >{{ $t('delete') }}</a>
|
|
</template>
|
|
|
|
</j-table>
|
|
</div>
|
|
<standard-selection v-show="false" ref="standardSelection" @change="changeStandardSelect"/>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { JeroListMixin } from '@/mixins/JeroListMixin'
|
|
import JTable from '@comp/jero/JTable'
|
|
import StandardSelection from '@comp/selection/StandardSelection'
|
|
|
|
export default {
|
|
name: 'BaseInfoTable',
|
|
components: { StandardSelection, JTable },
|
|
mixins: [JeroListMixin],
|
|
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'
|
|
}
|
|
],
|
|
columns: [
|
|
{
|
|
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' }
|
|
},
|
|
{
|
|
// 操作
|
|
fixed: 'right',
|
|
title: this.$t('operation'),
|
|
// dataIndex: 'action',
|
|
align: 'center',
|
|
width: 100,
|
|
scopedSlots: { customRender: 'action' }
|
|
}
|
|
]
|
|
}
|
|
},
|
|
methods: {
|
|
// 新增
|
|
handleAdd () {
|
|
this.$refs.standardSelection.standardClick()
|
|
},
|
|
changeStandardSelect (val) {
|
|
console.log(val)
|
|
},
|
|
// 跳转详情
|
|
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()
|
|
},
|
|
getIds () {
|
|
return this.dataSource.map(item => item.id).join(',')
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
|
|
</style>
|