|
|
@@ -1,5 +1,9 @@
|
|
|
"use strict";
|
|
|
const common_vendor = require("../../../common/vendor.js");
|
|
|
+const api_erp_colorKind = require("../../../api/erp/colorKind.js");
|
|
|
+const api_erp_pack = require("../../../api/erp/pack.js");
|
|
|
+const api_erp_model = require("../../../api/erp/model.js");
|
|
|
+const api_erp_orderDetail = require("../../../api/erp/orderDetail.js");
|
|
|
const ErpNavBar = () => "../../../components/erp-nav-bar.js";
|
|
|
const _sfc_main = {
|
|
|
components: { ErpNavBar },
|
|
|
@@ -11,25 +15,59 @@ const _sfc_main = {
|
|
|
tempSelectedIndex: -1,
|
|
|
tempSurfaceIndex: -1,
|
|
|
tempPackageIndex: -1,
|
|
|
- typeList: ["TY0018", "TY0019", "TY0020", "TY0021", "TY0022", "TY0023", "TY0024", "TY0025", "TY0026", "TY0027", "TY0028"],
|
|
|
- surfaceList: ["PL坯料", "阳极氧化", "电泳涂漆", "粉末喷涂", "氟碳喷涂", "木纹转印"],
|
|
|
- packageList: ["不贴膜+3点捆扎", "贴膜+纸箱", "气泡膜包装", "简易编织袋", "木托架包装"],
|
|
|
+ typeList: [],
|
|
|
+ surfaceList: [],
|
|
|
+ packageList: [],
|
|
|
formData: {
|
|
|
type: "",
|
|
|
+ modelId: "",
|
|
|
name: "",
|
|
|
material: "",
|
|
|
surfaceName: "",
|
|
|
+ surfaceId: "",
|
|
|
packageMethod: "",
|
|
|
+ packageId: "",
|
|
|
length: "",
|
|
|
wallThickness: "",
|
|
|
count: ""
|
|
|
}
|
|
|
};
|
|
|
},
|
|
|
+ async onLoad() {
|
|
|
+ await Promise.all([
|
|
|
+ this.loadModels(),
|
|
|
+ this.loadSurfaceKinds(),
|
|
|
+ this.loadPackageMethods()
|
|
|
+ ]);
|
|
|
+ },
|
|
|
methods: {
|
|
|
+ async loadModels() {
|
|
|
+ try {
|
|
|
+ const res = await api_erp_model.listAllModel();
|
|
|
+ this.typeList = res.data || [];
|
|
|
+ } catch (e) {
|
|
|
+ common_vendor.index.showToast({ title: "加载型号失败", icon: "none" });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async loadPackageMethods() {
|
|
|
+ try {
|
|
|
+ const res = await api_erp_pack.listAllPack();
|
|
|
+ this.packageList = res.data || [];
|
|
|
+ } catch (e) {
|
|
|
+ common_vendor.index.showToast({ title: "加载包装方式失败", icon: "none" });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async loadSurfaceKinds() {
|
|
|
+ try {
|
|
|
+ const res = await api_erp_colorKind.listAllColorKind();
|
|
|
+ this.surfaceList = (res.data || []).filter((item) => item.fname !== "所有类别");
|
|
|
+ } catch (e) {
|
|
|
+ common_vendor.index.showToast({ title: "加载表面处理失败", icon: "none" });
|
|
|
+ }
|
|
|
+ },
|
|
|
openTypePicker() {
|
|
|
if (this.formData.type)
|
|
|
- this.tempSelectedIndex = this.typeList.indexOf(this.formData.type);
|
|
|
+ this.tempSelectedIndex = this.typeList.findIndex((item) => item.fnum === this.formData.type);
|
|
|
this.showTypePicker = true;
|
|
|
},
|
|
|
closeTypePicker() {
|
|
|
@@ -41,15 +79,17 @@ const _sfc_main = {
|
|
|
confirmTypeSelect() {
|
|
|
if (this.tempSelectedIndex === -1)
|
|
|
return;
|
|
|
- const val = this.typeList[this.tempSelectedIndex];
|
|
|
- this.formData.type = val;
|
|
|
- this.formData.name = "工业铝材";
|
|
|
- this.formData.material = this.tempSelectedIndex % 2 === 0 ? "6063-T5" : "6061-T6";
|
|
|
+ const item = this.typeList[this.tempSelectedIndex];
|
|
|
+ this.formData.type = item.fnum;
|
|
|
+ this.formData.modelId = item.frowId;
|
|
|
+ this.formData.name = item.fname;
|
|
|
+ this.formData.wallThickness = item.thick ? Number(item.thick).toFixed(4) : "";
|
|
|
+ this.formData.material = "6063-T5";
|
|
|
this.closeTypePicker();
|
|
|
},
|
|
|
openSurfacePicker() {
|
|
|
if (this.formData.surfaceName)
|
|
|
- this.tempSurfaceIndex = this.surfaceList.indexOf(this.formData.surfaceName);
|
|
|
+ this.tempSurfaceIndex = this.surfaceList.findIndex((item) => item.fname === this.formData.surfaceName);
|
|
|
this.showSurfacePicker = true;
|
|
|
},
|
|
|
closeSurfacePicker() {
|
|
|
@@ -61,12 +101,14 @@ const _sfc_main = {
|
|
|
confirmSurfaceSelect() {
|
|
|
if (this.tempSurfaceIndex === -1)
|
|
|
return;
|
|
|
- this.formData.surfaceName = this.surfaceList[this.tempSurfaceIndex];
|
|
|
+ const item = this.surfaceList[this.tempSurfaceIndex];
|
|
|
+ this.formData.surfaceName = item.fname;
|
|
|
+ this.formData.surfaceId = item.frowId;
|
|
|
this.closeSurfacePicker();
|
|
|
},
|
|
|
openPackagePicker() {
|
|
|
if (this.formData.packageMethod)
|
|
|
- this.tempPackageIndex = this.packageList.indexOf(this.formData.packageMethod);
|
|
|
+ this.tempPackageIndex = this.packageList.findIndex((item) => item.fname === this.formData.packageMethod);
|
|
|
this.showPackagePicker = true;
|
|
|
},
|
|
|
closePackagePicker() {
|
|
|
@@ -78,10 +120,12 @@ const _sfc_main = {
|
|
|
confirmPackageSelect() {
|
|
|
if (this.tempPackageIndex === -1)
|
|
|
return;
|
|
|
- this.formData.packageMethod = this.packageList[this.tempPackageIndex];
|
|
|
+ const item = this.packageList[this.tempPackageIndex];
|
|
|
+ this.formData.packageMethod = item.fname;
|
|
|
+ this.formData.packageId = item.frowId;
|
|
|
this.closePackagePicker();
|
|
|
},
|
|
|
- confirmAddModel() {
|
|
|
+ async confirmAddModel() {
|
|
|
const fields = [
|
|
|
{ key: "type", label: "型号" },
|
|
|
{ key: "surfaceName", label: "表面名称" },
|
|
|
@@ -96,8 +140,32 @@ const _sfc_main = {
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
- common_vendor.index.$emit("add_order_item", JSON.parse(JSON.stringify(this.formData)));
|
|
|
- common_vendor.index.navigateBack();
|
|
|
+ const finalData = {
|
|
|
+ fOrderId: null,
|
|
|
+ modelId: this.formData.modelId,
|
|
|
+ modelNum: this.formData.type,
|
|
|
+ modelName: this.formData.name,
|
|
|
+ material: this.formData.material,
|
|
|
+ surfaceId: this.formData.surfaceId,
|
|
|
+ surfaceName: this.formData.surfaceName,
|
|
|
+ packId: this.formData.packageId,
|
|
|
+ packName: this.formData.packageMethod,
|
|
|
+ length: parseFloat(this.formData.length || 0).toFixed(4),
|
|
|
+ wallThickness: parseFloat(this.formData.wallThickness || 0).toFixed(4),
|
|
|
+ count: parseInt(this.formData.count || 0)
|
|
|
+ };
|
|
|
+ common_vendor.index.showLoading({ title: "正在保存..." });
|
|
|
+ try {
|
|
|
+ await api_erp_orderDetail.addOrderDetail(finalData);
|
|
|
+ common_vendor.index.hideLoading();
|
|
|
+ common_vendor.index.showToast({ title: "添加成功", icon: "success" });
|
|
|
+ common_vendor.index.$emit("add_order_item", finalData);
|
|
|
+ setTimeout(() => {
|
|
|
+ common_vendor.index.navigateBack();
|
|
|
+ }, 1e3);
|
|
|
+ } catch (e) {
|
|
|
+ common_vendor.index.hideLoading();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
@@ -130,66 +198,69 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
s: $data.formData.count,
|
|
|
t: common_vendor.o(($event) => $data.formData.count = $event.detail.value, "47"),
|
|
|
v: !$data.showTypePicker && !$data.showSurfacePicker && !$data.showPackagePicker,
|
|
|
- w: common_vendor.o((...args) => $options.confirmAddModel && $options.confirmAddModel(...args), "d9"),
|
|
|
+ w: common_vendor.o((...args) => $options.confirmAddModel && $options.confirmAddModel(...args), "39"),
|
|
|
x: $data.showTypePicker
|
|
|
}, $data.showTypePicker ? {
|
|
|
- y: common_vendor.o((...args) => $options.closeTypePicker && $options.closeTypePicker(...args), "0a"),
|
|
|
- z: common_vendor.o((...args) => $options.confirmTypeSelect && $options.confirmTypeSelect(...args), "31"),
|
|
|
+ y: common_vendor.o((...args) => $options.closeTypePicker && $options.closeTypePicker(...args), "b3"),
|
|
|
+ z: common_vendor.o((...args) => $options.confirmTypeSelect && $options.confirmTypeSelect(...args), "03"),
|
|
|
A: common_vendor.f($data.typeList, (item, index, i0) => {
|
|
|
return common_vendor.e({
|
|
|
- a: common_vendor.t(item),
|
|
|
- b: $data.tempSelectedIndex === index
|
|
|
+ a: common_vendor.t(item.fnum),
|
|
|
+ b: common_vendor.t(item.fname),
|
|
|
+ c: $data.tempSelectedIndex === index
|
|
|
}, $data.tempSelectedIndex === index ? {} : {}, {
|
|
|
- c: index,
|
|
|
- d: $data.tempSelectedIndex === index ? 1 : "",
|
|
|
- e: common_vendor.o(($event) => $options.selectTypeItem(index), index)
|
|
|
+ d: index,
|
|
|
+ e: $data.tempSelectedIndex === index ? 1 : "",
|
|
|
+ f: common_vendor.o(($event) => $options.selectTypeItem(index), index)
|
|
|
});
|
|
|
}),
|
|
|
B: common_vendor.o(() => {
|
|
|
- }, "2f"),
|
|
|
- C: common_vendor.o((...args) => $options.closeTypePicker && $options.closeTypePicker(...args), "f0"),
|
|
|
+ }, "4c"),
|
|
|
+ C: common_vendor.o((...args) => $options.closeTypePicker && $options.closeTypePicker(...args), "a9"),
|
|
|
D: common_vendor.o(() => {
|
|
|
- }, "d9")
|
|
|
+ }, "62")
|
|
|
} : {}, {
|
|
|
E: $data.showSurfacePicker
|
|
|
}, $data.showSurfacePicker ? {
|
|
|
- F: common_vendor.o((...args) => $options.closeSurfacePicker && $options.closeSurfacePicker(...args), "14"),
|
|
|
- G: common_vendor.o((...args) => $options.confirmSurfaceSelect && $options.confirmSurfaceSelect(...args), "eb"),
|
|
|
+ F: common_vendor.o((...args) => $options.closeSurfacePicker && $options.closeSurfacePicker(...args), "cf"),
|
|
|
+ G: common_vendor.o((...args) => $options.confirmSurfaceSelect && $options.confirmSurfaceSelect(...args), "30"),
|
|
|
H: common_vendor.f($data.surfaceList, (item, index, i0) => {
|
|
|
return common_vendor.e({
|
|
|
- a: common_vendor.t(item),
|
|
|
- b: $data.tempSurfaceIndex === index
|
|
|
+ a: common_vendor.t(item.fnum),
|
|
|
+ b: common_vendor.t(item.fname),
|
|
|
+ c: $data.tempSurfaceIndex === index
|
|
|
}, $data.tempSurfaceIndex === index ? {} : {}, {
|
|
|
- c: index,
|
|
|
- d: $data.tempSurfaceIndex === index ? 1 : "",
|
|
|
- e: common_vendor.o(($event) => $options.selectSurfaceItem(index), index)
|
|
|
+ d: index,
|
|
|
+ e: $data.tempSurfaceIndex === index ? 1 : "",
|
|
|
+ f: common_vendor.o(($event) => $options.selectSurfaceItem(index), index)
|
|
|
});
|
|
|
}),
|
|
|
I: common_vendor.o(() => {
|
|
|
- }, "bd"),
|
|
|
- J: common_vendor.o((...args) => $options.closeSurfacePicker && $options.closeSurfacePicker(...args), "0b"),
|
|
|
+ }, "c7"),
|
|
|
+ J: common_vendor.o((...args) => $options.closeSurfacePicker && $options.closeSurfacePicker(...args), "12"),
|
|
|
K: common_vendor.o(() => {
|
|
|
- }, "ff")
|
|
|
+ }, "b7")
|
|
|
} : {}, {
|
|
|
L: $data.showPackagePicker
|
|
|
}, $data.showPackagePicker ? {
|
|
|
- M: common_vendor.o((...args) => $options.closePackagePicker && $options.closePackagePicker(...args), "a7"),
|
|
|
- N: common_vendor.o((...args) => $options.confirmPackageSelect && $options.confirmPackageSelect(...args), "f7"),
|
|
|
+ M: common_vendor.o((...args) => $options.closePackagePicker && $options.closePackagePicker(...args), "21"),
|
|
|
+ N: common_vendor.o((...args) => $options.confirmPackageSelect && $options.confirmPackageSelect(...args), "42"),
|
|
|
O: common_vendor.f($data.packageList, (item, index, i0) => {
|
|
|
return common_vendor.e({
|
|
|
- a: common_vendor.t(item),
|
|
|
- b: $data.tempPackageIndex === index
|
|
|
+ a: common_vendor.t(item.fnum),
|
|
|
+ b: common_vendor.t(item.fname),
|
|
|
+ c: $data.tempPackageIndex === index
|
|
|
}, $data.tempPackageIndex === index ? {} : {}, {
|
|
|
- c: index,
|
|
|
- d: $data.tempPackageIndex === index ? 1 : "",
|
|
|
- e: common_vendor.o(($event) => $options.selectPackageItem(index), index)
|
|
|
+ d: index,
|
|
|
+ e: $data.tempPackageIndex === index ? 1 : "",
|
|
|
+ f: common_vendor.o(($event) => $options.selectPackageItem(index), index)
|
|
|
});
|
|
|
}),
|
|
|
P: common_vendor.o(() => {
|
|
|
- }, "54"),
|
|
|
- Q: common_vendor.o((...args) => $options.closePackagePicker && $options.closePackagePicker(...args), "7e"),
|
|
|
+ }, "ec"),
|
|
|
+ Q: common_vendor.o((...args) => $options.closePackagePicker && $options.closePackagePicker(...args), "11"),
|
|
|
R: common_vendor.o(() => {
|
|
|
- }, "97")
|
|
|
+ }, "a1")
|
|
|
} : {});
|
|
|
}
|
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-97855afd"]]);
|