bugfix 0706 物料配方 同步功能
This commit is contained in:
parent
a33636ef05
commit
ef1fa671b0
@ -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;
|
||||||
headers: {
|
if (syncOpt && "showOverlay" in syncOpt && syncOpt.showOverlay) {
|
||||||
"Content-Type": "text/plain",
|
this.overlayVisible = true;
|
||||||
},
|
shouldShowOverlay = true;
|
||||||
})
|
payload = data.id;
|
||||||
// .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);
|
|
||||||
}
|
}
|
||||||
})
|
} else payload = data;
|
||||||
.catch((errMsg) => {
|
|
||||||
this.$message({
|
this.$message({
|
||||||
message: "同步失败: " + errMsg,
|
message: "正在发起同步...",
|
||||||
type: "error",
|
type: "success",
|
||||||
duration: 1500,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 同步单个料仓数据
|
||||||
|
this.$http
|
||||||
|
.post(this.urls.syncSingleUrl, payload, {
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
})
|
})
|
||||||
);
|
.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,
|
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",
|
||||||
|
Loading…
Reference in New Issue
Block a user