bugfix 0706 物料配方 同步功能

This commit is contained in:
lb 2023-07-06 17:02:22 +08:00
parent a33636ef05
commit ef1fa671b0
2 changed files with 39 additions and 38 deletions

View File

@ -62,6 +62,8 @@
:dialog-visible.sync="dialogVisible" :dialog-visible.sync="dialogVisible"
:configs="dialogConfigs" :configs="dialogConfigs"
@refreshDataList="getList" /> @refreshDataList="getList" />
<Overlay v-if="overlayVisible" />
</div> </div>
</template> </template>
@ -69,6 +71,7 @@
import BaseListTable from "@/components/BaseListTable.vue"; import BaseListTable from "@/components/BaseListTable.vue";
import DialogWithMenu from "@/components/DialogWithMenu.vue"; import DialogWithMenu from "@/components/DialogWithMenu.vue";
import DialogJustForm from "@/components/DialogJustForm.vue"; import DialogJustForm from "@/components/DialogJustForm.vue";
import Overlay from "@/components/Overlay.vue";
import moment from "moment"; import moment from "moment";
const DIALOG_WITH_MENU = "DialogWithMenu"; const DIALOG_WITH_MENU = "DialogWithMenu";
@ -76,7 +79,7 @@ const DIALOG_JUST_FORM = "DialogJustForm";
export default { export default {
name: "ListView", name: "ListView",
components: { BaseListTable, DialogWithMenu, DialogJustForm }, components: { BaseListTable, DialogWithMenu, DialogJustForm, Overlay },
props: { props: {
tableConfig: { tableConfig: {
type: Object, type: Object,
@ -135,6 +138,7 @@ export default {
dataList: [], dataList: [],
tableLoading: false, tableLoading: false,
refreshLayoutKey: null, refreshLayoutKey: null,
overlayVisible: false,
}; };
}, },
inject: ["urls"], inject: ["urls"],
@ -417,45 +421,42 @@ export default {
}); });
} }
// const dataview = new DataView(new ArrayBuffer(8));
// dataview.setBigInt64(0, data);
// data = new Blob([dataview.buffer], { type: "application/octet-stream" });
case "sync": { case "sync": {
// console.log("sync ", data, typeof data, BigInt(data).toString()); let shouldShowOverlay = false;
// let payload = "";
// data = BigInt(data).toString(2) console.log("sync...", type, data);
return ( if (typeof data === "object") {
this.$http({ const head = data.head;
url: this.urls.syncUrl, const syncOpt =
method: "post", ("options" in head && Array.isArray(head.options) && head.options.find((item) => item.name === "sync")) ||
data, null;
if (syncOpt && "showOverlay" in syncOpt && syncOpt.showOverlay) {
this.overlayVisible = true;
shouldShowOverlay = true;
payload = data.id;
}
} else payload = data;
this.$message({
message: "正在发起同步...",
type: "success",
});
//
this.$http
.post(this.urls.syncSingleUrl, payload, {
headers: { headers: {
"Content-Type": "text/plain", "Content-Type": "application/json",
}, },
}) })
// .post(this.urls.syncUrl, data: `id=${data}`, { headers: { "Content-Type": "text/plain", "data-id": data } }) .then(({ data: res }) => {
.then(({ data: res }) => { this.$message({
if (res.code === 0) { message: res.msg,
this.$message({ type: res.code === 0 ? "success" : "error",
message: "同步成功", });
type: "success", this.getList();
duration: 1500, if (shouldShowOverlay) this.overlayVisible = false;
onClose: () => { });
this.getList();
},
});
} else {
throw new Error(res.msg);
}
})
.catch((errMsg) => {
this.$message({
message: "同步失败: " + errMsg,
type: "error",
duration: 1500,
});
})
);
} }
} }
}, },

View File

@ -48,7 +48,7 @@ export default function () {
width: 160, width: 160,
subcomponent: TableOperaionComponent, subcomponent: TableOperaionComponent,
options: [ options: [
{ name: "sync", label: "同步", icon: "refresh" }, { name: "sync", label: "同步", icon: "refresh", emitFull: true, showOverlay: true },
{ name: "copy", label: "复制", icon: "copy-document" }, { name: "copy", label: "复制", icon: "copy-document" },
{ name: "edit", label: "编辑", icon: "edit-outline" }, { name: "edit", label: "编辑", icon: "edit-outline" },
{ name: "delete", icon: "delete", label: "删除", emitFull: true, permission: "pms:bom:delete" }, { name: "delete", icon: "delete", label: "删除", emitFull: true, permission: "pms:bom:delete" },
@ -215,7 +215,7 @@ export default function () {
urls: { urls: {
base: "/pms/bom", base: "/pms/bom",
page: "/pms/bom/pageVersion", page: "/pms/bom/pageVersion",
syncUrl: "/pms/trans/bomSync", syncSingleUrl: "/pms/trans/bomSync",
copyUrl: "/pms/bom/copy", copyUrl: "/pms/bom/copy",
subase: "/pms/bomMaterial", subase: "/pms/bomMaterial",
subpage: "/pms/bomMaterial/page", subpage: "/pms/bomMaterial/page",