1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438 |
- <template>
- <LjDetail
- name="mattressInterfaceDetail"
- class="mattressInterface-detail-container"
- ref="LjDetailRef"
- v-bind="detailProps"
- :data="mainData"
- v-model:order-status="orderStatus"
- :action="orderDefaultAction"
- @after-mounted="funcAfterMound"
- :if-layout-editable="false"
- :search-col="{ xs: 3, sm: 3, md: 3, lg: 3, xl: 3 }"
- :basic-group-col="{ xs: 3, sm: 3, md: 3, lg: 3, xl: 3 }"
- >
- <template #mattressYW>
- <LjVxeTable
- ref="VxeTableMxRef"
- row-key="key"
- table-cls=""
- :data="mattressYWList"
- :columns="columns_yw"
- :dwname="DwnameEnum.mattressInterfaceYw"
- :request-auto="false"
- :table-props="tableProps_mx"
- :tool-button="[]"
- :auto-load-layout="false"
- collapseButtons
- :cellClassName="cellClassNameFn"
- >
- </LjVxeTable>
- </template>
- <template #tabNavRight="scope" v-if="orderStatus">
- <div class="flx-center flx-end flx-1 ml-24" v-if="scope.active == 'mattressYW'">
- <LjHeaderMenu group-cls="flx-start" :action="qdActionYW"></LjHeaderMenu>
- </div>
- <div class="flx-center flx-end flx-1 ml-24" v-else-if="scope.active == 'mattressQD'">
- <LjHeaderMenu group-cls="flx-start" :action="qdAction"></LjHeaderMenu>
- </div>
- </template>
- <template #mattressQD>
- <LjFoldLayout ref="LjFoldLayoutRef" v-bind="layoutSetting">
- <template #left>
- <LjVxeTable
- ref="YwTableRef"
- row-key="key"
- table-cls="h-full"
- :data="mattressYWList"
- :columns="columns_yw_qd"
- :dwname="DwnameEnum.mattressInterfaceYw"
- :request-auto="false"
- :table-props="tableProps_mx"
- :tool-button="[]"
- :auto-load-layout="false"
- collapseButtons
- >
- </LjVxeTable>
- </template>
- <div class="main-box flx-col">
- <LjVxeTable
- ref="QdTableRef"
- row-key="key"
- table-cls="h-full"
- :data="mattressQDList"
- :columns="columns_qd"
- :dwname="DwnameEnum.mattressInterfaceQd"
- :request-auto="false"
- :table-props="tableProps_qd"
- :tool-button="['setting']"
- collapseButtons
- @setMergeCells="resetMergeCellsQd"
- @row-dragend="autoRowDragend"
- >
- </LjVxeTable>
- </div>
- </LjFoldLayout>
- </template>
- </LjDetail>
- <MattressDialog ref="MattressDialogRef" v-bind="MattressDialogProps" />
- <MtrldefErpDialog ref="MtrldefErpDialogRef" v-bind="MtrldefErpDialogProps" />
- <CodeMxDialog ref="CodeMxDialogRef" v-bind="CodeMxDialogProps" />
- <!-- <SetSubspecsDialog ref=SetSubspecsDialogRef" /> -->
- </template>
- <script setup lang="tsx" name="mattressInterfaceDetail">
- import { ref, watch, reactive, inject, onMounted, computed, nextTick, onBeforeMount } from "vue";
- import { DwnameEnum } from "@/enums/dwnameEnum";
- import LjDetail from "@/components/LjDetail/index.vue";
- import { DetailProp } from "@/components/LjDetail/interface";
- import { useI18n } from "vue-i18n";
- import { useRoute, useRouter } from "vue-router";
- import { useHooks } from "./hooks/index";
- import { useAuthButtons } from "@/hooks/useAuthButtons";
- import { CommonDynamicSelect, GetERPWrkGrpList, GetERPWrkGrpList2, GetERPConfigureList } from "@/api/modules/common";
- import { SaveMattressInterface, GetResetWiptype, UpdateL1Basicinfo } from "@/api/modules/quote";
- import { ElMessage, ElMessageBox, ElNotification } from "element-plus";
- import mittBus from "@/utils/mittBus";
- import { MittEnum } from "@/enums/mittEnum";
- import MattressDialog from "@/views/system/selector/mattress/index.vue";
- import MtrldefErpDialog from "@/views/system/selector/mtrldefErp/index.vue";
- import CodeMxDialog from "@/views/system/selector/codemx/index.vue";
- import { formatToDate } from "@/utils/dateUtil";
- import LjFoldLayout from "@/components/LjFoldLayout/index.vue";
- import { detailAction } from "@/components/LjDetail/interface";
- import { transformTreeData, autoMergeCells, isFilterPrice } from "@/utils/index";
- import LjDialog from "@/components/LjDialog/index.vue";
- import dialog from "@/utils/dialog";
- // import SetSubspecsDialog from "./components/setSubspecs.vue";
- import InsterMxDialog from "./components/insterMx.vue";
- import InsterPzDialog from "./components/insterPz.vue";
- import { SaveMattressAuditing } from "@/api/modules/quote";
- import { usePageRouter } from "@/hooks/usePageRouter";
- interface detailProp {
- /**
- * @argument any 页面数据
- */
- data?: any;
- /**
- * @argument string 请求数据的api ==> 非必传
- */
- requestApi?: (params: any) => Promise<any>;
- /**
- * @argument any 基础信息,表格展示数据
- */
- // columns?: any;
- /**
- * @description 是否可编辑
- */
- status?: "edit" | "new" | string;
- enum?: any;
- }
- const props = withDefaults(defineProps<detailProp>(), {});
- const { t } = useI18n();
- const route = useRoute();
- const router = useRouter();
- const {
- VxeTableMxRef,
- YwTableRef,
- QdTableRef,
- orderStatus,
- LjDetailRef,
- columns_detail,
- columns_yw,
- columns_yw_qd,
- columns_qd,
- mainData,
- editType,
- mattressYWList,
- mattressQDList,
- MattressDialogRef,
- MattressDialogProps,
- MtrldefErpDialogRef,
- MtrldefErpDialogProps,
- tableProps_mx,
- tableProps_qd,
- workgrpEnum,
- workgrpEnum2,
- configureTypeEnum,
- loadingStatus,
- RetriveMattressInterface,
- RefreshMattressInterfaceList,
- RefreshMattressInterfaceQdList,
- CoverMattressInterfaceList,
- fModelChoseMattress,
- toExcel,
- toCreateMtrl,
- toCreateORDelMtrlPf,
- // toUpdateL1Planprice,
- YWAudit,
- JSAudit,
- JS2Audit,
- resetMergeCellsQd,
- resetMergeCells,
- funcAddRowQd,
- funcCmpCC,
- dynamicRef,
- CodeMxDialogProps,
- CodeMxDialogRef
- } = useHooks(t);
- const { CheckPower, CheckOption, buttonNew, buttonDefault } = useAuthButtons(t);
- const { pageOpen, pageRefresh } = usePageRouter();
- const initParams = ref({ mattressid: 0 as Number });
- const layoutSetting = reactive({});
- const SetSubspecsDialogRef = ref();
- const detailProps = reactive<DetailProp>({
- dwname: DwnameEnum.mattressInterfaceDetail,
- columns: columns_detail,
- basicDefault: {},
- header: {
- foldright: {
- width: 80
- },
- fieldNames: {
- code: "sptcode",
- codeLabel: t("table.u_spt.sptcode") + ":",
- name: "name"
- }
- },
- mould: [
- {
- id: "mattressYW",
- type: "table",
- label: "产品配置"
- },
- {
- id: "mattressQD",
- type: "table",
- label: "产品清单"
- }
- ]
- });
- const tabRemove: Function = inject("tabRemove") as Function;
- const cellClassNameFn = (data: any, editable) => {
- let { column, row } = data;
- if (editable) {
- if (column.field == "bj_pzname") {
- if (
- (["垫层", "辅料"].includes(row.itemname) && row.bj_pzname.indexOf("说明") == -1) ||
- [
- "边带",
- "面层裥棉图案",
- "底层裥棉图案",
- "大侧裥棉图案",
- "小侧1裥棉图案",
- "小侧2裥棉图案",
- "小侧3裥棉图案",
- "拉手刺绣及其他工艺项目所有"
- ].includes(row.bj_pzname)
- ) {
- return "vxecol-danger";
- }
- }
- }
- return null;
- };
- const moveData = async (refName: string, index: number, nextIndex: number) => {
- const $table = dynamicRef(refName).element;
- // const $table = QdTableRef.value.element;
- let { visibleData } = $table.getTableData();
- const curRecords = $table?.getCurrentRecord();
- let prevRow = visibleData[nextIndex];
- visibleData[nextIndex] = visibleData[index];
- visibleData[index] = prevRow;
- visibleData.map((o, idx) => {
- o.printid = idx + 1;
- return o;
- });
- $table.reloadData(visibleData);
- await $table.setCurrentRow(curRecords);
- if (refName == "VxeTableMxRef") {
- resetMergeCells(() => {
- setTimeout(() => {
- $table.scrollToRow(curRecords);
- }, 0);
- });
- } else if (refName == "QdTableRef") {
- resetMergeCellsQd(() => {
- setTimeout(() => {
- $table.scrollToRow(curRecords);
- }, 0);
- });
- }
- };
- const toMove = async (refName: string, action: number) => {
- // const $table = QdTableRef.value.element;
- const $table = dynamicRef(refName).element;
- let curRecords = $table?.getCurrentRecord();
- let visibleData = $table.getTableData().visibleData;
- if (!curRecords) {
- ElMessage.warning("请先选择要移动的行");
- return;
- }
- let curIdx = visibleData.findIndex(t => t === curRecords);
- console.log("curIdx :>> ", curIdx);
- if (action == 1) {
- // 上移
- if (curIdx == 0) {
- ElMessage.warning("已经是第一条了");
- return;
- }
- moveData(refName, curIdx, curIdx - 1);
- } else if (action == -1) {
- // 下移
- if (curIdx == visibleData.length - 1) {
- ElMessage.warning("已经是最后一条了");
- return;
- }
- moveData(refName, curIdx, curIdx + 1);
- }
- };
- const pzFormData = ref({
- itemname: "辅料",
- bj_pzname: ""
- });
- /**
- * @description 配置插入明细行
- * @param refName 表格ref名称
- * @param type 0:最后插入,1:插入列
- */
- const FuncInsertRowPz = (refName: string, type: number) => {
- const _ref = dynamicRef(refName);
- const $table = _ref.element;
- let insertParam = null;
- if ($table) {
- let { visibleData } = $table.getTableData();
- // 判断插入位置
- if (type == 1) {
- let currentRecod = $table.getCurrentRecord();
- insertParam = currentRecod;
- } else {
- insertParam = -1;
- }
- // 收集下拉数据
- let itEnum = [{ value: "辅料" }];
- let pzEnum = [
- { value: "价外物料1" },
- { value: "价外物料1做法" },
- { value: "价外物料2" },
- { value: "价外物料2做法" },
- { value: "价外物料3" },
- { value: "价外物料3做法" },
- { value: "价外物料4" },
- { value: "价外物料4做法" },
- { value: "价外物料5" }
- ];
- console.log("itEnum :>> ", itEnum);
- dialog(InsterPzDialog, {
- formData: pzFormData.value,
- itemnameEnum: itEnum,
- bjPznameEnum: pzEnum
- }).then((data: any) => {
- GetERPConfigureList({
- isPz: 0,
- configcodetype: LjDetailRef.value?._mainData.erp_configcodetype,
- interfaceList: [data]
- }).then(res => {
- if (res.interfaceList && res.interfaceList.length > 0) {
- $table.insertAt(res.interfaceList, insertParam).then(async ({ row }) => {
- const $table1 = dynamicRef(refName).element;
- if ($table1) {
- let visibleData1 = $table1.getTableData().visibleData;
- visibleData1.map((o, idx) => {
- o.printid = idx + 1;
- return o;
- });
- await $table1.reloadData(visibleData1);
- resetMergeCells(() => {
- dynamicRef(refName).scrollTo(row, "bj_namemx");
- });
- }
- });
- }
- });
- });
- }
- };
- const qdActionYW: detailAction[] = [
- buttonDefault({
- label: "增行",
- clickFunc: () => FuncInsertRowPz("VxeTableMxRef", 0)
- }),
- buttonDefault({
- label: "插行",
- divider: true,
- clickFunc: () => FuncInsertRowPz("VxeTableMxRef", 1)
- }),
- buttonDefault({
- label: "删行",
- limited: () => editType.value != 1,
- // disabledTextCallBack: (data: any) => {
- // if (editType.value != 3) {
- // return "不是清单补充,无法操作";
- // }
- // return "";
- // },
- divider: true,
- clickFunc: () => {
- const $table = VxeTableMxRef.value.element;
- if ($table) {
- let curRow = $table.getCurrentRecord();
- console.log("curRow :>> ", curRow);
- if (!curRow) {
- ElMessage.warning("请先选择要删除的行");
- return;
- }
- ElMessageBox.confirm(`是否确定删除当前行?`, "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- closeOnClickModal: false
- })
- .then(() => {
- // $table.remove(curRow);
- const $table = VxeTableMxRef.value.element;
- if ($table) {
- $table.removeCurrentRow();
- }
- })
- .catch(() => {
- // ElMessage.warning("已经取消审批流程操作!");
- });
- }
- }
- }),
- buttonDefault({
- label: "上移",
- clickFunc: () => toMove("VxeTableMxRef", 1)
- }),
- buttonDefault({
- label: "下移",
- clickFunc: () => toMove("VxeTableMxRef", -1),
- divider: true
- })
- ];
- const qdFormData = ref({
- itemname: "",
- bj_pzname: "",
- bj_pzname_mx: "",
- bj_pzname_mx_mx: ""
- });
- /**
- * @description 插入明细行
- * @param refName 表格ref名称
- * @param type 0:最后插入,1:插入列
- */
- const FuncInsertRow = (refName: string, type: number) => {
- const _ref = dynamicRef(refName);
- const $table = _ref.element;
- let insertParam = null;
- if ($table) {
- let { visibleData } = $table.getTableData();
- // 判断插入位置
- if (type == 1) {
- let currentRecod = $table.getCurrentRecord();
- insertParam = currentRecod;
- } else {
- insertParam = -1;
- }
- // 收集下拉数据
- let itEnum = visibleData
- .map(t => {
- return {
- value: t.itemname
- };
- })
- .filter(t => t);
- itEnum = [...new Set(itEnum.map(item => JSON.stringify(item)))].map((item: any) => JSON.parse(item));
- let pzEnum = visibleData
- .map(t => {
- return {
- value: t.bj_pzname
- };
- })
- .filter(t => t);
- pzEnum = [...new Set(pzEnum.map(item => JSON.stringify(item)))].map((item: any) => JSON.parse(item));
- console.log("itEnum :>> ", itEnum);
- dialog(InsterMxDialog, {
- formData: qdFormData.value,
- itemnameEnum: itEnum,
- bjPznameEnum: pzEnum
- }).then((data: any) => {
- // wf_fine_erp_pz()
- GetERPConfigureList({
- isPz: 1,
- configcodetype: LjDetailRef.value?._mainData.erp_configcodetype,
- qdList: [data]
- }).then(res => {
- if (res.qdList && res.qdList.length > 0) {
- const interfaceMap = {};
- mattressYWList.value.forEach((mb: any) => {
- interfaceMap[mb.bj_pzname] = mb;
- });
- // 遍历 qdList 并使用哈希表来查找和赋值
- res.qdList.forEach(mx => {
- const mb = interfaceMap[mx.bj_pzname];
- if (mb) {
- mx.bj_pzname_mx_mx = mb.bj_namemx;
- if (mx.ss_rate === 0) {
- mx.ss_rate = mb.ss_rate;
- }
- if (mx.ls_rate === 0) {
- mx.ls_rate = mb.ls_rate;
- }
- }
- });
- $table.insertAt(res.qdList, insertParam).then(async ({ row }) => {
- // $table.reloadData(visibleData);
- _ref.scrollTo(row, "bj_namemx");
- if (type == 1) {
- const $table1 = dynamicRef(refName).element;
- if ($table1) {
- let visibleData1 = $table1.getTableData().visibleData;
- await $table1.reloadData(visibleData1);
- // resetMergeCellsQd(() => {
- // dynamicRef(refName).scrollTo(row, "bj_namemx");
- // });
- }
- }
- });
- resetMergeCellsQd();
- }
- });
- });
- }
- };
- const qdAction: detailAction[] = [
- buttonDefault({
- label: "增行",
- limited: () => editType.value != 3,
- // disabledTextCallBack: (data: any) => {
- // if (editType.value != 3) {
- // return "不是清单补充,无法操作";
- // }
- // return "";
- // },
- clickFunc: () => FuncInsertRow("QdTableRef", 0)
- }),
- buttonDefault({
- label: "插行",
- limited: () => editType.value != 3,
- // disabledTextCallBack: (data: any) => {
- // console.log("editType.value != 3 :>> ", editType.value != 3);
- // if (editType.value != 3) {
- // return "不是清单补充,无法操作";
- // }
- // return "";
- // },
- clickFunc: () => FuncInsertRow("QdTableRef", 1)
- }),
- buttonDefault({
- label: "删行",
- limited: () => editType.value != 3,
- // disabledTextCallBack: (data: any) => {
- // if (editType.value != 3) {
- // return "不是清单补充,无法操作";
- // }
- // return "";
- // },
- divider: true,
- clickFunc: () => {
- const $table = QdTableRef.value.element;
- if ($table) {
- let curRow = $table.getCurrentRecord();
- console.log("curRow :>> ", curRow);
- if (!curRow) {
- ElMessage.warning("请先选择要删除的行");
- return;
- }
- ElMessageBox.confirm(`是否确定删除当前行?`, "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- closeOnClickModal: false
- })
- .then(() => {
- // $table.remove(curRow);
- const $table = QdTableRef.value.element;
- if ($table) {
- $table.removeCurrentRow();
- }
- })
- .catch(() => {
- // ElMessage.warning("已经取消审批流程操作!");
- });
- }
- }
- }),
- buttonDefault({
- label: "上移",
- clickFunc: () => toMove("QdTableRef", 1)
- }),
- buttonDefault({
- label: "下移",
- clickFunc: () => toMove("QdTableRef", -1),
- divider: true
- }),
- buttonDefault({
- label: "清单增加默认项目",
- limited: () => {
- return !orderStatus.value;
- },
- clickFunc: () => funcAddRowQd()
- }),
- buttonDefault({
- label: "辅助计算生产尺寸",
- divider: true,
- limited: () => {
- return !orderStatus.value;
- },
- clickFunc: () => funcCmpCC()
- }),
- buttonDefault({
- label: "批量设置",
- clickFunc: async () => {
- let _cur = QdTableRef.value.currentEditCell;
- if (!["wrkgrpid", "wrkgrpid2", "actual_useqty"].includes(_cur.field)) {
- return ElMessage.warning("此列暂不支持批量设置(仅支持实际用量、工组)");
- }
- // return mattressQDList.value.length == 0;
- // nextTick(() => {
- const $table = QdTableRef.value.element;
- const { visibleData } = $table.getTableData();
- let _data = [];
- if (visibleData) {
- let _val = visibleData[_cur.rowIndex];
- _data = visibleData.map((o, idx) => {
- if (o.actual_useqty > 0 && idx > _cur.rowIndex) {
- o[_cur.field] = _val[_cur.field];
- if (_cur.field == "wrkgrpid1") {
- o.wrkgrpcode1 = _val.wrkgrpcode1;
- } else if (_cur.field == "wrkgrpid2") {
- o.wrkgrpcode2 = _val.wrkgrpcode2;
- }
- }
- if (_cur.field == "actual_useqty") {
- if (o.useqty > 0 && idx > _cur.rowIndex) {
- o[_cur.field] = _val[_cur.field];
- }
- }
- return o;
- });
- await $table.reloadData(_data);
- resetMergeCellsQd();
- ElMessage.success("批设成功(有实际用量的数据行)");
- }
- }
- })
- ];
- const orderDefaultAction = [
- buttonDefault({
- label: t("common.cancelText"),
- icon: "iconchevron-left",
- limited: () => {
- return !orderStatus.value;
- },
- clickFunc: async item => {
- // router.replace(
- // `/erpapi/mattressInterface/detail?id=${LjDetailRef.value?._mainData.mattressid}&code=${LjDetailRef.value?._mainData.mattresscode}`
- // );
- const _cur = mainData.value[0];
- pageRefresh({
- name: "mattressInterfaceDetail",
- params: {
- id: _cur.mattressid,
- code: _cur.mattresscode
- },
- query: {
- id: _cur.mattressid,
- code: _cur.mattresscode
- },
- replace: true
- });
- }
- }),
- buttonDefault({
- label: t("common.saveText"),
- loading: () => loadingStatus.value.save,
- limited: () => !orderStatus.value,
- disabledTextCallBack: (data: any) => {
- if (editType.value == 3 && data.js2_flag == 1) {
- return "已清单补充审核,无法修改";
- }
- if (editType.value == 2 && data.js1_flag == 1) {
- return "已产品补充审核,无法操作";
- }
- // if (editType.value == 1 && data.yw_flag == 1) {
- // return "已完成业务补充审核,无法操作";
- // }
- return "";
- },
- clickFunc: async item => {
- try {
- await LjDetailRef.value.toValidateForm();
- let $tableYW = VxeTableMxRef.value.element;
- let { visibleData } = $tableYW.getTableData();
- visibleData.map(o => {
- console.log("tableYW visibleData o :>> ", o);
- if (
- (["垫层", "辅料"].includes(o.itemname) && o.bj_pzname.indexOf("说明") == -1) ||
- [
- "边带",
- "面层裥棉图案",
- "底层裥棉图案",
- "大侧裥棉图案",
- "小侧1裥棉图案",
- "小侧2裥棉图案",
- "小侧3裥棉图案",
- "拉手刺绣及其他工艺项目所有"
- ].includes(o.bj_pzname)
- ) {
- if (o.bj_namemx == "") {
- VxeTableMxRef.value.scrollTo(o, "bj_namemx");
- throw new Error("产品配置:【" + o.bj_pzname + "】的明细是必填项,请输入/选择");
- }
- }
- return o;
- });
- ElMessageBox.confirm("是否确定要保存吗?", "询问", {
- confirmButtonText: "是",
- cancelButtonText: "否",
- type: "warning",
- closeOnClickModal: false
- }).then(async () => {
- loadingStatus.value.save = true;
- try {
- let _qdList = mattressQDList.value;
- let _ywList = mattressYWList.value;
- const $tableQd = QdTableRef.value.element;
- const $tableYw = VxeTableMxRef.value.element;
- if ($tableQd) {
- const { visibleData } = $tableQd.getTableData();
- _qdList = visibleData.map((o, i) => {
- o.printid = i + 1;
- o.sh_rate = Number(o.sh_rate);
- o.actual_useqty = Number(o.actual_useqty);
- o.qd_pfgroupqty = Number(o.qd_pfgroupqty);
- return o;
- });
- }
- if ($tableYw) {
- const { visibleData } = $tableYw.getTableData();
- _ywList = visibleData.map((o, i) => {
- o.printid = i + 1;
- o.actual_useqty = Number(o.actual_useqty);
- o.sh_rate = Number(o.sh_rate);
- o.ls_rate = Number(o.ls_rate);
- o.qd_pfgroupqty = Number(o.qd_pfgroupqty);
- o.ss_rate = Number(o.ss_rate);
- return o;
- });
- }
- const res = await SaveMattressInterface({
- mattress: LjDetailRef.value?._mainData,
- interfaceList: _ywList,
- qdList: _qdList
- })
- .then(res => {
- ElNotification({
- title: "温馨提示",
- message: t("sys.api.sueccessToSave"),
- type: "success"
- });
- // tabRemove(route.fullPath);
- // router.replace(
- // `/erpapi/mattressInterface/detail?id=${LjDetailRef.value?._mainData.mattressid}&code=${LjDetailRef.value?._mainData.mattresscode}`
- // );
- const _cur = LjDetailRef.value?._mainData;
- router.push({
- name: "mattressInterfaceDetail",
- params: {
- id: _cur.mattressid
- },
- query: {
- code: _cur.mattresscode
- },
- replace: true
- });
- // LjDetailRef.value.refresh();
- loadingStatus.value.save = false;
- })
- .catch(error => {
- console.log("error !! :>> ", error);
- loadingStatus.value.save = false;
- });
- } catch (error) {
- loadingStatus.value.save = false;
- ElMessage.error(t("sys.api.operationFailed"));
- }
- });
- } catch (error) {
- console.log("errorerrorerrorerror :>> ", typeof error, error);
- if (error.hasOwnProperty("message")) {
- ElMessage.error(error.message);
- } else {
- for (const key in error) {
- if (Object.prototype.hasOwnProperty.call(error, key)) {
- const element = error[key];
- ElMessage.error(element[0].message);
- }
- }
- }
- return false;
- }
- }
- }),
- // [
- buttonDefault({
- label: "刷新带出配置",
- limited: () => {
- return !orderStatus.value || editType.value == 3;
- },
- clickFunc: item => {
- RefreshMattressInterfaceList(LjDetailRef.value?._mainData.mattressid, 0, LjDetailRef.value?._mainData.erp_configcodetype);
- }
- }),
- buttonDefault({
- label: "复制配置",
- limited: () => {
- return !orderStatus.value || editType.value == 3;
- },
- clickFunc: item => {
- fModelChoseMattress("", { arg_parentid: 0, js1_flag: 1 }).then((res: any) => {
- RefreshMattressInterfaceList(
- res.mattressid,
- 1,
- LjDetailRef.value?._mainData.erp_configcodetype,
- LjDetailRef.value?._mainData.mattressid
- );
- });
- }
- }),
- buttonDefault({
- label: "重新生成配置项目",
- limited: () => {
- return !orderStatus.value || editType.value != 1;
- },
- disabledTextCallBack: (data: any) => {
- if (data.js1_flag == 1) {
- return "已产品补充审核,无法操作";
- }
- return "";
- },
- clickFunc: item => {
- RefreshMattressInterfaceList(LjDetailRef.value?._mainData.mattressid, 2, LjDetailRef.value?._mainData.erp_configcodetype);
- }
- }),
- // ],
- // [
- buttonDefault({
- label: "刷新清单",
- limited: () => {
- return !orderStatus.value;
- },
- clickFunc: item => {
- RefreshMattressInterfaceQdList(LjDetailRef.value?._mainData.mattressid, 0);
- }
- }),
- buttonDefault({
- label: "复制清单",
- limited: () => {
- return !orderStatus.value;
- },
- clickFunc: item => {
- fModelChoseMattress("", { arg_parentid: 0 }).then((res: any) => {
- RefreshMattressInterfaceQdList(res.mattressid, 1, 0);
- });
- }
- }),
- buttonDefault({
- label: "重新生成清单",
- limited: () => {
- return !orderStatus.value;
- },
- clickFunc: item => {
- RefreshMattressInterfaceQdList(LjDetailRef.value?._mainData.mattressid, 2);
- }
- }),
- // ],
- // [
- // buttonDefault({
- // label: "清单增加默认项目",
- // limited: () => {
- // return !orderStatus.value;
- // },
- // clickFunc: () => funcAddRowQd()
- // }),
- // buttonDefault({
- // label: "辅助计算生产尺寸",
- // limited: () => {
- // return !orderStatus.value;
- // },
- // clickFunc: () => funcCmpCC()
- // }),
- // ],
- buttonDefault({
- label: "重置半成品及新工组归属列数据",
- limited: () => {
- return !orderStatus.value;
- },
- clickFunc: async () => {
- const $table = QdTableRef.value.element;
- if ($table) {
- const { visibleData } = $table.getTableData();
- let res = await GetResetWiptype({ qdList: visibleData });
- let arr = visibleData.map(o => {
- let _itm = res.qdList.find(itm => itm.printid == o.printid);
- if (_itm) {
- o.wip_type = _itm.wip_type;
- !o.wrkgrpcode2 && (o.wrkgrpcode2 = _itm.wrkgrpcode2);
- }
- return o;
- });
- $table.reloadData(arr);
- resetMergeCellsQd();
- }
- }
- }),
- buttonDefault({
- label: t("common.businessOrderCancel"),
- power: 95,
- limited: () => {
- return !!orderStatus.value;
- },
- disabledTextCallBack: (data: any) => {
- if (!CheckPower(95)) {
- return `你没有【报价单-${t("common.businessOrderCancel")}】的使用权限`;
- }
- if (data.js1_flag == 1) {
- return "已产品补充审核,无法操作";
- }
- if (data.parentid > 0) {
- return "副规格无法操作,请在主规格中进行";
- }
- return "";
- },
- clickFunc: item => {
- ElMessageBox.confirm(`是否确定要${t("common.businessOrderCancel")}吗?`, "询问", {
- confirmButtonText: "是",
- cancelButtonText: "否",
- type: "warning"
- })
- .then(() => {
- let _params = {
- mattressids: [Number(LjDetailRef.value._mainData.mattressid)],
- xd_flag: 0
- };
- SaveMattressAuditing(_params).then(() => {
- ElMessage.success(t("sys.api.operationSuccess"));
- LjDetailRef.value.refresh();
- });
- })
- .catch((e: TypeError) => {
- ElMessage({
- type: "info",
- message: "操作取消"
- });
- });
- }
- }),
- // [
- // buttonDefault({
- // label: "业务补充",
- // power: 79,
- // limited: () => {
- // return !!orderStatus.value || LjDetailRef.value?._mainData.xd_flag == 1;
- // },
- // disabledTextCallBack: (data: any) => {
- // if (data.yw_flag == 1) {
- // return "已业务补充审核,无法修改";
- // }
- // return "";
- // },
- // clickFunc: item => {
- // routeToEdit(1);
- // }
- // }),
- // buttonDefault({
- // label: "业务审核",
- // power: 80,
- // limited: () => {
- // return !!orderStatus.value;
- // },
- // clickFunc: item => {
- // const curRecords = [LjDetailRef.value?._mainData];
- // YWAudit(1, curRecords, () => {
- // LjDetailRef.value.refresh();
- // });
- // }
- // }),
- // buttonDefault({
- // label: "业务撤审",
- // power: 81,
- // limited: () => {
- // return !!orderStatus.value;
- // },
- // clickFunc: item => {
- // const curRecords = [LjDetailRef.value?._mainData];
- // YWAudit(0, curRecords, () => {
- // LjDetailRef.value.refresh();
- // });
- // }
- // }),
- // ],
- // [
- buttonDefault({
- label: "产品补充",
- power: 82,
- limited: () => {
- // return !!orderStatus.value || LjDetailRef.value?._mainData.yw_flag == 0;
- return !!orderStatus.value;
- },
- disabledTextCallBack: (data: any) => {
- if (data.js1_flag == 1) {
- return "已产品补充审核,无法修改";
- }
- return "";
- },
- clickFunc: item => {
- routeToEdit(2);
- }
- }),
- buttonDefault({
- label: "产品补充审核",
- power: 83,
- limited: () => {
- // return !!orderStatus.value || LjDetailRef.value?._mainData.yw_flag == 0;
- return !!orderStatus.value;
- },
- clickFunc: item => {
- const curRecords = [LjDetailRef.value?._mainData];
- JSAudit(1, curRecords, () => {
- LjDetailRef.value.refresh();
- });
- }
- }),
- buttonDefault({
- label: "产品补充撤审",
- power: 84,
- limited: () => {
- // return !!orderStatus.value || LjDetailRef.value?._mainData.yw_flag == 0;
- return !!orderStatus.value;
- },
- clickFunc: item => {
- const curRecords = [LjDetailRef.value?._mainData];
- JSAudit(0, curRecords, () => {
- LjDetailRef.value.refresh();
- });
- }
- }),
- // ],
- // [
- buttonDefault({
- label: "清单补充",
- power: 85,
- limited: () => {
- // return !!orderStatus.value || LjDetailRef.value?._mainData.yw_flag == 0;
- return !!orderStatus.value;
- },
- disabledTextCallBack: (data: any) => {
- if (data.js2_flag == 1) {
- return "已清单补充审核,无法修改";
- }
- return "";
- },
- clickFunc: item => {
- routeToEdit(3);
- }
- }),
- buttonDefault({
- label: "清单补充审核",
- power: 86,
- limited: () => {
- // return !!orderStatus.value || LjDetailRef.value?._mainData.yw_flag == 0;
- return !!orderStatus.value;
- },
- clickFunc: item => {
- const curRecords = [LjDetailRef.value?._mainData];
- JS2Audit(1, curRecords, () => {
- LjDetailRef.value.refresh();
- });
- }
- }),
- buttonDefault({
- label: "清单补充撤审",
- power: 87,
- limited: () => {
- // return !!orderStatus.value || LjDetailRef.value?._mainData.yw_flag == 0;
- return !!orderStatus.value;
- },
- clickFunc: item => {
- const curRecords = [LjDetailRef.value?._mainData];
- JS2Audit(0, curRecords, () => {
- LjDetailRef.value.refresh();
- });
- }
- }),
- // ],
- buttonDefault({
- label: "覆盖配置到副规格产品",
- loading: () => loadingStatus.value.main2sec,
- limited: () => {
- return !!orderStatus.value || LjDetailRef.value?._mainData.child_count == 0;
- },
- disabledTextCallBack: (data: any) => {
- if (data.child_count == 0) {
- return "没有副规格产品,无法操作";
- }
- return "";
- },
- clickFunc: item => {
- fModelChoseMattress("副规格", { arg_parentid: LjDetailRef.value?._mainData.mattressid }, 0, t("common.okText"), false).then(
- (res: any) => {
- console.log("res :>> ", res);
- CoverMattressInterfaceList(
- res.map(t => {
- return { mattressid: t.mattressid };
- })
- )
- .then(() => {
- loadingStatus.value.main2sec = false;
- })
- .catch(() => {
- loadingStatus.value.main2sec = false;
- });
- }
- );
- }
- }),
- buttonDefault({
- label: "获取主规格配置",
- limited: () => {
- return !orderStatus.value || +LjDetailRef.value?._mainData.parentid === 0;
- },
- disabledTextCallBack: (data: any) => {
- if (data.parentid == 0) {
- return "主规格产品,无法操作";
- }
- return "";
- },
- clickFunc: item => {
- RefreshMattressInterfaceList(
- LjDetailRef.value?._mainData.parentid,
- 1,
- LjDetailRef.value?._mainData.erp_configcodetype,
- LjDetailRef.value?._mainData.mattressid
- );
- }
- }),
- buttonDefault({
- label: "生成/更新物料",
- power: 88,
- loading: () => loadingStatus.value.mtrldef,
- limited: () => {
- // return !!orderStatus.value || LjDetailRef.value?._mainData.yw_flag == 0;
- return !!orderStatus.value;
- },
- clickFunc: item => {
- toCreateMtrl(1, [LjDetailRef.value?._mainData.mattressid]);
- }
- }),
- // [
- buttonDefault({
- label: "生成金蝶清单",
- power: 90,
- loading: () => loadingStatus.value.prdpf,
- limited: () => {
- // return !!orderStatus.value || LjDetailRef.value?._mainData.yw_flag == 0;
- return !!orderStatus.value;
- },
- disabledTextCallBack: (data: any) => {
- console.log("生成金蝶清单 disabledTextCallBack data", data);
- if (data.js2_flag == 0) {
- return "床垫清单未审核,无法生成金蝶清单";
- }
- return "";
- },
- clickFunc: item => {
- toCreateORDelMtrlPf(1, [LjDetailRef.value?._mainData.mattressid]);
- }
- }),
- // buttonDefault({
- // label: "删除金蝶清单",
- // power: 91,
- // clickFunc: item => {
- // toCreateORDelMtrlPf(0, LjDetailRef.value?._mainData.mattressid);
- // }
- // })
- // buttonDefault({
- // label: "更新计划价",
- // power: 91,
- // limited: () => {
- // return !!orderStatus.value;
- // },
- // clickFunc: item => {
- // toUpdateL1Planprice(LjDetailRef.value?._mainData.mattressid);
- // }
- // })
- // ],
- buttonDefault({
- label: "同步L1资料",
- // limited: () => {
- // return !orderStatus.value;
- // },
- loading: () => loadingStatus.value.synchsL1,
- clickFunc: async () => {
- try {
- loadingStatus.value.synchsL1 = true;
- let res = await UpdateL1Basicinfo();
- if (res) {
- ElNotification({
- title: "同步成功",
- message: `物料:${res.mtrlnum}个 <br/>工组:${res.wkgnum}个 <br/>物料类别:${res.mtrltypenum}个`,
- dangerouslyUseHTMLString: true,
- type: "warning"
- });
- }
- loadingStatus.value.synchsL1 = false;
- } catch (error) {
- loadingStatus.value.synchsL1 = false;
- console.error(error);
- }
- }
- }),
- buttonDefault({
- label: t("common.back"),
- clickFunc: item => {
- router.push(`/erpapi/mattressInterface`);
- }
- })
- ];
- const routeToEdit = async (type: any) => {
- console.log("routeToEdit mainData :>> ", mainData, route.fullPath);
- const _cur = mainData.value[0];
- // router.replace(`/erpapi/mattressInterface/${type}/edit?id=${_cur.mattressid}&code=${_cur.mattresscode}&type=${type}`);
- pageOpen({
- name: "mattressInterfaceEditYw",
- params: {
- id: _cur.mattressid,
- code: _cur.mattresscode
- },
- query: {
- id: _cur.mattressid,
- code: _cur.mattresscode,
- type: type
- },
- replace: true
- });
- };
- /**
- * @description 页面数据加载完成
- */
- const funcAfterMound = async () => {
- console.log("onMounted detail sale start!!!! :>> ", orderStatus.value);
- if (!orderStatus.value) {
- // 详情页
- // gotoSummy(8000);
- } else {
- // 新增/编辑
- tableProps_mx.value.editConfig.enabled = true;
- tableProps_qd.value.editConfig.enabled = true;
- // tableProps_mx_yw.value.editConfig.enabled = true;
- // tableProps_mx_qd.value.editConfig.enabled = true;
- }
- console.log("onMounted detail sale start!!!! :>> ", tableProps_mx.value.editConfig);
- console.log("onMounted detail sale start LjDetailRef.value.mainData :>> ", LjDetailRef.value);
- if (orderStatus.value != "new") {
- }
- };
- onBeforeMount(() => {
- if (route.params?.id) {
- // 刷新数据
- initParams.value.mattressid = Number(route.params?.id);
- editType.value = Number(route.query?.type);
- }
- });
- onMounted(async () => {
- console.log("route onMounted:>> ", route);
- console.log("route onMounted:>> ", route.params);
- console.log("route onMounted:>> ", route.params.id);
- const result = await GetERPWrkGrpList();
- if (result.workgroupList) {
- workgrpEnum.value = result.workgroupList.map(item => {
- return {
- label: item.wrkGrpName,
- value: item.wrkGrpid,
- code: item.wrkgrpcode
- };
- });
- // columns_qd.value = columns_qd.value.map(item => {
- // if (item.field == "wrkgrpid") {
- // item.editRender.options = workgrpEnum.value;
- // }
- // return item;
- // });
- }
- const result2 = await GetERPWrkGrpList2();
- workgrpEnum2.value = result2.datatable ?? [];
- if (route.params?.id) {
- // 刷新数据
- // initParams.value.mattressid = Number(route.params?.id);
- // editType.value = Number(route.query?.type);
- console.log("detail onMounted initParams.value :>> ", initParams.value);
- console.log("领用工组领用工组领用工组领用工组 columns_qd.value :>> ", columns_qd.value);
- await RetriveMattressInterface(initParams.value.mattressid.valueOf());
- }
- });
- /** 发现4.11~4.13版本reloadData加载超慢放弃使用 */
- const autoRowDragend = async data => {
- const $table = QdTableRef.value.element;
- $table.clearMergeCells();
- // setTimeout(() => {
- nextTick(() => {
- console.time("autoRowDragend");
- console.log("autoRowDragend data :>> ", data);
- console.log(`拖拽完成,被拖拽行:${data.oldRow.itemname} 目标行:${data.newRow.itemname} 目标位置:${data.dragPos}`);
- // resetMergeCellsQd();
- // console.time("autoRowDragend getTableData");
- // const { visibleData } = $table.getTableData();
- // console.timeEnd("autoRowDragend getTableData");
- // console.time("autoRowDragend arr");
- // let arr = visibleData.map((o, idx) => {
- // o.printid = idx + 1;
- // return o;
- // });
- // console.timeEnd("autoRowDragend arr");
- // console.time("autoRowDragend reloadData");
- // await $table.reloadData(arr);
- // console.timeEnd("autoRowDragend reloadData");
- console.time("autoRowDragend autoMergeCells");
- let mergeCells = autoMergeCells($table, ["itemname", "bj_pzname", "bj_pzname_mx_mx"]);
- console.timeEnd("autoRowDragend autoMergeCells");
- console.time("autoRowDragend setMergeCells");
- $table.setMergeCells(mergeCells);
- console.timeEnd("autoRowDragend setMergeCells");
- console.timeEnd("autoRowDragend");
- });
- // }, 1000);
- };
- // const LjDialogQdRowAdd = ref();
- // const interIndex = ref(0);
- // const qdFormParam = ref({
- // itemname: "",
- // bj_pzname: "",
- // bj_pzname_mx: "",
- // u_mtrl_price_mtrlname: ""
- // });
- // const qdDefaultAction = [
- // buttonDefault({
- // label: t("common.cancelText"),
- // icon: "iconchevron-left",
- // clickFunc: item => {
- // LjDialogQdRowAdd.value.hide();
- // }
- // }),
- // buttonDefault({
- // label: t("common.okText"),
- // clickFunc: async item => {
- // LjDialogQdRowAdd.value.hide();
- // }
- // })
- // ];
- </script>
- <style lang="scss">
- .mattressInterface-detail-container {
- --vxe-ui-table-column-padding-mini: 0 !important;
- --vxe-ui-table-row-height-mini: 23px !important;
- }
- </style>
|