diff --git a/src/api/login.js b/src/api/login.js index d5ac285..840fdf3 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -55,3 +55,11 @@ export const bind = (data) => { data, }); }; +//画桶添加或者更换画作 +export const add = (data) => { + return request({ + url: "/containeradm/v1/painting_bucket/add_replace", + method: "POST", + data, + }); +}; diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index 7d8833d..cd72e71 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -27,7 +27,7 @@ 平尺(寸):{{ painting.Ruler }} - + @@ -50,11 +50,12 @@ >取消 {{ buttonText }} @@ -65,9 +66,8 @@ import { ref, reactive, onBeforeMount } from "vue"; import useToast from "@/hooks/toast/useToast.js"; import { onLoad,onReachBottom } from "@dcloudio/uni-app"; -import { creChangepainting } from "@/api/login.js"; +import { creChangepainting,add } from "@/api/login.js"; const { showMessage } = useToast(); -const value = ref(null) const loading = ref(false); const isButtonDisabled = ref(false); const buttonText = ref("确认"); @@ -77,6 +77,7 @@ const state = reactive({ tableData:[], page:1, pageSize:10, + selectedUuid:"", }); onLoad((options) => { state.id = options.id; @@ -84,7 +85,11 @@ state.pid = options.pid; paintingList() }); const groupChange =(e) =>{ - console.log(e) + state.tableData.forEach((item) =>{ + if(item.ArtworkUuid!==e){ + item.checked ='' + } + }) } // 获取可添加的画作列表 const paintingList = async (param) => { @@ -100,12 +105,49 @@ const paintingList = async (param) => { }); if (res.status === 0) { loading.value = false - state.tableData = res.data.Data + state.tableData = res.data.Data.map((item) =>{ + return { + ...item, + checked:'' + } + })||[] + console.log(1111,state.tableData) } else { showMessage({ type: "error", message: res.msg }); } loading.value = false } +//添加画作 +const doneSet = async () => { + loading.value = true; + const selectedPainting = state.tableData.find((item) => item.checked); + if (selectedPainting) { + const res = await add({ + type: "add", + id: state.id, + pid: state.pid, + drawUid: selectedPainting.ArtworkUuid, + drawName: selectedPainting.ArtworkName, + drawerName: selectedPainting.ArtistName, + drawerUid: selectedPainting.ArtistUuid, + rulerNum:selectedPainting.Ruler, + drawThumbnai:selectedPainting.HdPic, + drawNum:selectedPainting.Tnum, + drawerNum:selectedPainting.Tfnum, + }); + if (res.status === 0) { + showMessage({ type: "sucess", message: "添加画作成功" }); + isButtonDisabled.value = true; + buttonText.value = "已添加"; + paintingList(); + } else { + showMessage({ type: "error", message: res.msg }); + } + } else { + showMessage({ type: "error", message: "请先选择要添加的画作" }); + } + loading.value = false; +}; const lower=() =>{ console.log(888888) }