bugfix 0706 物料配方 同步功能
This commit is contained in:
parent
a33636ef05
commit
ef1fa671b0
@ -62,6 +62,8 @@
|
||||
:dialog-visible.sync="dialogVisible"
|
||||
:configs="dialogConfigs"
|
||||
@refreshDataList="getList" />
|
||||
|
||||
<Overlay v-if="overlayVisible" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -69,6 +71,7 @@
|
||||
import BaseListTable from "@/components/BaseListTable.vue";
|
||||
import DialogWithMenu from "@/components/DialogWithMenu.vue";
|
||||
import DialogJustForm from "@/components/DialogJustForm.vue";
|
||||
import Overlay from "@/components/Overlay.vue";
|
||||
import moment from "moment";
|
||||
|
||||
const DIALOG_WITH_MENU = "DialogWithMenu";
|
||||
@ -76,7 +79,7 @@ const DIALOG_JUST_FORM = "DialogJustForm";
|
||||
|
||||
export default {
|
||||
name: "ListView",
|
||||
components: { BaseListTable, DialogWithMenu, DialogJustForm },
|
||||
components: { BaseListTable, DialogWithMenu, DialogJustForm, Overlay },
|
||||
props: {
|
||||
tableConfig: {
|
||||
type: Object,
|
||||
@ -135,6 +138,7 @@ export default {
|
||||
dataList: [],
|
||||
tableLoading: false,
|
||||
refreshLayoutKey: null,
|
||||
overlayVisible: false,
|
||||
};
|
||||
},
|
||||
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": {
|
||||
// console.log("sync ", data, typeof data, BigInt(data).toString());
|
||||
// 同步配方详情
|
||||
// data = BigInt(data).toString(2)
|
||||
return (
|
||||
this.$http({
|
||||
url: this.urls.syncUrl,
|
||||
method: "post",
|
||||
data,
|
||||
let shouldShowOverlay = false;
|
||||
let payload = "";
|
||||
console.log("sync...", type, data);
|
||||
if (typeof data === "object") {
|
||||
const head = data.head;
|
||||
const syncOpt =
|
||||
("options" in head && Array.isArray(head.options) && head.options.find((item) => item.name === "sync")) ||
|
||||
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: {
|
||||
"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 }) => {
|
||||
if (res.code === 0) {
|
||||
this.$message({
|
||||
message: "同步成功",
|
||||
type: "success",
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getList();
|
||||
},
|
||||
});
|
||||
} else {
|
||||
throw new Error(res.msg);
|
||||
}
|
||||
})
|
||||
.catch((errMsg) => {
|
||||
this.$message({
|
||||
message: "同步失败: " + errMsg,
|
||||
type: "error",
|
||||
duration: 1500,
|
||||
});
|
||||
})
|
||||
);
|
||||
.then(({ data: res }) => {
|
||||
this.$message({
|
||||
message: res.msg,
|
||||
type: res.code === 0 ? "success" : "error",
|
||||
});
|
||||
this.getList();
|
||||
if (shouldShowOverlay) this.overlayVisible = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -48,7 +48,7 @@ export default function () {
|
||||
width: 160,
|
||||
subcomponent: TableOperaionComponent,
|
||||
options: [
|
||||
{ name: "sync", label: "同步", icon: "refresh" },
|
||||
{ name: "sync", label: "同步", icon: "refresh", emitFull: true, showOverlay: true },
|
||||
{ name: "copy", label: "复制", icon: "copy-document" },
|
||||
{ name: "edit", label: "编辑", icon: "edit-outline" },
|
||||
{ name: "delete", icon: "delete", label: "删除", emitFull: true, permission: "pms:bom:delete" },
|
||||
@ -215,7 +215,7 @@ export default function () {
|
||||
urls: {
|
||||
base: "/pms/bom",
|
||||
page: "/pms/bom/pageVersion",
|
||||
syncUrl: "/pms/trans/bomSync",
|
||||
syncSingleUrl: "/pms/trans/bomSync",
|
||||
copyUrl: "/pms/bom/copy",
|
||||
subase: "/pms/bomMaterial",
|
||||
subpage: "/pms/bomMaterial/page",
|
||||
|
Loading…
Reference in New Issue
Block a user