12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555 |
- 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, GetComputeSpring } 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;
- vxeTableRef: any;
- 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;
- cmpFormulas: any;
- cmpFormulaReplace: any;
- dannum_type: number;
- }
- /**
- * @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
- };
- /**
- * @description 床网报价hooks
- * @param t
- * @param props 床网入参
- * @returns
- */
- export const useHooks = (t?: any, props?: any) => {
- const state = reactive<defaultState>({
- orderStatus: "",
- vxeTableRef: null,
- LjDetailRef: null,
- vxeTableMxRef: null,
- vxeTableMxSpringRef: null,
- initParams: {},
- initParamsMx: {},
- initParamsMxSpring: {},
- bednetMxData: [],
- bednetMxSpringData: [],
- MtrldefDialogRef: null,
- MtrldefDialogProps: {},
- SpringDialogRef: null,
- SpringDialogProps: {},
- currentArea: null,
- AreaList: [],
- bednetVarList: [],
- AllFormulaRef: null,
- cmpFormulas: null,
- cmpFormulaReplace: null,
- dannum_type: 0
- });
- 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 rModelSetMxSpring = (data: any, item: any) => {
- console.log("rModelSetSpring data, item :>> ", data, item);
- if (item) {
- data.springid = item.springid;
- data.springname = item.springname;
- setMxSpringQtyWidthAndLength(data);
- }
- };
- /**
- * @description 填充海绵
- */
- const rModelSetSpring = (data: any, item: any) => {
- console.log("rModelSetSpring data, item :>> ", data, item);
- if (item) {
- data.springid = item.springid;
- data.springname = item.springname;
- }
- };
- 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 _arg_bedtypeid = -1;
- let _arg_newspring = 0;
- if (params?.arg_bednettypeid) {
- switch (params?.arg_bednettypeid) {
- case 11: // 袋装网
- _arg_bedtypeid = 0;
- _arg_newspring = 1;
- break;
- case 12: // 圆网
- _arg_bedtypeid = 2;
- break;
- case 13: // 拉丝网
- _arg_bedtypeid = 1;
- break;
- }
- }
- let _params = {
- // arg_springtypeid: "11", // 默认选择国内分类
- arg_newspring: _arg_newspring,
- arg_bedtypeid: _arg_bedtypeid,
- ...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_mtrlname = item.mtrlname;
- 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_mtrlname = item.mtrlname;
- 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.springname;
- }
- };
- const rModelClearHardAroundSpring = (data: any) => {
- data.hard_around_springid = 0;
- data.hard_around_springname = "";
- };
- const getPriceid = () => {
- let _deptid = state.LjDetailRef?._mainData?.deptid ?? 0;
- console.log("getPriceid _deptid :>> ", _deptid);
- 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.duo_qv_str = "三区";
- _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 = 0; // 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 = 0; // 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;
- console.log("wf_b_bednet_type_ch _mainData :>> ", _mainData);
- let _default = cloneDeep(dw_bednet_define_add_mx);
- // 袋网
- if (Number(rBednetType.bednettypeid) == 11) {
- _default.fabrics2_mtrlid = 8760;
- _default.fabrics1_mtrlid = 8759;
- }
- reload_dw2(rBednetType, ({ mx }) => {
- console.log("reload_dw2reload_dw2reload_dw2 mx :>> ", mx);
- let fabrics2Col = mx.tableinfo.columns.find(item => item.field == "fabrics2_mtrlid");
- let fabrics2Item = fabrics2Col.enum.find(item => item.value == _default.fabrics2_mtrlid);
- if (fabrics2Item) {
- _default.fabrics2_price = fabrics2Item.pricelistprice;
- }
- let fabrics1Col = mx.tableinfo.columns.find(item => item.field == "fabrics1_mtrlid");
- let fabrics1Item = fabrics1Col.enum.find(item => item.value == _default.fabrics1_mtrlid);
- if (fabrics1Item) {
- _default.fabrics1_price = fabrics1Item.pricelistprice;
- }
- state.bednetMxData = [_default];
- });
- 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;
- };
- /**
- * @description 获取部门汇率 和 折扣率
- */
- const wf_get_moneyrate_discount = (val: any, data) => {
- const { _mainData, enumMap } = state.LjDetailRef;
- let deptEnum = enumMap.get("deptid");
- console.log("deptEnum :>> ", deptEnum);
- if (deptEnum) {
- let depItem = deptEnum.find((item: any) => item.value == _mainData.deptid);
- if (depItem) {
- let _moneyrate = !depItem.moneyrate || Number(depItem.moneyrate) == 0 ? 1 : depItem.moneyrate;
- if (val == 0 || !_mainData.if_moneyrate) {
- data.moneyrate = 1;
- } else {
- data.moneyrate = _moneyrate;
- }
- data.discount = depItem.discount;
- }
- }
- };
- 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,
- onChange: val => {
- state.initParams.arg_deptid = val;
- }
- },
- order: 1
- },
- basicinfo: {
- // el: "select",
- // editable: ALLOW_EDIT_STATE,
- // rules: [{ required: true, message: "请先选择部门", trigger: "change" }],
- // props: {
- // filterable: true,
- // clearable: false
- // },
- editvisible: (scope: any) => {
- return !state.initParams?.deptid || state.initParams?.deptid == scope.searchParam.deptid;
- },
- 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: (scope: any) => {
- if (ALLOW_EDIT_STATE.includes(scope.status) && !Boolean(props.mattressWidth)) {
- return true;
- }
- return false;
- },
- rules: [{ validator: numCheck, trigger: "blur" }]
- }
- },
- {
- title: "床垫长/CM",
- field: "mattress_length",
- basicinfo: {
- el: "input",
- editable: (scope: any) => {
- if (ALLOW_EDIT_STATE.includes(scope.status) && !Boolean(props.mattressLength)) {
- return true;
- }
- return false;
- },
- 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 (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;
- }
- }
- },
- {
- 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>
- {["卷包", "不压不卷"].includes(scope.searchParam.packtype) ? (
- <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>
- ) : null}
- </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;
- // }
- render: (scope: any) => {
- let optionRender = [];
- let _disabled = !ALLOW_EDIT_STATE.includes(scope.status);
- scope.enum.map(item => {
- optionRender.push(<el-option label={item.label} value={item.value} />);
- });
- let slotprefix = {
- prefix: () => {
- return <>{scope.searchParam.moneyrate}</>;
- }
- };
- return (
- <el-select
- v-model={scope.searchParam.if_moneyrate}
- v-slots={slotprefix}
- class="select-text-right"
- disabled={_disabled}
- onChange={val => wf_get_moneyrate_discount(val, scope.searchParam)}
- >
- {optionRender}
- </el-select>
- );
- }
- }
- },
- {
- 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>
- </>
- );
- }
- }
- },
- {
- title: "是否备货",
- field: "if_stock_up",
- basicinfo: {
- el: "checkbox",
- editable: ALLOW_EDIT_STATE,
- props: {
- trueValue: 1,
- falseValue: 0
- }
- }
- }
- ];
- /**
- * @description 多区select,控制多区明细条数
- * @param val
- */
- const handelChangeDuoqv = (val: any, enumArr: any) => {
- console.log("duo_qv_str val :>> ", val);
- const { _mainData } = state.LjDetailRef;
- let item = enumArr.find((item: any) => item.value + "" == val);
- let attrKey = "area_";
- if (_mainData.sponge_mtrlid > 0) {
- attrKey = "sponge_";
- }
- let arr = getDuoquVal(item, attrKey);
- 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: any, attr = "area_") => {
- let arr = [];
- for (const key in item) {
- if (key.indexOf(attr) > -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 setMxSpringQtyWidthAndLength = async row => {
- if (row?.springid && Number(row.springid) > 0) {
- const { _mainData, enumMap } = state.LjDetailRef;
- let _pricelistid = getPriceid();
- let bednet = cloneDeep(_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);
- bednet.pricelistid = _pricelistid;
- let _bednetMx = state.vxeTableMxRef?.element.getTableData().fullData ?? [];
- _bednetMx.forEach(itm => {
- itm.if_part = Number(itm.if_part);
- });
- let _params: any = {
- bednet: bednet,
- bednetMx: _bednetMx,
- spring: state.vxeTableMxSpringRef?.element.getTableData().fullData ?? []
- };
- let res = await GetComputeSpring(_params);
- console.log("setMxSpringQtyWidthAndLength res :>> ", res);
- if (!res?.message) {
- row.spring_qty_width = res.bednetMx[0].spring_qty_width;
- row.spring_qty_length = res.bednetMx[0].spring_qty_length;
- }
- }
- };
- /**
- * @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 attrKey = "area_";
- if (_mainData.sponge_mtrlid > 0) {
- attrKey = "sponge_";
- }
- let arr = getDuoquVal(item, attrKey);
- 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")}
- onChange={() => setMxSpringQtyWidthAndLength(row)}
- 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: "springname",
- editRender: {},
- editColRender: (scope: any) => {
- const { column, row, status } = scope;
- let _label = column.title;
- return (
- <>
- <SpringSelect
- value={row.springid}
- argHeight={row.bednet_height}
- argBednettypeid={state.LjDetailRef._mainData.bednettypeid}
- disabled={Number(row.if_part) == 1}
- clearable
- placeholder={_label}
- onOpenModal={() =>
- fModelChoseSpring(
- row,
- { arg_height: row.bednet_height, arg_bednettypeid: state.LjDetailRef._mainData.bednettypeid },
- rModelSetMxSpring
- )
- }
- onSelect={(val: any) => rModelSetMxSpring(row, val)}
- onClear={() => rModelClearSpring(row)}
- >
- {{
- label: () => row.springname
- }}
- </SpringSelect>
- </>
- );
- }
- },
- {
- 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, {}, 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={scope.row.fabrics1_mtrlid}
- pricelistidfn={() => getPriceid()}
- mtrltype={2}
- clearable
- placeholder={_label}
- onOpenModal={() => fModelChoseMtrl(scope.row, { mtrltype: 2 }, rModelSetMtrlFabrisc1)}
- onSelect={(val: any) => rModelSetMtrlFabrisc1(scope.row, val)}
- onClear={() => rModelClearMtrlFabrisc1(scope.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;
- let { fullData: mxlist } = state.vxeTableMxRef.element.getTableData();
- return (
- <>
- <SpringSelect
- value={row.springid}
- disabled={Number(row.if_part) == 1}
- clearable
- placeholder={_label}
- onOpenModal={() =>
- fModelChoseSpring(
- scope.row,
- { arg_height: mxlist[0]?.bednet_height, arg_bednettypeid: state.LjDetailRef._mainData.bednettypeid },
- rModelSetSpring
- )
- }
- onSelect={(val: any) => rModelSetSpring(scope.row, val)}
- onClear={() => rModelClearSpring(scope.row)}
- >
- {{
- label: () => row.springname
- }}
- </SpringSelect>
- </>
- );
- }
- },
- {
- 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;
- };
- /**
- * @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);
- }
- };
- /**
- * @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);
- if (state.initParams?.deptid > 0 && state.initParams?.deptid != bednet.deptid) {
- bednet.deptid = state.initParams.deptid;
- }
- let _params: any = {
- dannum_type: state.dannum_type,
- 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;
- state.cmpFormulas = res.formulas;
- state.cmpFormulaReplace = res.replace;
- } 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
- };
- };
|