<!--
|
* @Date: 2024-06-23 09:25:40
|
* @LastEditors: Sneed
|
* @LastEditTime: 2024-06-23 19:43:23
|
* @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/console/basic-data/tpm-data1.vue
|
-->
|
<template>
|
<div>
|
<scTable :ref="'table' + key" @selection-change="handleSelectionChange" row-key="id" border :apiObj="apiObj"
|
stripe @dataChange="dataChange">
|
<el-table-column type="selection" width="55" />
|
<el-table-column :prop="item.prop" :label="item.label" :key="item.prop" v-for="item in cols">
|
</el-table-column>
|
<el-table-column label="操作" fixed="right" align="left" width="160">
|
<template #default="scope">
|
<el-button-group>
|
<el-button text type="primary" size="small"
|
@click="table_edit(scope.row, scope.$index)">编辑</el-button>
|
<el-popconfirm width="220" cancel-button-text="停用" confirm-button-text="删除"
|
title="删除数据会影响已关联的业务 ,若您想在已关联的业务中依然显示这些数据, 您可以选择 停用 操作。停用后此数据将不能再被新业务使用。"
|
@confirm="table_del([scope.row], '0')" @cancel="table_del([scope.row], '1')">
|
<template #reference>
|
<el-button type="danger" text size="small">删除</el-button>
|
</template>
|
</el-popconfirm>
|
</el-button-group>
|
</template>
|
</el-table-column>
|
</scTable>
|
</div>
|
</template>
|
|
<script>
|
export default {
|
props: {
|
key: {
|
type: String
|
},
|
params: {
|
type: Object,
|
default() {
|
return {
|
keyWord: '',
|
status: 1
|
}
|
}
|
},
|
cols: {
|
type: Array,
|
default() {
|
return []
|
}
|
},
|
apiObj: {
|
type: Object,
|
default() {
|
return {}
|
}
|
}
|
},
|
data() {
|
return {
|
// apiObj: {
|
// get: async (data) => {
|
// let params = {
|
// ...data,
|
// ...this.params
|
// }
|
// return await this.$HTTP.get(`/api/smis/maintain-item/page`, {}, { params }).then(res => {
|
// res.data.records = res?.data?.records.map(v => {
|
// return {
|
// ...v,
|
// statusName: v.status ? '启用' : '禁用'
|
// }
|
// })
|
// return res
|
// })
|
// }
|
// }
|
}
|
},
|
methods: {
|
query() {
|
this.$refs?.[`table${this.key}`]?.reload()
|
},
|
handleSelectionChange(val) {
|
this.$emit('selection-change', val)
|
},
|
dataChange() {
|
|
},
|
table_edit(row) {
|
console.log(row, 'eeeeeee')
|
this.$emit('edit', { ...row })
|
},
|
table_del(selection, type) {
|
this.$emit('del', selection, type)
|
}
|
},
|
}
|
</script>
|
|
<style lang="scss" scoped></style>
|