|
@@ -4,10 +4,10 @@
|
|
|
<div class="item" v-for="(item, index) in list" :key="item.id" @click="handleItem(index)">
|
|
|
<img class="itemImg" :src="item.imgUrl" alt="" />
|
|
|
<div class="text">
|
|
|
- {{ item.imgInfo }}
|
|
|
+ <div :title="item.imgInfo">{{ item.imgInfo }}</div>
|
|
|
<EditPen @click.stop="handleEdit(item)" class="EditPen" />
|
|
|
</div>
|
|
|
- <CircleCloseFilled @click.stop="handleDet(index)" class="itemIcon" />
|
|
|
+ <CircleCloseFilled @click.stop="handleDet(index, item.id)" class="itemIcon" />
|
|
|
</div>
|
|
|
</VueDraggable>
|
|
|
<el-empty class="empty" v-else description="请上传现场照片" />
|
|
@@ -16,106 +16,16 @@
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
import { ref, onMounted, watch } from 'vue'
|
|
|
-import { caseImgList, CaseImg } from "@/store/case";
|
|
|
+import { caseImgList, CaseImg, caseDel } from "@/store/case";
|
|
|
import { VueDraggable } from 'vue-draggable-plus'
|
|
|
import { addCaseImgFile } from "../quisk";
|
|
|
// import { IconRabbish } from '@element-plus/icons-vue'
|
|
|
const props = defineProps({ sortType: Boolean, caseId: Number });
|
|
|
const emit = defineEmits<{
|
|
|
- (e: "changeList", value: Case[] | null): void;
|
|
|
+ (e: "changeList", value: CaseImg[] | null): void;
|
|
|
(e: "handleItem", value: Number | null): void;
|
|
|
}>();
|
|
|
-const list = ref([
|
|
|
- {
|
|
|
- name: 'Joao1',
|
|
|
- id: 1
|
|
|
-},
|
|
|
-{
|
|
|
- name: 'Jean2',
|
|
|
- id: 2
|
|
|
-},
|
|
|
-{
|
|
|
- name: 'Johanna3',
|
|
|
- id: 3
|
|
|
-},
|
|
|
-{
|
|
|
- name: 'Juan4',
|
|
|
- id: 4
|
|
|
-},
|
|
|
-{
|
|
|
- name: 'Joao5',
|
|
|
- id: 5
|
|
|
-},
|
|
|
-{
|
|
|
- name: 'Jean6',
|
|
|
- id: 6
|
|
|
-},
|
|
|
-{
|
|
|
- name: 'Johanna7',
|
|
|
- id: 7
|
|
|
-},
|
|
|
-{
|
|
|
- name: 'Juan8',
|
|
|
- id: 8
|
|
|
-},{
|
|
|
- name: 'Juan4',
|
|
|
- id: 4
|
|
|
-},
|
|
|
-{
|
|
|
- name: 'Joao5',
|
|
|
- id: 5
|
|
|
-},
|
|
|
-{
|
|
|
- name: 'Jean6',
|
|
|
- id: 6
|
|
|
-},
|
|
|
-{
|
|
|
- name: 'Johanna7',
|
|
|
- id: 7
|
|
|
-},
|
|
|
-{
|
|
|
- name: 'Juan8',
|
|
|
- id: 8
|
|
|
-},{
|
|
|
- name: 'Juan4',
|
|
|
- id: 4
|
|
|
-},
|
|
|
-{
|
|
|
- name: 'Joao5',
|
|
|
- id: 5
|
|
|
-},
|
|
|
-{
|
|
|
- name: 'Jean6',
|
|
|
- id: 6
|
|
|
-},
|
|
|
-{
|
|
|
- name: 'Johanna7',
|
|
|
- id: 7
|
|
|
-},
|
|
|
-{
|
|
|
- name: 'Juan8',
|
|
|
- id: 8
|
|
|
-},{
|
|
|
- name: 'Juan4',
|
|
|
- id: 4
|
|
|
-},
|
|
|
-{
|
|
|
- name: 'Joao5',
|
|
|
- id: 5
|
|
|
-},
|
|
|
-{
|
|
|
- name: 'Jean6',
|
|
|
- id: 6
|
|
|
-},
|
|
|
-{
|
|
|
- name: 'Johanna7',
|
|
|
- id: 7
|
|
|
-},
|
|
|
-{
|
|
|
- name: 'Juan8',
|
|
|
- id: 8
|
|
|
-}
|
|
|
-])
|
|
|
+const list = ref<CaseImg[]>([])
|
|
|
|
|
|
watch(()=>props.sortType,(newValue, oldValue)=>{
|
|
|
console.log('sum is changed',newValue,oldValue);
|
|
@@ -135,10 +45,12 @@ async function getList () {
|
|
|
emit("changeList", list.value);
|
|
|
|
|
|
}
|
|
|
-function handleDet(index: Number) {
|
|
|
- list.value.splice(index, 1)
|
|
|
- emit("changeList", list.value);
|
|
|
- console.log('handleDet', list.value);
|
|
|
+function handleDet(index: Number, id: Number) {
|
|
|
+ caseDel(id).then(res=>{
|
|
|
+ list.value.splice(index, 1)
|
|
|
+ emit("changeList", list.value);
|
|
|
+ console.log('handleDet', list.value);
|
|
|
+ })
|
|
|
}
|
|
|
function handleEdit(params) {
|
|
|
addCaseImgFile({ caseId: props.caseId, data: {
|
|
@@ -171,10 +83,18 @@ onMounted(() => {
|
|
|
object-fit: cover;
|
|
|
}
|
|
|
.text{
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ align-items: center;
|
|
|
+ div{
|
|
|
+ width: calc(100% - 20px);
|
|
|
+ white-space: nowrap;
|
|
|
+ text-overflow: ellipsis;
|
|
|
+ overflow: hidden;
|
|
|
+ }
|
|
|
.EditPen{
|
|
|
width: 20px;
|
|
|
height: 20px;
|
|
|
- float: right;
|
|
|
}
|
|
|
}
|
|
|
.itemIcon{
|