|
@@ -16,7 +16,7 @@
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
import { ref, onMounted, watch } from 'vue'
|
|
|
-import { caseImgList, CaseImg, caseDel } from "@/store/case";
|
|
|
+import { caseImgList, CaseImg, caseDel, caseUpdateSort } from "@/store/case";
|
|
|
import { VueDraggable } from 'vue-draggable-plus'
|
|
|
import { addCaseImgFile } from "../quisk";
|
|
|
// import { IconRabbish } from '@element-plus/icons-vue'
|
|
@@ -28,19 +28,22 @@ const emit = defineEmits<{
|
|
|
const list = ref<CaseImg[]>([])
|
|
|
|
|
|
watch(()=>props.sortType,(newValue, oldValue)=>{
|
|
|
- console.log('sum is changed',newValue,oldValue);
|
|
|
emit("changeList", list.value);
|
|
|
},{ deep: true, immediate:true})
|
|
|
|
|
|
-function onChange(event: any) {
|
|
|
- emit("changeList", list.value);
|
|
|
+async function onChange() {
|
|
|
+ let apiList = list.value.map((item, index) => {
|
|
|
+ return {...item, sort: index + 1}
|
|
|
+ })
|
|
|
+ await caseUpdateSort(apiList)
|
|
|
+ emit("changeList", apiList);
|
|
|
}
|
|
|
function handleItem(index) {
|
|
|
emit("handleItem", index);
|
|
|
|
|
|
}
|
|
|
async function getList () {
|
|
|
- let lists = await caseImgList(props.caseId)
|
|
|
+ let lists = await caseImgList(props.caseId, '')
|
|
|
list.value = lists.data
|
|
|
emit("changeList", list.value);
|
|
|
|
|
@@ -52,16 +55,19 @@ function handleDet(index: Number, id: Number) {
|
|
|
console.log('handleDet', list.value);
|
|
|
})
|
|
|
}
|
|
|
-function handleEdit(params) {
|
|
|
- addCaseImgFile({ caseId: props.caseId, data: {
|
|
|
+async function handleEdit(params) {
|
|
|
+ await addCaseImgFile({ caseId: props.caseId, data: {
|
|
|
...params,
|
|
|
} });
|
|
|
+ getList()
|
|
|
}
|
|
|
onMounted(() => {
|
|
|
getList()
|
|
|
// emit("update:list", props.list.value);
|
|
|
})
|
|
|
-
|
|
|
+defineExpose({
|
|
|
+ getList
|
|
|
+});
|
|
|
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|
|
@@ -87,7 +93,7 @@ onMounted(() => {
|
|
|
justify-content: space-between;
|
|
|
align-items: center;
|
|
|
div{
|
|
|
- width: calc(100% - 20px);
|
|
|
+ width: 100%;
|
|
|
white-space: nowrap;
|
|
|
text-overflow: ellipsis;
|
|
|
overflow: hidden;
|
|
@@ -95,6 +101,15 @@ onMounted(() => {
|
|
|
.EditPen{
|
|
|
width: 20px;
|
|
|
height: 20px;
|
|
|
+ display: none;
|
|
|
+ }
|
|
|
+ &:hover{
|
|
|
+ div{
|
|
|
+ width: calc(100% - 20px);
|
|
|
+ }
|
|
|
+ .EditPen{
|
|
|
+ display: block;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
.itemIcon{
|