|
@@ -747,7 +747,9 @@
|
|
<el-button type="primary" @click="toAddMx_subSpecs">{{ t("common.addText") }}</el-button>
|
|
<el-button type="primary" @click="toAddMx_subSpecs">{{ t("common.addText") }}</el-button>
|
|
<el-button type="danger" @click="toDelMx_subSpecs">{{ t("common.delText") }}</el-button>
|
|
<el-button type="danger" @click="toDelMx_subSpecs">{{ t("common.delText") }}</el-button>
|
|
<el-divider direction="vertical" />
|
|
<el-divider direction="vertical" />
|
|
- <el-button type="success" @click="toSave_subSpecs">{{ t("common.saveText") }}</el-button>
|
|
|
|
|
|
+ <el-button type="success" @click="toSave_subSpecs" :loading="loadingStatus.save">{{
|
|
|
|
+ t("common.saveText")
|
|
|
|
+ }}</el-button>
|
|
<el-button type="default" @click="toCancel_subSpecs">{{ t("common.cancelText") }}</el-button>
|
|
<el-button type="default" @click="toCancel_subSpecs">{{ t("common.cancelText") }}</el-button>
|
|
</template>
|
|
</template>
|
|
</el-space>
|
|
</el-space>
|
|
@@ -799,7 +801,14 @@ import LjVxeTable from "@/components/LjVxeTable/index.vue";
|
|
import { cloneDeep } from "lodash-es";
|
|
import { cloneDeep } from "lodash-es";
|
|
import { useRoute, useRouter } from "vue-router";
|
|
import { useRoute, useRouter } from "vue-router";
|
|
import { CommonDynamicSelect, GetFormulaCompute } from "@/api/modules/common";
|
|
import { CommonDynamicSelect, GetFormulaCompute } from "@/api/modules/common";
|
|
-import { SaveMattress, SaveMattressAuditing, DelMattress, GetMattressImportDW2, GetMattressSubspecs } from "@/api/modules/quote";
|
|
|
|
|
|
+import {
|
|
|
|
+ SaveMattress,
|
|
|
|
+ SaveMattressAuditing,
|
|
|
|
+ DelMattress,
|
|
|
|
+ GetMattressImportDW2,
|
|
|
|
+ GetMattressSubspecs,
|
|
|
|
+ SaveMattressSubSpecs
|
|
|
|
+} from "@/api/modules/quote";
|
|
// import ToastFormula from "@/components/ToastWidget/Formula/index.vue";
|
|
// import ToastFormula from "@/components/ToastWidget/Formula/index.vue";
|
|
import { TYPE, useToast, POSITION } from "vue-toastification";
|
|
import { TYPE, useToast, POSITION } from "vue-toastification";
|
|
import { ElMessage, ElMessageBox, ElNotification } from "element-plus";
|
|
import { ElMessage, ElMessageBox, ElNotification } from "element-plus";
|
|
@@ -1926,6 +1935,158 @@ const save = async () => {
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+const save_subSpecs = async () => {
|
|
|
|
+ try {
|
|
|
|
+ let mattress = LjDetailRef.value._mainData;
|
|
|
|
+ mattress.mattressid = Number(mattress.mattressid ?? 0);
|
|
|
|
+
|
|
|
|
+ let mattressMx = [];
|
|
|
|
+ try {
|
|
|
|
+ fabricMxTabList.value.map(t => {
|
|
|
|
+ if (t.ref) {
|
|
|
|
+ console.log("t.ref?.value :>> ", t.ref, dynamicRef(t.ref));
|
|
|
|
+ if (dynamicRef(t.ref) && !["specialProcessesMxRef", "additionalCostsMxRef"].includes(t.ref)) {
|
|
|
|
+ let $table = dynamicRef(t.ref)?.element;
|
|
|
|
+ $table.clearEdit();
|
|
|
|
+ let { visibleData } = $table.getTableData();
|
|
|
|
+ console.log("visibleData t.ref?.value :>> ", t.ref, visibleData);
|
|
|
|
+ visibleData = visibleData.map((itm, idx) => {
|
|
|
|
+ // 检查明细输入是否正确
|
|
|
|
+ let _disabled = !(
|
|
|
|
+ (itm.if_inputqty == 0 && [50, 51, 52, 53, 54, 104, 114, 11, 12, 13, 14, 32, 33].includes(itm.formulakind)) ||
|
|
|
|
+ itm.formulakind == 202 ||
|
|
|
|
+ itm.formulakind == 7
|
|
|
|
+ );
|
|
|
|
+ console.log("_disabled :>> ", _disabled);
|
|
|
|
+ if (t.ref == "cushionsMxRef") {
|
|
|
|
+ _disabled = !(
|
|
|
|
+ (itm.if_inputqty == 0 && [50, 51, 52, 53, 54, 104, 114, 11, 14, 32, 33].includes(itm.formulakind)) ||
|
|
|
|
+ itm.formulakind == 7 ||
|
|
|
|
+ itm.formulakind == 999
|
|
|
|
+ );
|
|
|
|
+ } else if (t.ref == "innerClothLayerMxRef") {
|
|
|
|
+ _disabled = !(
|
|
|
|
+ (itm.if_inputqty == 0 && [50, 51, 52, 53, 54, 104, 114, 11, 14, 32, 33].includes(itm.formulakind)) ||
|
|
|
|
+ itm.formulakind == 202 ||
|
|
|
|
+ itm.formulakind == 203
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+ console.log(
|
|
|
|
+ "itm.mtrlid > 0 && !_disabled && Number(itm.thickness) <= 0 :>> ",
|
|
|
|
+ _disabled,
|
|
|
|
+ itm.mtrlid > 0 && !_disabled && Number(itm.thickness) <= 0
|
|
|
|
+ );
|
|
|
|
+ if (itm.mtrlid > 0 && !_disabled && Number(itm.thickness) <= 0) {
|
|
|
|
+ throw new Error(t.label + "相关厚度输入有误,请检查");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ itm.xu = idx + 1;
|
|
|
|
+ itm.mattress_width = Number(itm?.mattress_width ?? 0);
|
|
|
|
+ itm.mattress_length = Number(itm?.mattress_length ?? 0);
|
|
|
|
+ return itm;
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ mattressMx = mattressMx.concat(visibleData);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ } catch (error) {
|
|
|
|
+ ElMessage.error(error.message);
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 主副规格
|
|
|
|
+ let subspecs = [];
|
|
|
|
+ let $table_subspecs = subSpecsRef.value?.element;
|
|
|
|
+ if ($table_subspecs) {
|
|
|
|
+ $table_subspecs.clearEdit();
|
|
|
|
+ subspecs = $table_subspecs.getTableData().visibleData;
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ // 忽略长宽高没填的明细行
|
|
|
|
+ subspecs = subspecs.filter(
|
|
|
|
+ itm => Number(itm.mattress_width) > 0 || Number(itm.mattress_length) > 0 || Number(itm.mattress_height) > 0
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ let ifHas99 = mattressMx.filter(itm => itm.formulakind == 99 && itm.mtrlid > 0);
|
|
|
|
+ if (ifHas99.length > 0) {
|
|
|
|
+ subspecs.map(itm => {
|
|
|
|
+ if (Number(itm.mattress_width) <= 0 || Number(itm.mattress_length) <= 0 || Number(itm.mattress_height) <= 0) {
|
|
|
|
+ throw new Error("主副规格相关尺寸输入有误(不能为空),请输入正数");
|
|
|
|
+ }
|
|
|
|
+ for (const key in itm) {
|
|
|
|
+ if (key.indexOf("spring_qty_") > -1) {
|
|
|
|
+ if (Number(itm[key]) <= 0) {
|
|
|
|
+ throw new Error("主副规格相关弹簧排列数不能为空,请检查");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ const prefixes = [
|
|
|
|
+ "spring_qty_width",
|
|
|
|
+ "spring_qty_length",
|
|
|
|
+ "bednet_iffork",
|
|
|
|
+ "bednet_fork_qty",
|
|
|
|
+ "cushions_subspecs",
|
|
|
|
+ "accessories_subspecs"
|
|
|
|
+ ];
|
|
|
|
+ subspecs = subspecs.map(itm => {
|
|
|
|
+ itm.mattress_width = Number(itm.mattress_width ?? 0);
|
|
|
|
+ itm.mattress_length = Number(itm.mattress_length ?? 0);
|
|
|
|
+ itm.mattress_height = Number(mattress.mattress_height ?? 0);
|
|
|
|
+ itm.DynamicFields = Object.keys(itm)
|
|
|
|
+ .filter(key => prefixes.some(prefix => key.startsWith(prefix)))
|
|
|
|
+ .reduce((obj, key) => {
|
|
|
|
+ obj[key] = itm[key];
|
|
|
|
+ return obj;
|
|
|
|
+ }, {});
|
|
|
|
+ return itm;
|
|
|
|
+ });
|
|
|
|
+ } catch (error) {
|
|
|
|
+ ElMessage.error(error.message);
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ loadingStatus.save = true;
|
|
|
|
+ let _param_mf = {
|
|
|
|
+ mattress,
|
|
|
|
+ subspecsList: subspecs
|
|
|
|
+ };
|
|
|
|
+ try {
|
|
|
|
+ await SaveMattressSubSpecs(_param_mf)
|
|
|
|
+ .then(res => {
|
|
|
|
+ ElNotification({
|
|
|
|
+ title: "温馨提示",
|
|
|
|
+ message: t("sys.api.sueccessToSave"),
|
|
|
|
+ type: "success"
|
|
|
|
+ });
|
|
|
|
+ if (res.mattressid) {
|
|
|
|
+ // router.replace(`/mattressQuote/detail?id=${res.mattressid}&code=${res.mattresscode}`);
|
|
|
|
+ nextTick(() => {
|
|
|
|
+ getData_subSpecs().then(res => {
|
|
|
|
+ const { list } = dataCallbackSubspecs(res);
|
|
|
|
+ subSpecsData.value = list;
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ router.replace("/mattressQuote");
|
|
|
|
+ }
|
|
|
|
+ loadingStatus.save = false;
|
|
|
|
+ })
|
|
|
|
+ .catch(error => {
|
|
|
|
+ loadingStatus.save = false;
|
|
|
|
+ });
|
|
|
|
+ } catch (error) {
|
|
|
|
+ ElMessage.error(t("sys.api.operationFailed"));
|
|
|
|
+ }
|
|
|
|
+ } catch (e) {
|
|
|
|
+ loadingStatus.save = false;
|
|
|
|
+ }
|
|
|
|
+};
|
|
|
|
+
|
|
const orderDefaultAction = [
|
|
const orderDefaultAction = [
|
|
buttonDefault({
|
|
buttonDefault({
|
|
label: t("common.cancelText"),
|
|
label: t("common.cancelText"),
|
|
@@ -2075,9 +2236,6 @@ const orderDefaultAction = [
|
|
buttonDefault({
|
|
buttonDefault({
|
|
label: t("common.businessOrderCancel"),
|
|
label: t("common.businessOrderCancel"),
|
|
power: 95,
|
|
power: 95,
|
|
- limited: () => {
|
|
|
|
- return !!orderStatus.value;
|
|
|
|
- },
|
|
|
|
disabledTextCallBack: (data: any) => {
|
|
disabledTextCallBack: (data: any) => {
|
|
if (!CheckPower(95)) {
|
|
if (!CheckPower(95)) {
|
|
return `你没有【报价单-${t("common.businessOrderCancel")}】的使用权限`;
|
|
return `你没有【报价单-${t("common.businessOrderCancel")}】的使用权限`;
|
|
@@ -3113,7 +3271,7 @@ const toCancel_subSpecs = () => {
|
|
};
|
|
};
|
|
|
|
|
|
const toSave_subSpecs = async () => {
|
|
const toSave_subSpecs = async () => {
|
|
- await save();
|
|
|
|
|
|
+ await save_subSpecs();
|
|
|
|
|
|
editSubSpecs.value = false;
|
|
editSubSpecs.value = false;
|
|
};
|
|
};
|