This commit is contained in:
@jyuhsin
2025-09-12 11:22:58 +08:00
parent 33e106c019
commit 8c21833204
@@ -10,7 +10,7 @@
@load="onLoad">
<div class="table-list-container">
<div v-for="(row, index) in tableData" :key="index" class="table-list-item">
<slot name="header" :index="index" :row="row">
<slot name="header" :index="index" :row="row" v-if="$slots.header">
<div class="item-header">
<div class="item-title">{{ row[title] }}</div>
<enum-tag :value="row.instanceState" name="ProcessInstanceStateEnum" label_key="message"
@@ -18,8 +18,15 @@
</div>
</slot>
<div style="display: flex;column-gap: 10px"
:style="{'max-height':img ? '100px':'unset', 'overflow': img ? 'hidden':'unset' }">
<div class="img-container" v-if="img">
<img :src="row[img]" alt="" style="object-fit: cover">
</div>
<div class="">
<slot :index="index" :row="row"></slot>
</div>
</div>
<div class="item-actions">
<slot name="actions" :index="index" :row="row"></slot>
</div>
@@ -54,13 +61,17 @@ module.exports = {
},
title: {
type: String,
default: ''
default: ""
},
img: {
type: String,
default: ""
}
},
watch: {
page_form: {
handler(newVal, oldVal) {
this.localPageForm = {...newVal}
this.localPageForm = { ...newVal }
},
deep: true,
immediate: true
@@ -72,14 +83,14 @@ module.exports = {
tableLoading: false,
tableFinished: false,
tableRefreshing: false,
localPageForm: {...this.page_form}
localPageForm: { ...this.page_form }
}
},
methods: {
onLoad(){
onLoad() {
if (this.tableFinished) return
this.localPageForm.pageNumber++
this.$emit('update:page_form', {...this.localPageForm});
this.$emit("update:page_form", { ...this.localPageForm })
this.pageData()
},
@@ -87,14 +98,14 @@ module.exports = {
this.tableLoading = true
const loading = createListLoading()
this.$axios.post(this.api, this.json ? ({pageForm: JSON.stringify(this.localPageForm)}) : this.localPageForm).then((res) => {
this.$axios.post(this.api, this.json ? ({ pageForm: JSON.stringify(this.localPageForm) }) : this.localPageForm).then((res) => {
if (res.code === 0) {
this.tableData = this.tableData.concat(res.data.list)
this.localPageForm.totalCount = res.data.totalCount
if (this.tableData.length >= this.localPageForm.totalCount) {
this.tableFinished = true
}
this.$emit('update:page_form', {...this.localPageForm});
this.$emit("update:page_form", { ...this.localPageForm })
}
}).finally(() => {
loading.close()
@@ -108,17 +119,17 @@ module.exports = {
this.tableFinished = false
this.tableData = []
this.localPageForm.pageNumber = 1
this.$emit('update:page_form', {...this.localPageForm});
this.$emit("update:page_form", { ...this.localPageForm })
this.pageData()
},
onRefresh() {
this.localPageForm.pageNumber = 1
this.$emit('update:page_form', {...this.localPageForm});
this.$emit("update:page_form", { ...this.localPageForm })
this.doSearch()
},
}
},
mounted() {
this.$emit('ready');
this.$emit("ready")
}
}
</script>
@@ -160,6 +171,20 @@ module.exports = {
padding-right: 10px;
}
.table-list-container .table-list-item .img-container {
width: 100px;
height: 100px;
flex-shrink: 0;
border-radius: 6px;
}
.table-list-container .table-list-item .img-container img {
width: 100%;
height: 100%;
border-radius: 6px;
}
.table-list-container .table-list-item .item-meta {
display: flex;
color: #606266;