Browse Source

Merge branch 'xj' of http://192.168.0.115:3000/bill/public-fuse into xj

bill 1 year ago
parent
commit
328958e363
3 changed files with 14 additions and 5 deletions
  1. 1 0
      src/request/urls.ts
  2. 5 1
      src/store/case.ts
  3. 8 4
      src/view/case/photos/draggable.vue

+ 1 - 0
src/request/urls.ts

@@ -228,6 +228,7 @@ export const onLineCheck = "/web/fireProject/onLineCheck";
 export const caseApiList = "/fusion-xj/caseImg/list";
 export const saveApiOrUpdate = "/fusion-xj/caseImg/saveOrUpdate";
 export const caseApiDel = "/fusion-xj/caseImg/delete";
+export const caseApiUpdateSort = "/fusion-xj/caseImg/updateSort";
 
 export const getSysSetting = `/fusion-xj/systemSetting/info`;
 export const updateSysSetting = `/fusion-xj/systemSetting/save`;

+ 5 - 1
src/store/case.ts

@@ -10,6 +10,7 @@ import {
   caseApiList,
   saveApiOrUpdate,
   caseApiDel,
+  caseApiUpdateSort,
   caseInquestInfo,
   caseInquestOpt,
   caseInquestExport
@@ -85,7 +86,7 @@ export const getCaseScenes = (scenes: Scene[]) => {
 export const replaceCaseScenes = (caseId: number, caseScenes: CaseScenes) =>
   axios.post(repCaseScenes, { sceneNumParam: caseScenes, caseId });
 
-export const caseImgList = (caseId: number, orderBy: string) =>
+export const caseImgList = (caseId: number, orderBy: string | null) =>
   axios.post(caseApiList, { orderBy: orderBy || 'desc', caseId });
 
 export const saveOrUpdate = (params: CaseImg) =>
@@ -94,6 +95,9 @@ export const saveOrUpdate = (params: CaseImg) =>
 export const caseDel = (id: number) =>
   axios.post(caseApiDel, { id });
 
+export const caseUpdateSort = (list: [CaseImg]) =>
+  axios.post(caseApiUpdateSort, { paramList: list });
+
 export const getCaseInquestInfo = (caseId: number) =>
   axios.get(caseInquestInfo, { params: { caseId } });
 

+ 8 - 4
src/view/case/photos/draggable.vue

@@ -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'
@@ -31,15 +31,19 @@ watch(()=>props.sortType,(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);