|
@@ -20,8 +20,9 @@
|
|
>
|
|
>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
+ <el-empty v-if="noData" description="暂无数据" />
|
|
<div class="comment-list" v-infinite-scroll="load">
|
|
<div class="comment-list" v-infinite-scroll="load">
|
|
- <div v-for="item in list" :key="item.id" class="comment-item">
|
|
|
|
|
|
+ <div v-for="(item, idx) in list" :key="item.id" class="comment-item">
|
|
<div class="comment-item-header">
|
|
<div class="comment-item-header">
|
|
<p>{{ item.createBy }}</p>
|
|
<p>{{ item.createBy }}</p>
|
|
<p class="comment-item-header__date">{{ item.createTime }}</p>
|
|
<p class="comment-item-header__date">{{ item.createTime }}</p>
|
|
@@ -32,6 +33,7 @@
|
|
width="16px"
|
|
width="16px"
|
|
height="16px"
|
|
height="16px"
|
|
color="var(--el-color-primary)"
|
|
color="var(--el-color-primary)"
|
|
|
|
+ @click="handleDelete(item, idx)"
|
|
/>
|
|
/>
|
|
</div>
|
|
</div>
|
|
<p class="comment-item__inner">
|
|
<p class="comment-item__inner">
|
|
@@ -45,7 +47,8 @@
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
import { computed, ref } from "vue";
|
|
import { computed, ref } from "vue";
|
|
-import { usePagination, getMessageListApi, saveMessageApi } from "@lsq/base";
|
|
|
|
|
|
+import { usePagination } from "@lsq/base";
|
|
|
|
+import { getMessageListApi, saveMessageApi, deleteMessageApi } from "@/api";
|
|
import Drawer from "./Drawer.vue";
|
|
import Drawer from "./Drawer.vue";
|
|
import { useBaseStore, useDetailStore } from "@/stores";
|
|
import { useBaseStore, useDetailStore } from "@/stores";
|
|
import { storeToRefs } from "pinia";
|
|
import { storeToRefs } from "pinia";
|
|
@@ -97,6 +100,28 @@ const handleSubmit = async () => {
|
|
btnLoading.value = false;
|
|
btnLoading.value = false;
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
+
|
|
|
|
+const handleDelete = async (item, idx) => {
|
|
|
|
+ ElMessageBox.confirm("确认是否删除?", "提示", {
|
|
|
|
+ confirmButtonText: "确定",
|
|
|
|
+ cancelButtonText: "取消",
|
|
|
|
+ type: "warning",
|
|
|
|
+ beforeClose: async (action, instance, done) => {
|
|
|
|
+ if (action === "confirm") {
|
|
|
|
+ try {
|
|
|
|
+ instance.confirmButtonLoading = true;
|
|
|
|
+ await deleteMessageApi(item.id);
|
|
|
|
+ list.value.splice(idx, 1);
|
|
|
|
+ done();
|
|
|
|
+ } finally {
|
|
|
|
+ instance.confirmButtonLoading = false;
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ done();
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ });
|
|
|
|
+};
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|