|
@@ -16,9 +16,9 @@ interface ServerTagging {
|
|
|
"hotIconUrl": string,
|
|
|
"getMethod": string,
|
|
|
"getUser": string,
|
|
|
- "id": number,
|
|
|
- "meta": { "name": string, "url": string } [],
|
|
|
- "remark": string,
|
|
|
+ "tagId": number,
|
|
|
+ "tagImgUrl": string,
|
|
|
+ "leaveBehind": string,
|
|
|
"tagDescribe": string,
|
|
|
"tagTitle": string,
|
|
|
}
|
|
@@ -39,47 +39,47 @@ export type Taggings = Tagging[]
|
|
|
|
|
|
|
|
|
const serviceToLocal = (serviceTagging: ServerTagging): Tagging => ({
|
|
|
- id: serviceTagging.id.toString(),
|
|
|
+ id: serviceTagging.tagId.toString(),
|
|
|
styleId: serviceTagging.hotIconId.toString(),
|
|
|
title: serviceTagging.tagTitle,
|
|
|
desc: serviceTagging.tagDescribe,
|
|
|
- part: serviceTagging.remark,
|
|
|
+ part: serviceTagging.leaveBehind,
|
|
|
method: serviceTagging.getMethod,
|
|
|
principal: serviceTagging.getUser,
|
|
|
- images: serviceTagging.meta.map(({url}) => url),
|
|
|
+ images: JSON.parse(serviceTagging.tagImgUrl)
|
|
|
})
|
|
|
|
|
|
-const localToService = (tagging: Tagging, update = false): PartialProps<ServerTagging, 'id' | 'hotIconUrl'> & { fusionId: number } => ({
|
|
|
+const localToService = (tagging: Tagging, update = false): PartialProps<ServerTagging, 'tagId' | 'hotIconUrl'> & { fusionId: number } => ({
|
|
|
"hotIconId": Number(tagging.styleId),
|
|
|
"fusionId": params.caseId,
|
|
|
"getMethod": tagging.method,
|
|
|
"getUser": tagging.principal,
|
|
|
"hotIconUrl": "static/img_default/lQLPDhrvVzvNvTswMLAOU-UNqYnnZQG1YPJUwLwA_48_48.png",
|
|
|
- "id": update ? Number(tagging.id) : undefined,
|
|
|
- "meta": tagging.images.map(((item, i) => ({ "name": item, "url": item }))),
|
|
|
- "remark": tagging.part,
|
|
|
+ "tagId": update ? Number(tagging.id) : undefined,
|
|
|
+ "tagImgUrl": JSON.stringify(tagging.images),
|
|
|
+ "leaveBehind": tagging.part,
|
|
|
"tagDescribe": tagging.desc,
|
|
|
"tagTitle": tagging.title,
|
|
|
})
|
|
|
|
|
|
|
|
|
export const fetchTaggings = async () => {
|
|
|
- const staggings = await axios.post<ServerTagging[]>(TAGGING_LIST, {})
|
|
|
+ const staggings = await axios.get<ServerTagging[]>(TAGGING_LIST, { params: { caseId: params.caseId } })
|
|
|
return staggings.map(serviceToLocal)
|
|
|
}
|
|
|
|
|
|
export const postAddTagging = async (tagging: Tagging) => {
|
|
|
- const stagging = await axios.post<ServerTagging>(INSERT_TAGGING, localToService(tagging))
|
|
|
- return serviceToLocal(stagging)
|
|
|
+ const stagging = await axios.post<ServerTagging>(INSERT_TAGGING, { ...localToService(tagging), caseId: params.caseId })
|
|
|
+ return serviceToLocal(stagging, )
|
|
|
}
|
|
|
|
|
|
export const postUpdateTagging = (tagging: Tagging) => {
|
|
|
- return axios.post<undefined>(UPDATE_TAGGING, localToService(tagging, true))
|
|
|
+ return axios.post<undefined>(UPDATE_TAGGING, { ...localToService(tagging, true), caseId: params.caseId })
|
|
|
}
|
|
|
|
|
|
|
|
|
export const postDeleteTagging = (id: Tagging['id']) => {
|
|
|
- return axios.post<undefined>(DELETE_TAGGING, { ids: [id] })
|
|
|
+ return axios.post<undefined>(DELETE_TAGGING, { tagId: id })
|
|
|
}
|
|
|
|
|
|
|