1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458 |
- import { ref, reactive, computed, toRefs, nextTick, inject } from "vue";
- import { Table } from "@/hooks/interface";
- import { ColumnProps } from "@/components/LjVxeTable/interface";
- import { ALLOW_EDIT_STATE, sys_arry_formulatype } from "@/config/index";
- import { CommonDynamicSelect } from "@/api/modules/common";
- import { GetComputeBednet } from "@/api/modules/quote";
- import { useUserStore } from "@/stores/modules/user";
- import MtrldefSelect from "@/views/system/selector/mtrldef/select.vue";
- import SpringSelect from "@/views/system/selector/spring/select.vue";
- // import { handleRowAccordingToProp } from "@/utils";
- import { ElButton, ElMessage, ElPopconfirm, ElMessageBox, ElNotification } from "element-plus";
- import { Minus, Plus, InfoFilled } from "@element-plus/icons-vue";
- import { DwnameEnum } from "@/enums/dwnameEnum";
- import { isArray } from "@/utils/is";
- import { calculateFormula, formulaPartsFormula, floatAdd, floatMul, formatFixedNumber, formatIntNumber } from "@/utils/index";
- import { cloneDeep, defaultsDeep } from "lodash-es";
- import { TYPE, useToast, POSITION } from "vue-toastification";
- import ToastFormula from "@/components/ToastWidget/Formula/index.vue";
- import ToastHistoryPrice from "@/components/ToastWidget/HistoryPrice/index.vue";
- import { numCheck } from "@/utils/rules/index";
- interface defaultState {
- /**
- * @description 单据当前状态
- */
- orderStatus: string;
- LjDetailRef: any;
- initParams: any;
- initParamsMx: any;
- initParamsMxSpring: any;
- bednetMxData: any;
- bednetMxSpringData: any;
- vxeTableMxRef: any;
- vxeTableMxSpringRef: any;
- MtrldefDialogRef: any;
- MtrldefDialogProps: any;
- SpringDialogRef: any;
- SpringDialogProps: any;
- currentArea: any;
- AreaList: any;
- bednetVarList: any;
- AllFormulaRef: any;
- }
- /**
- * @description 床网明细表-属性默认值
- */
- const dw_bednet_define_add_mx = {
- pid: 1,
- bednetmxid: 0,
- bednetid: 0,
- spring_qty_width: 0,
- spring_qty_length: 0,
- bednet_height: 0,
- wire_mtrlid: 0,
- springid: 0,
- springname: 0,
- if_part: 0,
- if_15strip: 0,
- if_pocket_around: 0,
- pocket_around_springid: 0,
- pocket_around_springname: 0,
- pocket_around_row: 0,
- pocket_around_wire_price: 0,
- pocket_around_spring_cost: 0,
- pocket_around_fabrics_cost: 0,
- if_hard_around: 0,
- hard_around_springid: 0,
- hard_around_springname: 0,
- hard_around_row: 0,
- hard_around_wire_price: 0,
- hard_around_mtrl_cost: 0,
- hard_around_hr_cost: 0,
- fabrics1_mtrlid: 0,
- fabrics1_price: 0,
- fabrics1_mtrl_cost: 0,
- fabrics2_mtrlid: 0,
- fabrics2_price: 0,
- fabrics2_mtrl_cost: 0,
- if_side_iron: 0,
- side_iron_qty: 0,
- side_iron_mtrl_cost: 0,
- side_iron_hr_cost: 0,
- pocket_around_spring_cost_replace_formula: "",
- pocket_around_fabrics_cost_replace_formula: "",
- hard_around_mtrl_cost_replace_formula: "",
- hard_around_hr_cost_replace_formula: "",
- fabrics1_mtrl_cost_replace_formula: "",
- fabrics2_mtrl_cost_replace_formula: "",
- side_iron_mtrl_cost_replace_formula: "",
- side_iron_hr_cost_replace_formula: "",
- cnail_mtrl_cost_replace_formula: "",
- cnail_mtrl_cost: 0,
- cnail_hr_cost_replace_formula: "",
- cnail_hr_cost: 0,
- glue_mtrl_cost_replace_formula: "",
- glue_mtrl_cost: 0,
- spring_mtrl_cost: 0,
- spring_hr_cost: 0,
- spring_mtrl_cost_replace_formula: "",
- spring_hr_cost_replace_formula: "",
- spring_weight_replace_formula: ""
- };
- const dw_bednet_mx_spring = {
- bednetmx_partid: 0,
- bednetmxid: 0,
- springid: 0,
- springname: "",
- spring_qty_width: 0,
- spring_qty_length: 0,
- fabrics1_mtrl_cost: 0
- };
- const ifsaleout_default = {
- commission: 1.05,
- other_rate: 1.05,
- taxrate: 1.07,
- moneyrate: 6.7
- };
- export const useHooks = (t?: any) => {
- const state = reactive<defaultState>({
- orderStatus: "",
- LjDetailRef: null,
- vxeTableMxRef: null,
- vxeTableMxSpringRef: null,
- initParams: {},
- initParamsMx: {},
- initParamsMxSpring: {},
- bednetMxData: [],
- bednetMxSpringData: [],
- MtrldefDialogRef: null,
- MtrldefDialogProps: {},
- SpringDialogRef: null,
- SpringDialogProps: {},
- currentArea: null,
- AreaList: [],
- bednetVarList: [],
- AllFormulaRef: null
- });
- state.orderStatus = inject("orderStatus", "");
- const { userInfo } = useUserStore();
- const rModelSetFabrics2_mtrlid = (data: any) => {
- data.sponge_tc_mtrlid = 0;
- data.mtrl_sponge_tc_name = "";
- data.sponge_tc_thickness = 0;
- data.sponge_tc_height = 0;
- };
- /**
- * @description 填充海绵
- */
- const rModelSetSpring = (data: any, item: any) => {
- console.log("rModelSetSpring data, item :>> ", data, item);
- if (item) {
- data.springid = item.springid;
- data.springname = item.name;
- }
- };
- const rModelClearSpring = (data: any) => {
- data.springid = 0;
- data.springname = "";
- };
- /**
- * @description 弹窗模块:选择弹簧
- * @param data 当前数据
- * @param status 当前订单状态
- * @returns Promise
- */
- const fModelChoseSpring = (data: any, params: any, cb: any) => {
- return new Promise((resolve, reject) => {
- // if (!ALLOW_EDIT_STATE.includes(status)) return;
- let _params = {
- arg_search: params
- };
- state.SpringDialogProps = {
- onSubmit: (res: any) => {
- // submit
- console.log("openCustDialog res", res);
- nextTick(() => {
- cb(data, res.value[0]);
- resolve(1);
- });
- },
- onCancel: (error: any) => {
- // cancel 回调
- console.log("openCustDialog error", error);
- }
- };
- state.SpringDialogRef.show(_params);
- });
- };
- const rModelSetMtrlFelt = (data: any, item: any) => {
- if (item) {
- data.felt_mtrlid = item.mtrlid;
- data.felt_price = item.pricelistprice;
- data.mtrl_felt_name = item.mtrlname;
- data.felt_qty = 1;
- }
- };
- const rModelClearMtrlFelt = (data: any) => {
- data.felt_mtrlid = 0;
- data.felt_price = 0;
- data.mtrl_felt_name = "";
- data.felt_qty = 0;
- data.felt_dscrp = "";
- };
- const rModelSetMtrlFeltX = (data: any, item: any) => {
- if (item) {
- data.felt_x_mtrlid = item.mtrlid;
- data.mtrl_felt_x_name = item.mtrlname;
- data.felt_x_qty = 1;
- }
- };
- const rModelClearMtrlFeltX = (data: any) => {
- data.felt_x_mtrlid = 0;
- data.mtrl_felt_x_name = "";
- data.felt_x_qty = 0;
- };
- /**
- * @description 封边
- */
- const rModelSetMtrlEdge = (data: any, item: any) => {
- if (item) {
- data.edge_mtrlid = item.mtrlid;
- data.edge_price = item.pricelistprice;
- data.mtrl_edge_name = item.mtrlname;
- }
- };
- const rModelClearMtrlEdge = (data: any) => {
- data.edge_mtrlid = 0;
- data.edge_price = 0;
- data.mtrl_edge_name = "";
- data.edge_height = 0;
- };
- /**
- * @description 填充海绵
- */
- const rModelSetMtrlSpongeTc = (data: any, item: any) => {
- if (item) {
- data.sponge_tc_mtrlid = item.mtrlid;
- data.mtrl_sponge_tc_name = item.mtrlname;
- }
- };
- const rModelClearMtrlSpongeTc = (data: any) => {
- data.sponge_tc_mtrlid = 0;
- data.mtrl_sponge_tc_name = "";
- data.sponge_tc_thickness = 0;
- data.sponge_tc_height = 0;
- };
- const rModelSetMtrlFabrisc1 = (data: any, item: any) => {
- if (item) {
- data.fabrics1_mtrlid = item.mtrlid;
- data.fabrics1_price = item.pricelistprice;
- }
- };
- const rModelClearMtrlFabrisc1 = (data: any) => {
- data.fabrics1_mtrlid = 0;
- data.fabrics1_price = 0;
- };
- const rModelSetMtrlFabrisc2 = (data: any, item: any) => {
- if (item) {
- data.fabrics2_mtrlid = item.mtrlid;
- data.fabrics2_price = item.pricelistprice;
- }
- };
- const rModelClearMtrlFabrisc2 = (data: any) => {
- data.fabrics2_mtrlid = 0;
- data.fabrics2_price = 0;
- };
- const rModelSetHardAroundSpring = (data: any, item: any) => {
- if (item) {
- data.hard_around_springid = item.springid;
- data.hard_around_springname = item.name;
- }
- };
- const rModelClearHardAroundSpring = (data: any) => {
- data.hard_around_springid = 0;
- data.hard_around_springname = "";
- };
- const getPriceid = () => {
- let _deptid = state.LjDetailRef?._mainData?.deptid ?? 0;
- if (!_deptid) {
- ElMessage.warning("请先选择部门");
- state.LjDetailRef?.baseformRef.element.validateField("deptid");
- return 0;
- }
- let deptEnum = state.LjDetailRef.enumMap.get("deptid");
- let _pricelistid = 0;
- console.log("deptEnum :>> ", deptEnum);
- if (deptEnum) {
- let depItem = deptEnum.find((item: any) => item.value == _deptid);
- console.log("depItem :>> ", depItem);
- if (depItem) {
- _pricelistid = Number(depItem.pricelistid);
- }
- }
- return _pricelistid;
- };
- /**
- * @description 弹窗模块:选择物料
- * @param data 当前数据
- * @param status 当前订单状态
- * @returns Promise
- */
- const fModelChoseMtrl = (data: any, params: any, cb: any) => {
- return new Promise((resolve, reject) => {
- let _pricelistid = getPriceid();
- if (!_pricelistid) return false;
- // if (!ALLOW_EDIT_STATE.includes(status)) return;
- console.log("fModelChoseMtrl fModelChoseMtrl params :>> ", params);
- let _params = {
- keyword: "",
- arg_mtrltype: params.mtrltype,
- arg_pricelistid: _pricelistid
- };
- state.MtrldefDialogProps = {
- onSubmit: (res: any) => {
- // submit
- console.log("openCustDialog res", res);
- nextTick(() => {
- cb(data, res.value[0]);
- resolve(1);
- });
- },
- onCancel: (error: any) => {
- // cancel 回调
- console.log("openCustDialog error", error);
- }
- };
- state.MtrldefDialogRef.show(_params);
- });
- };
- /**
- * @description 数据赋值:包边海绵
- * @param data 当前数据
- * @param item 当前选择的数据
- */
- const rModelSetMtrlSponge = (data: any, item: any) => {
- console.log("rModelSetMtrlSponge data :>> ", data);
- console.log("rModelSetMtrlSponge item :>> ", item);
- if (item) {
- data.sponge_mtrlid = item.mtrlid;
- data.sponge_price = item.pricelistprice;
- data.mtrl_sponge_name = item.mtrlname;
- }
- console.log("rModelSetMtrlSponge after data :>> ", data);
- };
- const rModelClearMtrlSponge = (data: any) => {
- console.log("rModelClearMtrlSponge data :>> ", data);
- data.sponge_mtrlid = 0;
- data.sponge_price = 0;
- data.mtrl_sponge_name = "";
- data.sponge_thickness = 0;
- data.sponge_height = 0;
- };
- const wf_hide_dw2 = (bednetData: any, columns: any) => {
- let hFields = [];
- console.log('bednetData.typename != "袋装网" :>> ', bednetData.typename, bednetData.typename != "袋装网");
- // if (bednetData.typename != "袋装网") {
- if (Number(bednetData.bednettypeid) != 11) {
- hFields.push("if_part");
- // 圆网和拉丝网 没有 入袋无纺布和底面无纺布
- hFields.push("fabrics1_mtrlid");
- hFields.push("fabrics2_mtrlid");
- }
- //四周加硬
- if (Number(bednetData.if_hard_around) == 0) {
- hFields.push("if_hard_around");
- hFields.push("hard_around_wire_price");
- hFields.push("hard_around_mtrl_cost");
- hFields.push("hard_around_hr_cost");
- hFields.push("hard_around_springid");
- hFields.push("hard_around_row");
- }
- //四周口袋
- if (Number(bednetData.if_pocket_around) == 0) {
- hFields.push("pocket_around_springname");
- hFields.push("pocket_around_springid");
- hFields.push("pocket_around_row");
- hFields.push("pocket_around_wire_price");
- hFields.push("pocket_around_spring_cost");
- hFields.push("pocket_around_fabrics_cost");
- hFields.push("if_pocket_around");
- }
- // 边铁?
- if (Number(bednetData.if_side_iron) == 0) {
- hFields.push("if_side_iron");
- hFields.push("side_iron_qty");
- hFields.push("side_iron_mtrl_cost");
- hFields.push("side_iron_hr_cost");
- }
- return columns.map(t => {
- if (hFields.includes(t.field)) {
- return {
- ...t,
- limited: true
- };
- }
- return t;
- });
- };
- /**
- * @description 重载床网明细和多区明细,返回多区明细数据
- * @param bednetData
- * @returns
- */
- const reload_dw2 = async (bednetData: any, cb?: any) => {
- state.bednetMxData = [];
- state.bednetMxSpringData = [];
- let res = await getDataMxAdd(state.initParamsMx);
- console.log("getDataMxAdd res :>> ", res);
- let result = dataCallback(res);
- columnsMx.value = wf_hide_dw2(bednetData, result.tableinfo.columns).map(item => {
- let _default = columnsMx_default.value.find(t => t.field == item.field);
- if (_default) {
- item = defaultsDeep(item, _default);
- }
- return item;
- });
- console.log("reset columnsMx.value :>> ", columnsMx.value, result);
- // cb && cb(result);
- let res2 = await getDataMxSpring(state.initParamsMx);
- let result2 = dataCallback(res2);
- // columnsMxSpring.value = result.tableinfo.columns;
- columnsMxSpring.value = result2.tableinfo.columns.map(item => {
- let _default = columnsMxSpring_default.value.find(t => t.field == item.field);
- if (_default) {
- item = defaultsDeep(item, _default);
- }
- return item;
- });
- console.log("reload_dw2 columnsMxSpring.value :>> ", columnsMxSpring.value, result);
- cb && cb({ mx: result, spring: result2 });
- };
- /**
- * @description 变更床垫分类时,重载明细数据 dw_1 itemchange
- * @author w_mattress_add dw_1 itemchange
- */
- const wf_b_bednet_type_ch = async (val: any) => {
- console.log("wf_b_bednet_type_ch state.LjDetailRef._mainData val:>> ", val, state.LjDetailRef, state.orderStatus);
- const { _mainData, enumMap, baseformRef } = state.LjDetailRef;
- // let mainData = state.orderStatus == "new" ? initParam : _mainData;
- console.log("mainData :>> ", _mainData);
- if (!Number(_mainData.deptid)) {
- ElMessage.warning("请先选择部门");
- console.log("baseformRef.element :>> ", baseformRef.element);
- baseformRef.element.validateField("deptid");
- _mainData.bednettypeid = "";
- return;
- }
- let _params = {
- dsname: "_Mapper_bednet_type_define",
- queryparams: {
- arg_bednettypeid: Number(val)
- }
- };
- let res = await CommonDynamicSelect(_params);
- let rBednetType: any = {};
- if (res?.datatable?.length > 0) {
- rBednetType = res?.datatable[0];
- }
- _mainData.bednettypeid = rBednetType.bednettypeid;
- _mainData.snake_wire_diameter = rBednetType.snake_wire_diameter;
- _mainData.snake_wire_mtrl_formula = rBednetType.snake_wire_mtrl_formula;
- _mainData.pocket_around_spring_formula = rBednetType.pocket_around_spring_formula;
- _mainData.pocket_around_fabrics_formula = rBednetType.pocket_around_fabrics_formula;
- _mainData.hard_around_mtrl_formula = rBednetType.hard_around_mtrl_formula;
- _mainData.hard_around_hr_formula = rBednetType.hard_around_hr_formula;
- _mainData.glue_mtrl_formula = rBednetType.glue_mtrl_formula;
- _mainData.if_side_iron = rBednetType.if_side_iron;
- _mainData.side_iron_mtrl_formula = rBednetType.side_iron_mtrl_formula;
- _mainData.side_iron_hr_formula = rBednetType.side_iron_hr_formula;
- _mainData.cnail_mtrl_formula = rBednetType.cnail_mtrl_formula;
- _mainData.cnail_hr_formula = rBednetType.cnail_hr_formula;
- _mainData.if_sponge_drilling = rBednetType.if_sponge_drilling;
- _mainData.sponge_mtrl_formula = rBednetType.sponge_mtrl_formula;
- _mainData.sponge_hr_formula = rBednetType.sponge_hr_formula;
- _mainData.edge_mtrl_formula = rBednetType.edge_mtrl_formula;
- _mainData.edge_hr_formula = rBednetType.edge_hr_formula;
- _mainData.fork_mtrl_formula = rBednetType.fork_mtrl_formula;
- _mainData.fork_hr_formula = rBednetType.fork_hr_formula;
- _mainData.if_rsorwa = rBednetType.if_rsorwa;
- _mainData.rsorwa_mtrl_formula = rBednetType.rsorwa_mtrl_formula;
- _mainData.rsorwa_hr_formula = rBednetType.rsorwa_hr_formula;
- _mainData.sponge_drilling_hr_formula = rBednetType.sponge_drilling_hr_formula;
- _mainData.spring_mtrl_formula = rBednetType.spring_mtrl_formula;
- _mainData.spring_hr_formula = rBednetType.spring_hr_formula;
- _mainData.fabrics1_mtrl_formula = rBednetType.fabrics1_mtrl_formula;
- _mainData.fabrics2_mtrl_formula = rBednetType.fabrics2_mtrl_formula;
- _mainData.felt_mtrl_formula = rBednetType.felt_mtrl_formula;
- _mainData.felt_hr_formula = rBednetType.felt_hr_formula;
- _mainData.packet_mtrl_formula = rBednetType.packet_mtrl_formula;
- _mainData.packet_hr_formula = rBednetType.packet_hr_formula;
- _mainData.sponge_mtrl_tc_formula = rBednetType.sponge_mtrl_tc_formula;
- _mainData.spring_weight_formula = rBednetType.spring_weight_formula;
- _mainData.side_iron_weight_formula = rBednetType.side_iron_weight_formula;
- _mainData.hard_around_weight_formula = rBednetType.hard_around_weight_formula;
- _mainData.fabrics1_weight_formula = rBednetType.fabrics1_weight_formula;
- _mainData.fabrics2_weight_formula = rBednetType.fabrics2_weight_formula;
- _mainData.felt_weight_formula = rBednetType.felt_weight_formula;
- _mainData.cnail_weight_formula = rBednetType.cnail_weight_formula;
- _mainData.sponge_weight_formula = rBednetType.sponge_weight_formula;
- _mainData.sponge_weight_tc_formula = rBednetType.sponge_weight_tc_formula;
- _mainData.edge_weight_formula = rBednetType.edge_weight_formula;
- _mainData.fork_weight_formula = rBednetType.fork_weight_formula;
- reload_dw2(rBednetType, () => {
- state.bednetMxData = [cloneDeep(dw_bednet_define_add_mx)];
- });
- nextTick(() => {
- console.log("wf_b_bednet_type_ch state.vxeTableMxRef :>> ", state.vxeTableMxRef);
- state.vxeTableMxRef && state.vxeTableMxRef.refresh();
- });
- };
- const getData = (params: any) => {
- console.log("getData params :>> ", params);
- let newParams: any = {};
- params.pageNum && (newParams.pageindex = params.pageNum);
- params.pageSize && (newParams.pagesize = params.pageSize);
- delete params.pageNum;
- delete params.pageSize;
- newParams.queryParams = params;
- console.log("params :>> ", params);
- newParams.dsname = "web_bednet_define";
- return CommonDynamicSelect(newParams, DwnameEnum.bednetQuote);
- // return [];
- };
- /**
- * @description 获取明细数据
- * @param params
- * @returns
- */
- const getDataMx = (params: any) => {
- console.log("getData beatad params :>> ", params);
- let newParams: any = {};
- params.pageNum && (newParams.pageindex = params.pageNum);
- params.pageSize && (newParams.pagesize = params.pageSize);
- delete params.pageNum;
- delete params.pageSize;
- newParams.queryParams = params;
- console.log("params :>> ", params);
- newParams.dsname = "web_bednet_mx";
- return CommonDynamicSelect(newParams, DwnameEnum.bednetQuoteMx);
- };
- /**
- * @description 获取弹簧明细
- * @param params
- * @returns
- */
- const getDataMxSpring = (params: any) => {
- console.log("getData params :>> ", params);
- let newParams: any = {};
- params.pageNum && (newParams.pageindex = params.pageNum);
- params.pageSize && (newParams.pagesize = params.pageSize);
- delete params.pageNum;
- delete params.pageSize;
- newParams.queryParams = params;
- console.log("params :>> ", params);
- newParams.dsname = "web_bednet_mx_spring";
- return CommonDynamicSelect(newParams, DwnameEnum.bednetQuoteMxSpring);
- };
- const getDataMxAdd = async (params: any) => {
- console.log("getData params :>> ", params);
- let newParams: any = {};
- params.pageNum && (newParams.pageindex = params.pageNum);
- params.pageSize && (newParams.pagesize = params.pageSize);
- delete params.pageNum;
- delete params.pageSize;
- newParams.queryParams = params;
- console.log("params :>> ", params);
- newParams.dsname = "web_bednet_mx_add";
- return await CommonDynamicSelect(newParams, DwnameEnum.bednetQuoteMx);
- };
- const dataCallback = (data: any) => {
- return {
- list: data.datatable,
- tableinfo: data.tableinfo,
- total: data.totalcnt,
- pageNum: data.pageindex,
- pageSize: data.pagesize
- };
- };
- const handleBlur = (value: any, data: any, field: string) => {
- //保留小数点和-号
- value = (value + "").replace(/[^-\d.]/g, "");
- console.log(value);
- // 保留整数部分
- value = value == "" ? 0 : parseInt(value, 10).toString();
- data[field] = value;
- };
- const columns: ColumnProps<any>[] = [
- { type: "checkbox", width: 50, fixed: "left" },
- { title: "#", field: "pid", fixed: "left", width: 80 },
- {
- title: "审核",
- field: "flag",
- basicinfo: {
- props: {
- trueValue: "1",
- falseValue: "0"
- }
- }
- },
- {
- field: "deptid",
- title: "部门",
- search: {
- el: "select",
- key: "arg_deptid",
- props: {
- filterable: true
- },
- order: 1
- },
- basicinfo: {
- el: "select",
- editable: ALLOW_EDIT_STATE,
- rules: [{ required: true, message: "请先选择部门", trigger: "change" }],
- props: {
- filterable: true,
- clearable: false
- },
- order: 1,
- group: "单据信息"
- }
- },
- {
- title: "床网编码",
- field: "bednetcode",
- table: "u_bednet_define"
- },
- {
- title: "床网名称",
- field: "bednetname",
- table: "u_bednet_define",
- search: {
- el: "input",
- titleKey: "keyword",
- key: "arg_search",
- props: {
- filterable: true
- },
- order: 2
- },
- basicinfo: {
- el: "input",
- editable: ALLOW_EDIT_STATE
- }
- },
- {
- title: "部门售价",
- field: "dept_cost"
- },
- {
- title: "外币价",
- field: "foreign_cost"
- },
- {
- title: "床网类别",
- field: "bednettypeid",
- basicinfo: {
- el: "select",
- editable: ALLOW_EDIT_STATE,
- rules: [{ required: true, message: "请先选择床网类别", trigger: "change" }],
- props: {
- clearable: false,
- filterable: true,
- onChange: val => wf_b_bednet_type_ch(val)
- }
- }
- },
- {
- title: "床垫宽/CM",
- field: "mattress_width",
- basicinfo: {
- el: "input",
- editable: ALLOW_EDIT_STATE,
- rules: [{ validator: numCheck, trigger: "blur" }]
- }
- },
- {
- title: "床垫长/CM",
- field: "mattress_length",
- basicinfo: {
- el: "input",
- editable: ALLOW_EDIT_STATE,
- rules: [{ validator: numCheck, trigger: "blur" }]
- }
- },
- {
- title: "床垫高/CM",
- field: "mattress_height",
- basicinfo: {
- el: "input",
- editable: ALLOW_EDIT_STATE,
- rules: [{ validator: numCheck, trigger: "blur" }]
- }
- },
- {
- title: "双网?",
- field: "if_doublenet"
- },
- {
- title: "双簧?",
- field: "if_doublespring",
- basicinfo: {
- labelHidden: true,
- render: (scope: any) => {
- let _disabled = !ALLOW_EDIT_STATE.includes(scope.status);
- return (
- <>
- <el-checkbox
- v-model={scope.searchParam.if_doublespring}
- disabled={_disabled}
- true-value="1"
- false-value="0"
- label="双簧"
- class="mr-8"
- />
- <el-checkbox
- v-model={scope.searchParam.if_rsorwa}
- disabled={_disabled}
- true-value="1"
- false-value="0"
- label="胶条 包角"
- class="mr-8"
- />
- <el-checkbox
- v-model={scope.searchParam.if_sponge_drilling}
- disabled={_disabled}
- true-value="1"
- false-value="0"
- label="海绵打孔"
- />
- <el-checkbox v-model={scope.searchParam.iffork} disabled={_disabled} true-value="1" false-value="0" label="弹叉" />
- <el-checkbox v-model={scope.searchParam.if_jb} disabled={_disabled} true-value="1" false-value="0" label="卷包" />
- </>
- );
- }
- }
- },
- {
- title: "蛇线线径MM",
- field: "snake_wire_diameter",
- basicinfo: {
- el: "input",
- rules: [{ validator: numCheck, trigger: "blur" }],
- editable: (scope: any) => {
- if (Number(scope.searchParam.bednettypeid) > 11) {
- return true;
- }
- return false;
- },
- editvisible: (scope: any) => {
- if (Number(scope.searchParam.bednettypeid) > 11) {
- return true;
- }
- return false;
- }
- }
- },
- {
- title: "边铁?",
- field: "if_side_iron"
- },
- {
- title: "边铁损耗率",
- field: "side_iron_lossrate"
- },
- {
- title: "海绵包边物料",
- field: "mtrl_sponge_name",
- basicinfo: {
- editable: ALLOW_EDIT_STATE,
- render: (scope: any) => {
- const { column, row, status } = scope;
- let _label = column.title;
- return (
- <>
- <MtrldefSelect
- value={scope.searchParam.sponge_mtrlid}
- pricelistidfn={() => getPriceid()}
- mtrltype={1}
- disabled={!ALLOW_EDIT_STATE.includes(status)}
- clearable
- placeholder={_label}
- onOpenModal={() => fModelChoseMtrl(scope.searchParam, { mtrltype: 1 }, rModelSetMtrlSponge)}
- onSelect={(val: any) => rModelSetMtrlSponge(scope.searchParam, val)}
- onClear={() => rModelClearMtrlSponge(scope.searchParam)}
- >
- {{
- label: () => scope.searchParam.mtrl_sponge_name
- }}
- </MtrldefSelect>
- </>
- );
- }
- }
- },
- {
- title: "海绵厚度CM",
- field: "sponge_thickness",
- basicinfo: {
- el: "input",
- editable: ALLOW_EDIT_STATE,
- rules: [{ validator: numCheck, trigger: "blur" }]
- }
- },
- {
- title: "海绵高CM",
- field: "sponge_height",
- basicinfo: {
- el: "input",
- editable: ALLOW_EDIT_STATE,
- rules: [{ validator: numCheck, trigger: "blur" }]
- }
- },
- {
- title: "填充海绵物料",
- field: "mtrl_sponge_tc_name",
- basicinfo: {
- editable: ALLOW_EDIT_STATE,
- render: (scope: any) => {
- const { column, row, status } = scope;
- let _label = column.title;
- return (
- <>
- <MtrldefSelect
- value={scope.searchParam.sponge_tc_mtrlid}
- pricelistidfn={() => getPriceid()}
- mtrltype={1}
- disabled={!ALLOW_EDIT_STATE.includes(status)}
- clearable
- placeholder={_label}
- onOpenModal={() => fModelChoseMtrl(scope.searchParam, { mtrltype: 1 }, rModelSetMtrlSpongeTc)}
- onSelect={(val: any) => rModelSetMtrlSpongeTc(scope.searchParam, val)}
- onClear={() => rModelClearMtrlSpongeTc(scope.searchParam)}
- >
- {{
- label: () => scope.searchParam.mtrl_sponge_tc_name
- }}
- </MtrldefSelect>
- </>
- );
- }
- }
- },
- {
- title: "填充海绵厚度CM",
- field: "sponge_tc_thickness",
- basicinfo: {
- el: "input",
- editable: ALLOW_EDIT_STATE,
- rules: [{ validator: numCheck, trigger: "blur" }]
- }
- },
- {
- title: "填充海绵高CM",
- field: "sponge_tc_height",
- basicinfo: {
- el: "input",
- editable: ALLOW_EDIT_STATE,
- rules: [{ validator: numCheck, trigger: "blur" }]
- }
- },
- {
- title: "封边物料",
- field: "mtrl_edge_name",
- basicinfo: {
- editable: ALLOW_EDIT_STATE,
- render: (scope: any) => {
- const { column, row, status } = scope;
- let _label = column.title;
- return (
- <>
- <MtrldefSelect
- value={scope.searchParam.edge_mtrlid}
- pricelistidfn={() => getPriceid()}
- mtrltype={7}
- disabled={!ALLOW_EDIT_STATE.includes(status)}
- clearable
- placeholder={_label}
- onOpenModal={() => fModelChoseMtrl(scope.searchParam, { mtrltype: 7 }, rModelSetMtrlEdge)}
- onSelect={(val: any) => rModelSetMtrlEdge(scope.searchParam, val)}
- onClear={() => rModelClearMtrlEdge(scope.searchParam)}
- >
- {{
- label: () => scope.searchParam.mtrl_edge_name
- }}
- </MtrldefSelect>
- </>
- );
- }
- }
- },
- {
- title: "封边高",
- field: "edge_height",
- basicinfo: {
- el: "input",
- editable: ALLOW_EDIT_STATE,
- rules: [{ validator: numCheck, trigger: "blur" }]
- }
- },
- {
- title: "上垫层材料",
- field: "mtrl_felt_name",
- basicinfo: {
- editable: ALLOW_EDIT_STATE,
- render: (scope: any) => {
- const { column, row, status } = scope;
- let _label = column.title;
- return (
- <>
- <MtrldefSelect
- value={scope.searchParam.felt_mtrlid}
- pricelistidfn={() => getPriceid()}
- mtrltype={7}
- disabled={!ALLOW_EDIT_STATE.includes(status)}
- clearable
- placeholder={_label}
- onOpenModal={() => fModelChoseMtrl(scope.searchParam, { mtrltype: 7 }, rModelSetMtrlFelt)}
- onSelect={(val: any) => rModelSetMtrlFelt(scope.searchParam, val)}
- onClear={() => rModelClearMtrlFelt(scope.searchParam)}
- >
- {{
- label: () => scope.searchParam.mtrl_felt_name
- }}
- </MtrldefSelect>
- </>
- );
- }
- }
- },
- {
- field: "felt_qty",
- basicinfo: {
- el: "input",
- editable: ALLOW_EDIT_STATE,
- rules: [{ validator: numCheck, trigger: "blur" }]
- }
- },
- {
- title: "下垫层材料",
- field: "mtrl_felt_x_name",
- basicinfo: {
- editable: ALLOW_EDIT_STATE,
- render: (scope: any) => {
- const { column, row, status } = scope;
- let _label = column.title;
- return (
- <>
- <MtrldefSelect
- value={scope.searchParam.felt_x_mtrlid}
- pricelistidfn={() => getPriceid()}
- mtrltype={7}
- disabled={!ALLOW_EDIT_STATE.includes(status)}
- clearable
- placeholder={_label}
- onOpenModal={() => fModelChoseMtrl(scope.searchParam, { mtrltype: 7 }, rModelSetMtrlFeltX)}
- onSelect={(val: any) => rModelSetMtrlFeltX(scope.searchParam, val)}
- onClear={() => rModelClearMtrlFeltX(scope.searchParam)}
- >
- {{
- label: () => scope.searchParam.mtrl_felt_x_name
- }}
- </MtrldefSelect>
- </>
- );
- }
- }
- },
- {
- field: "felt_x_qty",
- basicinfo: {
- el: "input",
- editable: ALLOW_EDIT_STATE,
- rules: [{ validator: numCheck, trigger: "blur" }]
- }
- },
- {
- title: "弹叉数量",
- field: "fork_qty",
- basicinfo: {
- el: "input",
- rules: [{ validator: numCheck, trigger: "blur" }],
- editable: (scope: any) => {
- if (ALLOW_EDIT_STATE.includes(scope.status) && Number(scope.searchParam.iffork)) {
- return true;
- }
- return false;
- },
- editvisible: (scope: any) => {
- if (Number(scope.searchParam.iffork)) {
- return true;
- }
- return false;
- }
- }
- },
- {
- title: "做法",
- field: "felt_dscrp",
- basicinfo: {
- el: "input",
- editable: ALLOW_EDIT_STATE,
- props: { type: "textarea", rows: 2 }
- }
- },
- {
- title: "胶条?包角?",
- field: "if_rsorwa"
- },
- {
- title: "海绵打孔?",
- field: "if_sponge_drilling"
- },
- {
- title: "登记人",
- field: "createby"
- },
- {
- title: "登记时间",
- field: "createtime"
- },
- {
- title: "总重量",
- field: "sum_weight"
- },
- {
- title: "计划价",
- field: "planprice"
- },
- {
- title: "Bednetid",
- field: "bednetid"
- },
- {
- title: "床网独立销售",
- field: "ifsaleout",
- basicinfo: {
- el: "checkbox",
- editable: ALLOW_EDIT_STATE,
- props: {
- trueValue: "1",
- falseValue: "0"
- }
- }
- },
- {
- title: "包装",
- field: "packtype",
- // enum: [
- // {
- // label: "压包",
- // value: "压包"
- // },
- // {
- // label: "卷包",
- // value: "卷包"
- // },
- // {
- // label: "不压不卷",
- // value: "不压不卷"
- // },
- // {
- // label: "裸包装",
- // value: "裸包装"
- // }
- // ],
- basicinfo: {
- el: "select",
- editable: (scope: any) => {
- if (ALLOW_EDIT_STATE.includes(scope.status) && Number(scope.searchParam.ifsaleout)) {
- return true;
- }
- return false;
- },
- editvisible: (scope: any) => {
- if (Number(scope.searchParam.ifsaleout)) {
- return true;
- }
- return false;
- },
- render: scope => {
- return (
- <>
- <div class="flx w-full">
- <el-select
- v-model={scope.searchParam.packtype}
- placeholder="方式"
- clearable
- disabled={!ALLOW_EDIT_STATE.includes(scope.status)}
- >
- <el-option label="压包" value="压包" />
- <el-option label="卷包" value="卷包" />
- <el-option label="不压不卷" value="不压不卷" />
- <el-option label="裸包装" value="裸包装" />
- </el-select>
- <el-select
- v-model={scope.searchParam.packmtrl}
- class="ml-4"
- placeholder="材料"
- clearable
- disabled={!ALLOW_EDIT_STATE.includes(scope.status)}
- >
- <el-option label="编辑袋" value="编辑袋" />
- <el-option label="牛皮纸" value="牛皮纸" />
- <el-option label="胶袋" value="胶袋" />
- <el-option label="牛皮纸袋" value="牛皮纸袋" />
- </el-select>
- </div>
- </>
- );
- }
- }
- },
- {
- title: "包装数量",
- field: "packqty",
- basicinfo: {
- el: "input",
- rules: [{ validator: numCheck, trigger: "blur" }],
- editable: (scope: any) => {
- if (ALLOW_EDIT_STATE.includes(scope.status) && Number(scope.searchParam.ifsaleout)) {
- return true;
- }
- return false;
- },
- editvisible: (scope: any) => {
- if (Number(scope.searchParam.ifsaleout)) {
- return true;
- }
- return false;
- }
- }
- },
- // {
- // title: "包装材料",
- // field: "packmtrl",
- // enum: [
- // {
- // label: "编辑袋",
- // value: "编辑袋"
- // },
- // {
- // label: "牛皮纸",
- // value: "牛皮纸"
- // },
- // {
- // label: "胶袋",
- // value: "胶袋"
- // },
- // {
- // label: "牛皮纸袋",
- // value: "牛皮纸袋"
- // }
- // ],
- // basicinfo: {
- // el: "select",
- // editable: (scope: any) => {
- // if (ALLOW_EDIT_STATE.includes(scope.status) && Number(scope.searchParam.ifsaleout)) {
- // return true;
- // }
- // return false;
- // },
- // editvisible: (scope: any) => {
- // if (ALLOW_EDIT_STATE.includes(scope.status) && Number(scope.searchParam.ifsaleout)) {
- // return true;
- // }
- // return false;
- // }
- // }
- // },
- {
- title: "运输方式",
- field: "transport_type",
- enum: [
- {
- label: "装车送货(装柜)",
- value: "装车送货(装柜)"
- },
- {
- label: "装车送货(送货运站)",
- value: "装车送货(送货运站)"
- }
- ],
- basicinfo: {
- el: "select",
- editable: (scope: any) => {
- if (ALLOW_EDIT_STATE.includes(scope.status) && Number(scope.searchParam.ifsaleout)) {
- return true;
- }
- return false;
- },
- editvisible: (scope: any) => {
- if (Number(scope.searchParam.ifsaleout)) {
- return true;
- }
- return false;
- }
- }
- },
- {
- title: "佣金点数",
- field: "commission",
- basicinfo: {
- el: "input",
- props: {
- placeholder: ifsaleout_default.commission + ""
- },
- rules: [{ validator: numCheck, trigger: "blur" }],
- editable: (scope: any) => {
- if (ALLOW_EDIT_STATE.includes(scope.status) && Number(scope.searchParam.ifsaleout)) {
- return true;
- }
- return false;
- },
- editvisible: (scope: any) => {
- if (Number(scope.searchParam.ifsaleout)) {
- return true;
- }
- return false;
- }
- }
- },
- {
- title: "额外点数",
- field: "other_rate",
- basicinfo: {
- el: "input",
- props: {
- placeholder: ifsaleout_default.other_rate + ""
- },
- rules: [{ validator: numCheck, trigger: "blur" }],
- editable: (scope: any) => {
- if (ALLOW_EDIT_STATE.includes(scope.status) && Number(scope.searchParam.ifsaleout)) {
- return true;
- }
- return false;
- },
- editvisible: (scope: any) => {
- if (Number(scope.searchParam.ifsaleout)) {
- return true;
- }
- return false;
- }
- }
- },
- {
- title: "FOB",
- field: "fob",
- basicinfo: {
- el: "input",
- props: {
- slots: {
- suffix: () => {
- return <>元</>;
- },
- append: () => {
- return <>元</>;
- }
- }
- },
- rules: [{ validator: numCheck, trigger: "blur" }],
- editable: (scope: any) => {
- if (ALLOW_EDIT_STATE.includes(scope.status) && Number(scope.searchParam.ifsaleout)) {
- return true;
- }
- return false;
- },
- editvisible: (scope: any) => {
- if (Number(scope.searchParam.ifsaleout)) {
- return true;
- }
- return false;
- }
- }
- },
- {
- title: "税率",
- field: "taxrate",
- basicinfo: {
- el: "input",
- props: {
- placeholder: ifsaleout_default.taxrate + ""
- },
- rules: [{ validator: numCheck, trigger: "blur" }],
- editable: (scope: any) => {
- if (ALLOW_EDIT_STATE.includes(scope.status) && Number(scope.searchParam.ifsaleout)) {
- return true;
- }
- return false;
- },
- editvisible: (scope: any) => {
- if (Number(scope.searchParam.ifsaleout)) {
- return true;
- }
- return false;
- }
- }
- },
- {
- title: "额外费用",
- field: "extras_cost",
- basicinfo: {
- el: "input",
- rules: [{ validator: numCheck, trigger: "blur" }],
- editable: (scope: any) => {
- if (ALLOW_EDIT_STATE.includes(scope.status) && Number(scope.searchParam.ifsaleout)) {
- return true;
- }
- return false;
- },
- editvisible: (scope: any) => {
- if (Number(scope.searchParam.ifsaleout)) {
- return true;
- }
- return false;
- }
- }
- },
- {
- title: "汇率",
- field: "moneyrate",
- basicinfo: {
- el: "input",
- props: {
- placeholder: ifsaleout_default.moneyrate + ""
- },
- rules: [{ validator: numCheck, trigger: "blur" }],
- editable: (scope: any) => {
- if (ALLOW_EDIT_STATE.includes(scope.status) && Number(scope.searchParam.ifsaleout)) {
- return true;
- }
- return false;
- },
- editvisible: (scope: any) => {
- if (Number(scope.searchParam.ifsaleout)) {
- return true;
- }
- return false;
- }
- }
- },
- {
- title: "额外费用备注",
- field: "extras_cost_dscrp",
- basicinfo: {
- el: "input",
- span: 2,
- props: { type: "textarea", rows: 2 },
- editable: (scope: any) => {
- if (ALLOW_EDIT_STATE.includes(scope.status) && Number(scope.searchParam.ifsaleout)) {
- return true;
- }
- return false;
- },
- editvisible: (scope: any) => {
- if (Number(scope.searchParam.ifsaleout)) {
- return true;
- }
- return false;
- }
- }
- },
- {
- field: "duo_qv_str",
- basicinfo: {
- el: "select",
- editable: (scope: any) => {
- if (ALLOW_EDIT_STATE.includes(scope.status) && Number(scope.searchParam.bednettypeid) == 11) {
- return true;
- }
- return false;
- },
- editvisible: (scope: any) => {
- if (Number(scope.searchParam.bednettypeid) == 11) {
- return true;
- }
- return false;
- },
- render: (scope: any) => {
- console.log("duo_qv_str scope :>> ", scope);
- let optionRender = [];
- scope.enum.map(item => {
- optionRender.push(<el-option label={item.label} value={item.value} />);
- });
- return (
- <>
- <el-select
- v-model={scope.searchParam.duo_qv_str}
- disabled={!ALLOW_EDIT_STATE.includes(scope.status)}
- clearable
- onChange={val => handelChangeDuoqv(val, scope.enum)}
- >
- {optionRender}
- </el-select>
- </>
- );
- }
- }
- }
- ];
- /**
- * @description 多区select,控制多区明细条数
- * @param val
- */
- const handelChangeDuoqv = (val: any, enumArr: any) => {
- console.log("duo_qv_str val :>> ", val);
- let item = enumArr.find((item: any) => item.value == val);
- let arr = getDuoquVal(item);
- console.log("state.vxeTableMxRef :>> ", state.vxeTableMxRef);
- // console.log("state.vxeTableMxRef.element.get :>> ", state.vxeTableMxRef.element.getTableData());
- // let { fullData } = state.vxeTableMxRef.element.getTableData();
- let num = arr.length;
- state.bednetMxData[0].if_part = Boolean(num > 1);
- console.log("fullData bednetMxData :>> ", state.bednetMxData);
- if (num > 1) {
- state.bednetMxData[0].springid = 0;
- state.bednetMxData[0].springname = "";
- nextTick(() => {
- setTimeout(async () => {
- console.log(
- "state.vxeTableMxSpringRef, state.vxeTableMxSpringRef.getTableData() :>> ",
- state.vxeTableMxSpringRef
- // state.vxeTableMxSpringRef.getTableData()
- );
- const $table = state.vxeTableMxSpringRef.element;
- if ($table) {
- const { fullData: springData } = $table.getTableData();
- console.log("handleAreaChange fullData :>> ", springData, num > 0 && springData.length < num);
- if (springData.length < num) {
- let arr = [];
- // let sum = Number(fullData[0].spring_qty_length);
- // let lengthValSum = 0;
- for (let i = 0; i < num - springData.length; i++) {
- // let lengthVal = 0;
- // if (i < num - springData.length - 1) {
- // if (sum > 0) {
- // lengthVal = (areaArr[i] / total) * sum;
- // lengthValSum += lengthVal;
- // }
- // } else {
- // lengthVal = sum - lengthValSum;
- // }
- // console.log("lengthVal :>> ", lengthVal);
- let _data = {
- ...dw_bednet_mx_spring,
- spring_qty_width: Number(state.bednetMxData[0].spring_qty_width),
- spring_qty_length: 0
- };
- arr.push(_data);
- }
- console.log("$table :>> ", $table, arr);
- await $table.insertAt(arr, -1);
- } else if (springData.length > num) {
- let arrs = springData.filter((item, index) => index + 1 > num);
- await $table.remove(arrs);
- }
- setMxSpringLength();
- }
- }, 200);
- });
- } else {
- // 1
- }
- };
- /**
- * @description 获取多区数据,数组化
- * @param item
- * @returns
- */
- const getDuoquVal = item => {
- let arr = [];
- for (const key in item) {
- if (key.indexOf("area_") > -1) {
- arr.push(Number(item[key]));
- }
- }
- // 忽略数组中尾部出现的多个0
- let i = arr.length - 1;
- while (arr[i] === 0) {
- i--;
- }
- arr = arr.slice(0, i + 1);
- return arr;
- };
- /**
- * @description 设置多区弹簧宽度
- */
- const setMxSpringWidth = row => {
- console.log("setMxSpringWidth val :>> ", row);
- // if (Number(row.if_part)) {
- // state.bednetMxSpringData = state.bednetMxSpringData.map(item => {
- // item.spring_qty_width = row.spring_qty_width;
- // return item;
- // });
- // }
- if (state.vxeTableMxSpringRef) {
- let { fullData: springData } = state.vxeTableMxSpringRef?.element.getTableData();
- springData.forEach((item, index) => {
- item.spring_qty_width = row.spring_qty_width;
- });
- console.log("state.vxeTableMxSpringRef.element :>> ", state.vxeTableMxSpringRef.element);
- state.vxeTableMxSpringRef.element.updateFooter();
- }
- };
- /**
- * @description 设置多区弹簧长度
- */
- const setMxSpringLength = () => {
- const { _mainData, enumMap } = state.LjDetailRef;
- console.log("setMxSpringLength object :>> ", _mainData, enumMap);
- let duoEnum = enumMap.get("duo_qv_str");
- let item = {};
- if (duoEnum) {
- item = duoEnum.find(t => t.value == _mainData.duo_qv_str);
- }
- console.log("setMxSpringLength item :>> ", item);
- let arr = getDuoquVal(item);
- let totality = arr.reduce((a, b) => a + b, 0);
- let { fullData } = state.vxeTableMxRef.element.getTableData();
- let sum = Number(fullData[0].spring_qty_length);
- console.log("arr, totality :>> ", arr, totality, sum);
- if (state.vxeTableMxSpringRef) {
- let { fullData: springData } = state.vxeTableMxSpringRef?.element.getTableData();
- let lengthValSum = 0;
- springData.forEach((item, index) => {
- let lengthVal = 0;
- if (arr.length >= index + 1) {
- console.log("index, arr.length :>> ", index, arr.length);
- if (index <= arr.length - 1) {
- console.log("index == arr.length - 1 :>> ", index, arr.length - 1);
- if (index == arr.length - 1) {
- lengthVal = sum - lengthValSum;
- console.log("lengthVal end:>> ", lengthVal, lengthValSum, sum);
- } else {
- lengthVal = formatIntNumber({ val: (arr[index] / totality) * sum });
- lengthValSum += Number(lengthVal);
- }
- } else {
- lengthVal = 0;
- }
- console.log("lengthVal :>> ", lengthVal);
- }
- item.spring_qty_length = lengthVal;
- });
- console.log("state.vxeTableMxSpringRef.element :>> ", state.vxeTableMxSpringRef.element);
- state.vxeTableMxSpringRef.element.updateFooter();
- }
- };
- const columnsMx_default = ref<ColumnProps<any>[]>([
- {
- field: "bednet_height",
- // editRender: {
- // name: "input"
- // }
- editRender: {},
- editColRender: (scope: any) => {
- const { column, row, status } = scope;
- return (
- <>
- <el-input
- v-model={row.bednet_height}
- onBlur={() => handleBlur(row.bednet_height, row, "bednet_height")}
- style="width: unset"
- />
- </>
- );
- }
- },
- {
- field: "spring_qty_width",
- datatype: "integer",
- editRender: {},
- editColRender: (scope: any) => {
- const { column, row, status } = scope;
- return (
- <>
- <el-input
- v-model={row.spring_qty_width}
- onBlur={() => handleBlur(row.spring_qty_width, row, "spring_qty_width")}
- onChange={() => setMxSpringWidth(row)}
- style="width: unset"
- />
- </>
- );
- }
- },
- {
- field: "spring_qty_length",
- editRender: {},
- editColRender: (scope: any) => {
- const { column, row, status } = scope;
- return (
- <>
- <el-input
- v-model={row.spring_qty_length}
- onBlur={() => handleBlur(row.spring_qty_length, row, "spring_qty_length")}
- onChange={() => setMxSpringLength()}
- style="width: unset"
- />
- </>
- );
- }
- },
- // {
- // field: "if_part"
- // editRender: {},
- // editColRender: (scope: any) => {
- // const { column, row, status } = scope;
- // console.log("if_part row :>> ", row);
- // if (Number(row.if_part) == 1) {
- // row.springid = 0;
- // row.springname = "";
- // }
- // return (
- // <>
- // <el-checkbox v-model={row.if_part} style="display: block"></el-checkbox>
- // </>
- // );
- // }
- // },
- {
- field: "springname",
- editRender: {},
- editColRender: (scope: any) => {
- const { column, row, status } = scope;
- let _label = column.title;
- return (
- <>
- <SpringSelect
- value={row.springid}
- disabled={Number(row.if_part) == 1}
- clearable
- placeholder={_label}
- onOpenModal={() => fModelChoseSpring(row, row.springid, rModelSetSpring)}
- onSelect={(val: any) => rModelSetSpring(row, val)}
- onClear={() => rModelClearSpring(row)}
- />
- </>
- );
- }
- },
- {
- field: "if_side_iron",
- editRender: {},
- editColRender: (scope: any) => {
- const { column, row, status } = scope;
- if (Number(row.if_side_iron) == 0) {
- row.side_iron_qty = 0;
- }
- return (
- <>
- <el-checkbox v-model={row.if_side_iron} class="vxe-edit-col-middle"></el-checkbox>
- </>
- );
- }
- },
- {
- field: "side_iron_qty",
- editRender: {},
- editColRender: (scope: any) => {
- const { column, row, status } = scope;
- return (
- <>
- <el-input v-model={row.side_iron_qty} disabled={Number(row.if_side_iron) == 0} />
- </>
- );
- }
- },
- {
- field: "if_hard_around",
- editRender: {},
- editColRender: (scope: any) => {
- const { column, row, status } = scope;
- if (Number(row.if_hard_around) == 0) {
- row.hard_around_springid = 0;
- row.hard_around_springname = "";
- row.hard_around_row = 0;
- }
- return (
- <>
- <el-checkbox v-model={row.if_hard_around} class="vxe-edit-col-middle"></el-checkbox>
- </>
- );
- }
- },
- {
- field: "hard_around_row",
- editRender: {},
- editColRender: (scope: any) => {
- const { column, row, status } = scope;
- return (
- <>
- <el-input v-model={row.hard_around_row} disabled={Number(row.if_hard_around) == 0} />
- </>
- );
- }
- },
- {
- field: "hard_around_springname",
- editRender: {},
- editColRender: (scope: any) => {
- console.log("hard_around_springname editColRender scope :>> ", scope);
- const { column, row, status } = scope;
- let _label = column.title;
- return (
- <>
- <SpringSelect
- value={row.hard_around_springid}
- disabled={Number(row.if_hard_around) == 0}
- clearable
- placeholder={_label}
- onOpenModal={() => fModelChoseSpring(row, row.hard_around_springid, rModelSetHardAroundSpring)}
- onSelect={(val: any) => rModelSetHardAroundSpring(row, val)}
- onClear={() => rModelClearHardAroundSpring(row)}
- />
- </>
- );
- }
- },
- {
- field: "if_15strip",
- editRender: {},
- editColRender: (scope: any) => {
- const { column, row, status } = scope;
- return (
- <>
- <el-checkbox v-model={row.if_15strip} class="vxe-edit-col-middle"></el-checkbox>
- </>
- );
- }
- },
- {
- field: "fabrics2_mtrlid",
- editRender: {},
- editColRender: (scope: any) => {
- const { column, row, status } = scope;
- let _label = column.title;
- return (
- <>
- <MtrldefSelect
- value={row.fabrics2_mtrlid}
- pricelistidfn={() => getPriceid()}
- mtrltype={2}
- clearable
- placeholder={_label}
- onOpenModal={() => fModelChoseMtrl(row, { mtrltype: 2 }, rModelSetMtrlFabrisc2)}
- onSelect={(val: any) => rModelSetMtrlFabrisc2(row, val)}
- onClear={() => rModelClearMtrlFabrisc2(row)}
- />
- </>
- );
- }
- },
- {
- field: "fabrics1_mtrlid",
- editRender: {},
- editColRender: (scope: any) => {
- const { column, row, status } = scope;
- let _label = column.title;
- return (
- <>
- <MtrldefSelect
- value={row.fabrics1_mtrlid}
- pricelistidfn={() => getPriceid()}
- mtrltype={2}
- clearable
- placeholder={_label}
- onOpenModal={() => fModelChoseMtrl(row, { mtrltype: 2 }, rModelSetMtrlFabrisc1)}
- onSelect={(val: any) => rModelSetMtrlFabrisc1(row, val)}
- onClear={() => rModelClearMtrlFabrisc1(row)}
- />
- </>
- );
- }
- }
- ]);
- const columnsMx = ref<ColumnProps<any>[]>();
- const columnsMxSpring = ref<ColumnProps<any>[]>([]);
- const columnsMxSpring_default = ref<ColumnProps<any>[]>([
- { title: "#", field: "pid", fixed: "left", width: 80 },
- {
- field: "springname",
- editRender: {},
- editColRender: (scope: any) => {
- console.log("springname editColRender scope :>> ", scope);
- const { column, row, status } = scope;
- let _label = column.title;
- return (
- <>
- <SpringSelect
- value={row.springid}
- disabled={Number(row.if_part) == 1}
- clearable
- placeholder={_label}
- onOpenModal={() => fModelChoseSpring(scope.row, row.springid, rModelSetSpring)}
- onSelect={(val: any) => rModelSetSpring(scope.row, val)}
- onClear={() => rModelClearSpring(scope.row)}
- />
- </>
- );
- }
- },
- {
- field: "spring_qty_width",
- editRender: {},
- editColRender: (scope: any) => {
- const { column, row, status } = scope;
- return (
- <>
- <el-input
- v-model={row.spring_qty_width}
- onBlur={() => handleBlur(row.spring_qty_width, row, "spring_qty_width")}
- style="width: unset"
- />
- </>
- );
- }
- },
- {
- field: "spring_qty_length",
- editRender: {},
- editColRender: (scope: any) => {
- const { column, row, status } = scope;
- return (
- <>
- <el-input
- v-model={row.spring_qty_length}
- onBlur={() => handleBlur(row.spring_qty_length, row, "spring_qty_length")}
- style="width: unset"
- />
- </>
- );
- }
- }
- ]);
- const columnsBednet = ref<ColumnProps<any>[]>([{}]);
- /**
- * @description 计算价格
- */
- const wf_cmp_cb = async () => {
- const { _mainData, enumMap, baseformRef } = state.LjDetailRef;
- wf_clear();
- wf_set_if_doublespring();
- if (!wf_check_rule()) return false;
- if (!(await wf_check_required())) return false;
- return true;
- };
- /**
- * @description 清除运算结果
- */
- const wf_clear = () => {
- const { _mainData } = state.LjDetailRef;
- _mainData.spring_mtrl_cost = 0;
- _mainData.spring_hr_cost = 0;
- _mainData.total_mtrl_cost = 0;
- _mainData.total_hr_cost = 0;
- _mainData.total_fees_cost = 0;
- _mainData.total_cost = 0;
- _mainData.nottax_factory_cost = 0;
- _mainData.nottax_dept_cost = 0;
- _mainData.dept_cost = 0;
- _mainData.foreign_cost = 0;
- _mainData.taxes = 0;
- _mainData.snake_wire_mtrl_cost = 0;
- _mainData.pocket_around_spring_cost = 0;
- _mainData.pocket_around_fabrics_cost = 0;
- _mainData.hard_around_mtrl_cost = 0;
- _mainData.hard_around_hr_cost = 0;
- _mainData.glue_price = 0;
- _mainData.felt_price = 0;
- _mainData.felt_mtrl_cost = 0;
- _mainData.felt_hr_cost = 0;
- _mainData.glue_mtrl_cost = 0;
- _mainData.fabrics1_mtrl_cost = 0;
- _mainData.fabrics2_mtrl_cost = 0;
- _mainData.side_iron_mtrl_cost = 0;
- _mainData.side_iron_hr_cost = 0;
- _mainData.side_iron_price = 0;
- _mainData.side_iron_lossrate = 0;
- _mainData.cnail_price = 0;
- _mainData.cnail_mtrl_cost = 0;
- _mainData.cnail_hr_cost = 0;
- _mainData.sponge_mtrl_cost = 0;
- _mainData.sponge_hr_cost = 0;
- _mainData.edge_mtrl_cost = 0;
- _mainData.edge_hr_cost = 0;
- _mainData.fork_mtrl_cost = 0;
- _mainData.fork_hr_cost = 0;
- _mainData.rsorwa_mtrl_cost = 0;
- _mainData.rsorwa_hr_cost = 0;
- _mainData.sponge_drilling_hr_cost = 0;
- _mainData.sponge_price = 0;
- _mainData.edge_price = 0;
- _mainData.fork_price = 0;
- _mainData.rsorwa_price = 0;
- _mainData.felt_mtrl_x_cost = 0;
- _mainData.packet_mtrl_cost = 0;
- _mainData.packet_hr_cost = 0;
- _mainData.sum_weight = 0;
- _mainData.spring_weight_qty = 0;
- _mainData.side_iron_weight_qty = 0;
- _mainData.hard_around_weight_qty = 0;
- _mainData.fabrics1_weight_qty = 0;
- _mainData.fabrics2_weight_qty = 0;
- _mainData.felt_weight_qty = 0;
- _mainData.cnail_weight_qty = 0;
- _mainData.sponge_weight_qty = 0;
- _mainData.sponge_weight_tc_qty = 0;
- _mainData.fork_weight_qty = 0;
- _mainData.edge_weight_qty = 0;
- };
- const wf_set_if_doublespring = () => {
- const { _mainData, enumMap } = state.LjDetailRef;
- const deptEnum = enumMap.get("deptid");
- const bednettypeEnum = enumMap.get("bednettypeid");
- let deptItem = deptEnum.find((item: any) => Number(item.value) == _mainData.deptid);
- let typeItem = bednettypeEnum.find((item: any) => Number(item.value) == _mainData.bednettypeid);
- console.log("typeItem :>> ", typeItem, deptItem);
- if (
- typeItem &&
- deptItem &&
- typeItem.label.indexOf("圆网") > -1 &&
- deptItem.label.indexOf("外贸") === -1 &&
- deptItem.label.indexOf("国外") === -1
- ) {
- _mainData.if_doublespring = 1;
- }
- };
- const wf_check_rule = (): boolean => {
- let { fullData: mxlist } = state.vxeTableMxRef.element.getTableData();
- if (!state.vxeTableMxSpringRef) {
- return true;
- }
- let { fullData: springlist } = state.vxeTableMxSpringRef.element.getTableData();
- for (let mx of mxlist) {
- //1.如果没有四周加硬 左边 弹簧个数排列宽 等于 右边每行 弹簧个数排列宽 , 左边 弹簧个数排列长 等于 右边每行合计 弹簧个数排列长
- if (Number(mx.if_hard_around) === 0) {
- // 左边 弹簧个数排列宽 等于 右边每行 弹簧个数排列宽
- let sum_length = 0;
- for (let spring of springlist) {
- sum_length += parseFloat(spring.spring_qty_length);
- if (Number(mx.spring_qty_width) != Number(spring.spring_qty_width)) {
- throw new Error(`多区袋装明细列表,第${spring.pid}行,弹簧个数排列宽填写错误!`);
- }
- }
- if (parseFloat(mx.spring_qty_length) != sum_length) {
- throw new Error(
- `床网明细列表 弹簧个数排列长${parseFloat(
- mx.spring_qty_length
- )}不等于 多区袋装明细列表 弹簧个数排列长合计${sum_length}!`
- );
- }
- } else if (Number(mx.if_hard_around) === 1) {
- // 左边 弹簧个数排列宽 小于 右边每行 弹簧个数排列宽
- let sum_length = 0;
- for (let spring of springlist) {
- sum_length += parseFloat(spring.spring_qty_length);
- if (Number(mx.spring_qty_width) < Number(spring.spring_qty_width)) {
- throw new Error(`多区袋装明细列表,第${spring.pid}行,弹簧个数排列宽填写错误!`);
- }
- }
- //左边 弹簧个数排列长 小于 右边每行合计 弹簧个数排列长
- if (parseFloat(mx.spring_qty_length) < sum_length) {
- throw new Error(
- `床网明细列表 弹簧个数排列长${parseFloat(
- mx.spring_qty_length
- )}小于 多区袋装明细列表 弹簧个数排列长合计${sum_length}!`
- );
- }
- }
- }
- return true;
- };
- const wf_check_required = async (): Promise<boolean> => {
- const { _mainData, enumMap } = state.LjDetailRef;
- let { fullData: mxlist } = state.vxeTableMxRef.element.getTableData();
- //检查有没有填写床网高
- for (let mx of mxlist) {
- if (mx.bednet_height + 0 == 0) {
- throw new Error("请填写床网高");
- } else {
- _mainData.mattress_height = parseFloat(mx.bednet_height);
- }
- }
- // 检查有没有 填写 填充海绵高
- if (_mainData.sponge_tc_mtrlid + 0 > 0) {
- if (_mainData.sponge_tc_thickness + 0 == 0) {
- throw new Error("请填写填充海绵厚度!");
- }
- if (_mainData.sponge_tc_height + 0 == 0) {
- throw new Error("请填写填充海绵厚度!");
- }
- if ((_mainData.sponge_tc_thickness + 0 > 0 || _mainData.sponge_tc_height + 0 > 0) && _mainData.sponge_tc_mtrlid + 0 == 0) {
- throw new Error("请选择填充海绵物料!");
- }
- }
- // 如果 没有填写 海绵高和封边高 自动等于 床网高
- if (_mainData.sponge_mtrlid > 0 && _mainData.sponge_height + 0 <= 0) _mainData.sponge_height = _mainData.mattress_height;
- if (_mainData.edge_mtrlid > 0 && _mainData.edge_height + 0 <= 0) _mainData.edge_height = _mainData.mattress_height;
- _mainData.commission = _mainData.commission && Number(_mainData.commission) !== 0 ? _mainData.commission : 1;
- _mainData.taxrate = _mainData.taxrate && Number(_mainData.taxrate) !== 0 ? _mainData.taxrate : 1;
- _mainData.other_rate = _mainData.other_rate && Number(_mainData.other_rate) !== 0 ? _mainData.other_rate : 1;
- _mainData.moneyrate = _mainData.moneyrate && Number(_mainData.moneyrate) !== 0 ? _mainData.moneyrate : 1;
- if (Number(_mainData.commission) < 1) {
- throw new Error("佣金点数不能小于1!");
- }
- if (Number(_mainData.taxrate) < 1) {
- throw new Error("税率不能小于1!");
- }
- if (Number(_mainData.other_rate) < 1) {
- throw new Error("额外点数不能小于1!");
- }
- if (_mainData.packtype && _mainData.packtype.length > 0) {
- _mainData.packtype = _mainData.packtype.trim();
- if (_mainData.packtype != "不压不卷" && _mainData.packqty + 0 == 0) {
- throw new Error("请填写包装数量!");
- }
- if (_mainData.packtype != "不压不卷" && _mainData.packtype != "裸包装" && _mainData.transport_type + "" == "") {
- throw new Error("请选择运输方式!");
- }
- if (_mainData.packtype == "卷包" && _mainData.packmtrl + "" == "") {
- throw new Error("请选择包装材料!");
- }
- }
- await wf_factory_profitrate();
- if (_mainData.dept_profitrate + 0 == 0) {
- throw new Error("部门利润率不能为0!");
- }
- if (_mainData.bednettypeid + 0 == 0) {
- throw new Error("请选择床网类别!");
- }
- if (_mainData.sponge_mtrlid + 0 > 0 && _mainData.sponge_thickness + 0 == 0) {
- throw new Error("请填写海绵厚度!");
- }
- if (_mainData.sponge_mtrlid + 0 == 0 && _mainData.sponge_thickness + 0 > 0) {
- throw new Error("请选择海绵物料!");
- }
- const bednettypeEnum = enumMap.get("bednettypeid");
- let typeItem = bednettypeEnum.find((item: any) => Number(item.value) == _mainData.bednettypeid);
- for (let mx of mxlist) {
- if (mx.bednet_height + 0 == 0) {
- throw new Error(`第${mx.pid}行,请填写床网高!`);
- }
- if (mx.spring_qty_width + 0 == 0) {
- throw new Error(`第${mx.pid}行,请填写弹簧排列个数-宽!`);
- }
- if (mx.spring_qty_length + 0 == 0) {
- throw new Error(`第${mx.pid}行,请填写弹簧排列个数-长!`);
- }
- if (typeItem.label.indexOf("袋装网") > -1 && mx.fabrics1_mtrlid + 0 == 0) {
- throw new Error(`第${mx.pid}行,请选择入袋无纺布!`);
- }
- if (mx.if_side_iron > 0 && mx.side_iron_qty + 0 == 0) {
- throw new Error(`第${mx.pid}行,请填写边铁条数!`);
- }
- }
- return true;
- };
- const wf_replace_expression = (arg_str: string, mx: any) => {
- const { _mainData, enumMap } = state.LjDetailRef;
- // 替换中文符号
- arg_str = arg_str.replace(/(/g, " ( ").replace(/)/g, " ) ");
- arg_str = arg_str.replace(/,/g, " , ");
- const bednettypeEnum = enumMap.get("bednettypeid");
- let typeItem = bednettypeEnum.find((item: any) => Number(item.value) == _mainData.bednettypeid);
- // 四周加硬逻辑
- if (mx.if_hard_around + 0 === 1) {
- let ls_temp_str = 0;
- if (typeItem.label.indexOf("袋装") > -1) {
- ls_temp_str = (mx.hard_around_row + 0) * 2;
- } else {
- ls_temp_str = mx.hard_around_row + 0;
- }
- let ls_temp_str_all = ` ( 【弹簧排列个数-宽】 - ${ls_temp_str} ) `;
- arg_str = replaceArgStr(arg_str, "【弹簧排列个数-宽】", ls_temp_str_all);
- ls_temp_str_all = ` ( 【弹簧计算个数(宽)】 - ${ls_temp_str} ) `;
- arg_str = replaceArgStr(arg_str, "【弹簧计算个数(宽)】", ls_temp_str_all);
- ls_temp_str_all = ` ( 【弹簧排列个数-长】 - ${ls_temp_str} ) `;
- arg_str = replaceArgStr(arg_str, "【弹簧排列个数-长】", ls_temp_str_all);
- ls_temp_str_all = ` ( 【弹簧计算个数(长)】 - ${ls_temp_str} ) `;
- arg_str = replaceArgStr(arg_str, "【弹簧计算个数(长)】", ls_temp_str_all);
- }
- // 四周口袋逻辑
- if (mx.if_pocket_around + 0 === 1) {
- let ls_temp_str = 0;
- if (typeItem.label.indexOf("袋装") > -1) {
- ls_temp_str = (mx.pocket_around_row + 0) * 2;
- } else {
- ls_temp_str = mx.pocket_around_row + 0;
- }
- let ls_temp_str_all = ` ( 【弹簧排列个数-宽】 - ${ls_temp_str} ) `;
- arg_str = replaceArgStr(arg_str, "【弹簧排列个数-宽】", ls_temp_str_all);
- ls_temp_str_all = ` ( 【弹簧计算个数(宽)】 - ${ls_temp_str} ) `;
- arg_str = replaceArgStr(arg_str, "【弹簧计算个数(宽)】", ls_temp_str_all);
- ls_temp_str_all = ` ( 【弹簧排列个数-长】 - ${ls_temp_str} ) `;
- arg_str = replaceArgStr(arg_str, "【弹簧排列个数-长】", ls_temp_str_all);
- ls_temp_str_all = ` ( 【弹簧计算个数(长)】 - ${ls_temp_str} ) `;
- arg_str = replaceArgStr(arg_str, "【弹簧计算个数(长)】", ls_temp_str_all);
- }
- return arg_str;
- };
- const wf_cmp_spring_mtrl_cost_dw2 = (arg_str: string, mx: any) => {
- const { _mainData, enumMap } = state.LjDetailRef;
- // 替换中文符号
- arg_str = arg_str.replace(/(/g, " ( ").replace(/)/g, " ) ");
- arg_str = arg_str.replace(/,/g, " , ");
- const bednettypeEnum = enumMap.get("bednettypeid");
- let typeItem = bednettypeEnum.find((item: any) => Number(item.value) == _mainData.bednettypeid);
- arg_str = replaceArgStr(arg_str, "【床垫宽】", _mainData.mattress_width);
- arg_str = replaceArgStr(arg_str, "【床垫长】", _mainData.mattress_length);
- arg_str = replaceArgStr(arg_str, "【床垫高】", _mainData.mattress_height);
- arg_str = replaceArgStr(arg_str, "【双簧】", _mainData.if_doublespring);
- arg_str = replaceArgStr(arg_str, "【床网类别】", typeItem.typename);
- for (let item of state.bednetVarList) {
- if (item.varvalue + 0 <= 0) continue;
- arg_str = replaceArgStr(arg_str, `【${item.varname}】`, item.varvalue + 0);
- }
- arg_str = replaceArgStr(arg_str, "【弹簧排列个数-宽】", mx.spring_qty_width);
- arg_str = replaceArgStr(arg_str, "【弹簧排列个数-长】", mx.spring_qty_length);
- arg_str = replaceArgStr(arg_str, "【弹簧计算个数(宽)】", mx.spring_qty_width);
- arg_str = replaceArgStr(arg_str, "【弹簧计算个数(长)】", mx.spring_qty_length);
- arg_str = replaceArgStr(arg_str, "【边铁条数】", mx.side_iron_qty);
- arg_str = replaceArgStr(arg_str, "【条数】", mx.side_iron_qty);
- };
- // 替换字符串
- const replaceArgStr = (arg_str: string, findStr: string, replaceStr: any) => {
- return arg_str.replace(findStr, replaceStr);
- };
- /**
- * @description 获取部门利润率
- */
- const wf_factory_profitrate = async () => {
- const { _mainData, enumMap } = state.LjDetailRef;
- console.log("wf_factory_profitrate enumMap :>> ", enumMap);
- let deptEnum = enumMap.get("deptid");
- console.log("deptEnum :>> ", deptEnum);
- if (deptEnum) {
- let depItem = deptEnum.find((item: any) => item.value == _mainData.deptid);
- console.log("depItem :>> ", depItem);
- if (depItem) {
- _mainData.dept_profitrate = parseFloat(depItem.profitrate);
- }
- }
- let _params = {
- dsname: "web_factory_profitratelist",
- queryparams: {
- arg_deptid: _mainData.deptid,
- arg_bednettypeid_mattresstypeid: _mainData.mattresstypeid,
- kind: 0
- }
- };
- let res = await CommonDynamicSelect(_params);
- if (res?.datatable?.length > 0) {
- _mainData.profitrate = parseFloat(res?.datatable[0].profitrate);
- }
- };
- const wf_bednet_var = async (varkind: Number, pricelistid: Number, bednettypeid: Number) => {
- let _params = {
- dsname: "web_bednet_var_define_cw",
- queryparams: {
- varkind,
- pricelistid,
- bednettypeid
- }
- };
- let res = await CommonDynamicSelect(_params);
- if (res?.datatable?.length > 0) {
- state.bednetVarList = res?.datatable;
- }
- };
- /**
- * @description 展示计算公式
- * @param timeout
- */
- const gotoSummy = async (timeout = 0, ifdrawer?: boolean) => {
- if (userInfo.usermode == 1) {
- ElMessage.error("'业务员模式不可以查看计算公式!'");
- return false;
- }
- console.log(
- "state.vxeTableMxRef?.element.getTableData().fullData :>> ",
- state.vxeTableMxRef?.element.getTableData().fullData,
- state.vxeTableMxRef
- );
- let bednet = cloneDeep(state.LjDetailRef._mainData);
- bednet.if_doublenet = Number(bednet.if_doublenet);
- bednet.if_doublespring = Number(bednet.if_doublespring);
- bednet.if_side_iron = Number(bednet.if_side_iron);
- bednet.if_rsorwa = Number(bednet.if_rsorwa);
- bednet.if_sponge_drilling = Number(bednet.if_sponge_drilling);
- bednet.iffork = Number(bednet.iffork);
- bednet.ifsaleout = Number(bednet.ifsaleout);
- bednet.if_jb = Number(bednet.if_jb);
- bednet.flag = Number(bednet.flag);
- let _params: any = {
- bednet: bednet,
- bednetMx: state.vxeTableMxRef?.element.getTableData().fullData ?? [],
- spring: state.vxeTableMxSpringRef?.element.getTableData().fullData ?? []
- };
- let res = await GetComputeBednet(_params);
- console.log("GetComputeBednet res :>> ", res);
- let summaryData = [];
- let fieldParams = [];
- let cpData = {};
- if (!res.message) {
- summaryData = res.formulas;
- fieldParams = res.replace;
- cpData = res.bednet;
- } else {
- setTimeout(() => {
- if (res.message) {
- ElNotification({
- title: "计算失败",
- message: res.message,
- type: "warning"
- });
- }
- }, 100);
- return false;
- }
- console.log("summaryData :>> ", summaryData, fieldParams);
- const toast = useToast();
- if (ifdrawer) {
- state.AllFormulaRef.open(summaryData, fieldParams, cpData);
- toast.clear();
- } else {
- toast(
- {
- component: ToastFormula,
- props: {
- t: t,
- formulas: summaryData,
- // data: cpData,
- fields: fieldParams
- },
- listeners: {
- tomore: () => {
- console.log("tomore summaryData :>> ", summaryData);
- state.AllFormulaRef.open(summaryData, fieldParams, cpData);
- toast.clear();
- },
- refresh: () => {
- gotoSummy();
- }
- }
- },
- {
- position: POSITION.BOTTOM_RIGHT,
- icon: false,
- timeout: timeout,
- closeButton: false,
- toastClassName: "longjoe-toast"
- }
- );
- }
- };
- return {
- ...toRefs(state),
- columns,
- columnsMx,
- columnsMxSpring,
- columnsBednet,
- dw_bednet_mx_spring,
- reload_dw2,
- getData,
- getDataMx,
- getDataMxSpring,
- getDataMxAdd,
- dataCallback,
- wf_cmp_cb,
- setMxSpringLength,
- gotoSummy
- };
- };
|